Esempio n. 1
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();
 }
 function getInfoIcon($item_id)
 {
     if (is_object($this->studienmodulmanagement) && $this->tree->isModuleItem($item_id)) {
         $nav = $this->studienmodulmanagement->getModuleInfoNavigation($item_id, SemesterData::GetSemesterIdByIndex($this->tree->sem_number[0]));
         if ($nav->isVisible(true)) {
             $ret = '<a class="module-info" href="' . URLHelper::getLink($nav->getURL()) . '">';
             $ret .= $nav->getImage()->asImg($nav->getLinkAttributes());
             $ret .= '<span>' . htmlready($nav->getTitle()) . '</span>';
             $ret .= '</a>';
         }
     } else {
         if ($item_id == "root") {
             $info = $this->root_content ? $this->root_content : _("Keine weitere Info vorhanden");
         } else {
             $info = $this->tree->getValue($item_id, 'info') ? $this->tree->getValue($item_id, 'info') : _("Keine weitere Info vorhanden");
         }
         $ret = tooltipicon(kill_format($info));
     }
     return $ret;
 }