本文整理汇总了PHP中Schedule::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::find方法的具体用法?PHP Schedule::find怎么用?PHP Schedule::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule
的用法示例。
在下文中一共展示了Schedule::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: overview
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);
}
示例2: get_records_html
public function get_records_html()
{
$records = RegisterRecord::where('user_id', Session::get('user.id'))->with('doctor')->get();
foreach ($records as $record) {
$doctor = $record->doctor;
$period = $record->period()->first();
$schedule = Schedule::find($period['schedule_id']);
$schedule_info = array('date' => $schedule->date, 'period' => $this->possible_period[$schedule->period], 'start' => date('H:i', strtotime($period->start)), 'end' => date('H:i', strtotime($period->end)));
$data[] = array('id' => $record->id, 'status' => $this->possible_status[$record->status], 'can_be_canceled' => $record->status == 0, 'created_at' => $record->created_at->format('Y-m-d H:i'), 'start' => $record->status ? date('Y-m-d H:i', strtotime($record->start)) : '', 'schedule' => $schedule_info, 'department' => $doctor->department->name, 'doctor' => array('id' => $doctor->id, 'name' => $doctor->name, 'title' => $doctor->title));
}
return View::make('user.record', array('records' => $data));
}
示例3: get_periods
public function get_periods()
{
$schedule = Schedule::find(Input::get('schedule_id'));
if (!isset($schedule)) {
return Response::json(array('error_code' => 1, 'message' => '不存在该排班'));
}
$periods = $schedule->periods;
if (!isset($periods)) {
return Response::json(array('error_code' => 2, 'message' => '该排班无日期'));
}
return Response::json(array('error_code' => 0, 'periods' => $periods));
}
示例4: post
public function post()
{
if (Input::has('api_key') && Input::has('content')) {
$api_key = Input::get('api_key');
$content = Input::get('content');
$settings = Settings::where('api_key', '=', $api_key)->first();
$user_id = $settings->user_id;
$default_networks = json_decode($settings->default_networks, true);
$schedule = Carbon::now();
if (Input::has('queue')) {
$schedule_id = $settings->schedule_id;
$interval = Schedule::find($schedule_id);
if ($interval->rule == 'add') {
$schedule = $current_datetime->modify('+ ' . $interval->period);
} else {
if ($interval->rule == 'random') {
$current_day = date('d');
$from_datetime = Carbon::now();
$to_datetime = $from_datetime->copy()->modify('+ ' . $interval->period);
$days_to_add = $from_datetime->diffInDays($to_datetime);
$day = mt_rand($current_day, $current_day + $days_to_add);
$hour = mt_rand(1, 23);
$minute = mt_rand(0, 59);
$second = mt_rand(0, 59);
//year, month and timezone is null
$schedule = Carbon::create(null, null, $day, $hour, $minute, $second, null);
}
}
if (empty($schedule)) {
$schedule = $current_datetime->addHours(1);
}
}
if (!empty($default_networks)) {
$post = new Post();
$post->user_id = $user_id;
$post->content = $content;
$post->date_time = $schedule;
$post->save();
$post_id = $post->id;
foreach ($default_networks as $network_id) {
$post_network = new PostNetwork();
$post_network->user_id = $user_id;
$post_network->post_id = $post_id;
$post_network->network_id = $network_id;
$post_network->status = 1;
$post_network->save();
}
Queue::later($schedule, 'SendPost@fire', array('post_id' => $post_id));
$response_data = array('type' => 'success', 'text' => 'Your post was scheduled! It will be published on ' . $schedule->format('l jS \\o\\f F \\a\\t h:i A'));
return $response_data;
}
}
}
示例5: select_period
public function select_period()
{
$schedule = Schedule::find(Input::get('schedule_id'));
if (!isset($schedule)) {
// ..
}
$doctor = $schedule->doctor;
$periods = $schedule->periods;
foreach ($periods as $period) {
$period->start = date('H:i', strtotime($period->start));
$period->end = date('H:i', strtotime($period->end));
}
return View::make('register.select_period', array('doctor' => array('name' => $doctor->name, 'photo' => $doctor->photo, 'title' => $doctor->title, 'specialty' => strip_tags($doctor->specialty), 'department' => $doctor->department->name, 'hospital' => $doctor->department->hospital->name), 'schedule' => $schedule, 'periods' => $periods->toArray()));
}
示例6: schedule_notification
protected function schedule_notification($appt_id)
{
$row1 = Schedule::find($appt_id);
if ($row1->pid != '0') {
$row = Demographics::find($row1->pid);
$row2 = Practiceinfo::find(Session::get('practice_id'));
$row0 = User::find($row1->provider_id);
$displayname = $row0->displayname;
$to = $row->reminder_to;
$phone = $row2->phone;
$startdate = date("F j, Y, g:i a", $row1->start);
if ($row1->start < time()) {
if ($to != '') {
$data_message['startdate'] = date("F j, Y, g:i a", $row1->start);
$data_message['displayname'] = $row0->displayname;
$data_message['phone'] = $row2->phone;
$data_message['email'] = $row2->email;
$data_message['additional_message'] = $row2->additional_message;
if ($row->reminder_method == 'Cellular Phone') {
$this->send_mail(array('text' => 'emails.remindertext'), $data_message, 'Appointment Reminder', $to, Session::get('practice_id'));
} else {
$this->send_mail('emails.reminder', $data_message, 'Appointment Reminder', $to, Session::get('practice_id'));
}
}
}
}
}
示例7: get_editscheduleonmaster
public function get_editscheduleonmaster($scheduledate_id = false)
{
if (!$scheduledate_id) {
return false;
}
$schd = Scheduledate::find($scheduledate_id);
$schm = Schedule::find($schd->schedule_id);
$stmp = mktime(0, 0, 0, $schm->month, $schd->date, $schm->year);
$this->data['date'] = Myfungsi::fulldate($stmp);
$this->data['schd'] = $schd;
$this->data['schm'] = $schm;
$this->data['month'] = date('n', $stmp);
$this->data['year'] = date('Y', $stmp);
$this->data['bckso'] = Kso::where('fleet_id', '=', $schm->fleet_id)->where('actived', '=', 1)->first();
return View::make('themes.modul.' . $this->views . '.editscheduleonmaster', $this->data);
}
示例8: edit
/**
* Show the form for editing the specified schedule.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$schedule = Schedule::find($id);
return View::make('schedules.edit', compact('schedule'));
}
示例9: rec_override
/**
* Add an override or dontrec record to force this show to/not record pass in
* rectype_dontrec or rectype_override constants
**/
public function rec_override($rectype)
{
$schedule =& Schedule::find($this->recordid);
// Unknown schedule?
if (!$schedule) {
add_error('Unknown schedule for this program\'s recordid: ' . $this->recordid);
return;
}
// Update the schedule with the new program info
$schedule->chanid = $this->chanid;
$schedule->starttime = $this->starttime;
$schedule->endtime = $this->endtime;
$schedule->title = $this->title;
$schedule->subtitle = $this->subtitle;
$schedule->description = $this->description;
$schedule->category = $this->category;
$schedule->station = $this->channel->callsign;
// Note that "callsign" becomes "station"
$schedule->seriesid = $this->seriesid;
$schedule->programid = $this->programid;
// $schedule->search = 0;
$schedule->inactive = 0;
// Save the schedule -- it'll know what to do about the override
$schedule->save($rectype);
}
示例10: post_toolspj
public function post_toolspj()
{
$date = Input::get('tanggal', date('Y-m-d'));
ini_set('max_execution_time', 120);
$timestamp = strtotime($date);
//list armada on schedule
$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 = array();
if (is_array($arrayschedule) && !empty($arrayschedule)) {
$fleets = 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('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('schedule_dates.shift_id', '=', 1)->where('ksos.actived', '=', 1)->order_by('fleets.taxi_number', 'asc')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number'));
}
if ($fleets) {
foreach ($fleets as $f) {
$scheduledate = Scheduledate::find($f->id);
$scheduledate->fg_check = 1;
$scheduledate->save();
$schedule = Schedule::find($scheduledate->schedule_id);
//$driverinfo = Driver::find($scheduledate->driver_id);
//$fleetinfo = Fleet::find($schedule->fleet_id);
$ksoinfo = Kso::where_fleet_id($schedule->fleet_id)->where_actived(1)->first();
$dateopertion = mktime(0, 0, 0, $schedule->month, $scheduledate->date, $schedule->year);
$checkouts = Checkout::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->first();
//delete checkouts
if ($checkouts) {
$checkouts->delete();
}
$codeops = 1;
$status = 7;
$keterangan = 'Print SPJ melalui Tools';
if (!$checkouts) {
//insert into to checkouts step
$checkouts = new Checkout();
$checkouts->kso_id = $ksoinfo->id;
$checkouts->operasi_time = date('Y-m-d', $dateopertion);
$checkouts->fleet_id = $schedule->fleet_id;
$checkouts->driver_id = $scheduledate->driver_id;
$checkouts->checkout_step_id = $status;
$checkouts->shift_id = $scheduledate->shift_id;
$checkouts->user_id = Auth::user()->id;
$checkouts->pool_id = Auth::user()->pool_id;
$checkouts->printspj_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
$checkouts->operasi_status_id = $codeops;
$checkouts->keterangan = $keterangan;
$checkouts->save();
$cinada = Checkin::where('operasi_time', '=', date('Y-m-d', $dateopertion))->where('fleet_id', '=', $schedule->fleet_id)->first();
if ($cinada) {
$cinada->delete();
}
if (!$cinada) {
$cin = Checkin::create(array('kso_id' => $ksoinfo->id, 'fleet_id' => $schedule->fleet_id, 'driver_id' => $scheduledate->driver_id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $scheduledate->shift_id, 'km_fleet' => 0, 'rit' => 0, 'incomekm' => 0, 'operasi_time' => date('Y-m-d', $dateopertion), 'pool_id' => Auth::user()->pool_id, 'operasi_status_id' => $codeops, 'fg_late' => '', 'checkin_step_id' => 2, 'document_check_user_id' => Auth::user()->id, 'physic_check_user_id' => '', 'bengkel_check_user_id' => '', 'finance_check_user_id' => '', 'keterangan' => $keterangan));
if ($cin) {
$docs = new Checkindocument();
$docs->checkin_id = $cin->id;
$docs->save();
//return Redirect::to('schedule');
}
//
}
}
}
return Redirect::to('schedule');
}
}
示例11: elseif
if ($_REQUEST['forget_old']) {
$program->rec_forget_old();
} elseif ($_REQUEST['never_record']) {
$program->rec_never_record();
} elseif ($_REQUEST['default']) {
$program->rec_default();
} elseif ($_REQUEST['dontrec']) {
$program->rec_override(rectype_dontrec);
} elseif ($_REQUEST['record']) {
$program->rec_override(rectype_override);
} elseif ($_REQUEST['activate']) {
$program->activate();
}
} else {
if ($_REQUEST['dontrec']) {
$schedule =& Schedule::find($_GET['chanid'], $_GET['starttime'])->save(rectype_dontrec);
} else {
add_warning('Unknown program.');
}
}
// Redirect back to the page again, but without the query string, so reloads are cleaner
redirect_browser(root_url . 'tv/upcoming');
}
// Ignore certain shows?
if ($_POST['change_display']) {
$_SESSION['scheduled_recordings']['disp_scheduled'] = $_POST['disp_scheduled'] ? true : false;
$_SESSION['scheduled_recordings']['disp_duplicates'] = $_POST['disp_duplicates'] ? true : false;
$_SESSION['scheduled_recordings']['disp_deactivated'] = $_POST['disp_deactivated'] ? true : false;
$_SESSION['scheduled_recordings']['disp_conflicts'] = $_POST['disp_conflicts'] ? true : false;
$_SESSION['scheduled_recordings']['disp_recgroup'] = $_POST['disp_recgroup'];
$_SESSION['scheduled_recordings']['disp_title'] = $_POST['disp_title'];
示例12: createPost
public function createPost()
{
$user_id = Auth::user()->id;
$rules = array('content' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
if (Input::has('ajax')) {
return array('type' => 'danger', 'messages' => $validator->messages());
} else {
return Redirect::to('/post/new')->withErrors($validator)->withInput();
}
}
$content = Input::get('content');
$post_now = Input::get('post_now');
$schedule_type = Input::get('schedule');
if (empty($schedule_type)) {
$schedule_type = Setting::where('user_id', '=', $user_id)->pluck('schedule_id');
}
$schedule_id = Settings::where('user_id', '=', $user_id)->pluck('schedule_id');
$current_datetime = Carbon::now();
$schedule = Carbon::now();
if ($post_now == '0' && $schedule_type != 'custom') {
$schedule_id = $schedule_type;
$interval = Schedule::find($schedule_id);
if ($interval->rule == 'add') {
$schedule = $current_datetime->modify('+ ' . $interval->period);
} else {
if ($interval->rule == 'random') {
$current_day = date('d');
$from_datetime = Carbon::now();
$to_datetime = $from_datetime->copy()->modify('+ ' . $interval->period);
$days_to_add = $from_datetime->diffInDays($to_datetime);
$day = mt_rand($current_day, $current_day + $days_to_add);
$hour = mt_rand(1, 23);
$minute = mt_rand(0, 59);
$second = mt_rand(0, 59);
//year, month and timezone is null
$schedule = Carbon::create(null, null, $day, $hour, $minute, $second, null);
}
}
if (empty($schedule)) {
$schedule = $current_datetime->addHours(1);
}
} else {
$schedule = Carbon::parse(Input::get('schedule_value'));
}
$networks = Input::get('network');
if (empty($networks)) {
$networks = Setting::where('user_id', '=', $user_id)->pluck('default_networks');
$networks = json_decode($networks, true);
}
$post = new Post();
$post->user_id = $user_id;
$post->content = $content;
$post->date_time = $schedule->toDateTimeString();
$post->save();
$post_id = $post->id;
foreach ($networks as $network_id) {
$post_network = new PostNetwork();
$post_network->user_id = $user_id;
$post_network->post_id = $post_id;
$post_network->network_id = $network_id;
$post_network->status = 1;
$post_network->save();
}
Queue::later($schedule, 'SendPost@fire', array('post_id' => $post_id));
if (Input::has('ajax')) {
return array('type' => 'success', 'text' => 'Your post was scheduled! It will be published on ' . $schedule->format('l jS \\o\\f F \\a\\t h:i A'));
}
return Redirect::to('/post/new')->with('message', array('type' => 'success', 'text' => 'Your post was scheduled! It will be published on ' . $schedule->format('l jS \\o\\f F \\a\\t h:i A')));
}
示例13: postApptView
public function postApptView($appt_id, $pid)
{
$row = Schedule::find($appt_id);
$row1 = Demographics::find($pid);
$text = '<strong>Patient:</strong> ' . $row1->firstname . " " . $row1->lastname . '<br><br><strong>Start Date:</strong> ' . date('m/d/Y h:i A', $row->start) . '<br><br><strong>End Date:</strong> ' . date('m/d/Y h:i A', $row->end) . '<br><br><strong>Visit Type:</strong> ' . $row->visit_type . '<br><br><strong>Reason:</strong> ' . $row->reason . '<br><br><strong>Status:</strong> ' . $row->status;
echo $text;
}
示例14: delete_schedule
public function delete_schedule()
{
if (Auth::check()) {
$data["inside_url"] = Config::get('app.inside_url');
$data["user"] = Session::get('user');
$data["actions"] = Session::get('actions');
if (in_array('side_armar_horario', $data["actions"])) {
$id = Input::get('schedule_id');
$schedule = Schedule::find($id);
$level = $schedule->course->level;
// si es un tutor, solo puede eliminar el horario de su nivel
$is_tutor = $data["user"]->profiles()->where('name', '=', 'Tutor')->first() ? true : false;
if ($is_tutor && $data["user"]->teacher->level->id != $level->id) {
Session::flash('error', 'Usted no puede modificar este horario.');
return Redirect::to('levels/' . $level->id . '/schedule');
}
$s_ids = $level->schedules()->where('initial_hour', '=', $schedule->initial_hour)->where('final_hour', '=', $schedule->final_hour)->get()->lists('id');
Schedule::whereIn('id', $s_ids)->delete();
// Llamo a la función para registrar el log de auditoria
$log_description = "Se eliminaron los Horarios con ids: " . implode(', ', $s_ids);
Helpers::registerLog(5, $log_description);
Session::flash('message', 'Se eliminó correctamente la hora.');
return Redirect::to('levels/' . $level->id . '/schedule');
} else {
// Llamo a la función para registrar el log de auditoria
$log_description = "Se intentó acceder a la ruta '" . Request::path() . "' por el método '" . Request::method() . "'";
Helpers::registerLog(10, $log_description);
Session::flash('error', 'Usted no tiene permisos para realizar dicha acción.');
return Redirect::to('/dashboard');
}
} else {
return View::make('error/error');
}
}
示例15: deleteTask
/**
* Delete a task specified by parameter $id with scheduleEntries.
* You can only delete, if you have rigths for marketing or clubleitung.
*
* @param int $id
* @return RedirectResponse
*/
public function deleteTask($id)
{
if (!Session::has('userId')) {
Session::put('message', Config::get('messages_de.access-denied'));
Session::put('msgType', 'danger');
return Redirect::action('MonthController@showMonth', array('year' => date('Y'), 'month' => date('m')));
}
// at first get all data
$schedule = Schedule::find($id);
if (is_null($schedule)) {
Session::put('message', Config::get('messages_de.task-doesnt-exist'));
Session::put('msgType', 'danger');
return Redirect::back();
}
// log the action
Log::info('Delete task: User ' . Session::get('userId') . ' with rigths ' . Session::get('userGroup') . ' deletes task ' . $schedule->schdl_title . ' with id ' . $schedule->id . '.');
$entries = $schedule->getEntries()->GetResults();
// at least delete date in reverse order 'cause of dependencies in database
foreach ($entries as $entry) {
$entry->delete();
}
$schedule->delete();
// show current month
Session::put('message', Config::get('messages_de.delete-task-ok'));
Session::put('msgType', 'success');
return Redirect::action('ScheduleController@showTaskList');
}