Beispiel #1
0
 function bookable_rooms_action()
 {
     if (!getGlobalPerms($GLOBALS['user']->id) == 'admin') {
         $resList = new ResourcesUserRoomsList($GLOBALS['user']->id, false, false, false);
         if (!$resList->roomsExist()) {
             throw new AccessDeniedException();
         }
     }
     $select_options = Request::optionArray('rooms');
     $rooms = array_filter($select_options, function ($v) {
         return strlen($v) === 32;
     });
     $events = array();
     $dates = array();
     $timestamps = array();
     if (count(Request::getArray('new_date'))) {
         $new_date = array();
         foreach (Request::getArray('new_date') as $one) {
             if ($one['name'] == 'startDate') {
                 $dmy = explode('.', $one['value']);
                 $new_date['day'] = (int) $dmy[0];
                 $new_date['month'] = (int) $dmy[1];
                 $new_date['year'] = (int) $dmy[2];
             }
             $new_date[$one['name']] = (int) $one['value'];
         }
         if (check_singledate($new_date['day'], $new_date['month'], $new_date['year'], $new_date['start_stunde'], $new_date['start_minute'], $new_date['end_stunde'], $new_date['end_minute'])) {
             $start = mktime($new_date['start_stunde'], $new_date['start_minute'], 0, $new_date['month'], $new_date['day'], $new_date['year']);
             $ende = mktime($new_date['end_stunde'], $new_date['end_minute'], 0, $new_date['month'], $new_date['day'], $new_date['year']);
             $timestamps[] = $start;
             $timestamps[] = $ende;
             $event = new AssignEvent('new_date', $start, $ende, null, null, '');
             $events[$event->getId()] = $event;
         }
     }
     foreach (Request::optionArray('selected_dates') as $one) {
         $date = new SingleDate($one);
         if ($date->getStartTime()) {
             $timestamps[] = $date->getStartTime();
             $timestamps[] = $date->getEndTime();
             $event = new AssignEvent($date->getTerminID(), $date->getStartTime(), $date->getEndTime(), null, null, '');
             $events[$event->getId()] = $event;
             $dates[$date->getTerminID()] = $date;
         }
     }
     if (count($events)) {
         $result = array();
         $checker = new CheckMultipleOverlaps();
         $checker->setTimeRange(min($timestamps), max($timestamps));
         foreach ($rooms as $room) {
             $checker->addResource($room);
         }
         $checker->checkOverlap($events, $result, "assign_id");
         foreach ((array) $result as $room_id => $details) {
             foreach ($details as $termin_id => $conflicts) {
                 if ($termin_id == 'new_date' && Request::option('singleDateID')) {
                     $assign_id = SingleDateDB::getAssignID(Request::option('singleDateID'));
                 } else {
                     $assign_id = SingleDateDB::getAssignID($termin_id);
                 }
                 $filter = function ($a) use($assign_id) {
                     if ($a['assign_id'] && $a['assign_id'] == $assign_id) {
                         return false;
                     }
                     return true;
                 };
                 if (!count(array_filter($conflicts, $filter))) {
                     unset($result[$room_id][$termin_id]);
                 }
             }
         }
         $result = array_filter($result);
         $this->render_json(array_keys($result));
         return;
     }
     $this->render_nothing();
 }
