function __construct($range_id){
     $this->range_id = $range_id;
     $this->range_type = get_object_type($range_id);
     $object_name = get_object_name($range_id, $this->range_type);
     $this->range_name = $object_name['type'] . ": " . $object_name['name'];
     $this->createGroups();
 }
Ejemplo n.º 2
0
    /**
    * constructor
    *
    * do not use directly, call TreeAbstract::GetInstance("StudipDocumentTree")
    * @access private
    */ 
    function StudipDocumentTree($args)
    {
        DbView::addView('core');

        $this->range_id = $args['range_id'];
        $this->entity_type = $args['entity_type'] ?: get_object_type($this->range_id);
        if ($args['get_root_name']) {
            list($name,) = array_values(get_object_name($this->range_id, $this->entity_type));
        }
        $this->root_name = $name;
        $this->must_have_perm = $this->entity_type == 'sem' ? 'tutor' : 'autor';
        $modules = new Modules();
        $this->permissions_activated = $modules->getStatus('documents_folder_permissions', $this->range_id, $this->entity_type);
        parent::TreeAbstract(); //calling the baseclass constructor 
        $this->tree_data['root']['permission'] = $this->default_perm;
    }
Ejemplo n.º 3
0
/**
 * This function creates the header line for studip-objects
 *
 * you will get a line like this "Veranstaltung: Name..."
 *
 * @param string $id          the id of the Veranstaltung
 * @param string $object_name the name of the object (optional)
 *
 * @return string  the header-line
 *
 */
function getHeaderLine($id, $object_name = null)
{
    if (!$object_name) {
        $object_name = get_object_name($id, get_object_type($id));
    }
    $header_line = $object_name['type'];
    if ($object_name['name']) {
        $header_line .= ": ";
    }
    if (studip_strlen($object_name['name']) > 60) {
        $header_line .= studip_substr($object_name['name'], 0, 60);
        $header_line .= "... ";
    } else {
        $header_line .= $object_name['name'];
    }
    return $header_line;
}
Ejemplo n.º 4
0
    /**
    * constructor
    *
    * do not use directly, call TreeAbstract::GetInstance("StudipLitList", $range_id)
    * @access private
    */
    function StudipLitList($range_id) {
        DbView::addView('literatur');

        if ($GLOBALS['LIT_LIST_FORMAT_TEMPLATE']){
            $this->format_default = $GLOBALS['LIT_LIST_FORMAT_TEMPLATE'];
        }
        $this->range_id = $range_id;
        $this->range_type = get_object_type($range_id);
        if ($this->range_type == "user"){
            $this->root_name = get_fullname($range_id);
        } else {
            $object_name = get_object_name($range_id, $this->range_type);
            $this->root_name = $object_name['type'] . ": " . $object_name['name'];
        }
        $this->cat_element = new StudipLitCatElement();
        parent::TreeAbstract(); //calling the baseclass constructor
    }
Ejemplo n.º 5
0
 /**
  * returns the complete seminar or only the passed sub-tree as a html-string
  *
  * @param string $seminar_id
  *
  * @return string
  */
 static function getDump($seminar_id, $parent_id = null)
 {
     $seminar_name = get_object_name($seminar_id, 'sem');
     $content = '<h1>' . _('Forum') . ': ' . $seminar_name['name'] . '</h1>';
     $data = ForumEntry::getList('dump', $parent_id ?: $seminar_id);
     foreach ($data['list'] as $entry) {
         if ($entry['depth'] == 1) {
             $content .= '<h2>' . _('Bereich') . ': ' . $entry['name'] . '</h2>';
             $content .= $entry['content'] . '<br><br>';
         } else {
             if ($entry['depth'] == 2) {
                 $content .= '<h3 style="margin-bottom: 0px;">' . _('Thema') . ': ' . $entry['name'] . '</h3>';
                 $content .= '<i>' . sprintf(_('erstellt von %s am %s'), htmlReady($entry['author']), strftime('%A %d. %B %Y, %H:%M', (int) $entry['mkdate'])) . '</i><br>';
                 $content .= $entry['content'] . '<br><br>';
             } else {
                 if ($entry['depth'] == 3) {
                     $content .= '<b>' . $entry['name'] . '</b><br>';
                     $content .= '<i>' . sprintf(_('erstellt von %s am %s'), htmlReady($entry['author']), strftime('%A %d. %B %Y, %H:%M', (int) $entry['mkdate'])) . '</i><br>';
                     $content .= $entry['content'] . '<hr><br>';
                 }
             }
         }
     }
     return $content;
 }
