public function run() { DB::table('schedules')->delete(); Schedule::create(array('start_time' => '18:00:00', 'end_time' => '6:00:00', 'brightness' => 20, 'start_date' => '2014-04-10', 'end_date' => '2014-04-20')); Schedule::create(array('start_time' => '17:00:00', 'end_time' => '5:30:00', 'brightness' => 80, 'start_date' => '2014-04-01', 'end_date' => '2014-04-02')); Schedule::create(array('start_time' => '17:30:00', 'end_time' => '6:00:00', 'brightness' => 80, 'start_date' => '2014-03-27', 'end_date' => '2014-03-28')); }
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)]); } }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Schedule::create([]); } }
/** * 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)); }
/** * Store a newly created schedule in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Schedule::$rules, Schedule::$messages); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } Schedule::create($data); return Redirect::route('schedules.index'); }
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); }
public function run() { DB::table('schedules')->delete(); Schedule::create(array('date' => '2015-08-27', 'period' => 0, 'doctor_id' => 1)); Schedule::create(array('date' => '2015-08-27', 'period' => 1, 'doctor_id' => 1)); Schedule::create(array('date' => '2015-08-28', 'period' => 0, 'doctor_id' => 1)); Schedule::create(array('date' => '2015-08-27', 'period' => 0, 'doctor_id' => 2)); Schedule::create(array('date' => '2015-08-28', 'period' => 1, 'doctor_id' => 2)); Schedule::create(array('date' => '2015-08-27', 'period' => 1, 'doctor_id' => 3)); Schedule::create(array('date' => '2015-08-28', 'period' => 0, 'doctor_id' => 3)); Schedule::create(array('date' => '2015-08-29', 'period' => 0, 'doctor_id' => 3)); }
public function run() { Eloquent::unguard(); /** * Clearing table */ DB::table('schedules')->delete(); /** * Creating event schedules */ Schedule::create(array('schdl_title' => 'Example event template', 'schdl_time_preparation_start' => '20:00', 'schdl_password' => Hash::make('password'), 'evnt_id' => '1', 'schdl_is_template' => '1')); /* * Creating tasks */ Schedule::create(array('schdl_title' => 'Example task', 'schdl_due_date' => '2015-04-01', 'schdl_is_template' => '0')); /** * Reporting result to console */ $this->command->info('One event schedule for event ID 1 and one example task created on 01.04.2015.'); }
protected function insert_schedules() { $doctors = Doctor::all(); foreach ($doctors as $doctor) { $count = rand(300, 500); while ($count--) { $date = $this->get_random_date(); $schedules = Schedule::where('date', $date)->where('doctor_id', $doctor->id)->get(); if ($schedules->count()) { continue; } // 添加早上排班 if (rand(0, 1)) { Schedule::create(['date' => $date, 'period' => 0, 'doctor_id' => $doctor->id]); } // 添加下午排班 if (rand(0, 1)) { Schedule::create(['date' => $date, 'period' => 1, 'doctor_id' => $doctor->id]); } } } }
public function createSchedule() { if (!empty($_POST['taskdate']) && !empty($_POST['cid']) && !empty($_POST['empid'])) { $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['cid'])); $thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['empid'])); $thisSchedule = new Schedule(); $thisSchedule->emp_id = $_POST['empid']; $thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname; $thisSchedule->client_id = " "; $thisSchedule->prod_id = $_POST['cid']; $thisSchedule->prod_name = $thisclientproduct->prod_name; $thisSchedule->s_date = $_POST['taskdate']; //$thisSchedule->s_time_in ; //$thisSchedule->s_time_out; $thisSchedule->issue = $_POST["tissue"]; $thisSchedule->datecreated = date("Y-m-d H:i:s"); $thisSchedule->maint_type = $_POST['mtype']; $msg = "Maintenance task alert for {$thisclientproduct->prod_name} at"; $msg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch; $msg .= "\r\n issue:" . $_POST["tissue"]; if ($thisSchedule->create()) { sendSms($thisemployee->emp_phone, $msg); return true; } else { return false; } } }
<?php require_once 'core/init.php'; $member_role = $_SESSION['roles']; if (in_array("Laboratory Administrator", $member_role)) { } else { header('location:restricted_page.php'); } $start_date = $_POST["sem_start_date"]; $end_date = $_POST["sem_end_date"]; if (strtotime($start_date) < strtotime($end_date)) { $data = array("schedule_id" => null, "semester_no" => $_POST["semester"], "academic_year" => $_POST["academic_year"], "schedule_start_date" => $_POST["sem_start_date"], "schedule_end_date" => $_POST["sem_end_date"]); $newSchedule = new Schedule(); $newSchedule->create($data); if ($newSchedule->add()) { echo "You have successfully added a schedule !"; } else { echo "Schedule creation was unsuccessful !"; } } else { echo "Schedule start date must be less than schedule end date !!"; }
public static function getAllSchedules() { $result = DB::getInstance()->directSelect("SELECT * FROM schedule;"); $schedules = array(); if (count($result) == 0) { return null; } foreach ($result as $key => $value) { $schedule = array("schedule_id" => $value["schedule_id"], "semester_no" => $value["semester_no"], "academic_year" => $value["academic_year"], "schedule_start_date" => $value["schedule_start_date"], "schedule_end_date" => $value["schedule_end_date"]); $newSchedule = new Schedule(); $newSchedule->create($schedule); $schedules[] = $newSchedule; } return $schedules; }
public function schedule($elements = array()) { return Schedule::create($elements); }
public function user_of_run($start) { $query = new Query('USER_OF_RUN', $this->dbh); $query->where('STARTDATE', '>', $start); $query->order('STARTDATE'); $result = $query->get('STARTDATE,ENDDATE,USERID,NUM_OF_RUN_ID'); foreach ($result as $row) { Schedule::create(['start_date' => $row['STARTDATE'], 'end_date' => $row['ENDDATE'], 'employee_id' => $row['USERID'], 'weekly_schedule_id' => $row['NUM_OF_RUN_ID']]); } $size = count($result); $this->num_data += $size; return $size > 0 ? $result[$size - 1]['STARTDATE'] : $start; }
public function createSchedule_Detail($id = "") { header('Content-Type: application/json'); $data = json_decode(stripslashes($_POST['data'])); foreach ($data as $d => $value) { $cntdata[] = $d; } if (!empty($data->taskdate) && !empty($data->cid) && !empty($data->empid)) { $issuefield = get_object_vars($data); // get the properties of an object into an array $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->cid)); $thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->empid)); $thisSchedule = new Schedule(); $thisSchedule->emp_id = $issuefield['empid']; $thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname; $thisSchedule->client_id = $thisclientproduct->client_id; $thisClient = Client::find_by_id($thisclientproduct->client_id); //print_r($thisclientproduct); //print_r($thisClient); //print_r($thisemployee); $thisSchedule->prod_id = $issuefield['cid']; $thisSchedule->prod_name = $thisclientproduct->prod_name; /** * this is to check if ticket * is in existence */ //print_r($theUser); global $session; //$partTicket = ($id!="") ? Ticket::find_by_id($id) : ""; // get the ticket to get details needed for sending mail $theUser = Employee::find_by_id($_SESSION["emp_ident"]); // get cse detail to retrieve email $thisSchedule->s_date = $data->taskdate; /** * section to configure and setup sms and email message */ $issue = array(); $objIssue = Issue::find_all(); // creating the issue log object $message_issue = ""; //$thisemployee->emp_phone foreach ($objIssue as $objI) { foreach ($issuefield as $key => $value) { if ($key == $objI->issue_accronym) { $message_issue .= $objI->issue_name . ", "; } } } $cemail = array(); $cemail = isset($_POST['cemail']) && !empty($_POST['cemail']) ? explode(",", $_POST['cemail']) : array('*****@*****.**'); array_push($cemail, $thisemployee->emp_email, is_array($partTicket) ? $partTicket->contact_email : "", $theUser->emp_email, $thisClient->email); //print_r($cemail); $thisSchedule->status = "Open"; $thisSchedule->issue = $message_issue; $thisSchedule->datecreated = date("Y-m-d H:i:s"); $thisSchedule->maint_type = $_POST['mtype']; $subject = "Maintenance Alert"; $smsmsg = "Maintenance alert for {$thisclientproduct->prod_name} at"; $smsmsg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch; $smsmsg .= "\r\n Issue:" . $message_issue . "\r\n"; $smsmsg .= "\r\n Comment:" . $issuefield["tissue"] . "\r\n"; $msg = "<h3>Maintenance Detail</h3> <hr />"; $msg .= "<p><strong>Machine: </strong>{$thisclientproduct->prod_name} </p>"; $msg .= "<p><strong>Client: </strong> {$thisClient->name}</p>"; $msg .= "<p><strong>Location: </strong>{$thisclientproduct->install_location} {$thisclientproduct->branch} {$thisclientproduct->install_city} </p>"; $msg .= "<p><strong>Issues: </strong>" . $message_issue . "</p>"; $msg .= "<p><strong>Comment: </strong>" . $issuefield["tissue"] . "</p>"; $msg .= "<br /><br /> <h4>Technician Details</h4> <hr />"; $msg .= "<p><strong>Name: </strong>" . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "</p>"; $msg .= "<p><strong>Email: </strong>" . $thisemployee->emp_email . "</p>"; $msg .= "<p><strong>Telephone: </strong>" . $thisemployee->emp_phone . "</p>"; $msg .= "<br /><br /><h4>Scheduled Date</h4> <hr />"; $msg .= "<p><strong>{$thisSchedule->s_date}</strong></p><br /><br /><br /><br />"; /** * the transaction log is created * to ensure that the product already * has history and cannot be deleted */ $Tlog2 = new Transaction(); $Tlog2->com_id = $thisclientproduct->main_id; $Tlog2->trans_type = "TASK ASSIGNMENT"; $Tlog2->trans_description = $issuefield["mtype"] . " task assigned to " . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . ""; $Tlog2->datecreated = date("Y-m-d H:i:s"); $Tlog2->user_id = $_SESSION['emp_ident']; // print_r($msg); if ($thisSchedule->create()) { $Tlog2->create(); /** * this section is needed * to post issues to database table * issuelog for statistical analysis on * issues */ //$thisemployee->emp_phone foreach ($objIssue as $objI) { foreach ($issuefield as $key => $value) { if ($key == $objI->issue_accronym) { $issueLog = new Issuelog(); $issueLog->ticket_id = 0; $issueLog->issue_id = $objI->id; $issueLog->issue_accronym = $objI->issue_accronym; $issueLog->issue_name = $objI->issue_name; $issueLog->prod_id = $issuefield['cid']; $issueLog->datecreated = date("Y-m-d H:i:s"); //$ddticket->subject .= $_POST[$objI->issue_accronym]. ", "; $issueLog->create(); } } } sendSms($thisemployee->emp_phone, $smsmsg); //method in function.php in the library folder helps to send sms $this->sendMail($thisSchedule->emp_name, $subject, $msg, $cemail); // sends email to employee return 1; } else { return 2; } } }