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 / controllers / admin / shift_templates.php

shift_templates.php in ShiftController Employee Shift Scheduling 2.1.0, at application/controllers/admin/shift_templates.php

49 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2
3 class Shift_templates_controller extends Backend_controller_crud
4 {
5 function __construct()
6 {
7 $this->conf = array(
8 'model' => 'Shift_template_model',
9 'path' => 'admin/shift_templates',
10 'entity' => 'shift_template',
11 );
12 parent::__construct( User_model::LEVEL_ADMIN );
13 }
14
15 function save()
16 {
17 $args = func_get_args();
18 $id = count($args) ? $args[0] : 0;
19 $post = call_user_func_array( array($this, 'save_prepare'), $args );
20 $relations = $this->save_prepare_relations();
21 $this->{$this->model}->weekday = 'mmm';
22
23 if( $this->{$this->model}->save($relations) )
24 {
25 // redirect to list
26 $msg = $id ? lang('common_update') : lang('common_add');
27 $this->session->set_flashdata( 'message', $msg . ': ' . lang('common_ok') );
28
29 $redirect_to = method_exists($this, 'after_save') ? $this->after_save() : array($this->conf['path']);
30 $this->redirect( $redirect_to );
31 return;
32 }
33 else
34 {
35 $this->hc_form->set_errors( $this->{$this->model}->error->all );
36 $this->hc_form->set_defaults( $post );
37 if( $this->{$this->model}->id )
38 $this->edit( $this->{$this->model}->id );
39 else
40 {
41 array_shift( $args );
42 call_user_func_array( array($this, 'add'), $args );
43 }
44 }
45 }
46 }
47
48 /* End of file customers.php */
49 /* Location: ./application/controllers/admin/categories.php */