Changeset 412
- Timestamp:
- 04/18/08 20:25:00 (8 months ago)
- Location:
- trunk/app
- Files:
-
- 5 modified
-
controllers/subjects_controller.php (modified) (6 diffs)
-
controllers/users_controller.php (modified) (1 diff)
-
views/entries/admin_listing.ctp (modified) (1 diff)
-
views/subjects/admin_add.ctp (modified) (1 diff)
-
views/subjects/admin_listing.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/subjects_controller.php
r328 r412 10 10 class SubjectsController extends AppController 11 11 { 12 public $helpers = array('Ajax');12 public $helpers = array('Ajax', 'Gags'); 13 13 14 public $components = array('Portal');14 public $components = array('Portal'); 15 15 16 public function isAuthorized() 17 { 16 public function beforeFilter() 17 { 18 $this->Auth->allow(array('display', 'view','show')); 19 parent::beforeFilter(); 20 } 21 22 public function isAuthorized() 23 { 18 24 if (isset($this->params[Configure::read('Routing.admin')])) 19 25 { … … 24 30 } 25 31 return true; 26 }32 } 27 33 28 public function display()29 {34 public function display() 35 { 30 36 $this->layout = 'ajax'; 31 37 … … 42 48 $this->render('qs', 'ajax'); 43 49 44 }50 } 45 51 46 public function view($code)47 {52 public function view($code) 53 { 48 54 $this->layout = 'portal'; 49 55 … … 55 61 56 62 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 57 }63 } 58 64 59 public function show($subject_id)60 {65 public function show($subject_id) 66 { 61 67 $this->pageTitle = 'Karamelo :: Subject'; 62 68 $this->layout = 'default'; //$this->Blog->field; … … 70 76 71 77 $this->set('data', $this->Subject->findAll($conditions, $fields, $order)); 72 73 } 78 } 74 79 75 /** ==== ADMIN METHODS ==== */80 /** ==== ADMIN METHODS ==== */ 76 81 77 public function admin_listing()78 {82 public function admin_listing() 83 { 79 84 $this->layout = 'admin'; 80 85 $this->pageTitle = 'Subjects'; … … 82 87 $conditions = null; 83 88 $fields = array("id", "title", "code"); 84 $order = "title DESC";89 $order = "title ASC"; 85 90 86 91 $this->set('data', $this->Subject->findAll($conditions, $fields, $order)); -
trunk/app/controllers/users_controller.php
r409 r412 22 22 parent::beforeFilter(); 23 23 } 24 24 25 25 public function isAuthorized() 26 26 { -
trunk/app/views/entries/admin_listing.ctp
r301 r412 2 2 window.onload = timedMsg; 3 3 </script> 4 <?php $session->flash(); ?>4 <?php 5 5 6 <?php 7 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 8 echo $html->getCrumbs(' / '); 6 $session->flash(); 7 8 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 9 echo $html->getCrumbs(' / '); 10 11 echo $html->div('title_section', 'Entries'); 12 13 echo $html>para($html->link($html->image('actions/new.png', array("alt"=>"Add entry", "title"=>"Add entry")), '/admin/entries/add', null, false, false) . $html->link($html->image('static/forum.gif', array("alt"=>"See comments", "title"=>"See comments")), '/admin/comments/listing', null, false, false)); 14 9 15 ?> 10 11 <div class="title_section">Entries </div>12 13 <p>14 <?php15 echo $html->link($html->image('actions/new.png', array("alt"=>"Add entry", "title"=>"Add entry")), '/admin/entries/add', null, false, false);16 17 echo $html->link($html->image('static/forum.gif', array("alt"=>"See comments", "title"=>"See comments")), '/admin/comments/listing', null, false, false);18 19 ?>20 21 </p>22 23 16 24 17 <table class="tbadmin"> -
trunk/app/views/subjects/admin_add.ctp
r313 r412 1 <?php echo $javascript->link('myfunctions'); ?>2 3 1 <div class="spaced"> 4 2 5 <?php echo $ html->formTag('/admin/subjects/add/','post'); ?>3 <?php echo $form->create('Subject'); ?> 6 4 <fieldset> 7 5 <legend>New Subject</legend> 8 9 <p><?php echo $form->labelTag( 'Subject/code', 'Code' );?><br /> 10 <?php echo $html->input('Subject/code', array("size" => 4, "maxlength" => 8)); ?> 11 <?php echo $html->tagErrorMsg('Subject/code', 'Code is required.'); ?> 12 </p> 13 14 <p><?php echo $form->labelTag( 'Subject/title', 'Title' );?><br /> 15 <?php echo $html->input('Subject/title', array("size" => 40, "maxlength" => 80)); ?> 16 <?php echo $html->tagErrorMsg('Subject/title', 'Title is required.'); ?> 17 </p> 18 6 <?php 7 echo $form->input('Subject.code', array("size" => 8, "maxlength" => 8)); 8 echo $form->input('Subject.title', array("size" => 40, "maxlength" => 80)); 9 ?> 19 10 <br /> 20 <?php echo $html->submit('Add') ?> 21 </fieldset> 22 </form> 11 <?php echo $form->end('Save'); ?></fieldset> 23 12 </div> -
trunk/app/views/subjects/admin_listing.ctp
r313 r412 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->getCrumbs(' / '); 1 4 2 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?> 3 <?php echo $html->getCrumbs(' / '); ?> 5 echo $html->div('title_section', 'Subjects'); 4 6 5 <div class="title_section">Subjects</div> 7 echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add subject", "title"=>"Add subject")), '/admin/subjects/add', null, false, false)); 8 9 ?> 10 11 <table class="tbadmin"> 12 <?php 13 //die(print_r($data)); 14 15 $th = array ('Edit', 'Code', 'Title', 'Delete'); 16 echo $html->tableHeaders($th); 17 foreach ($data as $val) { 18 $tr = array ( 19 $gags->sendEdit($val['Subject']['id'], 'Subject'), 20 $val['Subject']['code'], 21 $val['Subject']['title'], 22 $gags->confirmDel($val['Subject']['id'], 'Subject') 23 ); 24 25 echo $html->tableCells($tr, array("class"=>"altRow", "onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='altRow'"), 26 array('class'=>'evenRow',"onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='evenRow'")); 27 } 28 ?> 29 </table> 6 30 7 31 8 <p><?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add subject", "title"=>"Add subject")), '/admin/subjects/add', null, false, false) ?></p>9 <div>10 <?php11 //var_dump($data);12 13 foreach ($data as $key=>$val) {14 echo '<p><a href="/admin/subjects/edit/'.$val['Subject']['id'].'">Edit</a> ';15 echo $val['Subject']['code'] . " ";16 echo $val['Subject']['title'] . " ";17 echo '<a href="/admin/subjects/delete/'.$val['Subject']['id'].'">Delete</a> </p>';18 }19 ?>20 </div>
