コード例 #1
0
ファイル: CoreOverview.class.php プロジェクト: ratbird/hope
 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);
 }
コード例 #2
0
ファイル: overview.php プロジェクト: ratbird/hope
 function before_filter(&$action, &$args)
 {
     if (Request::option('auswahl')) {
         Request::set('cid', Request::option('auswahl'));
     }
     parent::before_filter($action, $args);
     checkObject();
     $this->institute = Institute::findCurrent();
     if (!$this->institute) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     }
     $this->institute_id = $this->institute->id;
     //set visitdate for institute, when coming from meine_seminare
     if (Request::option('auswahl')) {
         object_set_visit($this->institute_id, "inst");
     }
     //gibt es eine Anweisung zur Umleitung?
     if (Request::get('redirect_to')) {
         $query_parts = explode('&', stristr(urldecode($_SERVER['QUERY_STRING']), 'redirect_to'));
         list(, $where_to) = explode('=', array_shift($query_parts));
         $new_query = $where_to . '?' . join('&', $query_parts);
         page_close();
         $new_query = preg_replace('/[^:0-9a-z+_\\-.#?&=\\/]/i', '', $new_query);
         header('Location: ' . URLHelper::getURL($new_query, array('cid' => $this->institute_id)));
         die;
     }
     PageLayout::setHelpKeyword("Basis.Einrichtungen");
     PageLayout::setTitle($this->institute->getFullName() . " - " . _("Kurzinfo"));
     Navigation::activateItem('/course/main/info');
 }
コード例 #3
0
 public function manageUsers()
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return Redirect::to('/');
     }
     $institutes = Institute::where('status', 'active')->orderBy('name')->get();
     if (isset($institutes) && count($institutes) > 0) {
         return View::make('admin.users')->with('institutesFound', true)->with('institutes', $institutes);
     } else {
         return View::make('admin.users')->with('institutesFound', false);
     }
 }
