Changeset 679 for trunk/app/controllers
- Timestamp:
- 07/29/08 18:18:05 (4 months ago)
- Files:
-
- 1 modified
-
trunk/app/controllers/helps_controller.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/helps_controller.php
r548 r679 32 32 public function display($a, $b, $c) 33 33 { 34 $url = '/'.$a .'/'.$b .'/'.$c; 35 //exit($url); 36 $this->layout = 'help'; 37 $this->pageTitle = 'Karamelo Help'; 38 $conditions = array('url'=>$url); 39 $fields = array('help', 'url', 'lang'); 40 $this->set('data', $this->Help->find($conditions, $fields)); 34 $url = '/'.$a .'/'.$b .'/'.$c; 35 $lang = (Configure::read('Config.language')) ? Configure::read('Config.language') : 'en'; 36 37 $this->layout = 'help'; 38 $this->pageTitle = 'Karamelo ' . __('Help', true); 39 $conditions = array('url'=>$url, 'lang'=> $lang); 40 $fields = array('help', 'url', 'lang'); 41 $this->set('data', $this->Help->find($conditions, $fields)); 41 42 } 42 43 43 44 public function index($set=null) 44 45 { 45 $this->layout = ( isset($set) ) ? 'admin' : 'help'; //small window or admin panel? 46 $this->pageTitle = 'Karamelo Help'; 47 $conditions = array("lang"=>"en"); 48 $fields = array('help', 'url', 'lang'); 49 $this->set('data', $this->Help->findAll($conditions, $fields)); 46 $lang = (Configure::read('Config.language')) ? Configure::read('Config.language') : 'en'; 47 $this->layout = ( isset($set) ) ? 'admin' : 'help'; //small window or admin panel? 48 $this->pageTitle = 'Karamelo '. __('Help', true); 49 $conditions = array('lang'=>$lang); 50 $fields = array('help', 'url', 'lang'); 51 $order = 'url'; 52 $this->set('data', $this->Help->findAll($conditions, $fields, $order)); 50 53 } 51 54 … … 54 57 public function admin_newticket() 55 58 { 56 $this->layout = 'admin';57 $this->pageTitle = 'Karamelo Help';58 $conditions = array("lang"=>"en");59 $fields = array('help', 'url', 'lang');60 $this->set('data', $this->Help->findAll($conditions, $fields));59 $this->layout = 'admin'; 60 $this->pageTitle = 'Karamelo Help'; 61 $conditions = array("lang"=>"en"); 62 $fields = array('help', 'url', 'lang'); 63 $this->set('data', $this->Help->findAll($conditions, $fields)); 61 64 } 62 65 63 66 public function admin_submit() 64 67 { 65 if ( !empty( $this->data['Help'] ) ) 66 { 68 if ( !empty( $this->data['Help'] ) ): 67 69 $this->Sanitize = new Sanitize; 68 70 … … 76 78 $this->msgFlash('Email sent, Thanks!', '/admin/entries/start'); 77 79 endif; 78 79 } 80 endif; 80 81 } 81 82 … … 104 105 $this->layout = 'admin'; 105 106 106 if (!empty($this->data['Help'])) 107 { 108 //die(debug($this->data['Help'])); 107 if (!empty($this->data['Help'])): 108 //die(debug($this->data['Help'])); 109 109 $this->Sanitize = new Sanitize; 110 110 … … 115 115 $this->Help->create(); 116 116 117 if ($this->Help->save($this->data['Help'])) 118 { 119 $id = $this->Help->getLastInsertID(); 120 $this->msgFlash('Help saved','/admin/helps/edit/'.$id); 121 } 122 } 117 if ($this->Help->save($this->data)): 118 $id = $this->Help->getLastInsertID(); 119 $this->msgFlash(__('Data saved', true),'/admin/helps/edit/'.$id); 120 endif; 121 endif; 123 122 } 124 123 … … 130 129 131 130 $this->data = $this->Help->read(null, $help_id); 132 133 131 else: 134 135 if ($this->Help->save($this->data['Help'])): 136 $this->msgFlash('Help updated.','/admin/helps/edit/'.$this->data['Help']['id']); 132 if ( $this->Help->save($this->data) ): 133 if ( $this->data['Help']['end'] == 1 ): 134 $return = '/admin/helps/listing'; 135 else: 136 $return = '/admin/helps/edit/'.$this->data['Help']['id']; 137 endif; 138 $this->msgFlash(__('Data saved', true), $return); 137 139 endif; 138 139 140 endif; 140 141 } 141 142 142 public function admin_delete($ id)143 public function admin_delete($help_id) 143 144 { 144 if ( $this->Help->del($ id) ):145 $this->msgFlash('Help deleted','/admin/helps/listing');145 if ( $this->Help->del($help_id) ): 146 $this->msgFlash(__('Help deleted', true),'/admin/helps/listing'); 146 147 endif; 147 148 } … … 162 163 $this->set('report', $report); 163 164 //Do not pass any args to send() 164 if ( $this->Email->send() ) 165 { 165 if ( $this->Email->send() ): 166 166 return true; 167 } 168 else 169 { 167 else: 170 168 return false; 171 }169 endif; 172 170 } 173 171 }
