-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from bbalet/dev
Dev
- Loading branch information
Showing
154 changed files
with
1,746 additions
and
577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]> | ||
|
@@ -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 | ||
|
@@ -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) | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
@@ -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'); | ||
|
@@ -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'); | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]> | ||
|
@@ -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]> | ||
|
@@ -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 | ||
|
@@ -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'); | ||
|
@@ -93,7 +93,7 @@ public function edit($id) { | |
redirect('contracts'); | ||
} | ||
} | ||
|
||
/** | ||
* Display the form / action Create a new contract | ||
* @author Benjamin BALET <[email protected]> | ||
|
@@ -128,7 +128,7 @@ public function create() { | |
redirect('contracts'); | ||
} | ||
} | ||
|
||
/** | ||
* Delete a given contract | ||
* @param int $id contract identifier | ||
|
@@ -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 | ||
|
@@ -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) | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -297,7 +297,7 @@ public function editdayoff() { | |
} | ||
} | ||
} | ||
|
||
/** | ||
* Ajax endpoint : Edit a series of day offs for a given contract | ||
* @author Benjamin BALET <[email protected]> | ||
|
@@ -321,7 +321,7 @@ public function series() { | |
} else { | ||
$day = strtotime($freq, $start); | ||
} | ||
|
||
$list = ''; | ||
while ($day <= $end) { | ||
$list .= date("Y-m-d", $day) . ","; | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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]> | ||
|
Oops, something went wrong.