Ejemplo n.º 6
0
<? if (!$institutional): ?>
        <?php 
echo MessageBox::info(_('Fehlende Datenzeilen'));
?>
<? else: ?>
    <? foreach ($institutional as $inst): ?>
        <label>
            <?php 
echo htmlReady($inst['title']);
?>
        <? if ($inst['must']): ?>
            <em class="required"></em>
        <? endif; ?>
        <? if ($inst['type'] === 'select' && !$inst['choices'][$inst['value']]): ?>
            <? $name = get_object_name($inst['value'], 'inst'); ?>
             <?php 
echo htmlReady($name['name']);
?>
        <? else: ?>
            <?php 
echo $this->render_partial('course/basicdata/_input', array('input' => $inst));
?>
        <? endif; ?>
        </label>
    <? endforeach; ?>
<? endif; ?>
    </fieldset>

    <fieldset class="collapsed">
        <legend><?php 
Ejemplo n.º 7
0
    /**
     * set the entries for seminar_inst table in database
     * seminare.institut_id will always be added
     * @param institutes array: array of Institut_id's
     * @return bool:  if something changed
     */
    public function setInstitutes($institutes = array())
    {
        if (is_array($institutes)) {
            $institutes[] = $this->institut_id;
            $institutes = array_unique($institutes);

            $query = "SELECT institut_id FROM seminar_inst WHERE seminar_id = ?";
            $statement = DBManager::get()->prepare($query);
            $statement->execute(array($this->id));
            $old_inst = $statement->fetchAll(PDO::FETCH_COLUMN);

            $todelete = array_diff($old_inst, $institutes);

            $query = "DELETE FROM seminar_inst WHERE seminar_id = ? AND institut_id = ?";
            $statement = DBManager::get()->prepare($query);

            foreach($todelete as $inst) {
                $tmp_instname= get_object_name($inst, 'inst');
                StudipLog::log('CHANGE_INSTITUTE_DATA', $this->id, $inst, 'Die beteiligte Einrichtung "'. $tmp_instname['name'] .'" wurde gelöscht.');
                $statement->execute(array($this->id, $inst));
            }

            $toinsert = array_diff($institutes, $old_inst);

            $query = "INSERT INTO seminar_inst (seminar_id, institut_id) VALUES (?, ?)";
            $statement = DBManager::get()->prepare($query);

            foreach($toinsert as $inst) {
                $tmp_instname= get_object_name($inst, 'inst');
                StudipLog::log('CHANGE_INSTITUTE_DATA', $this->id, $inst, 'Die beteiligte Einrichtung "'. $tmp_instname['name'] .'" wurde hinzugefügt.');
                $statement->execute(array($this->id, $inst));
            }
            if ($todelete || $toinsert) {
                NotificationCenter::postNotification("CourseDidChangeInstitutes", $this);
            }
            return $todelete || $toinsert;
        } else {
            $this->createError(_("Ungültige Eingabe der Institute. Es muss " .
                "mindestens ein Institut angegeben werden."));
            return false;
        }
    }
