Exemple #1
0
 /**
  * Mapping function where to find what
  * @param type $object the object
  * @param type $function the called function
  * @return string output
  */
 private static function map($object, $function)
 {
     /**
      * If you want to add an object to the helper simply add to this array
      */
     $mapping = array('User' => array('link' => function ($obj) {
         return URLHelper::getLink('dispatch.php/profile', array('username' => $obj->username));
     }, 'name' => function ($obj) {
         return htmlReady($obj->getFullname());
     }, 'avatar' => function ($obj) {
         return Avatar::getAvatar($obj->id, $obj->username)->getImageTag(Avatar::SMALL, array('title' => htmlReady($obj->getFullname('no_title'))));
     }), 'Course' => array('link' => function ($obj) {
         return URLHelper::getLink('seminar_main.php', array('auswahl' => $obj->id));
     }, 'name' => function ($obj) {
         return htmlReady($obj->name);
     }, 'avatar' => function ($obj) {
         return CourseAvatar::getAvatar($obj->id)->getImageTag($size = CourseAvatar::SMALL, array('title' => htmlReady($obj->name)));
     }));
     /*
      * Some php magic to call the right function if it exists
      */
     if ($object && $mapping[get_class($object)]) {
         return $mapping[get_class($object)][$function]($object);
     }
     return "";
 }
 /**
  * get admin module links
  *
  * returns links add or remove a module from course
  * @access public
  * @return string returns html-code
  */
 function getAdminModuleLinks()
 {
     global $connected_cms, $view, $search_key, $cms_select, $current_module;
     $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
     $output .= CSRFProtection::tokenTag();
     $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
     if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
         $output .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
     } elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
         $output .= "<div align=\"left\"><input type=\"CHECKBOX\" value=\"1\" name=\"write_permission\" style=\"vertical-align:middle\">";
         $output .= _("Mit Schreibrechten für alle Dozenten/Tutoren dieser Veranstaltung") . "<br>";
         $output .= "<input type=\"CHECKBOX\" value=\"1\" style=\"vertical-align:middle\" name=\"write_permission_autor\">";
         $output .= _("Mit Schreibrechten für alle Teilnehmer dieser Veranstaltung") . "</div>";
         $output .= Button::create(_('Hinzufügen'), 'add') . "<br>";
     } else {
         $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
     }
     $output .= "</form>";
     return $output;
     //      $output .= parent::getAdminModuleLinks();
 }
 public static function markupHashtags($markup, $matches)
 {
     if (self::$course_hashes) {
         $url = URLHelper::getLink("plugins.php/Blubber/forum/forum", array('hash' => $matches[2], 'cid' => self::$course_hashes));
     } else {
         $url = URLHelper::getLink("plugins.php/Blubber/forum/globalstream", array('hash' => $matches[2]));
     }
     return $matches[1] . '<a href="' . $url . '" class="hashtag">#' . $markup->quote($matches[2]) . '</a>';
 }
