Exemplo n.º 1
0
 function sendFile()
 {
     if (file_exists($this->path . $this->tmp_file_name)) {
         header('Location: ' . GetDownloadLink($this->tmp_file_name, $this->file_name, 2, 'force'));
     } else {
         throw new CalendarExportException(_('Die Export-Datei konnte nicht erstellt werden!'));
     }
 }
Exemplo n.º 2
0
/**
 * Returns an overview of certain documents
 *
 * @param Array $documents Ids of the documents in question
 * @param mixed $open      Array containing open states of documents
 * @return string Overview of documents as html, ready to be displayed
 */
function show_documents($documents, $open = null)
{
    if (!is_array($documents)) {
        return;
    }
    if (!is_null($open) && !is_array($open)) {
        $open = null;
    }
    if (is_array($open)) {
        reset($open);
        $ank = key($open);
    }
    if (!empty($documents)) {
        $query = "SELECT {$GLOBALS['_fullname_sql']['full']} AS fullname, username, user_id,\n                         dokument_id, filename, filesize, downloads, protected, url, description,\n                         IF(IFNULL(name, '') = '', filename, name) AS t_name,\n                         GREATEST(a.chdate, a.mkdate) AS chdate\n                  FROM dokumente AS a\n                  LEFT JOIN auth_user_md5 USING (user_id)\n                  LEFT JOIN user_info USING (user_id)\n                  WHERE dokument_id IN (?)\n                  ORDER BY a.chdate DESC";
        $statement = DBManager::get()->prepare($query);
        $statement->execute(array($documents));
        $documents = $statement->fetchAll(PDO::FETCH_ASSOC);
    }
    foreach ($documents as $index => $document) {
        $type = empty($document['url']) ? 0 : 6;
        $is_open = is_null($open) || $open[$document['dokument_id']] ? 'open' : 'close';
        $extension = getFileExtension($document['filename']);
        // Create icon
        $icon = sprintf('<a href="%s">%s</a>', GetDownloadLink($document['dokument_id'], $document['filename'], $type), GetFileIcon($extension, true)->asImg());
        // Create open/close link
        $link = $is_open === 'open' ? URLHelper::getLink('#dok_anker', array('close' => $document['dokument_id'])) : URLHelper::getLink('#dok_anker', array('open' => $document['dokument_id']));
        // Create title including filesize and number of downloads
        $size = $document['filesize'] > 1024 * 1024 ? sprintf('%u MB', round($document['filesize'] / 1024 / 1024)) : sprintf('%u kB', round($document['filesize'] / 1024));
        $downloads = $document['downloads'] == 1 ? '1 ' . _('Download') : $document['downloads'] . ' ' . _('Downloads');
        $title = sprintf('<a href="%s"%s class="tree">%s</a> (%s / %s)', $link, $ank == $document['dokument_id'] ? ' name="dok_anker"' : '', htmlReady(mila($document['t_name'])), $size, $downloads);
        // Create additional information
        $addon = sprintf('<a href="%s">%s</a> %s', URLHelper::getLink('dispatch.php/profile', array('username' => $document['username'])), $document['fullname'], date('d.m.Y H:i', $document['chdate']));
        if ($document['protected']) {
            $addon = tooltipicon(_('Diese Datei ist urheberrechtlich geschützt!')) . ' ' . $addon;
        }
        if (!empty($document['url'])) {
            $addon .= ' ' . Icon::create('link-extern', 'clickable', ['title' => _('Diese Datei wird von einem externen Server geladen!')])->asImg(16);
        }
        // Attach created variables to document
        $documents[$index]['addon'] = $addon;
        $documents[$index]['extension'] = $extension;
        $documents[$index]['icon'] = $icon;
        $documents[$index]['is_open'] = $is_open;
        $documents[$index]['link'] = $link;
        $documents[$index]['title'] = $title;
        $documents[$index]['type'] = $type;
    }
    $template = $GLOBALS['template_factory']->open('user_activities/files-details');
    $template->documents = $documents;
    return $template->render();
}
Exemplo n.º 3
0
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $items = array();
     $type = get_object_type($course_id, array('sem', 'inst', 'fak'));
     if ($type == 'sem') {
         $query = 'SELECT dokumente.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM dokumente
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN seminar_user USING (Seminar_id)
             JOIN seminare USING (Seminar_id)
             WHERE seminar_user.user_id = ? AND Seminar_id = ? 
                 AND dokumente.chdate > ?';
     } else {
         $query = 'SELECT dokumente.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM dokumente
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN user_inst ON (seminar_id = Institut_id)
             JOIN Institute USING (Institut_id)
             WHERE user_inst.user_id = ? AND Institut_id = ? 
                 AND dokumente.chdate > ?';
     }
     $stmt = DBManager::get()->prepare($query);
     $stmt->execute(array($user_id, $course_id, $since));
     while ($row = $stmt->fetch()) {
         $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $row['seminar_id']));
         if ($folder_tree->isDownloadFolder($row['range_id'], $user_id)) {
             // use correct text depending on type of object
             if ($type == 'sem') {
                 $summary = sprintf('%s hat im Dateibereich der Veranstaltung "%s" die Datei "%s" hochgeladen.', $row['fullname'], $row['Name'], $row['name']);
             } else {
                 $summary = sprintf('%s hat im Dateibereich der Einrichtung "%s" die Datei "%s" hochgeladen.', $row['fullname'], $row['Name'], $row['name']);
             }
             // create ContentElement
             $items[] = new ContentElement(_('Datei') . ': ' . $row['name'], $summary, formatReady(GetDownloadLink($row['dokument_id'], $row['name'])), $row['user_id'], $row['fullname'], URLHelper::getLink('folder.php#anker', array('cid' => $row['seminar_id'], 'cmd' => 'tree', 'open' => $row['dokument_id'])), $row['chdate']);
         }
     }
     return $items;
 }
