本文整理汇总了PHP中Navigation::initItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::initItem方法的具体用法?PHP Navigation::initItem怎么用?PHP Navigation::initItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::initItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initItem
public function initItem()
{
parent::initItem();
if (is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') {
if (WidgetHelper::hasWidget($GLOBALS['user']->id, 'News')) {
$news = StudipNews::CountUnread();
}
if (Config::get()->VOTE_ENABLE && WidgetHelper::hasWidget($GLOBALS['user']->id, 'Evaluations')) {
$threshold = Config::get()->NEW_INDICATOR_THRESHOLD ? strtotime("-{" . Config::get()->NEW_INDICATOR_THRESHOLD . "} days 0:00:00") : 0;
$statement = DBManager::get()->prepare("\n SELECT COUNT(*)\n FROM questionnaire_assignments\n INNER JOIN questionnaires ON (questionnaires.questionnaire_id = questionnaire_assignments.questionnaire_id)\n WHERE questionnaire_assignments.range_id = 'start'\n AND questionnaires.visible = 1\n AND questionnaires.startdate IS NOT NULL\n AND questionnaires.startdate > UNIX_TIMESTAMP()\n AND questionnaires.startdate > :threshold\n AND (questionnaires.stopdate IS NULL OR questionnaires.stopdate <= UNIX_TIMESTAMP())\n ");
$statement->execute(array('threshold' => $threshold));
$vote = (int) $statement->fetchColumn();
$query = "SELECT COUNT(IF(chdate > IFNULL(b.visitdate, :threshold) AND d.author_id != :user_id, a.eval_id, NULL))\n FROM eval_range a\n INNER JOIN eval d ON (a.eval_id = d.eval_id AND d.startdate < UNIX_TIMESTAMP() AND\n (d.stopdate > UNIX_TIMESTAMP() OR d.startdate + d.timespan > UNIX_TIMESTAMP() OR (d.stopdate IS NULL AND d.timespan IS NULL)))\n LEFT JOIN object_user_visits b ON (b.object_id = d.eval_id AND b.user_id = :user_id AND b.type = 'eval')\n WHERE a.range_id = 'studip'\n GROUP BY a.range_id";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':user_id', $GLOBALS['user']->id);
$statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
$statement->execute();
$vote += (int) $statement->fetchColumn();
}
}
$homeinfo = _('Zur Startseite');
if ($news) {
$homeinfo .= ' - ';
$homeinfo .= sprintf(ngettext('%u neue Ankündigung', '%u neue Ankündigungen', $news), $news);
}
if ($vote) {
$homeinfo .= ' - ';
$homeinfo .= sprintf(ngettext('%u neuer Fragebogen', '%u neue Fragebögen', $vote), $vote);
}
$this->setBadgeNumber($vote + $news);
$this->setImage(Icon::create('home', 'navigation', ["title" => $homeinfo]));
}
示例3: initItem
public function initItem()
{
global $user;
parent::initItem();
$db = DBManager::get();
$time = $user->cfg->PROFILE_LAST_VISIT ? $user->cfg->PROFILE_LAST_VISIT : $user->cfg->LAST_LOGIN_TIMESTAMP;
$hp_txt = _('Zu Ihrer Profilseite');
$hp_link = 'dispatch.php/profile';
$hp_txt .= sprintf(' (%s, %s)', $user->username, $user->perms);
$this->setURL($hp_link);
$this->setImage(Icon::create('person', 'navigation', ["title" => $hp_txt]), ["class" => $hp_class]);
}
示例4: initItem
public function initItem()
{
parent::initItem();
$onlinetip = _('Nur Sie sind online');
$user_count = get_users_online_count(10);
// Should be the same value as in public/index.php
if ($user_count) {
if ($user_count == 1) {
$onlinetip = _('Außer Ihnen ist eine Person online');
} else {
$onlinetip = sprintf(_('Es sind außer Ihnen %d Personen online'), $user_count);
}
}
$this->setImage(Icon::create('community', 'navigation', ["title" => $onlinetip]));
}