Ejemplo n.º 1
0
 /**
  * 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;
     }
 }
Ejemplo n.º 2
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->course_id = current($args);
     if ($this->course_id === '' || get_object_type($this->course_id) !== 'sem' || !$GLOBALS['perm']->have_studip_perm("tutor", $this->course_id)) {
         $this->set_status(403);
         return FALSE;
     }
     $this->body_id = 'custom_avatar';
     PageLayout::setTitle(Course::findCurrent()->getFullname() . ' - ' . _('Bild ändern'));
     $sem = Seminar::getInstance($this->course_id);
     $this->studygroup_mode = $sem->getSemClass()->offsetget("studygroup_mode");
     if ($this->studygroup_mode) {
         $this->avatar = StudygroupAvatar::getAvatar($this->course_id);
     } else {
         $this->avatar = CourseAvatar::getAvatar($this->course_id);
     }
     Navigation::activateItem('/course/admin/avatar');
 }
Ejemplo n.º 3
0
 /**
  * shows details of a studygroup
  *
  * @param string id of a studygroup
  *
  * @return void
  */
 function details_action($id)
 {
     global $perm;
     $studygroup = new Seminar($id);
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->response->add_header('Content-Type', 'text/html;charset=Windows-1252');
         header('X-Title: ' . _('Studiengruppendetails'));
     } else {
         PageLayout::setTitle(getHeaderLine($id) . ' - ' . _('Studiengruppendetails'));
         PageLayout::setHelpKeyword('Basis.StudiengruppenAbonnieren');
         PageLayout::addSqueezePackage('enrolment');
         $stmt = DBManager::get()->prepare("SELECT * FROM admission_seminar_user" . " WHERE user_id = ? AND seminar_id = ?");
         $stmt->execute(array($GLOBALS['user']->id, $id));
         $data = $stmt->fetch();
         if ($data['status'] == 'accepted') {
             $membership_requested = true;
         }
         if (StudygroupModel::isInvited($GLOBALS['user']->id, $id)) {
             $invited = true;
         }
         $participant = $perm->have_studip_perm('autor', $id);
         if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\\.php)([a-zA-Z0-9_?&=-]*)$/', Request::get('send_from_search_page'))) {
             $send_from_search_page = '';
         } else {
             $send_from_search_page = Request::get('send_from_search_page');
         }
         $icon = Icon::create('schedule', 'info');
         if ($GLOBALS['perm']->have_studip_perm('autor', $studygroup->getId()) || $membership_requested) {
             $action = _("Persönlicher Status:");
             if ($membership_requested) {
                 $infotext = _("Mitgliedschaft bereits beantragt!");
             } else {
                 $infolink = URLHelper::getURL('seminar_main.php?auswahl=' . $studygroup->getId());
                 $infotext = _("Direkt zur Studiengruppe");
             }
         } else {
             if ($GLOBALS['perm']->have_perm('admin')) {
                 $action = _("Hinweis:");
                 $infotext = _('Sie sind Admin und können sich daher nicht für Studiengruppen anmelden.');
                 $icon = Icon::create('decline', 'attention');
             } else {
                 $action = _("Aktionen:");
                 $infolink = URLHelper::getScriptURL('dispatch.php/course/enrolment/apply/' . $studygroup->getId());
                 $infolink_options = array('data-dialog' => '');
                 // customize link text if user is invited or group access is restricted
                 if ($invited === true) {
                     $infotext = _("Einladung akzeptieren");
                 } elseif ($studygroup->admission_prelim) {
                     $infotext = _("Mitgliedschaft beantragen");
                 } else {
                     $infotext = _("Studiengruppe beitreten");
                 }
             }
         }
         $sidebar = Sidebar::get();
         $sidebar->setTitle(_("Details"));
         $sidebar->setContextAvatar(StudygroupAvatar::getAvatar($studygroup->id));
         $iwidget = new SidebarWidget();
         $iwidget->setTitle(_("Information"));
         $iwidget->addElement(new WidgetElement(_("Hier sehen Sie weitere Informationen zur Studiengruppe. Außerdem können Sie ihr beitreten/eine Mitgliedschaft beantragen.")));
         $sidebar->addWidget($iwidget);
         $awidget = new LinksWidget();
         $awidget->setTitle($action);
         $awidget->addLink($infotext, $infolink, $icon, $infolink_options);
         if ($send_from_search_page) {
             $awidget->addLink(_("zurück zur Suche"), URLHelper::getURL($send_from_search_page), Icon::create('schedule', 'info'));
         }
         $sidebar->addWidget($awidget);
     }
     $this->studygroup = $studygroup;
 }
