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();
 }
Example #2
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     global $perm;
     parent::before_filter($action, $args);
     $course_id = $args[0];
     $this->course_id = Request::option('cid', $course_id);
     Navigation::activateItem('/course/admin/admission');
     if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new Trails_Exception(403);
     }
     $this->course = Course::find($this->course_id);
     $this->user_id = $GLOBALS['user']->id;
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenZugangsberechtigungen");
     PageLayout::setTitle($this->course->getFullname() . " - " . _("Verwaltung von Zugangsberechtigungen"));
     $lockrules = words('admission_turnout admission_type admission_endtime admission_binding passwort read_level write_level admission_prelim admission_prelim_txt admission_starttime admission_endtime_sem admission_disable_waitlist user_domain admission_binding admission_studiengang');
     foreach ($lockrules as $rule) {
         $this->is_locked[$rule] = LockRules::Check($this->course_id, $rule) ? 'disabled readonly' : '';
     }
     if (!SeminarCategories::GetByTypeId($this->course->status)->write_access_nobody) {
         $this->is_locked['write_level'] = 'disabled readonly';
     }
     update_admission($this->course->id);
     PageLayout::addSqueezePackage('admission');
     URLHelper::addLinkParam('return_to_dialog', Request::get('return_to_dialog'));
 }
Example #3
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     global $perm;
     parent::before_filter($action, $args);
     if (Request::get('termin_id')) {
         $this->dates[0] = new SingleDate(Request::option('termin_id'));
         $this->course_id = $this->dates[0]->range_id;
     }
     if (Request::get('issue_id')) {
         $this->issue_id = Request::option('issue_id');
         $this->dates = array_values(array_map(function ($data) {
             $d = new SingleDate();
             $d->fillValuesFromArray($data);
             return $d;
         }, IssueDB::getDatesforIssue(Request::option('issue_id'))));
         $this->course_id = $this->dates[0]->range_id;
     }
     if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new Trails_Exception(400);
     }
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen");
     PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _("Veranstaltungstermine absagen"));
     $this->set_content_type('text/html;charset=windows-1252');
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->response->add_header('X-Title', PageLayout::getTitle());
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     }
 }
Example #4
0
 function getTabNavigation($course_id)
 {
     $object_type = get_object_type($course_id, array('sem', 'inst'));
     if ($object_type === 'sem') {
         $course = Course::find($course_id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$course->status]['class']] ?: SemClass::getDefaultSemClass();
     } else {
         $institute = Institute::find($course_id);
         $sem_class = SemClass::getDefaultInstituteClass($institute->type);
     }
     $navigation = new Navigation(_('Übersicht'));
     $navigation->setImage(Icon::create('seminar', 'info_alt'));
     $navigation->setActiveImage(Icon::create('seminar', 'info'));
     if ($object_type !== 'sem') {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/institute/overview'));
         $navigation->addSubNavigation('courses', new Navigation(_('Veranstaltungen'), 'show_bereich.php?level=s&id=' . $course_id));
         $navigation->addSubNavigation('schedule', new Navigation(_('Veranstaltungs-Stundenplan'), 'dispatch.php/calendar/instschedule?cid=' . $course_id));
         if ($GLOBALS['perm']->have_studip_perm('admin', $course_id)) {
             $navigation->addSubNavigation('admin', new Navigation(_('Administration der Einrichtung'), 'dispatch.php/institute/basicdata/index?new_inst=TRUE'));
         }
     } else {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/course/overview'));
         if (!$sem_class['studygroup_mode']) {
             $navigation->addSubNavigation('details', new Navigation(_('Details'), 'dispatch.php/course/details/'));
         }
         if (!$course->admission_binding && in_array($GLOBALS['perm']->get_studip_perm($course_id), array('user', 'autor'))) {
             $navigation->addSubNavigation('leave', new Navigation(_('Austragen aus der Veranstaltung'), 'dispatch.php/my_courses/decline/' . $course_id . '?cmd=suppose_to_kill'));
         }
     }
     return array('main' => $navigation);
 }
 /**
  * Gets the name of the range. Copied somewhere from Stud.IP...
  * @access  public
  * @param   string   $rangeID         the rangeID
  * @param   boolean  $html_decode     (optional)
  * @return  string                    The name of the range
  */
 function getRangename($rangeID, $html_decode = true)
 {
     global $user;
     if ($rangeID == "studip") {
         return _("Systemweite Evaluationen");
     }
     $o_type = get_object_type($rangeID, array('sem', 'user', 'inst'));
     if (in_array($o_type, array('sem', 'inst', 'fak'))) {
         $name = getHeaderLine($rangeID);
         if ($name != NULL) {
             if ($html_decode) {
                 $rangename = decodeHTML($name);
             } else {
                 $rangename = $name;
             }
         } else {
             $rangename = _("Kein Titel gefunden.");
         }
         return $rangename;
     }
     if ($o_type != 'user') {
         $user_id = get_userid($rangeID);
     } else {
         $user_id = $rangeID;
     }
     if ($user_id != $user->id) {
         $rangename = _("Profil: ") . get_fullname($user_id, 'full', 1) . " (" . get_username($user_id) . ")";
     } else {
         $rangename = _("Profil");
     }
     return $rangename;
 }
