예제 #1
0
 /**
  * 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);
         }
     }
 }
예제 #2
0
파일: datei.inc.php 프로젝트: ratbird/hope
/**
 * 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\">&nbsp;</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>&nbsp;";
        }
        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\">&nbsp;</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 "&nbsp;<a href=\"".URLHelper::getLink("?open=".$folder_id."_md_")."\">";
            print Icon::create('arr_2right', 'sort')->asImg();
            print "</a>&nbsp";
        }
        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() . '&nbsp;';
    } else {
        print Icon::create('folder-empty', 'clickable')->asImg() . '&nbsp;';
    }

    //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 .= '&nbsp;['.$folder_tree->getPermissionString($result["folder_id"]).']';
    }   else {
        //create a link onto the titel, too
        if ($rechte && $folder_tree->permissions_activated ) {
            $tmp_titel .= '&nbsp;';
            $tmp_titel .= '['.$folder_tree->getPermissionString($result["folder_id"]).']';
        }
        if ($document_count > 1)
            $titel= $tmp_titel."</span>&nbsp;&nbsp;" . sprintf(_("(%s Dokumente)"), $document_count);
        elseif ($document_count)
            $titel= $tmp_titel."</span>&nbsp;&nbsp;" . _("(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>&nbsp;";

    // 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>";
}
예제 #3
0
 function delete()
 {
     $dates = IssueDB::getDatesforIssue($this->issue_id);
     $titles = array();
     $title = '';
     foreach ($dates as $termin_id => $termin_data) {
         $titles[] = date('d.m.y, H:i', $termin_data['date']) . ' - ' . date('H:i', $termin_data['end_time']);
     }
     if (sizeof($titles) > 0) {
         $title = implode(', ', $titles) . ', ' . $this->getTitle() . ' ' . _("(Thema gelöscht)");
     } else {
         $title = $this->getTitle() . ' ' . _("(Thema gelöscht)");
     }
     $description = _("Dateiordner bezieht sich auf ein nicht mehr vorhandenes Thema.");
     IssueDB::deleteIssue($this->issue_id, $this->seminar_id, $title, $description);
 }