function StudipLitSearchPluginStudip() { parent::StudipLitSearchPluginAbstract(); $this->dbv = DbView::getView('literatur'); $rs = $this->dbv->get_query("view:LIT_GET_CATALOG_COUNT"); $rs->next_record(); $this->description = sprintf(_("Stud.IP Literaturkatalog. Inhalt des Kataloges: %s Einträge."), $rs->f(0)); }
public function StudipLitCatElement($catalog_id = false, $with_form = false) { $this->dbv = DbView::getView('literatur'); $this->init_form = $with_form; $this->initFields(); if ($catalog_id) { $this->getElementData($catalog_id); } }
function StudipSemTreeSearch($seminar_id, $form_name = "search_sem_tree", $auto_search = true) { $this->view = DbView::getView('sem_tree'); $this->form_name = $form_name; $this->tree = TreeAbstract::GetInstance("StudipSemTree", false); $this->seminar_id = $seminar_id; $this->view->params[0] = $seminar_id; $rs = $this->view->get_query("view:SEM_GET_INST"); while ($rs->next_record()) { $this->institut_id[] = $rs->f(0); } $this->init(); if ($auto_search) { $this->doSearch(); } }
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") . "> "; 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>"; } }
require '../lib/bootstrap.php'; page_open(array("sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User")); $perm->check(Config::get()->SEM_TREE_ADMIN_PERM ?: 'admin'); if (!$perm->is_fak_admin()) { $perm->perm_invalid(0, 0); page_close(); die; } include 'lib/seminar_open.php'; // initialise Stud.IP-Session include 'lib/msg.inc.php'; PageLayout::setTitle($UNI_NAME_CLEAN . " - " . _("Veranstaltungshierachie bearbeiten")); Navigation::activateItem('/admin/locations/sem_tree'); // Start of Output ob_start(); $view = DbView::getView('sem_tree'); $the_tree = new StudipSemTreeViewAdmin(Request::option('start_item_id')); $search_obj = new StudipSemSearch(); $_open_items =& $the_tree->open_items; $_open_ranges =& $the_tree->open_ranges; $_possible_open_items = array(); if (!Config::GetInstance()->getValue('SEM_TREE_ALLOW_BRANCH_ASSIGN')) { if (is_array($_open_items)) { foreach ($_open_items as $item_id => $value) { if (!$the_tree->tree->getNumKids($item_id)) { $_possible_open_items[$item_id] = $value; } } } } else { $_possible_open_items = $_open_items;
function StudipLitClipBoard() { $this->dbv = DbView::getView('literatur'); $this->elements =& $_SESSION["_lit_clipboard_elements"]; }
function getContent ($args) { global $_fullname_sql; $content = array(); $dbv = DbView::getView('literatur'); if (is_array($args) && isset($args['user_id'])) { $tree = TreeAbstract::GetInstance("StudipLitList", $args['user_id']); } else { preg_match(':^([a-z_-]{0,50})$:i', Request::quoted('username'), $matches); $tree = TreeAbstract::GetInstance("StudipLitList", get_userid($matches[1])); } if ($lists = $tree->getVisibleListIds()) { for ($i = 0; $i < count($lists); ++$i) { if ($this->config->getValue($this->name, 'showlastchange')) { // && ($tree->tree_data[$lists[$i]]['chdate'] > $last_modified_since) ){ $content['LITLISTS']['LITLIST'][$i]['LITLIST_CHANGE-DATE'] = strftime($this->config->getValue('Main', 'dateformat'), $tree->tree_data[$lists[$i]]['chdate']); $content['LITLISTS']['LITLIST'][$i]['LITLIST_FULLNAME'] = $tree->tree_data[$lists[$i]]['fullname']; $content['LITLISTS']['LITLIST'][$i]['LITLIST_NAME'] = $tree->tree_data[$lists[$i]]['name']; } else { $content['LITLISTS']['LITLIST'][$i]['LITLIST_NAME'] = $tree->tree_data[$lists[$i]]['name']; } if ($tree->hasKids($lists[$i])){ $dbv->params[0] = $lists[$i]; $rs = $dbv->get_query("view:LIT_LIST_GET_ELEMENTS"); $j = 0; while ($rs->next_record()){ if ( ($this->config->getValue($this->name, 'showlastchange'))) { // && ($tree->tree_data[$rs->f('list_element_id')]['chdate'] > $last_modified_since) ){ $content['LITLISTS']['LITLIST'][$i]['LITLIST_ITEM'][$j]['LITLIST_ITEM_CHANGE-DATE'] = strftime($this->config->getValue('Main', 'dateformat'), $tree->tree_data[$rs->f('list_element_id')]['chdate']); $content['LITLISTS']['LITLIST'][$i]['LITLIST_ITEM'][$j]['LITLIST_ITEM_FULLNAME'] = $tree->tree_data[$rs->f('list_element_id')]['fullname']; } $content['LITLISTS']['LITLIST'][$i]['LITLIST_ITEM'][$j]['LITLIST_ITEM_ELEMENT'] = ExternModule::ExtFormatReady($tree->getFormattedEntry($rs->f('list_element_id'), $rs->Record)); $j++; } } } } return $content; }
function getResult($level_id = null) { global $_fullname_sql, $SEM_TYPE, $SEM_CLASS; $add_fields = ''; $add_query = ''; $sem_tree_query = ''; $limit_sql = ''; $orderby_field = $this->config->getValue('Main', 'resultorderby') ? $this->config->getValue('Main', 'resultorderby') : 'VeranstaltungsNummer'; if ($this->sem_browse_data['group_by'] == 1 || sizeof($this->config->getValue('SelectSubjectAreas', 'subjectareasselected')) && !($this->config->getValue('SelectSubjectAreas', 'selectallsubjectareas') || $this->sem_browse_data['start_item_id'] == 'root')) { if ($this->config->getValue('Main', 'mode') == 'show_sem_range' && $this->sem_browse_data['start_item_id'] != 'root') { $allowed_ranges = array(); if (is_null($level_id)) { if (!is_object($this->sem_tree)) { $this->sem_tree = TreeAbstract::GetInstance('StudipSemTree'); } if ($kids = $this->sem_tree->getKidsKids($this->sem_browse_data['start_item_id'])) { $allowed_ranges = $kids; } $allowed_ranges[] = $this->sem_browse_data['start_item_id']; } else { $allowed_ranges[] = $level_id; } if ($this->config->getValue('SelectSubjectAreas', 'selectallsubjectareas')) { $sem_tree_query = " AND sem_tree_id IN('" . join("','", $allowed_ranges) . "') "; } elseif (is_array($this->config->getValue('SelectSubjectAreas', 'subjectareasselected'))) { if ($this->config->getValue('SelectSubjectAreas', 'reverseselection')) { $allowed_ranges = array_diff($allowed_ranges, $this->config->getValue('SelectSubjectAreas', 'subjectareasselected')); } else { $allowed_ranges = array_intersect($allowed_ranges, $this->config->getValue('SelectSubjectAreas', 'subjectareasselected')); } $sem_tree_query = " AND sem_tree_id IN('" . join("','", $allowed_ranges) . "') "; } else { return array(array(), array()); } } $add_fields = 'seminar_sem_tree.sem_tree_id AS bereich,'; $add_query = "LEFT JOIN seminar_sem_tree ON (seminare.Seminar_id = seminar_sem_tree.seminar_id)"; } else { if ($this->config->getValue('Main', 'maxnumberofhits')) { $limit_sql = ' ORDER BY sem_number DESC, ' . $orderby_field . ' ASC LIMIT ' . ($this->module_params['start'] ? intval($this->module_params['start']) : '0') . ',' . $this->config->getValue('Main', 'maxnumberofhits'); } } if ($this->sem_browse_data['group_by'] == 4) { $add_fields = 'Institute.Name AS Institut,Institute.Institut_id,'; $add_query = 'LEFT JOIN seminar_inst ON (seminare.Seminar_id = seminar_inst.Seminar_id) LEFT JOIN Institute ON (Institute.Institut_id = seminar_inst.institut_id)'; } // show only selected SemTypes $selected_semtypes = $this->config->getValue('ReplaceTextSemType', 'visibility'); $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 = ''; } // participated institutes (or show only courses located at this faculty) /* $sem_inst_query = ''; if (!$this->config->getValue('Main', 'allseminars')) { $tree = TreeAbstract::GetInstance('StudipRangeTree'); $kidskids = $tree->getKidsKids($this->sem_browse_data['start_item_id']); $institute_ids = array($tree->tree_data[$this->sem_browse_data['start_item_id']]['studip_object_id']); foreach ($kidskids as $kid) { $institute_ids[] = $tree->tree_data[$kid]['studip_object_id']; } $sem_inst_query = " AND seminare.Institut_id IN ('" . join("','", $institute_ids) . "')"; } */ if (!($nameformat = $this->config->getValue('Main', 'nameformat'))) { $nameformat = 'full_rev'; } $dbv = DbView::getView('sem_tree'); $query = "SELECT seminare.Seminar_id, VeranstaltungsNummer, seminare.status, seminare.Untertitel, seminare.Ort, seminare.art, seminare.Beschreibung, seminare.ects, IF(seminare.visible=0,CONCAT(seminare.Name, ' " . _("(versteckt)") . "'), seminare.Name) AS Name,\n {$add_fields}" . $_fullname_sql[$nameformat] . " AS fullname, auth_user_md5.username, title_front, title_rear, Vorname, Nachname,\n " . $dbv->sem_number_sql . " AS sem_number, " . $dbv->sem_number_end_sql . " AS sem_number_end, seminar_user.position AS position FROM seminare\n LEFT JOIN seminar_user ON (seminare.Seminar_id=seminar_user.Seminar_id AND seminar_user.status='dozent')\n LEFT JOIN auth_user_md5 USING (user_id)\n LEFT JOIN user_info USING (user_id)\n {$add_query}\n WHERE seminare.Seminar_id IN('" . join("','", array_keys($this->sem_browse_data['search_result'])) . "') {$sem_types_query} {$sem_inst_query} {$sem_tree_query} {$limit_sql}"; $db = new DB_Seminar($query); if (!$db->num_rows()) { return array(array(), array()); } $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) { $semester = SemesterData::GetSemesterArray(); $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] && 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) { $sem_number_end = count($semester) - 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) { if ($orderby_field) { $name = strtolower(key($sem_data[$seminar_id][$orderby_field])); } else { $name = strtolower(key($sem_data[$seminar_id]["VeranstaltungsNummer"])); } $name = str_replace(array('ä', 'ö', 'ü'), array('ae', 'oe', '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", false); $the_tree->buildIndex(); return (int)($the_tree->tree_data[$a]["index"] - $the_tree->tree_data[$b]["index"]); ')); break; case 3: 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; } return array($group_by_data, $sem_data); }
// along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // +---------------------------------------------------------------------------+ use Studip\Button, Studip\LinkButton; require '../lib/bootstrap.php'; page_open(array("sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User")); $perm->check('user'); include 'lib/seminar_open.php'; // initialise Stud.IP-Session require_once 'lib/visual.inc.php'; PageLayout::setHelpKeyword("Basis.SuchenEinrichtungen"); PageLayout::setTitle(_("Einrichtungssuche")); Navigation::activateItem('/search/institutes'); // Start of Output ob_start(); $view = DbView::getView('range_tree'); $the_tree = new StudipRangeTreeView(); $the_tree->open_ranges['root'] = true; if (Request::option('cmd') == "suche") { if (Request::get('search_name') && strlen(Request::get('search_name')) > 1) { $view->params[0] = "%" . Request::quoted('search_name') . "%"; $rs = $view->get_query("view:TREE_SEARCH_ITEM"); while ($rs->next_record()) { $found_items[] = htmlReady($the_tree->tree->getItemPath($rs->f("item_id"))); $the_tree->openItem($rs->f("item_id")); } } if (Request::get('search_user') && strlen(Request::get('search_user')) > 1) { $view->params[0] = "%" . Request::quoted('search_user') . "%"; $view->params[1] = "%" . Request::quoted('search_user') . "%"; $rs = $view->get_query("view:TREE_SEARCH_USER");
function GetFormattedListsByRange($range_id, $last_modified_since = false, $copy_link = true){ $ret = false; $dbv = DbView::getView('literatur'); $tree = TreeAbstract::GetInstance("StudipLitList", $range_id); if ( ($lists = $tree->getVisibleListIds()) ){ for ($i = 0; $i < count($lists); ++$i){ if ( ($tree->tree_data[$lists[$i]]['user_id'] != $GLOBALS['auth']->auth['uid']) && ($last_modified_since !== false) && ($tree->tree_data[$lists[$i]]['chdate'] > $last_modified_since) ){ $ret .= '<div align="left" style="color:red" title="' . htmlReady(sprintf(_("Letzte Änderung am %s von %s"), date('d M Y H:i',$tree->tree_data[$lists[$i]]['chdate']), $tree->tree_data[$lists[$i]]['fullname'])) . '">'; $ret .= "<b><u>" . htmlReady($tree->tree_data[$lists[$i]]['name']) . "</u></b>\n<br>\n"; $ret .= '</div>'; } else { $ret .= "\n<h3>" . htmlReady($tree->tree_data[$lists[$i]]['name']) . "</h3>"; } if ($copy_link){ $ret .= "\n<div align=\"right\" style=\"font-size:10pt\"><a href=\"".URLHelper::getLink("dispatch.php/literature/edit_list?cmd=CopyUserList&_range_id=self&user_list=".$lists[$i]."#anchor")."\">"; $ret .= Icon::create('literature+add', 'clickable')->asImg(16, ["class" => 'text-top']); $ret .= " " . _("Literaturliste kopieren") . "</a></div>"; } else { $ret .= "\n<br>\n"; } $ret .= "\n<ul>\n"; if ($tree->hasKids($lists[$i])){ $dbv->params[0] = $lists[$i]; $rs = $dbv->get_query("view:LIT_LIST_GET_ELEMENTS"); while ($rs->next_record()){ if ( ($tree->tree_data[$rs->f('list_element_id')]['user_id'] != $GLOBALS['auth']->auth['uid']) && ($last_modified_since !== false) && ($tree->tree_data[$rs->f('list_element_id')]['chdate'] > $last_modified_since) ){ $ret .= '<li style="color:red" title="' . htmlReady(sprintf(_("Letzte Änderung am %s von %s"), date('d M Y H:i',$tree->tree_data[$rs->f('list_element_id')]['chdate']), $tree->tree_data[$rs->f('list_element_id')]['fullname'])) . '">'; $ret .= formatReady($tree->getFormattedEntry($rs->f('list_element_id'), $rs->Record), false, true) . "\n<br>\n"; $ret .= '</li>'; } else { $ret .= "<li>".formatReady($tree->getFormattedEntry($rs->f('list_element_id'), $rs->Record), false, true) . "</li>"; } } } $ret .= "\n</ul><br>"; } } return $ret; }
/** * @author SL * @param Template $template * @param array $data * @return string */ public function getView(Template $template, array $data) { return \DbView::make($template)->field('html')->with($data)->render(); }
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 = " " . 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)); } }
function getSelf($param = "", $with_start_item = true){ $url_params = "foo=" . DbView::get_uniqid(); if ($this->mode) $url_params .= "&mode=" . $this->mode; if ($with_start_item) $url_params .= "&start_item_id=" . $this->start_item_id; if ($param) $url_params .= '&' . $param; return parent::getSelf($url_params); }
function get_result() { global $_fullname_sql, $SEM_TYPE, $SEM_CLASS; if ($this->sem_browse_data['group_by'] == 1) { if (!is_object($this->sem_tree)) { $the_tree = TreeAbstract::GetInstance("StudipSemTree", false); } else { $the_tree = $this->sem_tree->tree; } if ($this->sem_browse_data['start_item_id'] != 'root' && ($this->sem_browse_data['level'] == "vv" || $this->sem_browse_data['level'] == "sbb")) { $allowed_ranges = $the_tree->getKidsKids($this->sem_browse_data['start_item_id']); $allowed_ranges[] = $this->sem_browse_data['start_item_id']; $sem_tree_query = " AND sem_tree_id IN('" . join("','", $allowed_ranges) . "') "; } $add_fields = "seminar_sem_tree.sem_tree_id AS bereich,"; $add_query = "LEFT JOIN seminar_sem_tree ON (seminare.Seminar_id = seminar_sem_tree.seminar_id {$sem_tree_query})"; } else { if ($this->sem_browse_data['group_by'] == 4) { $add_fields = "Institute.Name AS Institut,Institute.Institut_id,"; $add_query = "LEFT JOIN seminar_inst ON (seminare.Seminar_id = seminar_inst.Seminar_id)\n LEFT JOIN Institute ON (Institute.Institut_id = seminar_inst.institut_id)"; } else { $add_fields = ""; $add_query = ""; } } $dbv = DbView::getView('sem_tree'); $query = "SELECT seminare.Seminar_id,VeranstaltungsNummer, seminare.status, IF(seminare.visible=0,CONCAT(seminare.Name, ' " . _("(versteckt)") . "'), seminare.Name) AS Name,\n {$add_fields}" . $_fullname_sql['full'] . " AS fullname, auth_user_md5.username,\n " . $dbv->sem_number_sql . " AS sem_number, " . $dbv->sem_number_end_sql . " AS sem_number_end, seminar_user.position AS position FROM seminare\n LEFT JOIN seminar_user ON (seminare.Seminar_id=seminar_user.Seminar_id AND seminar_user.status='dozent')\n LEFT JOIN auth_user_md5 USING (user_id)\n LEFT JOIN user_info USING (user_id)\n {$add_query}\n WHERE seminare.Seminar_id IN('" . join("','", array_keys($this->sem_browse_data['search_result'])) . "')"; $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] && count($detail['sem_number']) == 1)) { continue; } else { $current_semester_index = SemesterData::GetInstance()->GetSemesterIndexById(Semester::findCurrent()->semester_id); foreach ($detail['Seminar_id'] as $seminar_id => $foo) { $start_sem = key($sem_data[$seminar_id]["sem_number"]); if ($sem_number_end == -1) { if ($this->sem_number === false) { $sem_number_end = $current_semester_index && isset($this->search_obj->sem_dates[$current_semester_index + 1]) ? $current_semester_index + 1 : count($this->search_obj->sem_dates) - 1; } else { $sem_number_end = $this->sem_number[0]; } } 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); if (Config::get()->IMPORTANT_SEMNUMBER && key($sem_data[$seminar_id]['VeranstaltungsNummer'])) { $name = key($sem_data[$seminar_id]['VeranstaltungsNummer']) . ' ' . $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", false); $the_tree->buildIndex(); return (int)($the_tree->tree_data[$a]["index"] - $the_tree->tree_data[$b]["index"]); ')); break; case 3: 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; } return array($group_by_data, $sem_data); }
PageLayout::setTitle(_('Evaluations-Auswertung')); PageLayout::setHelpKeyword('Basis.Evaluationen'); Navigation::activateItem('/tools/evaluation'); // Extract variables from request $eval_id = Request::option('eval_id'); $template_id = Request::option('template_id'); // Überprüfen, ob die Evaluation existiert oder der Benutzer genügend Rechte hat $eval = new Evaluation($eval_id); $eval->check(); if (EvaluationObjectDB::getEvalUserRangesWithNoPermission($eval) == YES || count($eval->errorArray) > 0) { throw new Exception(_("Diese Evaluation ist nicht vorhanden oder Sie haben nicht ausreichend Rechte!")); } // Store settings if (Request::submitted('store')) { if (!$template_id) { $template_id = DbView::get_uniqid(); $query = "INSERT INTO eval_templates_eval (eval_id, template_id)\n VALUES (?, ?)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($eval_id, $template_id)); } $show_questions = Request::int('show_questions'); $show_total_stats = Request::int('show_total_stats'); $show_graphics = Request::int('show_graphics'); $show_questionblock_headline = Request::int('show_questionblock_headline'); $show_group_headline = Request::int('show_group_headline'); $polscale_gfx_type = Request::option('polscale_gfx_type'); $likertscale_gfx_type = Request::option('likertscale_gfx_type'); $mchoice_scale_gfx_type = Request::option('mchoice_scale_gfx_type'); $query = "INSERT INTO eval_templates\n (template_id, user_id, name,\n show_questions, show_total_stats, show_graphics,\n show_questionblock_headline, show_group_headline,\n polscale_gfx_type, likertscale_gfx_type, mchoice_scale_gfx_type)\n VALUES (?, ?, 'nix', ?, ?, ?, ?, ?, ?, ?, ?)\n ON DUPLICATE KEY UPDATE show_questions = VALUES(show_questions),\n show_total_stats = VALUES(show_total_stats),\n show_graphics = VALUES(show_graphics),\n show_questionblock_headline = VALUES(show_questionblock_headline),\n show_group_headline = VALUES(show_group_headline),\n polscale_gfx_type = VALUES(polscale_gfx_type),\n likertscale_gfx_type = VALUES(likertscale_gfx_type),\n mchoice_scale_gfx_type = VALUES(mchoice_scale_gfx_type)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($template_id, $GLOBALS['user']->id, $show_questions, $show_total_stats, $show_graphics, $show_questionblock_headline, $show_group_headline, $polscale_gfx_type, $likertscale_gfx_type, $mchoice_scale_gfx_type));
/** * Display the notification settings of a user. */ public function index_action() { $group_field = UserConfig::get($this->user->user_id)->MY_COURSES_GROUPING ?: 'not_grouped'; $add_fields = $add_query = ''; if ($group_field == 'sem_tree_id') { $add_fields = ',sem_tree_id'; $add_query = "LEFT JOIN seminar_sem_tree sst ON (sst.seminar_id=seminare.Seminar_id)"; } else { if ($group_field == 'dozent_id') { $add_fields = ', su1.user_id as dozent_id'; $add_query = "LEFT JOIN seminar_user as su1 ON (su1.seminar_id=seminare.Seminar_id AND su1.status='dozent')"; } } $dbv = DbView::getView('sem_tree'); $query = "SELECT seminare.VeranstaltungsNummer AS sem_nr, seminare.Name, seminare.Seminar_id,\n seminare.status AS sem_status, seminar_user.gruppe, seminare.visible,\n {$dbv->sem_number_sql} AS sem_number, {$dbv->sem_number_end_sql} AS sem_number_end\n {$add_fields}\n FROM seminar_user\n LEFT JOIN seminare USING (Seminar_id)\n {$add_query}\n WHERE seminar_user.user_id = ?"; if (get_config('DEPUTIES_ENABLE')) { $query .= " UNION " . getMyDeputySeminarsQuery('notification', $dbv->sem_number_sql, $dbv->sem_number_end_sql, $add_fields, $add_query); } $query .= " ORDER BY sem_nr ASC"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->user->user_id)); $seminars = $statement->fetchAll(PDO::FETCH_ASSOC); if (!count($seminars)) { $message = sprintf(_('Sie haben zur Zeit keine Veranstaltungen belegt. Bitte nutzen Sie %s<b>Veranstaltung suchen / hinzufügen</b>%s um sch für Veranstaltungen anzumdelden.'), '<a href="' . URLHelper::getLink('dispatch.php/search/courses') . '">', '</a>'); PageLayout::postMessage(MessageBox::info($message)); $this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox')); $this->render_nothing(); return; } $modules = new ModulesNotification(); $enabled_modules = $modules->getGlobalEnabledNotificationModules('sem'); $groups = array(); $my_sem = array(); foreach ($seminars as $seminar) { $my_sem[$seminar['Seminar_id']] = array('obj_type' => "sem", 'sem_nr' => $seminar['sem_nr'], 'name' => $seminar['Name'], 'visible' => $seminar['visible'], 'gruppe' => $seminar['gruppe'], 'sem_status' => $seminar['sem_status'], 'sem_number' => $seminar['sem_number'], 'sem_number_end' => $seminar['sem_number_end']); if ($group_field) { fill_groups($groups, $seminar[$group_field], array('seminar_id' => $seminar['Seminar_id'], 'sem_nr' => $seminar['sem_nr'], 'name' => $seminar['Name'], 'gruppe' => $seminar['gruppe'])); } } if ($group_field == 'sem_number') { correct_group_sem_number($groups, $my_sem); } else { add_sem_name($my_sem); } sort_groups($group_field, $groups); $group_names = get_group_names($group_field, $groups); $notifications = $modules->getModuleNotification(); $open = UserConfig::get($this->user->user_id)->MY_COURSES_OPEN_GROUPS; $checked = array(); foreach ($groups as $group_id => $group_members) { if ($group_id !== 'not_grouped' && !isset($open[$group_id])) { continue; } foreach ($group_members as $member) { $checked[$member['seminar_id']] = array(); foreach (array_values($enabled_modules) as $index => $m_data) { $checked[$member['seminar_id']][$index] = $modules->isBit($notifications[$member['seminar_id']], $m_data['id']); } $checked[$member['seminar_id']]['all'] = count($enabled_modules) === count(array_filter($checked[$member['seminar_id']])); } } $this->modules = $enabled_modules; $this->groups = $groups; $this->group_names = $group_names; $this->group_field = $group_field; $this->open = $open; $this->seminars = $my_sem; $this->notifications = $modules->getModuleNotification(); $this->checked = $checked; }
public function getPreview($template, $type = null) { $tmpl = Template::find($template)->first(); if (!is_null($type) && $type != 'pdf') { $content = DbView::make($tmpl)->field('body')->render(); return $content; } else { //return PDF::loadView('print.brochure',array('prop'=>$prop)) // ->stream('download.pdf'); $tmpl = $tmpl->toArray(); return PDF::loadView('brochuretmpl.' . $template, array('prop' => $prop, 'contact' => $contact, 'roi3' => $roi3, 'roi5' => $roi5))->setOption('margin-top', $tmpl['margin-top'])->setOption('margin-left', $tmpl['margin-left'])->setOption('margin-right', $tmpl['margin-right'])->setOption('margin-bottom', $tmpl['margin-bottom'])->setOption('dpi', $tmpl['dpi'])->setPaper($tmpl['paper-size'])->stream($prop['propertyId'] . '.pdf'); //return PDF::html('print.brochure',array('prop' => $prop), 'download.pdf'); } }
function getSelf($param = false) { $url_params = "foo=" . DbView::get_uniqid(); if ($this->mode) { $url_params .= "&mode=" . $this->mode; } if ($param) { $url_params .= '&' . $param; } return parent::getSelf($url_params); }
function getContent () { global $SEM_TYPE, $SEM_CLASS, $sem_type_tmp; if (is_array($this->sem_browse_data['search_result']) && count($this->sem_browse_data['search_result'])) { // show only selected subject areas $selected_ranges = (array) $this->module->config->getValue('SelectSubjectAreas', 'subjectareasselected'); $selected_ranges[] = $this->sem_browse_data['start_item_id']; 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'); $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((array) $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")){ $sem_inst_query = " AND seminare.Institut_id='{$this->module->config->range_id}' "; } 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, " . $GLOBALS['_fullname_sql'][$nameformat] ." AS fullname, auth_user_md5.username, Vorname, Nachname, title_front, title_rear, " . $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; } } } 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", false); 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 ((array) $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"); $content['__GLOBAL__']['LECTURES-COUNT'] = count($sem_data); $group_by_name = $this->module->config->getValue("Main", "aliasesgrouping"); $content['__GLOBAL__']['LECTURES-SUBSTITUTE-GROUPED-BY'] = $group_by_name[$this->sem_browse_data['group_by']]; $i = 0; foreach ((array) $group_by_data as $group_field => $sem_ids) { $content['LECTURES']['GROUP'][$i]['GROUP'] = $this->getGroupContent($the_tree, $group_field); $content['LECTURES']['GROUP'][$i]['GROUP-NO'] = $i + 1; if (is_array($sem_ids['Seminar_id'])) { $zebra = 0; $j = 0; while (list($seminar_id,) = each($sem_ids['Seminar_id'])) { // $sem_name = key($sem_data[$seminar_id]["Name"]); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['TITLE'] = ExternModule::ExtHtmlReady(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']); $sem_semester = $this->sem_dates[$sem_number_start]['name']; if ($sem_number_start != $sem_number_end){ $sem_semester .= ' - ' . ($sem_number_end == -1 ? _("unbegrenzt") : $this->sem_dates[$sem_number_end]['name']); } $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['SEMESTER'] = $sem_semester; // create turnus field $sem_turnus = Seminar::getInstance($seminar_id)->getDatesExport(array('show_room' => true)); // shorten, if string too long if (strlen($sem_turnus) > 70) { $sem_turnus = substr($sem_turnus, 0, strpos(substr($sem_turnus, 70, strlen($sem_turnus)), ",") +71); $sem_turnus .= "..."; } $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['CYCLE'] = ExternModule::ExtHtmlReady($sem_turnus); $doz_name = array_keys($sem_data[$seminar_id]['fullname']); $doz_lastname = array_keys($sem_data[$seminar_id]['Nachname']); $doz_firstname = array_keys($sem_data[$seminar_id]['Vorname']); $doz_titlefront = array_keys($sem_data[$seminar_id]['title_front']); $doz_titlerear = array_keys($sem_data[$seminar_id]['title_rear']); $doz_uname = array_keys($sem_data[$seminar_id]['username']); $doz_position = array_keys($sem_data[$seminar_id]['position']); if (sizeof($doz_position) < $doz_name) $doz_position = array_fill(0, sizeof($doz_name), 0); if (is_array($doz_name)){ array_multisort($doz_position, $doz_name, $doz_uname); $k = 0; foreach ($doz_name as $index => $value) { $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['PERSONDETAIL-HREF'] = $this->module->elements['LinkInternPersondetails']->createUrl(array('link_args' => 'username='******'LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['FULLNAME'] = ExternModule::ExtHtmlReady($doz_name[$index]); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['LASTNAME'] = ExternModule::ExtHtmlReady($doz_lastname[$index]); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['FIRSTNAME'] = ExternModule::ExtHtmlReady($doz_firstname[$index]); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['TITLEFRONT'] = ExternModule::ExtHtmlReady($doz_titlefront[$index]); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['TITLEREAR'] = ExternModule::ExtHtmlReady($doz_titlerear[$index]); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['UNAME'] = $doz_uname[$index]; $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTURERS'][$k]['LECTURER-NO'] = $k + 1; $k++; } } $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['LECTUREDETAILS-HREF'] = $this->module->elements['LinkInternLecturedetails']->createUrl(array('link_args' => 'seminar_id=' . $seminar_id)); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['NUMBER'] = ExternModule::ExtHtmlReady(key($sem_data[$seminar_id]['VeranstaltungsNummer'])); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['SUBTITLE'] = ExternModule::ExtHtmlReady(key($sem_data[$seminar_id]['Untertitel'])); $aliases_sem_type = $this->module->config->getValue('ReplaceTextSemType', 'class_' . $SEM_TYPE[key($sem_data[$seminar_id]['status'])]['class']); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['SEMTYPE-SUBSTITUTE'] = $aliases_sem_type[$this->sem_types_position[key($sem_data[$seminar_id]['status'])] - 1]; $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['SEMTYPE'] = ExternModule::ExtHtmlReady($SEM_TYPE[key($sem_data[$seminar_id]['status'])]['name'] .' ('. $SEM_CLASS[$SEM_TYPE[key($sem_data[$seminar_id]['status'])]['class']]['name'] . ')'); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['ROOM'] = ExternModule::ExtHtmlReady(Seminar::getInstance($seminar_id)->getDatesTemplate('dates/seminar_export_location')); $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['FORM'] = ExternModule::ExtHtmlReady(key($sem_data[$seminar_id]['art'])); // generic data fields if (is_array($generic_datafields)) { $localEntries = DataFieldEntry::getDataFieldEntries($seminar_id, 'sem'); #$datafields = $datafields_obj->getLocalFields($seminar_id); $l = 1; foreach ($generic_datafields as $datafield) { if (isset($localEntries[$datafield]) && is_object($localEntries[$datafield])) { $localEntry = $localEntries[$datafield]->getDisplayValue(); if ($localEntry) { $content['LECTURES']['GROUP'][$i]['LECTURE'][$j]['DATAFIELD_' . $l] = $localEntry; } } $l++; } } $j++; } } $i++; } } else { $content['__GLOBAL__']['LECTURES-COUNT'] = 0; $group_by_name = $this->module->config->getValue('Main', 'aliasesgrouping'); $content['__GLOBAL__']['LECTURES-SUBSTITUTE-GROUPED-BY'] = $group_by_name[$this->sem_browse_data['group_by']]; $content['LECTURES']['NO-LECTURES']['NO-LECTURES-TEXT'] = ExternModule::ExtHtmlReady($this->module->config->getValue('Main', 'nodatatext')); } return $content; }
function Get_union() { $queries = func_get_args(); $view = new DbView(); $union_table = $view->get_temp_table($view->get_parsed_query($queries[0])); if ($queries[1]) { for ($i = 1; $i < count($queries); ++$i) { $view->db->query("REPLACE INTO {$union_table} " . $view->get_parsed_query($queries[$i])); } } return $union_table; }
/** * Seminar group administration - cluster your seminars by colors or * change grouping mechanism */ public function groups_action($sem = null, $studygroups = false) { if ($GLOBALS['perm']->have_perm('admin')) { throw new AccessDeniedException(); } $this->title = _('Meine Veranstaltungen') . ' - ' . _('Farbgruppierungen'); if (Request::isXhr()) { $this->set_layout(null); $this->response->add_header('Content-Type', 'text/html;charset=Windows-1252'); header('X-Title: ' . $this->title); } else { PageLayout::setTitle($this->title); PageLayout::setHelpKeyword('Basis.VeranstaltungenOrdnen'); Navigation::activateItem('/browse/my_courses/list'); } $this->current_semester = $sem ?: Semester::findCurrent()->semester_id; $this->semesters = SemesterData::GetSemesterArray(); $forced_grouping = Config::get()->MY_COURSES_FORCE_GROUPING; if ($forced_grouping == 'not_grouped') { $forced_grouping = 'sem_number'; } $no_grouping_allowed = $forced_grouping == 'sem_number' || !in_array($forced_grouping, getValidGroupingFields()); $group_field = $GLOBALS['user']->cfg->MY_COURSES_GROUPING ?: $forced_grouping; $groups = array(); $add_fields = ''; $add_query = ''; if ($group_field == 'sem_tree_id') { $add_fields = ', sem_tree_id'; $add_query = "LEFT JOIN seminar_sem_tree sst ON (sst.seminar_id=seminare.Seminar_id)"; } else { if ($group_field == 'dozent_id') { $add_fields = ', su1.user_id as dozent_id'; $add_query = "LEFT JOIN seminar_user as su1 ON (su1.seminar_id=seminare.Seminar_id AND su1.status='dozent')"; } } $dbv = DbView::getView('sem_tree'); $query = "SELECT seminare.VeranstaltungsNummer AS sem_nr, seminare.Name, seminare.Seminar_id,\n seminare.status AS sem_status, seminar_user.gruppe, seminare.visible,\n {$dbv->sem_number_sql} AS sem_number,\n {$dbv->sem_number_end_sql} AS sem_number_end {$add_fields}\n FROM seminar_user\n JOIN semester_data sd\n LEFT JOIN seminare USING (Seminar_id)\n {$add_query}\n WHERE seminar_user.user_id = ?"; if (Config::get()->MY_COURSES_ENABLE_STUDYGROUPS && !$studygroups) { $query .= " AND seminare.status != 99"; } if ($studygroups) { $query .= " AND seminare.status = 99"; } if (get_config('DEPUTIES_ENABLE')) { $query .= " UNION " . getMyDeputySeminarsQuery('gruppe', $dbv->sem_number_sql, $dbv->sem_number_end_sql, $add_fields, $add_query); } $query .= " ORDER BY sem_nr ASC"; $statement = DBManager::get()->prepare($query); $statement->execute(array($GLOBALS['user']->id)); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $my_sem[$row['Seminar_id']] = array('obj_type' => 'sem', 'sem_nr' => $row['sem_nr'], 'name' => $row['Name'], 'visible' => $row['visible'], 'gruppe' => $row['gruppe'], 'sem_status' => $row['sem_status'], 'sem_number' => $row['sem_number'], 'sem_number_end' => $row['sem_number_end']); if ($group_field) { fill_groups($groups, $row[$group_field], array('seminar_id' => $row['Seminar_id'], 'sem_nr' => $row['sem_nr'], 'name' => $row['Name'], 'gruppe' => $row['gruppe'])); } } if ($group_field == 'sem_number') { correct_group_sem_number($groups, $my_sem); } else { add_sem_name($my_sem); } sort_groups($group_field, $groups); // Ensure that a seminar is never in multiple groups $sem_ids = array(); foreach ($groups as $group_id => $seminars) { foreach ($seminars as $index => $seminar) { if (in_array($seminar['seminar_id'], $sem_ids)) { unset($seminars[$index]); } else { $sem_ids[] = $seminar['seminar_id']; } } if (empty($seminars)) { unset($groups[$group_id]); } else { $groups[$group_id] = $seminars; } } $this->studygroups = $studygroups; $this->no_grouping_allowed = $no_grouping_allowed; $this->groups = $groups; $this->group_names = get_group_names($group_field, $groups); $this->group_field = $group_field; $this->my_sem = $my_sem; }
function fetchNumStaff() { $view = DbView::getView('range_tree'); if (!($view->params[0] = $this->item_data['studip_object_id'])) { $view->params[0] = $this->tree_item_id; } $rs = $view->get_query("view:STATUS_COUNT"); if ($rs->next_record()) { $this->item_data['num_staff'] = $rs->f(0); return true; } return false; }
public function getPrint($session_id) { $trx = Transaction::where('sessionId', $session_id)->get()->toArray(); $pay = Payment::where('sessionId', $session_id)->get()->toArray(); $tab = array(); foreach ($trx as $t) { $tab[$t['SKU']]['description'] = $t['productDetail']['itemDescription']; $tab[$t['SKU']]['qty'] = isset($tab[$t['SKU']]['qty']) ? $tab[$t['SKU']]['qty'] + 1 : 1; $tab[$t['SKU']]['tagprice'] = $t['productDetail']['priceRegular']; $tab[$t['SKU']]['total'] = isset($tab[$t['SKU']]['total']) ? $tab[$t['SKU']]['total'] + $t['productDetail']['priceRegular'] : $t['productDetail']['priceRegular']; } $tab_data = array(); $gt = 0; foreach ($tab as $k => $v) { $tab_data[] = array(array('value' => $v['description'], 'attr' => 'class="left"'), array('value' => $v['qty'], 'attr' => 'class="center"'), array('value' => Ks::idr($v['tagprice']), 'attr' => 'class="right"'), array('value' => Ks::idr($v['total']), 'attr' => 'class="right"')); $gt += $v['tagprice']; } $tab_data[] = array('', '', '', Ks::idr($gt)); $header = array('things to buy', 'unit', 'tagprice', array('value' => 'price to pay', 'attr' => 'style="text-align:right"')); $attr = array('class' => 'table', 'id' => 'transTab', 'style' => 'width:100%;', 'border' => '0'); $t = new HtmlTable($tab_data, $attr, $header); $tr_tab = $t->build(); $viewmodel = Template::where('type', 'invoice')->where('status', 'active')->first(); return DbView::make($viewmodel)->field('body')->with('transtab', $tr_tab)->with('trx', $trx)->with('pay', $pay); }
public function block($slug = false, $field = 'content', $variables = array(), $force_compile = true) { if (!$slug || !@count($this->blocks) || !@is_object($this->blocks[$slug])) { return false; } #Helper::tad($this); $block = null; $content_container = false; if (isset($this->blocks[$slug]->metas[Config::get('app.locale')])) { $content_container = $this->blocks[$slug]->metas[Config::get('app.locale')]; $block = $this->blocks[$slug]; } elseif (isset($this->blocks[$slug]->content)) { $content_container = $this->blocks[$slug]; } elseif (isset($this->blocks[$slug]->meta) && !is_null($this->blocks[$slug]->meta)) { $content_container = $this->blocks[$slug]->meta; } if (!$content_container) { return ''; } #dd($content_container); #Helper::dd($this->blocks[$slug]->meta->content); ## Without blade syntax compile #return $this->blocks[$slug]->meta->content; ## Force template compile if ($force_compile) { $content_container->updated_at = date('Y-m-d H:i:s'); } ## Without updated_at - COMPILE ONLY ONCE! #unset($this->blocks[$slug]->meta->updated_at); #Helper::ta($content_container); #Helper::ta($block); if (isset($block) && is_object($block) && isset($block->template)) { if ($block->template == '') { ## Return compiled field of the model return DbView::make($content_container)->field($field)->with($variables)->render(); } else { if (View::exists(Helper::layout('blocks.' . $block->template))) { $content = json_decode($content_container->content, true); $content_container->content = $content; #Helper::ta($content); #dd(extract($content)); return View::make(Helper::layout('blocks.' . $block->template), $content); } } } return null; }
function GetPreferredPlugin() { $dbv = DbView::getView('literatur'); $dbv->params[0] = $GLOBALS['user']->id; $rs = $dbv->get_query("view:LIT_GET_FAK_LIT_PLUGIN"); $rs->next_record(); return $rs->f('lit_plugin_name'); }
function initSubfolders($parent_id){ $view = DbView::getView('core'); $view->params[0] = $parent_id; $db = $view->get_query("view:FOLDER_GET_DATA_BY_RANGE"); $p = 0; while($db->next_record()){ //$this->tree_data[$db->f("folder_id")] = $db->Record; $this->tree_data[$db->f("folder_id")]["entries"] = 0; $this->tree_data[$db->f("folder_id")]["permission"] = $db->f('permission'); $this->storeItem($db->f("folder_id"), $parent_id, $db->f('name'), $p++); $this->initSubfolders($db->f("folder_id")); } }
public function doSearch() { if (!count($this->params)) { return false; } $this->params = array_map('mysql_escape_string', $this->params); $clause = ""; $and_clause = ""; $this->search_result = new DbSnapshot(); $combination = $this->params['combination']; $view = DbView::getView('sem_tree'); if (isset($this->params['sem']) && $this->params['sem'] != 'all') { $sem_number = (int) $this->params['sem']; $clause = " HAVING (sem_number <= {$sem_number} AND (sem_number_end >= {$sem_number} OR sem_number_end = -1)) "; } if (isset($this->params['category']) && $this->params['category'] != 'all') { foreach ($GLOBALS['SEM_TYPE'] as $type_key => $type_value) { if ($type_value['class'] == $this->params['category']) { $sem_types[] = $type_key; } } } if (isset($this->params['type']) && $this->params['type'] != 'all') { unset($sem_types); $sem_types[0] = $this->params['type']; } if (is_array($sem_types)) { $clause = " AND c.status IN('" . join("','", $sem_types) . "') " . $clause; } if ($this->params['scope_choose'] && $this->params['scope_choose'] != 'root') { $sem_tree = TreeAbstract::GetInstance("StudipSemTree", false); $view->params[0] = is_array($sem_types) ? $sem_types : $sem_tree->sem_status; $view->params[1] = $this->visible_only ? "c.visible=1" : "1"; $view->params[2] = $sem_tree->getKidsKids($this->params['scope_choose']); $view->params[2][] = $this->params['scope_choose']; $view->params[3] = $clause; $snap = new DbSnapshot($view->get_query("view:SEM_TREE_GET_SEMIDS")); if ($snap->numRows) { $clause = " AND c.seminar_id IN('" . join("','", $snap->getRows("seminar_id")) . "')" . $clause; } else { return 0; } unset($snap); } if ($this->params['range_choose'] && $this->params['range_choose'] != 'root') { $range_object = RangeTreeObject::GetInstance($this->params['range_choose']); $view->params[0] = $range_object->getAllObjectKids(); $view->params[0][] = $range_object->item_data['studip_object_id']; $view->params[1] = $this->visible_only ? " AND c.visible=1 " : ""; $view->params[2] = $clause; $snap = new DbSnapshot($view->get_query("view:SEM_INST_GET_SEM")); if ($snap->numRows) { $clause = " AND c.seminar_id IN('" . join("','", $snap->getRows("Seminar_id")) . "')" . $clause; } else { return 0; } unset($snap); } if (isset($this->params['lecturer']) && strlen($this->params['lecturer']) > 2) { $view->params[0] = "%" . trim($this->params['lecturer']) . "%"; $view->params[1] = "%" . trim($this->params['lecturer']) . "%"; $view->params[2] = "%" . trim($this->params['lecturer']) . "%"; $view->params[3] = "%" . trim($this->params['lecturer']) . "%"; $view->params[4] = "%" . trim($this->params['lecturer']) . "%"; $result = $view->get_query("view:SEM_SEARCH_LECTURER"); $lecturers = array(); while ($result->next_record()) { $lecturers[] = $result->f('user_id'); } if (count($lecturers)) { $view->params[0] = $this->visible_only ? "c.visible=1" : "1"; $view->params[1] = $lecturers; $view->params[2] = $clause; $snap = new DbSnapshot($view->get_query("view:SEM_SEARCH_LECTURER_ID")); $this->search_result = $snap; $this->found_rows = $this->search_result->numRows; } } if ($combination == "AND" && $this->search_result->numRows) { $and_clause = " AND c.seminar_id IN('" . join("','", $this->search_result->getRows("seminar_id")) . "')"; } if (isset($this->params['title']) && strlen($this->params['title']) > 2 || isset($this->params['sub_title']) && strlen($this->params['sub_title']) > 2 || isset($this->params['number']) && strlen($this->params['number']) > 2 || isset($this->params['comment']) && strlen($this->params['comment']) > 2) { $toFilter = explode(" ", $this->params['title']); $search_for = "(Name LIKE '%" . implode("%' AND Name LIKE '%", $toFilter) . "%')"; $view->params[0] .= $this->params['title'] ? $search_for . " " : " "; $view->params[0] .= $this->params['title'] && $this->params['sub_title'] ? $combination : " "; $view->params[0] .= $this->params['sub_title'] ? " Untertitel LIKE '%" . trim($this->params['sub_title']) . "%' " : " "; $view->params[0] .= ($this->params['title'] || $this->params['sub_title']) && $this->params['comment'] ? $combination : " "; $view->params[0] .= $this->params['comment'] ? " Beschreibung LIKE '%" . trim($this->params['comment']) . "%' " : " "; $view->params[0] .= ($this->params['title'] || $this->params['sub_title'] || $this->params['comment']) && $this->params['number'] ? $combination : " "; $view->params[0] .= $this->params['number'] ? " VeranstaltungsNummer LIKE '%" . trim($this->params['number']) . "%' " : " "; $view->params[0] = ($this->visible_only ? " c.visible=1 AND " : "") . "(" . $view->params[0] . ")"; $view->params[1] = $and_clause . $clause; $snap = new DbSnapshot($view->get_query("view:SEM_SEARCH_SEM")); if ($this->found_rows === false) { $this->search_result = $snap; } else { $this->search_result->mergeSnapshot($snap, "seminar_id", $combination); } $this->found_rows = $this->search_result->numRows; } if ($combination == "AND" && $this->search_result->numRows) { $and_clause = " AND c.seminar_id IN('" . join("','", $this->search_result->getRows("seminar_id")) . "')"; } if (isset($this->params['scope']) && strlen($this->params['scope']) > 2) { $view->params[0] = $this->visible_only ? "c.visible=1" : "1"; $view->params[1] = "%" . trim($this->params['scope']) . "%"; $view->params[2] = $and_clause . $clause; $snap = new DbSnapshot($view->get_query("view:SEM_TREE_SEARCH_SEM")); if ($this->found_rows === false) { $this->search_result = $snap; } else { $this->search_result->mergeSnapshot($snap, "seminar_id", $combination); } $this->found_rows = $this->search_result->numRows; } return $this->found_rows; }
/** * return all sem_tree-entries for the passed seminar * * @param string $seminar_id the seminar * * @return array a list of sem_tree_id's */ function get_seminar_sem_tree_entries($seminar_id) { $view = DbView::getView('sem_tree'); $ret = null; $view->params[0] = $seminar_id; $rs = $view->get_query("view:SEMINAR_SEM_TREE_GET_IDS"); while ($rs->next_record()) { $ret[] = $rs->f('sem_tree_id'); } return $ret; }
private function getContentListInstitutes () { $selected_item_ids = $this->config->getValue('SelectInstitutes', 'institutesselected'); // at least one institute has to be selected in the configuration if (!is_array($selected_item_ids)) { return array(); } $content = array(); $first_levels = $this->range_tree->getKids('root'); // var_dump($first_levels); $current_semester = get_sem_num(time()); $db_count = new DB_Seminar(); $dbv = DbView::getView('sem_tree'); $mrks = str_repeat('?,', count($selected_item_ids) - 1) . '?'; $query = "SELECT Institut_id, Name " . "FROM Institute " . "WHERE Institut_id IN ($mrks) " . "AND fakultaets_id != Institut_id " . "ORDER BY Name ASC"; $parameters = $selected_item_ids; $statement = DBManager::get()->prepare($query); $statement->execute($parameters); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { if ($this->config->getValue('Main', 'onlylecturers')) { // get only users with status dozent in an visible seminar in the current semester $query = sprintf("SELECT COUNT(DISTINCT(su.user_id)) AS count_user " . "FROM user_inst ui " . "LEFT JOIN seminar_user su USING(user_id) " . "LEFT JOIN seminare s USING (seminar_id) " . "LEFT JOIN auth_user_md5 aum ON su.user_id = aum.user_id " . "WHERE ui.Institut_id = '%s' " . "AND su.status = 'dozent' " . "AND ui.externdefault = 1 " . "AND " . get_ext_vis_query() . "AND ui.inst_perms = 'dozent' " . "AND ((%s) = %s OR ((%s) <= %s AND ((%s) >= %s OR (%s) = -1)))", $row['Institut_id'], $dbv->sem_number_sql, $current_semester, $dbv->sem_number_sql, $current_semester, $dbv->sem_number_end_sql, $current_semester, $dbv->sem_number_end_sql); } else { // get only users with the given status $query = sprintf("SELECT COUNT(DISTINCT(ui.user_id)) AS count_user " . "FROM user_inst ui " . "WHERE ui.Institut_id = '%s' " . "AND ui.inst_perms IN('%s') " . "AND ui.externdefault = 1" . "AND " . get_ext_vis_query(), $row['Institut_id'], implode("','", $this->config->getValue('Main', 'instperms'))); } $state = DBManager::get()->prepare($query); $state->execute($parameters); while ($row_count = $state->fetch(PDO::FETCH_ASSOC)) { if ($row_count['count_user'] > 0) { $content['LIST_INSTITUTES']['INSTITUTE'][] = array( 'INSTITUTE_NAME' => ExternModule::ExtHtmlReady($row['Name']), 'INSTITUTE_COUNT_USER' => $row_count['count_user'], 'URL_LIST_PERSONS' => $this->getLinkToModule('LinkInternListInstitutes', array('item_id' => $row['Institut_id']))); } } } return $content; }
/** * @param $course_id * @return array */ public static function getSemTree($course_id, $depth = false) { $the_tree = TreeAbstract::GetInstance("StudipSemTree"); $view = DbView::getView('sem_tree'); $ret = null; $view->params[0] = $course_id; $rs = $view->get_query("view:SEMINAR_SEM_TREE_GET_IDS"); while ($rs->next_record()) { $ret[$rs->f('sem_tree_id')]['name'] = $the_tree->getShortPath($rs->f('sem_tree_id'), null, ">", $depth ? $depth - 1 : 0); $ret[$rs->f('sem_tree_id')]['info'] = $the_tree->getValue($rs->f('sem_tree_id'), 'info'); } return $ret; }