Example #6
0
 /**
  * Set the seminar denoted by the passed id as visited by the currently 
  * logged in user
  * 
  * @param string $seminar_id
  */
 static function setVisit($seminar_id)
 {
     $type = get_object_type($seminar_id, words('fak inst sem'));
     if ($type === 'fak') {
         $type = 'inst';
     }
     if (self::getVisit($seminar_id) < object_get_visit($seminar_id, $type, false, false)) {
         self::setVisitdates($seminar_id);
     }
 }
Example #7
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  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))
  */
 function index_action($days = false)
 {
     if ($GLOBALS['perm']->have_perm('admin')) {
         $inst_mode = true;
     }
     $my_schedule_settings = $GLOBALS['user']->cfg->SCHEDULE_SETTINGS;
     // set the days to be displayed
     if ($days === false) {
         if (Request::getArray('days')) {
             $this->days = array_keys(Request::getArray('days'));
         } else {
             $this->days = array(0, 1, 2, 3, 4, 5, 6);
         }
     } else {
         $this->days = explode(',', $days);
     }
     // 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 = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT;
     }
     if (!$institute_id || in_array(get_object_type($institute_id), words('inst fak')) === false) {
         throw new Exception(sprintf(_('Kann Einrichtungskalendar nicht anzeigen!' . 'Es wurde eine ungültige Instituts-Id übergeben (%s)!', $institute_id)));
     }
     // load semester-data and current semester
     $semdata = new SemesterData();
     $this->semesters = $semdata->getAllSemesterData();
     if (Request::option('semester_id')) {
         $this->current_semester = $semdata->getSemesterData(Request::option('semester_id'));
     } else {
         $this->current_semester = $semdata->getCurrentSemesterData();
     }
     $this->entries = (array) CalendarInstscheduleModel::getInstituteEntries($GLOBALS['user']->id, $this->current_semester, 8, 20, $institute_id, $this->days);
     Navigation::activateItem('/course/main/schedule');
     PageLayout::setHelpKeyword('Basis.TerminkalenderStundenplan');
     PageLayout::setTitle($GLOBALS['SessSemName']['header_line'] . ' - ' . _('Veranstaltungs-Stundenplan'));
     $zoom = Request::int('zoom', 0);
     $this->controller = $this;
     $this->calendar_view = new CalendarWeekView($this->entries, 'instschedule');
     $this->calendar_view->setHeight(40 + 20 * $zoom);
     $this->calendar_view->setRange($my_schedule_settings['glb_start_time'], $my_schedule_settings['glb_end_time']);
     $this->calendar_view->groupEntries();
     // if enabled, group entries with same start- and end-date
     URLHelper::addLinkParam('zoom', $zoom);
     URLHelper::addLinkParam('semester_id', $this->current_semester['semester_id']);
     $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));
     if (Request::option('printview')) {
         PageLayout::addStylesheet('print.css');
     } else {
         PageLayout::addStylesheet('print.css', array('media' => 'print'));
     }
 }
