本文整理汇总了PHP中Schedule::get_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::get_by_id方法的具体用法?PHP Schedule::get_by_id怎么用?PHP Schedule::get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule
的用法示例。
在下文中一共展示了Schedule::get_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Schedule
<tr class="type-one-header">
<th width="5%" bgcolor="#D6D6D6">ID</th>
<th width="24%" bgcolor="#D6D6D6"><strong>Description</strong></th>
<th width="24%" bgcolor="#D6D6D6">Date</th>
<th width="22%" bgcolor="#D6D6D6">Schedule</th>
<th width="15%" bgcolor="#D6D6D6">Employees</th>
<th width="10%" bgcolor="#D6D6D6">Actions</th>
</tr>
<?php
$s = new Schedule();
?>
<?php
foreach ($rows as $row) {
?>
<?php
$s->get_by_id($row->schedule_id);
?>
<?php
$bg = $this->Helps->set_line_colors();
?>
<tr bgcolor="<?php
echo $bg;
?>
" onmouseover="this.bgColor = '<?php
echo $this->config->item('mouseover_linecolor');
?>
';"
onmouseout ="this.bgColor = '<?php
echo $bg;
?>
示例2: unserialize
function employee_schedule_save($id = '', $page = '')
{
$data['page_name'] = '<b>Save Employee Schedule</b>';
$data['msg'] = '';
$data['selected'] = Session::get('office_id');
if ($id != '') {
$sd = new Schedule_detail();
$sd->get_by_id($id);
$data['selected'] = $sd->office_id;
}
// Use for office listbox
$data['options'] = $this->options->office_options(TRUE);
$this->load->helper('options');
$sd = new Schedule_detail();
$data['sched'] = $sd->get_by_id($id);
$dates = unserialize($sd->dates);
if ($dates == '') {
$dates = array('year' => date('Y'), 'period_from' => 1, 'period_to' => date('d'), 'month' => date('m'));
}
$db_employees = unserialize($sd->employees);
if (!Input::get('op')) {
// if the database has value on it add the value from database to session
if (is_array($db_employees)) {
if (!is_array(Session::get('employees'))) {
Session::put('employees', array());
}
$employees = array_merge(Session::get('employees'), $db_employees);
Session::put('employees', $employees);
}
}
if (Input::get('op')) {
$employees = Session::get('employees');
$month_year = Input::get('year') . '-' . Input::get('month');
$between_from = $month_year . '-' . Input::get('period_from');
$between_to = $month_year . '-' . Input::get('period_to');
$dates = array('year' => Input::get('year'), 'period_from' => Input::get('period_from'), 'period_to' => Input::get('period_to'), 'month' => Input::get('month'));
$days = $this->Helps->get_days_in_between($between_from, $between_to);
if (!Input::get('op')) {
if (is_array($db_employees)) {
$employees = array_merge($employees, $db_employees);
}
}
$employees = array_unique($employees);
$sd->name = Input::get('name');
$sd->employees = serialize($employees);
$sd->dates = serialize($dates);
$sd->schedule_id = Input::get('schedule_id');
$sd->office_id = Input::get('office_id');
$sd->save();
Session::flash('msg', 'Schedule saved!');
// Get the schedule
$s = new Schedule();
$s->get_by_id(Input::get('schedule_id'));
$times = unserialize($s->times);
// Check if 2 logs or 4 logs
if ($times['am_in_hour'] != '' && $times['am_out_hour'] != '' && $times['pm_in_hour'] != '' && $times['pm_out_hour'] != '') {
$sched_data['hour_from'] = '';
$sched_data['hour_to'] = '';
$sched_data['am_in'] = $times['am_in_hour'] . ':' . $times['am_in_min'];
$sched_data['am_out'] = $times['am_out_hour'] . ':' . $times['am_out_min'];
$sched_data['pm_in'] = $times['pm_in_hour'] . ':' . $times['pm_in_min'];
$sched_data['pm_out'] = $times['pm_out_hour'] . ':' . $times['pm_out_min'];
$shift_id = 3;
$shift_type = 3;
} else {
//echo '2 times';
// IN
if ($times['am_in_hour'] != '') {
$sched_data['hour_from'] = $times['am_in_hour'] . ':' . $times['am_in_min'];
} else {
if ($times['pm_in_hour'] != '') {
$sched_data['hour_from'] = $times['pm_in_hour'] . ':' . $times['pm_in_min'];
}
}
// OUT
if ($times['am_out_hour'] != '') {
$sched_data['hour_to'] = $times['am_out_hour'] . ':' . $times['am_out_min'];
} else {
if ($times['pm_out_hour'] != '') {
$sched_data['hour_to'] = $times['pm_out_hour'] . ':' . $times['pm_out_min'];
}
}
$sched_data['am_in'] = '';
$sched_data['am_out'] = '';
$sched_data['pm_in'] = '';
$sched_data['pm_out'] = '';
$shift_id = 2;
$shift_type = 2;
// Check if 24 hrs
if ($sched_data['hour_from'] == $sched_data['hour_to']) {
$shift_id = 4;
$shift_type = 4;
}
}
foreach ($days as $day) {
//echo $day."<br>";
$sched_data['date'] = $day;
$oe = new Employee_m();
foreach ($employees as $employee) {
// Change the shift ID
//.........这里部分代码省略.........