Ejemplo n.º 8
0
    }
    // Если права выше диспетчера - разрешим конфигурировать
    if ($user['rights'] > 1) {
        $menu_text = $journals . $reports . $setup;
    }
    return "<div id=\"header\">\r\n\t\t<div class=\"name\">{$user['name']}</div>\r\n\t\t<div class=\"btnMenu\"><a class=\"toggleMenu\" href=\"#\">Меню</a></div>\r\n\t\t<ul class=\"nav\">\r\n\t\t\t<li><a href=\"#\">{$user['name']}</a>\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<li><a href=\"users-editor.php\">Профиль пользователя</a></li>\r\n\t\t\t\t\t<li><form id=\"exit\" method=\"post\" ><input type=\"hidden\" name=\"exit\" value=\"1\"><a href=\"#\" onclick=\"document.getElementById('exit').submit(); return false;\">Сдать смену</a></form></li>\r\n\t\t\t\t</ul>\r\n\t\t\t</li>\r\n\t\t\t<li><a href=\"index.php\">Мнемосхема</a></li>\r\n\t\t\t{$menu_text}\r\n\t\t\t<li class=\"help\"><a href=\"help/index.html\" title=\"Справочная информация\">&#59397;</a></li>\r\n\t\t\t<li class=\"show\"><span title=\"Скрыть/показать таблицы детализации\">&#59433;</span></li>\r\n\t\t</ul>\r\n\t</div>";
}
?>
<!DOCTYPE html>
<html lang="ru-RU">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
	<meta name="HandheldFriendly" content="True"/>
	<title><?php 
echo get_object_name(conf_get_main($mysqli)) . " / {$page_title}";
// Вставим заголовок
?>
</title>
	<link rel="icon" type="image/png" href="img/favicon.png" />
	<link rel="stylesheet" media="all" href="css/main.css" >
	<?php 
echo $page_styles;
// Подключим стили
?>
</head>

<body <?php 
echo $page_class;
?>
 data-last-inq="" data-last-event="">
Ejemplo n.º 9
0
/**
 *
 * @param unknown_type $range_id
 * @param unknown_type $type
 */