Exemple #4
0
 /**
  * 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;
 }
 function getColumnName($id, $print_view = false)
 {
     $res_obj = ResourceObject::Factory($this->show_columns[$id]);
     if (!$print_view) {
         $ret = '<a class="tree" href="' . URLHelper::getLink('?show_object=' . $this->show_columns[$id] . '&view=' . (Request::option('view') == 'openobject_group_schedule' ? 'openobject_schedule' : 'view_schedule')) . '">' . htmlReady($res_obj->getName()) . '</a>' . ($res_obj->getSeats() ? '<br>(' . $res_obj->getSeats() . ')' : '');
     } else {
         $ret = '<span style="font-size:10pt;">' . htmlReady($res_obj->getName()) . '</span>';
     }
     return $ret . chr(10);
 }
Exemple #6
0
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $items = array();
     $type = get_object_type($course_id, array('sem', 'inst', 'fak'));
     if ($type == 'sem') {
         $query = 'SELECT wiki.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM wiki
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN seminar_user ON (range_id = Seminar_id)
             JOIN seminare USING (Seminar_id)
             WHERE seminar_user.user_id = ? AND Seminar_id = ? 
                 AND wiki.chdate > ?';
     } else {
         $query = 'SELECT wiki.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM wiki
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN user_inst ON (range_id = Institut_id)
             JOIN Institute USING (Institut_id)
             WHERE user_inst.user_id = ? AND Institut_id = ? 
                 AND wiki.chdate > ?';
     }
     $wikipage_stmt = DBManager::get()->prepare("SELECT * FROM wiki\n            WHERE keyword = ? AND range_id = ?\n                AND version = ?");
     $stmt = DBManager::get()->prepare($query);
     $stmt->execute(array($user_id, $course_id, $since));
     while ($row = $stmt->fetch()) {
         // use correct text depending on type of object
         if ($type == 'sem') {
             if ($row['version'] > 1) {
                 $summary = sprintf('%s hat im Wiki der Veranstaltung "%s" die Seite "%s" geändert.', $row['fullname'], $row['Name'], $row['keyword']);
             } else {
                 $summary = sprintf('%s hat im Wiki der Veranstaltung "%s" die Seite "%s" erstellt.', $row['fullname'], $row['Name'], $row['keyword']);
             }
         } else {
             if ($row['version'] > 1) {
                 $summary = sprintf('%s hat im Wiki der Einreichtung "%s" die Seite "%s" geändert.', $row['fullname'], $row['Name'], $row['keyword']);
             } else {
                 $summary = sprintf('%s hat im Wiki der Einreichtung "%s" die Seite "%s" erstellt.', $row['fullname'], $row['Name'], $row['keyword']);
             }
         }
         $content = '';
         if ($row['version'] > 1) {
             $wikipage_stmt->execute(array($row['keyword'], $row['range_id'], $row['version'] - 1));
             $old_page = $wikipage_stmt->fetch(PDO::FETCH_ASSOC);
             $content = '<table>' . do_diff($old_page['body'], $row['body']) . '</table>';
         } else {
             $content = wikiReady($row['body']);
         }
         $items[] = new ContentElement('Wiki: ' . $row['keyword'], $summary, $content, $row['user_id'], $row['fullname'], URLHelper::getLink('wiki.php', array('cid' => $row['range_id'], 'keyword' => $row['keyword'])), $row['chdate']);
     }
     return $items;
 }
Exemple #7
0
 public function set_sidebar()
 {
     $sidebar = Sidebar::Get();
     $sidebar->setImage('sidebar/studygroup-sidebar.png');
     $sidebar->setTitle(_('Meine Studiengruppen'));
     if (count($this->studygroups) > 0) {
         $setting_widget = new ActionsWidget();
         $setting_widget->setTitle(_("Aktionen"));
         $setting_widget->addLink(_('Farbgruppierung ändern'), URLHelper::getLink('dispatch.php/my_courses/groups/all/true'), Icon::create('group4', 'clickable'), array('data-dialog' => 'buttons=true'));
         $sidebar->addWidget($setting_widget);
     }
 }
Exemple #8
0
 public function setUrl($url)
 {
     $query = parse_url($url, PHP_URL_QUERY);
     if ($query) {
         $url = str_replace('?' . $query, '', $url);
         parse_str(html_entity_decode($query) ?: '', $query_params);
     } else {
         $query_params = array();
     }
     $this->template_variables['url'] = URLHelper::getLink($url);
     $this->template_variables['params'] = $query_params;
 }
Exemple #9
0
 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');
 }
Exemple #10
0
/**
 * Returns an overview of certain documents
 *
 * @param Array $documents Ids of the documents in question
 * @param mixed $open      Array containing open states of documents
 * @return string Overview of documents as html, ready to be displayed
 */