Example #8
0
 /**
  * Common tasks for all actions
  *
  * @param String $action Called action
  * @param Array  $args   Possible arguments
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $course_id = $args[0];
     $this->course_id = Request::option('cid', $course_id);
     if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$GLOBALS['perm']->have_studip_perm("tutor", $this->course_id)) {
         throw new Trails_Exception(400);
     }
     PageLayout::addSqueezePackage('raumzeit');
     PageLayout::setHelpKeyword('Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen');
     PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _('Blockveranstaltungstermine anlegen'));
 }
Example #9
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 wiki.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM wiki
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN seminar_user ON (range_id = Seminar_id)
             JOIN seminare USING (Seminar_id)
             WHERE seminar_user.user_id = ? AND Seminar_id = ? 
                 AND wiki.chdate > ?';
     } else {
         $query = 'SELECT wiki.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM wiki
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN user_inst ON (range_id = Institut_id)
             JOIN Institute USING (Institut_id)
             WHERE user_inst.user_id = ? AND Institut_id = ? 
                 AND wiki.chdate > ?';
     }
     $wikipage_stmt = DBManager::get()->prepare("SELECT * FROM wiki\n            WHERE keyword = ? AND range_id = ?\n                AND version = ?");
     $stmt = DBManager::get()->prepare($query);
     $stmt->execute(array($user_id, $course_id, $since));
     while ($row = $stmt->fetch()) {
         // use correct text depending on type of object
         if ($type == 'sem') {
             if ($row['version'] > 1) {
                 $summary = sprintf('%s hat im Wiki der Veranstaltung "%s" die Seite "%s" geändert.', $row['fullname'], $row['Name'], $row['keyword']);
             } else {
                 $summary = sprintf('%s hat im Wiki der Veranstaltung "%s" die Seite "%s" erstellt.', $row['fullname'], $row['Name'], $row['keyword']);
             }
         } else {
             if ($row['version'] > 1) {
                 $summary = sprintf('%s hat im Wiki der Einreichtung "%s" die Seite "%s" geändert.', $row['fullname'], $row['Name'], $row['keyword']);
             } else {
                 $summary = sprintf('%s hat im Wiki der Einreichtung "%s" die Seite "%s" erstellt.', $row['fullname'], $row['Name'], $row['keyword']);
             }
         }
         $content = '';
         if ($row['version'] > 1) {
             $wikipage_stmt->execute(array($row['keyword'], $row['range_id'], $row['version'] - 1));
             $old_page = $wikipage_stmt->fetch(PDO::FETCH_ASSOC);
             $content = '<table>' . do_diff($old_page['body'], $row['body']) . '</table>';
         } else {
             $content = wikiReady($row['body']);
         }
         $items[] = new ContentElement('Wiki: ' . $row['keyword'], $summary, $content, $row['user_id'], $row['fullname'], URLHelper::getLink('wiki.php', array('cid' => $row['range_id'], 'keyword' => $row['keyword'])), $row['chdate']);
     }
     return $items;
 }
Example #10
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->institute_id = current($args);
     if ($this->institute_id === '' || !in_array(get_object_type($this->institute_id), words('inst fak')) || !$GLOBALS['perm']->have_studip_perm("admin", $this->institute_id)) {
         $this->set_status(403);
         return FALSE;
     }
     $this->body_id = 'custom_avatar';
     PageLayout::setTitle(getHeaderLine($this->institute_id) . ' - ' . _('Bild ändern'));
     Navigation::activateItem('/admin/institute/details');
     # choose base layout w/o infobox and set tabs
     $layout = $GLOBALS['template_factory']->open('layouts/base_without_infobox');
     $this->set_layout($layout);
 }
Example #11
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;
    }
Example #12
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $course_id = Request::option('cid');
     if (isset($_SESSION['seminar_change_view_' . $course_id])) {
         unset($_SESSION['seminar_change_view_' . $course_id]);
         // Reset simulated view, redirect to administration page.
         $this->redirect(URLHelper::getURL('dispatch.php/course/management'));
     } elseif (get_object_type($course_id, array('sem')) && !SeminarCategories::GetBySeminarId($course_id)->studygroup_mode && in_array($GLOBALS['perm']->get_studip_perm($course_id), words('tutor dozent'))) {
         // Set simulated view, redirect to overview page.
         $_SESSION['seminar_change_view_' . $course_id] = 'autor';
         $this->redirect(URLHelper::getURL('seminar_main.php'));
     } else {
         throw new Trails_Exception(400);
     }
 }
Example #13
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->course_id = $args[0];
     if (!in_array($action, words('apply claim delete order_down order_up'))) {
         $this->redirect($this->url_for('/apply/' . $action));
         return false;
     }
     if (!get_object_type($this->course_id, array('sem'))) {
         throw new Trails_Exception(400);
     }
     $course = Seminar::GetInstance($this->course_id);
     $enrolment_info = $course->getEnrolmentInfo($GLOBALS['user']->id);
     //Ist bereits Teilnehmer/Admin/freier Zugriff -> gleich weiter
     if ($enrolment_info['enrolment_allowed'] && (in_array($enrolment_info['cause'], words('root courseadmin member')) || $enrolment_info['cause'] == 'free_access' && $GLOBALS['user']->id == 'nobody')) {
         $redirect_url = UrlHelper::getUrl('seminar_main.php', array('auswahl' => $this->course_id));
         if (Request::isXhr()) {
             $this->response->add_header('X-Location', $redirect_url);
             $this->render_nothing();
         } else {
             $this->redirect($redirect_url);
         }
         return false;
     }
     //Grundsätzlich verboten
     if (!$enrolment_info['enrolment_allowed']) {
         throw new AccessDeniedException($enrolment_info['description']);
     }
     PageLayout::setTitle($course->getFullname() . " - " . _("Veranstaltungsanmeldung"));
     PageLayout::addSqueezePackage('enrolment');
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->response->add_header('X-No-Buttons', 1);
         $this->response->add_header('X-Title', PageLayout::getTitle());
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     } else {
         $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     }
     $this->set_content_type('text/html;charset=windows-1252');
     if (Request::submitted('cancel')) {
         $this->redirect(URLHelper::getURL('dispatch.php/course/details/', array('sem_id' => $this->course_id)));
     }
 }
Example #14
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
    }
Example #15
0
 /**
  * returns the lock rule object for the given id, else null
  * 
  * @param string $object_id id of course, institute or user
  * @param bool $renew if true, reloads the rule from database
  * @return LockRule 
  */
 public static function getObjectRule($object_id, $renew = false)
 {
     if (!array_key_exists($object_id, self::$lockmap) || $renew) {
         $object_type = get_object_type($object_id, words('sem inst user'));
         if ($object_type) {
             $methodmap = array('sem' => 'Seminar', 'inst' => 'Institute', 'fak' => 'Institute', 'user' => 'User');
             $lr = call_user_func(array('LockRule', 'FindBy' . $methodmap[$object_type]), $object_id);
             if ($lr) {
                 self::$lockmap[$object_id] = $lr->getId();
                 self::$lockrules[$lr->getId()] = $lr;
             } else {
                 self::$lockmap[$object_id] = null;
             }
         }
     }
     return self::$lockmap[$object_id] ? self::$lockrules[self::$lockmap[$object_id]] : null;
 }
