Exemplo n.º 1
0
 public function index()
 {
     // Getting data
     $website = WebsiteManagement::get_website();
     $menu = PageManagement::get_pages();
     $slider = SliderManagement::get_slider();
     PageManagement::add_visit(2);
     $this->load->view('front/header', array('website' => $website));
     $this->load->view('front/menu', array('menu' => $menu));
     $this->load->view('front/who_are_we', array('website' => $website));
     $this->load->view('front/footer', array('website' => $website));
 }
Exemplo n.º 2
0
 public function operations($type)
 {
     switch ($type) {
         case 'general_settings':
             $this->load->model('entities/website');
             $temp = new Website();
             $temp->initialize($this->input->post());
             WebsiteManagement::update_website($temp);
             redirect(base_url() . "panel/general_settings", "location");
             break;
         case 'supprimer_portfolio':
             $data = $this->input->get();
             $id = $data['id'];
             PortfolioManagement::delete_portfolio_content($id);
             redirect(base_url() . "panel/page/portfolio", "location");
             break;
         case 'supprimer_post':
             $data = $this->input->get();
             $id = $data['id'];
             BlogManagement::delete_blog_post($id);
             break;
         case 'editer_post':
             $this->load->model('entities/Post');
             $post = BlogManagement::get_post($this->input->post('id'));
             $post->title = $this->input->post('title');
             $post->description = $this->input->post('description');
             $post->content = $this->input->post('content');
             BlogManagement::update_blog_post($post);
             echo 'ok';
             break;
         case 'ajouter_post':
             $this->load->model('entities/Post');
             $temp = new Post();
             $temp->initialize($this->input->post());
             BlogManagement::insert_blog_post($temp);
             echo 'ok';
             break;
         case 'upload_slider_image':
             # Started working with file upload.
             $validFiles = array('upload_path' => './assets/front/img/slider_images', 'allowed_types' => 'jpg|png', 'file_name' => 'slider_image_' . $this->input->post('slide_to_update') . '.jpg', 'max_size' => 250000, 'overwrite' => TRUE);
             $this->load->library('upload', $validFiles);
             $this->load->model('entities/SliderImage');
             $slider_entry = SliderManagement::get_slider_entry($this->input->post('slide_to_update'));
             $slider_entry->title = $this->input->post('article_title');
             $slider_entry->description = $this->input->post('article_description');
             if ($this->upload->do_upload('to_upload_image')) {
                 $slider_entry->image = 'slider_image_' . $this->input->post('slide_to_update') . '.jpg';
             } else {
                 echo $this->upload->display_errors();
             }
             SliderManagement::update_slider($slider_entry);
             redirect(base_url() . "panel/page/accueil", "location");
             break;
         default:
             break;
     }
 }