function show_documents($documents, $open = null)
{
    if (!is_array($documents)) {
        return;
    }
    if (!is_null($open) && !is_array($open)) {
        $open = null;
    }
    if (is_array($open)) {
        reset($open);
        $ank = key($open);
    }
    if (!empty($documents)) {
        $query = "SELECT {$GLOBALS['_fullname_sql']['full']} AS fullname, username, user_id,\n                         dokument_id, filename, filesize, downloads, protected, url, description,\n                         IF(IFNULL(name, '') = '', filename, name) AS t_name,\n                         GREATEST(a.chdate, a.mkdate) AS chdate\n                  FROM dokumente AS a\n                  LEFT JOIN auth_user_md5 USING (user_id)\n                  LEFT JOIN user_info USING (user_id)\n                  WHERE dokument_id IN (?)\n                  ORDER BY a.chdate DESC";
        $statement = DBManager::get()->prepare($query);
        $statement->execute(array($documents));
        $documents = $statement->fetchAll(PDO::FETCH_ASSOC);
    }
    foreach ($documents as $index => $document) {
        $type = empty($document['url']) ? 0 : 6;
        $is_open = is_null($open) || $open[$document['dokument_id']] ? 'open' : 'close';
        $extension = getFileExtension($document['filename']);
        // Create icon
        $icon = sprintf('<a href="%s">%s</a>', GetDownloadLink($document['dokument_id'], $document['filename'], $type), GetFileIcon($extension, true)->asImg());
        // Create open/close link
        $link = $is_open === 'open' ? URLHelper::getLink('#dok_anker', array('close' => $document['dokument_id'])) : URLHelper::getLink('#dok_anker', array('open' => $document['dokument_id']));
        // Create title including filesize and number of downloads
        $size = $document['filesize'] > 1024 * 1024 ? sprintf('%u MB', round($document['filesize'] / 1024 / 1024)) : sprintf('%u kB', round($document['filesize'] / 1024));
        $downloads = $document['downloads'] == 1 ? '1 ' . _('Download') : $document['downloads'] . ' ' . _('Downloads');
        $title = sprintf('<a href="%s"%s class="tree">%s</a> (%s / %s)', $link, $ank == $document['dokument_id'] ? ' name="dok_anker"' : '', htmlReady(mila($document['t_name'])), $size, $downloads);
        // Create additional information
        $addon = sprintf('<a href="%s">%s</a> %s', URLHelper::getLink('dispatch.php/profile', array('username' => $document['username'])), $document['fullname'], date('d.m.Y H:i', $document['chdate']));
        if ($document['protected']) {
            $addon = tooltipicon(_('Diese Datei ist urheberrechtlich geschützt!')) . ' ' . $addon;
        }
        if (!empty($document['url'])) {
            $addon .= ' ' . Icon::create('link-extern', 'clickable', ['title' => _('Diese Datei wird von einem externen Server geladen!')])->asImg(16);
        }
        // Attach created variables to document
        $documents[$index]['addon'] = $addon;
        $documents[$index]['extension'] = $extension;
        $documents[$index]['icon'] = $icon;
        $documents[$index]['is_open'] = $is_open;
        $documents[$index]['link'] = $link;
        $documents[$index]['title'] = $title;
        $documents[$index]['type'] = $type;
    }
    $template = $GLOBALS['template_factory']->open('user_activities/files-details');
    $template->documents = $documents;
    return $template->render();
}
 /**
  * get admin module links
  *
  * returns links add or remove a module from course
  * @access public
  * @return string returns html-code
  */
 function getAdminModuleLinks()
 {
     global $connected_cms, $view, $search_key, $cms_select, $current_module;
     if (!$connected_cms[$this->cms_type]->content_module[$current_module]->isDummy()) {
         $result = $connected_cms[$this->cms_type]->soap_client->getPath($connected_cms[$this->cms_type]->content_module[$current_module]->getId());
     }
     if ($result) {
         $output .= "<i>Pfad: " . htmlReady($result) . "</i><br><br>";
     }
     $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
     $output .= CSRFProtection::tokenTag();
     $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
     if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
         $output .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
     } elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
         $output .= "<div align=\"left\">";
         if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_COPY) and !in_array($connected_cms[$this->cms_type]->content_module[$current_module]->module_type, array("lm", "htlm", "sahs", "cat", "crs", "dbk"))) {
             $output .= "<input type=\"CHECKBOX\" name=\"copy_object\" value=\"1\">";
             $output .= _("Als Kopie anlegen") . "&nbsp;";
             $output .= Icon::create('info-circle', 'inactive', ['title' => _('Wenn Sie diese Option wählen, wird eine identische Kopie als eigenständige Instanz des Lernmoduls erstellt. Anderenfalls wird ein Link zum Lernmodul gesetzt.')])->asImg();
             $output .= "<br>";
         }
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"none\" checked>";
         $output .= _("Keine Schreibrechte") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Nur der/die BesitzerIn des Lernmoduls hat Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "<br>";
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"dozent\">";
         $output .= _("Mit Schreibrechten für alle Lehrenden dieser Veranstaltung") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "<br>";
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"tutor\">";
         $output .= _("Mit Schreibrechten für alle Lehrenden und Tutor/-innen dieser Veranstaltung") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende und Tutor/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "<br>";
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"autor\">";
         $output .= _("Mit Schreibrechten für alle Personen dieser Veranstaltung") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende, Tutor/-innen und Teilnehmer/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "</div>";
         $output .= "</div><br>" . Button::create(_('Hinzufügen'), 'add') . "<br>";
     } else {
         $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
     }
     $output .= "</form>";
     return $output;
 }
