Esempio n. 1
0
 function edit()
 {
     if (isset($_POST['save'])) {
         $id = $this->input->post('id');
         $title = trim($this->input->post('title'));
         $alias = trim($this->input->post('alias'));
         if ($alias) {
             $alias = preg_replace('/\\s+/', '-', strtolower($alias));
             $alias = preg_replace('/&/', '-', $alias);
             $alias = preg_replace('#/+#', '-', $alias);
             $alias = preg_replace('/---/', '-', $alias);
             $alias = preg_replace('/\'/', '', $alias);
         } else {
             $alias = preg_replace('/\\s+/', '-', strtolower($title));
             $alias = preg_replace('/&/', '-', $alias);
             $alias = preg_replace('#/+#', '-', $alias);
             $alias = preg_replace('/---/', '-', $alias);
             $alias = preg_replace('/\'/', '', $alias);
         }
         $data = array('title' => $title, 'alias' => strtolower($alias), 'state' => $this->input->post('state'), 'order' => trim($this->input->post('order')), 'width' => trim($this->input->post('width')), 'height' => trim($this->input->post('height')), 'alt_text' => trim($this->input->post('alt_text')), 'link' => trim($this->input->post('link')), 'image' => trim($this->input->post('image')), 'scat_id' => trim($this->input->post('scat_id')), 'created_date' => date('y:m:d h:m:s'), 'intro_desc' => trim($this->input->post('intro_desc')));
         $dataIn = $this->crud_model->updateData('slide', 'id', $id, $data);
         if ($dataIn) {
             $this->admintemp->write('message', 'Edited Successfully');
             redirect('slide');
         } else {
             $this->admintemp->write('message', 'Error occured while editing');
             Slide::index();
         }
     } else {
         Slide::_edit();
     }
 }