Exemplo n.º 4
0
function get_flash_player ($document_id, $filename, $type) {
    global $auth;
    // width of image in pixels
    if (is_object($auth) && $auth->auth['xres']) {
        // 50% of x-resolution maximal
        $max_width = floor($auth->auth['xres'] / 4);
    } else {
        $max_width = 400;
    }
    $width = $max_width;
    $height = round($width * 0.75);
    if ($width > 200) {
        $flash_config = $GLOBALS['FLASHPLAYER_DEFAULT_CONFIG_MAX'];
    } else {
        $flash_config = $GLOBALS['FLASHPLAYER_DEFAULT_CONFIG_MIN'];
    }
    $cfg = Config::GetInstance();
    $DOCUMENTS_EMBEDD_FLASH_MOVIES = $cfg->getValue('DOCUMENTS_EMBEDD_FLASH_MOVIES');
    if ($DOCUMENTS_EMBEDD_FLASH_MOVIES == 'autoplay') {
        $flash_config .= '&amp;autoplay=1&amp;autoload=1';
    } else if ($DOCUMENTS_EMBEDD_FLASH_MOVIES == 'autoload') {
        $flash_config .= '&amp;autoload=1';
    }
    // we need the absolute url if the player is delivered from a different base
    $movie_url = GetDownloadLink($document_id, $filename, $type, 'force');
    $flash_object  = "\n<object type=\"application/x-shockwave-flash\" id=\"FlashPlayer\" data=\"".Assets::url()."flash/player_flv.swf\" width=\"$width\" height=\"$height\">\n";
    $flash_object .= "<param name=\"movie\" value=\"".Assets::url()."flash/player_flv.swf\">\n";
    $flash_object .= '<param name="allowFullScreen" value="true">' . "\n";
    $flash_object .= "<param name=\"FlashVars\" value=\"flv=" . urlencode($movie_url) . $flash_config . "\">\n";
    $flash_object .= "<embed src=\"".Assets::url()."flash/player_flv.swf\" movie=\"{$movie_url}\" type=\"application/x-shockwave-flash\" FlashVars=\"flv=".urlencode($movie_url).$flash_config."\">\n";
    $flash_object .= "</object>\n";

    return array('player' => $flash_object, 'width' => $width, 'height' => $height);
}
Exemplo n.º 5
0
        $export_pagecontent .= "<input type=\"hidden\" name=\"xslt_filename\" value=\"" . htmlReady($xslt_filename) . "\">";

        $export_weiter_button = "<br><br><center>" . Button::create('<< ' . _('Zurück'), 'back') . "</center></form>";
        $xml_printimage = '<a href="'. GetDownloadLink($xml_file_id, $xml_filename, 2) .  '">';
        $xml_printimage.= Icon::create($export_icon['xml'], 'clickable');
        $xml_printimage.= '</a>';
        $xml_printlink = '<a href="'. GetDownloadLink($xml_file_id, $xml_filename, 2). '" class="tree">' . htmlReady($xml_filename) . '</a>';
        $xml_printdesc = _("XML-Daten");
        $xml_printcontent = _("In dieser Datei sind die Daten als XML-Tags gespeichert. Diese Tags können mit einem XSLT-Script verarbeitet werden.") . "<br>";
    }

    $infobox = array    (
    array ("kategorie"  => _("Information:"),
        "eintrag" => array  (
                        array ( "icon" => Icon::create('info', 'clickable'),
                                "text"  => $xml_export_text
                             )
                        )
        )
    );
    if ($object_counter > 0)
    {
        $link = '<a href="'. GetDownloadLink($xml_file_id, $xml_filename, 2) .' ">';
        $infobox[1]["kategorie"] = _("Aktionen:");
            $infobox[1]["eintrag"][] = array (  'icon' => Icon::create('download', 'clickable'),
                                        "text"  => sprintf(_("Um die XML-Datei jetzt herunterzuladen klicken Sie %s hier %s."), $link, "</a>")
                                    );
    }

}
Exemplo n.º 6
0
            $export_pagecontent = "";
            $export_error = "<b>" . sprintf(_("Bei der Erzeugung der PDF-Datei ist ein Fehler aufgetreten. <br>Fehlermeldung: %s <br>Datei: %s"), $out, $pdf_file) . "</b><br>";
            $export_error_num ++;
        }

        $xml_printimage = ' <a href="'. GetDownloadLink($xml_file_id, $xml_filename, 2). '">';
        $xml_printimage.= Icon::create($export_icon['xml'], 'clickable')->asImg(['class' => 'text-top']);
        $xml_printimage.= '</a>';
        $xml_printlink = ' <a href="'. GetDownloadLink($xml_file_id, $xml_filename, 2) .  '" class="tree"> ' . $xml_filename . '</a>';
        $xml_printdesc = _("XML-Daten");
        $xml_printcontent = _("In dieser Datei sind die Daten als XML-Tags gespeichert. Diese Tags können mit einem XSLT-Script verarbeitet werden.") . "<br>";

        $xslt_printimage = '<a href="'. GetDownloadLink($result_file,$xslt_filename .'.'. $format,2) . '">';
        $xslt_printimage.= Icon::create($export_icon[$format], 'clickable')->asImg(['class' => 'text-top']);
        $xslt_printimage.= '</a>';
        $xslt_printlink = '<a href="'. GetDownloadLink($result_file,$xslt_filename .'.'. $format,2) . '" class="tree">' . $xslt_filename .'.'. $format . '</a>';
        $xslt_printdesc = _("Formatting-Objects-Datei");
        $xslt_printcontent = _("In dieser Datei sind die Formatting Objects zur Erzeugung der PDF-Datei gespeichert.") . "<br>";


        $infobox = array    (
        array ("kategorie"  => _("Information:"),
            "eintrag" => array  (
                            array ( "icon" => Icon::create('info', 'clickable'),
                                    "text"  => $xslt_info
                                 )
                            )
            )
        );
        {
            $infobox[1]["kategorie"] = _("Aktionen:");
Exemplo n.º 7
0
 function getExportButton($item_id)
 {
     $content = LinkButton::create(_('Export'), GetDownloadLink('', $this->tree->tree_data[$item_id]['name'] . '.txt', 5, 'force', $this->tree->range_id, $item_id), array('title' => _('Export der Liste in EndNote kompatiblem Forma')));
     $content .= '&nbsp;';
     return $content;
 }
Exemplo n.º 8
0
 /**
  * Return URL for downloading the file.
  *
  * @param  string $id  File identifier in database table 'dokumente'.
  * @return string      Download link, NULL if file doesn't exist.
  */
 public function url()
 {
     return \GetDownloadLink($this->studipDocument->getId(), $this->filename());
 }
Exemplo n.º 9
0
                if (!$result['studienbereiche']=='')
                    echo "<li><font size=-1><b>" . _("Bereich:") . " </b>".htmlReady($result['studienbereiche'])."</font></li>";

            // doppelt haelt besser: noch mal die Extras

                if ($view == 1) {
                    echo "<br><br><li><a href=\"". URLHelper::getLink("?dump_id=".$result['seminar_id']) ."\" target=_blank><font size=\"-1\">" . _("Übersicht der Veranstaltungsinhalte") . "</font></a></li>";
                    if (!$result['forumdump']=='')
                        echo "<li><font size=\"-1\"><a href=\"". URLHelper::getLink("?forum_dump_id=".$result['seminar_id']) ."\" target=_blank>" . _("Beiträge des Forums") . "</a></font></li>";
                    if (!$result['wikidump']=='')
                        echo "<li><font size=\"-1\"><a href=\"". URLHelper::getLink("?wiki_dump_id=".$result['seminar_id']) ."\" target=_blank>" . _("Wikiseiten") . "</a></font></li>";
                    if (!$result['archiv_file_id']=='') {
                        echo '<li><font size="-1"><a href="' . URLHelper::getLink(GetDownloadLink($result['archiv_file_id'], $file_name, 1)) .'">' . _("Download der Dateisammlung") . '</a></font></li>';
                    }
                    if ($result['archiv_protected_file_id'] && in_array(archiv_check_perm($result['seminar_id']), words("tutor dozent admin"))) {
                        echo '<li><font size="-1"><a href="' . URLHelper::getLink(GetDownloadLink($result['archiv_protected_file_id'], _("Geschützte-") . $file_name, 1)) .'">' . _("Download der geschützten Dateisammlung") . '</a></font></li>';
                    }
                    if (archiv_check_perm($result['seminar_id']) == "admin")
                        echo "<li><a href=\"". URLHelper::getLink("?delete_id=".$result['seminar_id']) ."\"><font size=\"-1\">" . _("Diese Veranstaltung unwiderruflich aus dem Archiv entfernen") . "</font></a></li>";
                    if (archiv_check_perm($result['seminar_id']) == "admin") {
                        if (!$_SESSION['archiv_data']["edit_grants"])
                            echo "<li><font size=\"-1\"><a href=\"". URLHelper::getLink("?show_grants=yes") ."#anker\">" . _("Zugriffsberechtigungen einblenden") . "</a></font></li>";
                        else
                            echo "<li><font size=\"-1\"><a href=\"". URLHelper::getLink("?hide_grants=yes") ."#anker\">" . _("Zugriffsberechtigungen ausblenden") . "</a></font></li>";
                    }
                } else
                    echo "<br><br><li><font size=\"-1\">" . _("Die Veranstaltungsinhalte, Beiträge im Forum und das Dateiarchiv sind nicht zugängig, da Sie an dieser Veranstaltung nicht teilgenommen haben.") . "</font></li>";

                if ($_SESSION['archiv_data']["edit_grants"]) {
                    echo "<br><br><hr><b><font size=\"-1\">" . _("Folgende Personen haben Zugriff auf die Daten der Veranstaltung (Übersicht, Beiträge und Dateiarchiv):") . "</font></b><br><br>";
                    $query = "SELECT {$_fullname_sql['full']} AS fullname, archiv_user.status, username, user_id
    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;
    }
Exemplo n.º 11
0
 /**
  * Gets the list of applicants for the courses belonging to this course set.
  *
  * @param String $set_id course set ID
  * @param String $csv    export users to file
  */
 public function applications_list_action($set_id, $csv = null)
 {
     if (Request::isXhr()) {
         $this->response->add_header('X-Title', _('Liste der Anmeldungen'));
     }
     $courseset = new CourseSet($set_id);
     $applicants = AdmissionPriority::getPriorities($set_id);
     $users = User::findMany(array_keys($applicants), 'ORDER BY Nachname');
     $courses = SimpleCollection::createFromArray(Course::findMany($courseset->getCourses()));
     $captions = array(_("Nachname"), _("Vorname"), _("Nutzername"), _("Veranstaltung"), _("Nummer"), _("Priorität"));
     $data = array();
     foreach ($users as $user) {
         $row = array();
         $app_courses = $applicants[$user->id];
         asort($app_courses);
         foreach ($app_courses as $course_id => $prio) {
             $row = array();
             $row[] = $user->nachname;
             $row[] = $user->vorname;
             $row[] = $user->username;
             $row[] = $courses->findOneBy('id', $course_id)->name;
             $row[] = $courses->findOneBy('id', $course_id)->veranstaltungsnummer;
             $row[] = $prio;
             if ($csv) {
                 $row[] = $user->email;
             }
             $data[] = $row;
         }
     }
     if ($csv) {
         $tmpname = md5(uniqid('tmp'));
         $captions[] = _("Email");
         if (array_to_csv($data, $GLOBALS['TMP_PATH'] . '/' . $tmpname, $captions)) {
             $this->redirect(GetDownloadLink($tmpname, 'Anmeldungen_' . $courseset->getName() . '.csv', 4, 'force'));
             return;
         }
     }
     $this->captions = $captions;
     $this->data = $data;
     $this->set_id = $courseset->getId();
 }
Exemplo n.º 12
0
function answers($parent_id, $anz_nutzer, $question_type)
{
    global $graph_switch, $auth, $ausgabeformat, $has_template;
    // Rueckgabearray, damit die Daten noch aufzutrennen sind...
    $ret_array = array("id" => $parent_id, "txt" => "", "antwort_texte" => array(), "frage" => "", "has_residual" => 0, "antwort_durchschnitt" => "", "summe_antworten" => "", "anzahl_teilnehmer" => $anz_nutzer, "auswertung" => array());
    $summary = array();
    $query = "SELECT COUNT(*)\n              FROM evalanswer\n              JOIN evalanswer_user USING (evalanswer_id)\n              WHERE parent_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($parent_id));
    $answers_sum = $statement->fetchColumn();
    $antwort_nummer = 0;
    $edit = "";
    $txt = "";
    $gesamte_antworten = 0;
    $antwort_durchschnitt = 0;
    $has_residual = user_answers_residual($parent_id);
    $i = 1;
    $edit .= "<tr class=\"table_row_even\"><td width=\"1%\">&nbsp;</td><td width=\"70%\"><font size=\"-1\"><b>" . _("Antworten") . "</b></font></td><td width=\"29%\"><font size=\"-1\"><b>" . _("Auswertung") . "</b></font></td></tr>\n";
    $query = "SELECT evalanswer_id, `text`, value, residual FROM evalanswer WHERE parent_id = ? ORDER BY position";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($parent_id));
    while ($answer = $statement->fetch(PDO::FETCH_ASSOC)) {
        $antwort_nummer++;
        $answer_counter = user_answers($answer['evalanswer_id']);
        if ($answer['residual'] == 0) {
            $gesamte_antworten += $answer_counter;
            $antwort_durchschnitt += $answer_counter * $antwort_nummer;
        }
        $prozente_wo_residual = 0;
        if ($has_residual && $answers_sum - $has_residual > 0) {
            $prozente_wo_residual = ROUND($answer_counter * 100 / ($anz_nutzer - $has_residual));
        }
        $prozente = 0;
        if ($answers_sum > 0) {
            $prozente = ROUND($answer_counter * 100 / $anz_nutzer);
        }
        $edit .= "<tr " . ($i == 1 ? 'class="content_body"' : '') . "><td width=\"1%\"><font size=\"-1\"><b>" . $antwort_nummer . ".&nbsp;</b></font></td><td width=\"70%\"><font size=\"-1\">" . ($answer['text'] != '' ? formatReady($answer['text']) : $answer['value']) . "</font></td>";
        if ($has_residual) {
            $edit .= "<td width=\"29%\"><font size=\"-1\">" . $answer_counter . " (" . $prozente . "%) " . ($answer['residual'] == 0 ? "(" . $prozente_wo_residual . "%)<b>*</b>" : "") . "</font></td></tr>\n";
        } else {
            $edit .= "<td width=\"29%\"><font size=\"-1\">" . $answer_counter . " (" . $prozente . "%)</font></td></tr>\n";
        }
        array_push($summary, array($antwort_nummer . "(" . $prozente . "%)", $answer_counter));
        array_push($ret_array["antwort_texte"], $answer['text'] != '' ? formatReady($answer['text']) : $answer['value']);
        array_push($ret_array["auswertung"], array($answer_counter, $prozente, $answer['residual'] == 0 ? $prozente_wo_residual : null));
        if ($has_residual) {
            $ret_array["has_residual"] = 1;
        }
        $i = 0;
    }
    do_graph($summary, $parent_id);
    if ($gesamte_antworten > 0 && $antwort_durchschnitt > 0) {
        $antwort_durchschnitt = ROUND($antwort_durchschnitt / $gesamte_antworten, 3);
    }
    $ret_array["antwort_durchschnitt"] = $antwort_durchschnitt;
    $ret_array["summe_antworten"] = $gesamte_antworten;
    $txt .= "  <tr>\n";
    $txt .= "    <td width=\"70%\" valign=\"TOP\">\n";
    $txt .= "      <table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
    $txt .= $edit . "\n";
    $txt .= "        <tr class=\"blank\"><td colspan=\"3\"><font size=\"-1\">&nbsp;</font></td></tr>";
    $txt .= "        <tr class=\"blank\"><td colspan=\"3\"><font size=\"-1\"><b>&#x2211;</b>=" . $gesamte_antworten . " " . _("Antworten") . "</font></td></tr>";
    $txt .= "        <tr class=\"blank\">";
    if ($question_type == "multiplechoice") {
        $txt .= "        <td colspan=\"3\">";
    } else {
        $txt .= "<td colspan=\"2\"><font size=\"-1\"><b>&#x2205;</b>-" . _("Antwort") . ": " . $antwort_durchschnitt . ($has_residual == 0 ? "" : "<b>*</b>") . "</font></td><td>";
    }
    $txt .= "          <font size=\"-1\">" . _("Anzahl der Teilnehmer") . ": " . $anz_nutzer . "</font></td></tr>";
    if ($has_residual) {
        $txt .= "        <tr class=\"blank\"><td colspan=\"3\"><font size=\"-1\"><b>*</b>" . _("Werte ohne Enthaltungen") . ".</font></td></tr>";
    }
    $txt .= "      </table>";
    $txt .= "    </td>\n";
    $txt .= "    <td width=\"30%\" valign=\"TOP\" align=\"RIGHT\">\n";
    if (do_template("show_graphics")) {
        $txt .= '<IMG SRC="' . GetDownloadLink('evalsum' . $parent_id . $auth->auth['uid'] . '.' . Config::get()->EVAL_AUSWERTUNG_GRAPH_FORMAT, 'evalsum' . $parent_id . $auth->auth['uid'] . '.' . Config::get()->EVAL_AUSWERTUNG_GRAPH_FORMAT, 2) . '">' . "\n";
    } else {
        $txt .= "&nbsp;\n";
    }
    $txt .= "    </td>\n";
    $txt .= "  </tr>\n";
    $ret_array['txt'] = $txt;
    return $ret_array;
}
Exemplo n.º 13
0
 /**
  * Shows a list of courses with restricted participant numbers.
  */
 function index_action()
 {
     $actions = new ActionsWidget();
     $actions->addLink(_("Export"), $this->link_for('admission/restricted_courses', array('csv' => 1)), Icon::create('file-excel+export', 'clickable'));
     Sidebar::get()->addWidget($actions);
     Sidebar::get()->setImage('sidebar/admin-sidebar.png');
     $sem_condition = "";
     foreach (words('current_institut_id sem_name_prefix') as $param) {
         $this->{$param} = $_SESSION[get_class($this)][$param];
     }
     if (Request::isPost()) {
         if (Request::submitted('choose_institut')) {
             $this->current_institut_id = Request::option('choose_institut_id');
             $this->current_semester_id = Request::option('select_semester_id');
             $this->sem_name_prefix = trim(Request::get('sem_name_prefix'));
         }
     }
     if (!$this->current_institut_id) {
         $this->current_institut_id = 'all';
     }
     if (!$this->current_semester_id) {
         $this->current_semester_id = $_SESSION['_default_sem'];
     } else {
         $_SESSION['_default_sem'] = $this->current_semester_id;
     }
     $semester = Semester::find($this->current_semester_id);
     $sem_condition .= "AND seminare.start_time <=" . (int) $semester["beginn"] . " AND (" . (int) $semester["beginn"] . " <= (seminare.start_time + seminare.duration_time) OR seminare.duration_time = -1) ";
     if ($this->sem_name_prefix) {
         $sem_condition .= sprintf('AND (seminare.Name LIKE %1$s OR seminare.VeranstaltungsNummer LIKE %1$s) ', DBManager::get()->quote($this->sem_name_prefix . '%'));
     }
     if ($GLOBALS['perm']->have_perm('dozent')) {
         $this->my_inst = $this->get_institutes($sem_condition);
     }
     $this->courses = $this->get_courses($sem_condition);
     foreach (words('current_institut_id sem_name_prefix') as $param) {
         $_SESSION[get_class($this)][$param] = $this->{$param};
     }
     if (Request::get('csv')) {
         $captions = array(_("Anmeldeset"), _("Nummer"), _("Name"), _("max. Teilnehmer"), _("Teilnehmer aktuell"), _("Anzahl Anmeldungen"), _("Anzahl vorl. Anmeldungen"), _("Anzahl Warteliste"), _("Platzverteilung"), _("Startzeitpunkt"), _("Endzeitpunkt"));
         $data = array();
         foreach ($this->courses as $course) {
             $row = array();
             $row[] = $course['cs_name'];
             $row[] = $course['course_number'];
             $row[] = $course['course_name'];
             $row[] = (int) $course['admission_turnout'];
             $row[] = $course['count_teilnehmer'] + $course['count_prelim'];
             $row[] = (int) $course['count_prelim'];
             $row[] = (int) $course['count_waiting'];
             $row[] = (int) $course['count_claiming'];
             $row[] = $course['distribution_time'] ? strftime('%x %R', $course['distribution_time']) : '';
             $row[] = $course['start_time'] ? strftime('%x %R', $course['start_time']) : '';
             $row[] = $course['end_time'] ? strftime('%x %R', $course['end_time']) : '';
             $data[] = $row;
         }
         $tmpname = md5(uniqid('tmp'));
         if (array_to_csv($data, $GLOBALS['TMP_PATH'] . '/' . $tmpname, $captions)) {
             $this->redirect(GetDownloadLink($tmpname, 'teilnahmebeschraenkteVeranstaltungen.csv', 4, 'force'));
             return;
         }
     }
     if (is_array($this->not_distributed_coursesets)) {
         PageLayout::postMessage(MessageBox::info(_("Es existieren Anmeldesets, die zum Zeitpunkt der Platzverteilung nicht gelost wurden. Stellen Sie sicher, dass der Cronjob \"Losverfahren überprüfen\" ausgeführt wird."), array_unique($this->not_distributed_coursesets)));
     }
 }