Exemple #12
0
 /**
  * Returns the Flexi template for entering the necessary values
  * for this step.
  *
  * @param Array $values Pre-set values
  * @param int $stepnumber which number has the current step in the wizard?
  * @param String $temp_id temporary ID for wizard workflow
  * @return String a Flexi template for getting needed data.
  */
 public function getStepTemplate($values, $stepnumber, $temp_id)
 {
     // We only need our own stored values here.
     $values = $values[__CLASS__];
     // Load template from step template directory.
     $factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
     $tpl = $factory->open('studyareas/index');
     if ($values['studyareas']) {
         $tree = $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findMany($values['studyareas'])), false);
         $tpl->set_attribute('assigned', $tree);
     } else {
         $tpl->set_attribute('assigned', array());
     }
     $tpl->set_attribute('values', $values);
     // First tree level is always shown.
     $tree = StudipStudyArea::findByParent(StudipStudyArea::ROOT);
     if (count($tree) == 0) {
         PageLayout::postError(formatReady(_('Das Anlegen einer ' . 'Veranstaltung ist nicht möglich, da keine Studienbereiche ' . 'existieren. Bitte wenden Sie sich an [die ' . 'Stud.IP-Administration]' . URLHelper::getLink('dispatch.php/siteinfo/show') . ' .')));
         return false;
     }
     /*
      * Someone works without JS activated, load all ancestors and
      * children of open node.
      */
     if ($values['open_node']) {
         $tpl->set_attribute('open_nodes', $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findByParent($values['open_node'])), false, true));
     }
     /*
      * Someone works without JS and has entered a search term:
      * build the partial tree with search results.
      */
     if ($values['searchterm']) {
         $search = $this->searchSemTree($values['searchterm'], false, true);
         if ($search) {
             $tpl->set_attribute('open_nodes', $search);
             $tpl->set_attribute('search_result', $search);
             unset($values['open_node']);
         } else {
             PageLayout::postMessage(MessageBox::info(_('Es wurde kein Suchergebnis gefunden.')));
             unset($values['searchterm']);
         }
     }
     $tpl->set_attribute('tree', $tree);
     $tpl->set_attribute('ajax_url', $values['ajax_url'] ?: URLHelper::getLink('dispatch.php/course/wizard/ajax'));
     $tpl->set_attribute('no_js_url', $values['no_js_url'] ?: 'dispatch.php/course/wizard/forward/' . $stepnumber . '/' . $temp_id);
     $tpl->set_attribute('stepnumber', $stepnumber);
     $tpl->set_attribute('temp_id', $temp_id);
     return $tpl->render();
 }
 /**
  *
  **/
 public static function onEnable($pluginId)
 {
     # TODO performance - use cache on success ?
     $role_persistence = new RolePersistence();
     $plugin_roles = $role_persistence->getAssignedPluginRoles($pluginId);
     $role_names = array_map(function ($role) {
         return $role->getRolename();
     }, $plugin_roles);
     if (!in_array('Nobody', $role_names)) {
         $message = _('Das OAuth-Plugin ist aktiviert, aber nicht für die Rolle "Nobody" freigegeben.');
         $details = array();
         $details[] = _('Dies behindert die Kommunikation externer Applikationen mit dem System.');
         $details[] = sprintf(_('Klicken Sie <a href="%s">hier</a>, um die Rollenzuweisung zu bearbeiten.'), URLHelper::getLink('dispatch.php/admin/role/assign_plugin_role/' . $pluginId));
         PageLayout::postMessage(Messagebox::info($message, $details));
     }
 }
Exemple #14
0
 public function perform($unconsumed)
 {
     if ($unconsumed !== 'read_all') {
         return;
     }
     $global_news = StudipNews::GetNewsByRange('studip', true);
     foreach ($global_news as $news) {
         object_add_view($news['news_id']);
         object_set_visit($news['news_id'], 'news');
     }
     if (Request::isXhr()) {
         echo json_encode(true);
     } else {
         PageLayout::postMessage(MessageBox::success(_('Alle Ankündigungen wurden als gelesen markiert.')));
         header('Location: ' . URLHelper::getLink('dispatch.php/start'));
     }
 }
Exemple #15
0
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;
    }
}
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $items = array();
     $stmt = DBManager::get()->prepare('SELECT seminar_user.*, seminare.Name,
         ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
         FROM seminar_user
         JOIN auth_user_md5 USING (user_id)
         JOIN user_info USING (user_id)
         JOIN seminare USING (Seminar_id)
         WHERE Seminar_id = ? 
             AND seminar_user.mkdate > ?');
     $stmt->execute(array($course_id, $since));
     while ($row = $stmt->fetch()) {
         $summary = sprintf('%s ist der Studiengruppe "%s" beigetreten.', $row['fullname'], $row['Name']);
         $items[] = new ContentElement('Studiengruppe: Neue/r Teilnehmer/in', $summary, '', $row['user_id'], $row['fullname'], URLHelper::getLink('dispatch.php/course/studygroup/members/' . $row['Seminar_id'], array('cid' => $row['Seminar_id'])), $row['mkdate']);
     }
     return $items;
 }
Exemple #17
0
 /**
  * Returns all columns of the calendar-view and removes everything that
  * is not needed and links the entry to the details page of the course.
  *
  * @return array of CalendarColumn
  */
 public function getColumns()
 {
     foreach ($this->entries as $column) {
         $column->setURL(false);
         foreach ($column->entries as $key => $entry) {
             if (isset($entry['cycle_id'])) {
                 list($course_id, $cycle_id) = explode('-', $entry['id']);
                 $url = URLHelper::getLink('dispatch.php/course/details/?sem_id=' . $course_id);
                 $column->entries[$key]['url'] = $url;
             } else {
                 unset($column->entries[$key]['url']);
             }
             unset($column->entries[$key]['onClick']);
             unset($column->entries[$key]['icons']);
         }
     }
     return $this->entries;
 }
Exemple #18
0
 /**
  * get module-links for admin
  *
  * returns links to remove or add module to object
  * @access public
  * @return string html-code
  */
 function getAdminModuleLinks()
 {
     global $connected_cms, $view, $search_key, $cms_select, $current_module;
     $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
     $output .= CSRFProtection::tokenTag();
     $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
     if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
         $output .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
     } else {
         $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
     }
     $output .= "</form>";
     return $output;
 }
