/**
  * Update a specific schedule for a campaign
  * @param string $accessToken - Constant Contact OAuth2 access token
  * @param int $campaignId - Campaign id to be scheduled
  * @param Schedule $schedule - Schedule to retrieve
  * @return Schedule
  */
 public function updateSchedule($accessToken, $campaignId, Schedule $schedule)
 {
     $baseUrl = Config::get('endpoints.base_url') . sprintf(Config::get('endpoints.campaign_schedule'), $campaignId, $schedule->id);
     $url = $this->buildUrl($baseUrl);
     $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $schedule->toJson());
     return Schedule::create(json_decode($response->body, true));
 }
Esempio n. 2
0
 public function schedule($cycle, $period, $interval = null)
 {
     $this->schedule = new Schedule();
     $this->schedule->setCycle($cycle);
     $this->schedule->setPeriod($period);
     $this->schedule->setInterval($interval);
 }
 public function onReceive($server, $fd, $fromId, $data)
 {
     //echo "receive \n";
     $tttt = new Schedule();
     $test = new TestController($server, $fd, $fromId, array());
     $tttt->add($test->test());
 }
Esempio n. 4
0
 public function setBusyhours($value)
 {
     $this->busyHours = $value;
     $schedule = new Schedule();
     $schedule->setBusyHours($value);
     $this->schedule = $schedule->schedule;
 }
 public function setup()
 {
     parent::setup();
     $this->scheduleRepository = $this->getMock('IScheduleRepository');
     $this->schedule = new FakeSchedule();
     $this->schedule->SetTimezone('America/Chicago');
 }
 public function onReceive($server, $fd, $fromId, $data)
 {
     $tttt = new Schedule();
     $test = new TestController($server, $fd, array());
     $tttt->add($test->test());
     $tttt->run();
     $this->server->send($fd, $data);
 }
Esempio n. 7
0
/**
 * return the tasklist as an xml document that 
 * would be used by the drdat app on a phone
 */
function smarty_function_tasklist2xml($params, &$smarty)
{
    if (!Check::digits($params['study_id'], $empty = false)) {
        return;
    }
    $s = new Schedule();
    return htmlentities($s->tasklist2xml($params['study_id']));
}
Esempio n. 8
0
 /**
  * @param Schedule $schedule
  * @param ResourceDto[] $resources
  * @return bool
  */
 private function ScheduleContainsNoResources(Schedule $schedule, $resources)
 {
     foreach ($resources as $resource) {
         if ($resource->GetScheduleId() == $schedule->GetId()) {
             return false;
         }
     }
     return true;
 }
 public function postDeleteshedule()
 {
     $data = Input::only('schedule_id');
     $scObj = new Schedule();
     $update = $scObj->deleteData($data['schedule_id']);
     if ($update) {
         return Response::json(array('status' => '1', $data));
     } else {
         return Response::json(array('status' => '0', $data));
     }
 }
Esempio n. 10
0
/**
 * grab the schedule for a task in a study
 */
function smarty_function_schedule($params, &$smarty)
{
    if (!Check::digits($params['study_id'])) {
        return;
    }
    if (!Check::digits($params['task_id'])) {
        return;
    }
    $s = new Schedule();
    $smarty->assign('schedule', $s->getone(array('study_id' => $params['study_id'], 'task_id' => $params['task_id'])));
}
Esempio n. 11
0
 public function editscheduleAction()
 {
     try {
         $this->checkLogin();
         $schedule = new Schedule();
         $schedule->update($this->request->getPost());
         header("Location: " . ROOT_URL . "/admin/finish/");
     } catch (Exception $e) {
         $this->displayErrorView($e->getMessage());
     }
 }
