Esempio n. 1
0
 function getTabNavigation($course_id)
 {
     $object_type = get_object_type($course_id, array('sem', 'inst'));
     if ($object_type === 'sem') {
         $course = Course::find($course_id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$course->status]['class']] ?: SemClass::getDefaultSemClass();
     } else {
         $institute = Institute::find($course_id);
         $sem_class = SemClass::getDefaultInstituteClass($institute->type);
     }
     $navigation = new Navigation(_('Übersicht'));
     $navigation->setImage(Icon::create('seminar', 'info_alt'));
     $navigation->setActiveImage(Icon::create('seminar', 'info'));
     if ($object_type !== 'sem') {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/institute/overview'));
         $navigation->addSubNavigation('courses', new Navigation(_('Veranstaltungen'), 'show_bereich.php?level=s&id=' . $course_id));
         $navigation->addSubNavigation('schedule', new Navigation(_('Veranstaltungs-Stundenplan'), 'dispatch.php/calendar/instschedule?cid=' . $course_id));
         if ($GLOBALS['perm']->have_studip_perm('admin', $course_id)) {
             $navigation->addSubNavigation('admin', new Navigation(_('Administration der Einrichtung'), 'dispatch.php/institute/basicdata/index?new_inst=TRUE'));
         }
     } else {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/course/overview'));
         if (!$sem_class['studygroup_mode']) {
             $navigation->addSubNavigation('details', new Navigation(_('Details'), 'dispatch.php/course/details/'));
         }
         if (!$course->admission_binding && in_array($GLOBALS['perm']->get_studip_perm($course_id), array('user', 'autor'))) {
             $navigation->addSubNavigation('leave', new Navigation(_('Austragen aus der Veranstaltung'), 'dispatch.php/my_courses/decline/' . $course_id . '?cmd=suppose_to_kill'));
         }
     }
     return array('main' => $navigation);
 }
Esempio n. 2
0
 /**
  * Returns the currently active course or false if none is active.
  *
  * @return mixed Course object of currently active course, false otherwise
  * @since 3.0
  */
 public static function findCurrent()
 {
     if (empty($GLOBALS['SessionSeminar'])) {
         return null;
     }
     if (isset(self::$current_institute) && $GLOBALS['SessionSeminar'] === self::$current_institute->id) {
         return self::$current_institute;
     }
     $found = Institute::find($GLOBALS['SessionSeminar']);
     if ($found) {
         return self::$current_institute = $found;
     }
 }
 public function check($data, $virtualobject, $relevantfields)
 {
     $errors = "";
     if (!$data['fleximport_dozenten'] || !count($data['fleximport_dozenten'])) {
         $errors .= "Dozent kann nicht gemapped werden. ";
     } else {
         $exist = false;
         foreach ((array) $data['fleximport_dozenten'] as $dozent_id) {
             if (User::find($dozent_id)) {
                 $exist = true;
                 break;
             }
         }
         if (!$exist) {
             $errors .= "Angegebene Dozenten sind nicht im System vorhanden. ";
         } else {
             if ($GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$virtualobject['status']]['class']]['only_inst_user']) {
                 $statement = DBManager::get()->prepare("\n                                    SELECT 1\n                                    FROM user_inst\n                                    WHERE user_id IN (:dozent_ids)\n                                        AND Institut_id IN (:institut_ids)\n                                        AND inst_perms IN ('autor','tutor','dozent')\n                                ");
                 $statement->execute(array('dozent_ids' => (array) $data['fleximport_dozenten'], 'institut_ids' => $data['fleximport_related_institutes'] ?: array($virtualobject['institut_id'])));
                 if (!$statement->fetch(PDO::FETCH_COLUMN, 0)) {
                     $errors .= "Keiner der Dozenten ist in einer beteiligten Einrichtung angestellt. ";
                 }
             }
         }
     }
     if (!$data['institut_id'] || !Institute::find($data['institut_id'])) {
         $errors .= "Keine gültige Heimateinrichtung. ";
     }
     if (!Semester::findByTimestamp($data['start_time'])) {
         $errors .= "Semester wurde nicht gefunden. ";
     }
     if ($data['status']) {
         if ($GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$data['status']]['class']]['bereiche']) {
             $found = false;
             foreach ((array) $data['fleximport_studyarea'] as $sem_tree_id) {
                 if (StudipStudyArea::find($sem_tree_id)) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $errors .= "Keine (korrekten) Studienbereiche definiert. ";
             }
         }
     } else {
         $errors .= "Kein Veranstaltungstyp definiert. ";
     }
     return $errors;
 }
Esempio n. 4
0
 public function viewInstitute($id)
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return Redirect::to('/');
     }
     if (isset($id)) {
         $institute = Institute::find($id);
         if (isset($institute)) {
             Session::put('institute_id', $id);
             return View::make('admin.view-institute')->with('institute', $institute);
         } else {
             return Redirect::to('/');
         }
     } else {
         return Redirect::to('/');
     }
 }
Esempio n. 5
0
 public function courses($id)
 {
     if (isset($id)) {
         $institute = Institute::find($id);
         if (isset($institute)) {
             $courses = Course::where('status', '=', 'active')->where('institute_id', '=', $id)->get();
             Session::put('course_id', $id);
             if (isset($courses) && count($courses) > 0) {
                 return View::make('course.list')->with('found', true)->with('courses', $courses)->with('institute', $institute);
             } else {
                 return View::make('course.list')->with('found', false)->with('institute', $institute);
             }
         } else {
             return Redirect::to('/');
         }
     } else {
         return Redirect::to('/');
     }
 }
Esempio n. 6
0
 static function findUser($id)
 {
     if (get_visibility_by_id($id)) {
         $user_data = User::find($id)->getData();
         if ($user_data["visible"] == "no" || $user_data["visible"] == "never") {
             return null;
         }
         $inst_fields = "Institut_id, user_id, sprechzeiten, raum, Telefon, Fax, visible";
         $query = "SELECT {$inst_fields} FROM `user_inst` WHERE user_inst.user_id = '{$id}' AND user_inst.externdefault='1'";
         $stmt = \DBManager::get()->query($query);
         $user_inst = $stmt->fetchAll();
         if (!empty($user_inst[0]["Institut_id"])) {
             $inst = \Institute::find($user_inst[0]["Institut_id"]);
             $institute = array("inst_name" => $inst->name, "inst_strasse" => $inst->strasse, "inst_url" => $inst->url, "inst_plz" => $inst->plz, "inst_telefon" => $inst->telefon, "inst_email" => $inst->email, "inst_fax" => $inst->fax);
         } else {
             $user_inst = null;
         }
         return array("user_data" => $user_data, "user_inst" => $user_inst[0], "inst_info" => $institute);
     }
     return null;
 }
Esempio n. 7
0
 public function decline_inst_action($inst_id)
 {
     $institut = Institute::find($inst_id);
     $ticket_check = Seminar_Session::check_ticket(Request::option('studipticket'));
     if (Request::option('cmd') != 'kill' && Request::get('cmd') != 'back') {
         $this->flash['decline_inst'] = true;
         $this->flash['inst_id'] = $inst_id;
         $this->flash['name'] = $institut->name;
         $this->flash['studipticket'] = Seminar_Session::get_ticket();
     } else {
         if (Request::get('cmd') == 'kill' && $ticket_check && Request::get('cmd') != 'back') {
             $query = "DELETE FROM user_inst WHERE user_id = ? AND Institut_id = ? AND inst_perms = 'user'";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->id, $inst_id));
             if ($statement->rowCount() > 0) {
                 PageLayout::postMessage(MessageBox::success(sprintf(_("Die Zuordnung zur Einrichtung %s wurde aufgehoben."), "<b>" . htmlReady($institut->name) . "</b>")));
             } else {
                 PageLayout::postMessage(MessageBox::error(_('Datenbankfehler')));
             }
         }
     }
     $this->redirect('my_institutes/index');
 }
