Пример #1
0
    if (($ObjectPerms->getUserPerm() != "admin") && ($change_object_schedules != "NEW") && (!$_SESSION['new_assign_object'])) {
        //load the assign-object perms of a saved object
        $SavedStateAssignObject = AssignObject::Factory($change_object_schedules);
        if ($SavedStateAssignObject->getAssignUserId()){
            unset($ObjectPerms);
            $ObjectPerms = new AssignObjectPerms($change_object_schedules);
        }
    }

    if (($ObjectPerms->havePerm("tutor")) && Request::submitted('change_meta_to_single_assigns')) {
        $assObj = AssignObject::Factory($change_object_schedules);
        if ($assObj->getOwnerType() != 'sem'){
            $events = $assObj->getEvents();
            if (is_array($events)){
                $create_assign = new AssignObject(false);
                $create_assign->setResourceId($assObj->getResourceId());
                $create_assign->setAssignUserId($assObj->getAssignUserId());
                $create_assign->setUserFreeName($assObj->getUserFreeName());
                $assObj->delete();
                foreach($events as $one_event){
                    $create_assign->setBegin($one_event->begin);
                    $create_assign->setEnd($one_event->end);
                    $create_assign->id = $one_event->id;
                    $create_assign->store(true);
                }
                $return_schedule = TRUE;
                $change_object_schedules = $events[0]->id;
                header (sprintf("Location:resources.php?quick_view=%s&quick_view_mode=%s&show_msg=37", ($view_mode == "oobj") ? "openobject_sem_schedule" : "view_sem_schedule", $view_mode));
            }
        }
    }
Пример #2
0
 /**
  * returns an array of AssignObjects for one cycle for given room
  * assigns are not stored, used for collision checks before the cycle is stored
  * (for now only in admin_seminare_assi.php)
  *
  * @param string id of cycle
  * @param string id of room
  * @return array array of AssignObject
  */
 function getVirtualMetaAssignObjects($metadate_id, $resource_id)
 {
     $ret = array();
     foreach ($this->getVirtualSingleDates($metadate_id) as $semester_id => $dates_for_semester) {
         list($dates, $dates_to_delete) = array_values($dates_for_semester);
         foreach ($dates as $d) {
             if (!$d->isExTermin()) {
                 $ao = new AssignObject(null);
                 $ao->setResourceId($resource_id);
                 $ao->setBegin($d->getStartTime());
                 $ao->setEnd($d->getEndTime());
                 $ao->setRepeatEnd($d->getEndTime());
                 $ao->setRepeatQuantity(0);
                 $ao->setRepeatInterval(0);
                 $ao->setRepeatMonthOfYear(0);
                 $ao->setRepeatDayOfMonth(0);
                 $ao->setRepeatWeekOfMonth(0);
                 $ao->setRepeatDayOfWeek(0);
                 $ret[] = $ao;
             }
         }
     }
     return $ret;
 }