当前位置: 首页>>代码示例>>PHP>>正文


PHP Schedule::save方法代码示例

本文整理汇总了PHP中Schedule::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::save方法的具体用法?PHP Schedule::save怎么用?PHP Schedule::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schedule的用法示例。


在下文中一共展示了Schedule::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateApiFromEvent

 public function updateApiFromEvent(Google_Service_Calendar_Event $event, Member $member, $publicFlag)
 {
     $conn = $this->getConnection();
     $conn->beginTransaction();
     try {
         $schedule = $this->findOneByApiIdUnique($event->id);
         if ('cancelled' === $event->status) {
             if ($schedule) {
                 $schedule->delete();
             }
             $conn->commit();
             return true;
         }
         if (!$schedule) {
             $schedule = new Schedule();
             $schedule->setApiIdUnique($event->id);
         } elseif ($event->etag === $schedule->api_etag) {
             $conn->rollback();
             return $schedule->id;
         }
         $schedule->setTitle($event->summary);
         $schedule->setBody($event->description);
         $schedule->setMember($member);
         $schedule->setPublicFlag($this->getEventPublicFlag($event, $publicFlag));
         if ($event->start->dateTime) {
             $startDateTime = new DateTime($event->start->dateTime);
             $schedule->setStartDate($startDateTime->format('Y-m-d'));
             $schedule->setStartTime($startDateTime->format('H:i:s'));
         } elseif ($event->start->date) {
             $schedule->setStartDate($event->start->date);
         }
         if ($event->end->dateTime) {
             $endDateTime = new DateTime($event->end->dateTime);
             $schedule->setEndDate($endDateTime->format('Y-m-d'));
             $schedule->setEndTime($endDateTime->format('H:i:s'));
         } elseif ($event->end->date) {
             $schedule->setStartDate($event->end->date);
         }
         $schedule->setApiEtag($event->etag);
         $schedule->save();
         ScheduleMemberTable::getInstance()->updateScheduleMember(array('schedule_id' => $schedule->id, 'member_id' => $schedule->member_id));
         foreach ($event->attendees as $attendee) {
             $memberId = opCalendarPluginToolkit::seekEmailAndGetMemberId($attendee->email);
             if (!$memberId) {
                 continue;
             }
             ScheduleMemberTable::getInstance()->updateScheduleMember(array('schedule_id' => $schedule->id, 'member_id' => $memberId));
         }
         $conn->commit();
     } catch (Exception $e) {
         $conn->rollback();
         throw $e;
     }
     return $schedule->id;
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:55,代码来源:PluginScheduleTable.class.php

示例2: addSchedule

 public function addSchedule()
 {
     $members = Member::find('all', ['order' => 'username']);
     $this->setViewData('members', $members);
     if ($_POST) {
         $schedule = new Schedule();
         $schedule->date = strtotime($_POST['date']);
         $schedule->member_id = $_POST['member_id'];
         $schedule->save();
         $this->redirect($this->url());
     }
 }
开发者ID:realskudd,项目名称:breakfast,代码行数:12,代码来源:Rotation.class.php

示例3: actionCreate

 /**
  * Создает новую модель Расписания.
  * Если создание прошло успешно - перенаправляет на просмотр.
  *
  * @return void
  */
 public function actionCreate()
 {
     $model = new Schedule();
     if (Yii::app()->getRequest()->getPost('Schedule') !== null) {
         $model->setAttributes(Yii::app()->getRequest()->getPost('Schedule'));
         if ($model->save()) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('ListnerModule.listner', 'Запись добавлена!'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['update', 'id' => $model->id]));
         }
     }
     $this->render('create', ['model' => $model]);
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:18,代码来源:ScheduleBackendController.php