Beispiel #2
0
 /**
  * Initialize the subnavigation of this item. This method
  * is called once before the first item is added or removed.
  */
 public function initSubNavigation()
 {
     global $perm, $auth;
     $username = $auth->auth['uname'];
     parent::initSubNavigation();
     if (!$perm->have_perm('user')) {
         return;
     }
     $sem_create_perm = in_array(get_config('SEM_CREATE_PERM'), array('root', 'admin', 'dozent')) ? get_config('SEM_CREATE_PERM') : 'dozent';
     // my courses
     if ($perm->have_perm('root')) {
         $navigation = new Navigation(_('Veranstaltungsübersicht'), 'dispatch.php/search/courses');
     } else {
         if ($perm->have_perm('admin')) {
             $navigation = new Navigation(_('Veranstaltungen an meinen Einrichtungen'), 'dispatch.php/my_courses');
         } else {
             $navigation = new Navigation(_('Meine Veranstaltungen'), 'dispatch.php/my_courses');
             if (!$perm->have_perm('dozent')) {
                 $navigation->addSubNavigation('browse', new Navigation(_('Veranstaltung hinzufügen'), 'dispatch.php/search/courses'));
                 if ($perm->have_perm('autor') && get_config('STUDYGROUPS_ENABLE')) {
                     $navigation->addSubNavigation('new_studygroup', new Navigation(_('Studiengruppe anlegen'), 'dispatch.php/course/wizard?studygroup=1'));
                 }
             } else {
                 if ($perm->have_perm($sem_create_perm)) {
                     $navigation->addSubNavigation('new_course', new Navigation(_('Neue Veranstaltung anlegen'), 'dispatch.php/course/wizard'));
                 }
                 if (get_config('STUDYGROUPS_ENABLE')) {
                     $navigation->addSubNavigation('new_studygroup', new Navigation(_('Studiengruppe anlegen'), 'dispatch.php/course/wizard?studygroup=1'));
                 }
             }
         }
     }
     $this->addSubNavigation('my_courses', $navigation);
     // course administration
     if ($perm->have_perm('admin')) {
         $navigation = new Navigation(_('Verwaltung von Veranstaltungen'), 'dispatch.php/my_courses');
         if ($perm->have_perm($sem_create_perm)) {
             $navigation->addSubNavigation('new_course', new Navigation(_('Neue Veranstaltung anlegen'), 'dispatch.php/course/wizard'));
         }
         if (get_config('STUDYGROUPS_ENABLE')) {
             $navigation->addSubNavigation('new_studygroup', new Navigation(_('Studiengruppe anlegen'), 'dispatch.php/course/wizard?studygroup=1'));
         }
         $this->addSubNavigation('admin_course', $navigation);
     }
     // insitute administration
     if ($perm->have_perm('admin')) {
         $navigation = new Navigation(_('Verwaltung von Einrichtungen'), 'dispatch.php/institute/basicdata/index?list=TRUE');
         $this->addSubNavigation('admin_inst', $navigation);
     }
     // user administration
     if ($perm->have_perm('root')) {
         $navigation = new Navigation(_('Verwaltung globaler Einstellungen'), 'admin_range_tree.php');
         $this->addSubNavigation('admin_user', $navigation);
     } else {
         if ($perm->have_perm('admin') && !get_config('RESTRICTED_USER_MANAGEMENT')) {
             $navigation = new Navigation(_('Globale Benutzerverwaltung'), 'dispatch.php/admin/user/');
             $this->addSubNavigation('admin_user', $navigation);
         }
     }
     // plugin and role administration
     if ($perm->have_perm('root')) {
         $navigation = new Navigation(_('Verwaltung von Plugins'), 'dispatch.php/admin/plugin');
         $navigation->addSubNavigation('admin_roles', new Navigation(_('Verwaltung von Rollen'), 'dispatch.php/admin/role'));
         $this->addSubNavigation('admin_plugins', $navigation);
     }
     // administration of ressources
     if ($perm->have_perm('admin')) {
         if (get_config('RESOURCES_ENABLE')) {
             $navigation = new Navigation(_('Verwaltung von Ressourcen'));
             $navigation->addSubNavigation('hierarchy', new Navigation(_('Struktur'), 'resources.php#a', array('view' => 'resources')));
             if ($perm->have_perm('admin') && get_config('RESOURCES_ALLOW_ROOM_REQUESTS')) {
                 if (getGlobalPerms($GLOBALS['user']->id) !== 'admin') {
                     $resList = new ResourcesUserRoomsList($GLOBALS['user']->id, false, false);
                     $show_roomplanning = $resList->roomsExist();
                 } else {
                     $show_roomplanning = true;
                 }
                 if ($show_roomplanning) {
                     $navigation->addSubNavigation('start_planning', new Navigation(_('Raumplanung'), 'resources.php?cancel_edit_request_x=1', array('view' => 'requests_start')));
                 }
             }
             if (getGlobalPerms($GLOBALS['user']->id) == 'admin') {
                 $navigation->addSubNavigation('edit_types', new Navigation(_('Anpassen'), 'resources.php', array('view' => 'edit_types')));
             }
             $this->addSubNavigation('ressources', $navigation);
         }
     }
     // messaging
     $navigation = new Navigation(_('Nachrichten'));
     $navigation->addSubNavigation('in', new Navigation(_('Posteingang'), 'dispatch.php/messages/overview'));
     $navigation->addSubNavigation('out', new Navigation(_('Gesendet'), 'dispatch.php/messages/sent'));
     $this->addSubNavigation('messaging', $navigation);
     // community
     $navigation = new Navigation(_('Community'));
     $navigation->addSubNavigation('online', new Navigation(_('Wer ist online?'), 'dispatch.php/online'));
     $navigation->addSubNavigation('contacts', new Navigation(_('Meine Kontakte'), 'dispatch.php/contact'));
     // study groups
     if (get_config('STUDYGROUPS_ENABLE')) {
         $navigation->addSubNavigation('browse', new Navigation(_('Studiengruppen'), 'dispatch.php/studygroup/browse'));
     }
     // ranking
     if (get_config('SCORE_ENABLE')) {
         $navigation->addSubNavigation('score', new Navigation(_('Rangliste'), 'dispatch.php/score'));
         $this->addSubNavigation('community', $navigation);
     }
     // calendar / home page
     if (!$perm->have_perm('admin')) {
         $navigation = new Navigation(_('Mein Profil'), 'dispatch.php/profile');
         if ($perm->have_perm('autor')) {
             $navigation->addSubNavigation('settings', new Navigation(_('Einstellungen'), 'dispatch.php/settings/general'));
         }
         $this->addSubNavigation('profile', $navigation);
         $navigation = new Navigation(_('Mein Planer'));
         if (get_config('CALENDAR_ENABLE')) {
             $navigation->addSubNavigation('calendar', new Navigation(_('Terminkalender'), 'dispatch.php/calendar/single'));
         }
         if (get_config('SCHEDULE_ENABLE')) {
             $navigation->addSubNavigation('schedule', new Navigation(_('Stundenplan'), 'dispatch.php/calendar/schedule'));
         }
         $this->addSubNavigation('planner', $navigation);
     }
     // global search
     $navigation = new Navigation(_('Suchen'), 'dispatch.php/search/courses');
     $navigation->addSubNavigation('user', new Navigation(_('Personensuche'), 'browse.php'));
     $navigation->addSubNavigation('course', new Navigation(_('Veranstaltungssuche'), 'dispatch.php/search/courses'));
     $this->addSubNavigation('search', $navigation);
     // tools
     $navigation = new Navigation(_('Tools'));
     $navigation->addSubNavigation('news', new Navigation(_('Ankündigungen'), 'dispatch.php/news/admin_news'));
     if (get_config('VOTE_ENABLE')) {
         $navigation->addSubNavigation('vote', new Navigation(_('Umfragen und Tests'), 'admin_vote.php', array('page' => 'overview', 'showrangeID' => $username)));
         $navigation->addSubNavigation('evaluation', new Navigation(_('Evaluationen'), 'admin_evaluation.php', array('rangeID' => $username)));
     }
     // literature
     if (get_config('LITERATURE_ENABLE')) {
         $navigation->addSubNavigation('literature', new Navigation(_('Literatur'), 'dispatch.php/literature/edit_list.php', array('_range_id' => 'self')));
     }
     // elearning
     if (get_config('ELEARNING_INTERFACE_ENABLE')) {
         $navigation->addSubNavigation('elearning', new Navigation(_('Lernmodule'), 'dispatch.php/elearning/my_accounts'));
     }
     // export
     if (get_config('EXPORT_ENABLE') && $perm->have_perm('tutor')) {
         $navigation->addSubNavigation('export', new Navigation(_('Export'), 'export.php'));
     }
     $this->addSubNavigation('tools', $navigation);
     // external help
     $navigation = new Navigation(_('Hilfe'), format_help_url('Basis.Allgemeines'));
     $navigation->addSubNavigation('intro', new Navigation(_('Schnelleinstieg'), format_help_url('Basis.SchnellEinstiegKomplett')));
     $this->addSubNavigation('help', $navigation);
 }