Example #16
0
 /**
  * Common tasks for all actions
  *
  * @param String $action Called action
  * @param Array  $args   Possible arguments
  */
 public function before_filter(&$action, &$args)
 {
     global $perm;
     $this->current_action = $action;
     parent::before_filter($action, $args);
     $course_id = $args[0];
     $this->course_id = Request::option('cid', $course_id);
     if ($course_id != '-') {
         //Navigation in der Veranstaltung:
         Navigation::activateItem('/course/admin/room_requests');
         if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
             throw new Trails_Exception(400);
         }
         PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen");
         PageLayout::setTitle(Course::find($this->course_id)->getFullname() . " - " . _("Verwaltung von Raumanfragen"));
     }
 }
Example #17
0
 function getTabNavigation($course_id)
 {
     if (get_config('LITERATURE_ENABLE')) {
         $object_type = get_object_type($course_id);
         $navigation = new Navigation(_('Literatur'));
         $navigation->setImage(Icon::create('literature', 'info_alt'));
         $navigation->setActiveImage(Icon::create('literature', 'info'));
         $navigation->addSubNavigation('view', new Navigation(_('Literatur'), "dispatch.php/course/literature?view=literatur_" . $object_type));
         if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id)) {
             $navigation->addSubNavigation('edit', new Navigation(_('Literatur bearbeiten'), 'dispatch.php/literature/edit_list?view=literatur_' . $object_type . '&new_' . $object_type . '=TRUE&_range_id=' . $course_id));
             $navigation->addSubNavigation('search', new Navigation(_('Literatur suchen'), 'dispatch.php/literature/search?return_range=' . $course_id));
         }
         return array('literature' => $navigation);
     } else {
         return null;
     }
 }
