PluginProbe
ShiftController Employee Shift Scheduling / 2.1.0
ShiftController Employee Shift Scheduling v2.1.0
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / application / models / shift_template_model.php

shift_template_model.php in ShiftController Employee Shift Scheduling 2.1.0, at application/models/shift_template_model.php

57 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class Shift_template_model extends MY_model
3 {
4 var $table = 'shift_templates';
5 var $default_order_by = array('start' => 'ASC');
6
7 var $validation = array(
8 'name' => array(
9 'label' => 'lang:shift_template_name',
10 'rules' => array('required', 'trim', 'max_length' => 50, 'unique'),
11 ),
12 'start' => array(
13 'label' => 'lang:shift_start',
14 'rules' => array('required', 'trim'),
15 ),
16 'end' => array(
17 'label' => 'lang:shift_end',
18 'rules' => array('required', 'trim', 'differs' => 'start'),
19 ),
20 );
21
22 var $my_fields = array(
23 array(
24 'name' => 'name',
25 'label' => 'lang:shift_template_name',
26 'size' => 24,
27 'required' => TRUE,
28 ),
29 array(
30 'name' => 'start',
31 'type' => 'time',
32 'label' => 'lang:shift_start',
33 'required' => TRUE,
34 ),
35 array(
36 'name' => 'end',
37 'type' => 'time',
38 'label' => 'lang:shift_end',
39 'required' => TRUE,
40 ),
41 );
42
43 public function get_duration()
44 {
45 if( $this->end > $this->start )
46 $return = $this->end - $this->start;
47 else
48 $return = $this->end + (24*60*60 - $this->start);
49 return $return;
50 }
51
52 public function title()
53 {
54 $return = lang('shift_template');
55 return $return;
56 }
57 }