/** * common tasks for all actions */ function before_filter(&$action, &$args) { global $perm; parent::before_filter($action, $args); if (Request::get('termin_id')) { $this->dates[0] = new SingleDate(Request::option('termin_id')); $this->course_id = $this->dates[0]->range_id; } if (Request::get('issue_id')) { $this->issue_id = Request::option('issue_id'); $this->dates = array_values(array_map(function ($data) { $d = new SingleDate(); $d->fillValuesFromArray($data); return $d; }, IssueDB::getDatesforIssue(Request::option('issue_id')))); $this->course_id = $this->dates[0]->range_id; } if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) { throw new Trails_Exception(400); } PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen"); PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _("Veranstaltungstermine absagen")); $this->set_content_type('text/html;charset=windows-1252'); if (Request::isXhr()) { $this->set_layout(null); $this->response->add_header('X-Title', PageLayout::getTitle()); $request = Request::getInstance(); foreach ($request as $key => $value) { $request[$key] = studip_utf8decode($value); } } }
/** * Deletes the current seminar * * @return void returns success-message if seminar could be deleted * otherwise an error-message */ public function delete() { $s_id = $this->id; // Delete that Seminar. // Alle Benutzer aus dem Seminar rauswerfen. $query = "DELETE FROM seminar_user WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Teilnehmende und Lehrende archiviert."), $db_ar)); } // Alle Benutzer aus Wartelisten rauswerfen $query = "DELETE FROM admission_seminar_user WHERE seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); // Alle beteiligten Institute rauswerfen $query = "DELETE FROM seminar_inst WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Zuordnungen zu Einrichtungen archiviert."), $db_ar)); } // user aus den Statusgruppen rauswerfen $count = DeleteAllStatusgruppen($s_id); if ($count > 0) { $this->createMessage(_("Einträge aus Funktionen / Gruppen gelöscht.")); } // Alle Eintraege aus dem Vorlesungsverzeichnis rauswerfen $db_ar = StudipSemTree::DeleteSemEntries(null, $s_id); if ($db_ar > 0) { $this->createMessage(sprintf(_("%s Zuordnungen zu Bereichen archiviert."), $db_ar)); } // Alle Termine mit allem was dranhaengt zu diesem Seminar loeschen. if (($db_ar = SingleDateDB::deleteAllDates($s_id)) > 0) { $this->createMessage(sprintf(_("%s Veranstaltungstermine archiviert."), $db_ar)); } //Themen IssueDB::deleteAllIssues($s_id); //Cycles SeminarCycleDate::deleteBySQL('seminar_id = ' . DBManager::get()->quote($s_id)); // Alle weiteren Postings zu diesem Seminar in den Forums-Modulen löschen foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $plugin->deleteContents($s_id); // delete content irrespective of plugin-activation in the seminar if ($plugin->isActivated($s_id)) { // only show a message, if the plugin is activated, to not confuse the user $this->createMessage(sprintf(_('Einträge in %s archiviert.'), $plugin->getPluginName())); } } // Alle Dokumente zu diesem Seminar loeschen. if (($db_ar = delete_all_documents($s_id)) > 0) { $this->createMessage(sprintf(_("%s Dokumente und Ordner archiviert."), $db_ar)); } // Freie Seite zu diesem Seminar löschen $query = "DELETE FROM scm WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(_("Freie Seite der Veranstaltung archiviert.")); } // delete literatur $del_lit = StudipLitList::DeleteListsByRange($s_id); if ($del_lit) { $this->createMessage(sprintf(_("%s Literaturlisten archiviert."),$del_lit['list'])); } // Alle News-Verweise auf dieses Seminar löschen if ( ($db_ar = StudipNews::DeleteNewsRanges($s_id)) ) { $this->createMessage(sprintf(_("%s Ankündigungen gelöscht."), $db_ar)); } //delete entry in news_rss_range StudipNews::UnsetRssId($s_id); //kill the datafields DataFieldEntry::removeAll($s_id); //kill all wiki-pages $query = "DELETE FROM wiki WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_wiki = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Wiki-Seiten archiviert."), $db_wiki)); } $query = "DELETE FROM wiki_links WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); $query = "DELETE FROM wiki_locks WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); // kill all the ressources that are assigned to the Veranstaltung (and all the linked or subordinated stuff!) if (Config::get()->RESOURCES_ENABLE) { $killAssign = new DeleteResourcesUser($s_id); $killAssign->delete(); if ($rr = RoomRequest::existsByCourse($s_id)) { RoomRequest::find($rr)->delete(); } } // kill virtual seminar-entries in calendar $query = "DELETE FROM schedule_seminare WHERE seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if(get_config('ELEARNING_INTERFACE_ENABLE')){ global $connected_cms; $del_cms = 0; $cms_types = ObjectConnections::GetConnectedSystems($s_id); if(count($cms_types)){ foreach($cms_types as $system){ ELearningUtils::loadClass($system); $del_cms += $connected_cms[$system]->deleteConnectedModules($s_id); } $this->createMessage(sprintf(_("%s Verknüpfungen zu externen Systemen gelöscht."), $del_cms )); } } //kill the object_user_vists for this seminar object_kill_visits(null, $s_id); // Logging... $query = "SELECT CONCAT(seminare.VeranstaltungsNummer, ' ', seminare.name, '(', semester_data.name, ')') FROM seminare LEFT JOIN semester_data ON (seminare.start_time = semester_data.beginn) WHERE seminare.Seminar_id='$s_id'"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); $semlogname = $statement->fetchColumn() ?: sprintf('unknown sem_id: %s', $s_id); StudipLog::log("SEM_ARCHIVE",$s_id,NULL,$semlogname); // ...logged // delete deputies if necessary deleteAllDeputies($s_id); UserDomain::removeUserDomainsForSeminar($s_id); AutoInsert::deleteSeminar($s_id); //Anmeldeset Zordnung entfernen $cs = $this->getCourseSet(); if ($cs) { CourseSet::removeCourseFromSet($cs->getId(), $this->getId()); $cs->load(); if (!count($cs->getCourses()) && $cs->isGlobal() && $cs->getUserid() != '') { $cs->delete(); } } AdmissionPriority::unsetAllPrioritiesForCourse($this->getId()); // und das Seminar loeschen. $this->course->delete(); $this->restore(); return true; }
/** * Displays the folder and all of its documents and recursively subfolders. * This function is not dependent on the recursive-level so it looks as if it all starts from here. * */ function display_folder ($folder_id, $open, $change, $move, $upload, $refresh=FALSE, $filelink="", $anchor_id, $position="middle", $isissuefolder = false) { global $_fullname_sql,$SessionSeminar,$SessSemName, $rechte, $anfang, $user, $SemSecLevelWrite, $SemUserStatus, $check_all, $countfolder, $droppable_folder; $option = true; $countfolder++; $more = true; $db = DBManager::get(); $droppable_folder++; $javascriptok = true; //Einbinden einer Klasse, die Informationen über den ganzen Baum enthält $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $SessionSeminar)); //Hole alle Informationen, die es über $folder_id gibt $query = "SELECT ". $_fullname_sql['full'] ." AS fullname , username, folder_id, a.range_id, a.user_id, name, a.description, a.mkdate, a.chdate FROM folder a LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE a.folder_id = '$folder_id' ORDER BY a.name, a.chdate"; $result = $db->query($query)->fetch(); $depth = count($folder_tree->getParents($folder_id)); print "<div id=\"folder_".($depth > 2 ? $result['range_id'] : "root")."_".$countfolder."\"".($rechte ? " class=\"draggable_folder\"" : "").">"; print "<div style=\"display:none\" id=\"getmd5_fo".$result['range_id']."_".$countfolder."\">".$folder_id."</div>"; print "<table cellpadding=0 border=0 cellspacing=0 width=\"100%\"><tr>"; //Abzweigung, wenn Ordner ein Unterordner ist if ($depth > 2) // root > folder > subfolder print "<td class=\"tree-elbow-end\">" . Assets::img("datatree_2.gif") . "</td>"; else print "<td></td>"; print "<td valign=\"bottom\">"; //Farbe des Pfeils bestimmen: $chdate = (($result["chdate"]) ? $result["chdate"] : $result["mkdate"]); if (object_get_visit($SessSemName[1], "documents") < $chdate) $neuer_ordner = TRUE; else $neuer_ordner = FALSE; if ($neuer_ordner == TRUE) $timecolor = "#FF0000"; else { $timediff = (int) log((time() - doc_newest($folder_id)) / 86400 + 1) * 15; if ($timediff >= 68) $timediff = 68; $red = dechex(255 - $timediff); $other = dechex(119 + $timediff); $timecolor= "#" . $red . $other . $other; } //Jetzt fängt eine zweite Tabelle an mit den Zeilen: Titel, Beschreibung und Knöpfe, Unterdateien und Unterordner if ($rechte) { print "<div class=\"droppable handle\" id=\"dropfolder_$folder_id\">"; } print "<table cellpadding=0 border=0 cellspacing=0 width=\"100%\" id=\"droppable_folder_$droppable_folder\"><tr>"; // -> Pfeile zum Verschieben (bzw. die Ziehfläche) if (($rechte) && ($depth > 2)) { $bewegeflaeche = "<span class=\"updown_marker\" id=\"pfeile_".$folder_id."\">"; if (($position == "middle") || ($position == "bottom")) { $bewegeflaeche .= "<a href=\"".URLHelper::getLink('?open='.$folder_id)."_mfou_\" title=\""._("Nach oben verschieben"). "\">" . Icon::create('arr_2up', 'sort')->asImg(['class' => 'text-top']) . "</a>"; } if (($position == "middle") || ($position == "top")) { $bewegeflaeche .= "<a href=\"".URLHelper::getLink('?open='. $folder_id)."_mfod_\" title=\""._("Nach unten verschieben"). "\">" . Icon::create('arr_2down', 'sort')->asImg(['class' => 'text-top']) . "</a>"; } $bewegeflaeche .= "</span>"; } //Jetzt folgt der Link zum Aufklappen if ($open[$folder_id]) { //print "<td width=1px class=\"printhead\"> </td>"; print "<td id=\"folder_".$folder_id."_arrow_td\" nowrap valign=\"top\" align=\"left\" width=1% bgcolor=\"$timecolor\" class=\"printhead3\" valign=\"bottom\">"; print "<a href=\"".URLHelper::getLink("?close=".$folder_id."#anker"); print "\" class=\"tree\" onClick=\"return STUDIP.Filesystem.changefolderbody('".$folder_id."')\">"; print Assets::img('forumgraurunt2.png', tooltip2(_('Objekt zuklappen')) + array('id' => 'folder_' . $folder_id . '_arrow_img')); print "</a>"; print "</td>"; //print ($javascriptok ? "<td class=\"printhead\"><a href=\"Javascript: changefolderbody('".$folder_id."')\" class=\"tree\"><span id=\"folder_".$folder_id."_header\" style=\"font-weight: bold\">" : print "<td class=\"printhead\" valign=\"bottom\">"; if ($move && ($move != $folder_id) && $folder_tree->isWritable($folder_id, $user->id) && (!$folder_tree->isFolder($move) || ($folder_tree->checkCreateFolder($folder_id, $user->id) && !$folder_tree->isExerciseFolder($folder_id, $user->id)))){ print "<a href=\"".URLHelper::getLink("?open=".$folder_id."_md_")."\">"; print Icon::create('arr_2right', 'sort')->asImg(); print "</a> "; } if (($anchor_id == $folder_id) || (($move == $folder_id))) { print "<a name=\"anker\"></a>"; } print "<a href=\"".URLHelper::getLink("?close=".$folder_id."#anker")."\" class=\"tree\" onClick=\"return STUDIP.Filesystem.changefolderbody('".$folder_id."')\"><span id=\"folder_".$folder_id."_header\" style=\"font-weight: bold\">"; } else { //print "<td width=1px class=\"printhead\"> </td>"; print "<td id=\"folder_".$folder_id."_arrow_td\" nowrap valign=\"top\" align=\"left\" width=1% bgcolor=\"$timecolor\" class=\"printhead2\" valign=\"bottom\">"; print "<a href=\""; print URLHelper::getLink("?open=".$folder_id."#anker"); print "\" class=\"tree\" onClick=\"return STUDIP.Filesystem.changefolderbody('".$folder_id."')\">"; print Assets::img('forumgrau2.png', tooltip2(_('Objekt aufklappen')) + array('id' => 'folder_' . $folder_id . '_arrow_img')); print "</a></td>"; print "<td class=\"printhead\" valign=\"bottom\">"; if ($move && ($move != $folder_id) && $folder_tree->isWritable($folder_id, $user->id) && (!$folder_tree->isFolder($move) || ($folder_tree->checkCreateFolder($folder_id, $user->id) && !$folder_tree->isExerciseFolder($folder_id, $user->id)))){ print " <a href=\"".URLHelper::getLink("?open=".$folder_id."_md_")."\">"; print Icon::create('arr_2right', 'sort')->asImg(); print "</a> "; } print "<a href=\"".URLHelper::getLink("?open=".$folder_id."#anker")."\" class=\"tree\" " . "onClick=\"return STUDIP.Filesystem.changefolderbody('".$folder_id."')\"><span id=\"folder_".$folder_id."_header\" " . "style=\"font-weight: normal\">"; } $document_count = doc_count($folder_id); if ($document_count > 0) { print Icon::create('folder-full', 'clickable')->asImg() . ' '; } else { print Icon::create('folder-empty', 'clickable')->asImg() . ' '; } //Pfeile, wenn Datei bewegt werden soll if ($move && ($folder_id != $move) && $folder_tree->isWritable($folder_id, $user->id) && (!$folder_tree->isFolder($move) || ($folder_tree->checkCreateFolder($folder_id, $user->id) && !$folder_tree->isExerciseFolder($folder_id, $user->id)))){ print "</a><span class=\"move_arrows\"><a href=\"".URLHelper::getLink("?open=".$folder_id."_md_")."\">"; print Icon::create('arr_2right', 'sort')->asImg(); print "</a></span>"; if ($open[$folder_id]) print "<a href=\"".URLHelper::getLink("?close=".$folder_id."#anker")."\" class=\"tree\" onClick=\"return STUDIP.Filesystem.changefolderbody('".$folder_id."')\">"; else print "<a href=\"".URLHelper::getLink("?open=".$folder_id."#anker")."\" class=\"tree\" onClick=\"return STUDIP.Filesystem.changefolderbody('".$folder_id."')\">"; } //Dateiname, Rechte und Dokumente anzeigen $tmp_titel = htmlReady(mila($result['name'])); if ($isissuefolder) { $issue_id = $db->query("SELECT range_id FROM folder WHERE folder_id = ".$db->quote($folder_id))->fetch(); $dates_for_issue = IssueDB::getDatesforIssue($issue_id['range_id']); $dates_title = array(); foreach ($dates_for_issue as $date) { $dates_title[] .= date('d.m.y, H:i', $date['date']).' - '.date('H:i', $date['end_time']); } if (!empty($dates_title)) { $tmp_titel = sprintf(_("Sitzung am: %s"), implode(', ', $dates_title)) . ", " . ($tmp_titel ? $tmp_titel : _("Ohne Titel")); } else { $tmp_titel = $tmp_titel ? $tmp_titel : _("Ohne Titel"); } } if (($change == $folder_id) && (!$isissuefolder) && ((count($folder_tree->getParents($folder_id)) > 1) || $result['range_id'] == md5($SessSemName[1] . 'top_folder') || $folder_tree->isGroupFolder($result['folder_id']) ) ) { //Aenderungsmodus, Anker + Formular machen, Font tag direkt ausgeben (muss ausserhalb einer td stehen! $titel= "</a><input style=\"font-size:8 pt; width: 400px;\" type=\"text\" size=\"20\" maxlength=\"255\" aria-label=\"Ordnername eingeben\" name=\"change_name\" value=\"".htmlReady($result['name'])."\" >"; if ($rechte && $folder_tree->permissions_activated) $titel .= ' ['.$folder_tree->getPermissionString($result["folder_id"]).']'; } else { //create a link onto the titel, too if ($rechte && $folder_tree->permissions_activated ) { $tmp_titel .= ' '; $tmp_titel .= '['.$folder_tree->getPermissionString($result["folder_id"]).']'; } if ($document_count > 1) $titel= $tmp_titel."</span> " . sprintf(_("(%s Dokumente)"), $document_count); elseif ($document_count) $titel= $tmp_titel."</span> " . _("(1 Dokument)"); else $titel= $tmp_titel; } print $titel; if ($isissuefolder) { $dates_title = array(); foreach ($dates_for_issue as $date) { $dates_title[] .= date('d.m.y, H:i', $date['date']).' - '.date('H:i', $date['end_time']); } if (sizeof($dates_title) > 0) { $title_name = sprintf(_("Sitzung am: %s"), implode(', ', $dates_title)); if (!$result['name']) { $title_name .= ', '._("Ohne Titel"); } else { $title_name .= ', '.htmlReady($result['name']); } } } print "</a> "; // Schloss, wenn Folder gelockt if ($folder_tree->isLockedFolder($folder_id)) { print Icon::create('lock-locked', 'inactive', ['title' => _('Dieser Ordner ist gesperrt.')])->asImg(['class' => 'text-bottom']); } //Wenn verdeckt durch gesperrten übergeordneten Ordner else if ( ($super_folder = $folder_tree->getNextSuperFolder($folder_id)) ) { print Icon::create('lock-locked', 'inactive', ['title' => _('Dieser Ordner ist nicht zugänglich, da ein übergeordneter Ordner gesperrt ist.')])->asImg(['class' => 'text-bottom']); } // Wenn es ein Hausaufgabenordner ist if ($folder_tree->isExerciseFolder($folder_id)) { print Icon::create('edit', 'inactive', ['title' => _('Dieser Ordner ist ein Hausaufgabenordner. Es können nur Dateien eingestellt werden.')])->asImg(['class' => 'text-bottom']); } print "</td>"; //So und jetzt die rechtsbündigen Sachen: print "</td><td align=right class=\"printhead\" valign=\"bottom\">"; print "<a href=\"".URLHelper::getLink('dispatch.php/profile?username='******'username'])."\">".htmlReady($result['fullname'])."</a> "; print $bewegeflaeche." "; //Workaround for older data from previous versions (chdate is 0) print date("d.m.Y - H:i", (($result["chdate"]) ? $result["chdate"] : $result["mkdate"])); print "</td></tr></table>"; //Ende des Titels, Beschreibung und Knöpfen if ($rechte) print "</div>"; //End des Droppable-Divs if ($open[$folder_id]) { print "<div id=\"folder_".$folder_id."_body\">"; //Der ganze Teil des Unterbaus wurde in die folgende Funktion outsourced: display_folder_body($folder_id, $open, $change, $move, $upload, $refresh, $filelink, $anchor_id, $depth - 3); } else { print "<div id=\"folder_".$folder_id."_body\" style=\"display: none\">"; } print "</div></td></tr></table>"; print "</div>"; }
/** * change existing cycledate, changes also corresponding single dates * * @param array assoc, see CycleData, metadate_id must be in $data['cycle_id'] * @return number|boolean */ function editCycle($data = array()) { $cycle = $this->cycles[$data['cycle_id']]; $new_start = mktime((int) $data['start_stunde'], (int) $data['start_minute']); $new_end = mktime((int) $data['end_stunde'], (int) $data['end_minute']); $old_start = mktime($cycle->getStartStunde(), $cycle->getStartMinute()); $old_end = mktime($cycle->getEndStunde(), $cycle->getEndMinute()); if ($new_start >= $old_start && $new_end <= $old_end && $data['day'] == $cycle->day && $data['endWeek'] == $cycle->end_offset) { // Zeitraum wurde verkuerzt, Raumbuchungen bleiben erhalten... if ($this->setCycleData($data, $cycle)) { $termine = $cycle->getSingleDates(); foreach ($termine as $key => $val) { $tos = $val->getStartTime(); $toe = $val->getEndTime(); if ($toe > time()) { $t_start = mktime((int) $data['start_stunde'], (int) $data['start_minute'], 0, date('m', $tos), date('d', $tos), date('Y', $tos)); $t_end = mktime((int) $data['end_stunde'], (int) $data['end_minute'], 0, date('m', $toe), date('d', $toe), date('Y', $toe)); $termine[$key]->setTime($t_start, $t_end); $termine[$key]->store(); } else { unset($termine[$key]); } } $this->sortCycleData(); } return sizeof($termine); } else { if ($this->setCycleData($data, $cycle)) { // collect all existing themes (issues) for this cycle: $issues = array(); $issue_objects = array(); $singledate_count = 0; // loop through the single dates and look for themes (issues) $termine = $cycle->getSingleDates(); foreach ($termine as $key => $termin) { // get all isues of this date ( zero, one, or more, if the expert view is activated) // and store them at the relative position of this single date $issues[$singledate_count] = $termin->getIssueIDs(); $singledate_count++; } // remove all SingleDates in the future for this CycleData $count = CycleDataDB::deleteNewerSingleDates($data['cycle_id'], time(), true); // create new SingleDates $this->createSingleDates(array('metadate_id' => $cycle->getMetaDateId(), 'startAfterTimeStamp' => time())); // clear all loaded SingleDates so no odd ones remain. The Seminar-Class will load them fresh when needed $cycle->termine = NULL; // read all new single dates $termine = $cycle->getSingleDates(); // new dates counter $new_singledate_count = 0; // loop through the single dates and add the themes (issues) foreach ($termine as $key => $termin) { // check, if there are issues for this single date if ($issues[$new_singledate_count] != NULL) { // add all issues: foreach ($issues[$new_singledate_count] as $issue_key => $issue_id) { $termin->addIssueID($issue_id); $termin->store(); } } unset($issues[$new_singledate_count]); $new_singledate_count++; } // delete issues, that are not assigned to a single date because of to few dates // (only if the schedule expert view is off) if (!Config::get()->RESOURCES_ENABLES_EXPERT_SCHEDULE_VIEW) { if ($new_singledate_count < $singledate_count) { for ($i = $new_singledate_count; $i < $singledate_count; $i++) { if ($issues[$i] != NULL) { foreach ($issues[$i] as $issue_id) { // delete this issue IssueDB::deleteIssue($issue_id); } } } } } $this->sortCycleData(); return $count; } } return FALSE; }
function isIssue($issue_id) { return IssueDB::isIssue($issue_id); }