function show_rss_news($range_id, $type)
{
    $item_url_fmt = '%1$s&contentbox_open=%2$s#%2$s';
    switch ($type) {
        case 'user':
            $studip_url = $GLOBALS['ABSOLUTE_URI_STUDIP'] . 'dispatch.php/profile?again=yes&username='******' (Stud.IP - ' . $GLOBALS['UNI_NAME_CLEAN'] . ')';
            $description = _('Persönliche Neuigkeiten') . ' ' . $title;
            break;
        case 'sem':
            $studip_url = $GLOBALS['ABSOLUTE_URI_STUDIP'] . 'dispatch.php/course/overview?cid=' . $range_id;
            $sem_obj = Seminar::GetInstance($range_id);
            if ($sem_obj->read_level > 0) {
                $studip_url .= '&again=yes';
            }
            $title = $sem_obj->getName() . ' (Stud.IP - ' . $GLOBALS['UNI_NAME_CLEAN'] . ')';
            $description = _('Neuigkeiten der Veranstaltung') . ' ' . $title;
            break;
        case 'inst':
            $studip_url = $GLOBALS['ABSOLUTE_URI_STUDIP'] . 'dispatch.php/institute/overview?auswahl=' . $range_id;
            $object_name = get_object_name($range_id, $type);
            if (!get_config('ENABLE_FREE_ACCESS')) {
                $studip_url .= "&again=yes";
            }
            $title = $object_name['name'] . ' (Stud.IP - ' . $GLOBALS['UNI_NAME_CLEAN'] . ')';
            $description = _('Neuigkeiten der Einrichtung') . ' ' . $title;
            break;
        case 'global':
            $studip_url = $GLOBALS['ABSOLUTE_URI_STUDIP'] . 'dispatch.php/start?again=yes';
            $title = 'Stud.IP - ' . $GLOBALS['UNI_NAME_CLEAN'];
            $description = _('Allgemeine Neuigkeiten') . ' ' . $title;
            break;
    }
    $items = StudipNews::GetNewsByRange($range_id, true);
    $last_changed = 0;
    foreach ($items as &$item) {
        if ($last_changed < $item['chdate']) {
            $last_changed = $item['chdate'];
        }
        if ($item['date'] < $item['chdate']) {
            $item['date'] = $item['chdate'];
        }
        list($body, $admin_msg) = explode('<admin_msg>', $item['body']);
        $item['body'] = $body;
    }
    header('Content-type: application/rss+xml; charset=utf-8');
    $template = $GLOBALS['template_factory']->open('news/rss-feed');
    $template->items = $items;
    $template->title = $title;
    $template->studip_url = $studip_url;
    $template->description = $description;
    $template->last_changed = $last_changed;
    $template->item_url_fmt = $item_url_fmt;
    echo $template->render();
    return true;
}
Ejemplo n.º 10
0
    if ($new_sem_id) {
        foreach($new_sem_id as $sid) {
            $new_range_id = md5($sid . 'top_folder');
            if ($folder_system_data["mode"] == 'move'){
                $done = move_item($folder_system_data["move"], $new_range_id, $sid);
                if (!$done){
                    $msg .= "error§" . _("Verschiebung konnte nicht durchgeführt werden. Eventuell wurde im Ziel der Allgemeine Dateiordner nicht angelegt.") . "§";
                } else {
                    $msg .= "msg§" . sprintf(_("%s Ordner, %s Datei(en) wurden verschoben."), $done[0], $done[1]) . '§';
                }
            } else {
                $done = copy_item($folder_system_data["move"], $new_range_id, $sid);
                if (!$done){
                    $msg .= "error§" . _("Kopieren konnte nicht durchgeführt werden. Eventuell wurde im Ziel der Allgemeine Dateiordner nicht angelegt.") . "§";
                } else {
                    $s_name = get_object_name($sid, Request::submitted('move_to_sem') ? "sem" : "inst");
                    $msg .= "msg§" . $s_name['name'] . ": " . sprintf(_("%s Ordner, %s Datei(en) wurden kopiert."), $done[0], $done[1]) . '§';
                }
            }
        }
    }
    $folder_system_data["move"]='';
    $folder_system_data["mode"]='';
}
//verschieben / kopieren innerhalb der Veranstaltung
//wurde Code fuer Starten der Verschiebung uebermittelt (=id+"_md_"), wird entsprechende Funktion aufgerufen
if ($open_cmd == 'md' && $folder_tree->isWritable($open_id, $user->id) && !Request::submitted("cancel") && (!$folder_tree->isFolder($folder_system_data["move"]) || ($folder_tree->isFolder($folder_system_data["move"]) && $folder_tree->checkCreateFolder($open_id, $user->id)))) {
    if ($folder_system_data["mode"] == 'move'){
        $done = move_item($folder_system_data["move"], $open_id);
        if (!$done){
            $msg .= "error§" . _("Verschiebung konnte nicht durchgeführt werden.") . "§";
Ejemplo n.º 11
0
            <td><?php 
echo htmlReady($banner['description']);
?>
</td>
            <td><?php 
echo $banner['target_type'];
?>
</td>
            <td>
                <? if ($banner['target_type'] == 'seminar'): ?>
                    <?php 
echo mila(reset(get_object_name($banner['target'], 'sem')), 30);
?>
                <? elseif ($banner['target_type'] == 'inst') :?>
                    <?php 
echo mila(reset(get_object_name($banner['target'], 'inst')), 30);
?>
                <? else: ?>
                    <?php 
echo $banner['target'];
?>
                <? endif; ?>
            </td>
            <td style="text-align: center;">
                <?php 
echo $banner['startdate'] ? date("d.m.Y", $banner['startdate']) : _("sofort");
?>
<br>
                <?php 
echo _("bis");
?>
Ejemplo n.º 12
0
 /**
  * this action is the main action of the schedule-controller, setting the environment
  * for the timetable, accepting a comma-separated list of days.
  *
  * @param  string  $days  a list of an arbitrary mix of the numbers 0-6, separated
  *                        with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
  * @return void
  */
 function index_action($days = false)
 {
     global $user;
     $schedule_settings = CalendarScheduleModel::getScheduleSettings();
     if ($GLOBALS['perm']->have_perm('admin')) {
         $inst_mode = true;
     }
     if ($inst_mode) {
         // try to find the correct institute-id
         $institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false));
         if (!$institute_id) {
             $institute_id = UserConfig::get($user->id)->MY_INSTITUTES_DEFAULT;
         }
         if (!$institute_id || !in_array(get_object_type($institute_id), words('fak inst'))) {
             throw new Exception('Cannot display institute-calender. No valid ID given!');
         }
         Navigation::activateItem('/browse/my_courses/schedule');
     } else {
         Navigation::activateItem('/calendar/schedule');
     }
     // check, if the hidden seminar-entries shall be shown
     $show_hidden = Request::int('show_hidden', 0);
     // load semester-data and current semester
     $semdata = new SemesterData();
     $this->semesters = array_reverse($semdata->getAllSemesterData());
     if (Request::option('semester_id')) {
         $this->current_semester = $semdata->getSemesterData(Request::option('semester_id'));
     } else {
         $this->current_semester = $semdata->getCurrentSemesterData();
     }
     // check type-safe if days is false otherwise sunday (0) cannot be chosen
     if ($days === false) {
         if (Request::getArray('days')) {
             $this->days = array_keys(Request::getArray('days'));
         } else {
             $this->days = $schedule_settings['glb_days'];
             foreach ($this->days as $key => $day_number) {
                 $this->days[$key] = ($day_number + 6) % 7;
             }
         }
     } else {
         $this->days = explode(',', $days);
     }
     $this->controller = $this;
     $this->calendar_view = $inst_mode ? CalendarScheduleModel::getInstCalendarView($institute_id, $show_hidden, $this->current_semester, $this->days) : CalendarScheduleModel::getUserCalendarView($GLOBALS['user']->id, $show_hidden, $this->current_semester, $this->days);
     // have we chosen an entry to display?
     if ($this->flash['entry']) {
         if ($inst_mode) {
             $this->show_entry = $this->flash['entry'];
         } else {
             if ($this->flash['entry']['id'] == null) {
                 $this->show_entry = $this->flash['entry'];
             } else {
                 foreach ($this->calendar_view->getColumns() as $entry_days) {
                     foreach ($entry_days->getEntries() as $entry) {
                         if ($this->flash['entry']['cycle_id']) {
                             if ($this->flash['entry']['id'] . '-' . $this->flash['entry']['cycle_id'] == $entry['id']) {
                                 $this->show_entry = $entry;
                                 $this->show_entry['id'] = reset(explode('-', $this->show_entry['id']));
                             }
                         } else {
                             if ($entry['id'] == $this->flash['entry']['id']) {
                                 $this->show_entry = $entry;
                             }
                         }
                     }
                 }
             }
         }
     }
     $style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight());
     $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views');
     PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters), 'screen, print');
     if (Request::option('printview')) {
         $this->calendar_view->setReadOnly();
         PageLayout::addStylesheet('print.css');
     } else {
         PageLayout::addStylesheet('print.css', array('media' => 'print'));
     }
     $this->show_hidden = $show_hidden;
     $inst = get_object_name($institute_id, 'inst');
     $this->inst_mode = $inst_mode;
     $this->institute_name = $inst['name'];
     $this->institute_id = $institute_id;
     if (Request::get('show_settings')) {
         $this->show_settings = true;
     }
 }