Example #18
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $this->course_id = current($args);
     if ($this->course_id === '' || get_object_type($this->course_id) !== 'sem' || !$GLOBALS['perm']->have_studip_perm("tutor", $this->course_id)) {
         $this->set_status(403);
         return FALSE;
     }
     $this->body_id = 'custom_avatar';
     PageLayout::setTitle(Course::findCurrent()->getFullname() . ' - ' . _('Bild ändern'));
     $sem = Seminar::getInstance($this->course_id);
     $this->studygroup_mode = $sem->getSemClass()->offsetget("studygroup_mode");
     if ($this->studygroup_mode) {
         $this->avatar = StudygroupAvatar::getAvatar($this->course_id);
     } else {
         $this->avatar = CourseAvatar::getAvatar($this->course_id);
     }
     Navigation::activateItem('/course/admin/avatar');
 }
Example #19
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;
 }
Example #20
0
 /**
  * Widget controller to produce the formally known show_votes()
  *
  * @param String $range_id range id (or array of range ids) of the news to get displayed
  * @return array() Array of votes
  */
 function display_action($range_id, $timespan = 604800, $start = null)
 {
     // Fetch time if needed
     $this->start = $start ?: strtotime('today');
     $this->timespan = $timespan;
     // To array fallback of $range_id
     if (!is_array($range_id)) {
         $this->single = true;
         $range_id = array($range_id);
     }
     foreach ($range_id as $id) {
         switch (get_object_type($id, array('user', 'sem'))) {
             case 'user':
                 $this->parseUser($id);
                 $this->userRange = true;
                 break;
             case 'sem':
                 $this->parseSeminar($id);
                 break;
         }
     }
     // Check permission to edit
     if ($this->single) {
         $this->admin = $range_id[0] == $GLOBALS['user']->id || get_object_type($range_id[0], array('sem')) === 'sem' && $GLOBALS['perm']->have_studip_perm('tutor', $range_id[0]);
         // Set range_id
         $this->range_id = $range_id[0];
     }
     // Forge title
     if ($this->termine) {
         $this->title = sprintf(_("Termine für die Zeit vom %s bis zum %s"), strftime("%d. %B %Y", $this->start), strftime("%d. %B %Y", $this->start + $this->timespan));
     } else {
         $this->title = _('Termine');
     }
     // Check out if we are on a profile
     if ($this->admin) {
         $this->isProfile = $this->single && $this->userRange;
     }
 }
