0byt3m1n1-V2
Path:
/
home
/
nlpacade
/
www
/
arcaneoverseas.com
/
application
/
controllers
/
admin
/
[
Home
]
File: contact.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Contact extends CI_Controller { /** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/<method_name> * @see http://codeigniter.com/user_guide/general/urls.html */ /* * Doctrine EntityManager */ public $em; /* * constructeur */ public function __construct() { parent::__construct(); /* Session controle */ if ($this->session->userdata("logged_in") != true) redirect('admin/login/index'); /* Standard Libraries */ $this->layout->set_theme('admin/interne_page'); //Instantiate a Doctrine Entity Manager $this->em = $this->doctrine->em; /* Standard Libraries */ $this->load->database(); $this->load->helper('url'); /* Load Crud */ $this->load->library('grocery_CRUD'); } public function index($type_contenu_id = 0) { $data = array(); $crud = new grocery_CRUD(); $crud->set_table('contact'); $crud->add_action('Consultez', '', '','edit-icon',array($this,'more')); $crud->unset_edit(); $crud->unset_add(); $output = $crud->render(); $output->title_module = "Message Contact" ; $this->layout->views('admin/session_user') ->views('admin/header') ->views('admin/nav') ->view('admin/view_contact', $output); } public function edit($id){ $data = array(); $message = $this->em->getRepository('Entities\Contact')->find((int)$id); //set message not new if( $message->getLu() == "non"){ $message->setLu("oui"); $data["message"] = $message; $this->em->persist($message); $this->em->flush(); $data = array( 'contact' => $this->session->userdata("contact") - 1, ); $this->session->set_userdata($data); //empty la session } $data["message"] = $message; $this->layout->views('admin/session_user') ->views('admin/header') ->views('admin/nav') ->view('admin/contact_update', $data); } /** * * */ public function type_content($post_array){ // var_dump($post_array);die; // 5 : type de contenu partenaire $post_array['type_contenu_id'] = 5; return $post_array; } public function cleanUrl($param) { return url_title($param, 'underscore', TRUE); } public function more($primary_key , $row){ return site_url('admin/contact/edit/'.$row->id); } /** * * @param type $uploader_response * @param type $field_info * @param type $files_to_upload * @return boolean */ public function resizeImage($uploader_response, $field_info, $files_to_upload) { $this->load->library('image_moo'); //Is only one file uploaded so it ok to use it with $uploader_response[0]. $file_uploaded = $field_info->upload_path . '/' . $uploader_response[0]->name; $file_uploaded_thamb = $field_info->upload_path . '/thamb/' . $uploader_response[0]->name; $file_uploaded_contenu = $field_info->upload_path . '/contenu/' . $uploader_response[0]->name; $pic = $this->image_moo->load($file_uploaded); $pic->resize(900, 700)->save($file_uploaded, true); $pic->resize(640, 377)->save($file_uploaded_contenu, true); $pic->resize(150, 150)->save($file_uploaded_thamb, true); return true; } } /* End of file welcome.php */ /* Location: ./application/controllers/welcome.php */
©
2018.