示例4: actionCreate

    public function actionCreate()
    {
        $model = new Schedule();
        $model2 = new ProfessorCourse();
        // Uncomment the following line if AJAX validation is needed
        // $this->performAjaxValidation($model);
        if (isset($_POST['Schedule'])) {
            $sql = '
			
       select sem.end_Date from professor_course pc join courses co on pc.course_Id = co.course_Id
	   join semesters sem on sem.semester_Id = co.semester_Id where professor_Course_Id = "' . $_POST['Schedule']['professor_Course_Id'] . '" ;
			
        ';
            $row1Class = Yii::app()->db->createCommand($sql)->queryRow();
            $sql2 = '
       select day from class_type where class_Type_Id =  "' . $_POST['Schedule']['class_Type_Id'] . '" ;
        ';
            $row2Class = Yii::app()->db->createCommand($sql2)->queryRow();
            $endDate = $row1Class['end_Date'];
            $dayNameEndDate = $row2Class['day'];
            $date = date('Y-m-d');
            while ($date != $endDate) {
                $dayName = date('l', strtotime($date));
                if ($dayName == $dayNameEndDate) {
                    $model = new Schedule();
                    $model->date = $date;
                    $model->attributes = $_POST['Schedule'];
                    // other fileds if they are not getting assigned
                    if (!$model->save()) {
                        echo '<pre>';
                        print_r($model->getErrors());
                        echo '</pre>';
                        exit;
                    }
                }
                $date = strtotime("+1 day", strtotime($date));
                $date = date("Y-m-d", $date);
            }
            $this->redirect(array('index'));
        }
        $this->render('_Form2', array('model' => $model, 'model2' => $model2));
    }
开发者ID:Androidstudent,项目名称:PHP-YII_Project,代码行数:42,代码来源:ScheduleController.php

示例5: add

 /**
  * Add new Schedule
  *
  * @return bool
  */
 public function add($name, $desc, $start_date, $end_date, $updatedby)
 {
     $validator = Validator::make(array('name' => $name, 'desc' => $desc, 'start_date' => $start_date, 'end_date' => $end_date, 'updatedby' => $updatedby), array('name' => array('required', 'min:3'), 'desc' => array(), 'start_date' => array('required'), 'end_date' => array('required'), 'updatedby' => array('alpha_num', 'required')));
     // Validation did not pass
     if ($validator->fails()) {
         throw new Exception($validator->messages());
     }
     try {
         $schedule = new Schedule();
         $schedule->name = $name;
         $schedule->desc = $desc;
         $schedule->start_date = $start_date;
         $schedule->end_date = $end_date;
         $schedule->updatedby = $updatedby;
         $schedule->save();
         return true;
     } catch (Exception $ex) {
         return $ex;
     }
 }
开发者ID:arizawan,项目名称:livetvwithyoutube,代码行数:25,代码来源:Schedule.php

示例6: createSchedule

 public function createSchedule()
 {
     $rules = array('name' => 'required', 'rule' => 'required', 'period' => 'required');
     $period = Input::get('period');
     try {
         Carbon::now()->modify('+ ' . $period);
     } catch (Exception $e) {
         return Redirect::to('/schedules/new')->with('message', array('type' => 'danger', 'text' => 'Period has invalid format'))->withInput();
     }
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/schedules/new')->withErrors($validator)->withInput();
     }
     $schedule = new Schedule();
     $schedule->user_id = Auth::user()->id;
     $schedule->rule = Input::get('rule');
     $schedule->period = $period;
     $schedule->name = Input::get('name');
     $schedule->save();
     return Redirect::to('/schedules/new')->with('message', array('type' => 'success', 'text' => 'Schedule was created!'));
 }
开发者ID:anchetaWern,项目名称:ahead,代码行数:21,代码来源:SettingsController.php

示例7: actionSaveInfo

 public function actionSaveInfo()
 {
     //echo 1;
     $number = $_POST['num'];
     $title = $_POST['title'];
     $content = $_POST['content'];
     $route_id = $_POST['route_id'];
     if ($number != '' || $title != '' || $content != '') {
         $v_num = explode('$$$$$$', $number);
         $v_title = explode('$$$$$$', $title);
         $v_content = explode('$$$$$$', $content);
         //echo 1;
         //echo $number;
         $a = '';
         for ($i = 0; $i < count($v_num); $i++) {
             $schedule = new Schedule();
             $schedule->title = $v_title[$i];
             $schedule->content = $v_content[$i];
             $schedule->day = $v_num[$i];
             $schedule->save();
             $a .= $schedule->id;
             if ($i != count($v_num) - 1) {
                 $a .= ',';
             }
         }
         Route::model()->updateByPk($route_id, array('schedule' => $a, 'days' => count($v_num)));
     } else {
         Route::model()->updateByPk($route_id, array('schedule' => NULL, 'days' => 0));
     }
     $this->redirect(Yii::app()->request->urlReferrer);
     echo 1;
 }