Ejemplo n.º 4
0
 /**
  * Renders the sidebar.
  * The sidebar will only be rendered if it actually contains any widgets.
  * It will use the template "sidebar.php" located at "templates/sidebar".
  * A notification is dispatched before and after the actual rendering
  * process.
  *
  * @return String The HTML code of the rendered sidebar.
  */
 public function render()
 {
     $content = '';
     if ($this->context_avatar === null) {
         $breadcrumbs = $this->getBreadCrumbs();
         $keys = array_keys($breadcrumbs);
         if (reset($keys) === 'course') {
             $course = Course::findCurrent();
             if ($course) {
                 if ($course->getSemClass()->offsetGet('studygroup_mode')) {
                     $avatar = StudygroupAvatar::getAvatar($course->id);
                 } else {
                     $avatar = CourseAvatar::getAvatar($course->id);
                 }
             } else {
                 $institute = Institute::findCurrent();
                 $avatar = InstituteAvatar::getAvatar($institute->id);
             }
             $this->setContextAvatar($avatar);
         }
     }
     NotificationCenter::postNotification('SidebarWillRender', $this);
     if ($this->hasWidgets()) {
         $template = $GLOBALS['template_factory']->open('sidebar/sidebar');
         $template->widgets = $this->widgets;
         $template->image = $this->getImage();
         $template->title = $this->getTitle();
         $template->avatar = $this->context_avatar;
         $content = $template->render();
     }
     NotificationCenter::postNotification('SidebarDidRender', $this);
     return $content;
 }
