Exemplo n.º 1
0
 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]));
 }
Exemplo n.º 2
0
 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]));
 }
Exemplo n.º 3
0
 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]);
 }
Exemplo n.º 4
0
 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]));
 }