Esempio n. 12
0
 private function _GetAllRows()
 {
     $rows = $this->GetRows();
     $expected = array();
     foreach ($rows as $item) {
         $schedule = new Schedule($item[ColumnNames::SCHEDULE_ID], $item[ColumnNames::SCHEDULE_NAME], $item[ColumnNames::SCHEDULE_DEFAULT], $item[ColumnNames::SCHEDULE_WEEKDAY_START], $item[ColumnNames::SCHEDULE_DAYS_VISIBLE], $item[ColumnNames::TIMEZONE_NAME]);
         $schedule->SetAdminGroupId($item[ColumnNames::SCHEDULE_ADMIN_GROUP_ID]);
         $expected[] = $schedule;
     }
     return $expected;
 }
Esempio n. 13
0
 /**
  * Creates a new schedule
  *
  * @return Redirect
  * @author Dan Cox
  */
 public function newSchedule()
 {
     $schedule = new Schedule();
     $schedule->setName(Input::get('name'))->setDescription(Input::get('description'))->setUpdatedAt(date('Y-m-d H:i:s'));
     $errors = Validator::make($schedule);
     if (count($errors) > 0) {
         return Redirect::route('page.newSchedule')->withErrors($errors)->withInput()->send();
     }
     DB::save($schedule);
     return Redirect::route('page.schedules')->with('success', 'Successfully created new schedule')->send();
 }
Esempio n. 14
0
 private function getScheduleToRoomMapping()
 {
     $schedule = new Schedule();
     $mapping = array();
     foreach ($schedule->getScheduleToRoomSlugMapping() as $schedule => $slug) {
         try {
             $mapping[$schedule] = new Room($slug);
         } catch (NotFoundException $e) {
             //
         }
     }
     return $mapping;
 }
Esempio n. 15
0
 public function indexAction()
 {
     try {
         $schedule = new Schedule();
         $is_able_to_register = $schedule->is_in_time('regist', $this->current_time);
         if ($is_able_to_register) {
             $this->showIndexPage($schedule);
         } else {
             $this->showPreIndexPage($schedule);
         }
     } catch (Exception $e) {
         $this->displayErrorView($e->getMessage());
     }
 }
Esempio n. 16
0
/**
 * Options for dropdown list
 * 
 *
 * @return array
 */
function schedule_options($add_blank = FALSE)
{
    $s = new Schedule();
    $rows = $s->order_by('name')->get();
    $minute = 0;
    if ($add_blank == TRUE) {
        $options[''] = '';
    }
    foreach ($rows as $row) {
        $options[$row->id] = $row->name;
        $minute++;
    }
    return $options;
}
Esempio n. 17
0
function schedule_controller()
{
    global $session, $route, $mysqli, $user;
    $result = false;
    require "Modules/schedule/schedule_model.php";
    $schedule = new Schedule($mysqli, $user->get_timezone($session['userid']));
    if ($route->format == 'html') {
        if ($route->action == "view" && $session['write']) {
            $result = view("Modules/schedule/Views/schedule_view.php", array());
        }
        if ($route->action == 'api') {
            $result = view("Modules/schedule/Views/schedule_api.php", array());
        }
    }
    if ($route->format == 'json') {
        if ($route->action == 'list') {
            if ($session['userid'] > 0 && $session['userid'] && $session['read']) {
                $result = $schedule->get_list($session['userid']);
            }
        } elseif ($route->action == "create") {
            if ($session['userid'] > 0 && $session['write']) {
                $result = $schedule->create($session['userid']);
            }
        } else {
            $scheduleid = (int) get('id');
            if ($schedule->exist($scheduleid)) {
                $scheduleget = $schedule->get($scheduleid);
                // if public or belongs to user
                if ($session['read'] && ($scheduleget['public'] || $session['userid'] > 0 && $scheduleget['userid'] == $session['userid'])) {
                    if ($route->action == "get") {
                        $result = $scheduleget;
                    }
                    if ($route->action == "expression") {
                        $result = $schedule->get_expression($scheduleid);
                    }
                    if ($route->action == "test") {
                        $result = $schedule->test_expression($scheduleid);
                    }
                }
                // if public
                if (isset($session['write']) && $session['write'] && $session['userid'] > 0 && $scheduleget['userid'] == $session['userid']) {
                    if ($route->action == "delete") {
                        $result = $schedule->delete($scheduleid);
                    }
                    if ($route->action == 'set') {
                        $result = $schedule->set_fields($scheduleid, get('fields'));
                    }
                }
            } else {
                $result = array('success' => false, 'message' => 'Schedule does not exist');
            }
        }
    }
    return array('content' => $result);
}
 /**
  * Save the user, both in the DB and in the session
  *
  */
 function save(Schedule $schedule, $userID)
 {
     $userID = $this->clean($userID);
     // Remove all the hours of the user
     $query = 'DELETE * FROM ' . self::TABLE_SCHEDULE . ' WHERE userID = ' . $userID;
     $this->getDB()->query($query);
     // Add all the new hours
     foreach ($schedule->getSchedule() as $day => $hours) {
         foreach ($hours as $h) {
             $save = array('userID' => $userID, 'day' => $day, 'hour' => $h);
             $this->getDB()->insert(self::TABLE_SCHEDULE, $save);
         }
     }
 }
 public function Add(Schedule $schedule, $copyLayoutFromScheduleId)
 {
     $user = $this->repo->LoadById($this->user->UserId);
     if (!$user->IsInRole(RoleLevel::SCHEDULE_ADMIN)) {
         throw new Exception(sprintf('Schedule Add Failed. User %s does not have admin access.', $this->user->UserId));
     }
     foreach ($user->Groups() as $group) {
         if ($group->IsScheduleAdmin) {
             $schedule->SetAdminGroupId($group->GroupId);
             break;
         }
     }
     parent::Add($schedule, $copyLayoutFromScheduleId);
 }
