Skip to content

Commit

Permalink
Merge pull request #203 from bbalet/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
bbalet authored Jul 17, 2017
2 parents fac3d84 + 269958d commit af57cbd
Show file tree
Hide file tree
Showing 154 changed files with 1,746 additions and 577 deletions.
4 changes: 4 additions & 0 deletions application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
$route['contracts/calendar/userdayoffs/(:num)'] = 'contracts/userDayoffs/$1';
$route['contracts/calendar/userdayoffs'] = 'contracts/userDayoffs';
$route['contracts/calendar/alldayoffs'] = 'contracts/allDayoffs';
$route['contracts/calendar/alldayoffs/lists'] = 'contracts/allDayoffsForList';
$route['contracts'] = 'contracts';

//_______________________________________________
Expand All @@ -150,6 +151,7 @@
$route['organization/lists/addemployees'] = 'organization/listsAddEmployees';
$route['organization/lists/removeemployees'] = 'organization/listsRemoveEmployees';
$route['organization/lists/reorder'] = 'organization/listsReorder';
$route['organization/lists/name'] = 'organization/listName';
$route['organization'] = 'organization';

//_______________________________________________
Expand Down Expand Up @@ -178,6 +180,7 @@
$route['leaves/workmates'] = 'leaves/workmates';
$route['leaves/department'] = 'leaves/department';
$route['leaves/organization/(:num)'] = 'leaves/organization/$1';
$route['leaves/list/(:num)'] = 'leaves/listEvents/$1';
$route['leaves/collaborators'] = 'leaves/collaborators';
$route['leaves/team'] = 'leaves/team';

Expand All @@ -193,6 +196,7 @@
$route['leaves/export'] = 'leaves/export';
$route['leaves/create'] = 'leaves/create';
$route['leaves/edit/(:num)'] = 'leaves/edit/$1';
$route['leaves/request/(:num)'] = 'leaves/requestLeave/$1';
$route['leaves/update'] = 'leaves/update';
$route['leaves/delete/(:num)'] = 'leaves/delete/$1';
$route['leaves/(:num)/history'] = 'leaves/history/$1';
Expand Down
32 changes: 17 additions & 15 deletions application/controllers/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*/

if (!defined('BASEPATH')) { exit('No direct script access allowed'); }

