set_userdata() public méthode

Legacy CI_Session compatibility method
public set_userdata ( mixed $data, mixed $value = NULL ) : void
$data mixed Session data key or an associative array
$value mixed Value to store
Résultat void
 /**
  * Setea el menu
  */
 public function setCollapse()
 {
     $menu_collapse = $this->session->userdata("menu_collapse");
     if ($menu_collapse) {
         $this->session->set_userdata("menu_collapse", false);
     } else {
         $this->session->set_userdata("menu_collapse", true);
     }
 }
 /**
  * Encode array of image info to string and save in session
  * @param array $images
  * @return $this
  */
 protected function setTemplateImages(array $images)
 {
     $this->templateImages = $images;
     $images = $this->valuesHandler->input('array', $images);
     $this->session->set_userdata($this->sessionKeys['template_images'], $images);
     $this->session->set_userdata('theme_images_deletion_queue', $images);
     // to delete extra files
     return $this;
 }
 function __construct($menu_item = null)
 {
     parent::__construct();
     $this->menu_item = $menu_item;
     $this->load->model('languages_model');
     $get_lang = $this->input->get('l');
     //        dump($this->lang->language);die;
     if ($get_lang && array_key_exists($get_lang, $this->long_to_short)) {
         $this->current_language = $get_lang;
         $this->session->set_userdata('language', $get_lang);
     } else {
         if (!$this->session->userdata('language')) {
             $this->session->set_userdata('language', $this->getLanguage());
         } else {
             $this->current_language = $this->session->userdata('language');
         }
     }
     $this->lang->load("main", $this->current_language);
     $this->current_language_short = $this->long_to_short[$this->current_language];
     $this->menus = ['home' => ['url' => base_url(''), 'title' => lang('home'), 'additional_params' => 'data-href="1"'], 'contacts' => ['url' => base_url('contacts'), 'title' => lang('contacts'), 'additional_params' => 'data-href="11"'], 'about_me' => ['url' => base_url('about'), 'title' => lang('about_me'), 'additional_params' => ''], 'portfolio' => ['url' => base_url('portfolio'), 'title' => lang('portfolio'), 'additional_params' => '']];
 }
Exemple #4
0
 /**
  * {@inheritDoc}
  */
 public function put($value)
 {
     $this->store->set_userdata($this->key, serialize($value));
 }
Exemple #5
0
 /**
  * Add or change data in the "userdata" array
  *
  * @access	public
  * @param	mixed
  * @param	string
  * @return	void
  */
 function set_userdata($newdata = array(), $newval = '')
 {
     if ($this->is_custom_session) {
         return $this->session_driver->set_userdata($newdata, $newval);
     } else {
         return parent::set_userdata($newdata, $newval);
     }
 }
Exemple #6
0
 function set_userdata($newdata = array(), $newval = '', $append = FALSE)
 {
     if (is_string($newdata)) {
         $newdata = array($newdata => $newval);
     }
     $parent_newdata = array();
     if (count($newdata) > 0) {
         $parent_newdata = array();
         foreach ($newdata as $key => $val) {
             if (!in_array($key, $this->builtin_props)) {
                 $my_key = $this->my_prefix . $key;
                 if ($append) {
                     if (!isset($_SESSION[$my_key])) {
                         $_SESSION[$my_key] = array();
                     }
                     if (!is_array($_SESSION[$my_key])) {
                         $_SESSION[$my_key] = array($_SESSION[$my_key]);
                     }
                     $_SESSION[$my_key][] = $val;
                 } else {
                     $_SESSION[$my_key] = $val;
                 }
             } else {
                 $parent_newdata[$key] = $val;
             }
         }
     }
     if ($parent_newdata) {
         parent::set_userdata($parent_newdata);
     }
 }