Esempio n. 20
0
 function get_Schedule($id, $ident)
 {
     global $globalDebug;
     // Get schedule here, so it's done only one time
     $Connection = new Connection();
     $dbc = $Connection->db;
     $Spotter = new Spotter($dbc);
     $Schedule = new Schedule($dbc);
     $Translation = new Translation($dbc);
     $operator = $Spotter->getOperator($ident);
     if ($Schedule->checkSchedule($operator) == 0) {
         $operator = $Translation->checkTranslation($ident);
         if ($Schedule->checkSchedule($operator) == 0) {
             $schedule = $Schedule->fetchSchedule($operator);
             if (count($schedule) > 0) {
                 if ($globalDebug) {
                     echo "-> Schedule info for " . $operator . " (" . $ident . ")\n";
                 }
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime']));
                 $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime']));
                 // FIXME : Check if route schedule = route from DB
                 if ($schedule['DepartureAirportIATA'] != '') {
                     if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) {
                         $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
                         if ($airport_icao != '') {
                             $this->all_flights[$id]['departure_airport'] = $airport_icao;
                             if ($globalDebug) {
                                 echo "-> Change departure airport to " . $airport_icao . " for " . $ident . "\n";
                             }
                         }
                     }
                 }
                 if ($schedule['ArrivalAirportIATA'] != '') {
                     if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) {
                         $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
                         if ($airport_icao != '') {
                             $this->all_flights[$id]['arrival_airport'] = $airport_icao;
                             if ($globalDebug) {
                                 echo "-> Change arrival airport to " . $airport_icao . " for " . $ident . "\n";
                             }
                         }
                     }
                 }
                 $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']);
             }
         }
     }
     //$Connection->db = null;
 }
Esempio n. 21
0
 public static function update_schedule()
 {
     $Connection = new Connection();
     $Schedule = new Schedule();
     $query = "SELECT * FROM schedule";
     try {
         $sth = $Connection->db->prepare($query);
         $sth->execute();
     } catch (PDOException $e) {
         return "error : " . $e->getMessage() . "\n";
     }
     while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
         $Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
     }
 }
Esempio n. 22
0
 protected function schedule(Schedule $schedule)
 {
     $schedule->call(function () {
         $users = User::all();
         if ($users) {
             foreach ($users as $key => $user) {
                 Mail::send('emails.reminder', ['user' => $user], function ($m) use($user) {
                     $m->from('*****@*****.**', 'Money Flow Notification');
                     $m->to($user->email, $user->username)->subject('Your plan is going on, Go update it!');
                 });
             }
         }
         // $result = mail("*****@*****.**","My subject","Hi");
     })->daily();
 }