开发者ID:rocketyang,项目名称:yii2,代码行数:32,代码来源:ScheduleController.php

示例8: afterSave

 protected function afterSave()
 {
     parent::afterSave();
     if ($this->isNewRecord && $this->is_test == 0) {
         //Формирование расписания пользователя
         if ($this->isNewRecord && $this->group == "on") {
             $group = new Group();
             $group->code = $this->listner->branch->group_counter + 1;
             $group->name = $group->name = $group->code . ' | ' . date('Y-m-d', strtotime("+2 week"));
             $group->time = $this->time;
             $group->lvl = $this->lvl;
             $group->note = $this->note;
             $group->teacher_id = $this->teacher_id;
             $group->number = $this->form->number;
             $group->hui = $this->hui;
             $group->branch_id = $this->listner->branch_id;
             $group->subject_id = $this->subject_id;
             $group->parent_id = $this->id;
             if ($this->parent_group) {
                 $group->parent_group = $this->parent_group;
                 if ($group->prev->first_parent_group) {
                     $group->first_parent_group = $group->prev->first_parent_group;
                 } else {
                     $group->first_parent_group = $group->prev->id;
                 }
             }
             $group->is_active = 1;
             $group->save();
             if ($this->form->type->id == 4) {
                 $this->listner->branch->individual_counter += 1;
             } else {
                 $this->listner->branch->group_counter += 1;
             }
             $this->listner->branch->save();
         }
         if ($this->form->type->id == 3) {
             $time = explode(',', $this->time);
             $tCount = count($time);
             $j = 0;
             $k = 0;
             for ($i = 0; $i < $this->form->number; $i++) {
                 if ($j == $tCount) {
                     $j = 0;
                     $k++;
                 }
                 $schedule = new Schedule();
                 //if($this->form->type->id == 3 || $this->form->type->id == 4)
                 //$schedule->position_id = $this->id;
                 //                    else{
                 //                        $schedule->position_id = $this->id;
                 $schedule->position_id = $this->id;
                 $schedule->number = $i + 1;
                 $schedule->teacher_id = $this->teacher_id;
                 $schedule->start_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week", strtotime($time[$j]))));
                 if ($this->hui == "on") {
                     $pizda = 30;
                 } else {
                     $pizda = 0;
                 }
                 $schedule->end_time = str_replace(" ", "T", date('Y-m-d H:i:s', strtotime("+" . $k . "week 1 hours " . $pizda . " minutes", strtotime($time[$j]))));
                 $schedule->room_id = $this->findRoom($schedule->start_time, $this->listner->branch_id, 1);
                 $schedule->save();
                 $j++;
             }
             if ($this->form->type->id == 3) {
                 $this->listner->branch->individual_counter += 1;
                 $this->listner->branch->save();
             }
         }
         //Формирование прихода
         $inflow = new Inflow();
         $inflow->subject_id = $this->subject_id;
         $inflow->receiver = $this->teacher->user->fullName;
         $inflow->form_id = $this->form_id;
         if ($this->is_old == "on") {
             $inflow->price = $this->form->old_price;
         } else {
             $inflow->price = $this->form->price;
         }
         $inflow->based = $this->code;
         $inflow->comment = $this->note;
         $inflow->date = $this->start_date;
         $inflow->branch_id = $this->listner->branch_id;
         $inflow->save();
         //Изменение статуса
         if ($this->listner->status != 1) {
             $this->listner->status = 1;
             $this->listner->save();
         }
     }
 }
开发者ID:shipovalovyuriy,项目名称:spasibeaucoup,代码行数:91,代码来源:Position.php