Exemplo n.º 14
0
    $export_info = _("Die benötigten Dateien liegen nun zum Download bereit.");
    $export_pagecontent .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">";
    $export_pagecontent .= CSRFProtection::tokenTag();

    $xml_printimage = '<a href="'. GetDownloadLink($xml_file_id, $xml_filename, 2) . '">';
    $xml_printimage.= Icon::create($export_icon['xml'], 'clickable')->asImg(['class' => 'text-top']);
    $xml_printimage.= '</a>';
    $xml_printlink = '<a href="' . GetDownloadLink($xml_file_id, $xml_filename, 2) . '">' . htmlReady($xml_filename) . '</a>';
    $xml_printdesc = _("XML-Daten");
    $xml_printcontent = _("In dieser Datei sind die Daten als XML-Tags gespeichert. Diese Tags können mit einem XSLT-Script verarbeitet werden.") . "<br>";

    $xslt_printimage = '<a href="' . GetDownloadLink( $xslt_files[$choose]['file'], $xslt_files[$choose]['name'] . '.xsl', 3). '">';
    $xslt_printimage.= Icon::create($export_icon['xslt'], 'clickable')->asImg(['class' => 'text-top']);
    $xslt_printimage.= '</a>';
    $xslt_printlink = '<a href="'.GetDownloadLink( $xslt_files[$choose]['file'], $xslt_files[$choose]['name'] . '.xsl', 3).'">' . $xslt_files[$choose]['name'] . '.xsl</a>';
    $xslt_printdesc = _("XSLT-Datei");
    $xslt_printcontent = _("Dies ist das XSLT-Script zur Konvertierung der Daten. Klicken Sie auf den Dateinamen, um die Datei zu öffnen.") . "<br>";

    $export_pagecontent .= "";
    $export_pagecontent .= "<input type=\"hidden\" name=\"page\" value=\"3\">";
    $export_pagecontent .= "<input type=\"hidden\" name=\"choose\" value=\"" . htmlReady($choose) . "\">";
    $export_pagecontent .= "<input type=\"hidden\" name=\"format\" value=\"" . htmlReady($format) . "\">";
    $export_pagecontent .= "<input type=\"hidden\" name=\"o_mode\" value=\"" . htmlReady($o_mode) . "\">";
    $export_pagecontent .= "<input type=\"hidden\" name=\"ex_type\" value=\"" . htmlReady($ex_type) . "\">";
    $export_pagecontent .= "<input type=\"hidden\" name=\"ex_sem\" value=\"" . htmlReady($ex_sem) . "\">";
    foreach(array_keys($ex_sem_class) as $semclassid){
        $export_pagecontent .= "<input type=\"hidden\" name=\"ex_sem_class[". htmlReady($semclassid) ."]\" value=\"1\">";
    }
    $export_pagecontent .= "<input type=\"hidden\" name=\"range_id\" value=\"" . htmlReady($range_id) . "\">";
    $export_pagecontent .= "<input type=\"hidden\" name=\"xml_file_id\" value=\"" . htmlReady($xml_file_id) . "\">";
Exemplo n.º 15
0
            <td valign="middle"><label>
              <input type="submit" name="Submit" value="Get download link" />
            </label></td>
          </tr>
        </table>
      </form></td>
    </tr>
    <tr>
      <td height="16" align="center" valign="top">&nbsp;</td>
    </tr>
    <tr>
      <td align="center" valign="top">