/**
* This class displays the calendars of the leave requests.
* In opposition to the other pages of the application, some calendars can be public (no need to be logged in).
*/
class Calendar extends CI_Controller {

/**
* Default constructor
* @author Benjamin BALET <[email protected]>
Expand Down Expand Up @@ -77,8 +77,8 @@ public function year($employee = 0, $year = 0) {
$this->load->view('menu/index', $data);
$this->load->view('calendar/year', $data);
$this->load->view('templates/footer');
}
}

/**
* Display the page of the individual calendar (of the connected user)
* Data (calendar events) is retrieved by AJAX from leaves' controller
Expand All @@ -99,7 +99,7 @@ public function individual() {
$this->load->view('calendar/individual', $data);
$this->load->view('templates/footer');
}

/**
* Display the page of the team calendar (users having the same manager
* than the connected user)
Expand Down Expand Up @@ -136,7 +136,7 @@ public function collaborators() {
$this->load->view('calendar/collaborators', $data);
$this->load->view('templates/footer');
}

/**
* Display the calendar of the employees working in the same department
* than the connected user.
Expand All @@ -163,7 +163,7 @@ public function department() {
$this->load->view('templates/footer');
}
}

/**
* Display a global calendar filtered by organization/entity
* Data (calendar events) is retrieved by AJAX from leaves' controller
Expand All @@ -179,6 +179,7 @@ public function organization() {
$data['language_code'] = $this->polyglot->language2code($data['language']);
$data['title'] = lang('calendar_organization_title');
$data['help'] = '';
$data['mode'] = 'public';
$data['logged_in'] = FALSE;
$data['month'] = $month;
$data['year'] = date('Y');
Expand All @@ -194,6 +195,7 @@ public function organization() {
$this->lang->load('calendar', $this->language);
$this->auth->checkIfOperationIsAllowed('organization_calendar');
$data = getUserContext($this);
$data['mode'] = 'connected';
$data['logged_in'] = TRUE;
$data['month'] = $month;
$data['year'] = date('Y');
Expand All @@ -208,7 +210,7 @@ public function organization() {
$this->load->view('templates/footer');
}
}

/**
* Ajax endpoint : Send a list of fullcalendar events
* This code is duplicated from controller/leaves for public access
Expand All @@ -227,7 +229,7 @@ public function publicOrganization($entity_id) {
$this->output->set_header("HTTP/1.1 403 Forbidden");
}
}

/**
* Ajax endpoint : Send a list of fullcalendar events: List of all possible day offs
* This code is duplicated from controller/contract for public access
Expand All @@ -246,7 +248,7 @@ public function publicDayoffs() {
$this->output->set_header("HTTP/1.1 403 Forbidden");
}
}

/**
* Display a global tabular calendar
* @param int $id identifier of the entity
Expand Down Expand Up @@ -308,7 +310,7 @@ public function tabular($id=-1, $month=0, $year=0, $children=TRUE, $displayTypes
$this->load->view('templates/footer');
}
}

/**
* Display a partial tabular widget. Used to reload only a part of the page.
* @param int $id identifier of the entity
Expand Down Expand Up @@ -353,7 +355,7 @@ public function tabularPartial($id=-1, $month=0, $year=0, $children=TRUE, $displ
$this->load->view('calendar/tabular_partial', $data);
}
}

/**
* Display a partial tabular widget. Used to reload only a part of the page.
* The difference with tabularPartial function is that this view is not available
Expand Down Expand Up @@ -382,7 +384,7 @@ public function tabularPartialFromList($id, $month=0, $year=0, $displayTypes=TRU
$data['displayTypes'] = $displayTypes;
$this->load->view('calendar/tabular_partial', $data);
}

/**
* Export the tabular calendar into Excel. The presentation differs a bit according to the limitation of Excel
* We'll get one line for the morning and one line for the afternoon
Expand Down Expand Up @@ -413,7 +415,7 @@ public function exportTabularFromList($id=-1, $month=0, $year=0, $displayTypes=T
$data['tabular'] = $this->leaves_model->tabularList($id, $month, $year);
$this->load->view('calendar/export_tabular', $data);
}

/**
* Export the tabular calendar into Excel. The presentation differs a bit according to the limitation of Excel
* We'll get one line for the morning and one line for the afternoon
Expand Down Expand Up @@ -453,7 +455,7 @@ public function exportTabular($id=-1, $month=0, $year=0, $children=TRUE, $displa
$data['tabular'] = $this->leaves_model->tabular($id, $month, $year, $children);
$this->load->view('calendar/export_tabular', $data);
}

/**
* Export the yearly calendar into Excel. The presentation differs a bit according to the limitation of Excel
* We'll get one line for the morning and one line for the afternoon
Expand Down
47 changes: 31 additions & 16 deletions application/controllers/Contracts.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* - The default period for leave credit (taken, available, entitled).
*/
class Contracts extends CI_Controller {

/**
* Default constructor
* @author Benjamin BALET <[email protected]>
Expand All @@ -28,7 +28,7 @@ public function __construct() {
$this->lang->load('contract', $this->language);
$this->load->model('contracts_model');
}

/**
* Display the list of all contracts defined in the system
* @author Benjamin BALET <[email protected]>
Expand All @@ -46,7 +46,7 @@ public function index() {
$this->load->view('contracts/index', $data);
$this->load->view('templates/footer');
}

/**
* Display a form that allows to update a contract
* @param int $id Contract identifier
Expand All @@ -59,7 +59,7 @@ public function edit($id) {
$this->load->library('form_validation');
$this->lang->load('calendar', $this->language);
$data['title'] = lang('contract_edit_title');

$this->form_validation->set_rules('name', lang('contract_edit_field_name'), 'required|strip_tags');
$this->form_validation->set_rules('startentdatemonth', lang('contract_edit_field_start_month'), 'required|strip_tags');
$this->form_validation->set_rules('startentdateday', lang('contract_edit_field_start_day'), 'required|strip_tags');
Expand Down Expand Up @@ -93,7 +93,7 @@ public function edit($id) {
redirect('contracts');
}
}

/**
* Display the form / action Create a new contract
* @author Benjamin BALET <[email protected]>
Expand Down Expand Up @@ -128,7 +128,7 @@ public function create() {
redirect('contracts');
}
}

/**
* Delete a given contract
* @param int $id contract identifier
Expand All @@ -146,7 +146,7 @@ public function delete($id) {
$this->session->set_flashdata('msg', lang('contract_delete_msg_success'));
redirect('contracts');
}

/**
* Display an interactive calendar that allows to dynamically set the days
* off, bank holidays, etc. for a given contract
Expand All @@ -165,7 +165,7 @@ public function calendar($id, $year = 0) {
} else {
$data['year'] = date("Y");
}

//Load the list of contracts (select destination contract / copy dayoff feature)
$data['contracts'] = $this->contracts_model->getContracts();
//Remove the contract being displayed (source)
Expand All @@ -190,7 +190,7 @@ public function calendar($id, $year = 0) {
$this->load->view('contracts/calendar', $data);
$this->load->view('templates/footer');
}

/**
* Copy the days off defined on a souce contract to another contract
* for the civil year being displayed
Expand All @@ -207,7 +207,7 @@ public function copydayoff($source, $destination, $year) {
$this->session->set_flashdata('msg', lang('contract_calendar_copy_msg_success'));
redirect('contracts/' . $destination . '/calendar/' . $year);
}

/**
* Display a form that allows to exclude some leave types from a contract
* @param int $id Contract identifier
Expand Down Expand Up @@ -240,7 +240,7 @@ public function excludeTypes($id) {
$this->load->view('contracts/exclude_types', $data);
$this->load->view('templates/footer');
}

/**
* Ajax endpoint : include a leave type into a contract
* @param int $contractId identifier of the contract
Expand Down Expand Up @@ -297,7 +297,7 @@ public function editdayoff() {
}
}
}

/**
* Ajax endpoint : Edit a series of day offs for a given contract
* @author Benjamin BALET <[email protected]>
Expand All @@ -321,7 +321,7 @@ public function series() {
} else {
$day = strtotime($freq, $start);
}

$list = '';
while ($day <= $end) {
$list .= date("Y-m-d", $day) . ",";
Expand Down Expand Up @@ -373,7 +373,7 @@ public function import() {
echo("$url is not a valid URL");
}
}

/**
* Ajax endpoint : Send a list of fullcalendar events
* List of day offs for the connected user
Expand All @@ -388,7 +388,7 @@ public function userDayoffs($id = 0) {
if ($id == 0) $id =$this->user_id;
echo $this->dayoffs_model->userDayoffs($id, $start, $end);
}

/**
* Ajax endpoint : Send a list of fullcalendar events
* List of all possible day offs
Expand All @@ -404,7 +404,22 @@ public function allDayoffs() {
$this->load->model('dayoffs_model');
echo $this->dayoffs_model->allDayoffs($start, $end, $entity, $children);
}


/**
* Ajax endpoint : Send a list of fullcalendar events
* List of all possible day offs
* @param int $entity_id Entity identifier
* @author Emilien NICOLAS <[email protected]>
*/
public function allDayoffsForList() {
header("Content-Type: application/json");
$start = $this->input->get('start', TRUE);
$end = $this->input->get('end', TRUE);
$list = $this->input->get('entity', TRUE);
$this->load->model('dayoffs_model');
echo $this->dayoffs_model->allDayoffsForList($start, $end, $list);
}

/**
* Action: export the list of all contracts into an Excel file
* @author Benjamin BALET <[email protected]>
Expand Down
Loading

0 comments on commit af57cbd

Please sign in to comment.