示例9: logRevision

 /**
  * Updates entry revision
  *
  * @param Schedule $schedule	 
  * @param ScheduleEntry $entry
  * @param string $action
  * @param string $old
  * @param string $new
  * @return void
  */
 public static function logRevision($schedule, $entry, $action, $old, $new)
 {
     // workaround for older events where revision history is not present
     if ($schedule->entry_revisions == "") {
         $schedule->entry_revisions = json_encode(["0" => ["entry id" => "", "job type" => "", "action" => "Keine frühere Änderungen vorhanden.", "old id" => "", "old value" => "", "new id" => "", "new value" => "", "user id" => "", "user name" => "", "from ip" => "", "timestamp" => (new DateTime())->format('d.m.Y H:i:s')]]);
     }
     // decode revision history
     $revisions = json_decode($schedule->entry_revisions, true);
     // decode old values
     if (!is_null($old)) {
         $oldId = $old->id;
         switch ($old->prsn_status) {
             case "candidate":
                 $oldStatus = "(K)";
                 break;
             case "member":
                 $oldStatus = "(A)";
                 break;
             case "veteran":
                 $oldStatus = "(V)";
                 break;
             default:
                 $oldStatus = "";
         }
         $oldName = $old->prsn_name . $oldStatus . "(" . $old->getClub->clb_title . ")";
     } else {
         $oldId = "";
         $oldName = "";
     }
     // decode new values
     if (!is_null($new)) {
         $newId = $new->id;
         switch ($new->prsn_status) {
             case "candidate":
                 $newStatus = "(K)";
                 break;
             case "member":
                 $newStatus = "(A)";
                 break;
             case "veteran":
                 $newStatus = "(V)";
                 break;
             default:
                 $newStatus = "";
         }
         $newName = $new->prsn_name . $newStatus . "(" . $new->getClub->clb_title . ")";
     } else {
         $newId = "";
         $newName = "";
     }
     // append current change
     array_push($revisions, ["entry id" => $entry->id, "job type" => $entry->getJobType->jbtyp_title, "action" => $action, "old id" => $oldId, "old value" => $oldName, "new id" => $newId, "new value" => $newName, "user id" => Session::get('userId') != NULL ? Session::get('userId') : "", "user name" => Session::get('userId') != NULL ? Session::get('userName') . '(' . Session::get('userClub') . ')' : "Gast", "from ip" => Request::getClientIp(), "timestamp" => (new DateTime())->format('d.m.Y H:i:s')]);
     // encode and save
     $schedule->entry_revisions = json_encode($revisions);
     $schedule->save();
 }
开发者ID:gitter-badger,项目名称:lara-vedst,代码行数:66,代码来源:ScheduleController.php

