本文整理汇总了PHP中UserConfig::get方法的典型用法代码示例。如果您正苦于以下问题:PHP UserConfig::get方法的具体用法?PHP UserConfig::get怎么用?PHP UserConfig::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserConfig
的用法示例。
在下文中一共展示了UserConfig::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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]));
}
示例2: 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);
}
示例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: __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");
}
示例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: 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');
}
示例8: __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();
}
示例9: 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;
}
示例10: 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);
}
}
}
示例11: check_terms
function check_terms($userid, $_language_path) {
if (Request::get('i_accept_the_terms') == "yes") {
UserConfig::get($userid)->store('TERMS_ACCEPTED', 1);
return;
}
if ($GLOBALS['auth']->auth['uid'] != 'nobody' && !empty($GLOBALS['user']) && !$GLOBALS['user']->cfg->getValue('TERMS_ACCEPTED'))
{
?>
<table align="center" border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="table_header_bold">
<?= Icon::create('door-enter', 'info_alt')->asImg() ?>
<b><?=_("Nutzungsbedingungen")?></b>
</td>
</tr>
<tr>
<td class="blank">
<p><br><?=_("Stud.IP ist ein Open Source Projekt und steht unter der Gnu General Public License (GPL). Das System befindet sich in der ständigen Weiterentwicklung.")?></p>
<p><?=_("Um den vollen Funktionsumfang von Stud.IP nutzen zu können, müssen Sie sich am System anmelden.")?><br>
<?=_("Das hat viele Vorzüge:")?></p>
<ul>
<li><?=_("Zugriff auf Ihre Daten von jedem internetfähigen Rechner weltweit,")?></li>
<li><?=_("Anzeige neuer Mitteilungen oder Dateien seit Ihrem letzten Besuch,")?></li>
<li><?=_("Ein eigenes Profil im System,")?></li>
<li><?=_("die Möglichkeit anderen Personen Nachrichten zu schicken oder mit ihnen zu chatten,")?></li>
<li><?=_("und vieles mehr.")?></li>
</ul>
<p><?=_("Mit der Anmeldung werden die nachfolgenden Nutzungsbedingungen akzeptiert:")?></p>
<? include("locale/$_language_path/LC_HELP/pages/nutzung.html"); ?>
<p align="center">
<a href="<?= URLHelper::getLink(Request::url(), array('i_accept_the_terms' => 'yes')) ?>"><b><?=_("Ich erkenne die Nutzungsbedingungen an")?></b></a>
</p>
<br>
</td>
</tr>
</table>
<?php
include ('lib/include/html_end.inc.php');
die;
}
}
示例12: before_filter
/**
* Sets up the controller
*
* @param String $action Which action shall be invoked
* @param Array $args Arguments passed to the action method
*/
public function before_filter(&$action, &$args)
{
// Abwärtskompatibilität, erst ab 1.1 bekannt
if (!isset($GLOBALS['ALLOW_CHANGE_NAME'])) {
$GLOBALS['ALLOW_CHANGE_NAME'] = TRUE;
}
parent::before_filter($action, $args);
// Ensure user is logged in
$GLOBALS['auth']->login_if($action !== 'logout' && $GLOBALS['auth']->auth['uid'] === 'nobody');
// extract username
$username = Request::username('username', $GLOBALS['user']->username);
$user = User::findByUsername($username);
if (!$GLOBALS['perm']->have_profile_perm('user', $user->user_id)) {
$username = $GLOBALS['user']->username;
} else {
$username = $user->username;
URLHelper::addLinkParam('username', $username);
}
$this->about = new about($username, null);
$this->about->get_user_details();
if (!$this->about->check) {
$this->reportErrorWithDetails(_('Zugriff verweigert.'), array(_("Wahrscheinlich ist Ihre Session abgelaufen. Bitte " . "nutzen Sie in diesem Fall den untenstehenden Link, " . "um zurück zur Anmeldung zu gelangen.\n\n" . "Eine andere Ursache kann der Versuch des Zugriffs " . "auf Userdaten, die Sie nicht bearbeiten dürfen, sein. " . "Nutzen Sie den untenstehenden Link, um zurück auf " . "die Startseite zu gelangen."), sprintf(_('%s Hier%s geht es wieder zur Anmeldung beziehungsweise Startseite.'), '<a href="index.php">', '</a>')));
$this->render_nothing();
return;
}
$this->user = User::findByUsername($username);
$this->restricted = $GLOBALS['perm']->get_profile_perm($this->user->user_id) !== 'user' && $username !== $GLOBALS['user']->username;
$this->config = UserConfig::get($this->user->user_id);
$this->validator = new email_validation_class();
# Klasse zum Ueberpruefen der Eingaben
$this->validator->timeout = 10;
// Default auth plugin to standard
if (!$this->user->auth_plugin) {
$this->user->auth_plugin = 'standard';
}
PageLayout::addSqueezePackage('settings');
// Show info message if user is not on his own profile
if ($username != $GLOBALS['user']->username) {
$message = sprintf(_('Daten von: %s %s (%s), Status: %s'), htmlReady($this->user->Vorname), htmlReady($this->user->Nachname), $username, $this->user->perms);
$this->reportInfo($message);
}
Sidebar::get()->setImage('sidebar/person-sidebar.png');
$this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
}
示例13: getHTML
/**
* Returns the formatted list of skip links
*
* @return string the formatted list of skip links
*/
public static function getHTML()
{
$html = '';
if (UserConfig::get($GLOBALS['user']->id)->getValue('SKIPLINKS_ENABLE') && $GLOBALS['auth']->is_authenticated() && sizeof(self::$links)) {
Navigation::addItem('/skiplinks', new Navigation(''));
uasort(self::$links, create_function('$a, $b', 'return $a["position"] > $b["position"];'));
$i = 1;
$position = 0;
$overwriteable = false;
foreach (self::$links as $link) {
$navigation = new Navigation($link['name'], $link['url']);
$path = '/skiplinks/' . $i++;
Navigation::addItem($path, $navigation);
$position = $link['position'];
$overwriteable = $link['overwriteable'];
}
$navigation = Navigation::getItem('/skiplinks');
$html = $GLOBALS['template_factory']->render('skiplinks', compact('navigation'));
}
return $html;
}
示例14: getUserTrackerData
public static function getUserTrackerData()
{
$entities = array("character", "corporation", "alliance", "faction", "ship", "item", "system", "region");
$entlist = array();
foreach ($entities as $ent) {
Db::execute("update zz_users_config set locker = 'tracker_{$ent}' where locker = '{$ent}'");
$result = UserConfig::get("tracker_{$ent}");
$part = array();
if ($result != null) {
foreach ($result as $row) {
switch ($ent) {
case "system":
$row["solarSystemID"] = $row["id"];
$row["solarSystemName"] = $row["name"];
$sunType = Db::queryField("SELECT sunTypeID FROM ccp_systems WHERE solarSystemID = :id", "sunTypeID", array(":id" => $row["id"]));
$row["sunTypeID"] = $sunType;
break;
case "item":
$row["typeID"] = $row["id"];
$row["shipName"] = $row["name"];
break;
case "ship":
$row["shipTypeID"] = $row["id"];
$row["{$ent}Name"] = $row["name"];
break;
default:
$row["{$ent}ID"] = $row["id"];
$row["{$ent}Name"] = $row["name"];
break;
}
$part[] = $row;
}
}
$entlist[$ent] = $part;
}
return $entlist;
}
示例15: overview_action
public function overview_action()
{
if (Navigation::hasItem("/lernmarktplatz/overview")) {
Navigation::activateItem("/lernmarktplatz/overview");
}
$tag_matrix_entries_number = 9;
$tag_subtags_number = 6;
if (Request::get("disable_maininfo")) {
UserConfig::get($GLOBALS['user']->id)->store("LERNMARKTPLATZ_DISABLE_MAININFO", 1);
$this->redirect("market/overview");
}
if (Request::get("tags")) {
$tags = $this->tag_history = explode(",", Request::get("tags"));
$this->without_tags = array();
$tag_to_search_for = array_pop($tags);
foreach (LernmarktplatzTag::findBest($tag_matrix_entries_number, true) as $related_tag) {
if ($related_tag['tag_hash'] !== $this->tag_history[0]) {
$this->without_tags[] = $related_tag['tag_hash'];
}
}
//array_shift($this->tag_history);
foreach ($tags as $tag) {
foreach (LernmarktplatzTag::findRelated($tag, $this->without_tags, $tag_subtags_number, true) as $related_tag) {
$this->without_tags[] = $related_tag['tag_hash'];
}
}
$this->more_tags = LernmarktplatzTag::findRelated($tag_to_search_for, $this->without_tags, $tag_subtags_number);
$this->materialien = LernmarktplatzMaterial::findByTagHash($tag_to_search_for);
} elseif (Request::get("search")) {
$this->materialien = LernmarktplatzMaterial::findByText(Request::get("search"));
} elseif (Request::get("tag")) {
$this->materialien = LernmarktplatzMaterial::findByTag(Request::get("tag"));
} else {
$this->best_nine_tags = LernmarktplatzTag::findBest($tag_matrix_entries_number);
}
}