Beispiel #3
0
        }

        if ($ActualObjectPerms->havePerm('autor')) {
            $navigation->addSubNavigation('edit_assign', new Navigation(_('Belegung bearbeiten'), 'resources.php', array('view' => 'edit_object_assign')));
        } else {
            $navigation->addSubNavigation('edit_assign', new Navigation(_('Belegung anzeigen'), 'resources.php', array('view' => 'edit_object_assign')));
        }
    }

    $resources_nav->addSubNavigation('objects', $navigation);
}

// Reiter "Raumplanung"
if ($perm->have_perm('admin')) {
    $resList = new ResourcesUserRoomsList($user_id, TRUE, FALSE);
    if ($resList->roomsExist() && get_config('RESOURCES_ALLOW_ROOM_REQUESTS')) {
        $navigation = new Navigation(_('Raumplanung'));
        $navigation->addSubNavigation('start', new Navigation(_('Übersicht'), 'resources.php?cancel_edit_request_x=1', array('view' => 'requests_start')));

        $edit_nav = new Navigation(_('Anfragen bearbeiten'), 'resources.php', array('view' => 'edit_request'));
        $list_nav = new Navigation(_('Anfragenliste'), 'resources.php', array('view' => 'list_requests'));
        $view_nav = new Navigation(_('Anfragenplan'), 'resources.php', array('view' => 'view_requests_schedule'));
        $navigation->addSubNavigation('edit', $edit_nav);
        $navigation->addSubNavigation('list', $list_nav);
        $navigation->addSubNavigation('schedule', $view_nav);

        if (!$_SESSION['resources_data']['requests_working_on']) {
            $edit_nav->setEnabled(false);
            $list_nav->setEnabled(false);
            $view_nav->setEnabled(false);
        }