Changeset 695 for trunk/app/controllers

Show
Ignore:
Timestamp:
08/04/08 21:29:32 (4 months ago)
Author:
aarkerio
Message:

Update scavanger~

Files:
1 modified

Legend:

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

    r661 r695  
    6767    $this->layout = 'admin'; 
    6868      
    69     // adds new classroom to database 
    70     if (!empty($this->data["Subject"])) 
    71     { 
     69    if (!empty($this->data['Subject'])): 
     70     
    7271        $this->Sanitize = new Sanitize; 
    7372         
    74         $this->Sanitize->clean($this->data["Subject"]); //Hopefully this is enough 
     73        $this->Sanitize->clean($this->data['Subject']);  
    7574     
    76     $this->Subject->create(); 
    77          
    78         if ($this->Subject->save($this->data["Subject"])) 
    79         { 
    80            $this->msgFlash('Your subject has been saved.','/admin/subjects/listing'); 
    81         } 
    82     }      
     75    if ($this->Subject->save($this->data)): 
     76            $this->msgFlash(__('Data saved', true),'/admin/subjects/listing'); 
     77    endif; 
     78    endif;    
    8379  } 
    8480   
    85   public function admin_edit($id = null) 
    86   { 
    87       
    88     if (empty($this->data["Subject"])) 
    89     { 
     81  public function admin_edit($subject_id = null) 
     82  {      
     83    if (empty($this->data['Subject'])): 
     84 
    9085        $this->layout = 'admin'; 
    9186         
    92         $this->Subject->id = $id; 
    93          
    94         $this->data = $this->Subject->read(); 
    95     } 
    96     else 
    97     { 
     87        $this->data = $this->Subject->read(null, $subject_id); 
     88     
     89    else: 
     90  
    9891        $this->Sanitize = new Sanitize; 
    9992         
    100         $this->Sanitize->clean($this->data["Subject"]); //Hopefully this is enough 
     93        $this->Sanitize->clean($this->data['Subject']); 
    10194         
    102         if ($this->Subject->save($this->data['Subject'])) 
    103         { 
     95        if ($this->Subject->save($this->data)): 
    10496            $this->msgFlash('Your subject has been updated', '/admin/subjects/listing'); 
    105         } 
    106     } 
    107 } 
     97    endif; 
     98   endif; 
     99 } 
    108100   
    109   public function admin_delete($id) 
    110   { 
    111         // deletes task from database 
    112         $this->Subject->del($id); 
    113         $this->msgFlash('Subject has been deleted','/admin/subjects/listing'); 
    114   } 
    115    
     101 public function admin_delete($subject_id) 
     102 { 
     103   if ( $this->Subject->del($subject_id) ): 
     104     $this->msgFlash('Subject has been deleted','/admin/subjects/listing'); 
     105   endif; 
     106 }  
    116107} 
    117108?>