/** * */ function ExternModuleLecturedetails ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->data_fields = array('subtitle', 'lecturer', 'art', 'status', 'description', 'location', 'semester', 'time', 'number', 'teilnehmer', 'requirements', 'lernorga', 'leistung', 'range_path', 'misc', 'ects'); $this->registered_elements = array( 'ReplaceTextSemType', 'Body', 'TableHeader', 'SemName' => 'TableParagraphText', 'Headline' => 'TableParagraphText', 'Content' => 'TableParagraphText', 'LinkInternSimple' => 'LinkIntern', 'StudipInfo', 'StudipLink'); $this->args = array('seminar_id'); $this->field_names = array( _("Untertitel"), _("Lehrende"), _("Veranstaltungsart"), _("Veranstaltungstyp"), _("Beschreibung"), _("Ort"), _("Semester"), _("Zeiten"), _("Veranstaltungsnummer"), _("Teilnehmende"), _("Voraussetzungen"), _("Lernorganisation"), _("Leistungsnachweis"), _("Bereichseinordnung"), _("Sonstiges"), _("ECTS-Punkte")); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function ExternModuleLecturestable ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->data_fields = array('VeranstaltungsNummer', 'Name', 'Untertitel', 'status', 'Ort', 'art', 'zeiten', 'dozent'); $this->registered_elements = array( 'ReplaceTextSemType', 'SelectSubjectAreas', 'Body', 'TableHeader', 'InfoCountSem' => 'TableGroup', 'Grouping' => 'TableGroup', 'TableHeadrow', 'TableRow', 'SemLink' => 'LinkIntern', 'LecturerLink' => 'LinkIntern'); $this->field_names = array( _("Veranstaltungsnummer"), _("Name"), _("Untertitel"), _("Status"), _("Ort"), _("Art"), _("Zeiten"), _("Lehrende") ); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function ExternModuleSemLectureTree ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->registered_elements = array( 'Body', 'TreePath', 'TreeLevelName', 'TreeLevelContent', 'TreeKids', 'TreeBackLink' ); $this->args = array('sem', 'start_item_id'); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function parse () { $query = "SELECT config FROM extern_config WHERE config_id = ?"; $parameters = array($this->id); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $row = $statement->fetchColumn(); if ($row) { $this->config = unserialize(stripslashes($row)); } else { ExternModule::printError(); } }
/** * */ function ExternModuleDownload ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->field_names = array ( _("Icon"), _("Dateiname"), _("Beschreibung"), _("Datum"), _("Größe"), _("Upload durch") ); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function ExternModuleLectures ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->registered_elements = array( 'ReplaceTextSemType', 'SelectSubjectAreas', 'Body', 'TableHeader', 'InfoCountSem' => 'TableGroup', 'Grouping' => 'TableGroup', 'LecturesInnerTable', 'SemLink' => 'LinkIntern', 'LecturerLink' => 'LinkIntern'); $this->args = array('group'); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function ExternModuleGlobal ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->registered_elements = array ( 'PageBodyGlobal' => 'Body', 'MainTableHeaderGlobal' => 'TableHeader', 'InnerTableHeaderGlobal' => 'TableHeader', 'MainTableHeadrowGlobal' => 'TableHeadrow', 'TableGrouprowGlobal' => 'TableGroup', 'TableRowGlobal' => 'TableRow', 'TableHeadrowTextGlobal' => 'Link', 'Headline1TextGlobal' => 'Link', 'Headline2TextGlobal' => 'Link', 'TextGlobal' => 'Link', 'LinksGlobal' => 'Link' ); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function ExternModuleNews ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->registered_elements = array( 'Body', 'TableHeader', 'TableHeadrow', 'TableRow', 'ContentNews', 'LinkInternSimple' => 'LinkIntern', 'StudipLink'); $this->data_fields = array('date', 'topic'); $this->field_names = array ( _("Datum/Autor"), _("Nachricht") ); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function ExternModulePersons ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->data_fields = array( 'Nachname', 'Telefon', 'raum', 'Email', 'sprechzeiten' ); $this->registered_elements = array( 'Body', 'TableHeader', 'TableHeadrow', 'TableGroup', 'TableRow', 'Link', 'LinkIntern', 'TableFooter' ); $this->field_names = array ( _("Name"), _("Telefon"), _("Raum"), _("Email"), _("Sprechzeiten") ); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
/** * */ function ExternModuleNewsticker ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
function getDates($seminar_id, $start_time = 0, $end_time = 0) { $dow_array = array(_("So"), _("Mo"), _("Di"), _("Mi"), _("Do"), _("Fr"), _("Sa")); $cycles_array = array(_("wöchentlich"), _("zweiwöchentlich"), _("dreiwöchentlich")); $cont = array(); // irregular dates $meta = new MetaDate($seminar_id); if ($meta->getTurnus() == 1) { $cont['REGULAR_DATES']['TURNUS'] = true; } if ($meta->getStartWoche()) { $cont['REGULAR_DATES']['START_WEEK'] = $meta->getStartWoche(); } //$cont['REGULAR_TYPE'] = $GLOBALS['TERMIN_TYP'][$meta->getArt()]['name']; $i = 0; $cycle_data = $meta->getCycleData(); foreach ($cycle_data as $metadate_id => $cycle) { $cont['REGULAR_DATES']['REGULAR_DATE'][$i] = array('DAY_OF_WEEK' => $dow_array[$cycle['day']], 'START_TIME' => sprintf('%02d:%02d', $cycle['start_hour'], $cycle['start_minute']), 'END_TIME' => sprintf('%02d:%02d', $cycle['end_hour'], $cycle['end_minute']), 'START_WEEK' => $cycle['week_offset'] + 1, 'CYCLE' => $cycles_array[(int) $cycle['cycle']], 'REGULAR_DESCRIPTION' => ExternModule::ExtHtmlReady(trim($cycle['desc'])), 'REGULAR_DELIMITER' => true); $k = 0; if (Config::get()->RESOURCES_ENABLE) { if (($resource_ids = CycleDataDB::getPredominantRoomDB($metadate_id, $start_time, $end_time)) !== false) { foreach ($resource_ids as $resource_id => $foo) { $cont['REGULAR_DATES']['REGULAR_DATE'][$i]['REGULAR_ROOMS']['ROOMS'][$k]['ROOM'] = ExternModule::ExtHtmlReady(trim(ResourceObject::Factory($resource_id)->getName())); $cont['REGULAR_DATES']['REGULAR_DATE'][$i]['REGULAR_ROOMS']['ROOMS'][$k]['ROOMS_DELIMITER'] = true; $k++; } unset($cont['REGULAR_DATES']['REGULAR_DATE'][$i]['REGULAR_ROOMS']['ROOMS'][$k - 1]['ROOMS_DELIMITER']); } } if (!$k) { if (($free_rooms = CycleDataDB::getFreeTextPredominantRoomDB($metadate_id, $start_time, $end_time)) !== false) { foreach ($free_rooms as $free_room => $foo) { $cont['REGULAR_DATES']['REGULAR_DATE'][$i]['REGULAR_ROOMS']['FREE_ROOMS'][$k]['FREE_ROOM'] = ExternModule::ExtHtmlReady(trim($free_room)); $cont['REGULAR_DATES']['REGULAR_DATE'][$i]['REGULAR_ROOMS']['FREE_ROOMS'][$k]['FREE_ROOMS_DELIMITER'] = true; $k++; } unset($cont['REGULAR_DATES']['REGULAR_DATE'][$i]['REGULAR_ROOMS']['FREE_ROOMS'][$k - 1]['FREE_ROOMS_DELIMITER']); } else { $cont['REGULAR_DATES']['REGULAR_DATE'][$i]['NO_ROOM'] = true; } } // if (!$k) { // $cont['REGULAR_DATES']['REGULAR_DATE'][$i]['REGULAR_ROOMS']['NO_FREE_ROOM'] = true; //} $i++; } // remove last delimiter if ($i) { unset($cont['REGULAR_DATES']['REGULAR_DATE'][$i - 1]['REGULAR_DELIMITER']); } // regular dates if ($start_time && $end_time) { $dates = SeminarDB::getSingleDates($seminar_id, $start_time, $end_time); } else { $dates = array(); } $i = 0; $selected_types = $this->config->getValue('Main', 'selectedeventtypes'); foreach ($dates as $date) { if (in_array('all', $selected_types) || in_array('meeting', $selected_types) && $GLOBALS['TERMIN_TYP'][$date['date_typ']]['sitzung'] || in_array('other', $selected_types) && !$GLOBALS['TERMIN_TYP'][$date['date_typ']]['sitzung'] || in_array($date['date_typ'], $selected_types)) { $cont['IRREGULAR_DATES']['IRREGULAR_DATE'][$i] = array('DAY_OF_WEEK' => $dow_array[date('w', $date['date'])], 'START_TIME' => date('H:i', $date['date']), 'END_TIME' => date('H:i', $date['end_time']), 'DATE' => date('d.m.y', $date['date']), 'IRREGULAR_DESCRIPTION' => ExternModule::ExtHtmlReady(trim($date['description'])), 'IRREGULAR_DELIMITER' => true); if ($GLOBALS['TERMIN_TYP'][$date['date_typ']]['sitzung']) { $cont['IRREGULAR_DATES']['IRREGULAR_DATE'][$i]['IRREGULAR_TYPE_MEETING'] = $GLOBALS['TERMIN_TYP'][$date['date_typ']]['name']; } else { $cont['IRREGULAR_DATES']['IRREGULAR_DATE'][$i]['IRREGULAR_TYPE_OTHER'] = $GLOBALS['TERMIN_TYP'][$date['date_typ']]['name']; } if (Config::get()->RESOURCES_ENABLE && $date['resource_id']) { $cont['IRREGULAR_DATES']['IRREGULAR_DATE'][$i]['IRREGULAR_ROOM'] = ExternModule::ExtHtmlReady(trim(ResourceObject::Factory($date['resource_id'])->getName())); } else { if (trim($date['raum'])) { $cont['IRREGULAR_DATES']['IRREGULAR_DATE'][$i]['IRREGULAR_ROOM'] = ExternModule::ExtHtmlReady(trim($date['raum'])); } else { $cont['IRREGULAR_DATES']['IRREGULAR_DATE'][$i]['IRREGULAR_NO_ROOM'] = true; } } } $i++; } // remove last delimiter if ($i) { unset($cont['IRREGULAR_DATES']['IRREGULAR_DATE'][$i - 1]['IRREGULAR_DELIMITER']); } return $cont; }
function getContent ($args = NULL, $raw = FALSE) { $error_message = ""; if (!$args) { $args = array(); } $content = array(); // check for valid range_id if(!$this->checkRangeId($this->config->range_id)) { $error_message = $GLOBALS['EXTERN_ERROR_MESSAGE']; } // if $args['seminar_id'] is given, check for free access if ($args['seminar_id']) { $seminar_id = $args['seminar_id']; $query = "SELECT Lesezugriff FROM seminare s LEFT JOIN seminar_inst si "; $query .= "USING(seminar_id) WHERE s.seminar_id = ? "; $query .= "AND si.institut_id = ?"; $params = array($seminar_id, $this->config->range_id); $statement = DBManager::get()->prepare($query); $statement->execute($params); $row = $statement->fetchColumn(); if ($row !== false && $row == 0 ) { $error_message = $GLOBALS['EXTERN_ERROR_MESSAGE']; } } else { $seminar_id = $this->config->range_id; } $sort = (array) $this->config->getValue('Main', 'sort'); $query_order = ''; foreach ($sort as $key => $position) { if ($position > 0) { $query_order[$position] = $this->data_fields[$key]; } } if ($query_order) { ksort($query_order, SORT_NUMERIC); $query_order = ' ORDER BY ' . implode(',', $query_order) . ' DESC'; } if (!$nameformat = $this->config->getValue('Main', 'nameformat')) { $nameformat = 'no_title_short'; } // generic data fields $generic_datafields = $this->config->getValue('TemplateGeneric', 'genericdatafields'); $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $seminar_id)); $allowed_folders = $folder_tree->getReadableFolders('nobody'); $mrks = str_repeat('?,', count($allowed_folders) - 1) . '?'; $query = "SELECT dokument_id, name, description, filename, d.mkdate, d.chdate, filesize, "; $query .= $GLOBALS['_fullname_sql'][$nameformat]; $query .= "AS fullname, Vorname, Nachname, title_front, title_rear, username, aum.user_id, author_name FROM dokumente d LEFT JOIN user_info USING (user_id) "; $query .= "LEFT JOIN auth_user_md5 aum USING (user_id) WHERE "; $query .= "seminar_id = ? AND range_id IN ($mrks)$query_order"; $parameters = $allowed_folders; $parameters[] = $seminar_id; $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $row = $statement->fetch(PDO::FETCH_ASSOC); if ( !$row ) { $content['NO-FILES']['NO-FILES-TEXT'] = $this->config->getValue('Main', 'nodatatext'); } else { $i = 0; do { preg_match("/^.+\.([a-z1-9_-]+)$/i", $row['filename'], $file_suffix); $icon = ''; switch ($file_suffix[1]) { case 'txt' : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'icontxt')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-text', 'clickable')->asImagePath(16); break; case 'xls' : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'iconxls')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-xls', 'clickable')->asImagePath(16); break; case 'ppt' : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'iconppt')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-presentation', 'clickable')->asImagePath(16); break; case 'rtf' : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'iconrtf')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-text', 'clickable')->asImagePath(16); break; case 'zip' : case 'tgz' : case 'gz' : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'iconzip')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-archive', 'clickable')->asImagePath(16); break; case 'jpg' : case 'png' : case 'gif' : case 'jpeg' : case 'tif' : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'iconpic')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-pic', 'clickable')->asImagePath(16); break; case 'pdf' : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'iconpdf')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-pdf', 'clickable')->asImagePath(16); break; default : if (!$content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = $this->config->getValue('Main', 'icondefault')) $content['FILES']['FILE'][$i]['FILE_ICON-HREF'] = Icon::create('file-generic', 'clickable')->asImagePath(16); } $content['FILES']['FILE'][$i]['FILE_NO'] = $i + 1; $download_link = GetDownloadLink($row['dokument_id'], $row['filename']); $content['FILES']['FILE'][$i]['FILE_HREF'] = $download_link; $content['FILES']['FILE'][$i]['FILE_NAME'] = ExternModule::ExtHtmlReady($row['name']); $content['FILES']['FILE'][$i]['FILE_FILE-NAME'] = ExternModule::ExtHtmlReady($row['filename']); $content['FILES']['FILE'][$i]['FILE_DESCRIPTION'] = ExternModule::ExtHtmlReady(mila_extern($row["description"], $this->config->getValue("Main", "lengthdesc"))); $content['FILES']['FILE'][$i]['FILE_UPLOAD-DATE'] = strftime($this->config->getValue("Main", "dateformat"), $row["mkdate"]); $content['FILES']['FILE'][$i]['FILE_SIZE'] = $row['filesize'] > 1048576 ? round($row['filesize'] / 1048576, 1) . " MB" : round($row["filesize"] / 1024, 1) . " kB"; $content['FILES']['FILE'][$i]['USERNAME'] = $row['username']; $content['FILES']['FILE'][$i]['FULLNAME'] = ExternModule::ExtHtmlReady($row['fullname'] ? $row['fullname'] : $row['author_name']); $content['FILES']['FILE'][$i]['FIRSTNAME'] = ExternModule::ExtHtmlReady($row['Vorname']); $content['FILES']['FILE'][$i]['LASTNAME'] = ExternModule::ExtHtmlReady($row['Nachname']); $content['FILES']['FILE'][$i]['TITLEFRONT'] = ExternModule::ExtHtmlReady($row['title_front']); $content['FILES']['FILE'][$i]['TITLEREAR'] = ExternModule::ExtHtmlReady($row['title_rear']); $content['FILES']['FILE'][$i]['PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl('Persondetails', array('link_args' => 'username='******'username'])); // if user is member of a group then link name to details page $link_persondetail = ''; if (GetRoleNames(GetAllStatusgruppen($this->config->range_id, $row['user_id']))) { $content['FILES']['FILE'][$i]['PERSONDETAIL-LINK']['LINK_PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl('Persondetails', array('link_args' => 'username='******'username'])); $content['FILES']['FILE'][$i]['PERSONDETAIL-LINK']['LINK_FULLNAME'] = ExternModule::ExtHtmlReady($row['fullname'] ? $row['fullname'] : $row['author_name']); $content['FILES']['FILE'][$i]['PERSONDETAIL-LINK']['LINK_FIRSTNAME'] = ExternModule::ExtHtmlReady($row['Vorname']); $content['FILES']['FILE'][$i]['PERSONDETAIL-LINK']['LINK_LASTNAME'] = ExternModule::ExtHtmlReady($row['Nachname']); $content['FILES']['FILE'][$i]['PERSONDETAIL-LINK']['LINK_TITLEFRONT'] = ExternModule::ExtHtmlReady($row['title_front']); $content['FILES']['FILE'][$i]['PERSONDETAIL-LINK']['LINK_TITLEREAR'] = ExternModule::ExtHtmlReady($row['title_rear']); } // generic data fields if (is_array($generic_datafields)) { $localEntries = DataFieldEntry::getDataFieldEntries($row['user_id'], 'user'); $k = 1; foreach ($generic_datafields as $datafield) { if (isset($localEntries[$datafield]) && is_object($localEntries[$datafield])) { $localEntry = $localEntries[$datafield]->getDisplayValue(); if ($localEntry) { $content['FILES']['FILE'][$i]['DATAFIELD_' . $k] = $localEntry; } } $k++; } } $i++; }while($row = $statement->fetch(PDO::FETCH_ASSOC)); } $content = array('DOWNLOAD' => $content); $content['__GLOBAL__']['FILES-COUNT'] = $i; return $content; }
/** * */ function store () { parent::store(); if (!$this->file_name) { if ($this->id) { $this->file_name = $this->id . '.cfg'; } else { return FALSE; } } $file_content = "; Configuration file for the extern module" . " $this->module_name in Stud.IP\n" . "; (range_id: $this->range_id)\n" . "; DO NOT EDIT !!!\n"; foreach ($this->config as $element => $attributes) { $file_content .= "\n[" . $element . "]\n"; foreach ($attributes as $attribute => $value) { if (is_array($value)) { $value = '|' . implode('|', $value); } $file_content .= $attribute . " = \"" . $value . "\"\n"; } } if ($file = @fopen($GLOBALS['EXTERN_CONFIG_FILE_PATH'] . $this->file_name, 'w')) { fputs($file, $file_content); fclose($file); return ($this->updateConfiguration()); } else { ExternModule::printError(); return FALSE; } }
echo "</font></blockquote></form>\n</td></tr>\n"; } else { echo "<tr><td class=\"blank\"> </td></tr>\n"; } echo "<tr><td class=\"blank\">\n"; $configurations = ExternConfig::GetAllConfigurations($range_id); $module_types_ordered = ExternModule::GetOrderedModuleTypes(); $choose_module_form = ''; // remove global configuration array_shift($module_types_ordered); foreach ($module_types_ordered as $i) { if ((sizeof($configurations[$GLOBALS['EXTERN_MODULE_TYPES'][$i]['module']]) < $EXTERN_MAX_CONFIGURATIONS) && ExternModule::HaveAccessModuleType(Request::option('view'), $i)) { $choose_module_form .= "<option value=\"{$GLOBALS['EXTERN_MODULE_TYPES'][$i]['module']}\">" . $GLOBALS['EXTERN_MODULE_TYPES'][$i]['name'] . "</option>\n"; } if (isset($configurations[$GLOBALS['EXTERN_MODULE_TYPES'][$i]["module"]])) { $have_config = TRUE; } } // add global configuration on first position array_unshift($module_types_ordered, 0); // check for global configurations if (isset($configurations[$GLOBALS['EXTERN_MODULE_TYPES'][0]["module"]])) { $have_config = TRUE; } if (Request::option('com') != 'copychoose') {
private function getContentLectures () { global $attr_text_td, $end, $start; $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); // old hard coded $SEMESTER-array starts with index 1 array_unshift($all_semester, 0); $types = array(); $semclass = $this->config->getValue('PersondetailsLectures', 'semclass'); if (is_null($semclass)) { $semclass = array(1); } if (in_array($type["class"], $semclass)) { } $switch_time = mktime(0, 0, 0, date("m"), date("d") + 7 * $this->config->getValue("PersondetailsLectures", "semswitch"), date("Y")); // get current semester $current_sem = get_sem_num($switch_time) + 1; switch ($this->config->getValue("PersondetailsLectures", "semstart")) { case "previous" : if (isset($all_semester[$current_sem - 1])) { $current_sem--; } break; case "next" : if (isset($all_semester[$current_sem + 1])) { $current_sem++; } break; case "current" : break; default : if (isset($all_semester[$this->config->getValue("PersondetailsLectures", "semstart")])) { $current_sem = $this->config->getValue("PersondetailsLectures", "semstart"); } } $last_sem = $current_sem + $this->config->getValue("PersondetailsLectures", "semrange") - 1; if ($last_sem < $current_sem) { $last_sem = $current_sem; } if (!isset($all_semester[$last_sem])) { $last_sem = sizeof($all_semester) - 1; } $types = array(); $semclass = $this->config->getValue('PersondetailsLectures', 'semclass'); if (is_null($semclass)) { $semclass = array(1); } foreach ($GLOBALS["SEM_TYPE"] as $key => $type) { if (in_array($type["class"], $semclass)) { $types[] = $key; } } $stm = DBManager::get()->prepare( "SELECT s.Name, s.Seminar_id, s.Untertitel, s.VeranstaltungsNummer " . "FROM seminar_user su " . "LEFT JOIN seminare s USING(seminar_id) " . "WHERE user_id = ? AND su.status LIKE 'dozent' " . "AND start_time <= ? AND (? <= start_time + duration_time OR duration_time = -1) " . "AND s.status IN (?) AND s.visible = 1 " . "ORDER BY Name"); $i = 0; for (;$current_sem <= $last_sem; $last_sem--) { $stm->execute(array($this->user_id, $all_semester[$last_sem]['beginn'], $all_semester[$last_sem]['beginn'], $types ?: '')); $result = $stm->fetchAll(); if ($result && sizeof($result)) { if (!($this->config->getValue('PersondetailsLectures', 'semstart') == 'current' && $this->config->getValue('PersondetailsLectures', 'semrange') == 1)) { $month = date('n', $all_semester[$last_sem]['beginn']); if ($month > 9) { $content['LECTURES']['SEMESTER'][$i]['NAME'] = $this->config->getValue('PersondetailsLectures', 'aliaswise') . date(' Y/', $all_semester[$last_sem]['beginn']) . date('y', $all_semester[$last_sem]['ende']); } else if ($month > 3 && $month < 10) { $content['LECTURES']['SEMESTER'][$i]['NAME'] = $this->config->getValue('PersondetailsLectures', 'aliassose') . date(' Y', $all_semester[$last_sem]['beginn']); } } $k = 0; foreach ($result as $row) { $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['TITLE'] = ExternModule::ExtHtmlReady($row['Name']); $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['LECTUREDETAILS-HREF'] = $this->elements['LinkInternLecturedetails']->createUrl(array('link_args' => 'seminar_id=' . $row['Seminar_id'])); if (trim($row['Untertitel']) != '') { $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['SUBTITLE'] = ExternModule::ExtHtmlReady($row['Untertitel']); } if (trim($row['VeranstaltungsNummer']) != '') { $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['NUMBER'] = ExternModule::ExtHtmlReady($row['VeranstaltungsNummer']); } $k++; } } $i++; } return $content; }
function getContent ($args = NULL, $raw = FALSE) { $content = array(); $error_message = ""; // stimmt die übergebene range_id? $query = "SELECT 1 FROM Institute WHERE Institut_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->config->range_id)); if (!$statement->fetchColumn()) { $error_message = $GLOBALS['EXTERN_ERROR_MESSAGE']; } $local_fullname_sql = $GLOBALS['_fullname_sql']; if (!$nameformat = $this->config->getValue('Main', 'nameformat')) { $nameformat = 'no_title'; } if ($nameformat == 'last') $local_fullname_sql['last'] = ' Nachname '; $news =& StudipNews::GetNewsByRange($this->config->range_id); if (!count($news)) { $content['NEWS']['NO-NEWS']['NO-NEWS_TEXT'] = $this->config->getValue('Main', "nodatatext"); } $studip_link = URLHelper::getLink('dispatch.php/institute/overview?again=yes&cid='. $this->config->range_id); $content['__GLOBAL__']['STUDIP-LINK'] = $studip_link; $dateform = $this->config->getValue("Main", "dateformat"); $show_date_author = $this->config->getValue("Main", "showdateauthor"); $i = 1; $j = 1; foreach ($news as $news_id => $news_detail) { //aktuelle News ausgeben if (($news_detail['date'] + $news_detail['expire']) >= time()) { list($news_content, $admin_msg) = explode("<admin_msg>", $news_detail['body']); if ($news_detail['chdate_uid']){ $admin_msg = StudipNews::GetAdminMsg($news_detail['chdate_uid'],$news_detail['chdate']); } if ($admin_msg) { $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_ADMIN-MESSAGE'] = preg_replace('# \(?(.*)\)?#', '$1', $admin_msg); } if (!$news_content) { $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_BODY'] = _("Keine Beschreibung vorhanden."); } else { $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_BODY'] = ExternModule::ExtFormatReady($news_content); } $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_DATE'] = strftime($dateform, $news_detail['date']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_TOPIC'] = ExternModule::ExtHtmlReady($news_detail['topic']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_NO'] = $i; $query = "SELECT Nachname, Vorname, title_front, title_rear, {$local_fullname_sql[$nameformat]} AS fullname, username, aum.user_id FROM auth_user_md5 AS aum LEFT JOIN user_info AS ui USING (user_id) WHERE aum.user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($news_detail['user_id'])); $temp = $statement->fetch(PDO::FETCH_ASSOC); if ($temp) { $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['USERNAME'] = $temp['username']; $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username'])); if (GetAllStatusgruppen($this->config->range_id, $temp['user_id'], true)) { $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username'])); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']); $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']); } } $i++; } //archivierte News ausgeben elseif(($news_detail['date'] + $news_detail['expire']) < time()) { list($news_content, $admin_msg) = explode("<admin_msg>", $news_detail['body']); if ($news_detail['chdate_uid']){ $admin_msg = StudipNews::GetAdminMsg($news_detail['chdate_uid'],$news_detail['chdate']); } if ($admin_msg) { $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_ADMIN-MESSAGE'] = preg_replace('# \(?(.*)\)?#', '$1', $admin_msg); } if (!$news_content) { $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_BODY'] = _("Keine Beschreibung vorhanden."); } else { $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_BODY'] = ExternModule::ExtFormatReady($news_content); } $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_DATE'] = strftime($dateform, $news_detail['date']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_TOPIC'] = ExternModule::ExtHtmlReady($news_detail['topic']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_NO'] = $j; $query = "SELECT Nachname, Vorname, title_front, title_rear, {$local_fullname_sql[$nameformat]} AS fullname, username, aum.user_id FROM auth_user_md5 AS aum LEFT JOIN user_info AS ui USING (user_id) WHERE aum.user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($news_detail['user_id'])); $temp = $statement->fetch(PDO::FETCH_ASSOC); if ($temp) { $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_USERNAME'] = $temp['username']; $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username'])); if (GetAllStatusgruppen($this->config->range_id, $temp['user_id'], true)) { $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username'])); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']); $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']); } } $j++; } } $content['__GLOBAL__']['NEWS-COUNT'] = $i - 1; $content['__GLOBAL__']['ARCHIV-NEWS-COUNT'] = $j -1; return $content; }
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; }
function setDefaultConfiguration ($config) { foreach ($config as $element_name => $element) { if (is_array($element)) foreach ($element as $attribute => $value) { if ((string)$value{0} == '|') { $new_config[$element_name][$attribute] = explode('|', substr($value, 1)); } else { $new_config[$element_name][$attribute] = $value; } } } $this->id = $this->makeId(); $this->config_name = $this->createConfigName($this->range_id); // take the new configuration, write the name in the configuration // insert it into the database and store it (method of storaging deepends on // object type) $this->config = $new_config; $this->setValue('Main', 'name', $this->config_name); if ($this->insertConfiguration()) { $this->store(); } else { echo MessageBox::error(_("Sie haben die maximale Anzahl an Konfigurationen für dieses Modul erreicht! Kopieren fehlgeschlagen!")); ExternModule::printError(); } }
$start = $all_semester[$current - 1]["beginn"]; $end = $all_semester[$current - 1]["ende"]; } elseif ($sem_offset == "+1") { $start = $all_semester[$current + 1]["beginn"]; $end = $all_semester[$current + 1]["ende"]; } else { $start = $all_semester[$current]["beginn"]; $end = $all_semester[$current]["ende"]; } // all parameters ok, instantiate module and print data foreach ($EXTERN_MODULE_TYPES as $type) { if ($type["module"] == $module_name) { $class_name = "ExternModule" . $module_name; require_once($RELATIVE_PATH_EXTERN . "/modules/$class_name.class.php"); $module_obj = ExternModule::GetInstance($range_id, $module_name, $config_id, $default, $global_id); } } // drop URL parameters from page_url $page_url = preg_replace('/\?.*/', '', Request::get('page_url')); $sri_url = $module_obj->config->getValue('Main', 'sriurl'); if (isset($sri_url)) { // drop URL parameters from sri_url $sri_url = preg_replace('/\?.*/', '', $sri_url); } if ($page_url != $sri_url || !sri_is_enabled($module_obj->config->range_id)) { echo $EXTERN_ERROR_MESSAGE;
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 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 ExternModulePersondetails ($range_id, $module_name, $config_id = NULL, $set_config = NULL, $global_id = NULL) { $this->data_fields = array( 'contact' => array( 'raum', 'Telefon', 'Fax', 'Email', 'Home', 'sprechzeiten'), 'content' => array( 'head', 'lebenslauf', 'schwerp', 'lehre', 'news', 'termine', 'publi', 'kategorien'/*, 'literature' */) ); $this->registered_elements = array( 'Body', 'TableHeader', 'PersondetailsHeader', 'Contact', 'PersondetailsLectures', 'TableParagraph', 'TableParagraphHeadline', 'TableParagraphSubHeadline', 'TableParagraphText', 'List',/* 'LitList',*/ 'LinkIntern', 'StudipLink' ); $this->args = array('username', 'seminar_id'); $this->field_names = array ( "contact" => array ( _("Raum"), _("Telefon"), _("Fax"), _("Email"), _("Homepage"), _("Sprechzeiten") ), "content" => array ( _("Name, Anschrift, Kontakt"), _("Lebenslauf"), _("Schwerpunkte"), _("Lehrveranstaltungen"), _("News"), _("Termine"), _("Publikationen"), _("eigene Kategorien")/*, _("Literaturlisten")*/ ) ); parent::ExternModule($range_id, $module_name, $config_id, $set_config, $global_id); }
function getContent ($args = NULL, $raw = FALSE) { if ($raw) { $this->setRawOutput(); } if (!$all_groups = get_all_statusgruppen($this->config->range_id)) { die($GLOBALS["EXTERN_ERROR_MESSAGE"]); } else { $all_groups = array_keys($all_groups); } if (!$group_ids = $this->config->getValue('Main', 'groupsvisible')) { die($GLOBALS["EXTERN_ERROR_MESSAGE"]); } else { $group_ids = array_intersect($all_groups, $group_ids); } if (!is_array($group_ids)) { die($GLOBALS["EXTERN_ERROR_MESSAGE"]); } if (!$visible_groups = get_statusgruppen_by_id($this->config->range_id, $group_ids)) { die($GLOBALS["EXTERN_ERROR_MESSAGE"]); } $sort = $this->config->getValue('Main', 'sort'); $query_order = ''; foreach ($sort as $key => $position) { if ($position > 0) { $query_order[$position] = $this->data_fields[$key]; } } if ($query_order) { ksort($query_order, SORT_NUMERIC); $query_order = ' ORDER BY ' . implode(',', $query_order); } $grouping = $this->config->getValue("Main", "grouping"); if (!$nameformat = $this->config->getValue('Main', 'nameformat')) { $nameformat = 'full_rev'; } if(!$grouping) { $query = "SELECT DISTINCT ui.raum, ui.sprechzeiten, ui.Telefon, inst_perms, Email, aum.user_id, "; $query .= 'username, aum.Vorname, title_front, title_rear, '; $query .= $GLOBALS['_fullname_sql'][$nameformat] . " AS fullname, aum.Nachname "; if ($query_order != '') { $query .= "FROM statusgruppe_user LEFT JOIN auth_user_md5 aum USING(user_id) "; $query .= "LEFT JOIN user_info USING(user_id) LEFT JOIN user_inst ui USING(user_id) "; $query .= "WHERE statusgruppe_id IN (?) AND Institut_id = ? AND ".get_ext_vis_query()."$query_order"; } else { $query .= "FROM statusgruppen s LEFT JOIN statusgruppe_user su USING(statusgruppe_id) "; $query .= "LEFT JOIN auth_user_md5 aum USING(user_id) "; $query .= "LEFT JOIN user_info USING(user_id) LEFT JOIN user_inst ui USING(user_id) "; $query .= "WHERE su.statusgruppe_id IN (?) AND Institut_id = ? "; $query .= "' AND ".get_ext_vis_query()." ORDER BY "; $query .= "s.position ASC, su.position ASC"; } $parameters = array($this->config->getValue('Main', 'groupsvisible'), $this->config->range_id); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $row = $statement->fetch(PDO::FETCH_ASSOC); $visible_groups = array(''); } // generic data fields $generic_datafields = $this->config->getValue('TemplateGeneric', 'genericdatafields'); $data['data_fields'] = $this->data_fields; $defaultaddress = $this->config->getValue('Main', 'defaultadr'); if (! $defaultaddress) { $db_out =& $row; } $content = null; $i = 0; $aliases_groups = $this->config->getValue('Main', 'groupsalias'); foreach ($visible_groups as $group_id => $group) { if ($grouping) { if ($query_order == '') { $query_order = ' ORDER BY su.position'; } $query = 'SELECT ui.raum, ui.sprechzeiten, ui.Telefon, inst_perms, Email, aum.user_id, '; $query .= 'username, aum.Vorname, title_front, title_rear, '; $query .= $GLOBALS['_fullname_sql'][$nameformat] . " AS fullname, aum.Nachname "; $query .= 'FROM statusgruppe_user su LEFT JOIN auth_user_md5 aum USING(user_id) '; $query .= 'LEFT JOIN user_info USING(user_id) LEFT JOIN user_inst ui USING(user_id) '; $query .= "WHERE su.statusgruppe_id = ? AND ".get_ext_vis_query()." AND Institut_id = ? $query_order"; $parameters = array($group_id, $this->config->range_id ); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $row = $statement->fetch(PDO::FETCH_ASSOC); if($aliases_groups[$group_id]) { $group = $aliases_groups[$group_id]; } } if ($row !== false) { if($aliases_groups[$group_id]) { $content['PERSONS']['GROUP'][$i]['GROUPTITLE-SUBSTITUTE'] = ExternModule::ExtHtmlReady($aliases_groups[$group_id]); } $content['PERSONS']['GROUP'][$i]['GROUPTITLE'] = ExternModule::ExtHtmlReady($group); $content['PERSONS']['GROUP'][$i]['GROUP-NO'] = $i + 1; $j = 0; do{ $visibilities = get_local_visibility_by_id($row['user_id'], 'homepage', true); $user_perm = $visibilities['perms']; $visibilities = json_decode($visibilities['homepage'], true); if ($defaultaddress) { $query = 'SELECT ui.raum, ui.sprechzeiten, ui.Telefon, inst_perms, Email, '; $query .= 'title_front, title_rear, '; $query .= 'aum.user_id, username, ' . $GLOBALS['_fullname_sql'][$nameformat]; $query .= ' AS fullname, aum.Nachname, aum.Vorname FROM auth_user_md5 aum LEFT JOIN '; $query .= 'user_info USING(user_id) LEFT JOIN '; $query .= "user_inst ui USING(user_id) WHERE aum.user_id = '" . $row['user_id']; $query .= "' AND ".get_ext_vis_query().' AND externdefault = 1'; $statement2 = DBManager::get()->prepare($query); $statement2->execute(); $db_out = $statement2->fetch(PDO::FETCH_ASSOC); //no default if ($db_out === false) { $query = 'SELECT ui.raum, ui.sprechzeiten, ui.Telefon, inst_perms, Email, '; $query .= 'title_front, title_rear, '; $query .= 'aum.user_id, username, ' . $GLOBALS['_fullname_sql'][$nameformat]; $query .= ' AS fullname, aum.Nachname, aum.Vorname FROM auth_user_md5 aum LEFT JOIN '; $query .= 'user_info USING(user_id) LEFT JOIN '; $query .= "user_inst ui USING(user_id) WHERE aum.user_id = '" . $row['user_id']; $query .= "' AND ".get_ext_vis_query()." AND Institut_id = ? " ; $statement2 = DBManager::get()->prepare($query); $params = array($this->config->range_id); $statement2->execute($params); $db_out = $statement2->fetch(PDO::FETCH_ASSOC); } } $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['FULLNAME'] = ExternModule::ExtHtmlReady($db_out['fullname']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['LASTNAME'] = ExternModule::ExtHtmlReady($db_out['Nachname']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['FIRSTNAME'] = ExternModule::ExtHtmlReady($db_out['Vorname']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['TITLEFRONT'] = ExternModule::ExtHtmlReady($db_out['title_front']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['TITLEREAR'] = ExternModule::ExtHtmlReady($db_out['title_rear']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username'])); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['USERNAME'] = $db_out['username']; if (is_element_visible_externally( $row['user_id'], $user_perm, 'picture', $visibilities['picture'])) { $avatar = Avatar::getAvatar($db_out['user_id']); } else { $avatar = Avatar::getNobody(); } $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['IMAGE-URL-SMALL'] = $avatar->getURL(Avatar::SMALL); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['IMAGE-URL-MEDIUM'] = $avatar->getURL(Avatar::MEDIUM); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['IMAGE-URL-NORMAL'] = $avatar->getURL(Avatar::NORMAL); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['PHONE'] = ExternModule::ExtHtmlReady($db_out['Telefon']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['ROOM'] = ExternModule::ExtHtmlReady($db_out['raum']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL'] = get_visible_email($row['user_id']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL-LOCAL'] = array_shift(explode('@', $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL'])); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL-DOMAIN'] = array_pop(explode('@', $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['EMAIL'])); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['OFFICEHOURS'] = ExternModule::ExtHtmlReady($db_out['sprechzeiten']); $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['PERSON-NO'] = $j + 1; // generic data fields if (is_array($generic_datafields)) { $localEntries = DataFieldEntry::getDataFieldEntries($db_out['user_id'], 'user'); #$datafields = $datafields_obj->getLocalFields($db_out->f('user_id')); $k = 1; foreach ($generic_datafields as $datafield) { if (isset($localEntries[$datafield]) && is_object($localEntries[$datafield] && is_element_visible_externally($db_out['user_id'], $user_perm, $localEntries[$datafield]->getId(), $visibilities[$localEntries[$datafield]->getId()]))) { if ($localEntries[$datafield]->getType() == 'link') { $localEntry = ExternModule::extHtmlReady($localEntries[$datafield]->getValue()); } else { $localEntry = $localEntries[$datafield]->getDisplayValue(); } if ($localEntry) { $content['PERSONS']['GROUP'][$i]['PERSON'][$j]['DATAFIELD_' . $k] = $localEntry; } } $k++; } } $j++; }while ($row = $statement->fetch(PDO::FETCH_ASSOC)); } $i++; } return $content; }