示例10: executeSaveCopy

 public function executeSaveCopy()
 {
     $accal_tujuan = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal1'));
     $accal_asal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal2'));
     $params = array();
     foreach (explode('&', $this->getRequestParameter('ekskul_list_ser')) as $p) {
         $p = explode('=', $p);
         $params[rawurldecode($p[0])][] = rawurldecode($p[1]);
     }
     if (array_key_exists('ekskuls', $params)) {
         foreach ($params['ekskuls'] as $ekskul_id) {
             $sc = SchedulePeer::retrieveByPK($ekskul_id);
             $cw = new Criteria();
             $cw->add(ScheduleDetailPeer::SCHEDULE_ID, $sc->getId());
             $sc_details = ScheduleDetailPeer::doSelect($cw);
             $cd = new Criteria();
             $cd->add(ScheduleTutorPeer::SCHEDULE_ID, $sc->getId());
             $sc_tutors = ScheduleTutorPeer::doSelect($cd);
             $schedule = new Schedule();
             $schedule->setGradeComponentId($sc->getGradeComponentId());
             $schedule->setAcademicCalendarId($accal_tujuan->getId());
             $schedule->setType(2);
             $schedule->setEmployeeId($sc->getEmployeeId());
             $schedule->save();
             foreach ($sc_details as $sc_detail) {
                 $schedule_detail = new ScheduleDetail();
                 $schedule_detail->setSchedule($schedule);
                 $schedule_detail->setLocationId($sc_detail->getLocationId());
                 $schedule_detail->setClassSessionId($sc_detail->getClassSessionId());
                 $schedule_detail->setDay($sc_detail->getDay());
                 $schedule_detail->save();
                 $cb = new Criteria();
                 $cb->add(StudentRaportPeer::GRADE_COMPONENT_ID, $sc->getGradeComponentId());
                 $cb->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $sc->getAcademicCalendarId());
                 $cb->add(StudentRaportPeer::SCHEDULE_DETAIL_ID, $sc_detail->getId());
                 $cb->add(StudentRaportPeer::SCHEDULE_ID, $sc->getId());
                 $stu_raports = StudentRaportPeer::doSelect($cb);
                 foreach ($stu_raports as $stu_raport) {
                     $sr = new StudentRaport();
                     $sr->setStudentId($stu_raport->getStudentId());
                     $sr->setAcademicCalendarId($accal_tujuan->getId());
                     $sr->setGradeComponentId($sc->getGradeComponentId());
                     $sr->setClassGroupId($sc->getClassGroupId());
                     $sr->setSchedule($schedule);
                     $sr->setScheduleDetail($schedule_detail);
                     $sr->save();
                 }
             }
             foreach ($sc_tutors as $sc_tutor) {
                 $schedule_tutor = new ScheduleTutor();
                 $schedule_tutor->setSchedule($schedule);
                 $schedule_tutor->setEmployeeId($sc_tutor->getEmployeeId());
                 $schedule_tutor->save();
             }
         }
     }
     return $this->redirect('extracurricular/list');
 }
开发者ID:taryono,项目名称:school,代码行数:58,代码来源:actions.class.php

示例11: Schedule

 function schedules_save($id = '', $page = '')
 {
     $data['page_name'] = '<b>Save Schedule</b>';
     $data['msg'] = '';
     $this->load->helper('options');
     $s = new Schedule();
     $data['sched'] = $s->get_by_id($id);
     if (Input::get('op')) {
         $all_time = array('am_in_hour' => Input::get('am_in_hour'), 'am_in_min' => Input::get('am_in_min'), 'am_out_hour' => Input::get('am_out_hour'), 'am_out_min' => Input::get('am_out_min'), 'pm_in_hour' => Input::get('pm_in_hour'), 'pm_in_min' => Input::get('pm_in_min'), 'pm_out_hour' => Input::get('pm_out_hour'), 'pm_out_min' => Input::get('pm_out_min'));
         $s->name = Input::get('name');
         $s->times = serialize($all_time);
         $s->save();
         Session::flash('msg', 'Schedule saved!');
         return Redirect::to('attendance/schedules/' . $page, 'refresh');
     }
     $times = $s->times;
     $times = unserialize($times);
     $data['am_in_hour_selected'] = $times['am_in_hour'];
     $data['am_in_min_selected'] = $times['am_in_min'];
     $data['am_out_hour_selected'] = $times['am_out_hour'];
     $data['am_out_min_selected'] = $times['am_out_min'];
     $data['pm_in_hour_selected'] = $times['pm_in_hour'];
     $data['pm_in_min_selected'] = $times['pm_in_min'];
     $data['pm_out_hour_selected'] = $times['pm_out_hour'];
     $data['pm_out_min_selected'] = $times['pm_out_min'];
     $data['main_content'] = 'schedules_save';
     return View::make('includes/template', $data);
 }
开发者ID:billyriantono,项目名称:ihrmis,代码行数:28,代码来源:attendance.php

示例12: array

