Assembla home | Assembla project page
 

Changeset 60

Show
Ignore:
Timestamp:
06/12/07 14:17:44 (1 year ago)
Author:
digitalspaghetti
Message:

Corrected new interface for Post, Page, Event. Fixed empty links going to top of screen

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branch/controllers/events_controller.php

    r55 r60  
    33 
    44        var $name = 'Events'; 
    5         var $helpers = array('Html', 'Form' ); 
     5        var $uses = array('Event', 'Group'); 
    66 
    77        function index() { 
     
    8989        function admin_add() { 
    9090                if(!empty($this->data)) { 
     91                        $this->data['Event']['user_id'] = $this->othAuth->user('id'); 
    9192                        $this->cleanUpFields(); 
    9293                        $this->Event->create(); 
  • branch/controllers/menus_controller.php

    r57 r60  
    33 
    44        var $name = 'Menus'; 
    5         var $helpers = array('Html', 'Form' ); 
    6  
    75        var $uses = array('Menu','Group'); 
    86 
  • branch/controllers/pages_controller.php

    r55 r60  
    11<?php 
    2 /* SVN FILE: $Id: pages_controller.php 5118 2007-05-18 17:19:53Z phpnut $ */ 
     2class PagesController extends AppController { 
    33 
    4 /** 
    5  * Short description for file. 
    6  * 
    7  * This file is application-wide controller file. You can put all 
    8  * application-wide controller-related methods here. 
    9  * 
    10  * PHP versions 4 and 5 
    11  * 
    12  * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/> 
    13  * Copyright 2005-2007, Cake Software Foundation, Inc. 
    14  *                                                              1785 E. Sahara Avenue, Suite 490-204 
    15  *                                                              Las Vegas, Nevada 89104 
    16  * 
    17  * Licensed under The MIT License 
    18  * Redistributions of files must retain the above copyright notice. 
    19  * 
    20  * @filesource 
    21  * @copyright           Copyright 2005-2007, Cake Software Foundation, Inc. 
    22  * @link                                http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project 
    23  * @package                     cake 
    24  * @subpackage          cake.app.controllers 
    25  * @since                       CakePHP(tm) v 0.2.9 
    26  * @version                     $Revision: 5118 $ 
    27  * @modifiedby          $LastChangedBy: phpnut $ 
    28  * @lastmodified        $Date: 2007-05-18 18:19:53 +0100 (Fri, 18 May 2007) $ 
    29  * @license                     http://www.opensource.org/licenses/mit-license.php The MIT License 
    30  */ 
     4        var $name = 'Pages'; 
     5        var $uses = array('Page', 'Group' ); 
    316 
    32 /** 
    33  * Short description for class. 
    34  * 
    35  * This file is application-wide controller file. You can put all 
    36  * application-wide controller-related methods here. 
    37  * 
    38  * Add your application-wide methods in the class below, your controllers 
    39  * will inherit them. 
    40  * 
    41  * @package             cake 
    42  * @subpackage  cake.app.controllers 
    43  */ 
    44 class PagesController extends AppController{ 
     7        function index() { 
     8                $this->Page->recursive = 0; 
     9                $this->set('pages', $this->paginate()); 
     10        } 
    4511 
    46 /** 
    47  * Enter description here... 
    48  * 
    49  * @var unknown_type 
    50  */ 
    51          var $name = 'Pages'; 
     12        function view($id = null) { 
     13                if(!$id) { 
     14                        $this->Session->setFlash('Invalid Page.'); 
     15                        $this->redirect(array('action'=>'index'), null, true); 
     16                } 
     17                $this->set('page', $this->Page->findByStub($id)); 
     18        } 
    5219 
    53 /** 
    54  * Enter description here... 
    55  * 
    56  * @var unknown_type 
    57  */ 
    58          var $helpers = array('Html'); 
     20        function add() { 
     21                if(!empty($this->data)) { 
     22                        $this->cleanUpFields(); 
     23                        $this->Page->create(); 
     24                        if($this->Page->save($this->data)) { 
     25                                $this->Session->setFlash('The Page has been saved'); 
     26                                $this->redirect(array('action'=>'index'), null, true); 
     27                        } else { 
     28                                $this->Session->setFlash('The Page could not be saved. Please, try again.'); 
     29                        } 
     30                } 
     31                $tags = $this->Page->Tag->generateList(); 
     32                $users = $this->Page->User->generateList(); 
     33                $subjects = $this->Page->Subject->generateList(); 
     34                $this->set(compact('tags', 'users', 'subjects')); 
     35        } 
    5936 
    60 /** 
    61  * This controller does not use a model 
    62  * 
    63  * @var $uses 
    64  */ 
    65          var $uses = null; 
     37        function edit($id = null) { 
     38                if(!$id && empty($this->data)) { 
     39                        $this->Session->setFlash('Invalid Page'); 
     40                        $this->redirect(array('action'=>'index'), null, true); 
     41                } 
     42                if(!empty($this->data)) { 
     43                        $this->cleanUpFields(); 
     44                        if($this->Page->save($this->data)) { 
     45                                $this->Session->setFlash('The Page saved'); 
     46                                $this->redirect(array('action'=>'index'), null, true); 
     47                        } else { 
     48                                $this->Session->setFlash('The Page could not be saved. Please, try again.'); 
     49                        } 
     50                } 
     51                if(empty($this->data)) { 
     52                        $this->data = $this->Page->read(null, $id); 
     53                } 
     54                $tags = $this->Page->Tag->generateList(); 
     55                $users = $this->Page->User->generateList(); 
     56                $subjects = $this->Page->Subject->generateList(); 
     57                $this->set(compact('tags','users','subjects')); 
     58        } 
    6659 
    67 /** 
    68  * Displays a view 
    69  * 
    70  */ 
    71          function display() { 
    72                   if (!func_num_args()) { 
    73                                 $this->redirect('/'); 
    74                   } 
     60        function delete($id = null) { 
     61                if(!$id) { 
     62                        $this->Session->setFlash('Invalid id for Page'); 
     63                        $this->redirect(array('action'=>'index'), null, true); 
     64                } 
     65                if($this->Page->del($id)) { 
     66                        $this->Session->setFlash('Page #'.$id.' deleted'); 
     67                        $this->redirect(array('action'=>'index'), null, true); 
     68                } 
     69        } 
    7570 
    76                   $path=func_get_args(); 
    7771 
    78                   if (!count($path)) { 
    79                                 $this->redirect('/'); 
    80                   } 
     72        function admin_index() { 
     73                $this->Page->recursive = 0; 
     74                $this->set('pages', $this->paginate()); 
     75        } 
    8176 
    82                   $count  =count($path); 
    83                   $page   =null; 
    84                   $subpage=null; 
    85                   $title  =null; 
     77        function admin_view($id = null) { 
     78                if(!$id) { 
     79                        $this->Session->setFlash('Invalid Page.'); 
     80                        $this->redirect(array('action'=>'index'), null, true); 
     81                } 
     82                $this->set('page', $this->Page->read(null, $id)); 
     83        } 
    8684 
    87                   if (!empty($path[0])) { 
    88                                 $page = $path[0]; 
    89                   } 
     85        function admin_add() { 
     86                if(!empty($this->data)) { 
     87                        $this->data['Page']['user_id'] = $this->othAuth->user('id'); 
     88                        $this->cleanUpFields(); 
     89                        $this->Page->create(); 
     90                        if($this->Page->save($this->data)) { 
     91                                $this->Session->setFlash('The Page has been saved'); 
     92                                $this->redirect(array('action'=>'index'), null, true); 
     93                        } else { 
     94                                $this->Session->setFlash('The Page could not be saved. Please, try again.'); 
     95                        } 
     96                } 
     97                $this->set('access_levels', $this->Group->generateList(null, 'Group.name ASC', null,'{n}.Group.level', '{n}.Group.name')); 
     98                $this->set('subjects', $this->Page->Subject->generateList()); 
     99        } 
    90100 
    91                   if (!empty($path[1])) { 
    92                                 $subpage = $path[1]; 
    93                   } 
     101        function admin_edit($id = null) { 
     102                if(!$id && empty($this->data)) { 
     103                        $this->Session->setFlash('Invalid Page'); 
     104                        $this->redirect(array('action'=>'index'), null, true); 
     105                } 
     106                if(!empty($this->data)) { 
     107                        $this->cleanUpFields(); 
     108                        if($this->Page->save($this->data)) { 
     109                                $this->Session->setFlash('The Page saved'); 
     110                                $this->redirect(array('action'=>'index'), null, true); 
     111                        } else { 
     112                                $this->Session->setFlash('The Page could not be saved. Please, try again.'); 
     113                        } 
     114                } 
     115                if(empty($this->data)) { 
     116                        $this->data = $this->Page->read(null, $id); 
     117                } 
     118                $this->set('access_levels', $this->Group->generateList(null, 'Group.name ASC', null,'{n}.Group.level', '{n}.Group.name')); 
     119                $this->set('subjects', $this->Page->Subject->generateList()); 
     120        } 
    94121 
    95                   if (!empty($path[$count - 1])) { 
    96                                 $title = ucfirst($path[$count - 1]); 
    97                   } 
     122        function admin_delete($id = null) { 
     123                if(!$id) { 
     124                        $this->Session->setFlash('Invalid id for Page'); 
     125                        $this->redirect(array('action'=>'index'), null, true); 
     126                } 
     127                if($this->Page->del($id)) { 
     128                        $this->Session->setFlash('Page #'.$id.' deleted'); 
     129                        $this->redirect(array('action'=>'index'), null, true); 
     130                } 
     131        } 
    98132 
    99                   $this->set('page', $page); 
    100                   $this->set('subpage', $subpage); 
    101                   $this->set('title', $title); 
    102                   $this->render(join('/', $path)); 
    103          } 
    104133} 
    105134?> 
  • branch/controllers/posts_controller.php

    r58 r60  
    130130                        if($this->Post->save($this->data)) { 
    131131                                $this->Session->setFlash('The Post saved'); 
    132                                 //$this->redirect(array('action'=>'index'), null, true); 
    133                                 pr($this->data); 
     132                                $this->redirect(array('action'=>'index'), null, true); 
    134133                        } else { 
    135134                                $this->Session->setFlash('The Post could not be saved. Please, try again.'); 
  • branch/models/event.php

    r55 r60  
    5454                                                'limit' => '', 
    5555                                                'offset' => '', 
    56                                                 'unique' => ''
     56                                                'unique' => true
    5757                                                'finderQuery' => '', 
    5858                                                'deleteQuery' => '', 
  • branch/models/page.php

    r55 r60  
    44        var $name = 'Page'; 
    55        var $validate = array( 
    6                 'url' => VALID_NOT_EMPTY, 
    76                'title' => VALID_NOT_EMPTY, 
    87                'body' => VALID_NOT_EMPTY, 
     
    4443                                                'insertQuery' => ''), 
    4544        ); 
    46  
     45         
     46        function beforeSave() 
     47    { 
     48        $this->data[$this->name]['stub'] = $this->getUniqueUrl($this->data[$this->name]['title'], 'stub'); 
     49         
     50        return true; 
     51    }  
    4752} 
    4853?> 
  • branch/models/post.php

    r58 r60  
    88                'body' => VALID_NOT_EMPTY, 
    99                'post_date' => VALID_NOT_EMPTY, 
    10                 'comments_count' => VALID_NOT_EMPTY, 
    1110                'user_id' => VALID_NOT_EMPTY, 
    1211                'subject_id' => VALID_NOT_EMPTY, 
    1312                'access_level' => VALID_NOT_EMPTY, 
    14                 /*'stub' => VALID_NOT_EMPTY,*/ 
    1513                'tags' => VALID_NOT_EMPTY, 
    1614                'published' => VALID_NOT_EMPTY, 
  • branch/views/events/admin_add.ctp

    r55 r60  
    22<h2>New Event</h2> 
    33        <?php echo $form->create('Event');?> 
    4                 <?php echo $form->input('venue', array('class' => 'required'));?> 
    5                 <?php echo $form->input('address');?> 
    6                 <?php echo $form->input('city', array('class' => 'required'));?> 
    7                 <?php echo $form->input('country_id', array('class' => 'required', 'options' => $countries));?> 
    8                 <?php echo $form->input('postcode', array('class' => 'required'));?> 
    9                 <?php echo $form->input('event_type_id', array('class' => 'required', 'options' => $eventTypes));?> 
    10                 <?php echo $form->input('event_date', array('class' => 'required'));?> 
    11                 <?php echo $form->input('event_time');?> 
    12                 <?php echo $form->input('event_url');?> 
    13                 <?php echo $form->input('notes');?> 
    14                 <?php echo $form->input('tags', array('class' => 'required'));?> 
    15                 <?php echo $form->input('user_id', array('class' => 'required', 'options' => $users));?> 
    16                 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
    17                 <?php echo $form->input('published', array('class' => 'required'));?> 
    18                 <?php echo $form->input('Tag/Tag', array('options' => $tags, 'multiple' => 'multiple'));?> 
    19                 <?php echo $form->submit('Add');?> 
     4                <fieldset id="main-content"> 
     5                        <legend>Main Content</legend> 
     6                        <?php echo $form->input('venue', array('class' => 'required'));?> 
     7                        <?php echo $form->input('address');?> 
     8                        <?php echo $form->input('city', array('class' => 'required'));?> 
     9                        <?php echo $form->input('country_id', array('class' => 'required', 'options' => $countries));?> 
     10                        <?php echo $form->input('postcode', array('class' => 'required'));?> 
     11                        <?php echo $form->input('event_type_id', array('class' => 'required', 'options' => $eventTypes));?> 
     12                        <?php echo $form->input('event_date', array('class' => 'required'));?> 
     13                        <?php echo $form->input('event_time');?> 
     14                        <?php echo $form->input('event_url');?> 
     15                </fieldset> 
     16                 
     17                <fieldset id="meta-content"> 
     18                        <legend>Meta Data</legend> 
     19                        <?php echo $form->input('body',array('class'=>'wymeditor'));?> 
     20                        <?php echo $form->input('tags', array('class' => 'required', 'type'=>'text'));?> 
     21                        <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
     22                </fieldset> 
     23                 
     24                <fieldset id="publishing-options"> 
     25                        <legend>Publishing Options</legend> 
     26                        <?php echo $form->input('published', array('class' => 'required'));?> 
     27                </fieldset> 
     28                 
     29                <?php echo $form->submit('Add', array('class'=>'wymupdate'));?> 
    2030        </form> 
    2131</div> 
    22 <div class="actions"> 
    23         <ul> 
    24                 <li><?php echo $html->link('List Events', array('action'=>'index')); ?></li> 
    25                 <li><?php echo $html->link('View Countries', array('controller'=> 'countries', 'action'=>'view'));?></li> 
    26                 <li><?php echo $html->link('Add Countries', array('controller'=> 'countries', 'action'=>'add')); ?></li> 
    27                 <li><?php echo $html->link('View Event Types', array('controller'=> 'event_types', 'action'=>'view'));?></li> 
    28                 <li><?php echo $html->link('Add Event Types', array('controller'=> 'event_types', 'action'=>'add')); ?></li> 
    29                 <li><?php echo $html->link('View Users', array('controller'=> 'users', 'action'=>'view'));?></li> 
    30                 <li><?php echo $html->link('Add Users', array('controller'=> 'users', 'action'=>'add')); ?></li> 
    31                 <li><?php echo $html->link('View Subjects', array('controller'=> 'subjects', 'action'=>'view'));?></li> 
    32                 <li><?php echo $html->link('Add Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?></li> 
    33         </ul> 
    34 </div> 
  • branch/views/events/admin_edit.ctp

    r55 r60  
    22<h2>Edit Event</h2> 
    33        <?php echo $form->create('Event');?> 
    4                 <?php echo $form->input('id');?> 
    5                 <?php echo $form->input('venue', array('class' => 'required'));?> 
    6                 <?php echo $form->input('address');?> 
    7                 <?php echo $form->input('city', array('class' => 'required'));?> 
    8                 <?php echo $form->input('country_id', array('class' => 'required', 'options' => $countries));?> 
    9                 <?php echo $form->input('postcode', array('class' => 'required'));?> 
    10                 <?php echo $form->input('event_type_id', array('class' => 'required', 'options' => $eventTypes));?> 
    11                 <?php echo $form->input('event_date', array('class' => 'required'));?> 
    12                 <?php echo $form->input('event_time');?> 
    13                 <?php echo $form->input('event_url');?> 
    14                 <?php echo $form->input('notes');?> 
    15                 <?php echo $form->input('tags', array('class' => 'required'));?> 
    16                 <?php echo $form->input('user_id', array('class' => 'required', 'options' => $users));?> 
    17                 <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
    18                 <?php echo $form->input('published', array('class' => 'required'));?> 
    19                 <?php echo $form->input('Tag/Tag', array('options' => $tags, 'multiple' => 'multiple'));?> 
    20                 <?php echo $form->submit('Update');?> 
     4                <fieldset id="main-content"> 
     5                        <legend>Main Content</legend> 
     6                        <?php echo $form->input('id');?> 
     7                        <?php echo $form->input('venue', array('class' => 'required'));?> 
     8                        <?php echo $form->input('address');?> 
     9                        <?php echo $form->input('city', array('class' => 'required'));?> 
     10                        <?php echo $form->input('country_id', array('class' => 'required', 'options' => $countries));?> 
     11                        <?php echo $form->input('postcode', array('class' => 'required'));?> 
     12                        <?php echo $form->input('event_type_id', array('class' => 'required', 'options' => $eventTypes));?> 
     13                        <?php echo $form->input('event_date', array('class' => 'required'));?> 
     14                        <?php echo $form->input('event_time');?> 
     15                        <?php echo $form->input('event_url');?> 
     16                </fieldset> 
     17                 
     18                <fieldset id="meta-content"> 
     19                        <legend>Meta Data</legend> 
     20                        <?php echo $form->input('body',array('class'=>'wymeditor'));?> 
     21                        <?php echo $form->input('tags', array('class' => 'required', 'type'=>'text'));?> 
     22                        <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
     23                </fieldset> 
     24                 
     25                <fieldset id="publishing-options"> 
     26                        <legend>Publishing Options</legend> 
     27                        <?php echo $form->input('published', array('class' => 'required'));?> 
     28                </fieldset> 
     29                 
     30                <?php echo $form->submit('Add', array('class'=>'wymupdate'));?> 
     31                <?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Event/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Event/id')); ?> 
    2132        </form> 
    2233</div> 
    23 <div class="actions"> 
    24         <ul> 
    25                 <li><?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Event/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Event/id')); ?> 
    26                 <li><?php echo $html->link('List Events', array('action'=>'index')); ?></li> 
    27                 <li><?php echo $html->link('View Countries', array('controller'=> 'countries', 'action'=>'view')); ?></li> 
    28                 <li><?php echo $html->link('Add Countries', array('controller'=> 'countries', 'action'=>'add')); ?></li> 
    29                 <li><?php echo $html->link('View Event Types', array('controller'=> 'event_types', 'action'=>'view')); ?></li> 
    30                 <li><?php echo $html->link('Add Event Types', array('controller'=> 'event_types', 'action'=>'add')); ?></li> 
    31                 <li><?php echo $html->link('View Users', array('controller'=> 'users', 'action'=>'view')); ?></li> 
    32                 <li><?php echo $html->link('Add Users', array('controller'=> 'users', 'action'=>'add')); ?></li> 
    33                 <li><?php echo $html->link('View Subjects', array('controller'=> 'subjects', 'action'=>'view')); ?></li> 
    34                 <li><?php echo $html->link('Add Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?></li> 
    35         </ul> 
    36 </div> 
  • branch/views/events/admin_index.ctp

    r55 r60  
    1 <div class="events"> 
    2 <h2>List Events</h2> 
    3  
    4 <table cellpadding="0" cellspacing="0"> 
    5         <tr> 
    6                 <th><?php echo $paginator->sort('id');?></th> 
    7                 <th><?php echo $paginator->sort('venue');?></th> 
    8                 <th><?php echo $paginator->sort('address');?></th> 
    9                 <th><?php echo $paginator->sort('city');?></th> 
    10                 <th><?php echo $paginator->sort('country_id');?></th> 
    11                 <th><?php echo $paginator->sort('postcode');?></th> 
    12                 <th><?php echo $paginator->sort('event_type_id');?></th> 
    13                 <th><?php echo $paginator->sort('event_date');?></th> 
    14                 <th><?php echo $paginator->sort('event_time');?></th> 
    15                 <th><?php echo $paginator->sort('event_url');?></th> 
    16                 <th><?php echo $paginator->sort('notes');?></th> 
    17                 <th><?php echo $paginator->sort('tags');?></th> 
    18                 <th><?php echo $paginator->sort('user_id');?></th> 
    19                 <th><?php echo $paginator->sort('subject_id');?></th> 
    20                 <th><?php echo $paginator->sort('published');?></th> 
    21                 <th>Actions</th> 
    22         </tr> 
    23 <?php foreach ($events as $event): ?> 
    24         <tr> 
    25                 <td><?php echo $event['Event']['id']; ?></td> 
    26                 <td><?php echo $event['Event']['venue']; ?></td> 
    27                 <td><?php echo $event['Event']['address']; ?></td> 
    28                 <td><?php echo $event['Event']['city']; ?></td> 
    29                 <td><?php echo $html->link($event['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $event['Country']['id'])); ?></td> 
    30                 <td><?php echo $event['Event']['postcode']; ?></td> 
    31                 <td><?php echo $html->link($event['EventType']['title'], array('controller'=> 'event_types', 'action'=>'view', $event['EventType']['id'])); ?></td> 
    32                 <td><?php echo $event['Event']['event_date']; ?></td> 
    33                 <td><?php echo $event['Event']['event_time']; ?></td> 
    34                 <td><?php echo $event['Event']['event_url']; ?></td> 
    35                 <td><?php echo $event['Event']['notes']; ?></td> 
    36                 <td><?php echo $event['Event']['tags']; ?></td> 
    37                 <td><?php echo $html->link($event['User']['name'], array('controller'=> 'users', 'action'=>'view', $event['User']['id'])); ?></td> 
    38                 <td><?php echo $html->link($event['Subject']['title'], array('controller'=> 'subjects', 'action'=>'view', $event['Subject']['id'])); ?></td> 
    39                 <td><?php echo $event['Event']['published']; ?></td> 
    40                 <td class="actions"> 
    41                         <?php echo $html->link('View', array('action'=>'view', $event['Event']['id'])); ?> 
    42                         <?php echo $html->link('Edit', array('action'=>'edit', $event['Event']['id'])); ?> 
    43                         <?php echo $html->link('Delete', array('action'=>'delete', $event['Event']['id']), null, 'Are you sure you want to delete #' . $event['Event']['id']); ?> 
    44                 </td> 
    45         </tr> 
    46 <?php endforeach; ?> 
    47 </table> 
    48  
    49 </div> 
    50 <div class="paging"> 
    51 <?php echo $paginator->prev('<< previous', array(), null, array('class'=>'disabled'));?> 
    52 
    53 <?php echo $paginator->next('next >>', array(), null, array('class'=>'disabled'));?> 
    54 </div> 
     1<?php if ($events) { ?> 
     2        <div class="events"> 
     3        <h2>List Events</h2> 
     4         
     5        <table cellpadding="0" cellspacing="0"> 
     6                <tr> 
     7                        <th><?php echo $paginator->sort('id');?></th> 
     8                        <th><?php echo $paginator->sort('venue');?></th> 
     9                        <th><?php echo $paginator->sort('event_type_id');?></th> 
     10                        <th><?php echo $paginator->sort('event_date');?></th> 
     11                        <th><?php echo $paginator->sort('event_time');?></th> 
     12                        <th><?php echo $paginator->sort('tags');?></th> 
     13                        <th><?php echo $paginator->sort('user_id');?></th> 
     14                        <th><?php echo $paginator->sort('subject_id');?></th> 
     15                        <th><?php echo $paginator->sort('published');?></th> 
     16                        <th>Actions</th> 
     17                </tr> 
     18        <?php foreach ($events as $event): ?> 
     19                <tr> 
     20                        <td><?php echo $event['Event']['id']; ?></td> 
     21                        <td> 
     22                                <?php echo $event['Event']['venue']; ?><br /> 
     23                                <?php echo $event['Event']['address']; ?><br /> 
     24                                <?php echo $event['Event']['city']; ?><br /> 
     25                                <?php echo $html->link($event['Country']['name'], array('controller'=> 'countries', 'action'=>'view', $event['Country']['id'])); ?><br /> 
     26                                <?php echo $event['Event']['postcode']; ?>       
     27                        </td> 
     28                        <td><?php echo $html->link($event['EventType']['title'], array('controller'=> 'event_types', 'action'=>'view', $event['EventType']['id'])); ?></td> 
     29                        <td><?php echo $event['Event']['event_date']; ?></td> 
     30                        <td><?php echo $event['Event']['event_time']; ?></td> 
     31                        <td><?php echo $event['Event']['tags']; ?></td> 
     32                        <td><?php echo $html->link($event['User']['name'], array('controller'=> 'users', 'action'=>'view', $event['User']['id'])); ?></td> 
     33                        <td><?php echo $html->link($event['Subject']['title'], array('controller'=> 'subjects', 'action'=>'view', $event['Subject']['id'])); ?></td> 
     34                        <td><?php echo $event['Event']['published']; ?></td> 
     35                        <td class="actions"> 
     36                                <?php echo $html->link('View', array('action'=>'view', $event['Event']['id'])); ?> 
     37                                <?php echo $html->link('Edit', array('action'=>'edit', $event['Event']['id'])); ?> 
     38                                <?php echo $html->link('Delete', array('action'=>'delete', $event['Event']['id']), null, 'Are you sure you want to delete #' . $event['Event']['id']); ?> 
     39                        </td> 
     40                </tr> 
     41        <?php endforeach; ?> 
     42        </table> 
     43         
     44        </div> 
     45        <div class="paging"> 
     46        <?php echo $paginator->prev('<< previous', array(), null, array('class'=>'disabled'));?> 
     47        | 
     48        <?php echo $paginator->next('next >>', array(), null, array('class'=>'disabled'));?> 
     49        </div> 
     50<?php } else { ?> 
     51        <h2>There are currently no events. Click <?php echo $html->link('here', array('action'=>'add')); ?> to create one.</h2> 
     52<?php } ?> 
    5553<div class="actions"> 
    5654        <ul> 
  • branch/views/helpers/tree_menu.php

    r57 r60  
    1111                        if ($this->othAuth->group('level') >=$value['Menu']['access_level']){ 
    1212                                $output .= '<li>'; 
    13                                 $output .= $this->Html->link($value['Menu']['name'],$value['Menu']['url']); 
     13                                if ($value['Menu']['url'] == '#') { 
     14                                        $onclick = array('onclick'=>'javascript:return false;'); 
     15                                } else { 
     16                                        $onclick = null; 
     17                                } 
     18                                $output .= $this->Html->link($value['Menu']['name'],$value['Menu']['url'], $onclick); 
    1419                                if (isset($value['children']) && count($value['children'])) 
    1520                                { 
  • branch/views/pages/add.ctp

    r55 r60  
    22<h2>New Page</h2> 
    33        <?php echo $form->create('Page');?> 
     4                <?php echo $form->input('url', array('class' => 'required'));?> 
     5                <?php echo $form->input('title', array('class' => 'required'));?> 
     6                <?php echo $form->input('body', array('class' => 'required'));?> 
     7                <?php echo $form->input('published', array('class' => 'required'));?> 
     8                <?php echo $form->input('user_id', array('class' => 'required', 'options' => $users));?> 
     9                <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
     10                <?php echo $form->input('tags', array('class' => 'required'));?> 
     11                <?php echo $form->input('Tag/Tag', array('options' => $tags, 'multiple' => 'multiple'));?> 
    412                <?php echo $form->submit('Add');?> 
    513        </form> 
     
    816        <ul> 
    917                <li><?php echo $html->link('List Pages', array('action'=>'index')); ?></li> 
     18                <li><?php echo $html->link('View Users', array('controller'=> 'users', 'action'=>'view'));?></li> 
     19                <li><?php echo $html->link('Add Users', array('controller'=> 'users', 'action'=>'add')); ?></li> 
     20                <li><?php echo $html->link('View Subjects', array('controller'=> 'subjects', 'action'=>'view'));?></li> 
     21                <li><?php echo $html->link('Add Subjects', array('controller'=> 'subjects', 'action'=>'add')); ?></li> 
    1022        </ul> 
    1123</div> 
  • branch/views/pages/admin_add.ctp

    r55 r60  
    22<h2>New Page</h2> 
    33        <?php echo $form->create('Page');?> 
    4                 <?php echo $form->submit('Add');?> 
     4                <fieldset id="main-content"> 
     5                        <legend>Main Content</legend> 
     6                        <?php echo $form->input('title', array('class' => 'required'));?> 
     7                        <?php echo $form->input('body', array('class' => 'wymeditor'));?> 
     8                </fieldset> 
     9                 
     10                <fieldset id="meta-content"> 
     11                        <legend>Meta Data</legend> 
     12                        <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
     13                        <?php echo $form->input('tags', array('class' => 'required', 'type'=>'text'));?> 
     14                </fieldset> 
     15                 
     16                <fieldset id="publishing-options"> 
     17                        <legend>Publishing Options</legend> 
     18                        <?php echo $form->input('published', array('class' => 'required'));?> 
     19                        <?php echo $form->input('access_level', array('class' => 'required', 'options'=>$access_levels));?> 
     20                </fielset> 
     21                 
     22                <?php echo $form->submit('Add', array('class'=>'wymupdate'));?> 
    523        </form> 
    624</div> 
    7 <div class="actions"> 
    8         <ul> 
    9                 <li><?php echo $html->link('List Pages', array('action'=>'index')); ?></li> 
    10         </ul> 
    11 </div> 
  • branch/views/pages/admin_edit.ctp

    r55 r60  
    22<h2>Edit Page</h2> 
    33        <?php echo $form->create('Page');?> 
    4                 <?php echo $form->submit('Update');?> 
     4                <fieldset id="main-content"> 
     5                        <legend>Main Content</legend> 
     6                        <?php echo $form->input('id');?> 
     7                        <?php echo $form->input('title', array('class' => 'required'));?> 
     8                        <?php echo $form->input('body', array('class' => 'wymeditor'));?> 
     9                </fieldset> 
     10                 
     11                <fieldset id="meta-content"> 
     12                        <legend>Meta Data</legend> 
     13                        <?php echo $form->input('subject_id', array('class' => 'required', 'options' => $subjects));?> 
     14                        <?php echo $form->input('tags', array('class' => 'required', 'type'=>'text'));?> 
     15                </fieldset> 
     16                 
     17                <fieldset id="publishing-options"> 
     18                        <legend>Publishing Options</legend> 
     19                        <?php echo $form->input('published', array('class' => 'required'));?> 
     20                        <?php echo $form->input('access_level', array('class' => 'required', 'options'=>$access_levels));?> 
     21                </fielset> 
     22                 
     23                <?php echo $form->submit('Add', array('class'=>'wymupdate'));?> 
     24                <?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('Page/id')), null, 'Are you sure you want to delete #' . $html->tagValue('Page/id')); ?> 
    525        </form> 
    626</div> 
    7 <div class="actions"> 
    8         <ul> 
    9                 <li><?php echo $html->link('Delete', array('action'=>'delete', $html->tagValue('/')), null, 'Are you sure you want to delete #' . $html->tagValue('/')); ?> 
    10                 <li><?php echo $html->link('List Pages', array('action'=>'index')); ?></li> 
    11         </ul> 
    12 </div> 
  • branch/views/pages/admin_index.ctp

    r55 r60  
    1 <div class="pages"> 
    2 <h2>List Pages</h2> 
    3  
    4 <table cellpadding="0" cellspacing="0"> 
    5         <tr> 
    6                 <th>Actions</th> 
    7         </tr> 
    8 <?php foreach ($pages as $page): ?> 
    9         <tr> 
    10                 <td class="actions"> 
    11                         <?php echo $html->link('View', array('action'=>'view', $page[''][''])); ?> 
    12                         <?php echo $html->link('Edit', array('action'=>'edit', $page[''][''])); ?> 
    13                         <?php echo $html->link('Delete', array('action'=>'delete', $page['']['']), null, 'Are you sure you want to delete #' . $page['']['']); ?> 
    14                 </td> 
    15         </tr> 
    16 <?php endforeach; ?> 
    17 </table> 
    18  
    19 </div> 
    20 <div class="paging"> 
    21 <?php echo $paginator->prev('<< previous', array(), null, array('class'=>'disabled'));?> 
    22 
    23 <?php echo $paginator->next('next >>', array(), null, array('class'=>'disabled'));?> 
    24 </div> 
     1<?php if ($pages) { ?> 
     2        <div class="pages"> 
     3        <h2>List Pages</h2> 
     4         
     5        <table cellpadding="0" cellspacing="0"> 
     6                <tr> 
     7                        <th><?php echo $paginator->sort('id');?></th> 
     8                        <th><?php echo $paginator->sort('title');?></th> 
     9                        <th><?php echo $paginator->sort('published');?></th> 
     10                        <th><?php echo $paginator->sort('user_id');?></th> 
     11                        <th><?php echo $paginator->sort('subject_id');?></th> 
     12                        <th><?php echo $paginator->sort('tags');?></th> 
     13                        <th>Actions</th> 
     14                </tr> 
     15        <?php foreach ($pages as $page): ?> 
     16                <tr> 
     17              &