Ejemplo n.º 1
0
 /**
  * @return array|mixed
  */
 static function refresh_nav()
 {
     $nav = self::get_instance()->gen_nav_from_module();
     $option_model = new Model_Option();
     $save = $option_model->save(self::SAVE_KEY_NAV, $nav);
     if ($save[Const_DataAccess::MREK_ERRNO] != Const_Err_Base::ERR_OK) {
         return $save;
     }
     return Lib_Helper::get_return_struct($nav);
 }
Ejemplo n.º 2
0
 public function action_edit()
 {
     $id = $this->request->param('id', null);
     if (is_numeric($id)) {
         $option = Model_Option::find_by_id($id);
         if (!$option) {
             throw new Exception_Page('common.option_not_found');
         }
         $this->template_data['title'] = __('admin.settings.edit.modify_option');
     } else {
         $option = new Model_Option();
         $this->template_data['title'] = __('admin.settings.edit.new_option');
     }
     if ($this->request->is_post()) {
         $post = $this->cleaned_post();
         $option->update($post);
         $option->save();
         $this->redirect('/admin/setting');
     }
     $this->template_data['option'] = $option;
 }
Ejemplo n.º 3
0
 public static function insert($name = '', $value = '')
 {
     if (false === static::is_enabled()) {
         return false;
     }
     if (isset(static::$_data[$name])) {
         static::update($name, $value);
     }
     $data = new \Model_Option();
     $data->name = $name;
     $data->value = $value;
     $data->save();
     static::$_data[$data->name] = array('id' => $data->id, 'value' => $data->value);
     return false;
 }