require "Schedule.inc.php";
require "connectToDataBase.inc.php";
if (isset($_REQUEST['save'])) {
    // handle ajax save request (do not show the interface)
    // we posted . characters, but something converts them to _ (HTTP 1.1 standard)
    $r = array();
    foreach ($_REQUEST as $i => $v) {
        $r[join('.', explode('_', $i))] = $v;
        //convert _ back to .
    }
    $Process = array();
    for ($i0 = 0; isset($r['0.' . $i0]); $i0++) {
        $Process[$i0] = array('id' => @$r['0.' . $i0 . '.0'], 'nr' => @$r['0.' . $i0 . '.0'], 'session' => @$r['0.' . $i0 . '.1'], 'case' => @$r['0.' . $i0 . '.2'], 'scheduled' => @$r['0.' . $i0 . '.3']);
    }
    $Schedule = new Schedule($Process);
    if ($Schedule->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF']);
    } else {
        die('');
    }
    exit;
    // do not show the interface
}
$buttons = "";
if (isset($_REQUEST['edit'])) {
    $edit = true;
} else {
    $edit = false;
}
$Schedule = new Schedule();
writeHead("<TITLE>Schedule - VIRO - ADL Prototype</TITLE>" . ($edit ? '<SCRIPT type="text/javascript" src="edit.js"></SCRIPT>' : '<SCRIPT type="text/javascript" src="navigate.js"></SCRIPT>') . "\n");
开发者ID:sapray,项目名称:ampersand-models,代码行数:31,代码来源:Schedule.php

示例13: afterSave

 protected function afterSave()
 {
     if (Yii::app() instanceof CConsoleApplication) {
         return;
     }
     $isAdmin = Yii::app()->user->checkRole(User::ROLE_DELEGATE);
     //处理代表和主办
     foreach (array('organizer', 'delegate') as $attribute) {
         $attributeId = $attribute . '_id';
         $oldValues = array_values(CHtml::listData($this->{$attribute}, $attributeId, $attributeId));
         $newValues = array_values((array) $this->{$attribute . 's'});
         sort($oldValues);
         sort($newValues);
         if ($oldValues != $newValues) {
             $modelName = 'Competition' . ucfirst($attribute);
             foreach ($oldValues as $value) {
                 if (!in_array($value, $newValues) && $isAdmin) {
                     $modelName::model()->deleteAllByAttributes(array('competition_id' => $this->id, $attributeId => $value));
                 }
             }
             foreach ($newValues as $value) {
                 if (!in_array($value, $oldValues)) {
                     $model = new $modelName();
                     $model->competition_id = $this->id;
                     $model->{$attribute . '_id'} = $value;
                     $model->save();
                 }
             }
         }
     }
     //处理赛程
     $schedules = $this->schedules;
     if (!empty($schedules['start_time'])) {
         Schedule::model()->deleteAllByAttributes(array('competition_id' => $this->id));
         foreach ($schedules['start_time'] as $key => $startTime) {
             if (empty($startTime) || !isset($schedules['end_time'][$key]) || empty($schedules['end_time'][$key])) {
                 continue;
             }
             $model = new Schedule();
             $model->competition_id = $this->id;
             $model->start_time = strtotime($startTime);
             $model->end_time = strtotime($schedules['end_time'][$key]);
             $model->day = $schedules['day'][$key];
             $model->stage = $schedules['stage'][$key];
             $model->event = $schedules['event'][$key];
             $model->group = $schedules['group'][$key];
             $model->round = $schedules['round'][$key];
             $model->format = $schedules['format'][$key];
             $model->number = intval($schedules['number'][$key]);
             $model->cut_off = intval($schedules['cut_off'][$key]);
             $model->time_limit = intval($schedules['time_limit'][$key]);
             $model->save(false);
         }
     }
     //处理地址
     $oldLocations = $this->location;
     foreach ($this->locations as $key => $value) {
         if (isset($oldLocations[$key])) {
             $location = $oldLocations[$key];
         } else {
             $location = new CompetitionLocation();
             $location->competition_id = $this->id;
             $location->location_id = $key;
         }
         $location->attributes = $value;
         $location->save(false);
     }
     if ($this->isOld()) {
         $this->old->save(false);
     }
 }
开发者ID:sunshy360,项目名称:cubingchina,代码行数:71,代码来源:Competition.php