Ejemplo n.º 13
0
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $this->setupAutoload();
     if (ForumPerm::has('view', $course_id, $user_id)) {
         $postings = ForumEntry::getLatestSince($course_id, $since);
         $contents = array();
         foreach ($postings as $post) {
             $obj = get_object_name($course_id, 'sem');
             $summary = sprintf(_('%s hat im Forum der Veranstaltung "%s" einen Forenbeitrag verfasst.'), get_fullname($post['user_id']), $obj['name']);
             $contents[] = new ContentElement(_('Forum: ') . $obj['name'], $summary, formatReady($post['content']), $post['user_id'], $post['author'], PluginEngine::getURL($this, array(), 'index/index/' . $post['topic_id'] . '?cid=' . $course_id . '#' . $post['topic_id']), $post['mkdate']);
         }
     }
     return $contents;
 }
Ejemplo n.º 14
0
<?php

$seminar = get_object_name($topic['seminar_id'], 'sem');
array_pop($path);
// last element is the entry itself
$message = array('header' => sprintf(_('Im Forum der Veranstaltung **%s** gibt es einen neuen Beitrag unter **%s** von **%s**'), $seminar['name'], implode(' > ', array_map(function ($p) {
    return $p['name'];
}, $path)), $topic['anonymous'] ? _('Anonym') : $topic['author']), 'title' => $topic['name'] ? '**' . $topic['name'] . "** \n\n" : '', 'content' => $topic['content'], 'url' => '<a href="' . UrlHelper::getUrl($GLOBALS['ABSOLUTE_URI_STUDIP'] . 'plugins.php/coreforum/index/index/' . $topic['topic_id'] . '?cid=' . $topic['seminar_id'] . '&again=yes#' . $topic['topic_id']) . '">Beitrag im Forum ansehen.</a>');
// since we've possibly got a mixup of HTML and Stud.IP markup,
// create a pure HTML message step by step
$htmlMessage = '<div>' . implode('<br><br>', array_map('formatReady', $message)) . '</div>';
echo $htmlMessage;
Ejemplo n.º 15
0
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
require '../lib/bootstrap.php';
ob_start();
page_open(array("sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User"));
$perm->check('admin');
include 'lib/seminar_open.php';
// initialise Stud.IP-Session
$element = new StudipLitCatElement();
if (Request::quotedArray('_lit_data')) {
    $_SESSION['_lit_data'] = Request::quotedArray('_lit_data');
}
$header = get_object_name($_inst_id, 'inst');
?>
<h1>
<?php 
echo htmlReady(sprintf(_("Literaturliste %s"), $header['type'] . ": " . $header['name']));
?>
</h1>
<?
if (is_array($_SESSION['_lit_data'])){
    foreach ($_SESSION['_lit_data'] as $cid => $data){
        $element->setValues($data);
        if ($element->getValue('catalog_id')){
            $titel = htmlReady($element->getShortName());
            echo "\n<table width=\"99%\" cellpadding=\"0\" cellspacing=\"4\" border=\"0\" align=\"center\"><tr>";
            echo '<td><b>' . $titel . '</b></td>';
            echo "\n</tr></table>";
Ejemplo n.º 16
0
 /**
  * Create a pdf of all postings belonging to the passed seminar located
  * under the passed topic_id. The PDF is dispatched automatically.
  * 
  * BEWARE: This function never returns, it dies after the PDF has been 
  * (succesfully or not) dispatched.
  * 
  * @param string $seminar_id
  * @param string $parent_id
  */
 static function createPdf($seminar_id, $parent_id = null)
 {
     $seminar_name = get_object_name($seminar_id, 'sem');
     $data = ForumEntry::getList('dump', $parent_id ?: $seminar_id);
     $first_page = true;
     $document = new ExportPDF();
     $document->SetTitle(_('Forum'));
     $document->setHeaderTitle(sprintf(_("Forum \"%s\""), $seminar_name['name']));
     $document->addPage();
     foreach ($data['list'] as $entry) {
         if (Config::get()->FORUM_ANONYMOUS_POSTINGS && $entry['anonymous']) {
             $author = _('anonym');
         } else {
             $author = $entry['author'];
         }
         if ($entry['depth'] == 1) {
             if (!$first_page) {
                 $document->addPage();
             }
             $first_page = false;
             $document->addContent('++++**' . _('Bereich') . ': ' . $entry['name_raw'] . '**++++' . "\n");
             $document->addContent($entry['content_raw']);
             $document->addContent("\n\n");
         } else {
             if ($entry['depth'] == 2) {
                 $document->addContent('++**' . _('Thema') . ': ' . $entry['name_raw'] . '**++' . "\n");
                 $document->addContent('%%' . sprintf(_('erstellt von %s am %s'), $author, strftime('%A %d. %B %Y, %H:%M', (int) $entry['mkdate'])) . '%%' . "\n");
                 $document->addContent($entry['content_raw']);
                 $document->addContent("\n\n");
             } else {
                 if ($entry['depth'] == 3) {
                     $document->addContent('**' . $entry['name_raw'] . '**' . "\n");
                     $document->addContent('%%' . sprintf(_('erstellt von %s am %s'), $author, strftime('%A %d. %B %Y, %H:%M', (int) $entry['mkdate'])) . '%%' . "\n");
                     $document->addContent($entry['content_raw']);
                     $document->addContent("\n--\n");
                 }
             }
         }
     }
     $document->dispatch($seminar_name['name'] . " - Forum");
     die;
 }
Ejemplo n.º 17
0
 /**
  * Displays edit form and performs according actions upon submit
  *
  * @param int    $banner_id Id from the banner-object
  */
 public function edit_action($banner_id)
 {
     $banner = Banner::find($banner_id);
     if ($banner === null) {
         throw new Exception(sprintf(_('Es existiert kein Banner mit der Id "%s"'), $banner_id));
     }
     // edit banner input
     if (Request::submitted('speichern')) {
         $banner_path = Request::get('banner_path');
         $description = Request::get('description');
         $alttext = Request::get('alttext');
         $target_type = Request::get('target_type');
         $priority = Request::int('priority');
         //add the right target
         if ($target_type == 'url') {
             $target = Request::get('target');
         } else {
             if ($target_type == 'inst') {
                 $target = Request::option('institut');
             } else {
                 if ($target_type == 'user') {
                     $target = Request::username('user');
                 } else {
                     if ($target_type == 'seminar') {
                         $target = Request::option('seminar');
                     } else {
                         $target = Request::get('target');
                     }
                 }
             }
         }
         $errors = array();
         //upload file
         $upload = $_FILES['imgfile'];
         if (!empty($upload['name'])) {
             $banner_path = $this->bannerupload($upload['tmp_name'], $upload['size'], $upload['name'], $errors);
         }
         if (!$target && $target_type != 'none') {
             $errors[] = _('Es wurde kein Verweisziel angegeben.');
         }
         $startDate = explode('.', Request::get('start_date'));
         if (($x = $this->valid_date(Request::int('start_hour'), Request::int('start_minute'), $startDate[0], $startDate[1], $startDate[2])) == -1) {
             $errors[] = _('Bitte geben Sie einen gültiges Startdatum ein.');
         } else {
             $startdate = $x;
         }
         $endDate = explode('.', Request::get('end_date'));
         if (($x = $this->valid_date(Request::int('end_hour'), Request::int('end_minute'), $endDate[0], $endDate[1], $endDate[2])) == -1) {
             $errors[] = _('Bitte geben Sie einen gültiges Enddatum ein.');
         } else {
             $enddate = $x;
         }
         switch ($target_type) {
             case 'url':
                 if (!preg_match('~^(https?|ftp)://~i', $target)) {
                     $errors[] = _('Das Verweisziel muss eine gültige URL sein (incl. http://).');
                 }
                 break;
             case 'inst':
                 if (Institute::find($target) === null) {
                     $errors[] = _('Die angegebene Einrichtung existiert nicht. ' . 'Bitte geben Sie eine gültige Einrichtungs-ID ein.');
                 }
                 break;
             case 'user':
                 if (User::findByUsername($target) === null) {
                     $errors[] = _('Der angegebene Username existiert nicht.');
                 }
                 break;
             case 'seminar':
                 try {
                     Seminar::getInstance($target);
                 } catch (Exception $e) {
                     $errors[] = _('Die angegebene Veranstaltung existiert nicht. ' . 'Bitte geben Sie eine gültige Veranstaltungs-ID ein.');
                 }
                 break;
             case 'none':
                 $target = '';
                 break;
         }
         if (count($errors) > 0) {
             PageLayout::postMessage(MessageBox::error(_('Es sind folgende Fehler aufgetreten:'), $errors));
         } else {
             $banner->banner_path = $banner_path;
             $banner->description = $description;
             $banner->alttext = $alttext;
             $banner->target_type = $target_type;
             $banner->target = $target;
             $banner->startdate = $startdate;
             $banner->enddate = $enddate;
             $banner->priority = $priority;
             $banner->store();
             PageLayout::postMessage(MessageBox::success(_('Der Banner wurde erfolgreich gespeichert.')));
             $this->redirect('admin/banner');
         }
     }
     if ($banner['target_type'] == 'seminar') {
         $seminar_name = get_object_name($banner['target'], 'sem');
         $this->seminar = QuickSearch::get('seminar', new StandardSearch('Seminar_id'))->setInputStyle('width: 240px')->defaultValue($banner['target'], $seminar_name['name'])->render();
     }
     if ($banner['target_type'] == 'user') {
         $this->user = QuickSearch::get('user', new StandardSearch('username'))->setInputStyle('width: 240px')->defaultValue($banner['target'], $banner['target'])->render();
     }
     if ($banner['target_type'] == 'inst') {
         $institut_name = get_object_name($banner['target'], 'inst');
         $this->institut = QuickSearch::get('institut', new StandardSearch('Institut_id'))->setInputStyle('width: 240px')->defaultValue($banner['target'], $institut_name['name'])->render();
     }
     $this->banner = $banner;
 }
Ejemplo n.º 18
0
    <div class="hiddeninfo">
        <input type="hidden" name="context" value="<?php 
echo htmlReady($thread['Seminar_id']);
?>
">
        <input type="hidden" name="context_type" value="<?php 
echo $thread['Seminar_id'] === $thread['user_id'] ? "public" : "course";
?>
">
    </div>
    <? if ($thread['context_type'] === "course") : ?>
        <a href="<?php 
echo URLHelper::getLink("plugins.php/blubber/streams/forum", array('cid' => $thread['Seminar_id']));
?>
"
            <? $title = get_object_name($thread['Seminar_id'], "sem") ?>
           title="<?php 
echo _("Veranstaltung") . " " . htmlReady($title['name']);
?>
"
           class="contextinfo"
           >
            <div class="name"><?php 
echo htmlReady(Course::find($thread['Seminar_id'])->name);
?>
</div>
        </a>
    <? elseif($thread['context_type'] === "private") : ?>
        <?
        if (count($related_users) > 20) {
            $title = _("Privat: ").sprintf(_("%s Personen"), count($related_users));
Ejemplo n.º 19
0
/**
 * generic_delete 
 * 
 * @param mixed $object the object class name
 * @param mixed $id     the unique identifier
 *
 * @access public
 * @return string
 */
function generic_delete($request)
{
    $object = $request->getParam('object');
    $id = $request->getParam('id');
    $object_name = get_object_name($object);
    $object = Doctrine::getTable($object)->find($id);
    if ($object) {
        $object->delete();
    }
    return redirect('/' . $object_name);
}