Esempio n. 23
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Schedule::create(['from_time' => $faker->time($format = 'H:i:s', $max = 'now'), 'to_time' => $faker->time($format = 'H:i:s', $max = 'now'), 'group_id' => rand(1, 10), 'day' => rand(1, 7)]);
     }
 }
Esempio n. 24
0
 public function overview()
 {
     $members = Member::find('all', ['order' => 'username']);
     $this->setViewData('members', $members);
     $schedules = Schedule::find('all', ['conditions' => ['date >= UNIX_TIMESTAMP()'], 'order' => 'date']);
     $this->setViewData('schedules', $schedules);
 }
Esempio n. 25
0
 public function get_fleetsonnotprintspj()
 {
     $date = Input::get('date', date('Y-m-d'));
     $pool_id = Auth::user()->pool_id;
     $timestamp = strtotime($date);
     /*
     $fleets_on_not_printspj = Scheduledate::join('schedules','schedules.id','=','schedule_dates.schedule_id')
                 ->join('fleets', 'fleets.id', '=', 'schedules.fleet_id' )
                 //->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id' )
                 //->where_in('schedule_dates.schedule_id', $arrayschedule )
                 //->where('ksos.actived','=',1)
                 ->where('schedules.pool_id', '=', $pool_id )
                 ->where('schedule_dates.date', '=', date('j', $timestamp))
                 ->where('schedules.month','=',date('n', $timestamp ))
                 ->where('schedule_dates.fg_check','=',0)                  
                 ->order_by('fleets.taxi_number','asc')
                 ->get(array('schedule_dates.id as id','schedule_dates.driver_id','schedules.fleet_id','fleets.taxi_number'));
     */
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets_on_not_printspj = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets_on_not_printspj = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedule_dates.fg_check', '=', 0)->order_by('fleets.taxi_number', 'asc')->get(array('fleets.taxi_number', 'schedule_dates.id as id'));
     }
     $datas = array_map(function ($object) {
         return $object->to_array();
     }, $fleets_on_not_printspj);
     return Response::json($datas);
 }
Esempio n. 26
0
 /**
  * Generate the view of the week for given month and given year
  * with events in this period.
  *
  * @param string $year
  * @param string $week 
  * @return view weekView
  *
  *
  */
 public function showWeek($year, $week)
 {
     // Create week start date on monday (day 1)
     $weekStart = date('Y-m-d', strtotime($year . "W" . $week . '1'));
     // Create the number of the next week
     $nextWeek = date("W", strtotime("next Week" . $weekStart));
     $nextYear = date("Y", strtotime("next Week" . $weekStart));
     // Create week end date - we go till tuesday (day 2) because café needs alternative week view (Mi-Di)
     $weekEnd = date('Y-m-d', strtotime($nextYear . "W" . $nextWeek . '2'));
     // Create the number of the previous week
     $previousWeek = date("W", strtotime("previous Week" . $weekStart));
     $previousYear = date("Y", strtotime("previous Week" . $weekStart));
     // Convert number of prev/next week to verbatim format - needed for correct << and >> button links
     $nextWeek = $nextYear . "/KW" . $nextWeek;
     $previousWeek = $previousYear . "/KW" . $previousWeek;
     $date = array('year' => $year, 'week' => $week, 'weekStart' => $weekStart, 'weekEnd' => $weekEnd, 'nextWeek' => $nextWeek, 'previousWeek' => $previousWeek);
     $events = ClubEvent::where('evnt_date_start', '>=', $weekStart)->where('evnt_date_start', '<=', $weekEnd)->with('getPlace', 'getSchedule.getEntries.getJobType', 'getSchedule.getEntries.getPerson.getClub')->orderBy('evnt_date_start')->orderBy('evnt_time_start')->get();
     $tasks = Schedule::where('schdl_show_in_week_view', '=', '1')->where('schdl_due_date', '>=', $weekStart)->where('schdl_due_date', '<=', $weekEnd)->with('getEntries.getPerson.getClub', 'getEntries.getJobType')->get();
     // TODO: don't use raw query, rewrite with eloquent.
     $persons = Cache::remember('personsForDropDown', 10, function () {
         $timeSpan = new DateTime("now");
         $timeSpan = $timeSpan->sub(DateInterval::createFromDateString('3 months'));
         return Person::whereRaw("prsn_ldap_id IS NOT NULL \n\t\t\t\t\t\t\t\t\t\t AND (prsn_status IN ('aktiv', 'kandidat') \n\t\t\t\t\t\t\t\t\t\t OR updated_at>='" . $timeSpan->format('Y-m-d H:i:s') . "')")->orderBy('clb_id')->orderBy('prsn_name')->get();
     });
     $clubs = Club::orderBy('clb_title')->lists('clb_title', 'id');
     // IDs of schedules shown, needed for bulk-update
     $updateIds = array();
     foreach ($events as $event) {
         array_push($updateIds, $event->getSchedule->id);
     }
     return View::make('weekView', compact('events', 'schedules', 'date', 'tasks', 'entries', 'weekStart', 'weekEnd', 'persons', 'clubs'));
 }
