Пример #1
0
function createPage($smarty)
{
    $item = Queries::assignmentWithId(Input::get('id', 'get'));
    if (empty($item->id)) {
        Redirect::error(404);
    }
    $smarty->assign('item', $item);
    $smarty->assign('table_parentT', 'assignments');
    $smarty->assign('table_parentI', $item->id);
    $smarty->assign('planning', Tables::planning(true, 'assignments', $item->id));
    return $smarty;
}
Пример #2
0
 public static function updateAssignment($id)
 {
     $assignment = Queries::assignmentWithId($id);
     if (Users::loggedIn() && !empty($assignment) && self::isReady()) {
         $service = self::getService();
         $eventId = Users::currentData()->student_id . 'assignment' . $assignment->id;
         $calendarId = Users::currentData()->calendar_assignments;
         $state = $assignment->completion ? '[DONE] ' : '';
         $request = new Google_Service_Calendar_Event(array('id' => $eventId, 'summary' => $state . $assignment->desc_short, 'start' => array('date' => $assignment->end_date, 'timeZone' => 'Europe/Amsterdam'), 'end' => array('date' => $assignment->end_date, 'timeZone' => 'Europe/Amsterdam')));
         try {
             $event = $service->events->get($calendarId, $eventId);
             $service->events->update($calendarId, $eventId, $request);
         } catch (Exception $e) {
             $service->events->insert($calendarId, $request);
         }
         Notifications::addSuccess('Google calendar event updated!');
     }
 }