示例14: intval

            $schedule->prefinput = $_POST['prefinput'];
            $schedule->inetref = $_POST['inetref'];
            $schedule->season = intval($_POST['season']);
            $schedule->episode = intval($_POST['episode']);
            // Keep track of the parent recording for overrides
            if ($_POST['record'] == rectype_override) {
                $schedule->parentid = $schedule->recordid;
            }
            // Search schedules saved here will create a new standard schedule,
            // so we should wipe out the old search-type data.
            if ($schedule->search) {
                $schedule->recordid = null;
            }
            $schedule->search = 0;
            // Back up the program type, and save the schedule
            $schedule->save($type);
        }
    }
    // Redirect back to the page again, but without the query string, so reloads are cleaner
    if ($db->query_col('SELECT COUNT(*) FROM program WHERE chanid = ? and starttime = FROM_UNIXTIME(?) LIMIT 1', $program->chanid, $program->starttime) == 0) {
        redirect_browser(root . 'tv/detail?recordid=' . $schedule->recordid);
    }
    redirect_browser(root_url . 'tv/detail/' . $program->chanid . '/' . $program->starttime);
} elseif ($_REQUEST['forget_old']) {
    $program->rec_forget_old();
    // Redirect back to the page again, but without the query string, so reloads are cleaner
    redirect_browser(root_url . 'tv/detail/' . $program->chanid . '/' . $program->starttime);
} elseif (isset($_GET['never_record']) || isset($_POST['never_record'])) {
    $program->rec_never_record();
    // Redirect back to the page again, but without the query string, so reloads are cleaner
    redirect_browser(root_url . 'tv/detail/' . $program->chanid . '/' . $program->starttime);
开发者ID:halovanic,项目名称:mythweb,代码行数:31,代码来源:detail.php

示例15: postShift

 public function postShift()
 {
     $path = public_path();
     $allowedExts = array("xls", "xlsx", "csv");
     $temp = explode(".", $_FILES["file"]["name"]);
     $extension = end($temp);
     //$filename= $temp[0];
     $filename = $temp[0] . '_' . date('YmdHis') . '_' . rand(111, 999);
     $destinationPath = $path . '/uploads/' . $filename . '.' . $extension;
     if (in_array($extension, $allowedExts) && $_FILES["file"]["size"] < 20000000) {
         if ($_FILES["file"]["error"] > 0) {
             //echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
         } else {
             //if (file_exists($path."/uploads/" . $_FILES["file"]["name"]))
             if (file_exists($path . "/uploads/" . $filename)) {
                 //echo $_FILES["file"]["name"] . " already exists. ";
             } else {
                 $uploadSuccess = move_uploaded_file($_FILES["file"]["tmp_name"], $destinationPath);
                 Excel::load($destinationPath, function ($reader) {
                     //$results = Excel::load('public/products2.xls')->get();
                     $result = $reader->all();
                     $reader->toArray();
                     //$reader->dump();
                     // Loop through all the sheets
                     $reader->each(function ($sheet) {
                         // Loop through all rows
                         $sheet->each(function ($row) {
                             //$date = $row->schedule_date;
                             //$scheduleDate = date('Y-m-d', strtotime($schedule_date));
                             $schedule = new Schedule();
                             $schedule->employee_id = $row->employee_id;
                             $schedule->year = $row->year;
                             $schedule->month = $row->month;
                             $schedule->day = $row->day;
                             $schedule->day = $row->shift;
                             $schedule->day = $row->rest_day;
                             //$schedule->day = $row->hours_per_day;
                             $schedule->start_time = $row->start_time;
                             $schedule->end_time = $row->end_time;
                             $schedule->schedule_date = date('Y-m-d', strtotime($row->schedule_date));
                             $schedule->save();
                             //Redirect::action('EmployeesController@index');
                         });
                     });
                 });
                 /*if( $uploadSuccess )
                   {
                      $document_details=Response::json(Author::insert_document_details_Call($filename,$destinationPath));
                      return $document_details; // or do a redirect with some message that file was uploaded
                   }
                   else
                   {
                      return Response::json('error', 400);
                   }*/
                 Session::flash('error', 'Uploading of employee is successful');
                 //return Redirect::action('EmployeesController@indexshift');
                 return Redirect::route('adminScheduling');
             }
         }
     } else {
         return "Invalid file";
     }
 }
开发者ID:jarciga,项目名称:Euler2015Alpha,代码行数:63,代码来源:EmployeesController20150706.php


注:本文中的Schedule::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。