Click on the hyperlink to download the video:
<?php 
include_once "generic-vids-downloader-v2.1.php";
echo GetDownloadLink();
?>
      </td>
    </tr>
  </table>
</div><script type="text/javascript">

</script><script type="text/javascript">

</script><script type="text/javascript">

</script>
</body>
</html><?php 
global $ob_starting;
if (!$ob_starting) {
Exemplo n.º 16
0
            <br>
            <?php 
echo sprintf(_('<b>Dateigröße:</b> %u kB '), round($document['filesize'] / 1024));
?>
            <?php 
echo sprintf(_('<b>Dateiname:</b> %s '), $document['filename']);
?>

        <? if ($document['protected']): ?>
            <?php 
echo MessageBox::info(_('Diese Datei ist urheberrechtlich geschützt'), array(_('Sie darf nur im Rahmen dieser Veranstaltung verwendet werden, jede weitere ' . 'Verbreitung ist strafbar!')));
?>
        <? endif; ?>
            <div style="text-align: center;">
                <div class="button-group">
                    <?php 
echo Studip\LinkButton::create(_('Herunterladen'), GetDownloadLink($document['dokument_id'], $document['filename'], $document['type'], 'force'));
?>
                <? if ($type != 6 && !in_array($document['extension'], words('bz2 gzip tgz zip'))): ?>
                    <?php 
echo Studip\LinkButton::create(_('Als ZIP herunterladen'), GetDownloadLink($document['dokument_id'], $document['filename'], $document['type'], 'zip'));
?>
                <? endif; ?>
                </div>
            </div>
        </td>
    </tr>
    <? endif; ?>
</table>
<? endforeach; ?>
Exemplo n.º 17
0
 /**
  * Export action
  */
 public function export_csv_action()
 {
     $filter_config = $this->getFilterConfig();
     unset($filter_config['contents']);
     if (empty($filter_config)) {
         return;
     }
     $sortby = $GLOBALS['user']->cfg->getValue('MEINE_SEMINARE_SORT');
     $config_my_course_type_filter = $GLOBALS['user']->cfg->getValue('MY_COURSES_TYPE_FILTER');
     $courses = $this->getCourses(array('sortby' => $sortby, 'sortFlag' => 'asc', 'typeFilter' => $config_my_course_type_filter, 'view_filter' => $filter_config));
     $view_filters = $this->getViewFilters();
     $data = array();
     foreach ($courses as $course_id => $course) {
         $sem = new Seminar(Course::buildExisting($course));
         $row = array();
         if (in_array('number', $filter_config)) {
             $row['number'] = $course['VeranstaltungsNummer'];
         }
         if (in_array('name', $filter_config)) {
             $row['name'] = $course['Name'];
         }
         if (in_array('type', $filter_config)) {
             $row['type'] = sprintf('%s: %s', $sem->getSemClass()['name'], $sem->getSemType()['name']);
         }
         if (in_array('room_time', $filter_config)) {
             $_room = $sem->getDatesExport(array('semester_id' => $this->semester->id, 'show_room' => true));
             $row['room_time'] = $_room ?: _('nicht angegeben');
         }
         if (in_array('teachers', $filter_config)) {
             $row['teachers'] = implode(', ', array_map(function ($d) {
                 return $d['fullname'];
             }, $course['dozenten']));
         }
         if (in_array('members', $filter_config)) {
             $row['members'] = $course['teilnehmer'];
         }
         if (in_array('waiting', $filter_config)) {
             $row['waiting'] = $course['waiting'];
         }
         if (in_array('preliminary', $filter_config)) {
             $row['preliminary'] = $course['prelim'];
         }
         $data[$course_id] = $row;
     }
     $captions = array();
     foreach ($filter_config as $index) {
         $captions[$index] = $view_filters[$index];
     }
     $tmpname = md5(uniqid('Veranstaltungsexport'));
     if (array_to_csv($data, $GLOBALS['TMP_PATH'] . '/' . $tmpname, $captions)) {
         $this->redirect(GetDownloadLink($tmpname, 'Veranstaltungen_Export.csv', 4, 'force'));
         return;
     }
 }
Exemplo n.º 18
0
 function callSafeguard($evalAction, $evalID = "", $showrangeID = NULL, $search = NULL, $referer = NULL)
 {
     global $perm, $auth, $user;
     if (!($evalAction || $evalAction == "search")) {
         return " ";
     }
     if (!$perm->have_studip_perm("tutor", $showrangeID) && $user->id != $showrangeID && !(isDeputyEditAboutActivated() && isDeputy($user->id, $showrangeID, true))) {
         return $this->createSafeguard("ausruf", sprintf(_("Sie haben keinen Zugriff auf diesen Bereich.")));
     }
     $evalDB = new EvaluationDB();
     $evalChanged = NULL;
     $safeguard = " ";
     /* Actions without any permissions ---------------------------------- */
     switch ($evalAction) {
         case "search_template":
             $search = trim($search);
             $templates = $evalDB->getPublicTemplateIDs($search);
             if (strlen($search) < EVAL_MIN_SEARCHLEN) {
                 $report = EvalCommon::createReportMessage(sprintf(_("Bitte einen Suchbegriff mit mindestens %d Buchstaben eingeben."), EVAL_MIN_SEARCHLEN), EVAL_PIC_ERROR, EVAL_CSS_ERROR);
             } elseif (count($templates) == 0) {
                 $report = EvalCommon::createReportMessage(_("Es wurden keine passenden öffentlichen Evaluationsvorlagen gefunden."), EVAL_PIC_ERROR, EVAL_CSS_ERROR);
             } else {
                 $report = EvalCommon::createReportMessage(sprintf(_("Es wurde(n) %d passende öffentliche Evaluationsvorlagen gefunden."), count($templates)), EVAL_PIC_SUCCESS, EVAL_CSS_SUCCESS);
             }
             $safeguard .= $report->createContent();
             return $safeguard;
         case "export_request":
             /* Check permissions ------------------------------------------- */
             $haveNoPerm = YES;
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_NO_CHILDREN);
             $haveNoPerm = EvaluationObjectDB::getEvalUserRangesWithNoPermission($eval);
             if ($haveNoPerm == YES) {
                 $report = EvalCommon::createReportMessage(_("Sie haben nicht die Berechtigung diese Evaluation zu exportieren."), EVAL_PIC_ERROR, EVAL_CSS_ERROR);
                 return $report->createContent();
             }
             /* -------------------------------------- end: check permissions */
             /* Export evaluation ------------------------------------------- */
             $exportManager = new EvaluationExportManagerCSV($evalID);
             $exportManager->export();
             /* -------------------------------------- end: export evaluation */
             /* Create link ------------------------------------------------- */
             $link = new HTML("a");
             $link->addAttr('href', GetDownloadLink($exportManager->getTempFilename(), $exportManager->getFilename(), 2));
             $link->addHTMLContent(GetFileIcon('csv')->asImg());
             $link->addContent(_("auf diese Verknüpfung"));
             /* -------------------------------------------- end: create link */
             /* Create report ----------------------------------------------- */
             if ($exportManager->isError()) {
                 $report = EvalCommon::createErrorReport($exportManager, _("Fehler beim Exportieren"));
             } else {
                 $report = EvalCommon::createReportMessage(_("Die Daten wurden erfolgreich exportiert. Sie können die Ausgabedatei jetzt herunterladen."), EVAL_PIC_SUCCESS, EVAL_CSS_SUCCESS);
                 $report = $report->createContent();
                 $report .= sprintf(_("Bitte klicken Sie %s um die Datei herunter zu laden.") . "<br><br>", $link->createContent());
             }
             $safeguard .= $report;
             /* ------------------------------------------ end: create report */
             return $safeguard;
     }
     /* ----------------------------------- end: actions without permissions */
     $eval = new Evaluation($evalID, NULL, EVAL_LOAD_NO_CHILDREN);
     $evalName = htmlready($eval->getTitle());
     /* Check for errors while loading ------------------------------------- */
     if ($eval->isError()) {
         EvalCommon::createErrorReport($eval);
         return $this->createSafeguard("", EvalCommon::createErrorReport($eval));
     }
     /* -------------------------------------- end: errorcheck while loading */
     /* Check for permissions in all ranges of the evaluation -------------- */
     if (!$eval->isTemplate() && $user->id != $eval->getAuthorID()) {
         $no_permisson = EvaluationObjectDB::getEvalUserRangesWithNoPermission($eval);
         if ($no_permisson > 0) {
             if ($no_permisson == 1) {
                 $no_permission_msg .= sprintf(_("Die Evaluation <b>%s</b> ist einem Bereich zugeordnet, für den Sie keine Veränderungsrechte besitzen."), $evalName);
             } else {
                 $no_permission_msg .= sprintf(_("Die Evaluation <b>%s</b> ist %s Bereichen zugeordnet, für die Sie keine Veränderungsrechte besitzen."), $evalName, $no_permisson);
             }
             if ($evalAction != "save") {
                 $no_permission_msg .= " " . _("Der Besitzer wurde durch eine systeminterne Nachricht informiert.");
                 $sms = new messaging();
                 $sms->insert_message(sprintf(_("Benutzer **%s** hat versucht eine unzulässige Änderung an Ihrer Evaluation **%s** vorzunehmen."), get_username($auth->auth["uid"]), $eval->getTitle()), get_username($eval->getAuthorID()), "____%system%____", FALSE, FALSE, "1", FALSE, _("Versuchte Änderung an Ihrer Evaluation"));
             }
         }
     } else {
         if ($eval->isTemplate() && $user->id != $eval->getAuthorID() && $evalAction != "copy_public_template" && $evalAction != "search_showrange") {
             $sms = new messaging();
             $sms->insert_message(sprintf(_("Benutzer **%s** hat versucht eine unzulässige Änderung an Ihrem Template **%s** vorzunehmen."), get_username($auth->auth["uid"]), $eval->getTitle()), get_username($eval->getAuthorID()), "____%system%____", FALSE, FALSE, "1", FALSE, _("Versuchte Änderung an Ihrem Template"));
             return $this->createSafeguard("ausruf", sprintf(_("Sie besitzen keine Rechte für das Tempate <b>%s</b>. Der Besitzer wurde durch eine systeminterne Nachricht informiert."), $evalName));
         }
     }
     /* ----------------------------------------- end: check for permissions */
     switch ($evalAction) {
         case "share_template":
             if ($eval->isShared()) {
                 $eval->setShared(NO);
                 $eval->save();
                 if ($eval->isError()) {
                     $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                     return $safeguard;
                 }
                 $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluationsvorlage <b>%s</b> kann jetzt nicht mehr von anderen Benutzern gefunden werden."), $evalName));
             } else {
                 $eval->setShared(YES);
                 $eval->save();
                 if ($eval->isError()) {
                     $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                     return $safeguard;
                 }
                 $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluationsvorlage <b>%s</b> kann jetzt von anderen Benutzern gefunden werden."), $evalName));
             }
             break;
         case "copy_public_template":
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $newEval = $eval->duplicate();
             $newEval->setAuthorID($auth->auth["uid"]);
             $newEval->setShared(NO);
             $newEval->setStartdate(NULL);
             $newEval->setStopdate(NULL);
             $newEval->setTimespan(NULL);
             $newEval->removeRangeIDs();
             $newEval->save();
             if ($newEval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($newEval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die öffentliche Evaluationsvorlage <b>%s</b> wurde zu den eigenen Evaluationsvorlagen kopiert."), $evalName));
             break;
         case "start":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht gestartet."));
             }
             $eval->setStartdate(time() - 500);
             $eval->save();
             if ($eval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluation <b>%s</b> wurde gestartet."), $evalName));
             $evalChanged = YES;
             break;
         case "stop":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht beendet."));
             }
             $eval->setStopdate(time());
             $eval->save();
             if ($eval->isError()) {
                 EvalCommon::createErrorReport($eval);
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluation <b>%s</b> wurde beendet."), $evalName));
             $evalChanged = YES;
             break;
         case "continue":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht fortgesetzt."));
             }
             $eval->setStopdate(NULL);
             $eval->setStartdate(time() - 500);
             $eval->save();
             if ($eval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluation <b>%s</b> wurde fortgesetzt."), $evalName));
             $evalChanged = YES;
             break;
         case "restart_request":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht zurücksetzen."));
             }
             $safeguard .= $this->createSafeguard("ausruf", sprintf(_("Die Evaluation <b>%s</b> wirklich zurücksetzen? Dabei werden alle bisher abgegebenen Antworten gelöscht!"), $evalName), "restart_request", $evalID, $showrangeID, $referer);
             break;
         case "restart_confirmed":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht zurücksetzen."));
             }
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $eval->resetAnswers();
             $evalDB->removeUser($eval->getObjectID());
             $eval->setStartdate(NULL);
             $eval->setStopdate(NULL);
             $eval->save();
             if ($eval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluation <b>%s</b> wurde zurückgesetzt."), $evalName));
             $evalChanged = YES;
             break;
         case "restart_aborted":
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluation <b>%s</b> wurde nicht zurückgesetzt."), $evalName), "", "", "", $referer);
             break;
         case "copy_own_template":
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $newEval = $eval->duplicate();
             $newEval->setShared(NO);
             $newEval->save();
             if ($newEval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($newEval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluationsvorlage <b>%s</b> wurde kopiert."), $evalName));
             break;
         case "delete_request":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht gelöscht."));
             }
             $text = $eval->isTemplate() ? sprintf(_("Die Evaluationsvorlage <b>%s </b>wirklich löschen?"), $evalName) : sprintf(_("Die Evaluation <b>%s </b>wirklich löschen?"), $evalName);
             $safeguard .= $this->createSafeguard("ausruf", $text, "delete_request", $evalID, $showrangeID, $referer);
             break;
         case "delete_confirmed":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht gelöscht."));
             }
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $eval->delete();
             if ($eval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $text = $eval->isTemplate() ? _("Die Evaluationsvorlage <b>%s</b> wurde gelöscht.") : _("Die Evaluation <b>%s</b> wurde gelöscht.");
             $safeguard .= $this->createSafeguard("ok", sprintf($text, $evalName), "", "", "", $referer);
             $evalChanged = YES;
             break;
         case "delete_aborted":
             $text = $eval->isTemplate() ? _("Die Evaluationsvorlage <b>%s</b> wurde nicht gelöscht.") : _("Die Evaluation <b>%s</b> wurde nicht gelöscht.");
             $safeguard .= $this->createSafeguard("ok", sprintf($text, $evalName), "", "", "", $referer);
             break;
         case "unlink_delete_aborted":
             $text = _("Die Evaluation <b>%s</b> wurde nicht verändert.");
             $safeguard .= $this->createSafeguard("ok", sprintf($text, $evalName), "", "", "", $referer);
             break;
         case "unlink_and_move":
             if ($no_permission_msg) {
                 return $this->createSafeguard("ausruf", $no_permission_msg . "<br>" . _("Die Evaluation wurde nicht ausgehängt und zu den eigenen Evaluationsvorlagen verschoben."));
             }
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $eval->removeRangeIDs();
             $eval->setAuthorID($auth->auth["uid"]);
             $eval->resetAnswers();
             $evalDB->removeUser($eval->getObjectID());
             $eval->setStartdate(NULL);
             $eval->setStopdate(NULL);
             $eval->save();
             if ($eval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $text = _("Die Evaluation <b>%s</b> wurde aus allen Bereichen ausgehängt und zu den eigenen Evaluationsvorlagen verschoben.");
             $safeguard .= $this->createSafeguard("ok", sprintf($text, $evalName), "", "", "", $referer);
             break;
         case "created":
             $safeguard .= $this->createSafeguard("ok", sprintf(_("Die Evaluation <b>%s</b> wurde angelegt."), $evalName));
             break;
         case "save2":
         case "save":
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $update_message = sprintf(_("Die Evaluation <b>%s</b> wurde mit den Veränderungen gespeichert."), $evalName);
             /* Timesettings ---------------------------------------------------- */
             if (Request::option("startMode")) {
                 switch (Request::option("startMode")) {
                     case "manual":
                         $startDate = NULL;
                         break;
                     case "timeBased":
                         $startDate = EvalCommon::date2timestamp(Request::int("startDay"), Request::int("startMonth"), Request::int("startYear"), Request::int("startHour"), Request::int("startMinute"));
                         break;
                     case "immediate":
                         $startDate = time() - 1;
                         break;
                 }
                 if ($no_permission_msg && $eval->getStartdate != $startDate) {
                     $time_msg = $no_permission_msg . "<br>" . _("Die Einstellungen zur Startzeit wurden nicht verändert.");
                 }
             }
             if (Request::option("stopMode")) {
                 switch (Request::option("stopMode")) {
                     case "manual":
                         $stopDate = NULL;
                         $timeSpan = NULL;
                         break;
                     case "timeBased":
                         $stopDate = EvalCommon::date2timestamp(Request::int("stopDay"), Request::int("stopMonth"), Request::int("stopYear"), Request::int("stopHour"), Request::int("stopMinute"));
                         $timeSpan = NULL;
                         break;
                     case "timeSpanBased":
                         $stopDate = NULL;
                         $timeSpan = Request::get("timeSpan");
                         break;
                 }
                 if ($no_permission_msg && ($eval->getStopdate != $stopDate && $eval->getTimespan != $timeSpan)) {
                     $time_msg = $time_msg ? $time_msg . "<br>" : $no_permission_msg;
                     $time_msg .= _("Die Einstellungen zur Endzeit wurden nicht verändert.");
                 }
             }
             /* ----------------------------------------------- end: timesettings */
             /* link eval to ranges --------------------------------------------- */
             $link_range_Array = Request::optionArray("link_range");
             if ($link_range_Array) {
                 $isTemplate = $eval->isTemplate();
                 if ($isTemplate) {
                     $newEval = $eval->duplicate();
                     if ($newEval->isError()) {
                         $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($newEval));
                         return $safeguard;
                     }
                     $update_message = sprintf(_("Die Evaluationsvorlage <b>%s</b> wurde als Evaluation angelegt."), $evalName);
                     $newEval->setStartdate($startDate);
                     $newEval->setStopdate($stopDate);
                     $newEval->setTimespan($timeSpan);
                     $newEval->setShared(NO);
                 } else {
                     $newEval =& $eval;
                 }
                 $counter_linked = 0;
                 foreach ($link_range_Array as $link_rangeID => $v) {
                     if ($userid = get_userid($link_rangeID)) {
                         $link_rangeID = $userid;
                     }
                     $newEval->addRangeID($link_rangeID);
                     $counter_linked++;
                 }
                 if ($isTemplate) {
                     $newEval->save();
                 }
                 if ($newEval->isError()) {
                     $safeguard .= $this->createSafeguard("ausruf", _("Fehler beim Einhängen von Bereichen.") . EvalCommon::createErrorReport($newEval));
                     return $safeguard;
                 }
                 $message .= $message ? "<br>" : " ";
                 $message .= $counter_linked > 1 ? sprintf(_("Die Evaluation wurde in %s Bereiche eingehängt."), $counter_linked) : sprintf(_("Die Evaluation wurde in einen Bereich eingehängt."), $counter_linked);
             }
             /* ---------------------------------------- end: link eval to ranges */
             /* copy eval to ranges --------------------------------------------- */
             $copy_range_Array = Request::optionArray("copy_range");
             if (!empty($copy_range_Array)) {
                 $counter_copy = 0;
                 foreach ($copy_range_Array as $copy_rangeID => $v) {
                     if ($userid = get_userid($copy_rangeID)) {
                         $copy_rangeID = $userid;
                     }
                     $newEval = $eval->duplicate();
                     if (Request::option("startMode")) {
                         $newEval->setStartdate($startDate);
                     }
                     if (Request::get("stopMode")) {
                         $newEval->setStopdate($stopDate);
                         $newEval->setTimespan($timeSpan);
                     }
                     $newEval->setShared(NO);
                     $newEval->removeRangeIDs();
                     $evalDB->removeUser($newEval->getObjectID());
                     $newEval->addRangeID($copy_rangeID);
                     $newEval->save();
                     $counter_copy++;
                     if ($newEval->isError()) {
                         $safeguard .= $this->createSafeguard("ausruf", _("Fehler beim Kopieren von Evaluationen in Bereiche.") . EvalCommon::createErrorReport($newEval));
                         return $safeguard;
                     }
                 }
                 $message .= $message ? "<br>" : " ";
                 $message .= $counter_copy > 1 ? sprintf(_("Die Evaluation wurde in %s Bereiche kopiert."), $counter_copy) : sprintf(_("Die Evaluation wurde in einen Bereich kopiert."), $counter_copy);
             }
             /* ------------------------------------------- end: copy eval to ranges */
             /* unlink ranges ------------------------------------------------------- */
             $remove_range_Array = Request::optionArray("remove_range");
             if (!empty($remove_range_Array)) {
                 /* if all rangeIDs will be removed, so ask if it should be deleted -- */
                 if (sizeof($remove_range_Array) == $eval->getNumberRanges()) {
                     $text = _("Sie wollen die Evaluation <b>%s</b> aus allen ihr zugeordneten Bereichen aushängen.<br>Soll die Evaluation gelöscht oder zu Ihren eigenen Evaluationsvorlagen verschoben werden?");
                     $safeguard .= $this->createSafeguard("ausruf", sprintf($text, $evalName), "unlink_delete_request", $evalID, $showrangeID, $referer);
                     $update_message = NULL;
                     return $safeguard;
                 }
                 /* -------------------------------- end: ask if it should be deleted */
                 $no_permission_ranges = EvaluationObjectDB::getEvalUserRangesWithNoPermission($eval, YES);
                 $counter_no_permisson = 0;
                 if (is_array($no_permission_ranges)) {
                     foreach ($remove_range_Array as $remove_rangeID => $v) {
                         if ($userid = get_userid($remove_rangeID)) {
                             $remove_rangeID = $userid;
                         }
                         // no permisson to unlink this range
                         if (in_array($remove_rangeID, $no_permission_ranges)) {
                             $counter_no_permisson++;
                         }
                     }
                 }
                 // if there are no_permisson_ranges to unlink, return
                 if ($counter_no_permisson > 0) {
                     if ($counter_no_permisson == 1) {
                         $safeguard .= $this->createSafeguard("ausruf", _("Sie wollen die Evaluation aus einem Bereich aushängen, für den Sie keine Berechtigung besitzten.<br> Die Aktion wurde nicht ausgeführt."));
                     } else {
                         $safeguard .= $this->createSafeguard("ausruf", sprintf(_("Sie wollen die Evaluation aus %d Bereichen aushängen, für die Sie keine Berechtigung besitzten.<br> Die Aktion wurde nicht ausgeführt."), $counter_no_permisson));
                     }
                     return $safeguard;
                 }
                 reset($remove_range_Array);
                 $counter_copy = 0;
                 foreach ($remove_range_Array as $remove_rangeID => $v) {
                     if ($userid = get_userid($remove_rangeID)) {
                         $remove_rangeID = $userid;
                     }
                     // the current range will be removed
                     if ($showrangeID == $remove_rangeID) {
                         $current_range_removed = 1;
                     }
                     $eval->removeRangeID($remove_rangeID);
                     $counter_copy++;
                 }
                 if ($eval->isError()) {
                     $safeguard .= $this->createSafeguard("ausruf", _("Fehler beim Aushängen von Bereichen.") . EvalCommon::createErrorReport($eval));
                     return $safeguard;
                 }
                 $message .= $message ? "<br>" : " ";
                 $message .= $counter_copy > 1 ? sprintf(_("Die Evaluation wurde aus %s Bereichen ausgehängt."), $counter_copy) : sprintf(_("Die Evaluation wurde aus einem Bereich ausgehängt."), $counter_copy);
                 if ($eval->getNumberRanges() == 0) {
                     $message .= $message ? "<br>" : "";
                     $message .= _("Sie ist nun keinem Bereich mehr zugeordnet und wurde zu den eigenen Evaluationsvorlagen verschoben.");
                     $eval->setStartdate(NULL);
                     $eval->setStopdate(NULL);
                     $evalDB->removeUser($eval->getObjectID());
                     if ($eval->isError()) {
                         $safeguard .= $this->createSafeguard("ausruf", _("Fehler beim Kopieren von Evaluationen in Bereiche.") . EvalCommon::createErrorReport($newEval));
                         return $safeguard;
                     }
                 } else {
                     $no_permission_ranges = EvaluationObjectDB::getEvalUserRangesWithNoPermission($eval);
                     $number_of_ranges = $eval->getNumberRanges();
                     if ($number_of_ranges == $no_permission_ranges) {
                         $return["msg"] = $this->createSafeguard("ausruf", $message . "<br>" . sprintf(_("Sie haben die Evaluation <b>%s</b> aus allen ihren Bereichen ausgehängt."), $evalName));
                         $return["option"] = DISCARD_OPENID;
                         $eval->save();
                         if ($eval->isError()) {
                             $safeguard = $this->createSafeguard("ausruf", _("Fehler beim Aushängen einer Evaluationen aus allen Bereichen auf die Sie Zugriff haben.") . EvalCommon::createErrorReport($newEval));
                             return $safeguard;
                         }
                         return $return;
                     }
                 }
             }
             if ($eval->isTemplate()) {
                 if (empty($link_range) && empty($copy_range) && empty($remove_range)) {
                     $update_message = sprintf(_("Es wurden keine Veränderungen an der Evaluationsvorlage <b>%s</b> gespeichert."), $evalName);
                 }
             } else {
                 // nothing changed
                 if (!Request::option('startMode') && !Request::option('stopMode') && empty($link_range) && empty($copy_range) && empty($remove_range)) {
                     $update_message = _("Es wurden keine Veränderungen gespeichert.");
                 }
                 // set new start date
                 if (Request::option("startMode") && !$time_msg) {
                     $eval->setStartDate($startDate);
                     if ($startDate != NULL && $startDate <= time() - 1) {
                         $message .= $message ? "<br>" : " ";
                         $message .= _("Die Evaluation wurde gestartet.");
                     }
                 }
                 // set new stop date
                 if (Request::get("stopMode") && !$time_msg) {
                     $eval->setStopDate($stopDate);
                     $eval->setTimeSpan($timeSpan);
                     if ($stopDate != NULL && $stopDate <= time() - 1 || $timeSpan != NULL && $eval->getStartdate() != NULL && $eval->getStartdate() + $timeSpan <= time() - 1) {
                         $message .= $message ? "<br>" : " ";
                         $message .= _("Die Evaluation wurde beendet.");
                     }
                 }
                 if ($eval->isError()) {
                     $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                     return $safeguard;
                 }
                 $eval->save();
             }
             $evalChanged = YES;
             // start/endtime aren't saved, because of ranges with no permisson
             if ($time_msg) {
                 $safeguard .= $this->createSafeguard("ausruf", $time_msg);
             }
             // everything is just fine so print the all messages
             if ($update_message && !$time_msg) {
                 $safeguard .= $this->createSafeguard("ok", $update_message . "<br>" . $message);
             } elseif ($time_msg && $message) {
                 $safeguard .= $this->createSafeguard("ok", $message);
             }
             break;
         case "search_showrange":
         case "search_range":
             $search = Request::get("search");
             if (EvaluationObjectDB::getGlobalPerm(YES) < 31) {
                 $safeguard = $this->createSafeguard("ausruf", _("Sie besitzen keine Berechtigung eine Suche durchzuführen."));
                 return $safeguard;
             }
             $results = $evalDB->search_range($search);
             if (empty($search)) {
                 $safeguard .= $this->createSafeguard("ausruf", _("Bitte einen Suchbegriff eingeben."), $search);
             } elseif (sizeof($results) == 0) {
                 $safeguard .= $this->createSafeguard("ausruf", sprintf(_("Es wurde kein Bereich gefunden, der den Suchbegriff <b>%s</b> enthält."), htmlReady($search)), $search);
             } else {
                 $safeguard .= $this->createSafeguard("ok", sprintf(_("Es wurden %s Bereiche gefunden, die den Suchbegriff <b>%s</b> enthalten."), sizeof($results), htmlReady($search)), $search);
             }
             break;
         case "check_abort_creation":
             # check if the evaluation is new and not yet edited
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_NO_CHILDREN);
             $abort_creation = false;
             if ($eval->getTitle() == _("Neue Evaluation") && $eval->getText() == "") {
                 # the evaluationen may be not edited yet ... so continue checking
                 $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
                 $number_of_childs = $eval->getNumberChildren();
                 $child = $eval->getNextChild();
                 if ($number_of_childs == 1 && $child && $child->getTitle() == _("Erster Gruppierungsblock") && $child->getChildren() == NULL && $child->getText() == "") {
                     $abort_creation = true;
                 }
             }
             if ($abort_creation != true) {
                 break;
             }
             # continue abort_creation
         # continue abort_creation
         case "abort_creation":
             $eval = new Evaluation($evalID, NULL, EVAL_LOAD_ALL_CHILDREN);
             $eval->delete();
             // error_ausgabe
             if ($eval->isError()) {
                 $safeguard .= $this->createSafeguard("", EvalCommon::createErrorReport($eval));
                 return $safeguard;
             }
             $safeguard .= $this->createSafeguard("ok", _("Die Erstellung einer Evaluation wurde abgebrochen."), "", "", "", $referer);
             break;
         case "nothing":
             break;
         default:
             $safeguard .= $this->createSafeguard("ausruf", _("Fehler! Es wurde versucht, eine nicht vorhandene Aktion auszuführen."));
             break;
     }
     /* Send SMS when eval has been modified by admin/root ----------------- */
     if ($evalChanged && $eval->getAuthorID() != $auth->auth["uid"]) {
         $sms = new messaging();
         $sms->insert_message(sprintf(_("An Ihrer Evaluation \"%s\" wurden von %s Änderungen vorgenommen."), $eval->getTitle(), get_username($auth->auth["uid"])), get_username($eval->getAuthorID()), "____%system%____", FALSE, FALSE, "1");
     }
     /* ------------------------------------------------------ end: send SMS */
     // the current range has been removed from the eval
     if ($current_range_removed) {
         $return["msg"] = $safeguard;
         $return["option"] = DISCARD_OPENID;
         return $return;
     } else {
         return $safeguard;
     }
 }
Exemplo n.º 19
0
</h3>
<ul class="message_attachments">
    <? foreach ($message->attachments as $attachment) : ?>
    <li>
        <? $mime_type = get_mime_type($attachment['filename']) ?>
        <h4><a href="<?php 
echo GetDownloadLink($attachment->getId(), $attachment['filename'], 7, 'force');
?>
"><?php 
echo GetFileIcon(substr($attachment['filename'], strrpos($attachment["filename"], ".") + 1))->asImg();
echo htmlReady($attachment['name']);
?>
</a></h4>
        <? if (substr($mime_type, 0, 5) === "image") : ?>
        <div><img src="<?php 
echo GetDownloadLink($attachment->getId(), $attachment['filename'], 7, 'normal');
?>
" style="max-width: 400px;"></div>
        <? endif ?>
    </li>
    <? endforeach ?>
</ul>
<? endif ?>

<div align="center" data-dialog-button>
    <div class="button-group">
    <? if ($message['autor_id'] !== '____%system%____'): ?>
        <a href="<?php 
echo URLHelper::getLink("dispatch.php/messages/write", array('answer_to' => $message->getId()));
?>
" data-dialog="buttons"><?php 
Exemplo n.º 20
0
 /**
  * Saves given files (dragged into the textarea) and returns the link to the
  * file to the user as json.
  * @throws AccessDeniedException
  */
 public function post_files_action()
 {
     $context = Request::option("context") ? Request::get("context") : $GLOBALS['user']->id;
     $context_type = Request::option("context_type");
     if (!Request::isPost() || $context_type === "course" && !$GLOBALS['perm']->have_studip_perm("autor", $context)) {
         throw new AccessDeniedException();
     }
     //check folders
     $db = DBManager::get();
     $folder_id = md5("Blubber_" . $context . "_" . $GLOBALS['user']->id);
     $parent_folder_id = md5("Blubber_" . $context);
     if ($context_type !== "course") {
         $folder_id = $parent_folder_id;
     }
     $folder = $db->query("SELECT * " . "FROM folder " . "WHERE folder_id = " . $db->quote($folder_id) . " " . "")->fetch(PDO::FETCH_COLUMN, 0);
     if (!$folder) {
         $folder = $db->query("SELECT * " . "FROM folder " . "WHERE folder_id = " . $db->quote($parent_folder_id) . " " . "")->fetch(PDO::FETCH_COLUMN, 0);
         if (!$folder) {
             $db->exec("INSERT IGNORE INTO folder " . "SET folder_id = " . $db->quote($parent_folder_id) . ", " . "range_id = " . $db->quote($context) . ", " . "seminar_id = " . $db->quote($context) . ", " . "user_id = " . $db->quote($GLOBALS['user']->id) . ", " . "name = " . $db->quote("BlubberDateien") . ", " . "permission = '7', " . "mkdate = " . $db->quote(time()) . ", " . "chdate = " . $db->quote(time()) . " " . "");
         }
         if ($context_type === "course") {
             $db->exec("INSERT IGNORE INTO folder " . "SET folder_id = " . $db->quote($folder_id) . ", " . "range_id = " . $db->quote($parent_folder_id) . ", " . "seminar_id = " . $db->quote($context) . ", " . "user_id = " . $db->quote($GLOBALS['user']->id) . ", " . "name = " . $db->quote(get_fullname()) . ", " . "permission = '7', " . "mkdate = " . $db->quote(time()) . ", " . "chdate = " . $db->quote(time()) . " " . "");
         }
     }
     $output = array();
     foreach ($_FILES as $file) {
         $GLOBALS['msg'] = '';
         validate_upload($file);
         if ($GLOBALS['msg']) {
             $output['errors'][] = $file['name'] . ': ' . decodeHTML(trim(substr($GLOBALS['msg'], 6), '§'));
             continue;
         }
         if ($file['size']) {
             $document['name'] = $document['filename'] = studip_utf8decode(strtolower($file['name']));
             $document['user_id'] = $GLOBALS['user']->id;
             $document['author_name'] = get_fullname();
             $document['seminar_id'] = $context;
             $document['range_id'] = $context_type === "course" ? $folder_id : $parent_folder_id;
             $document['filesize'] = $file['size'];
             if ($context === $GLOBALS['user']->id && Config::get()->PERSONALDOCUMENT_ENABLE) {
                 try {
                     $root_dir = RootDirectory::find($GLOBALS['user']->id);
                     $blubber_directory = $root_dir->listDirectories()->findOneBy('name', 'Blubber');
                     if (!$blubber_directory) {
                         $blubber_directory = $root_dir->mkdir('Blubber', _('Ihre Dateien aus Blubberstreams'));
                     }
                     $newfile = $blubber_directory->file->createFile($document['name']);
                     $newfile->name = $document['name'];
                     $newfile->store();
                     $handle = $newfile->file;
                     $handle->restricted = 0;
                     $handle->mime_type = $file['type'];
                     $handle->setContentFromFile($file['tmp_name']);
                     $handle->update();
                     $url = $newfile->getDownloadLink(true, true);
                     $success = true;
                 } catch (Exception $e) {
                     $output['error'][] = $e->getMessage();
                     $success = false;
                 }
             } else {
                 $newfile = StudipDocument::createWithFile($file['tmp_name'], $document);
                 $success = (bool) $newfile;
                 if ($success) {
                     $url = GetDownloadLink($newfile->getId(), $newfile['filename']);
                 }
             }
             if ($success) {
                 $type = null;
                 strpos($file['type'], 'image') === false || ($type = "img");
                 strpos($file['type'], 'video') === false || ($type = "video");
                 if (strpos($file['type'], 'audio') !== false || strpos($document['filename'], '.ogg') !== false) {
                     $type = "audio";
                 }
                 if ($type) {
                     $output['inserts'][] = "[" . $type . "]" . $url;
                 } else {
                     $output['inserts'][] = "[" . $document['filename'] . "]" . $url;
                 }
             }
         }
     }
     $this->render_json($output);
 }
Exemplo n.º 21
0
 public function post_files_action()
 {
     $context = Request::option("context") ? Request::get("context") : $GLOBALS['user']->id;
     $context_type = Request::option("context_type");
     if (!Request::isPost() || $context_type === "course" && !$GLOBALS['perm']->have_studip_perm("autor", $context)) {
         throw new AccessDeniedException("Kein Zugriff");
     }
     //check folders
     $db = DBManager::get();
     $folder_id = md5("Blubber_" . $context . "_" . $GLOBALS['user']->id);
     $parent_folder_id = md5("Blubber_" . $context);
     if ($context_type !== "course") {
         $folder_id = $parent_folder_id;
     }
     $folder = $db->query("SELECT * " . "FROM folder " . "WHERE folder_id = " . $db->quote($folder_id) . " " . "")->fetch(PDO::FETCH_COLUMN, 0);
     if (!$folder) {
         $folder = $db->query("SELECT * " . "FROM folder " . "WHERE folder_id = " . $db->quote($parent_folder_id) . " " . "")->fetch(PDO::FETCH_COLUMN, 0);
         if (!$folder) {
             $db->exec("INSERT IGNORE INTO folder " . "SET folder_id = " . $db->quote($parent_folder_id) . ", " . "range_id = " . $db->quote($context) . ", " . "user_id = " . $db->quote($GLOBALS['user']->id) . ", " . "name = " . $db->quote("BlubberDateien") . ", " . "permission = '7', " . "mkdate = " . $db->quote(time()) . ", " . "chdate = " . $db->quote(time()) . " " . "");
         }
         if ($context_type === "course") {
             $db->exec("INSERT IGNORE INTO folder " . "SET folder_id = " . $db->quote($folder_id) . ", " . "range_id = " . $db->quote($parent_folder_id) . ", " . "user_id = " . $db->quote($GLOBALS['user']->id) . ", " . "name = " . $db->quote(get_fullname()) . ", " . "permission = '7', " . "mkdate = " . $db->quote(time()) . ", " . "chdate = " . $db->quote(time()) . " " . "");
         }
     }
     $output = array();
     foreach ($_FILES as $file) {
         $GLOBALS['msg'] = '';
         if ($context_type === "course") {
             validate_upload($file);
             if ($GLOBALS['msg']) {
                 $output['errors'][] = $file['name'] . ': ' . studip_utf8encode(html_entity_decode(trim(substr($GLOBALS['msg'], 6), '§')));
                 continue;
             }
         }
         if ($file['size']) {
             $document['name'] = $document['filename'] = studip_utf8decode(strtolower($file['name']));
             $document['user_id'] = $GLOBALS['user']->id;
             $document['author_name'] = get_fullname();
             $document['seminar_id'] = $context;
             $document['range_id'] = $context_type === "course" ? $folder_id : $parent_folder_id;
             $document['filesize'] = $file['size'];
             if ($newfile = StudipDocument::createWithFile($file['tmp_name'], $document)) {
                 $type = null;
                 strpos($file['type'], 'image') === false || ($type = "img");
                 strpos($file['type'], 'video') === false || ($type = "video");
                 if (strpos($file['type'], 'audio') !== false || strpos($document['filename'], '.ogg') !== false) {
                     $type = "audio";
                 }
                 $url = GetDownloadLink($newfile->getId(), $newfile['filename']);
                 if ($type) {
                     $output['inserts'][] = "[" . $type . "]" . $url;
                 } else {
                     $output['inserts'][] = "[" . $newfile['filename'] . "]" . $url;
                 }
             }
         }
     }
     $this->render_json($output);
 }
Exemplo n.º 22
0
 /**
  * Displays all members of the course and their aux data
  * @return int fake return to stop after redirect;
  */
 public function additional_action($format = null)
 {
     // Users get forwarded to aux_input
     if (!($this->is_dozent || $this->is_tutor)) {
         $this->redirect('course/members/additional_input');
         return 0;
     }
     Navigation::activateItem('/course/members/additional');
     // fetch course and aux data
     $course = new Course($_SESSION['SessionSeminar']);
     if (Request::submitted('save')) {
         foreach ($course->members->findBy('status', 'autor') as $member) {
             $course->aux->updateMember($member, Request::getArray($member->user_id));
         }
     }
     if (Request::submitted('export')) {
         $aux = $course->aux->getCourseData($course, true);
         $tmp_name = uniqid();
         array_to_csv($aux['rows'], $GLOBALS['TMP_PATH'] . '/' . $tmp_name, $aux['head']);
         $this->redirect(GetDownloadLink($tmp_name, _('Zusatzangaben') . '.csv', 4, 'force'));
     } else {
         $this->aux = $course->aux->getCourseData($course);
     }
 }
Exemplo n.º 23
0
" target="_blank">
                                <?php 
echo Icon::create('forum', 'clickable', ['title' => _('Beiträge des Forums der Veranstaltung')])->asImg(20);
?>
                            </a>
                        <? else: ?>
                            <?php 
echo Icon::create('forum', 'inactive')->asImg(20, ["style" => 'visibility: hidden;']);
?>
                        <? endif; ?>

                        <? if ($row['archiv_file_id']):
                            $filename = _('Dateisammlung') . '-' . substr($row['name'], 0, 200) . '.zip';
                            ?>
                            <a href="<?php 
echo URLHelper::getLink(GetDownloadLink($row['archiv_file_id'], $filename, 1));
?>
">
                                <?php 
echo Icon::create('download', 'clickable', ['title' => _('Dateisammlung der Veranstaltung herunterladen')])->asImg(20);
?>
                            </a>
                        <? else: ?>
                            <?php 
echo Icon::create('download', 'inactive')->asImg(20, ["style" => 'visibility: hidden;']);
?>
                        <? endif; ?>

                        <? if ($row['wikidump']): ?>
                            <a href="<?php 
echo URLHelper::getLink('archiv.php?wiki_dump_id=' . $row['seminar_id']);
Exemplo n.º 24
0
        //echo "<br>dailymotion";
        include "dailymotion_v3.php";
        $new_flv_path = downloadDailymotionFlvFile($url);
    } elseif ($parseUrl['host'] == "www.vimeo.com" || $parseUrl['host'] == "vimeo.com") {
        //echo "<br>dailymotion";
        include "vimeo.php";
        $video_url = $url;
        $id = getVimeoVideoId($video_url);
        $new_flv_path = vimeoid2url($id);
        //$new_flv_path=downloadDailymotionFlvFile($url);
    } elseif ($parseUrl['host'] == "www.metacafe.com") {
        //echo "<br>metacafe";
        include "metacafe.php";
        //Den brika AKOMA
        $video_url = $url;
        $video_link = GetDownloadLink($url);
        //getMetacafeVideoID($url);
        $new_flv_path = download($video_link);
        //$new_flv_path=downloadDailymotionFlvFile($url);
    } elseif ($parseUrl['host'] == "www.veoh.com") {
        //echo "<br>dailymotion";
        include "veoh_v2.php";
        $video_id = getVeohVideoId($url);
        $xmlString = downloadVeoXml($video_id);
        $new_flv_path = getVeohVideoUrl($xmlString);
        //echo $new_flv_path;
    }
    $url = $new_flv_path;
    //require "include/FLVMetaData.class.php";
    include "flv.php";
}
Exemplo n.º 25
0
    function toString ($args = NULL) {
        
        $error_message = "";

        // 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 = ?";

            $parameters = array($seminar_id, $this->config->range_id);
            $statement = DBManager::get()->prepare($query);
            $statement->execute($parameters);
            $row = $statement->fetch(PDO::FETCH_ASSOC);
            
            if ($row === false && $row['Lesezugriff'] == 0)
                $error_message = $GLOBALS["EXTERN_ERROR_MESSAGE"];
        } else {
            $seminar_id = $this->config->range_id;
        }

        $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) . " DESC";
        }

        if (!$nameformat = $this->config->getValue("Main", "nameformat")) {
            $nameformat = "no_title_short";
        }
        $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $seminar_id));
        $allowed_folders = $folder_tree->getReadableFolders('nobody');
        $query = "SELECT dokument_id, description, filename, d.mkdate, d.chdate, filesize, ";
        $query .= $GLOBALS["_fullname_sql"][$nameformat];
        $query .= "AS fullname, 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 ('";
        $query .= implode("','", $allowed_folders) . "')$query_order";

        $parameters = array($seminar_id);
        $statement = DBManager::get()->prepare($query);
        $statement->execute($parameters);
        $row = $statement->fetch(PDO::FETCH_ASSOC);

        if ($row === false) {
            $error_message = $this->config->getValue("Main", "nodatatext");
        }

        $out = $this->elements["TableHeadrow"]->toString();

        if ($error_message) {
            // use one column and set it visible to display error_message
            $this->config->setValue('Main', 'order', array('0'));
            $this->config->setValue('Main', 'visible', array('1'));
            $this->config->setValue('Main', 'width', array('100%'));
            $out = $this->elements['TableRow']->toString(array('content' => array('' => $error_message)));
        } else {
            $table_row_data["data_fields"] = $this->data_fields;
            do{
                preg_match("/^.+\.([a-z1-9_-]+)$/i", $row['filename'], $file_suffix);

                $icon = "";
                switch ($file_suffix[1]) {
                    case "txt" :
                        if (!$picture_file = $this->config->getValue("Main", "icontxt"))
                            $icon = Icon::create("file-text", "clickable");
                        break;
                    case "xls" :
                        if (!$picture_file = $this->config->getValue("Main", "iconxls"))
                            $icon = Icon::create("file-archive", "clickable");
                        break;
                    case "ppt" :
                        if (!$picture_file = $this->config->getValue("Main", "iconppt"))
                            $icon = Icon::create("file-presentation", "clickable");
                        break;
                    case "rtf" :
                        if (!$picture_file = $this->config->getValue("Main", "iconrtf"))
                            $icon = Icon::create("file-text", "clickable");
                        break;
                    case "zip" :
                    case "tgz" :
                    case "gz" :
                        if (!$picture_file = $this->config->getValue("Main", "iconzip"))
                            $icon = Icon::create("file-archive", "clickable");
                        break;
                    case "jpg" :
                    case "png" :
                    case "gif" :
                    case "jpeg" :
                    case "tif" :
                        if (!$picture_file = $this->config->getValue("Main", "iconpic"))
                            $icon = Icon::create("file-pic", "clickable");
                        break;
                    case "pdf" :
                        if (!$picture_file = $this->config->getValue("Main", "iconpdf"))
                            $icon = Icon::create("file-pdf", "clickable");
                        break;
                    default :
                        if (!$picture_file = $this->config->getValue("Main", "icondefault"))
                            $icon = Icon::create("file-generic", "clickable");
                }

                if ($icon) {
                    $picture_file = $icon;
                }
                
                $download_link = GetDownloadLink($row['dokument_id'], $row['filename']);
                
                // Aufbereiten der Daten
                $table_row_data["content"] = array(
                    "icon"        => sprintf("<a href=\"%s\">%s</a>",
                                             $download_link,
                                             is_string($picture_file)
                                             ? Assets::img($picture_file)
                                             : $picture_file->asImg()),
                                                                             
                    "filename"    => $this->elements["Link"]->toString(array("content" =>
                                                        htmlReady($row['filename']), "link" => $download_link)),
                                                         
                    "description" => htmlReady(mila_extern($row['description'],
                                                     $this->config->getValue("Main", "lengthdesc"))),
                    
                    "mkdate"      => strftime($this->config->getValue("Main", "dateformat"), $row['mkdate']),
                    
                    "filesize"    => $row['filesize'] > 1048576 ? round($row['filesize'] / 1048576, 1) . " MB"
                                                        : round($row['filesize'] / 1024, 1) . " kB",
                                                            
                );
                // if user is member of a group then link name to details page
                if (GetRoleNames(GetAllStatusgruppen($this->config->range_id, $row['user_id']))) {
                    $table_row_data['content']['fullname'] = 
                            $this->elements['LinkIntern']->toString(array('content' =>
                            htmlReady($row['fullname']), 'module' => 'Persondetails',
                            'link_args' => 'username='******'username']));
                } else {
                    $table_row_data['content']['fullname'] = htmlReady($row['username'] ? $row['username'] : $row['author_name']);
                }
                $out .= $this->elements["TableRow"]->toString($table_row_data);
            }while($row = $statement->fetch(PDO::FETCH_ASSOC));
        }

        return $this->elements["TableHeader"]->toString(array("content" => $out));
    }
