Show
Ignore:
Timestamp:
07/04/08 15:06:44 (5 months ago)
Author:
aarkerio
Message:

Internatiantilzation

Files:
1 modified

Legend:

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

    r540 r625  
    8787    $this->set('subjects', Set::combine($this->Lesson->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
    8888     
    89      if (!empty($this->data["Lesson"])) 
    90      { 
     89    if (!empty($this->data['Lesson'])): 
     90 
    9191       $this->Sanitize = new Sanitize; 
    9292         
    93        $this->Sanitize->html($this->data["Lesson"]["title"]); 
     93       $this->Sanitize->html($this->data['Lesson']['title']); 
    9494         
    95        $this->Sanitize->html($this->data["Lesson"]["body"]); 
     95       $this->Sanitize->html($this->data['Lesson']['body']); 
    9696         
    97        $this->data["Lesson"]["user_id"] = $this->Auth->user('id');;  
     97       $this->data['Lesson']['user_id'] = $this->Auth->user('id');;  
    9898         
    99        if ($this->Lesson->save($this->data["Lesson"])) 
    100        { 
     99       if ($this->Lesson->save($this->data['Lesson'])): 
    101100           $this->msgFlash('Lesson saved', '/admin/lessons/edit/'.$this->Lesson->getLastInsertID()); 
    102        } 
    103     } 
     101       endif; 
     102    endif; 
    104103  } 
    105104  
     
    110109     $this->set('subjects', Set::combine($this->Lesson->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 
    111110      
    112      if ( empty( $this->data["Lesson"] ) ) 
    113      { 
     111     if ( empty( $this->data["Lesson"] ) ): 
     112 
    114113         $this->Lesson->id  = $id; 
    115114          
    116115         $this->data      = $this->Lesson->read(); 
    117      } 
    118      else 
    119      {    
     116     
     117     else: 
     118    
    120119         $this->Sanitize = new Sanitize; 
    121120          
    122          $this->Sanitize->html($this->data["Lesson"]["title"]); 
     121         $this->Sanitize->html($this->data['Lesson']['title']); 
    123122          
    124          $this->Sanitize->html($this->data["Lesson"]["body"]); 
     123         $this->Sanitize->html($this->data['Lesson']['body']); 
    125124          
    126          if ($this->Lesson->save($this->data["Lesson"])) 
    127          {    
    128              if ( $this->data["Lesson"]["end"] == 1 ) 
    129              { 
    130                                  $this->redirect('/admin/lessons/listing'); 
    131              } 
    132              else 
    133              { 
    134                                  $this->msgFlash('Your story has been saved!', '/admin/lessons/edit/'.$this->data["Lesson"]["id"]); 
    135              } 
    136         } 
    137      } 
     125         if ($this->Lesson->save($this->data['Lesson'])):    
     126         if ( $this->data['Lesson']['end'] == 1 ): 
     127                     $this->redirect('/admin/lessons/listing'); 
     128            
     129         else: 
     130                     $this->msgFlash(__('Data saved', true), '/admin/lessons/edit/'.$this->data["Lesson"]["id"]); 
     131         endif; 
     132      endif; 
     133      endif; 
    138134 } 
    139135 // change status enabled/disabled actived