Ejemplo n.º 5
0
 function print_result()
 {
     ob_start();
     global $_fullname_sql, $SEM_TYPE, $SEM_CLASS;
     if (is_array($this->sem_browse_data['search_result']) && count($this->sem_browse_data['search_result'])) {
         if (!is_object($this->sem_tree)) {
             $this->sem_tree = new StudipSemTreeViewSimple($this->sem_browse_data["start_item_id"], $this->sem_number, is_array($this->sem_browse_data['sem_status']) ? $this->sem_browse_data['sem_status'] : false, !(is_object($GLOBALS['perm']) && $GLOBALS['perm']->have_perm(get_config('SEM_VISIBILITY_PERM'))));
         }
         $the_tree = $this->sem_tree->tree;
         SkipLinks::addIndex(_("Suchergebnis"), 'sem_search_result', 90);
         list($group_by_data, $sem_data) = $this->get_result();
         echo "\n<table class='default' id=\"sem_search_result\" border=\"0\" align=\"center\" cellspacing=0 cellpadding=2 width = \"99%\">\n";
         echo "<caption>" . sprintf(_(" %s Veranstaltungen gefunden %s, Gruppierung: %s"), count($sem_data), $this->sem_browse_data['sset'] ? _("(Suchergebnis)") : "", $this->group_by_fields[$this->sem_browse_data['group_by']]['name']) . "</caption>";
         foreach ($group_by_data as $group_field => $sem_ids) {
             echo "\n<tr><th colspan='5'>";
             switch ($this->sem_browse_data["group_by"]) {
                 case 0:
                     echo htmlReady($this->search_obj->sem_dates[$group_field]['name']);
                     break;
                 case 1:
                     if ($the_tree->tree_data[$group_field]) {
                         echo htmlReady($the_tree->getShortPath($group_field));
                         if (is_object($this->sem_tree)) {
                             echo $this->sem_tree->getInfoIcon($group_field);
                         }
                     } else {
                         echo _("keine Studienbereiche eingetragen");
                     }
                     break;
                 case 3:
                     echo htmlReady($SEM_TYPE[$group_field]["name"] . " (" . $SEM_CLASS[$SEM_TYPE[$group_field]["class"]]["name"] . ")");
                     break;
                 default:
                     echo htmlReady($group_field);
                     break;
             }
             echo "</th></tr><tr>";
             ob_end_flush();
             ob_start();
             if (is_array($sem_ids['Seminar_id'])) {
                 if ($this->sem_browse_data["default_sem"] != 'all') {
                     $current_semester_id = SemesterData::GetSemesterIdByIndex($this->sem_browse_data["default_sem"]);
                 }
                 while (list($seminar_id, ) = each($sem_ids['Seminar_id'])) {
                     // create instance of seminar-object
                     $seminar_obj = new Seminar($seminar_id);
                     // is this sem a studygroup?
                     $studygroup_mode = SeminarCategories::GetByTypeId($seminar_obj->getStatus())->studygroup_mode;
                     $sem_name = $SEM_TYPE[key($sem_data[$seminar_id]["status"])]["name"] . ": " . key($sem_data[$seminar_id]["Name"]);
                     $seminar_number = key($sem_data[$seminar_id]['VeranstaltungsNummer']);
                     if ($studygroup_mode) {
                         $sem_name .= ' (' . _("Studiengruppe");
                         if ($seminar_obj->admission_prelim) {
                             $sem_name .= ', ' . _("Zutritt auf Anfrage");
                         }
                         $sem_name .= ')';
                         echo '<td width="1%">';
                         echo StudygroupAvatar::getAvatar($seminar_id)->getImageTag(Avatar::SMALL, array('title' => htmlReady($seminar_obj->getName())));
                         echo '</td>';
                     } else {
                         $sem_number_start = key($sem_data[$seminar_id]["sem_number"]);
                         $sem_number_end = key($sem_data[$seminar_id]["sem_number_end"]);
                         if ($sem_number_start != $sem_number_end) {
                             $sem_name .= " (" . $this->search_obj->sem_dates[$sem_number_start]['name'] . " - ";
                             $sem_name .= ($sem_number_end == -1 ? _("unbegrenzt") : $this->search_obj->sem_dates[$sem_number_end]['name']) . ")";
                         } elseif ($this->sem_browse_data["group_by"]) {
                             $sem_name .= " (" . $this->search_obj->sem_dates[$sem_number_start]['name'] . ")";
                         }
                         echo '<td width="1%">';
                         echo CourseAvatar::getAvatar($seminar_id)->getImageTag(Avatar::SMALL, array('title' => htmlReady($seminar_obj->getName())));
                         echo '</td>';
                     }
                     $send_from_search = URLHelper::getUrl(basename($_SERVER['PHP_SELF']), array('keep_result_set' => 1, 'cid' => null));
                     $send_from_search_link = UrlHelper::getLink($this->target_url, array($this->target_id => $seminar_id, 'cid' => null, 'send_from_search' => 1, 'send_from_search_page' => $send_from_search));
                     echo '<td width="66%" colspan="2">';
                     echo '<a href="' . $send_from_search_link . '">';
                     if (Config::get()->IMPORTANT_SEMNUMBER && $seminar_number) {
                         echo htmlReady($seminar_number) . " ";
                     }
                     echo htmlReady($sem_name) . '</a><br>';
                     //create Turnus field
                     if ($studygroup_mode) {
                         echo "<div style=\"font-size:smaller\">" . htmlReady(substr($seminar_obj->description, 0, 100)) . "</div>";
                     } else {
                         $temp_turnus_string = $seminar_obj->getDatesExport(array('short' => true, 'shrink' => true, 'semester_id' => $current_semester_id));
                         //Shorten, if string too long (add link for details.php)
                         if (strlen($temp_turnus_string) > 70) {
                             $temp_turnus_string = htmlReady(substr($temp_turnus_string, 0, strpos(substr($temp_turnus_string, 70, strlen($temp_turnus_string)), ",") + 71));
                             $temp_turnus_string .= " ... <a href=\"{$send_from_search_link}\">(" . _("mehr") . ")</a>";
                         } else {
                             $temp_turnus_string = htmlReady($temp_turnus_string);
                         }
                         if (!Config::get()->IMPORTANT_SEMNUMBER) {
                             echo "<div style=\"margin-left:5px;font-size:smaller\">" . htmlReady($seminar_number) . "</div>";
                         }
                         echo "<div style=\"margin-left:5px;font-size:smaller\">" . $temp_turnus_string . "</div>";
                     }
                     echo '</td>';
                     echo "<td align=\"right\">(";
                     $doz_name = array();
                     $c = 0;
                     reset($sem_data[$seminar_id]['fullname']);
                     foreach ($sem_data[$seminar_id]['username'] as $anzahl1) {
                         if ($c == 0) {
                             list($d_name, $anzahl2) = each($sem_data[$seminar_id]['fullname']);
                             $c = $anzahl2 / $anzahl1;
                             $doz_name = array_merge($doz_name, array_fill(0, $c, $d_name));
                         }
                         --$c;
                     }
                     $doz_uname = array_keys($sem_data[$seminar_id]['username']);
                     $doz_position = array_keys($sem_data[$seminar_id]['position']);
                     if (count($doz_name)) {
                         if (count($doz_position) != count($doz_uname)) {
                             $doz_position = range(1, count($doz_uname));
                         }
                         array_multisort($doz_position, $doz_name, $doz_uname);
                         $i = 0;
                         foreach ($doz_name as $index => $value) {
                             if ($value) {
                                 // hide dozenten with empty username
                                 if ($i == 4) {
                                     echo "... <a href=\"{$send_from_search_link}\">(" . _("mehr") . ")</a>";
                                     break;
                                 }
                                 echo "<a href=\"" . UrlHelper::getLink('dispatch.php/profile', array('username' => $doz_uname[$index])) . "\">" . htmlReady($value) . "</a>";
                                 if ($i != count($doz_name) - 1) {
                                     echo ", ";
                                 }
                             }
                             ++$i;
                         }
                         echo ")</td></tr>";
                     }
                 }
             }
         }
         echo "</table>";
     } elseif ($this->search_obj->search_button_clicked && !$this->search_obj->new_search_button_clicked) {
         if ($this->search_obj->found_rows === false) {
             $details = array(_("Der Suchbegriff fehlt oder ist zu kurz"));
         }
         if (!isset($details)) {
             echo MessageBox::info(_("Ihre Suche ergab keine Treffer"), $details);
         } else {
             echo MessageBox::error(_("Ihre Suche ergab keine Treffer"), $details);
         }
         $this->sem_browse_data["sset"] = 0;
     }
     ob_end_flush();
 }