Example #21
0
 function getNotificationObjects($course_id, $since, $user_id)
 {
     $items = array();
     $type = get_object_type($course_id, array('sem', 'inst', 'fak'));
     // only show new participants for seminars, not for institutes
     if ($type != 'sem') {
         return $items;
     }
     $stmt = DBManager::get()->prepare('SELECT seminar_user.*, seminare.Name, seminare.status,
         ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
         FROM seminar_user
         JOIN auth_user_md5 USING (user_id)
         JOIN user_info USING (user_id)
         JOIN seminare USING (Seminar_id)
         WHERE Seminar_id = ? 
             AND seminar_user.mkdate > ?');
     $stmt->execute(array($course_id, $since));
     while ($row = $stmt->fetch()) {
         $summary = sprintf('%s ist der Veranstaltung "%s" beigetreten.', $row['fullname'], $row['Name']);
         $items[] = new ContentElement('Studiengruppe: Neue/r Teilnehmer/in', $summary, '', $row['user_id'], $row['fullname'], URLHelper::getLink('seminar_main.php?auswahl=' . $row['Seminar_id'] . '&redirect_to=dispatch.php/course/member'), $row['mkdate']);
     }
     return $items;
 }
Example #22
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 scm.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM scm
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN seminar_user ON (range_id = Seminar_id)
             JOIN seminare USING (Seminar_id)
             WHERE seminar_user.user_id = ? AND Seminar_id = ? 
                 AND scm.chdate > ?';
     } else {
         $query = 'SELECT scm.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
             FROM scm
             JOIN auth_user_md5 USING (user_id)
             JOIN user_info USING (user_id)
             JOIN user_inst ON (range_id = Institut_id)
             JOIN Institute USING (Institut_id)
             WHERE user_inst.user_id = ? AND Institut_id = ? 
                 AND scm.chdate > ?';
     }
     $stmt = DBManager::get()->prepare($query);
     $stmt->execute(array($user_id, $course_id, $since));
     while ($row = $stmt->fetch()) {
         // use correct text depending on type of object
         if ($type == 'sem') {
             $summary = sprintf('%s hat in der Veranstaltung "%s" die Informationsseite "%s" geändert.', $row['fullname'], $row['Name'], $row['tab_name']);
         } else {
             $summary = sprintf('%s hat in der Einreichtung "%s" die Informationsseite "%s" geändert.', $row['fullname'], $row['Name'], $row['tab_name']);
         }
         $link = URLHelper::getLink('dispatch.php/course/scm/' . $row['scm_id'], array('cid' => $row['range_id']));
         $items[] = new ContentElement('Freie Informationsseite: ' . $row['tab_name'], $summary, formatReady($row['content']), $row['user_id'], $row['fullname'], $link, $row['chdate']);
     }
     return $items;
 }
    /**
    *
    */
    function toStringEdit ($post_vars = "", $faulty_values = "",
            $edit_form = "", $anker = "") {

        update_generic_datafields($this->config, $this->data_fields["content"],
                $this->field_names["content"], "user");
        $out = "";
        $table = "";
        if ($edit_form == "")
            $edit_form = new ExternEditModule($this->config, $post_vars, $faulty_values, $anker);

        $edit_form->setElementName($this->getName());
        $element_headline = $edit_form->editElementHeadline($this->real_name,
                $this->config->getName(), $this->config->getId(), TRUE, $anker);

        $headline = $edit_form->editHeadline(_("Name der Konfiguration"));
        $table = $edit_form->editName("name");
        $content_table = $edit_form->editContentTable($headline, $table);
        $content_table .= $edit_form->editBlankContent();

        $content_table .= $this->getSRIFormContent($edit_form);

        $headline = $edit_form->editHeadline(_("Weitere Angaben"));

        $title = _("Namensformat:");
        $info = _("Wählen Sie, wie Personennamen formatiert werden sollen.");
        $values = array("", "no_title_short", "no_title", "no_title_rev", "full", "full_rev");
        $names = array(_("keine Auswahl"), _("Meyer, P."), _("Peter Meyer"), _("Meyer Peter"),
                _("Dr. Peter Meyer"), _("Meyer, Peter, Dr."));
        $table = $edit_form->editOptionGeneric("nameformat", $title, $info, $values, $names);

        $title = _("Datumsformat:");
        $info = _("Wählen Sie, wie Datumsangaben formatiert werden sollen.");
        $values = array("%d. %b. %Y", "%d.%m.%Y", "%d.%m.%y", "%d. %B %Y", "%m/%d/%y");
        $names = array(_("25. Nov. 2003"), _("25.11.2003"), _("25.11.03"),
                _("25. November 2003"), _("11/25/03"));
        $table .= $edit_form->editOptionGeneric("dateformat", $title, $info, $values, $names);

        $title = _("Sprache:");
        $info = _("Wählen Sie eine Sprache für die Datumsangaben aus.");
        $values = array("", "de_DE", "en_GB");
        $names = array(_("keine Auswahl"), _("Deutsch"), _("Englisch"));
        $table .= $edit_form->editOptionGeneric("language", $title, $info, $values, $names);

        if (in_array(get_object_type($this->config->range_id), array('fak', 'global'))) {
            $title = _("Nur Lehrende:");
            $info = _("Es werden nur Personen angezeigt, die in einer sichtbaren Veranstaltung des aktuellen Semesters Dozent sind.");
            $values = '1';
            $table .= $edit_form->editCheckboxGeneric('onlylecturers', $title, $info, $values, '');

            $table .= $edit_form->editTextblock('<span style="font-weight: bold">'
                . _("Das Modul zeigt nur Personen an, die eine Standardadresse angegeben haben.")
                . '</span>');
        } else {
            $title = _("Standard-Adresse:");
            $info = _("Wenn Sie diese Option wählen, wird die Standard-Adresse ausgegeben, die jede(r) Mitarbeiter(in) bei seinen universitären Daten auswählen kann. Wählen Sie diese Option nicht, wenn immer die Adresse der Einrichtung ausgegeben werden soll.");
            $table .= $edit_form->editCheckboxGeneric('defaultaddr', $title, $info, '1', '0');
        }

        $content_table .= $edit_form->editContentTable($headline, $table);
        $content_table .= $edit_form->editBlankContent();

        $submit = $edit_form->editSubmit($this->config->getName(),
                $this->config->getId(), $this->getName());
        $out = $edit_form->editContent($content_table, $submit);
        $out .= $edit_form->editBlank();

        return $element_headline . $out;
    }
