PluginProbe
ShiftController Employee Shift Scheduling / trunk
ShiftController Employee Shift Scheduling vtrunk
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 / sh4 / reminders / commandlog.php

commandlog.php in ShiftController Employee Shift Scheduling trunk, at sh4/reminders/commandlog.php

54 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 interface SH4_Reminders_CommandLog_
3 {
4 public function create( SH4_Reminders_ModelLog $model );
5 }
6
7 class SH4_Reminders_CommandLog implements SH4_Reminders_CommandLog_
8 {
9 public $t, $crud;
10
11 public function __construct(
12 HC3_Time $t,
13 HC3_Hooks $hooks,
14 HC3_CrudFactory $crudFactory
15 )
16 {
17 $this->t = $t;
18 $crudFactory = $hooks->wrap( $crudFactory );
19 $this->crud = $hooks->wrap( $crudFactory->make('reminderlog') );
20 }
21
22 public function create( SH4_Reminders_ModelLog $model )
23 {
24 $errors = array();
25
26 if( $errors ){
27 throw new HC3_ExceptionArray( $errors );
28 }
29
30 $sentOn = isset( $model->sent_on ) ? $model->sent_on : $this->t->setNow()->formatDateTimeDb();
31 $array = array(
32 'range' => $model->range,
33 'date' => $model->date,
34 'employee_id' => $model->employee_id,
35 'sent_on' => $sentOn,
36 );
37
38 $ret = $this->crud->create( $array );
39
40 $ret = $ret['id'];
41 return $ret;
42 }
43
44 public function delete( SH4_Reminders_ModelLog $model )
45 {
46 $id = $model->id;
47 return $this->crud->delete( $id );
48 }
49
50 public function deleteAll()
51 {
52 return $this->crud->deleteAll();
53 }
54 }