Esempio n. 27
0
 public static function boot()
 {
     parent::boot();
     static::deleted(function ($group) {
         Schedule::destroy($group->schedules()->lists('id'));
     });
 }
Esempio n. 28
0
 public static function GetNextItem($p_timeNow)
 {
     //get previous show and previous item in the schedule table.
     //Compare the two and if the last show was recorded and started
     //after the last item in the schedule table, then return the show's
     //name. Else return the last item from the schedule.
     $showInstance = ShowInstance::GetNextShowInstance($p_timeNow);
     $row = Schedule::GetNextScheduleItem($p_timeNow);
     if (is_null($showInstance)) {
         if (count($row) == 0) {
             return null;
         } else {
             return array("name" => $row[0]["artist_name"] . " - " . $row[0]["track_title"], "starts" => $row[0]["starts"], "ends" => $row[0]["ends"]);
         }
     } else {
         if (count($row) == 0) {
             if ($showInstance->isRecorded()) {
                 //last item is a show instance
                 return array("name" => $showInstance->getName(), "starts" => $showInstance->getShowStart(), "ends" => $showInstance->getShowEnd());
             } else {
                 return null;
             }
         } else {
             //return the one that starts sooner.
             if ($row[0]["starts"] <= $showInstance->getShowStart()) {
                 return array("name" => $row[0]["artist_name"] . " - " . $row[0]["track_title"], "starts" => $row[0]["starts"], "ends" => $row[0]["ends"]);
             } else {
                 return array("name" => $showInstance->getName(), "starts" => $showInstance->getShowStart(), "ends" => $showInstance->getShowEnd());
             }
         }
     }
 }
Esempio n. 29
0
 public function thanksAction()
 {
     try {
         $schedule = new Schedule();
         $is_able_to_register = $schedule->is_in_time('regist', $this->current_time);
         $is_able_to_post_impression = $schedule->is_in_time('impre', $this->current_time);
     } catch (Exception $e) {
         $this->displayErrorView($e->getMessage());
     }
     $this->view->assign('is_able_to_register', $is_able_to_register);
     $this->view->assign('is_able_to_post_impression', $is_able_to_post_impression);
     $this->view->assign('root_url', ROOT_URL);
     $this->view->assign('head', 'Registration is Completed.');
     $this->view->assign('msg', 'あなたの作品登録を受け付けました');
     $this->view->display('thanks.tpl');
 }
Esempio n. 30
0
 public function schedules()
 {
     $schedules = Schedule::where('user_id', '=', Auth::user()->id)->paginate(10);
     $page_data = array('schedules' => $schedules);
     $this->layout->title = 'Schedules';
     $this->layout->content = View::make('admin.schedules', $page_data);
 }