本文整理汇总了PHP中UserConfig类的典型用法代码示例。如果您正苦于以下问题:PHP UserConfig类的具体用法?PHP UserConfig怎么用?PHP UserConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUserRequestCreation
public function testUserRequestCreation()
{
$factoryMock = $this->getMock('Magento\\Backend\\Model\\Config\\Factory', [], [], '', false);
$responseMock = $this->getMock('Magento\\Framework\\App\\Console\\Response', [], [], '', false);
$configMock = $this->getMock('Magento\\Backend\\Model\\Config', [], [], '', false);
$key = 'key';
$value = 'value';
$request = [$key => $value];
$model = new UserConfig($factoryMock, $responseMock, $request);
$factoryMock->expects($this->once())->method('create')->will($this->returnValue($configMock));
$configMock->expects($this->once())->method('setDataByPath')->with($key, $value);
$configMock->expects($this->once())->method('save');
$model->launch();
}
示例2: __construct
public function __construct()
{
parent::__construct();
$top = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array('view' => 'tiles'), "presenting/overview"));
$top->setImage(Icon::create($this->getPluginURL() . "/assets/topicon.svg"));
$overview = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
$top->addSubNavigation("presenting", $overview);
$overview->addSubNavigation("overview", new AutoNavigation(_('Übersicht'), PluginEngine::getURL($this, array(), "presenting/overview")));
$overview->addSubNavigation("all", new AutoNavigation(_('Alle Plugins'), PluginEngine::getURL($this, array(), "presenting/all")));
$overview->addSubNavigation("tools", new AutoNavigation(_('Tools'), PluginEngine::getURL($this, array(), "tools/sidebar_graphics_generator")));
if ($GLOBALS['perm']->have_perm("autor")) {
$top->addSubNavigation("myplugins", new Navigation(_("Meine Plugins"), PluginEngine::getURL($this, array(), "myplugins/overview")));
}
if ($GLOBALS['perm']->have_perm("user")) {
$last_visit = UserConfig::get($GLOBALS['user']->id)->getValue("last_pluginmarket_visit");
if ($last_visit) {
$badge_number = MarketPlugin::countBySql("publiclyvisible = 1 AND approved = 1 AND published > ?", array($last_visit));
if ($badge_number > 0) {
$top->setBadgeNumber($badge_number);
}
}
}
if ($GLOBALS['perm']->have_perm("root")) {
$approving = new Navigation(_("Qualitätssicherung"), PluginEngine::getURL($this, array(), "approving/overview"));
$top->addSubNavigation("approving", $approving);
}
Navigation::addItem("/pluginmarket", $top);
$loginlink = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
$loginlink->setDescription(_("Laden Sie hier Plugins für Ihr Stud.IP herunter"));
Navigation::addItem("/login/pluginmarket", $loginlink);
NotificationCenter::addObserver($this, "triggerFollowingStudips", "PluginReleaseDidUpdateCode");
}
示例3: index_action
/**
* Display a user's calendar settings
*/
public function index_action()
{
$calendar_user_control_data = (array) UserConfig::get($GLOBALS['user']->id)->getValue('CALENDAR_SETTINGS');
foreach ($calendar_user_control_data as $key => $value) {
$this->{$key} = $value;
}
}
示例4: before_filter
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
PageLayout::setHelpKeyword('Basis.Terminkalender');
$this->settings = UserConfig::get($GLOBALS['user']->id)->getValue('CALENDAR_SETTINGS');
if (!is_array($this->settings)) {
$this->settings = Calendar::getDefaultUserSettings();
}
URLHelper::bindLinkParam('atime', $this->atime);
$this->atime = Request::int('atime', time());
$this->category = Request::int('category');
$this->last_view = Request::option('last_view', $this->settings['view']);
$this->action = $action;
$this->restrictions = $this->category ? array('STUDIP_CATEGORY' => $this->category) : null;
if ($this->category) {
URLHelper::bindLinkParam('category', $this->category);
}
$self = Request::option('self');
// var_dump($_SESSION['SessSemName'], $self); exit;
if (!$self && $_SESSION['SessSemName']['class'] == 'sem') {
$this->range_id = Request::option('cid');
Navigation::activateItem('/course/calendar');
} else {
$this->range_id = Request::option('range_id', $GLOBALS['user']->id);
Navigation::activateItem('/calendar/calendar');
URLHelper::bindLinkParam('range_id', $this->range_id);
}
URLHelper::bindLinkParam('last_view', $this->last_view);
}
示例5: showFolder
/**
* Liefert die vorhandenen Nachrichten eines Ordners des
* autorisierten Nutzers zurück.
*
* @get /user/:user_id/:box/:folder_id
*/
public function showFolder($user_id, $box, $folder_id)
{
$settings = \UserConfig::get($user_id)->MESSAGING_SETTINGS ?: array();
$type = substr($box, 0, -3);
if ($folder_id != 0 && (!isset($settings['folder'][$type][$folder_id]) || $settings['folder'][$type][$folder_id] === 'dummy')) {
$this->notFound();
}
// only your messages!
if ($user_id !== self::currentUser()) {
$this->error(401);
}
// get all messages in the user's folder
$ids = self::folder($user_id, $box === 'inbox' ? 'rec' : 'snd', $folder_id);
$total = count($ids);
$ids = array_slice($ids, $this->offset, $this->limit, true);
$messages = array();
if (sizeof($ids)) {
foreach (\Message::findMany($ids) as $msg) {
$url = $this->urlf('/message/%s', array($msg->id));
$messages[$url] = $this->messageToJSON($msg);
}
}
$this->etag(md5(serialize($messages)));
return $this->paginated($messages, $total, compact('user_id', 'box', 'folder_id'));
}
示例6: bulkSend
/**
* Sends the collected messages from sendingMail as e-mail.
*/
function bulkSend()
{
// if nothing to do, return
if (empty($this->bulk_mail)) {
return;
}
// send a mail, for each language one
foreach ($this->bulk_mail as $lang_data) {
foreach ($lang_data as $data) {
$mail = new StudipMail();
$mail->setSubject($data['title']);
foreach ($data['users'] as $user_id => $to) {
$mail->addRecipient($to, get_fullname($user_id), 'Bcc');
}
$mail->setReplyToEmail('')->setBodyText($data['text']);
if (strlen($data['reply_to'])) {
$mail->setSenderEmail($data['reply_to'])->setSenderName($snd_fullname);
}
$user_cfg = UserConfig::get($user_id);
if ($user_cfg->getValue('MAIL_AS_HTML')) {
$mail->setBodyHtml($mailhtml);
}
if ($GLOBALS["ENABLE_EMAIL_ATTACHMENTS"]) {
foreach (get_message_attachments($data['message_id']) as $attachment) {
$mail->addStudipAttachment($attachment['dokument_id']);
}
}
$mail->send();
}
}
}
示例7: initItem
public function initItem()
{
global $user, $neux;
parent::initItem();
$my_messaging_settings = UserConfig::get($user->id)->MESSAGING_SETTINGS;
$lastVisitedTimestamp = isset($my_messaging_settings['last_box_visit']) ? (int) $my_messaging_settings['last_box_visit'] : 0;
$query = "SELECT SUM(mkdate > :time AND readed = 0) AS num_new,\n SUM(readed = 0) AS num_unread,\n SUM(readed = 1) AS num_read\n FROM message_user\n WHERE snd_rec = 'rec' AND user_id = :user_id AND deleted = 0";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':time', $lastVisitedTimestamp);
$statement->bindValue(':user_id', $GLOBALS['user']->id);
$statement->execute();
list($neux, $neum, $altm) = $statement->fetch(PDO::FETCH_NUM);
$this->setBadgeNumber($neum);
if ($neux > 0) {
$tip = sprintf(ngettext('Sie haben %d neue ungelesene Nachricht', 'Sie haben %d neue ungelesene Nachrichten', $neux), $neux);
} else {
if ($neum > 1) {
$tip = sprintf(ngettext('Sie haben %d ungelesene Nachricht', 'Sie haben %d ungelesene Nachrichten', $neum), $neum);
} else {
if ($altm > 1) {
$tip = sprintf(ngettext('Sie haben %d alte empfangene Nachricht', 'Sie haben %d alte empfangene Nachrichten', $altm), $altm);
} else {
$tip = _('Sie haben keine alten empfangenen Nachrichten');
}
}
}
$this->setImage(Icon::create('mail', 'navigation', ["title" => $tip]));
}
示例8: createUdpApplication
public static function createUdpApplication($config)
{
AutoLoad::addRoot(dirname(dirname($config)));
SysLog::init(UserConfig::getConfig('log'));
return new YaafUdpServ();
// return $class;
//进行路由解析等
}
示例9: __construct
public function __construct()
{
parent::__construct();
if (!is_null(UserConfig::$email_module)) {
throw new EmailModuleException("You can assign only one email module");
}
UserConfig::$email_module = $this;
}
示例10: saveEmailAlerts
/**
* @param User $model
* Add new email alerts and delete older
*/
private function saveEmailAlerts(User $model)
{
if (isset($_POST['User'])) {
UserConfig::model()->deleteAll("userId=" . $model->use_id . " AND configType ='" . UserConfig::TYPE_EMAIL_ALERT . "' AND configKey='" . UserConfig::KEY_EMAIL_ALERT_DEAL_STATUS . "'");
if (isset($_POST['User']['emailAlertForDealStatus'])) {
$emailAlerts = $_POST['User']['emailAlertForDealStatus'];
foreach ($emailAlerts as $k => $v) {
if ($v == 1) {
$userConfig = new UserConfig();
$userConfig->unsetAttributes();
$userConfig->userId = $model->use_id;
$userConfig->configType = UserConfig::TYPE_EMAIL_ALERT;
$userConfig->configKey = UserConfig::KEY_EMAIL_ALERT_DEAL_STATUS;
$userConfig->configValue = $k;
$userConfig->save();
}
}
}
}
}
示例11: before_filter
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
Navigation::activateItem("/pluginmarket/presenting");
if ($GLOBALS['perm']->have_perm("user")) {
$config = UserConfig::get($GLOBALS['user']->id);
$this->last_pluginmarket_visit = $config->getValue("last_pluginmarket_visit") ?: time();
$_SESSION['last_pluginmarket_visit'] = time();
$config->store("last_pluginmarket_visit", $_SESSION['last_pluginmarket_visit']);
}
PageLayout::addScript($this->plugin->getPluginURL() . "/assets/studiptable.js");
PageLayout::addScript($this->plugin->getPluginURL() . "/assets/pluginmarket.js");
$tags_statement = DBManager::get()->prepare("\n SELECT pluginmarket_tags.tag, COUNT(*) AS number\n FROM pluginmarket_tags\n INNER JOIN pluginmarket_plugins ON (pluginmarket_plugins.plugin_id = pluginmarket_tags.plugin_id)\n WHERE pluginmarket_tags. proposal = '0'\n AND pluginmarket_plugins.approved = 1\n AND pluginmarket_plugins.publiclyvisible = 1\n GROUP BY pluginmarket_tags.tag\n ORDER BY number DESC, RAND()\n LIMIT 25\n ");
$tags_statement->execute();
$this->tags = $tags_statement->fetchAll(PDO::FETCH_ASSOC);
// Set view
$_SESSION['pluginmarket']['view'] = Request::get('view') ?: $_SESSION['pluginmarket']['view'];
if (!isset($_SESSION['pluginmarket']['view'])) {
$_SESSION['pluginmarket']['view'] = 'tiles';
}
// Sidebar
$sidebar = Sidebar::Get();
// Create search widget
$searchWidget = new SearchWidget($this->url_for('presenting/all'));
$searchWidget->addNeedle(_('Suche'), 'search', true);
$sidebar->addWidget($searchWidget);
// Create cloud
$tagWidget = new LinkCloudWidget();
$tagWidget->setTitle(_("Beliebte Tags"));
foreach ($this->tags as $tag) {
$tagWidget->addLink($tag['tag'], $this->url_for('presenting/all', array('tag' => $tag['tag'])), $tag['number']);
}
$sidebar->addWidget($tagWidget);
// Create view widget
if ($action != 'details') {
$viewWidget = new ViewsWidget();
$viewWidget->addLink(_('Kacheln'), URLHelper::getLink('', array('view' => 'tiles')))->setActive($_SESSION['pluginmarket']['view'] == 'tiles');
$viewWidget->addLink(_('Liste'), $this->url_for('presenting/all', array('view' => 'list')))->setActive($_SESSION['pluginmarket']['view'] == 'list');
$sidebar->addWidget($viewWidget);
}
// Create versionfilter widget
$versionWidget = new OptionsWidget();
$versionWidget->setTitle(_('Stud.IP Version'));
// Create options for all studip versions
$_SESSION['pluginmarket']['version'] = Request::submitted('version') ? Request::get('version') : $_SESSION['pluginmarket']['version'];
$options[] = "<option value='" . URLHelper::getLink('', array('version' => 0)) . "'>" . _('Alle Versionen') . "</option>";
foreach (array_reverse(PluginMarket::getStudipReleases()) as $version) {
$options[] = "<option value='" . URLHelper::getLink('', array('version' => $version)) . "' " . ($_SESSION['pluginmarket']['version'] == $version ? "SELECTED" : "") . ">{$version}</option>";
}
$versionWidget->addElement(new WidgetElement('<select style="width: 100%" onchange="location = this.options[this.selectedIndex].value;">' . join("", $options) . '</select>'));
// Add checkbox to ignore older releases (use invese logic to be applied on startup)
$sidebar->addWidget($versionWidget, 'comments');
}
示例12: _getIncludes
protected function _getIncludes()
{
$config = array();
$config['js']['core'] = json_decode($this->getModule('FS')->read(self::INCLUDES_PATH), TRUE);
$core_css = $this->getModule('FS')->readDir("system/ui/core/interface", TRUE, array('file_type' => 'css', 'path_type' => FS::FILESYSTEM_PATH));
if ($this->isSession()) {
$user_config = new UserConfig();
$ui = $user_config->getConfig('ui', TRUE);
foreach (array('interface', 'icons') as $value) {
$this->set_session_value($value, $ui[$value]);
}
$user_css = $this->getModule('FS')->readDir("system/ui/" . $this->session['interface'] . "/interface", TRUE, array('file_type' => 'css', 'path_type' => FS::FILESYSTEM_PATH));
$user_js = [];
//$this->getModule('FS')->readDir("system/ui/".$this->session['interface']."/interface", TRUE, array('file_type' => 'js', 'path_type' => FS::FILESYSTEM_PATH));
} else {
$user_css = $this->getModule('FS')->readDir("system/ui/flatos/interface", TRUE, array('file_type' => 'css', 'path_type' => FS::FILESYSTEM_PATH));
$user_js = $this->getModule('FS')->readDir("system/ui/flatos/interface", TRUE, array('file_type' => 'js', 'path_type' => FS::FILESYSTEM_PATH));
}
$config['css']['core'] = $core_css;
$config['css']['user'] = $user_css;
$config['js']['user'] = $user_js;
return $config;
}
示例13: __construct
function __construct($user = null)
{
if ($user instanceof User) {
$this->user = $user;
} else {
$this->user = User::find($user);
}
if (!isset($this->user)) {
$this->user = new User();
$this->user->user_id = 'nobody';
}
$this->cfg = UserConfig::get($this->user->user_id);
$this->last_online_time = $this->get_last_action();
}
示例14: showUserConfiguration
/**
* Show the user configuration for one parameter
*
* @param string $user_id
* @param string $field
*
* @return array()
*/
public static function showUserConfiguration($user_id, $field)
{
$uconfig = UserConfig::get($user_id);
$config = Config::get();
$data = $config->getMetadata($field);
if (!count($data)) {
$data['field'] = $field;
$data['type'] = 'string';
$data['description'] = 'missing in table `config`';
}
$data['value'] = $uconfig->{$field};
$data['fullname'] = User::find($user_id)->getFullname();
return $data;
}
示例15: down
function down()
{
DBManager::get()->execute("ALTER TABLE `event_data` CHANGE `author_id` `autor_id` VARCHAR(32) NOT NULL");
DBManager::get()->execute("ALTER TABLE `calendar_event` DROP `mkdate`");
$replace = array('list' => 'showlist', 'day' => 'showday', 'week' => 'showweek', 'month' => 'showmonth', 'year' => 'showyear');
$default_settings = array('view' => 'week', 'start' => '9', 'end' => '20', 'step_day' => '900', 'step_week' => '1800', 'type_week' => 'LONG', 'delete' => '0', 'step_week_group' => '3600', 'step_day_group' => '3600');
$res = DBManager::get()->query("SELECT user_id FROM `user_config` WHERE field = 'CALENDAR_SETTINGS'");
foreach ($res as $row) {
$config = UserConfig::get($row['user_id']);
$settings = $config->getValue('CALENDAR_SETTINGS');
if (isset($settings['view'])) {
$default_settings['view'] = $replace[$settings['view']];
$config->store('CALENDAR_SETTINGS', $default_settings);
}
}
}