Example #24
0
 /**
  * Returns the object type this event belongs to.
  * Possible values are 'user', 'sem', 'inst', 'fak'.
  *
  * @return string The object type.
  */
 public function getType()
 {
     return get_object_type($this->range_id, array('user', 'sem', 'inst', 'fak'));
 }
Example #25
0
    /**
    *
    */
    function checkRangeId ($range_id) {
        if ($range_id == 'studip') {
            return in_array('studip', $GLOBALS['EXTERN_MODULE_TYPES'][$this->type]['view']);
        }

        return in_array(get_object_type($range_id), $GLOBALS['EXTERN_MODULE_TYPES'][$this->type]['view']);
    }
Example #26
0
 public function getTypeExplained()
 {
     $ret = '';
     if ($this->termin_id) {
         $ret = _("Einzeltermin der Veranstaltung");
         if (get_object_type($this->termin_id, array('date'))) {
             $termin = new SingleDate($this->termin_id);
             $ret .= chr(10) . '(' . $termin->toString() . ')';
         }
     } elseif ($this->metadate_id) {
         $ret = _("alle Termine einer regelmäßigen Zeit");
         if ($cycle = SeminarCycleDate::find($this->metadate_id)) {
             $ret .= chr(10) . ' (' . $cycle->toString('full') . ')';
         }
     } elseif ($this->seminar_id) {
         $ret = _("alle regelmäßigen und unregelmäßigen Termine der Veranstaltung");
         if (get_object_type($this->seminar_id, array('sem'))) {
             $course = new Seminar($this->seminar_id);
             $ret .= chr(10) . ' (' . $course->getDatesExport(array('short' => true, 'shrink' => true)) . ')';
         }
     } else {
         $ret = _("Kein Typ zugewiesen");
     }
     return $ret;
 }
Example #27
0
/**
 *
 * checks if the 'protected' flag of a file is set and if
 * the course access is closed
 *
 * @param string MD5 id of the file
 * @return bool
 */
