示例#1
0
 function restoreOpenRequests(){
     if (is_null($this->requests)){
         $this->requests = (array)getMyRoomRequests($GLOBALS['user']->id, $this->semester_id, true, null, $this->sem_type, $this->faculty, $this->tagged);//MOD_BREMEN
         foreach ($this->requests as $val) {
             $this->requests_stats_open['sum'] += !$val["closed"] && ($val["have_times"] || $this->show_requests_no_time);
             $this->requests_stats_open['my_res'] += !$val["closed"] && $val["my_res"] && ($val["have_times"] || $this->show_requests_no_time);
             $this->requests_stats_open['my_sem'] += !$val["closed"] && $val["my_sem"] && ($val["have_times"] || $this->show_requests_no_time);
             $this->requests_stats_open['no_time'] += !$val["closed"] && !$val["have_times"];
         }
     }
 }
示例#2
0
            $statement->execute(array($request_ids));
            if ($statement->fetchColumn()) {
                $msg->addMsg(40, array(URLHelper::getLink(), URLHelper::getLink('?snd_closed_request_sms=1')));
                Request::set('save_state', 1);
            }
        }
    }
    $_SESSION['resources_data']["view"] = "requests_start";
    $view = "requests_start";
}

//we start a new room-planning-session
if (Request::submitted('start_multiple_mode') || (Request::option('single_request'))) {
    unset($_SESSION['resources_data']["requests_working_on"]);
    unset($_SESSION['resources_data']["requests_open"]);
    $requests = (array)getMyRoomRequests($GLOBALS['user']->id, $_SESSION['resources_data']["sem_schedule_semester_id"], true, Request::option('single_request'), $_SESSION['resources_data']["resolve_requests_sem_type"], $_SESSION['resources_data']["resolve_requests_faculty"], $_SESSION['resources_data']["resolve_requests_tagged"]);

    $_SESSION['resources_data']["requests_working_pos"] = 0;
    $_SESSION['resources_data']["skip_closed_requests"] = TRUE;
    if(Request::option('resolve_requests_mode') == "one_res"){
        $_SESSION['resources_data']['resolve_requests_one_res'] = Request::quoted('resolve_requests_one_res');
    } else {
        $_SESSION['resources_data']['resolve_requests_one_res'] = null;
    }
    $selected_requests = array();
    //filter the requests
    foreach($requests as $key => $val) {
        if (!$val["closed"] && !(Request::option('resolve_requests_no_time') && !$val['have_times'])) {
            if (Request::option('resolve_requests_mode') == "sem") {
                if ($val["my_sem"])
                    $selected_requests[$key] = TRUE;
示例#3
0
 /**
  * edit one room requests
  */
 public function edit_action()
 {
     Helpbar::get()->addPlainText(_('Information'), _('Hier können Sie Angaben zu gewünschten Raumeigenschaften machen.'));
     if (Request::option('new_room_request_type')) {
         $request = new RoomRequest();
         $request->seminar_id = $this->course_id;
         $request->user_id = $GLOBALS['user']->id;
         list($new_type, $id) = explode('_', Request::option('new_room_request_type'));
         if ($new_type == 'course') {
             if ($existing_request = RoomRequest::existsByCourse($this->course_id)) {
                 $request = RoomRequest::find($existing_request);
             }
         }
         if ($new_type == 'date') {
             $request->termin_id = $id;
             if ($existing_request = RoomRequest::existsByDate($id)) {
                 $request = RoomRequest::find($existing_request);
             }
         } elseif ($new_type == 'cycle') {
             $request->metadate_id = $id;
             if ($existing_request = RoomRequest::existsByCycle($id)) {
                 $request = RoomRequest::find($existing_request);
             }
         }
     } else {
         $request = RoomRequest::find(Request::option('request_id'));
     }
     $admission_turnout = Seminar::getInstance($this->course_id)->admission_turnout;
     $attributes = self::process_form($request, $admission_turnout);
     $this->params = array('request_id' => $request->getId());
     $this->params['fromDialog'] = Request::get('fromDialog');
     if (Request::get('origin') !== null) {
         $this->params['origin'] = Request::get('origin');
     }
     if (Request::submitted('save') || Request::submitted('save_close')) {
         if (!($request->getSettedPropertiesCount() || $request->getResourceId())) {
             PageLayout::postMessage(MessageBox::error(_("Die Anfrage konnte nicht gespeichert werden, da Sie mindestens einen Raum oder mindestens eine Eigenschaft (z.B. Anzahl der Sitzplätze) angeben müssen!")));
         } else {
             $request->setClosed(0);
             $this->request_stored = $request->store();
             if ($this->request_stored) {
                 PageLayout::postMessage(MessageBox::success(_("Die Raumanfrage und gewünschte Raumeigenschaften wurden gespeichert")));
             }
             if (Request::submitted('save_close')) {
                 if (!Request::isXhr()) {
                     $this->redirect('course/room_requests/index/' . $this->course_id);
                 } else {
                     if (Request::get('fromDialog') == true && !isset($this->params['origin'])) {
                         $this->relocate('course/room_requests/index/' . $this->course_id);
                     } else {
                         if (isset($this->params['origin'])) {
                             $this->relocate(str_replace('_', '/', $this->params['origin']) . '?cid=' . $this->course_id);
                         } else {
                             $this->relocate('course/room_requests/index/' . $this->course_id);
                         }
                     }
                 }
             }
         }
     }
     if (!$request->isNew() && $request->isDirty()) {
         PageLayout::postMessage(MessageBox::info(_("Die Änderungen an der Raumanfrage wurden noch nicht gespeichert!")));
     }
     $room_categories = array_values(array_filter(getResourcesCategories(), create_function('$a', 'return $a["is_room"] == 1;')));
     if (!$request->getCategoryId() && count($room_categories) == 1) {
         $request->setCategoryId($room_categories[0]['category_id']);
     }
     $this->search_result = $attributes['search_result'];
     $this->search_by_properties = $attributes['search_by_properties'];
     $this->admission_turnout = $admission_turnout;
     $this->request = $request;
     $this->room_categories = $room_categories;
     $this->new_room_request_type = Request::option('new_room_request_type');
     $this->is_resources_admin = getGlobalPerms($GLOBALS['user']->id);
     $actions = new ActionsWidget();
     $actions->addLink(_('Bearbeitung abbrechen'), $this->link_for('index/' . $this->course_id), Icon::create('decline', 'clickable'));
     if (getGlobalPerms($GLOBALS['user']->id) == 'admin' || $GLOBALS['perm']->have_perm('admin') && count(getMyRoomRequests(null, null, true, $request->getId()))) {
         $actions->addLink(_('Raumanfrage auflösen'), URLHelper::getLink('resources.php', array('view' => 'edit_request', 'single_request' => $request->getId())), Icon::create('admin', 'clickable'));
     }
     if (Request::isXhr()) {
         Sidebar::Get()->addWidget($actions);
         $widget = new SidebarWidget();
         $widget->setTitle(_('Informationen'));
         if ($request->isNew()) {
             $widget->addElement(new WidgetElement(_('Dies ist eine neue Raumanfrage.')));
         } else {
             $info_txt = '<p>' . sprintf(_('Erstellt von: %s'), User::find($request->user_id)->getFullname()) . '</p>';
             $info_txt .= '<p>' . sprintf(_('Erstellt am: %s'), strftime('%x %H:%M', $request->mkdate)) . '</p>';
             $info_txt .= '<p>' . sprintf(_('Letzte Änderung: %s'), strftime('%x %H:%M', $request->chdate)) . '</p>';
             $widget->addElement(new WidgetElement($info_txt));
         }
         Sidebar::Get()->addWidget($widget);
     }
 }