Exemplo n.º 26
0
 static function find_files($id, $user_id)
 {
     $db = \DBManager::get();
     $query = "       SELECT *\n\t\t\t\t\t\tFROM dokumente\n\t\t\t\t\t\tWHERE seminar_id =  '{$id}'\n\t\t\t\t\t\tORDER BY mkdate DESC\n\t\t\tLIMIT 0,30\n\t\t\t";
     $result = $db->query($query);
     $files = array();
     foreach ($result as $row) {
         // getLink
         $link = $row['url'];
         if ($row['url'] == "" or !$row['url']) {
             $link = GetDownloadLink($row['dokument_id'], $row['filename'], 0, 'force_download');
         }
         // get file extension
         $path_parts = pathinfo($row['filename']);
         $extension = strtoupper($path_parts['extension']);
         //get extension icon
         switch ($extension) {
             case "PDF":
                 $icon_link = "/public/images/icons/files32/pdf.png";
                 break;
             case "XLS":
                 $icon_link = "/public/images/icons/files32/xls.png";
                 break;
             case "PPT":
                 $icon_link = "/public/images/icons/files32/ppt.png";
                 break;
             case "ZIP":
                 $icon_link = "/public/images/icons/files32/zip.png";
                 break;
             case "RTF":
                 $icon_link = "/public/images/icons/files32/rtf.png";
                 break;
             case "TXT":
                 $icon_link = "/public/images/icons/files32/txt.png";
                 break;
             case "TGZ":
                 $icon_link = "/public/images/icons/files32/tgz.png";
                 break;
             default:
                 $icon_link = "/public/images/icons/files32/_blank.png";
         }
         //check access
         $file_object = \StudipDocument::find($row['dokument_id']);
         // Falls $file_oject vorhanden ab in den Array
         if (isset($file_object) && $file_object->checkAccess($user_id)) {
             $files[] = array('id' => $row['dokument_id'], 'name' => $row['name'], 'Seminar_id' => $row['seminar_id'], 'author' => $row['author_name'], 'author_id' => $row['user_id'], 'description' => $row['description'], 'mkdate' => $row['mkdate'], 'filesize' => $row['filesize'], 'link' => $link, 'filename' => $row['filename'], 'icon_link' => $icon_link, 'extension' => $extension);
         }
     }
     return $files;
 }