function check_protected_download($document_id) {
    $ok = true;
    if (Config::GetInstance()->getValue('ENABLE_PROTECTED_DOWNLOAD_RESTRICTION')) {
        $doc = new StudipDocument($document_id);
        if ($doc->getValue('protected')) {
            $ok = false;
            $range_id = $doc->getValue('seminar_id');

            if (get_object_type($range_id) == 'sem') {
                $seminar = Seminar::GetInstance($range_id);
                $timed_admission = $seminar->getAdmissionTimeFrame();

                if ($seminar->isPasswordProtected() ||
                        $seminar->isAdmissionLocked()
                        || ($timed_admission['end_time'] > 0 && $timed_admission['end_time'] < time())) {
                    $ok = true;
                } else if (StudygroupModel::isStudygroup($range_id)) {
                    $studygroup = Seminar::GetInstance($range_id);
                    if ($studygroup->admission_prelim == 1) {
                        $ok = true;
                    }
                }
            }
        }
    }

    return $ok;
}
Example #28
0
 private function setType()
 {
     $_SESSION['SessionSeminar'] = Request::option('admin_inst_id') ?: $_SESSION['SessionSeminar'];
     if (get_object_type($_SESSION['SessionSeminar'], array('inst', 'fak'))) {
         $type = 'inst';
     }
     $types = $this->types();
     if (!$type || Request::submitted('type') && $type != Request::get('type')) {
         $types[Request::get('type', 'inst')]['redirect']();
     } else {
         $this->type = $types[$type];
     }
 }
 /**
  * Get the current archive link
  *
  * Documented in {@see Boilerplate\Canonical}
  *
  * @param boolean $paged Whether or not to return a link with the current page
  *                       in the archive. Defaults to `true`.
  */
 function get_current_archive_link($paged = true)
 {
     $link = false;
     if (is_front_page()) {
         $link = home_url('/');
     } else {
         if (is_home() && 'page' == get_option('show_on_front')) {
             $link = get_permalink(get_option('page_for_posts'));
         } else {
             if (is_tax() || is_tag() || is_category()) {
                 $term = get_queried_object();
                 $link = get_term_link($term, $term->taxonomy);
             } else {
                 if (is_post_type_archive()) {
                     $link = get_post_type_archive_link(get_object_type());
                 } else {
                     if (is_author()) {
                         $link = get_author_posts_url(get_query_var('author'), get_query_var('author_name'));
                     } else {
                         if (is_archive()) {
                             if (is_date()) {
                                 if (is_day()) {
                                     $link = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day'));
                                 } else {
                                     if (is_month()) {
                                         $link = get_month_link(get_query_var('year'), get_query_var('monthnum'));
                                     } else {
                                         if (is_year()) {
                                             $link = get_year_link(get_query_var('year'));
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($paged && $link && get_query_var('paged') > 1) {
         global $wp_rewrite;
         if (!$wp_rewrite->using_permalinks()) {
             $link = add_query_arg('paged', get_query_var('paged'), $link);
         } else {
             $link = user_trailingslashit(trailingslashit($link) . trailingslashit($wp_rewrite->pagination_base) . get_query_var('paged'), 'archive');
         }
     }
     /**
      * Filter the current archive URL.
      *
      * @param string  $link   The current archive URL.
      * @param boolean $paged  Whether or not to return a link with the current
      *                        page in the archive. Defaults to `true`.
      */
     return apply_filters('current_archive_link', $link, $paged);
 }
Example #30
0
/**
 * This function tracks user acces to several Data (only dokuments by now, to be extended)
 *
 * @param string $id          the id of the object to track
 * @param string $object_type the object type (optional)
 *
 * @return void
 */
function TrackAccess($id, $object_type = null)
{
    if (!$object_type) {
        $object_type = get_object_type($id, array('dokument'));
    }
    switch ($object_type) {
        // what kind ob object shall we track
        case "dokument":
            // the object is a dokument, so downloads will be increased
            $query = "UPDATE dokumente SET downloads = downloads + 1 WHERE dokument_id = ?";
            $statement = DBManager::get()->prepare($query);
            $statement->execute(array($id));
            break;
    }
}