/** * Return the number of option in category that logged user can see * * @param boolean $include_system_options Include system options * @return integer */ function countUserWsOptions($include_system_options = false) { if (is_null($this->count_user_ws_config_options)) { $this->count_user_ws_config_options = UserWsConfigOptions::countOptionsByCategory($this, $include_system_options); } // if return $this->count_user_ws_config_options; }
function enable_all_context_help() { $context_help_options = UserWsConfigOptions::getOptionsByCategoryName('context help', true); foreach ($context_help_options as $option) { set_user_config_option($option->getName(), true, logged_user()->getId()); } ajx_current("empty"); flash_success(lang('success enable all context help')); }
function save() { parent::save(); UserWsConfigOptions::instance()->updateConfigOptionCache($this); }
function default_user_config_option($option, $default = null) { return UserWsConfigOptions::getDefaultOptionValue($option, $default); }
/** * This function will return paginated result. Result is an array where first element is * array of returned object and second populated pagination object that can be used for * obtaining and rendering pagination data using various helpers. * * Items and pagination array vars are indexed with 0 for items and 1 for pagination * because you can't use associative indexing with list() construct * * @access public * @param array $arguments Query argumens (@see find()) Limit and offset are ignored! * @param integer $items_per_page Number of items per page * @param integer $current_page Current page number * @return array */ function paginate($arguments = null, $items_per_page = 10, $current_page = 1) { if (isset($this) && instance_of($this, 'UserWsConfigOptions')) { return parent::paginate($arguments, $items_per_page, $current_page); } else { return UserWsConfigOptions::instance()->paginate($arguments, $items_per_page, $current_page); //$instance =& ConfigOptions::instance(); //return $instance->paginate($arguments, $items_per_page, $current_page); } // if }
/** * Set value of specific user configuration option * * @param string $option_name * @param mixed $value * @param int $user_id User Id, if null logged user is taken * @return boolean */ function set_user_config_option($option_name, $value, $user_id = null) { $config_option = UserWsConfigOptions::getByName($option_name); if (!$config_option instanceof UserWsConfigOption) { return false; } // if $config_option->setUserValue($value, $user_id); // update cache if available if (GlobalCache::isAvailable() && GlobalCache::key_exists('user_config_option_' . $user_id . '_' . $option_name)) { GlobalCache::update('user_config_option_' . $user_id . '_' . $option_name, $value); } return $config_option->save(); }
/** * Remove Getting Started widget from dashboard * */ function remove_getting_started_widget() { try { DB::beginWork(); $option = UserWsConfigOptions::getByName('show getting started widget'); $option->setUserValue(0, logged_user()->getId()); $option->save(); DB::commit(); ajx_current('reload'); } catch (Exception $ex) { DB::rollback(); } }
/** * Return manager instance * * @access protected * @param void * @return ConfigOptions */ function manager() { if (!$this->manager instanceof UserWsConfigOptions) { $this->manager = UserWsConfigOptions::instance(); } return $this->manager; }