Ejemplo n.º 6
0
?>
>
                <a href="<?php 
echo $controller->url_for($base_url . ($sort == 'access_asc' ? 'access_desc' : 'access_asc'));
?>
"><?php 
echo _("Zugang");
?>
</a>
            </th>
        </tr>
        <? foreach ($groups as $group) : ?>
            <tr>
                <td>
                   <?php 
echo StudygroupAvatar::getAvatar($group['Seminar_id'])->getImageTag(Avatar::SMALL);
?>
                </td>
                <td>
                    <? if (StudygroupModel::isMember($this->userid,$group['Seminar_id'] )): ?>
                        <a href="<?php 
echo URLHelper::getlink("seminar_main.php?auswahl=" . $group['Seminar_id']);
?>
">
                    <? else: ?>
                       <a href="<?php 
echo URLHelper::getlink("dispatch.php/course/studygroup/details/" . $group['Seminar_id']);
?>
">
                    <? endif; ?>
                       <?php 
Ejemplo n.º 7
0
<? foreach ($course_collection as $course)  : ?>
    <? $sem_class = $course['sem_class']; ?>
    <tr>
        <td class="gruppe<?php 
echo $course['gruppe'];
?>
"></td>
        <td>
            <? if ($sem_class['studygroup_mode']) : ?>
                <?php 
echo StudygroupAvatar::getAvatar($course['seminar_id'])->is_customized() ? StudygroupAvatar::getAvatar($course['seminar_id'])->getImageTag(Avatar::SMALL, tooltip2($course['name'])) : Icon::create('studygroup', 'clickable', ['title' => $course['name']])->asImg(20);
?>
            <? else : ?>
                <?php 
echo CourseAvatar::getAvatar($course['seminar_id'])->is_customized() ? CourseAvatar::getAvatar($course['seminar_id'])->getImageTag(Avatar::SMALL, tooltip2($course['name'])) : Icon::create('seminar', 'clickable', ['title' => $course['name']])->asImg(20);
?>
            <? endif ?>
        </td>
        <? if($config_sem_number) :?>
            <td><?php 
echo $course['veranstaltungsnummer'];
?>
</td>
        <? endif?>
        <td style="text-align: left">
            <a href="<?php 
echo URLHelper::getLink('seminar_main.php', array('auswahl' => $course['seminar_id']));
?>
"
                <?php 
echo $course['visitdate'] <= $course['chdate'] ? 'style="color: red;"' : '';