Changeset 412

Show
Ignore:
Timestamp:
04/18/08 20:25:00 (8 months ago)
Author:
aarkerio
Message:

Discussions fixed

Location:
trunk/app
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/subjects_controller.php

    r328 r412  
    1010class SubjectsController extends AppController 
    1111 
    12    public $helpers       = array('Ajax'); 
     12 public $helpers       = array('Ajax', 'Gags'); 
    1313    
    14    public $components    = array('Portal'); 
     14 public $components    = array('Portal'); 
    1515    
    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 { 
    1824       if (isset($this->params[Configure::read('Routing.admin')])) 
    1925       { 
     
    2430       } 
    2531   return true; 
    26    } 
     32 } 
    2733                                                             
    28    public function display() 
    29     
     34 public function display() 
     35  
    3036      $this->layout    = 'ajax'; 
    3137       
     
    4248      $this->render('qs', 'ajax'); 
    4349       
    44    } 
     50 } 
    4551    
    46    public function view($code) 
    47     
     52 public function view($code) 
     53  
    4854      $this->layout    = 'portal'; 
    4955      
     
    5561       
    5662      $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 
    57    } 
     63 } 
    5864    
    59    public function show($subject_id) 
    60     {    
     65 public function show($subject_id) 
     66 {    
    6167        $this->pageTitle = 'Karamelo :: Subject'; 
    6268        $this->layout    = 'default'; //$this->Blog->field; 
     
    7076         
    7177        $this->set('data', $this->Subject->findAll($conditions, $fields, $order)); 
    72          
    73     } 
     78  } 
    7479    
    75    /** ==== ADMIN METHODS ==== */ 
     80  /** ==== ADMIN METHODS ==== */ 
    7681    
    77    public function admin_listing() 
    78    { 
     82  public function admin_listing() 
     83  { 
    7984      $this->layout    = 'admin'; 
    8085      $this->pageTitle = 'Subjects'; 
     
    8287      $conditions = null; 
    8388      $fields     = array("id", "title", "code"); 
    84       $order      = "title DESC"; 
     89      $order      = "title ASC"; 
    8590       
    8691      $this->set('data', $this->Subject->findAll($conditions, $fields, $order)); 
  • trunk/app/controllers/users_controller.php

    r409 r412  
    2222    parent::beforeFilter(); 
    2323 } 
    24   
     24   
    2525 public function isAuthorized()  
    2626 {       
  • trunk/app/views/entries/admin_listing.ctp

    r301 r412  
    22   window.onload = timedMsg; 
    33</script> 
    4 <?php $session->flash(); ?> 
     4<?php  
    55 
    6 <?php  
    7  echo $html->addCrumb('Control Tools', '/admin/entries/start'); 
    8  echo $html->getCrumbs(' / ');  
     6 $session->flash();  
     7  
     8echo $html->addCrumb('Control Tools', '/admin/entries/start'); 
     9echo $html->getCrumbs(' / ');  
     10 
     11echo $html->div('title_section', 'Entries');  
     12 
     13echo $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 
    915?> 
    10  
    11 <div class="title_section">Entries </div> 
    12  
    13 <p> 
    14 <?php  
    15   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  
    2316 
    2417<table class="tbadmin"> 
  • trunk/app/views/subjects/admin_add.ctp

    r313 r412  
    1 <?php echo $javascript->link('myfunctions'); ?> 
    2  
    31<div class="spaced"> 
    42 
    5 <?php echo $html->formTag('/admin/subjects/add/','post'); ?> 
     3<?php echo $form->create('Subject'); ?> 
    64<fieldset> 
    75  <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   ?> 
    1910  <br /> 
    20   <?php echo $html->submit('Add') ?> 
    21 </fieldset> 
    22 </form> 
     11  <?php echo $form->end('Save'); ?></fieldset> 
    2312</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(' / '); 
    14 
    2 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?>  
    3 <?php echo $html->getCrumbs(' / '); ?> 
     5 echo $html->div('title_section', 'Subjects'); 
    46 
    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'); 
     16echo $html->tableHeaders($th);   
     17foreach ($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> 
    630 
    731 
    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 <?php 
    11 //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>