コード例 #4
0
ファイル: Institute.class.php プロジェクト: ratbird/hope
 /**
  * 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;
     }
 }
コード例 #5
0
 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;
 }
コード例 #6
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('/');
     }
 }
コード例 #7
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('/');
     }
 }
コード例 #8
0
 public function map($format, $value)
 {
     switch ($format) {
         case "name":
             $inst = Institute::findOneBySQL("Name = ?", array($value));
             if ($inst) {
                 return $inst->getId();
             }
             break;
         default:
             //Datenfeld:
             $datafield = DataField::find($format);
             if ($datafield && $datafield['object_type'] === "inst") {
                 $entry = DatafieldEntryModel::findOneBySQL("datafield_id = ? AND content = ?", array($datafield->getId(), $value));
                 if ($entry) {
                     return $entry['range_id'];
                 }
             }
     }
 }
コード例 #9
0
 public function getConnections($status = 'active', $page = 1)
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $connections = InstituteConnection::where('status', $status)->get();
     if (isset($connections) && count($connections) > 0) {
         $connectionArray = array();
         foreach ($connections as $connection) {
             $connectionFrom = Institute::where('id', $connection->connection_id)->first();
             $connectionTo = Institute::where('id', $connection->institute_id)->first();
             if (isset($connectionFrom) && isset($connectionTo)) {
                 $connectionArray[] = array('id' => $connection->id, 'connection_from' => $connectionFrom->name, 'connection_from_location' => $connectionFrom->city . ', ' . $connectionFrom->country, 'connection_to' => $connectionTo->name, 'connection_to_location' => $connectionTo->city . ', ' . $connectionTo->country);
             }
         }
         return json_encode(array('message' => 'found', 'connections' => $connectionArray));
     } else {
         return json_encode(array('message' => 'empty'));
     }
 }
コード例 #10
0
ファイル: profile.php プロジェクト: nbussman/StudipMobile
 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;
 }
コード例 #11
0
ファイル: my_institutes.php プロジェクト: ratbird/hope
 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');
 }
コード例 #12
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('/');
     }
 }
コード例 #13
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 != '';
 }
コード例 #14
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>";
        }
    }
コード例 #15
0
ファイル: statusgroups.php プロジェクト: ratbird/hope
 private function loadGroups()
 {
     $this->groups = Institute::find($_SESSION['SessionSeminar'])->status_groups;
 }
コード例 #16
0
ファイル: check_activation.php プロジェクト: ratbird/hope
        <br/>
        <input type="radio" name="activated" value="inst" onclick="STUDIP.Admission.checkRuleActivation('rule_activation_form')"<?php 
echo $atInst ? ' checked="checked"' : '';
?>
/><?php 
echo _('an ausgewählten Einrichtungen');
?>
    </div>
    <br/>
    <div id="institutes_activation"<?php 
echo $globally ? ' style="display:none"' : '';
?>
>
        <ul>
        <?php 
foreach (Institute::findBySQL("`fakultaets_id`=`Institut_id`") as $fak) {
    ?>
            <li id="<?php 
    echo $fak->Institut_id;
    ?>
">
                <input type="checkbox" name="institutes[]" value="<?php 
    echo $fak->Institut_id;
    ?>
"<?php 
    echo $activated[$fak->Institut_id] ? ' checked="checked"' : '';
    ?>
/>
                <a href=""><?php 
    echo htmlReady($fak->name);
    ?>
コード例 #17
0
ファイル: context.php プロジェクト: ratbird/hope
        <? 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 ?>
コード例 #18
0
ファイル: User.php プロジェクト: suryaharshan1/invoker-api
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInstitutes()
 {
     return $this->hasMany(Institute::className(), ['manager_id' => 'id']);
 }
コード例 #19
0
ファイル: StudipLog.class.php プロジェクト: ratbird/hope
 /**
  * Finds all institutes by given search string. Searches for the name of
  * existing or already deleted institutes.
  * 
  * @param type $needle The needle to search for.
  * @return array
  */
 public static function searchInstitute($needle)
 {
     $result = array();
     $institutes = Institute::findBySQL("name LIKE CONCAT('%', ?, '%')", array($needle));
     foreach ($institutes as $institute) {
         $result[] = array($institute->getId(), my_substr($institute->name, 0, 28));
     }
     // search for deleted institutes
     // Name of deleted institute is part of info field,
     // old id (still in DB) is in affected column
     $log_action_delete_institute = SimpleORMapCollection::createFromArray(LogAction::findByName('INST_DEL'))->first();
     $log_events_delete_institute = LogEvent::findBySQL("action_id = ? AND info LIKE CONCAT('%', ?, '%')", array($log_action_delete_institute->getId(), $needle));
     foreach ($log_events_delete_institute as $log_event) {
         $title = sprintf('%s (%s)', $log_event->info, _('gelöscht'));
         $result[] = array($log_event->affected_range_id, $title);
     }
     return $result;
 }
