0byt3m1n1-V2
Path:
/
home
/
nlpacade
/
www
/
arcaneoverseas.com
/
application
/
controllers
/
admin
/
[
Home
]
File: partenaires.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Partenaires 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->where('type_contenu_id', '5'); $crud->set_table('gestion_contenu'); $crud->set_relation('type_contenu_id', 'type_contenu', 'titre'); $crud->display_as('type_contenu_id', 'Type de Contenu'); $crud->display_as('image', 'Logo'); $crud->display_as('image_hover', 'Logo Hover'); $crud->change_field_type('type_contenu_id', 'hidden', 5); $crud->required_fields('titre'); $crud->display_as('active', 'Activer ?'); $crud->set_field_upload('image', 'assets/uploads/images_partenaire'); $crud->set_field_upload('image_hover', 'assets/uploads/images_partenaire_hover'); $crud->callback_after_upload(array($this, 'resizeImage')); $crud->callback_column('image', array($this, '_transformIMG')); $crud->columns('titre','image','active'); $crud->fields('titre','link_externe','type_contenu_id','image','image_hover','active'); $crud->callback_field('active', array($this, 'callback_active')); $output = $crud->render(); $output->title_module = "Partenaires" ; $output->ariane = '<a href="">Accueil</a> > Gestion des Partenaires'; $this->layout->views('admin/session_user') ->views('admin/header') ->views('admin/nav') ->view('admin/view_standart', $output); } function _transformIMG($value, $row) { $img = "<div class='thumbnail'><img src='" . base_url('assets/uploads/images_partenaire/thamb') . "/" . $value . "' /></div>"; return($img); } /** * * */ 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 callback_active($value = NULL) { $options = array('oui', 'non'); $option_tag = ''; foreach ($options as $option) { $attribute = 'value="' . $option . '"'; if ($option == $value) { $attribute .= ' selected="selected"'; } $option_tag .= "<option $attribute>$option</option>"; } return '<select name="active">' . $option_tag . '</select>'; } public function cleanUrl($param) { return url_title($param, 'underscore', TRUE); } /** * * @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.