Esempio n. 8
0
    function print_result ($args) {
        global $_fullname_sql,$SEM_TYPE,$SEM_CLASS;

        if (is_array($this->sem_browse_data['search_result']) && count($this->sem_browse_data['search_result'])) {
            
            // show only selected subject areas
            $selected_ranges = $this->config->getValue('SelectSubjectAreas', 'subjectareasselected');
            if ($stid = Request::option('sem_tree_id')) {
                if (!is_object($this->sem_tree)){
                    $the_tree = TreeAbstract::GetInstance("StudipSemTree");
                } else {
                    $the_tree =& $this->sem_tree->tree;
                }
                $the_tree->buildIndex();
                $selected_ranges = array_merge(array($stid), $the_tree->getKidsKids($stid));
            }
            if (!$this->config->getValue('SelectSubjectAreas', 'selectallsubjectareas')
                    && count($selected_ranges)) {
                if ($this->config->getValue('SelectSubjectAreas', 'reverseselection')) {
                    $sem_range_query =  "AND seminar_sem_tree.sem_tree_id NOT IN ('".implode("','", $selected_ranges)."')";
                } else {
                    $sem_range_query =  "AND seminar_sem_tree.sem_tree_id IN ('".implode("','", $selected_ranges)."')";
                }
            } else {
                $sem_range_query = '';
            }
            
            // show only selected SemTypes
            $selected_semtypes = $this->config->getValue('ReplaceTextSemType', 'visibility');
            if (Request::get('semstatus')) {
                $selected_semtypes = array(Request::get('semstatus'));
            }
            $sem_types_array = array();
            if (count($selected_semtypes)) {
                for ($i = 0; $i < count($selected_semtypes); $i++) {
                    if ($selected_semtypes[$i] == '1') {
                        $sem_types_array[] = $i + 1;
                    }
                }
                $sem_types_query = "AND seminare.status IN ('" . implode("','", $sem_types_array) . "')";
            } else {
                $sem_types_query = '';
            }
            
            if ($this->sem_browse_data['group_by'] == 1){
                if (!is_object($this->sem_tree)){
                    $the_tree = TreeAbstract::GetInstance("StudipSemTree");
                } else {
                    $the_tree =& $this->sem_tree->tree;
                }
                $the_tree->buildIndex();
            }
            
            if (!$this->config->getValue("Main", "allseminars") && !Request::get('allseminars')) {
                $sem_inst_query = " AND seminare.Institut_id='{$this->config->range_id}' ";
            }
            if (Request::option('aggregation')) {
                $i = Institute::find($this->config->range_id);
                $children = $i->sub_institutes->pluck('institut_id');
                $sem_inst_query = " AND seminare.Institut_id IN ('".(implode("', '", $children))."')";
            }

            $dbv = DbView::getView('sem_tree');
            
            if (!$nameformat = $this->config->getValue("Main", "nameformat"))
                $nameformat = "no_title_short";
            $query = "SELECT seminare.Seminar_id, seminare.status, seminare.Name  
                , seminare.Institut_id, Institute.Name AS Institut,Institute.Institut_id,
                seminar_sem_tree.sem_tree_id AS bereich, "
                . $_fullname_sql[$nameformat]
                . " AS fullname, auth_user_md5.username,
                " . $dbv->sem_number_sql . " AS sem_number, " . $dbv->sem_number_end_sql . " AS sem_number_end, " . 
            " seminar_user.position AS position " . 
            " FROM seminare 
                LEFT JOIN seminar_user ON (seminare.Seminar_id=seminar_user.Seminar_id AND seminar_user.status='dozent') 
                LEFT JOIN auth_user_md5 USING (user_id) 
                LEFT JOIN user_info USING (user_id) 
                LEFT JOIN seminar_sem_tree ON (seminare.Seminar_id = seminar_sem_tree.seminar_id)
                LEFT JOIN seminar_inst ON (seminare.Seminar_id = seminar_inst.Seminar_id) 
                LEFT JOIN Institute ON (seminar_inst.institut_id = Institute.Institut_id) 
                WHERE seminare.Seminar_id IN('" . join("','", array_keys($this->sem_browse_data['search_result']))
                 . "')$sem_inst_query $sem_range_query $sem_types_query";
            
            $db = new DB_Seminar($query);
            $snap = new DbSnapshot($db);
            if (isset($args['group']) && $args['group'] >= 0 && $args['group'] < 5) {
                $this->sem_browse_data['group_by'] = $args['group'];
            }
            $group_field = $this->group_by_fields[$this->sem_browse_data['group_by']]['group_field'];
            $data_fields[0] = "Seminar_id";
            if ($this->group_by_fields[$this->sem_browse_data['group_by']]['unique_field']){
                $data_fields[1] = $this->group_by_fields[$this->sem_browse_data['group_by']]['unique_field'];
            }
            $group_by_data = $snap->getGroupedResult($group_field, $data_fields);
            $sem_data = $snap->getGroupedResult("Seminar_id");
            
            if ($this->sem_browse_data['group_by'] == 0){
                $group_by_duration = $snap->getGroupedResult("sem_number_end", array("sem_number","Seminar_id"));
                foreach ($group_by_duration as $sem_number_end => $detail){
                    if ($sem_number_end != -1 && ($detail['sem_number'][$sem_number_end - 1] && count($detail['sem_number']) == 1)){
                        continue;
                    } else {
                        foreach ($detail['Seminar_id'] as $seminar_id => $foo){
                            $start_sem = key($sem_data[$seminar_id]["sem_number"]);
                            if ($sem_number_end == -1){
                                if (is_array($this->sem_number)){
                                    $sem_number_end = $this->sem_number[0];
                                } else {
                                    $sem_number_end = count($this->sem_dates) - 1;
                                }
                            }
                            for ($i = $start_sem; $i <= $sem_number_end; ++$i){
                                if ($this->sem_number === false || (is_array($this->sem_number) && in_array($i,$this->sem_number))){
                                    if ($group_by_data[$i] && !$tmp_group_by_data[$i]){
                                        foreach($group_by_data[$i]['Seminar_id'] as $id => $bar){
                                            $tmp_group_by_data[$i]['Seminar_id'][$id] = true;
                                        }
                                    }
                                    $tmp_group_by_data[$i]['Seminar_id'][$seminar_id] = true;
                                }
                            }
                        }
                    }
                }
                if (is_array($tmp_group_by_data)){
                    if ($this->sem_number !== false){
                        unset($group_by_data);
                    }
                    foreach ($tmp_group_by_data as $start_sem => $detail){
                        $group_by_data[$start_sem] = $detail;
                    }
                }
            }
            
            foreach ($group_by_data as $group_field => $sem_ids){
                foreach ($sem_ids['Seminar_id'] as $seminar_id => $foo){
                    $name = strtolower(key($sem_data[$seminar_id]["Name"]));
                    $name = str_replace("ä","ae",$name);
                    $name = str_replace("ö","oe",$name);
                    $name = str_replace("ü","ue",$name);
                    $group_by_data[$group_field]['Seminar_id'][$seminar_id] = $name;
                }
                uasort($group_by_data[$group_field]['Seminar_id'], 'strnatcmp');
            }
            
            switch ($this->sem_browse_data["group_by"]){
                    case 0:
                    krsort($group_by_data, SORT_NUMERIC);
                    break;
                    
                    case 1:
                    uksort($group_by_data, create_function('$a,$b',
                            '$the_tree = TreeAbstract::GetInstance("StudipSemTree");
                            return (int)($the_tree->tree_data[$a]["index"] - $the_tree->tree_data[$b]["index"]);
                            '));
                            
                    break;
                    
                    case 3:
                    if ($order = $this->module->config->getValue("ReplaceTextSemType", "order")) {
                        foreach ($order as $position) {
                            if (isset($group_by_data[$position]))
                                $group_by_data_tmp[$position] = $group_by_data[$position];
                        }
                        $group_by_data = $group_by_data_tmp;
                        unset($group_by_data_tmp);
                    }
                    else {
                        uksort($group_by_data, create_function('$a,$b',
                                'global $SEM_CLASS,$SEM_TYPE;
                                return strnatcasecmp($SEM_TYPE[$a]["name"]." (". $SEM_CLASS[$SEM_TYPE[$a]["class"]]["name"].")",
                                                $SEM_TYPE[$b]["name"]." (". $SEM_CLASS[$SEM_TYPE[$b]["class"]]["name"].")");'));
                    }
                    break;
                    
                    default:
                    uksort($group_by_data, 'strnatcasecmp');
                    break;
            }
            
            $show_time = $this->config->getValue("Main", "time");
            $show_lecturer = $this->config->getValue("Main", "lecturer");
            if ($show_time && $show_lecturer) {
                if (!$td2width = $this->config->getValue("LecturesInnerTable", "td2width"))
                    $td2width = 50;
                $colspan = " colspan=\"2\"";
                $td_time = $this->config->getAttributes("LecturesInnerTable", "td2");
                $td_time .= " width=\"$td2width%\"";
                $td_lecturer = " align=\"" . $this->config->getValue("LecturesInnerTable", "td3_align");
                $td_lecturer .= "\" valign=\"" . $this->config->getValue("LecturesInnerTable", "td2_valign");
                $td_lecturer .= "\" width=\"" . (100 - $td2width) . "%\"";
            }
            else {
                $colspan = "";
                $td_time = $this->config->getAttributes("LecturesInnerTable", "td2") . " width=\"100%\"";
                $td_lecturer = " align=\"" . $this->config->getValue("LecturesInnerTable", "td3_align");
                $td_lecturer .= "\" valign=\"" . $this->config->getValue("LecturesInnerTable", "td2_valign");
                $td_lecturer .= " width=\"100%\"";
            }
            // erase output buffer with warnings and start unbuffered output
            ob_end_clean();
            echo "\n<table" . $this->config->getAttributes("TableHeader", "table") . ">\n";
            if ($this->config->getValue("Main", "addinfo")) {
                echo "\n<tr" . $this->config->getAttributes("InfoCountSem", "tr") . ">";
                echo "<td" . $this->config->getAttributes("InfoCountSem", "td") . ">";
                echo "<font" . $this->config->getAttributes("InfoCountSem", "font") . ">&nbsp;";
                echo count($sem_data);
                echo $this->config->getValue("Main", "textlectures");
                echo ", " . $this->config->getValue("Main", "textgrouping");
                $group_by_name = $this->config->getValue("Main", "aliasesgrouping");
                echo $group_by_name[$this->sem_browse_data['group_by']];
                echo "</font></td></tr>";
            }
            if (count($group_by_data)) {
                foreach ($group_by_data as $group_field => $sem_ids) {
                    echo "\n<tr" . $this->config->getAttributes("Grouping", "tr") . ">";
                    echo "<td" . $this->config->getAttributes("Grouping", "td") . ">";
                    echo "<font" . $this->config->getAttributes("Grouping", "font") . ">";
                    switch ($this->sem_browse_data["group_by"]){
                        case 0:
                        echo $this->sem_dates[$group_field]['name'];
                        break;
                        
                        case 1:
                        if ($the_tree->tree_data[$group_field]) {
                            $range_path_level = $this->config->getValue("Main", "rangepathlevel");
                            echo htmlReady($the_tree->getShortPath($group_field, NULL, '>', $range_path_level ? $range_path_level - 1 : 0));
                        } else {
                            echo $this->config->getValue("Main", "textnogroups");
                        }
                        /*
                        $range_path_new = NULL;
                        if ($the_tree->tree_data[$group_field]) {
                            $range_path = explode(" ^ ", $the_tree->getShortPath($group_field, "^"));
                            $range_path_level = $this->config->getValue("Main", "rangepathlevel");
                            if ($range_path_level > sizeof($range_path))
                                $range_path_level = sizeof($range_path);
                            for ($i = $range_path_level - 1; $i < sizeof($range_path); $i++)
                                $range_path_new[] = $range_path[$i];
                            echo htmlReady(implode(" > ", $range_path_new));
                        }
                        else
                            echo $this->config->getValue("Main", "textnogroups");
                        */
                        break;
                        
                        case 2:
                        echo htmlReady($group_field);
                        break;
                        
                        case 3:
                        $aliases_sem_type = $this->config->getValue("ReplaceTextSemType",
                                "class_{$SEM_TYPE[$group_field]['class']}");
                        if ($aliases_sem_type[$this->sem_types_position[$group_field] - 1])
                            echo $aliases_sem_type[$this->sem_types_position[$group_field] - 1];
                        else {
                            echo htmlReady($SEM_TYPE[$group_field]["name"]
                                    ." (". $SEM_CLASS[$SEM_TYPE[$group_field]["class"]]["name"].")");
                        }
                        break;
                        
                        case 4:
                        echo htmlReady($group_field);
                        break;
                        
                    }
                    echo "</font></td></tr>";
                    if (is_array($sem_ids['Seminar_id'])) {
                        $zebra = 0;
                        while (list($seminar_id,) = each($sem_ids['Seminar_id'])) {
                            $sem_name = key($sem_data[$seminar_id]["Name"]);
                            $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->sem_dates[$sem_number_start]['name'] . " - ";
                                $sem_name .= (($sem_number_end == -1) ? _("unbegrenzt") : $this->sem_dates[$sem_number_end]['name']) . ")";
                            }
                            echo "\n<tr" . $this->config->getAttributes("LecturesInnerTable", "tr").">";
                            if ($zebra % 2 && $this->config->getValue("LecturesInnerTable", "td_bgcolor2_"))
                                echo "<td width=\"100%\"".$this->config->getAttributes("LecturesInnerTable", "td", TRUE)."\">\n";
                            else
                                echo "<td width=\"100%\"".$this->config->getAttributes("LecturesInnerTable", "td")."\">\n";
                            $zebra++;
                            echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
                            echo "<tr" . $this->config->getAttributes("LecturesInnerTable", "tr1") . ">";
                            echo "<td$colspan" . $this->config->getAttributes("LecturesInnerTable", "td1") . ">";
                            echo "<font" . $this->config->getAttributes("LecturesInnerTable", "font1") . ">";
                            $sem_link["module"] = "Lecturedetails";
                            $sem_link["link_args"] = "seminar_id=$seminar_id";
                            $sem_link["content"] = htmlReady($sem_name);
                            $this->module->elements["SemLink"]->printout($sem_link);
                            echo "</font></td></tr>\n";
                            //create Turnus field
                            $temp_turnus_string = Seminar::GetInstance($seminar_id)->getDatesExport(array('show_room' => true));
                            //Shorten, if string too long (add link for details.php)
                            if (strlen($temp_turnus_string) >70) {
                                $temp_turnus_string = substr($temp_turnus_string, 0, strpos(substr($temp_turnus_string, 70, strlen($temp_turnus_string)), ',') +71);
                                $temp_turnus_string .= '...';
                            }
                            if ($show_time || $show_lecturer) {
                                echo "\n<tr" . $this->config->getAttributes('LecturesInnerTable', 'tr2') . '>';
                                if ($show_time) {
                                    echo "<td$td_time>";
                                    echo '<font' . $this->config->getAttributes('LecturesInnerTable', 'font2') . '>';
                                    echo $temp_turnus_string . "</font></td>\n";
                                }
                                if ($show_lecturer) {
                                    echo "<td$td_lecturer>";
                                    echo '<font' . $this->config->getAttributes('LecturesInnerTable', 'font2') . '>(';
                                    $doz_position = array_keys($sem_data[$seminar_id]['position']);
                                    $doz_name = array_keys($sem_data[$seminar_id]['fullname']);
                                    $doz_uname = array_keys($sem_data[$seminar_id]['username']);
                                    if (is_array($doz_name)){
                                        $lecturer_link['module'] = 'Persondetails';
                                        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 ($i == 4) { 
                                                echo '...';
                                                break;
                                            }
                                            $lecturer_link['link_args'] = "username={$doz_uname[$index]}&seminar_id=$seminar_id";
                                            $lecturer_link['content'] = htmlReady($value);
                                            $this->module->elements['LecturerLink']->printout($lecturer_link);
                                            if ($i != count($doz_name) - 1) {
                                                echo ', ';
                                            }
                                            ++$i;
                                        }
                                        echo ') ';
                                    }
                                    echo '</font></td>';
                                }
                                echo '</tr>';
                            }
                            echo "</table></td></tr>\n";
                        }
                    }
                }
            }
            echo "</table>";
        }
    }
Esempio n. 9
0
 /**
  * Return the default title of the avatar.
  * @return string the default title
  */
 function getDefaultTitle()
 {
     $institute = Institute::find($this->user_id);
     return $institute ? $institute->name : Avatar::NOBODY;
 }
Esempio n. 10
0
 function viewInstitute($id)
 {
     $expertId = Session::get('expert_id');
     if (!isset($expertId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $patientRequest = PatientRequest::find($id);
     if (isset($patientRequest)) {
         $institute = Institute::find($patientRequest->connection_id);
         if (isset($institute)) {
             return View::make('expert.view-institute')->with('found', true)->with('institute', $institute);
         } else {
             return View::make('expert.view-institute')->with('found', false);
         }
     } else {
         return View::make('expert.view-institute')->with('found', false);
     }
 }
Esempio n. 11
0
 /**
  * create course
  *
  * creates new ilias course
  * @access public
  * @param string $seminar_id seminar-id
  * @return boolean successful
  */
 function createCourse($seminar_id)
 {
     global $messages, $SessSemName, $DEFAULT_LANGUAGE, $ELEARNING_INTERFACE_MODULES;
     $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type);
     $this->soap_client->setCachingStatus(false);
     $this->soap_client->clearCache();
     if ($crs_id == false) {
         $seminar = Seminar::getInstance($seminar_id);
         $home_institute = Institute::find($seminar->getInstitutId());
         if ($home_institute) {
             $ref_id = ObjectConnections::getConnectionModuleId($home_institute->getId(), "cat", $this->cms_type);
         }
         if ($ref_id < 1) {
             // Kategorie für Heimateinrichtung anlegen
             $object_data["title"] = sprintf("%s", $home_institute->name);
             $object_data["description"] = sprintf(_("Hier befinden sich die Veranstaltungsdaten zur Stud.IP-Einrichtung \"%s\"."), $home_institute->name);
             $object_data["type"] = "cat";
             $object_data["owner"] = $this->soap_client->LookupUser($ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["username"]);
             $ref_id = $this->soap_client->addObject($object_data, $this->main_category_node_id);
             ObjectConnections::setConnection($home_institute->getId(), $ref_id, "cat", $this->cms_type);
         }
         if ($ref_id < 1) {
             $ref_id = $this->main_category_node_id;
         }
         // Kurs anlegen
         $lang_array = explode("_", $DEFAULT_LANGUAGE);
         $course_data["language"] = $lang_array[0];
         $course_data["title"] = "Stud.IP-Kurs " . $seminar->getName();
         $course_data["description"] = "";
         $crs_id = $this->soap_client->addCourse($course_data, $ref_id);
         if ($crs_id == false) {
             $messages["error"] .= _("Zuordnungs-Fehler: Kurs konnte nicht angelegt werden.");
             return false;
         }
         ObjectConnections::setConnection($seminar_id, $crs_id, "crs", $this->cms_type);
         // Rollen zuordnen
         $this->permissions->CheckUserPermissions($crs_id);
     }
     return $crs_id;
 }
Esempio n. 12
0
}
?>
    <div id="wizard-participating">
        <div class="description<?php 
echo count($values['participating']) ? '' : ' hidden-js';
?>
">
            <?php 
echo _('bereits zugeordnet:');
?>
        </div>
        <?php 
foreach ($values['participating'] as $id => $assigned) {
    ?>
            <?php 
    if ($inst = Institute::find($id)) {
        ?>
                <?php 
        echo $this->render_partial('basicdata/_institute', array('class' => 'institute', 'inst' => $inst));
        ?>
            <?php 
    }
    ?>
        <?php 
}
?>
    </div>
</section>
<section >
    <label for="lecturer_id_2" class="required">
        <?php 
Esempio n. 13
0
    function print_result () {
        global $_fullname_sql,$SEM_TYPE,$SEM_CLASS,$sem_type_tmp;
        
        $sem_link = $this->module->getModuleLink("Lecturedetails",
            $this->module->config->getValue("SemLink", "config"),
            $this->module->config->getValue("SemLink", "srilink"));
        
        $lecturer_link = $this->module->getModuleLink("Persondetails",
            $this->module->config->getValue("LecturerLink", "config"),
            $this->module->config->getValue("LecturerLink", "srilink"));
        
        if (is_array($this->sem_browse_data['search_result']) && count($this->sem_browse_data['search_result'])) {
            
            // show only selected subject areas
            $selected_ranges = $this->module->config->getValue('SelectSubjectAreas', 'subjectareasselected');
            if ($stid = Request::option('sem_tree_id')) {
                if (!is_object($this->sem_tree)){
                    $the_tree = TreeAbstract::GetInstance("StudipSemTree");
                } else {
                    $the_tree =& $this->sem_tree->tree;
                }
                $the_tree->buildIndex();
                $selected_ranges = array_merge(array($stid), $the_tree->getKidsKids($stid));
            }
            if (!$this->module->config->getValue('SelectSubjectAreas', 'selectallsubjectareas')
                    && count($selected_ranges)) {
                if ($this->module->config->getValue('SelectSubjectAreas', 'reverseselection')) {
                    $sem_range_query =  "AND seminar_sem_tree.sem_tree_id NOT IN ('".implode("','", $selected_ranges)."')";
                } else {
                    $sem_range_query =  "AND seminar_sem_tree.sem_tree_id IN ('".implode("','", $selected_ranges)."')";
                }
            } else {
                $sem_range_query = '';
            }
            
            // show only selected SemTypes
            $selected_semtypes = $this->module->config->getValue('ReplaceTextSemType', 'visibility');
            if (Request::get('semstatus')) {
                $selected_semtypes = array(Request::get('semstatus'));
            }
            $sem_types_array = array();
            if (count($selected_semtypes)) {
                for ($i = 0; $i < count($selected_semtypes); $i++) {
                    if ($selected_semtypes[$i] == '1') {
                        $sem_types_array[] = $i + 1;
                    }
                }
                $sem_types_query = "AND seminare.status IN ('" . implode("','", $sem_types_array) . "')";
            } else {
                $sem_types_query = '';
            }
            
            // number of visible columns
            $group_colspan = array_count_values($this->module->config->getValue("Main", "visible"));
            
            if ($this->sem_browse_data['group_by'] == 1){
                if (!is_object($this->sem_tree)){
                    $the_tree = TreeAbstract::GetInstance("StudipSemTree");
                } else {
                    $the_tree =& $this->sem_tree->tree;
                }
            $the_tree->buildIndex();
            }
            
            if (!$this->module->config->getValue("Main", "allseminars") && !Request::get('allseminars')){
                $sem_inst_query = " AND seminare.Institut_id='{$this->module->config->range_id}' ";
            }
            if (Request::option('aggregation')) {
                $i = Institute::find($this->config->range_id);
                $children = $i->sub_institutes->pluck('institut_id');
                $sem_inst_query = " AND seminare.Institut_id IN ('".(implode("', '", $children))."')";
            }
            if (!$nameformat = $this->module->config->getValue("Main", "nameformat"))
                $nameformat = "no_title_short";
            
            $dbv = DbView::getView('sem_tree');
                
            $query = "SELECT seminare.* 
                , Institute.Name AS Institut,Institute.Institut_id,
                seminar_sem_tree.sem_tree_id AS bereich, " . $_fullname_sql[$nameformat] ." AS fullname, auth_user_md5.username,
                " . $dbv->sem_number_sql . " AS sem_number, " . $dbv->sem_number_end_sql . " AS sem_number_end, " . 
            " seminar_user.position AS position " . 
            " FROM seminare 
                LEFT JOIN seminar_user ON (seminare.Seminar_id=seminar_user.Seminar_id AND seminar_user.status='dozent') 
                LEFT JOIN auth_user_md5 USING (user_id) 
                LEFT JOIN user_info USING (user_id) 
                LEFT JOIN seminar_sem_tree ON (seminare.Seminar_id = seminar_sem_tree.seminar_id)
                LEFT JOIN seminar_inst ON (seminare.Seminar_id = seminar_inst.Seminar_id) 
                LEFT JOIN Institute ON (seminar_inst.institut_id = Institute.Institut_id)
                WHERE seminare.Seminar_id IN('" . join("','", array_keys($this->sem_browse_data['search_result']))
                 . "') $sem_inst_query $sem_range_query $sem_types_query";
            
            $db = new DB_Seminar($query);
            $snap = new DbSnapshot($db);
            $group_field = $this->group_by_fields[$this->sem_browse_data['group_by']]['group_field'];
            $data_fields[0] = "Seminar_id";
            if ($this->group_by_fields[$this->sem_browse_data['group_by']]['unique_field']){
                $data_fields[1] = $this->group_by_fields[$this->sem_browse_data['group_by']]['unique_field'];
            }
            $group_by_data = $snap->getGroupedResult($group_field, $data_fields);
            $sem_data = $snap->getGroupedResult("Seminar_id");
            if ($this->sem_browse_data['group_by'] == 0){
                $group_by_duration = $snap->getGroupedResult("sem_number_end", array("sem_number","Seminar_id"));
                foreach ($group_by_duration as $sem_number_end => $detail){
                    if ($sem_number_end != -1 && ($detail['sem_number'][$sem_number_end - 1] && count($detail['sem_number']) == 1)){
                        continue;
                    } else {
                        foreach ($detail['Seminar_id'] as $seminar_id => $foo){
                            $start_sem = key($sem_data[$seminar_id]["sem_number"]);
                            if ($sem_number_end == -1){
                                if (is_array($this->sem_number)){
                                    $sem_number_end = $this->sem_number[0];
                                } else {
                                    $sem_number_end = count($this->sem_dates)-1;
                                }
                            }
                            for ($i = $start_sem; $i <= $sem_number_end; ++$i){
                                if ($this->sem_number === false || (is_array($this->sem_number) && in_array($i,$this->sem_number))){
                                    if ($group_by_data[$i] && !$tmp_group_by_data[$i]){
                                        foreach($group_by_data[$i]['Seminar_id'] as $id => $bar){
                                            $tmp_group_by_data[$i]['Seminar_id'][$id] = true;
                                        }
                                    }
                                    $tmp_group_by_data[$i]['Seminar_id'][$seminar_id] = true;
                                }
                            }
                        }
                    }
                }
                if (is_array($tmp_group_by_data)){
                    if ($this->sem_number !== false){
                        unset($group_by_data);
                    }
                    foreach ($tmp_group_by_data as $start_sem => $detail){
                        $group_by_data[$start_sem] = $detail;
                    }
                }
            }
            //release memory
            unset($snap);
            unset($tmp_group_by_data);
            
            foreach ($group_by_data as $group_field => $sem_ids){
                foreach ($sem_ids['Seminar_id'] as $seminar_id => $foo){
                    $name = strtolower(key($sem_data[$seminar_id]["Name"]));
                    $name = str_replace("ä","ae",$name);
                    $name = str_replace("ö","oe",$name);
                    $name = str_replace("ü","ue",$name);
                    $group_by_data[$group_field]['Seminar_id'][$seminar_id] = $name;
                }
                uasort($group_by_data[$group_field]['Seminar_id'], 'strnatcmp');
            }
            
            switch ($this->sem_browse_data["group_by"]){
                    case 0:
                    krsort($group_by_data, SORT_NUMERIC);
                    break;
                    
                    case 1:
                    uksort($group_by_data, create_function('$a,$b',
                            '$the_tree = TreeAbstract::GetInstance("StudipSemTree");
                            return (int)($the_tree->tree_data[$a]["index"] - $the_tree->tree_data[$b]["index"]);
                            '));
                    break;
                    
                    case 3:
                    if ($order = $this->module->config->getValue("ReplaceTextSemType", "order")) {
                        foreach ($order as $position) {
                            if (isset($group_by_data[$position]))
                                $group_by_data_tmp[$position] = $group_by_data[$position];
                        }
                        $group_by_data = $group_by_data_tmp;
                        unset($group_by_data_tmp);
                    }
                    else {
                        uksort($group_by_data, create_function('$a,$b',
                                'global $SEM_CLASS,$SEM_TYPE;
                                return strnatcasecmp($SEM_TYPE[$a]["name"]." (". $SEM_CLASS[$SEM_TYPE[$a]["class"]]["name"].")",
                                                $SEM_TYPE[$b]["name"]." (". $SEM_CLASS[$SEM_TYPE[$b]["class"]]["name"].")");'));
                    }
                    break;
                    default:
                    uksort($group_by_data, 'strnatcasecmp');
                    break;
                    
            }
            
            // generic datafields
            $generic_datafields = $this->module->config->getValue("Main", "genericdatafields");
//              $datafields_obj = new DataFields();
            
            if ($this->module->config->getValue("Main", "addinfo")) {
                $info = "&nbsp;" . count($sem_data);
                $info .= $this->module->config->getValue("Main", "textlectures");
                $info .= ", " . $this->module->config->getValue("Main", "textgrouping");
                $group_by_name = $this->module->config->getValue("Main", "aliasesgrouping");
                $info .= $group_by_name[$this->sem_browse_data['group_by']];
                $out = $this->module->elements["InfoCountSem"]->toString(array("content" => $info));
            }
            else
                $out = "";
            
            $first_loop = TRUE;
            $repeat_headrow = $this->module->config->getValue("Main", "repeatheadrow");
            foreach ($group_by_data as $group_field => $sem_ids) {
                
                $group_content = $this->getGroupContent($the_tree, $group_field);
                
                if ($repeat_headrow == "beneath") {
                    $out .= $this->module->elements["Grouping"]->toString(array("content" => $group_content));
                    $out .= $this->module->elements["TableHeadrow"]->toString();
                }
    
                if($first_loop && $repeat_headrow != "beneath")
                    $out .= $this->module->elements["TableHeadrow"]->toString();
    
                if ($repeat_headrow != "beneath") {
                    if ($repeat_headrow && !$first_loop)
                        $out .= $this->module->elements["TableHeadrow"]->toString();
                    $out .= $this->module->elements["Grouping"]->toString(array("content" => $group_content));
                }
                $first_loop = FALSE;
                                
                if (is_array($sem_ids['Seminar_id'])) {
                    $zebra = 0;
                    while (list($seminar_id,) = each($sem_ids['Seminar_id'])) {
                                                
                        $sem_name = key($sem_data[$seminar_id]["Name"]);
                        $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->sem_dates[$sem_number_start]['name'] . " - ";
                            $sem_name .= (($sem_number_end == -1) ? _("unbegrenzt") : $this->sem_dates[$sem_number_end]['name']) . ")";
                        }
                        
                        //create Turnus field
                        $data["content"]["zeiten"] = Seminar::GetInstance($seminar_id)->getDatesExport(array('show_room' => true));
                        //Shorten, if string too long
                        if (strlen($data["content"]["zeiten"]) >70) {
                            $data["content"]["zeiten"] = substr($data["content"]["zeiten"], 0,
                                    strpos(substr($data["content"]["zeiten"], 70, strlen($data["content"]["zeiten"])), ",") +71);
                            $data["content"]["zeiten"] .= "...";
                        }
                        $data["content"]["zeiten"] = htmlReady($data["content"]["zeiten"]);
                        $doz_position = array_keys($sem_data[$seminar_id]['position']);
                        $doz_name = array_keys($sem_data[$seminar_id]['fullname']);
                        $doz_uname = array_keys($sem_data[$seminar_id]['username']);
                        if (is_array($doz_name)){
                            if(count($doz_position) != count($doz_uname)) $doz_position = range(1, count($doz_uname));
                     array_multisort($doz_position, $doz_name, $doz_uname);
                            $data["content"]["dozent"] = "";
                            $i = 0;
                            foreach ($doz_name as $index => $value) {
                                if ($i == 4) {
                                    $data["content"]["dozent"] .= $this->module->elements["LecturerLink"]->toString(
                                        array("module" => "Lecturedetails", "link_args" => "seminar_id=$seminar_id",
                                        "content" => "..."));
                                    break;
                                }
                                $data["content"]["dozent"] .= $this->module->elements["LecturerLink"]->toString(
                                        array("module" => "Persondetails", "link_args" => "username="******"&seminar_id=$seminar_id",
                                        "content" =>  htmlReady($value)));
                                if ($i != count($doz_name) - 1) {
                                    $data["content"]["dozent"] .= ", ";
                                }
                                ++$i;
                            }
                        }
                        
                        $data["content"]["Name"] = $this->module->elements["SemLink"]->toString(
                                array("module" => "Lecturedetails", "link_args" => "seminar_id=$seminar_id",
                                "content" => htmlReady($sem_name)));
                        $data["content"]["VeranstaltungsNummer"] =
                                htmlReady(key($sem_data[$seminar_id]["VeranstaltungsNummer"]));
                        $data["content"]["Untertitel"] = htmlReady(key($sem_data[$seminar_id]["Untertitel"]));
                        
                        $aliases_sem_type = $this->module->config->getValue("ReplaceTextSemType",
                                "class_" . $SEM_TYPE[key($sem_data[$seminar_id]["status"])]['class']);
                        if ($aliases_sem_type[$this->sem_types_position[key($sem_data[$seminar_id]["status"])] - 1]) {
                            $data["content"]["status"] =
                                    $aliases_sem_type[$this->sem_types_position[key($sem_data[$seminar_id]["status"])] - 1];
                        }
                        else {
                            $data["content"]["status"] =
                                    htmlReady($SEM_TYPE[key($sem_data[$seminar_id]["status"])]["name"]
                                    ." (". $SEM_CLASS[$SEM_TYPE[key($sem_data[$seminar_id]["status"])]["class"]]["name"].")");
                        }
                        
                        $data["content"]["Ort"] = Seminar::getInstance($seminar_id)->getDatesTemplate('dates/seminar_export_location');
                        if ($sem_data[$seminar_id]["art"])
                            $data["content"]["art"] = htmlReady(key($sem_data[$seminar_id]["art"]));
                        else
                            $data["content"]["art"] = "";
                        
                        // generic data fields
                        if (is_array($generic_datafields)) {
                            $localEntries = DataFieldEntry::getDataFieldEntries($seminar_id);
                            foreach ($generic_datafields as $id) {
                                if (isset($localEntries[$id]) && is_object($localEntries[$id])) {
                                    $data["content"][$id] = $localEntries[$id]->getDisplayValue();
                                }
                            }
                        }
                        
                        $data["data_fields"] = $this->module->data_fields;
                        $out .= $this->module->elements["TableRow"]->toString($data);
                    }
                }
            }
            ob_end_clean();
            $this->module->elements["TableHeader"]->printout(array("content" => $out));
        }
    }
Esempio n. 14
0
        if ($grouping && $repeat_headrow == 'beneath') {
            $out .= $this->elements['TableGroup']->toString(array('content' => htmlReady($group)));
        }

        if ($repeat_headrow || $first_loop) {
            $out .= $this->elements['TableHeadrow']->toString();
        }

        if ($grouping && $repeat_headrow != 'beneath') {
            $out .= $this->elements['TableGroup']->toString(array('content' => htmlReady($group)));
        }

        $range_ids = array($range_id);
        if (Request::option('aggregation')) {
            $i = Institute::find($range_id);
            $children = $i->sub_institutes->pluck('institut_id');
            $range_ids = array_merge($range_ids, $children);
        }

        foreach ($rows as $row) {
            if ($defaultadr) {
                $ext_vis_query = get_ext_vis_query();
                $query = "SELECT ui.raum, ui.sprechzeiten, ui.Telefon,
                                 inst_perms, Email, aum.user_id, username,
                                 {$_fullname_sql[$nameformat]} AS fullname,
                                 aum.Nachname
                          FROM auth_user_md5 AS aum
                          LEFT JOIN user_info USING (user_id)
                          LEFT JOIN user_inst AS ui USING (user_id)
                          WHERE aum.user_id = ? AND externdefault = 1
Esempio n. 15
0
 /**
  * Show all coursesets the current user has access to.
  */
 public function index_action()
 {
     $this->course_set_details = Request::option('course_set_details');
     if ($this->course_set_details && Request::isXhr()) {
         $courseset = new CourseSet($this->course_set_details);
         return $this->render_text($courseset->toString());
     }
     $this->ruleTypes = RuleAdministrationModel::getAdmissionRuleTypes();
     $this->coursesets = array();
     foreach (words('current_institut_id current_rule_types set_name_prefix current_semester_id current_rule_types') as $param) {
         $this->{$param} = $_SESSION[get_class($this)][$param];
     }
     if (Request::submitted('choose_institut')) {
         $this->current_institut_id = Request::option('choose_institut_id');
         $this->current_rule_types = Request::getArray('choose_rule_type');
         $this->set_name_prefix = trim(Request::get('set_name_prefix'));
         $this->current_semester_id = Request::option('select_semester_id');
     }
     if ($this->current_semester_id === null) {
         $this->current_semester_id = $_SESSION['_default_sem'];
     } else {
         if ($this->current_semester_id !== '0') {
             $_SESSION['_default_sem'] = $this->current_semester_id;
         }
     }
     if (!isset($this->current_rule_types)) {
         $this->current_rule_types['ParticipantRestrictedAdmission'] = true;
     }
     $filter['course_set_name'] = $this->set_name_prefix;
     $filter['semester_id'] = $this->current_semester_id != 'all' ? $this->current_semester_id : null;
     $filter['rule_types'] = array_keys($this->current_rule_types);
     $this->myInstitutes = CoursesetModel::getInstitutes($filter);
     if (!$this->current_institut_id) {
         if ($this->myInstitutes['all']['num_sets'] < 100) {
             $this->current_institut_id = 'all';
         } else {
             next($this->myInstitutes);
             $this->current_institut_id = key($this->myInstitutes);
             reset($this->myInstitutes);
         }
     }
     list($institut_id, $all) = explode('_', $this->current_institut_id);
     if ($institut_id == 'all') {
         $institutes = array_keys($this->myInstitutes);
     } else {
         if ($all == 'all') {
             $institutes[] = $institut_id;
             $institutes = array_merge($institutes, Institute::find($institut_id)->sub_institutes->pluck('institut_id'));
         } else {
             $institutes = array($institut_id);
         }
     }
     foreach ($institutes as $one) {
         if ($this->myInstitutes[$one]['num_sets']) {
             $sets = CourseSet::getCoursesetsByInstituteId($one, $filter);
             foreach ($sets as $set) {
                 $courseset = new CourseSet($set['set_id']);
                 $this->coursesets[$set['set_id']] = $courseset;
             }
         }
     }
     uasort($this->coursesets, function ($a, $b) {
         return strnatcasecmp($a->getName(), $b->getName());
     });
     foreach (words('current_institut_id current_rule_types set_name_prefix current_semester_id current_rule_types') as $param) {
         $_SESSION[get_class($this)][$param] = $this->{$param};
     }
     $not_distributed_coursesets = array_filter(array_map(function ($cs) {
         return $cs->isSeatDistributionEnabled() && $cs->getSeatDistributionTime() < time() - 1000 && !$cs->hasAlgorithmRun() ? $cs->getName() : null;
     }, $this->coursesets));
     if (count($not_distributed_coursesets)) {
         PageLayout::postMessage(MessageBox::info(_("Es existieren Anmeldesets, die zum Zeitpunkt der Platzverteilung nicht gelost wurden. Stellen Sie sicher, dass der Cronjob \"Losverfahren überprüfen\" ausgeführt wird."), array_unique($not_distributed_coursesets)));
     }
 }
Esempio n. 16
0
                 $name .= ' - ' . Semester::findByTimestamp($seminar->semester_start_time + $seminar->semester_duration_time)->name;
             }
             $name .= ')';
             $dozenten = array_map(function ($v) {
                 return $v['Nachname'];
             }, $seminar->getMembers('dozent'));
             $name .= ' (' . join(', ', $dozenten) . ')';
             break;
         case 'user':
             $name = _("Profil:");
             $name .= ' ' . get_fullname($eval_range);
             break;
         case 'inst':
         case 'fak':
             $name = _("Einrichtung:");
             $name .= ' ' . Institute::find($eval_range)->name;
             break;
         default:
             $name = _("unbekannt");
     }
     $eval_ranges_names[] = $name;
 }
 sort($eval_ranges_names);
 // Evaluation existiert auch...
 echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";
 echo "<tr><td class=\"table_header_bold\" align=\"left\"><font color=\"" . ($ausgabeformat == 1 ? "white" : "black") . "\">";
 echo $ausgabeformat == 1 ? Icon::create('test', 'info_alt')->asImg() : "";
 echo "<b>" . _("Evaluations-Auswertung") . "</b></font></td>\n";
 echo "<td class=\"" . ($ausgabeformat == 1 ? "table_header_bold" : "blank") . "\" align=\"RIGHT\">" . ($ausgabeformat == 1 ? "<a href=\"eval_summary_export.php?eval_id=" . $eval_id . "\" TARGET=\"_blank\"><font color=\"WHITE\">" . _("PDF-Export") . "</font></a><b>&nbsp;|&nbsp;</b><a href=\"" . URLHelper::getLink('?eval_id=' . $eval_id . '&ausgabeformat=2') . "\" TARGET=\"_blank\"><font color=\"WHITE\">" . _("Druckansicht") . "</font></a>&nbsp;&nbsp;<a href=\"eval_config.php?eval_id=" . $eval_id . "\">" . Icon::create('arr_2right', 'info_alt', ['title' => _('Auswertung konfigurieren')])->asImg() . "</a>" : "") . "&nbsp;</td>\n";
 echo "</tr>\n";
 echo "<tr><td class=\"blank\" colspan=\"2\" align=\"left\">&nbsp;</td></tr>\n";
Esempio n. 17
0
 function up()
 {
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaires` (\n                `questionnaire_id` varchar(32) NOT NULL,\n                `title` varchar(128)  NOT NULL,\n                `description` text NULL,\n                `user_id` varchar(32)  NOT NULL,\n                `startdate` BIGINT(20) NULL,\n                `stopdate` BIGINT(20) NULL,\n                `visible` TINYINT(1) DEFAULT '0' NOT NULL,\n                `anonymous` TINYINT(1) DEFAULT '0' NOT NULL,\n                `resultvisibility` ENUM('always', 'never', 'afterending') DEFAULT 'always' NOT NULL,\n                `editanswers` TINYINT(1) DEFAULT '1' NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                PRIMARY KEY (`questionnaire_id`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_questions` (\n                `question_id` varchar(32) NOT NULL,\n                `questionnaire_id` varchar(32) NOT NULL,\n                `questiontype` varchar(64) NOT NULL,\n                `questiondata` text NOT NULL,\n                `position` INT NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                PRIMARY KEY (`question_id`),\n                KEY `questionnaire_id` (`questionnaire_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_assignments` (\n                `assignment_id` varchar(32) NOT NULL,\n                `questionnaire_id` varchar(32) NOT NULL,\n                `range_id` varchar(32) NOT NULL,\n                `range_type` varchar(64) NOT NULL,\n                `user_id` varchar(32) NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` int(11) NOT NULL,\n                PRIMARY KEY (`assignment_id`),\n                KEY `questionnaire_id` (`questionnaire_id`),\n                KEY `range_id_range_type` (`range_id`,`range_type`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_answers` (\n                `answer_id` varchar(32) NOT NULL,\n                `question_id` varchar(32)  NOT NULL,\n                `user_id` varchar(32) NULL,\n                `answerdata` text NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                PRIMARY KEY (`answer_id`),\n                KEY `question_id` (`question_id`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_anonymous_answers` (\n                `anonymous_answer_id` varchar(32) NOT NULL,\n                `questionnaire_id` varchar(32) NOT NULL,\n                `user_id` varchar(32) NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` int(11) NOT NULL,\n                PRIMARY KEY (`anonymous_answer_id`),\n                KEY `questionnaire_id` (`questionnaire_id`),\n                UNIQUE KEY `questionnaire_id_user_id` (`questionnaire_id`,`user_id`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     //now import old data into new tables:
     $resultvisibility_mapping = array('ever' => 'always', 'delivery' => 'always', 'end' => 'afterending', 'never' => 'never');
     $all_votes = DBManager::get()->prepare("\n            SELECT * FROM vote\n        ");
     $all_votes->execute();
     while ($vote = $all_votes->fetch(PDO::FETCH_ASSOC)) {
         //Fragebogen erstellen
         $questionnaire = new Questionnaire($vote['vote_id']);
         $questionnaire['title'] = $vote['title'];
         $questionnaire->setId($vote['vote_id']);
         $questionnaire['user_id'] = $vote['author_id'];
         $questionnaire['startdate'] = $vote['startdate'];
         $questionnaire['stopdate'] = $vote['stopdate'] ?: (in_array($vote['state'], array("stopvis", "stopinvis")) ? time() : null);
         $questionnaire['visible'] = in_array($vote['state'], array("active", "stopvis")) ? 1 : 0;
         // stopvis new active stopinvis
         $questionnaire['anonymous'] = $vote['anonymous'];
         $questionnaire['resultvisibility'] = $resultvisibility_mapping[$vote['resultvisibility']];
         $questionnaire['editanswers'] = $vote['changeable'];
         $questionnaire['chdate'] = $vote['chdate'];
         $questionnaire['mkdate'] = $vote['mkdate'];
         $questionnaire->store();
         //Tests und Umfragen anlegen
         if ($vote['type'] === "vote") {
             $question = new Vote();
             $question['questiontype'] = "Vote";
         } else {
             $question = new Test();
             $question['questiontype'] = "Test";
         }
         $questiondata = array();
         $question['questionnaire_id'] = $questionnaire->getId();
         $question['chdate'] = $vote['chdate'];
         $question['mkdate'] = $vote['mkdate'];
         $questiondata['multiplechoice'] = $vote['multiplechoice'];
         $questiondata['question'] = $vote['question'];
         $question['position'] = 1;
         //Antwortmöglichkeiten vorsehen:
         $options_statement = DBManager::get()->prepare("\n                SELECT *\n                FROM voteanswers\n                WHERE vote_id = ?\n                ORDER BY position ASC\n            ");
         $options_statement->execute(array($vote['vote_id']));
         $options = $options_statement->fetchAll(PDO::FETCH_ASSOC);
         $mapping = array();
         $counter = array();
         foreach ($options as $key => $option) {
             $questiondata['options'][] = $option['answer'];
             $mapping[$option['answer_id']] = $key + 1;
             $counter[$option['answer_id']] = $option['counter'];
             if ($vote['type'] === "test" && $option['correct']) {
                 $questiondata['correctanswer'][] = $key + 1;
             }
         }
         $question['questiondata'] = $questiondata;
         $question->store();
         //Bestehende Antworten migrieren
         if ($questionnaire['anonymous']) {
             foreach ($counter as $answer_id => $count) {
                 for ($i = 0; $i < $count; $i++) {
                     $answer = new QuestionnaireAnswer();
                     $answer['user_id'] = null;
                     $answer['chdate'] = 1;
                     //damit man nicht aus dem chdate auf die user_id schließen kann
                     $answer['mkdate'] = 1;
                     //mkdate genauso
                     $answer['question_id'] = $question->getId();
                     $answerdata = array();
                     $answers = array($answer_id);
                     foreach ($answers as $key => $answer_data) {
                         $answers[$key] = $mapping[$answer_data];
                     }
                     sort($answers);
                     $answerdata['answers'] = $answers;
                     if (!$questiondata['multiplechoice']) {
                         $answerdata['answers'] = $answerdata['answers'][0];
                     }
                     $answer['answerdata'] = $answerdata;
                     $answer->store();
                 }
             }
             $statement = DBManager::get()->prepare("\n                    SELECT *\n                    FROM vote_user\n                    WHERE vote_id = :vote_id\n                ");
             $statement->execute(array('vote_id' => $vote['vote_id']));
             foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $anonymous_vote) {
                 $anonymous_answer = new QuestionnaireAnonymousAnswer();
                 $anonymous_answer['questionnaire_id'] = $questionnaire->getId();
                 $anonymous_answer['user_id'] = $anonymous_vote['user_id'];
                 $anonymous_answer['chdate'] = $anonymous_vote['votedate'];
                 $anonymous_answer['mkdate'] = $anonymous_vote['votedate'];
                 $anonymous_answer->store();
             }
         } else {
             $statement = DBManager::get()->prepare("\n                    SELECT GROUP_CONCAT(answer_id SEPARATOR ' ') AS answers, user_id, MAX(votedate) AS votedate\n                    FROM voteanswers_user\n                    WHERE answer_id IN (?)\n                    GROUP BY user_id\n                ");
             $statement->execute(array(array_keys($mapping)));
             foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $answer_data) {
                 $answer = new QuestionnaireAnswer();
                 $answer['user_id'] = $answer_data['user_id'];
                 $answer['chdate'] = $answer_data['votedate'];
                 $answer['mkdate'] = $answer_data['votedate'];
                 $answer['question_id'] = $question->getId();
                 $answerdata = array();
                 $answers = explode(" ", $answer_data['answers']);
                 foreach ($answers as $key => $answer_data) {
                     $answers[$key] = $mapping[$answer_data];
                 }
                 sort($answers);
                 $answerdata['answers'] = $answers;
                 if (!$questiondata['multiplechoice']) {
                     $answerdata['answers'] = $answerdata['answers'][0];
                 }
                 $answer['answerdata'] = $answerdata;
                 $answer->store();
             }
         }
         //Und noch einhängen das ganze:
         $binding = new QuestionnaireAssignment();
         $binding['questionnaire_id'] = $questionnaire->getId();
         $binding['range_id'] = $vote['range_id'] !== "studip" ? $vote['range_id'] : "start";
         $binding['range_type'] = $vote['range_id'] === "studip" ? "static" : ($vote['range_id'] === $vote['author_id'] ? "user" : (Institute::find($vote['range_id']) ? "institute" : "course"));
         $binding['user_id'] = $vote['author_id'];
         $binding['chdate'] = $questionnaire['chdate'];
         $binding['mkdate'] = $questionnaire['mkdate'];
         $binding->store();
     }
     //and finally clean up:
     //DBManager::get()->exec("DROP TABLE IF EXISTS `vote`");
     //DBManager::get()->exec("DROP TABLE IF EXISTS `voteanswers`");
     //DBManager::get()->exec("DROP TABLE IF EXISTS `voteanswers_user`");
     //DBManager::get()->exec("DROP TABLE IF EXISTS `vote_user`");
 }
Esempio n. 18
0
 /**
  * Deletes an institute
  * @param String $i_id Institute id
  */
 public function delete_action($i_id)
 {
     CSRFProtection::verifyUnsafeRequest();
     // Missing parameter
     if (!Request::get('i_kill')) {
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     // Invalid ticket
     if (!check_ticket(Request::option('studipticket'))) {
         PageLayout::postMessage(MessageBox::error(_('Ihr Ticket ist abgelaufen. Versuchen Sie die letzte Aktion erneut.')));
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     // User may not delete this institue
     if (!$GLOBALS['perm']->have_perm('root') && !($GLOBALS['perm']->is_fak_admin() && get_config('INST_FAK_ADMIN_PERMS') === 'all')) {
         PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung Fakultäten zu löschen!')));
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     $institute = Institute::find($i_id);
     if ($institute === null) {
         throw new Exception('Invalid institute id');
     }
     // Institut in use?
     if (count($institute->home_courses)) {
         PageLayout::postMessage(MessageBox::error(_('Diese Einrichtung kann nicht gelöscht werden, da noch Veranstaltungen an dieser Einrichtung existieren!')));
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     // Institute has sub institutes?
     if (count($institute->sub_institutes)) {
         PageLayout::postMessage(MessageBox::error(_('Diese Einrichtung kann nicht gelöscht werden, da sie den Status Fakultät hat und noch andere Einrichtungen zugeordnet sind!')));
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     // Is the user allowed to delete faculties?
     if ($institute->is_fak && !$GLOBALS['perm']->have_perm('root')) {
         PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung Fakultäten zu löschen!')));
         return $this->redirect('institute/basicdata/index/' . $i_id);
     }
     // Save users, name and number of courses
     $user_ids = $institute->members->pluck('user_id');
     $i_name = $institute->name;
     $i_courses = count($institute->courses);
     // Delete that institute
     if (!$institute->delete()) {
         PageLayout::postMessage(MessageBox::error(_('Die Einrichtung konnte nicht gelöscht werden.')));
     } else {
         $details = array();
         // logging - put institute's name in info - it's no longer derivable from id afterwards
         log_event('INST_DEL', $i_id, NULL, $i_name);
         // set a suitable default institute for each user
         foreach ($user_ids as $user_id) {
             log_event('INST_USER_DEL', $i_id, $user_id);
             checkExternDefaultForUser($user_id);
         }
         if (count($user_ids)) {
             $details[] = sprintf(_('%u Mitarbeiter gelöscht.'), count($user_ids));
         }
         // Report number of formerly associated courses
         if ($i_courses) {
             $details[] = sprintf(_('%u Beteiligungen an Veranstaltungen gelöscht'), $i_courses);
         }
         // delete literatur
         $del_lit = StudipLitList::DeleteListsByRange($i_id);
         if ($del_lit) {
             $details[] = sprintf(_('%u Literaturlisten gelöscht.'), $del_lit['list']);
         }
         // delete news-links
         StudipNews::DeleteNewsRanges($i_id);
         //delete entry in news_rss_range
         StudipNews::UnsetRssId($i_id);
         //updating range_tree
         $query = "UPDATE range_tree SET name = ?, studip_object = '', studip_object_id = '' WHERE studip_object_id = ?";
         $statement = DBManager::get()->prepare($query);
         $statement->execute(array(_('(in Stud.IP gelöscht)'), $i_id));
         if (($db_ar = $statement->rowCount()) > 0) {
             $details[] = sprintf(_('%u Bereiche im Einrichtungsbaum angepasst.'), $db_ar);
         }
         // Statusgruppen entfernen
         if ($db_ar = DeleteAllStatusgruppen($i_id) > 0) {
             $details[] = sprintf(_('%s Funktionen/Gruppen gelöscht.'), $db_ar);
         }
         //kill the datafields
         DataFieldEntry::removeAll($i_id);
         //kill all wiki-pages
         $removed_wiki_pages = 0;
         foreach (array('', '_links', '_locks') as $area) {
             $query = "DELETE FROM wiki{$area} WHERE range_id = ?";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($i_id));
             $removed_wiki_pages += $statement->rowCount();
         }
         if ($removed_wiki_pages > 0) {
             $details[] = sprintf(_('%u Wikiseiten gelöscht.'));
         }
         // kill all the ressources that are assigned to the Veranstaltung (and all the linked or subordinated stuff!)
         if (get_config('RESOURCES_ENABLE')) {
             $killAssign = new DeleteResourcesUser($i_id);
             $killAssign->delete();
         }
         // delete all configuration files for the "extern modules"
         if (get_config('EXTERN_ENABLE')) {
             $counts = ExternConfig::DeleteAllConfigurations($i_id);
             if ($counts) {
                 $details[] = sprintf(_('%u Konfigurationsdateien für externe Seiten gelöscht.'), $counts);
             }
         }
         // delete all contents in forum-modules
         foreach (PluginEngine::getPlugins('ForumModule') as $plugin) {
             $plugin->deleteContents($i_id);
             // delete content irrespective of plugin-activation in the seminar
             if ($plugin->isActivated($i_id)) {
                 // only show a message, if the plugin is activated, to not confuse the user
                 $details[] = sprintf(_('Einträge in %s gelöscht.'), $plugin->getPluginName());
             }
         }
         // Delete assigned documents
         $db_ar = delete_all_documents($i_id);
         if ($db_ar > 0) {
             $details[] = sprintf(_('%u Dokumente gelöscht.'), $db_ar);
         }
         //kill the object_user_vists for this institut
         object_kill_visits(null, $i_id);
         // Report success with details
         $message = sprintf(_('Die Einrichtung "%s" wurde gelöscht!'), $i_name);
         PageLayout::postMessage(MessageBox::success($message, $details));
     }
     $this->redirect('institute/basicdata/index?cid=');
 }
Esempio n. 19
0
        <? if ($GLOBALS['perm']->have_perm("admin")) : ?>
            <h3><?php 
echo _("Einrichtungen");
?>
</h3>
            <ul class="clean instituteselector">
                <? foreach ($this->questionnaire->assignments as $assignment) : ?>
                    <? if ($assignment['range_type'] === "institute") : ?>
                        <li>
                            <label>
                                <input type="checkbox" name="remove_inst[]" value="<?php 
echo htmlReady($assignment['range_id']);
?>
" style="display: none;">
                                <span><?php 
echo htmlReady(Institute::find($assignment['range_id'])->name);
?>
</span>
                                <?php 
echo Assets::img("icons/16/blue/trash", array('class' => "text-bottom", 'title' => _("Zuweisung zur Einrichtung aufheben.")));
?>
                            </label>
                        </li>
                    <? endif ?>
                <? endforeach ?>
            </ul>
            <?php 
echo QuickSearch::get("add_institut_id", new SeminarSearch())->render();
?>
        <? endif ?>
Esempio n. 20
0
 /**
  * Create a new banner
  */
 public function new_action()
 {
     // add new banner input
     if (Request::submitted('anlegen')) {
         $description = Request::get('description');
         $alttext = Request::get('alttext');
         $target_type = Request::option('target_type');
         //add the right target
         if ($target_type == 'url') {
             $target = Request::get('target');
         } else {
             if ($target_type == 'inst') {
                 $target = Request::option('institut');
             } else {
                 if ($target_type == 'user') {
                     $target = Request::username('user');
                 } else {
                     if ($target_type == 'seminar') {
                         $target = Request::option('seminar');
                     } else {
                         $target = Request::get('target');
                     }
                 }
             }
         }
         $priority = Request::int('priority');
         $errors = array();
         $upload = $_FILES['imgfile'];
         if (!$upload['name']) {
             $errors[] = _('Es wurde kein Bild ausgewählt.');
         } else {
             $banner_path = $this->bannerupload($upload['tmp_name'], $upload['size'], $upload['name'], $errors);
         }
         $startDate = explode('.', Request::get('start_date'));
         if (($x = $this->valid_date(Request::int('start_hour'), Request::int('start_minute'), $startDate[0], $startDate[1], $startDate[2])) == -1) {
             $errors[] = _('Bitte geben Sie einen gültiges Startdatum ein.');
         } else {
             $startdate = $x;
         }
         $endDate = explode('.', Request::get('end_date'));
         if (($x = $this->valid_date(Request::int('end_hour'), Request::int('end_minute'), $endDate[0], $endDate[1], $endDate[2])) == -1) {
             $errors[] = _('Bitte geben Sie einen gültiges Enddatum ein.');
         } else {
             $enddate = $x;
         }
         if (!$target && $target_type != 'none') {
             $errors[] = _('Es wurde kein Verweisziel angegeben.');
         } else {
             switch ($target_type) {
                 case 'url':
                     if (!preg_match('~^(https?|ftp)://~i', $target)) {
                         $errors[] = _('Das Verweisziel muss eine gültige URL sein (incl. http://).');
                     }
                     break;
                 case 'inst':
                     if (Institute::find($target) === null) {
                         $errors[] = _('Die angegebene Einrichtung existiert nicht. ' . 'Bitte geben Sie eine gültige Einrichtungs-ID ein.');
                     }
                     break;
                 case 'user':
                     if (User::findByUsername($target) === null) {
                         $errors[] = _('Der angegebene Benutzername existiert nicht.');
                     }
                     break;
                 case 'seminar':
                     try {
                         Seminar::getInstance($target);
                     } catch (Exception $e) {
                         $errors[] = _('Die angegebene Veranstaltung existiert nicht. ' . 'Bitte geben Sie eine gültige Veranstaltungs-ID ein.');
                     }
                     break;
                 case 'none':
                     $target = '';
                     break;
             }
         }
         if (count($errors) > 0) {
             PageLayout::postMessage(MessageBox::error(_('Es sind folgende Fehler aufgetreten:'), $errors));
         } else {
             $banner = new Banner();
             $banner->banner_path = $banner_path;
             $banner->description = $description;
             $banner->alttext = $alttext;
             $banner->target_type = $target_type;
             $banner->target = $target;
             $banner->startdate = $startdate;
             $banner->enddate = $enddate;
             $banner->priority = $priority;
             $banner->store();
             PageLayout::postMessage(MessageBox::success(_('Der Banner wurde erfolgreich gespeichert.')));
             $this->redirect('admin/banner');
         }
     }
 }
Esempio n. 21
0
 private function loadGroups()
 {
     $this->groups = Institute::find($_SESSION['SessionSeminar'])->status_groups;
 }
Esempio n. 22
0
 /**
  * Returns the name of the institute for the id found in the given
  * field or the id if the institute is unknown.
  *
  * @param string $field The name of the table field.
  * @return string The name of institute or the id.
  */
 protected function formatInstitute($field)
 {
     $institute = Institute::find($this->{$field});
     if (!$institute) {
         return $this->{$field};
     }
     return sprintf('<a href="%s">%s</a>', URLHelper::getLink('dispatch.php/institute/overview', array('auswahl' => $institute->getId())), htmlReady(my_substr($institute->name, 0, 100)));
 }
Esempio n. 23
0
 /**
  * Checks a role assignment for an user
  * optionally check for institute
  *
  * @param string $userid
  * @param string $assignedrole
  * @param string $institut_id
  * @return boolean
  */
 public static function isAssignedRole($userid, $assignedrole, $institut_id = '')
 {
     if ($institut_id) {
         $faculty_id = Institute::find($institut_id)->fakultaets_id;
     }
     $assigned = DBManager::get()->fetchColumn("SELECT r.roleid FROM roles_user AS u 
                                            LEFT JOIN roles AS r ON r.roleid=u.roleid 
                                            WHERE u.userid=? AND r.rolename=? AND u.institut_id IN (?)", array($userid,$assignedrole,array((string)$institut_id,(string)$faculty_id)));
     return $assigned != '';
 }
Esempio n. 24
0
 public function accessories($id)
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return Redirect::to('/');
     }
     if (isset($id)) {
         $course = Course::find($id);
         if (isset($course)) {
             Session::put('course_id', $id);
             $instituteId = Session::get('institute_id');
             if (isset($instituteId)) {
                 $institute = Institute::find($instituteId);
                 if (isset($institute)) {
                     return View::make('admin.accessories')->with('course', $course)->with('institute', $institute);
                 } else {
                     return Redirect::to('/');
                 }
             } else {
                 return Redirect::to('/');
             }
         } else {
             return Redirect::to('/');
         }
     } else {
         return Redirect::to('/');
     }
 }
Esempio n. 25
0
 case "sbb":
     $sem_browse_obj->sem_browse_data['start_item_id'] = $id;
     $sem_browse_obj->get_sem_range($id, false);
     $sem_browse_obj->show_result = true;
     $sem_browse_obj->sem_browse_data['sset'] = false;
     $the_tree = $sem_browse_obj->sem_tree->tree;
     $bereich_typ = _("Studienbereich");
     $head_text = _("Übersicht aller Veranstaltungen eines Studienbereichs");
     $intro_text = sprintf(_("Alle Veranstaltungen, die dem Studienbereich: <br><b>%s</b><br> zugeordnet wurden."), htmlReady($the_tree->getShortPath($id)));
     $excel_text = strip_tags(DecodeHtml($intro_text));
     break;
 case "s":
     $db = DbManager::get();
     $bereich_typ = _("Einrichtung");
     $head_text = _("Übersicht aller Veranstaltungen einer Einrichtung");
     $intro_text = sprintf(_("Alle Veranstaltungen der Einrichtung: <b>%s</b>"), htmlReady(Institute::find($id)->name));
     $excel_text = strip_tags(DecodeHtml($intro_text));
     $parameters = array($id);
     if ($show_semester) {
         $query = "SELECT seminar_inst.seminar_id\n                  FROM seminar_inst\n                  LEFT JOIN seminare AS s ON (seminar_inst.seminar_id = s.Seminar_id)\n                  INNER JOIN semester_data sd\n                     ON ((s.start_time <= sd.beginn AND sd.beginn <= (s.start_time + s.duration_time )\n                         OR (s.start_time <= sd.beginn AND s.duration_time = -1))\n                      AND semester_id = ?)\n                  WHERE seminar_inst.Institut_id = ?";
         array_unshift($parameters, $show_semester);
     } else {
         $query = "SELECT seminar_inst.seminar_id\n                  FROM seminar_inst\n                  LEFT JOIN seminare AS s ON (seminar_inst.seminar_id = s.Seminar_id)\n                  WHERE seminar_inst.Institut_id = ?";
     }
     if (!$GLOBALS['perm']->have_perm(get_config('SEM_VISIBILITY_PERM'))) {
         $query .= " AND s.visible = 1";
     }
     $statement = DBManager::get()->prepare($query);
     $statement->execute($parameters);
     $seminar_ids = $statement->fetchAll(PDO::FETCH_COLUMN);
     $sem_browse_obj->sem_browse_data['search_result'] = array_flip($seminar_ids);
 public function getInstitute($id)
 {
     if (isset($id)) {
         $institute = Institute::find($id);
         if (isset($institute)) {
             return json_encode(array('message' => 'found', 'institute' => $institute));
         } else {
             return json_encode(array('message' => 'empty'));
         }
     } else {
         return json_encode(array('message' => 'invalid'));
     }
 }