示例#1
0
文件: overview.php 项目: ratbird/hope
 /**
  * This method is called to show the form to upload a new avatar for a
  * course.
  *
  * @return void
  */
 function index_action()
 {
     // nothing to do
     if ($this->studygroup_mode) {
         $this->avatar = StudygroupAvatar::getAvatar($this->course_id);
     } else {
         $this->avatar = CourseAvatar::getAvatar($this->course_id);
     }
     if (get_config('NEWS_RSS_EXPORT_ENABLE') && $this->course_id) {
         $rss_id = StudipNews::GetRssIdFromRangeId($this->course_id);
         if ($rss_id) {
             PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $rss_id));
         }
     }
     // Fetch news
     $response = $this->relay('news/display/' . $this->course_id);
     $this->news = $response->body;
     // Fetch  votes
     if (get_config('VOTE_ENABLE')) {
         $response = $this->relay('questionnaire/widget/' . $this->course_id);
         $this->votes = $response->body;
     }
     // Fetch dates
     if (!$this->studygroup_mode) {
         $response = $this->relay("calendar/contentbox/display/{$this->course_id}/1210000");
         $this->dates = $response->body;
     }
 }
示例#2
0
 function getPortalTemplate()
 {
     $dispatcher = new StudipDispatcher();
     $controller = new NewsController($dispatcher);
     $response = $controller->relay('news/display/studip');
     $template = $GLOBALS['template_factory']->open('shared/string');
     $template->content = $response->body;
     if (StudipNews::CountUnread() > 0) {
         $navigation = new Navigation('', PluginEngine::getLink($this, array(), 'read_all'));
         $navigation->setImage(Icon::create('refresh', 'clickable', ["title" => _('Alle als gelesen markieren')]));
         $icons[] = $navigation;
     }
     if (get_config('NEWS_RSS_EXPORT_ENABLE')) {
         if ($rss_id = StudipNews::GetRssIdFromRangeId('studip')) {
             $navigation = new Navigation('', 'rss.php', array('id' => $rss_id));
             $navigation->setImage(Icon::create('rss', 'clickable', ["title" => _('RSS-Feed')]));
             $icons[] = $navigation;
         }
     }
     if ($GLOBALS['perm']->have_perm('root')) {
         $navigation = new Navigation('', 'dispatch.php/news/edit_news/new/studip');
         $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Ankündigungen bearbeiten')]), ["rel" => 'get_dialog']);
         $icons[] = $navigation;
         if (get_config('NEWS_RSS_EXPORT_ENABLE')) {
             $navigation = new Navigation('', 'dispatch.php/news/rss_config/studip');
             $navigation->setImage(Icon::create('rss+add', 'clickable', ["title" => _('RSS-Feed konfigurieren')]), ["data-dialog" => 'size=auto']);
             $icons[] = $navigation;
         }
     }
     $template->icons = $icons;
     return $template;
 }
示例#3
0
文件: overview.php 项目: ratbird/hope
 /**
  * show institute overview page
  *
  * @return void
  */
 function index_action()
 {
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage('sidebar/institute-sidebar.png');
     if (get_config('NEWS_RSS_EXPORT_ENABLE') && $this->institute_id) {
         $rss_id = StudipNews::GetRssIdFromRangeId($this->institute_id);
         if ($rss_id) {
             PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $rss_id));
         }
     }
     URLHelper::bindLinkParam("inst_data", $this->institut_main_data);
     // (un)subscribe to institute
     if (Config::get()->ALLOW_SELFASSIGN_INSTITUTE && $GLOBALS['user']->id !== 'nobody' && !$GLOBALS['perm']->have_perm('admin')) {
         $widget = new ActionsWidget();
         if (!$GLOBALS['perm']->have_studip_perm('user', $this->institute_id)) {
             $url = URLHelper::getLink('dispatch.php/institute/overview', array('follow_inst' => 'on'));
             $widget->addLink(_('Einrichtung abonnieren'), $url);
         } elseif (!$GLOBALS['perm']->have_studip_perm('autor', $this->institute_id)) {
             $url = URLHelper::getLink('dispatch.php/institute/overview', array('follow_inst' => 'off'));
             $widget->addLink(_('Austragen aus der Einrichtung'), $url);
         }
         $this->sidebar->addWidget($widget);
         if (!$GLOBALS['perm']->have_studip_perm('user', $this->institute_id) and Request::option('follow_inst') == 'on') {
             $query = "INSERT IGNORE INTO user_inst\n                          (user_id, Institut_id, inst_perms)\n                          VALUES (?, ?, 'user')";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->user_id, $this->institute_id));
             if ($statement->rowCount() > 0) {
                 log_event('INST_USER_ADD', $this->institute_id, $GLOBALS['user']->user_id, 'user');
                 PageLayout::postMessage(MessageBox::success(_("Sie haben die Einrichtung abonniert.")));
                 header('Location: ' . URLHelper::getURL('', array('cid' => $this->institute_id)));
                 die;
             }
         } elseif (!$GLOBALS['perm']->have_studip_perm('autor', $this->institute_id) and Request::option('follow_inst') == 'off') {
             $query = "DELETE FROM user_inst\n                          WHERE user_id = ?  AND Institut_id = ?";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->user_id, $this->institute_id));
             if ($statement->rowCount() > 0) {
                 log_event('INST_USER_DEL', $this->institute_id, $GLOBALS['user']->user_id, 'user');
                 PageLayout::postMessage(MessageBox::success(_("Sie haben sich aus der Einrichtung ausgetragen.")));
                 header('Location: ' . URLHelper::getURL('', array('cid' => $this->institute_id)));
                 die;
             }
         }
     }
     // Fetch news
     $response = $this->relay('news/display/' . $this->institute_id);
     $this->news = $response->body;
     // Fetch  votes
     if (get_config('VOTE_ENABLE')) {
         $response = $this->relay('questionnaire/widget/' . $this->institute_id . '/institute');
         $this->questionnaires = $response->body;
     }
     // Fetch dates
     $response = $this->relay("calendar/contentbox/display/{$this->institute_id}/1210000");
     $this->dates = $response->body;
 }
示例#4
0
 public static function GetRssIdFromUserId($user_id)
 {
     return StudipNews::GetRssIdFromRangeId($user_id);
 }
示例#5
0
文件: news.php 项目: ratbird/hope
 function rss_config_action($range_id)
 {
     if (!get_config('NEWS_RSS_EXPORT_ENABLE') || !StudipNews::haveRangePermission('edit', $range_id)) {
         throw new AccessDeniedException();
     }
     if (Request::isPost()) {
         if (Request::submitted('rss_on')) {
             StudipNews::SetRssId($range_id);
         } else {
             StudipNews::UnsetRssId($range_id);
         }
     }
     $this->range_id = $range_id;
     $this->rss_id = StudipNews::GetRssIdFromRangeId($range_id);
 }