Exemple #19
0
 function show_action()
 {
     $this->url_params = array();
     if (Request::get('from')) {
         $this->url_params['from'] = Request::get('from');
     }
     if (Request::get('open_node')) {
         $this->url_params['open_node'] = Request::get('open_node');
     }
     if (!Request::isXhr()) {
         Navigation::activateItem('course/admin/study_areas');
         $sidebar = Sidebar::get();
         $sidebar->setImage('sidebar/admin-sidebar.png');
         if ($this->course) {
             $links = new ActionsWidget();
             foreach (Navigation::getItem('/course/admin/main') as $nav) {
                 if ($nav->isVisible(true)) {
                     $image = $nav->getImage();
                     $links->addLink($nav->getTitle(), URLHelper::getLink($nav->getURL(), array('studip_ticket' => Seminar_Session::get_ticket())), $image);
                 }
             }
             $sidebar->addWidget($links);
             // Entry list for admin upwards.
             if ($GLOBALS['perm']->have_studip_perm("admin", $GLOBALS['SessionSeminar'])) {
                 $list = new SelectorWidget();
                 $list->setUrl("?#admin_top_links");
                 $list->setSelectParameterName("cid");
                 foreach (AdminCourseFilter::get()->getCoursesForAdminWidget() as $seminar) {
                     $list->addElement(new SelectElement($seminar['Seminar_id'], $seminar['Name']), 'select-' . $seminar['Seminar_id']);
                 }
                 $list->setSelection($this->course->id);
                 $sidebar->addWidget($list);
             }
         }
     }
     if (Request::get('open_node')) {
         $this->values['StudyAreasWizardStep']['open_node'] = Request::get('open_node');
     }
     $this->tree = $this->step->getStepTemplate($this->values, 0, 0);
 }
Exemple #20
0
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $items = array();
     $type = get_object_type($course_id, array('sem', 'inst', 'fak'));
     if ($type == 'sem') {
         $query = 'SELECT dokumente.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM dokumente
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN seminar_user USING (Seminar_id)
             JOIN seminare USING (Seminar_id)
             WHERE seminar_user.user_id = ? AND Seminar_id = ? 
                 AND dokumente.chdate > ?';
     } else {
         $query = 'SELECT dokumente.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM dokumente
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN user_inst ON (seminar_id = Institut_id)
             JOIN Institute USING (Institut_id)
             WHERE user_inst.user_id = ? AND Institut_id = ? 
                 AND dokumente.chdate > ?';
     }
     $stmt = DBManager::get()->prepare($query);
     $stmt->execute(array($user_id, $course_id, $since));
     while ($row = $stmt->fetch()) {
         $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $row['seminar_id']));
         if ($folder_tree->isDownloadFolder($row['range_id'], $user_id)) {
             // use correct text depending on type of object
             if ($type == 'sem') {
                 $summary = sprintf('%s hat im Dateibereich der Veranstaltung "%s" die Datei "%s" hochgeladen.', $row['fullname'], $row['Name'], $row['name']);
             } else {
                 $summary = sprintf('%s hat im Dateibereich der Einrichtung "%s" die Datei "%s" hochgeladen.', $row['fullname'], $row['Name'], $row['name']);
             }
             // create ContentElement
             $items[] = new ContentElement(_('Datei') . ': ' . $row['name'], $summary, formatReady(GetDownloadLink($row['dokument_id'], $row['name'])), $row['user_id'], $row['fullname'], URLHelper::getLink('folder.php#anker', array('cid' => $row['seminar_id'], 'cmd' => 'tree', 'open' => $row['dokument_id'])), $row['chdate']);
         }
     }
     return $items;
 }
 function getItemContent($item_id)
 {
     $content = "\n<table width=\"90%\" cellpadding=\"2\" cellspacing=\"2\" align=\"center\" style=\"font-size:10pt\">";
     if ($item_id == "root") {
         $content .= "\n<tr><td class=\"table_header_bold\" align=\"left\">" . htmlReady($this->tree->root_name) . " </td></tr>";
         $content .= "\n<tr><td class=\"blank\" align=\"left\">" . htmlReady($this->root_content) . " </td></tr>";
         $content .= "\n</table>";
         return $content;
     }
     $range_object = RangeTreeObject::GetInstance($item_id);
     $name = $range_object->item_data['type'] ? $range_object->item_data['type'] . ": " : "";
     $name .= $range_object->item_data['name'];
     $content .= "\n<tr><td class=\"table_header_bold\" align=\"left\">" . htmlReady($name) . " </td></tr>";
     if (is_array($range_object->item_data_mapping)) {
         $content .= "\n<tr><td class=\"blank\" align=\"left\">";
         foreach ($range_object->item_data_mapping as $key => $value) {
             if ($range_object->item_data[$key]) {
                 $content .= "<b>" . htmlReady($value) . ":</b>&nbsp;";
                 $content .= formatLinks($range_object->item_data[$key]) . "&nbsp; ";
             }
         }
         $content .= "</td></tr><tr><td class=\"blank\" align=\"left\">" . "<a href=\"" . URLHelper::getLink("dispatch.php/institute/overview?auswahl=" . $range_object->item_data['studip_object_id']) . "\"" . tooltip(_("Seite dieser Einrichtung in Stud.IP aufrufen")) . ">" . htmlReady($range_object->item_data['name']) . "</a>&nbsp;" . _("in Stud.IP") . "</td></tr>";
     } elseif (!$range_object->item_data['studip_object']) {
         $content .= "\n<tr><td class=\"blank\" align=\"left\">" . _("Dieses Element ist keine Stud.IP-Einrichtung, es hat daher keine Grunddaten.") . "</td></tr>";
     } else {
         $content .= "\n<tr><td class=\"blank\" align=\"left\">" . _("Keine Grunddaten vorhanden!") . "</td></tr>";
     }
     $content .= "\n<tr><td>&nbsp;</td></tr>";
     $kategorien =& $range_object->getCategories();
     if ($kategorien->numRows) {
         while ($kategorien->nextRow()) {
             $content .= "\n<tr><td class=\"table_header_bold\">" . htmlReady($kategorien->getField("name")) . "</td></tr>";
             $content .= "\n<tr><td class=\"blank\">" . formatReady($kategorien->getField("content")) . "</td></tr>";
         }
     } else {
         $content .= "\n<tr><td class=\"blank\">" . _("Keine weiteren Daten vorhanden!") . "</td></tr>";
     }
     $content .= "</table>";
     return $content;
 }