コード例 #20
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`");
 }
コード例 #21
0
ファイル: admin_search.inc.php プロジェクト: ratbird/hope
<?php

# Lifter002: TEST
# Lifter007: TEST
/**
 * admin_search_form.inc.php - Suche fuer die Verwaltungsseiten von Stud.IP.
 *
 * @author Stefan Suchi <*****@*****.**>
 * @author Ralf Stockmann <*****@*****.**>
 * @author Cornelis Kater <*****@*****.**>
 * @copyright 2001
 * @license GPL2 or any later version
 */
if (!Institute::findCurrent()) {
    $template = $GLOBALS['template_factory']->open('admin/institute_search.php');
    $template->set_layout('layouts/base.php');
    $template->institutes = Institute::getMyInstitutes($GLOBALS['user']->id);
    echo $template->render();
    page_close();
    die;
}
コード例 #22
0
ファイル: start.php プロジェクト: ratbird/hope
?>
</option>
                                       <?
                                    }
                                }
                            }
                           ?>
                           </select>
                           <br>
                           <select name="tools_requests_faculty_choose" onChange="document.tools_requests_form.submit()">
                           <option value=""><?php 
echo _("alle Veranstaltungen");
?>
</option>
                           <?
                           foreach (Institute::findBySQL("fakultaets_id=Institut_id ORDER BY Name ASC") as $faculty) {
                               ?>
                               <option <?php 
echo $display_faculty == $faculty->id ? 'selected' : '';
?>
 value="<?php 
echo $faculty->id;
?>
"><?php 
echo htmlReady($faculty->name);
?>
</option>
                               <?
                           }
                           ?>
                           </select>
コード例 #23
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);
     }
 }
コード例 #24
0
ファイル: courseset.php プロジェクト: ratbird/hope
 /**
  * Fetch institutes for course sets.
  *
  * @param Array $filter filter settings, e.g. a special subset of allowed
  * admission rules
  *
  * @return Array Found institutes.
  */
 static function getInstitutes($filter = array())
 {
     global $perm, $user;
     $parameters = array(1);
     $query = "SELECT COUNT(DISTINCT ci.set_id) FROM courseset_institute ci\n        LEFT JOIN coursesets c ON c.set_id = ci.set_id\n        LEFT JOIN courseset_rule cr ON c.set_id = cr.set_id\n        LEFT JOIN seminar_courseset sc ON c.set_id = sc.set_id\n        LEFT JOIN seminare s ON s.seminar_id = sc.seminar_id\n        WHERE ci.institute_id = ?";
     if ($filter['course_set_name']) {
         $query .= " AND c.name LIKE ?";
         $parameters[] = $filter['course_set_name'] . '%';
     }
     if (is_array($filter['rule_types']) && count($filter['rule_types'])) {
         $query .= " AND cr.type IN (?)";
         $parameters[] = $filter['rule_types'];
     }
     if ($filter['semester_id']) {
         $query .= " AND s.start_time = ?";
         $parameters[] = Semester::find($filter['semester_id'])->beginn;
     }
     $cs_count_statement = DBManager::get()->prepare($query);
     $query = str_replace('ci.institute_id', '1', $query);
     $cs_count_all_statement = DBManager::get()->prepare($query);
     if ($perm->have_perm('root')) {
         $cs_count_all_statement->execute($parameters);
         $num_sets = $cs_count_all_statement->fetchColumn();
         $my_inst['all'] = array('name' => _('alle'), 'num_sets' => $num_sets);
         $top_insts = Institute::findBySQL('Institut_id = fakultaets_id ORDER BY Name');
     } else {
         $top_insts = Institute::findMany(User::find($user->id)->institute_memberships->findBy('inst_perms', words('admin dozent'))->pluck('institut_id'), 'ORDER BY institut_id=fakultaets_id,name');
     }
     foreach ($top_insts as $inst) {
         $my_inst[$inst->id] = $inst->toArray('name is_fak');
         $parameters[0] = $inst->id;
         $cs_count_statement->execute($parameters);
         $my_inst[$inst->id]['num_sets'] = $cs_count_statement->fetchColumn();
         if ($inst->is_fak && ($perm->have_perm('root') || $inst->members->findBy('user_id', $user->id)->val('inst_perms') == 'admin')) {
             $alle = $inst->sub_institutes;
             if (count($alle)) {
                 $my_inst[$inst->id . '_all'] = array('name' => sprintf(_('[Alle unter %s]'), $inst->name), 'is_fak' => 'all');
                 $num_inst = 0;
                 $num_sets_alle = $my_inst[$inst->id]['num_sets'];
                 foreach ($alle as $institute) {
                     $num_inst += 1;
                     $my_inst[$institute->id] = $institute->toArray('name is_fak');
                     $parameters[0] = $institute->id;
                     $cs_count_statement->execute($parameters);
                     $my_inst[$institute->id]['num_sets'] = $cs_count_statement->fetchColumn();
                     $num_sets_alle += $my_inst[$institute->id]['num_sets'];
                 }
                 $my_inst[$inst->id . '_all']['num_inst'] = $num_inst;
                 $my_inst[$inst->id . '_all']['num_sets'] = $num_sets_alle;
             }
         }
     }
     return $my_inst;
 }
コード例 #25
0
ファイル: LogEvent.php プロジェクト: ratbird/hope
 /**
  * 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)));
 }
コード例 #26
0
 public function institutes()
 {
     $key = Input::get('keyword');
     $city = Input::get('city');
     $cityId = Input::get('c');
     // city id
     if (isset($key)) {
         if (isset($cityId) && strlen($cityId) > 0) {
             $institutes = Institute::where('name', 'like', '%' . $key . '%')->where('location_id', '=', $cityId)->with('location')->get();
         } else {
             $institutes = Institute::where('name', 'like', '%' . $key . '%')->with('location')->get();
         }
         $city = str_replace("-", " / ", $city);
         if (isset($institutes) && count($institutes) > 0) {
             return View::make('institute.institutes')->with('institutes', $institutes)->with('city', $city)->with('status', 'search');
         } else {
             return View::make('institute.institutes')->with('city', $city)->with('status', 'search');
         }
     } else {
         return View::make('institute.institutes')->with('city', '')->with('status', 'direct');
     }
 }
コード例 #27
0
ファイル: CourseSet.class.php プロジェクト: ratbird/hope
 /**
  * A textual description of the current rule.
  *
  * @param bool short Show only short info without overview of assigned
  *                   courses and institutes.
  * @return String
  */
 public function toString($short = false)
 {
     $tpl = $GLOBALS['template_factory']->open('admission/courseset/info');
     $tpl->set_attribute('courseset', $this);
     $institutes = array();
     if (!$short) {
         $institutes = Institute::findAndMapMany(function ($i) {
             return $i->name;
         }, array_keys($this->institutes), 'ORDER BY Name');
         $tpl->set_attribute('institutes', $institutes);
     }
     if (!$short || $this->hasAdmissionRule('LimitedAdmission')) {
         $courses = Course::findAndMapMany(function ($c) {
             return array('id' => $c->id, 'name' => $c->getFullname('number-name-semester'));
         }, array_keys($this->courses), 'ORDER BY start_time,VeranstaltungsNummer,Name');
         $tpl->set_attribute('is_limited', $this->hasAdmissionRule('LimitedAdmission'));
         $tpl->set_attribute('courses', $courses);
     }
     $tpl->set_attribute('short', $short);
     return $tpl->render();
 }
コード例 #28
0
ファイル: Sidebar.php プロジェクト: ratbird/hope
 /**
  * Renders the sidebar.
  * The sidebar will only be rendered if it actually contains any widgets.
  * It will use the template "sidebar.php" located at "templates/sidebar".
  * A notification is dispatched before and after the actual rendering
  * process.
  *
  * @return String The HTML code of the rendered sidebar.
  */
 public function render()
 {
     $content = '';
     if ($this->context_avatar === null) {
         $breadcrumbs = $this->getBreadCrumbs();
         $keys = array_keys($breadcrumbs);
         if (reset($keys) === 'course') {
             $course = Course::findCurrent();
             if ($course) {
                 if ($course->getSemClass()->offsetGet('studygroup_mode')) {
                     $avatar = StudygroupAvatar::getAvatar($course->id);
                 } else {
                     $avatar = CourseAvatar::getAvatar($course->id);
                 }
             } else {
                 $institute = Institute::findCurrent();
                 $avatar = InstituteAvatar::getAvatar($institute->id);
             }
             $this->setContextAvatar($avatar);
         }
     }
     NotificationCenter::postNotification('SidebarWillRender', $this);
     if ($this->hasWidgets()) {
         $template = $GLOBALS['template_factory']->open('sidebar/sidebar');
         $template->widgets = $this->widgets;
         $template->image = $this->getImage();
         $template->title = $this->getTitle();
         $template->avatar = $this->context_avatar;
         $content = $template->render();
     }
     NotificationCenter::postNotification('SidebarDidRender', $this);
     return $content;
 }
コード例 #29
0
ファイル: show_bereich.php プロジェクト: ratbird/hope
 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);
コード例 #30
0
ファイル: basicdata.php プロジェクト: ratbird/hope
 /**
  * Zeigt die Grunddaten an. Man beachte, dass eventuell zuvor eine andere
  * Action wie Set ausgeführt wurde, von der hierher weitergeleitet worden ist.
  * Wichtige Daten dazu wurden dann über $this->flash übertragen.
  *
  * @param md5 $course_id
  */
 public function view_action($course_id = null)
 {
     global $user, $perm, $_fullname_sql;
     $deputies_enabled = get_config('DEPUTIES_ENABLE');
     //damit QuickSearch funktioniert:
     Request::set('new_doz_parameter', $this->flash['new_doz_parameter']);
     if ($deputies_enabled) {
         Request::set('new_dep_parameter', $this->flash['new_dep_parameter']);
     }
     Request::set('new_tut_parameter', $this->flash['new_tut_parameter']);
     $this->course_id = Request::option('cid', $course_id);
     Navigation::activateItem('/course/admin/details');
     //Berechtigungscheck:
     if (!$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new AccessDeniedException(_("Sie haben keine Berechtigung diese " . "Veranstaltung zu verändern."));
     }
     //Kopf initialisieren:
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenGrunddaten");
     PageLayout::setTitle(_("Verwaltung der Grunddaten"));
     if ($this->course_id) {
         PageLayout::setTitle(Course::find($this->course_id)->getFullname() . " - " . PageLayout::getTitle());
     }
     //Daten sammeln:
     $sem = Seminar::getInstance($this->course_id);
     $data = $sem->getData();
     //Erster Reiter des Akkordions: Grundeinstellungen
     $this->attributes = array();
     $this->attributes[] = array('title' => _("Name der Veranstaltung"), 'name' => "course_name", 'must' => true, 'type' => 'text', 'value' => $data['name'], 'locked' => LockRules::Check($this->course_id, 'Name'));
     $this->attributes[] = array('title' => _("Untertitel der Veranstaltung"), 'name' => "course_subtitle", 'type' => 'text', 'value' => $data['subtitle'], 'locked' => LockRules::Check($this->course_id, 'Untertitel'));
     $sem_types = array();
     if ($perm->have_perm("admin")) {
         foreach (SemClass::getClasses() as $sc) {
             foreach ($sc->getSemTypes() as $st) {
                 if (!$sc['course_creation_forbidden']) {
                     $sem_types[$st['id']] = $st['name'] . ' (' . $sc['name'] . ')';
                 }
             }
         }
     } else {
         $sc = $sem->getSemClass();
         foreach ($sc->getSemTypes() as $st) {
             $sem_types[$st['id']] = $st['name'] . ' (' . $sc['name'] . ')';
         }
     }
     if (!isset($sem_types[$data['status']])) {
         $sem_types[$data['status']] = $sem->getSemType()->offsetGet('name');
     }
     $this->attributes[] = array('title' => _("Typ der Veranstaltung"), 'name' => "course_status", 'must' => true, 'type' => 'select', 'value' => $data['status'], 'locked' => LockRules::Check($this->course_id, 'status'), 'choices' => array_map('htmlReady', $sem_types));
     $this->attributes[] = array('title' => _("Art der Veranstaltung"), 'name' => "course_form", 'type' => 'text', 'value' => $data['form'], 'locked' => LockRules::Check($this->course_id, 'art'));
     $this->attributes[] = array('title' => _("Veranstaltungs-Nummer"), 'name' => "course_seminar_number", 'type' => 'text', 'value' => $data['seminar_number'], 'locked' => LockRules::Check($this->course_id, 'VeranstaltungsNummer'));
     $this->attributes[] = array('title' => _("ECTS-Punkte"), 'name' => "course_ects", 'type' => 'text', 'value' => $data['ects'], 'locked' => LockRules::Check($this->course_id, 'ects'));
     $this->attributes[] = array('title' => _("max. Teilnehmerzahl"), 'name' => "course_admission_turnout", 'must' => false, 'type' => 'number', 'value' => $data['admission_turnout'], 'locked' => LockRules::Check($this->course_id, 'admission_turnout'), 'min' => '0');
     $this->attributes[] = array('title' => _("Beschreibung"), 'name' => "course_description", 'type' => 'textarea', 'value' => $data['description'], 'locked' => LockRules::Check($this->course_id, 'Beschreibung'));
     //Zweiter Reiter: Institute
     $this->institutional = array();
     $institute = Institute::getMyInstitutes();
     $choices = array();
     foreach ($institute as $inst) {
         //$choices[$inst['Institut_id']] = $inst['Name'];
         $choices[$inst['Institut_id']] = ($inst['is_fak'] ? "<span style=\"font-weight: bold\">" : "&nbsp;&nbsp;&nbsp;&nbsp;") . htmlReady($inst['Name']) . ($inst['is_fak'] ? "</span>" : "");
     }
     $this->institutional[] = array('title' => _("Heimat-Einrichtung"), 'name' => "course_institut_id", 'must' => true, 'type' => 'select', 'value' => $data['institut_id'], 'choices' => $choices, 'locked' => LockRules::Check($this->course_id, 'Institut_id'));
     $institute = Institute::getInstitutes();
     $choices = array();
     foreach ($institute as $inst) {
         $choices[$inst['Institut_id']] = ($inst['is_fak'] ? "<span style=\"font-weight: bold\">" : "&nbsp;&nbsp;&nbsp;&nbsp;") . htmlReady($inst['Name']) . ($inst['is_fak'] ? "</span>" : "");
     }
     $sem_institutes = $sem->getInstitutes();
     $inst = array_flip($sem_institutes);
     unset($inst[$sem->institut_id]);
     $inst = array_flip($inst);
     $this->institutional[] = array('title' => _("beteiligte Einrichtungen"), 'name' => "related_institutes[]", 'type' => 'multiselect', 'value' => $inst, 'choices' => $choices, 'locked' => LockRules::Check($this->course_id, 'seminar_inst'));
     $this->dozent_is_locked = LockRules::Check($this->course_id, 'dozent');
     $this->tutor_is_locked = LockRules::Check($this->course_id, 'tutor');
     //Dritter Reiter: Personal
     $this->dozenten = $sem->getMembers('dozent');
     $instUsers = new SimpleCollection(InstituteMember::findByInstituteAndStatus($sem->getInstitutId(), 'dozent'));
     $this->lecturersOfInstitute = $instUsers->pluck('user_id');
     if (SeminarCategories::getByTypeId($sem->status)->only_inst_user) {
         $search_template = "user_inst_not_already_in_sem";
     } else {
         $search_template = "user_not_already_in_sem";
     }
     $this->dozentUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('dozent', 1, $sem->status)), "user_id", array('permission' => 'dozent', 'seminar_id' => $this->course_id, 'sem_perm' => 'dozent', 'institute' => $sem_institutes));
     $this->dozenten_title = get_title_for_status('dozent', 1, $sem->status);
     $this->deputies_enabled = $deputies_enabled;
     if ($this->deputies_enabled) {
         $this->deputies = getDeputies($this->course_id);
         $this->deputySearch = new PermissionSearch("user_not_already_in_sem_or_deputy", sprintf(_("%s suchen"), get_title_for_status('deputy', 1, $sem->status)), "user_id", array('permission' => getValidDeputyPerms(), 'seminar_id' => $this->course_id));
         $this->deputy_title = get_title_for_status('deputy', 1, $sem->status);
     }
     $this->tutoren = $sem->getMembers('tutor');
     $this->tutorUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('tutor', 1, $sem->status)), "user_id", array('permission' => array('dozent', 'tutor'), 'seminar_id' => $this->course_id, 'sem_perm' => array('dozent', 'tutor'), 'institute' => $sem_institutes));
     $this->tutor_title = get_title_for_status('tutor', 1, $sem->status);
     $instUsers = new SimpleCollection(InstituteMember::findByInstituteAndStatus($sem->getInstitutId(), 'tutor'));
     $this->tutorsOfInstitute = $instUsers->pluck('user_id');
     unset($instUsers);
     //Vierter Reiter: Beschreibungen (darunter Datenfelder)
     $this->descriptions[] = array('title' => _("Teilnehmde"), 'name' => "course_participants", 'type' => 'textarea', 'value' => $data['participants'], 'locked' => LockRules::Check($this->course_id, 'teilnehmer'));
     $this->descriptions[] = array('title' => _("Voraussetzungen"), 'name' => "course_requirements", 'type' => 'textarea', 'value' => $data['requirements'], 'locked' => LockRules::Check($this->course_id, 'voraussetzungen'));
     $this->descriptions[] = array('title' => _("Lernorganisation"), 'name' => "course_orga", 'type' => 'textarea', 'value' => $data['orga'], 'locked' => LockRules::Check($this->course_id, 'lernorga'));
     $this->descriptions[] = array('title' => _("Leistungsnachweis"), 'name' => "course_leistungsnachweis", 'type' => 'textarea', 'value' => $data['leistungsnachweis'], 'locked' => LockRules::Check($this->course_id, 'leistungsnachweis'));
     $this->descriptions[] = array('title' => _("Ort") . "<br><span style=\"font-size: 0.8em\"><b>" . _("Achtung:") . "&nbsp;</b>" . _("Diese Ortsangabe wird nur angezeigt, wenn keine " . "Angaben aus Zeiten oder Sitzungsterminen gemacht werden können.") . "</span>", 'name' => "course_location", 'type' => 'textarea', 'value' => $data['location'], 'locked' => LockRules::Check($this->course_id, 'Ort'));
     $datenfelder = DataFieldEntry::getDataFieldEntries($this->course_id, 'sem', $data["status"]);
     if ($datenfelder) {
         foreach ($datenfelder as $datenfeld) {
             if ($datenfeld->isVisible()) {
                 $locked = !$datenfeld->isEditable() || LockRules::Check($this->course_id, $datenfeld->getID());
                 $this->descriptions[] = array('title' => $datenfeld->getName(), 'must' => $datenfeld->isRequired(), 'name' => "datafield_" . $datenfeld->getID(), 'type' => "datafield", 'html_value' => $datenfeld->getHTML("datafields"), 'display_value' => $datenfeld->getDisplayValue(), 'locked' => $locked, 'description' => !$datenfeld->isEditable() ? "Diese Felder werden zentral durch die zuständigen Administratoren erfasst." : $datenfeld->getDescription());
             }
         }
     }
     $this->descriptions[] = array('title' => _("Sonstiges"), 'name' => "course_misc", 'type' => 'textarea', 'value' => $data['misc'], 'locked' => LockRules::Check($this->course_id, 'Sonstiges'));
     $this->perm_dozent = $perm->have_studip_perm("dozent", $this->course_id);
     $this->mkstring = $data['mkdate'] ? date("d.m.Y, G:i", $data['mkdate']) : _("unbekannt");
     $this->chstring = $data['chdate'] ? date("d.m.Y, G:i", $data['chdate']) : _("unbekannt");
     $lockdata = LockRules::getObjectRule($this->course_id);
     if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])) {
         $this->flash['msg'] = array_merge((array) $this->flash['msg'], array(array("info", formatLinks($lockdata['description']))));
     }
     $this->flash->discard();
     //schmeißt ab jetzt unnötige Variablen aus der Session.
     $sidebar = Sidebar::get();
     $sidebar->setImage("sidebar/admin-sidebar.png");
     $widget = new ActionsWidget();
     $widget->addLink(_('Bild ändern'), $this->url_for('course/avatar/update', $course_id), Icon::create('edit', 'clickable'));
     if ($this->deputies_enabled) {
         if (isDeputy($user->id, $this->course_id)) {
             $newstatus = 'dozent';
             $text = _('Lehrende werden');
         } else {
             if (in_array($user->id, array_keys($this->dozenten)) && sizeof($this->dozenten) > 1) {
                 $newstatus = 'deputy';
                 $text = _('Vertretung werden');
             }
         }
         $widget->addLink($text, $this->url_for('course/basicdata/switchdeputy', $this->course_id, $newstatus), Icon::create('persons', 'clickable'));
     }
     $sidebar->addWidget($widget);
     // Entry list for admin upwards.
     if ($perm->have_studip_perm("admin", $this->course_id)) {
         $list = new SelectorWidget();
         $list->setUrl("?#admin_top_links");
         $list->setSelectParameterName("cid");
         foreach (AdminCourseFilter::get()->getCoursesForAdminWidget() as $seminar) {
             $list->addElement(new SelectElement($seminar['Seminar_id'], $seminar['Name']), 'select-' . $seminar['Seminar_id']);
         }
         $list->setSelection($this->course_id);
         $sidebar->addWidget($list);
     }
 }