added Parking feauture to infocenter

This commit is contained in:
alex
2018-05-16 20:00:19 +02:00
parent 24d4c316e4
commit 6a67183738
8 changed files with 400 additions and 33 deletions
@@ -6,7 +6,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
* Also shows infocenter-related data for a person and its prestudents, enables document and zgv checks,
* displays and saves Notizen for a person, logs infocenter-related actions for a person
*/
class InfoCenter extends VileSci_Controller
class InfoCenter extends FHC_Controller
{
// App and Verarbeitungstaetigkeit name for logging
const APP = 'infocenter';
@@ -21,12 +21,14 @@ class InfoCenter extends VileSci_Controller
'saveformalgep' => array(
'logtype' => 'Action',
'name' => 'Document formally checked',
'message' => 'Document %s formally checked, set to %s'
'message' => 'Document %s formally checked, set to %s',
'success' => null
),
'savezgv' => array(
'logtype' => 'Action',
'name' => 'ZGV saved',
'message' => 'ZGV saved for degree program %s, prestudentid %s'
'message' => 'ZGV saved for degree program %s, prestudentid %s',
'success' => null
),
'abgewiesen' => array(
'logtype' => 'Processstate',
@@ -41,12 +43,14 @@ class InfoCenter extends VileSci_Controller
'savenotiz' => array(
'logtype' => 'Action',
'name' => 'Note added',
'message' => 'Note with title %s was added'
'message' => 'Note with title %s was added',
'success' => null
),
'updatenotiz' => array(
'logtype' => 'Action',
'name' => 'Note updated',
'message' => 'Note with title %s was updated'
'message' => 'Note with title %s was updated',
'success' => null
)
);
private $uid; // contains the UID of the logged user
@@ -473,12 +477,11 @@ class InfoCenter extends VileSci_Controller
)
);
$json = FALSE;
$json = false;
if (isSuccess($result))
{
$json = TRUE;
$json = true;
//set log "Notiz updated"
$this->_log($person_id, 'updatenotiz', array($titel));
@@ -543,6 +546,61 @@ class InfoCenter extends VileSci_Controller
->_display();
}
/**
* Gets the date until which a person is parked
* @param $person_id
*/
public function getParkedDate($person_id)
{
$result = $this->personloglib->getParkedDate($person_id);
$this->output
->set_content_type('application/json')
->set_output(json_encode($result));
}
/**
* Initializes parking of a person, i.e. a person is not expected to do any actions while it is parked
*/
public function park()
{
$person_id = $this->input->post('person_id');
$date = $this->input->post('parkdate');
$this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->uid);
}
/**
* Removes parking of a person
*/
public function unPark()
{
$person_id = $this->input->post('person_id');
$this->personloglib->unPark($person_id);
}
/**
* Gets the End date of the current Studienjahr
*/
public function getStudienjahrEnd()
{
$this->load->model('organisation/studienjahr_model', 'StudienjahrModel');
$result = $this->StudienjahrModel->getCurrStudienjahr();
$json = false;
if (hasData($result))
{
$json = $result->retval[0]->ende;
}
$this->output
->set_content_type('application/json')
->set_output(json_encode($json));
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
@@ -762,7 +820,7 @@ class InfoCenter extends VileSci_Controller
show_error($user_person->retval);
}
$messagelink = base_url('/index.ci.php/system/Messages/write/'.$user_person->retval[0]->person_id);
$messagelink = site_url('/system/Messages/write/'.$user_person->retval[0]->person_id);
$data = array (
'lockedby' => $lockedby,
@@ -898,15 +956,20 @@ class InfoCenter extends VileSci_Controller
{
$logdata = $this->logparams[$logname];
$datatolog = array(
'name' => $logdata['name']
);
if (isset($logdata['message']))
$datatolog['message'] = vsprintf($logdata['message'], $messageparams);
if (array_key_exists('success', $logdata))
$datatolog['success'] = true;
$this->personloglib->log(
$person_id,
$logdata['logtype'],
array(
'name' => $logdata['name'],
'message' => vsprintf($logdata['message'],
$messageparams),
'success' => 'true'
),
$datatolog,
self::TAETIGKEIT,
self::APP,
null,