Exemple #22
0
 /**
  * Before filter, set up the page by initializing the session and checking
  * all conditions.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // open session
     page_open(array('sess' => 'Seminar_Session', 'auth' => 'Seminar_Default_Auth', 'perm' => 'Seminar_Perm', 'user' => 'Seminar_User'));
     // set up user session
     include 'lib/seminar_open.php';
     if (!Config::Get()->SCM_ENABLE) {
         throw new AccessDeniedException(_('Die freien Informationsseiten sind nicht aktiviert.'));
     }
     $GLOBALS['auth']->login_if(Request::get('again') && $GLOBALS['auth']->auth['uid'] == 'nobody');
     $this->priviledged = $GLOBALS['perm']->have_studip_perm('tutor', $GLOBALS['SessSemName'][1]);
     if (Request::isXhr()) {
         $this->set_content_type('text/html;charset=Windows-1252');
     } else {
         $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     }
     if (!in_array($action, words('index create edit move delete'))) {
         array_unshift($args, $action);
         $action = 'index';
     }
     if (in_array($action, words('create edit move delete')) && !$this->priviledged) {
         throw new AccessDeniedException();
     }
     if ($GLOBALS['perm']->have_studip_perm('tutor', $GLOBALS['SessSemName'][1])) {
         $widget = new ActionsWidget();
         $widget->addLink(_('Neuen Eintrag anlegen'), URLHelper::getLink('dispatch.php/course/scm/create'), Icon::create('add', 'clickable'))->asDialog();
         Sidebar::get()->addWidget($widget);
     }
     PageLayout::setHelpKeyword('Basis.Informationsseite');
     Navigation::activateItem('/course/scm');
     checkObject();
     // do we have an open object?
     checkObjectModule('scm');
     object_set_visit_module('scm');
     // Set sidebar image
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/info-sidebar.png');
 }
Exemple #23
0
 /**
  * Edit or create a rule
  *
  * @param md5 $edit_id
  */
 function edit_action($id = null)
 {
     //get data
     $user_field = 'user';
     $semdata_field = 'usersemdata';
     $this->semFields = AuxLockRules::getSemFields();
     $this->entries_user = DataField::getDataFields($user_field);
     $this->entries_semdata = DataField::getDataFields($semdata_field);
     $this->rule = is_null($id) ? false : AuxLockRules::getLockRuleByID($id);
     if ($GLOBALS['perm']->have_perm('root') && count($this->entries_semdata) == 0) {
         $this->flash['info'] = sprintf(_('Sie müssen zuerst im Bereich %sDatenfelder%s in der Kategorie ' . '<i>Datenfelder für Personenzusatzangaben in Veranstaltungen</i> einen neuen Eintrag erstellen.'), '<a href="' . URLHelper::getLink('dispatch.php/admin/datafields') . '">', '</a>');
     }
     // save action
     if (Request::submitted('erstellen') || Request::submitted('uebernehmen')) {
         //checking for errors
         $errors = array();
         if (!Request::get('rulename')) {
             array_push($errors, _("Bitte geben Sie der Regel mindestens einen Namen!"));
         }
         if (!AuxLockRules::checkLockRule(Request::getArray('fields'))) {
             array_push($errors, _('Bitte wählen Sie mindestens ein Feld aus der Kategorie "Zusatzinformationen" aus!'));
         }
         if (!empty($errors)) {
             $this->flash['error'] = _("Ihre Eingaben sind ungültig.");
             $this->flash['error_detail'] = $errors;
             // save
         } else {
             //new
             if (is_null($id)) {
                 AuxLockRules::createLockRule(Request::get('rulename'), Request::get('description'), Request::getArray('fields'), Request::getArray('order'));
                 //edit
             } else {
                 AuxLockRules::updateLockRule($id, Request::get('rulename'), Request::get('description'), Request::getArray('fields'), Request::getArray('order'));
             }
             $this->flash['success'] = sprintf(_('Die Regel "%s" wurde erfolgreich gespeichert!'), htmlReady(Request::get('rulename')));
             $this->redirect('admin/specification');
         }
     }
 }
