Esempio n. 1
0
 /**
  * Sets the range object and checks whether the calendar is available.
  *
  * @param string $range_id The id of a course, institute or user.
  * @throws AccessDeniedException
  */
 private function setRangeObject($range_id)
 {
     $this->range_object = get_object_by_range_id($range_id);
     if (!is_object($this->range_object)) {
         throw new AccessDeniedException();
     }
     $range_map = array('User' => Calendar::RANGE_USER, 'Course' => Calendar::RANGE_SEM, 'Institute' => Calendar::RANGE_INST);
     $this->range = $range_map[get_class($this->range_object)];
     if ($this->range == Calendar::RANGE_INST || $this->range == Calendar::RANGE_SEM) {
         $modules = new Modules();
         if (!$modules->getStatus('calendar', $this->range_object->getId())) {
             throw new AccessDeniedException();
         }
     }
 }
Esempio 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;
    }
Esempio n. 3
0
 /**
  * Wizard finished: we can create the course now. First store an empty,
  * invisible course for getting an ID. Then, iterate through steps and
  * set values from each step.
  * @return Course
  * @throws Exception
  */
 private function createCourse()
 {
     // Create a new (empty) course so that we get an ID.
     $course = new Course();
     $course->visible = 0;
     $course->store();
     // Each (required) step stores its own values at the course object.
     for ($i = 0; $i < sizeof($this->steps); $i++) {
         $step = $this->getStep($i);
         if ($step->isRequired($this->getValues())) {
             if ($stored = $step->storeValues($course, $this->getValues())) {
                 $course = $stored;
             } else {
                 $course = false;
                 break;
                 //throw new Exception(_('Die Daten aus Schritt ' . $i . ' konnten nicht gespeichert werden, breche ab.'));
             }
         }
     }
     // Check if "documents" module is activated and create "General" folder.
     $m = new Modules();
     if ($m->getStatus('documents', $course->id)) {
         $f = new DocumentFolder();
         $f->name = _('Allgemeiner Dateiordner');
         $f->description = _('Ablage für allgemeine Ordner und Dokumente der Veranstaltung');
         $f->range_id = $course->id;
         $f->seminar_id = $course->id;
         $f->user_id = $GLOBALS['user']->id;
         $f->permission = 7;
         $f->store();
     }
     // Cleanup session data.
     unset($_SESSION['coursewizard'][$this->temp_id]);
     return $course;
 }
Esempio n. 4
0
if ($msg) {
    echo "<tr><td class='blank' colspan=3>&nbsp;";
    parse_msg($msg);
    echo "</td></tr>";
}
if ($question) {
    echo $question;
}

    //Ordner die fehlen, anlegen: Allgemeiner, wenn nicht da, Ordner zu Terminen, die keinen Ordner haben
    if ($rechte){
        if ($folder_system_data['mode']){
            $module_check = new Modules();
            $my_sem = $my_inst = array();
            foreach(search_range('%') as $key => $value){
                if ($module_check->getStatus('documents', $key, $value['type']) && $key != $SessSemName[1]){
                    if ($value['type'] == 'sem'){
                        $my_sem[$key] = $value['name'];
                    } else {
                        $my_inst[$key] = $value['name'];
                    }
                }
            }
            asort($my_sem, SORT_STRING);
            asort($my_inst, SORT_STRING);
            $button_name = $folder_system_data["mode"] == 'move' ? _('verschieben') : _('kopieren');
            echo '<form action="'.URLHelper::getLink('').'" method="post">';
            echo CSRFProtection::tokenTag();
            echo "\n" . '<tr><td class="blank" colspan="3" width="100%" style="font-size:80%;">';
            echo "\n" . '<div style="margin-left:25px;">';
            echo "\n<b>" . ($folder_system_data["mode"] == 'move' ? _("Verschiebemodus") : _("Kopiermodus")) . "</b><br>";