Exemple #24
0
 /**
  * Displays the deputy information of a user.
  */
 public function index_action()
 {
     if (Request::submitted('add_deputy') && ($deputy_id = Request::option('deputy_id'))) {
         $this->check_ticket();
         if (isDeputy($deputy_id, $this->user->user_id)) {
             $this->reportError(_('%s ist bereits als Vertretung eingetragen.'), get_fullname($deputy_id, 'full'));
         } else {
             if ($deputy_id == $this->user->user_id) {
                 $this->reportError(_('Sie können sich nicht als Ihre eigene Vertretung eintragen!'));
             } else {
                 if (addDeputy($deputy_id, $this->user->user_id)) {
                     $this->reportSuccess(_('%s wurde als Vertretung eingetragen.'), get_fullname($deputy_id, 'full'));
                 } else {
                     $this->reportError(_('Fehler beim Eintragen der Vertretung!'));
                 }
             }
         }
         $this->redirect('settings/deputies');
         return;
     }
     $deputies = getDeputies($this->user->user_id, true);
     $exclude_users = array($this->user->user_id);
     if (is_array($deputies)) {
         $exclude_users = array_merge($exclude_users, array_map(function ($d) {
             return $d['user_id'];
         }, $deputies));
     }
     $this->deputies = $deputies;
     $this->search = new PermissionSearch('user', _('Vor-, Nach- oder Benutzername'), 'user_id', array('permission' => getValidDeputyPerms(), 'exclude_user' => $exclude_users));
     $sidebar = Sidebar::Get();
     $sidebar->setTitle(PageLayout::getTitle());
     $actions = new ActionsWidget();
     // add "add dozent" to infobox
     $mp = MultiPersonSearch::get('settings_add_deputy')->setLinkText(_('Neue Standardvertretung festlegen'))->setDefaultSelectedUser(array_keys($this->deputies))->setLinkIconPath('')->setTitle(_('Neue Standardvertretung festlegen'))->setExecuteURL(URLHelper::getLink('dispatch.php/settings/deputies/add_member'))->setSearchObject($this->search)->setNavigationItem('/links/settings/deputies')->render();
     $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable'));
     $actions->addElement($element);
     Sidebar::Get()->addWidget($actions);
 }
Exemple #25
0
 /**
  * Returns a schedule entry for a course
  *
  * @param string  $seminar_id  the ID of the course
  * @param string  $user_id     the ID of the user
  * @param string  $cycle_id    optional; if given, specifies the ID of the entry
  * @return array  an array containing the properties of the entry
  */
 static function getSeminarEntry($seminar_id, $user_id, $cycle_id = false)
 {
     $ret = array();
     $sem = new Seminar($seminar_id);
     foreach ($sem->getCycles() as $cycle) {
         if (!$cycle_id || $cycle->getMetaDateID() == $cycle_id) {
             $entry = array();
             $entry['id'] = $seminar_id;
             $entry['cycle_id'] = $cycle->getMetaDateId();
             $entry['start_formatted'] = sprintf("%02d", $cycle->getStartStunde()) . ':' . sprintf("%02d", $cycle->getStartMinute());
             $entry['end_formatted'] = sprintf("%02d", $cycle->getEndStunde()) . ':' . sprintf("%02d", $cycle->getEndMinute());
             $entry['start'] = (int) $cycle->getStartStunde() * 100 + $cycle->getStartMinute();
             $entry['end'] = (int) $cycle->getEndStunde() * 100 + $cycle->getEndMinute();
             $entry['day'] = $cycle->getDay();
             $entry['content'] = $sem->getNumber() . ' ' . $sem->getName();
             $entry['url'] = URLHelper::getLink('dispatch.php/calendar/instschedule/entry/' . $seminar_id . '/' . $cycle->getMetaDateId());
             $entry['onClick'] = "function(id) { STUDIP.Instschedule.showSeminarDetails('{$seminar_id}', '" . $cycle->getMetaDateId() . "'); }";
             $entry['title'] = '';
             $ret[] = $entry;
         }
     }
     return $ret;
 }
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $items = array();
     $type = get_object_type($course_id, array('sem', 'inst', 'fak'));
     // only show new participants for seminars, not for institutes
     if ($type != 'sem') {
         return $items;
     }
     $stmt = DBManager::get()->prepare('SELECT seminar_user.*, seminare.Name, seminare.status,
         ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
         FROM seminar_user
         JOIN auth_user_md5 USING (user_id)
         JOIN user_info USING (user_id)
         JOIN seminare USING (Seminar_id)
         WHERE Seminar_id = ? 
             AND seminar_user.mkdate > ?');
     $stmt->execute(array($course_id, $since));
     while ($row = $stmt->fetch()) {
         $summary = sprintf('%s ist der Veranstaltung "%s" beigetreten.', $row['fullname'], $row['Name']);
         $items[] = new ContentElement('Studiengruppe: Neue/r Teilnehmer/in', $summary, '', $row['user_id'], $row['fullname'], URLHelper::getLink('seminar_main.php?auswahl=' . $row['Seminar_id'] . '&redirect_to=dispatch.php/course/member'), $row['mkdate']);
     }
     return $items;
 }
Exemple #27
0
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $items = array();
     $type = get_object_type($course_id, array('sem', 'inst', 'fak'));
     if ($type == 'sem') {
         $query = 'SELECT scm.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM scm
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN seminar_user ON (range_id = Seminar_id)
             JOIN seminare USING (Seminar_id)
             WHERE seminar_user.user_id = ? AND Seminar_id = ? 
                 AND scm.chdate > ?';
     } else {
         $query = 'SELECT scm.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM scm
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN user_inst ON (range_id = Institut_id)
             JOIN Institute USING (Institut_id)
             WHERE user_inst.user_id = ? AND Institut_id = ? 
                 AND scm.chdate > ?';
     }
     $stmt = DBManager::get()->prepare($query);
     $stmt->execute(array($user_id, $course_id, $since));
     while ($row = $stmt->fetch()) {
         // use correct text depending on type of object
         if ($type == 'sem') {
             $summary = sprintf('%s hat in der Veranstaltung "%s" die Informationsseite "%s" geändert.', $row['fullname'], $row['Name'], $row['tab_name']);
         } else {
             $summary = sprintf('%s hat in der Einreichtung "%s" die Informationsseite "%s" geändert.', $row['fullname'], $row['Name'], $row['tab_name']);
         }
         $link = URLHelper::getLink('dispatch.php/course/scm/' . $row['scm_id'], array('cid' => $row['range_id']));
         $items[] = new ContentElement('Freie Informationsseite: ' . $row['tab_name'], $summary, formatReady($row['content']), $row['user_id'], $row['fullname'], $link, $row['chdate']);
     }
     return $items;
 }
Exemple #28
0
                <?php 
echo date("j.n.Y", $posting['mkdate']) == date("j.n.Y") ? sprintf(_("%s Uhr"), date("G:i", $posting['mkdate'])) : date("j.n.Y", $posting['mkdate']);
?>
            </span>
            <? if ($GLOBALS['perm']->have_studip_perm("tutor", $posting['Seminar_id']) or ($posting['user_id'] === $GLOBALS['user']->id)) : ?>
            <a href="#" class="edit" onClick="return false;" style="vertical-align: middle; opacity: 0.6;">
                <?php 
echo Icon::create('tools', 'inactive', ['title' => _('Bearbeiten')])->asImg(14);
?>
            </a>
            <? endif ?>
        </div>
        <div class="name">
            <? if ($author_url) : ?>
            <a href="<?php 
echo URLHelper::getLink($author_url, array(), true);
?>
">
            <? endif ?>
                <?php 
echo htmlReady($author_name);
?>
            <? if ($author_url) : ?>
            </a>
            <? endif ?>
        </div>
        <div class="content">
            <?php 
echo $posting->getContent();
?>
        </div>
        </tr>
    <? endif; ?>
        <tr>
            <td>&nbsp;</td>
            <td colspan="2" align="center">
                <br>
                <?php 
echo Button::create(_('Übernehmen'));
?>
                <? if ($resObject->isUnchanged()) : ?>
                    <?php 
echo LinkButton::createCancel(_('Abbrechen'), URLHelper::getLink('?cancel_edit=' . $resObject->id));
?>
                <? endif; ?>
                <br>&nbsp;
            </td>
        </tr>
    </tbody>
</table>

</form>
<br><br>
<?
$sidebar = Sidebar::Get();
$sidebar->setTitle(htmlReady($resObject->getName()));
$action = new ActionsWidget();
$action->addLink(_('Ressourcensuche'), URLHelper::getLink('resources.php?view=search&quick_view_mode=' . $view_mode));

$sidebar->addWidget($action);
?>
Exemple #30
0
            if (is_array($rooms) && sizeof($rooms) > 0) :
                if ($show_room) :
                    if (count($dates) > 10) :
                        echo "<br />";
                    else :
                        echo ", ";
                    endif;

                    echo _("Ort:") . ' ';
                    if (sizeof($rooms) > 3) :
                        echo implode(', ', array_slice($rooms, sizeof($rooms) - 3, sizeof($rooms)));
                        echo sprintf(_(' (+%s weitere)'), sizeof($rooms) - 3);
                    else:
                        echo implode(', ', $rooms);
                    endif;
                endif;
            endif;
        endif;
    endif;

    if ($link_to_dates) :
        ?>
        <br>
        <?php 
echo sprintf(_("Details zu allen Terminen im %sAblaufplan%s"), '<a href="' . URLHelper::getLink('seminar_main.php', array('auswahl' => $seminar_id, 'redirect_to' => 'dispatch.php/course/dates')) . '">', '</a>');
?>
<?
    endif;
endif;