- adapted infocenterdetails to work with new ajaxlib

- layout change infocenter dataset
- wrapping objects around javascript code
This commit is contained in:
alex
2018-05-25 15:10:50 +02:00
parent 505c15f558
commit 282b822b63
6 changed files with 542 additions and 503 deletions
@@ -155,7 +155,7 @@ class InfoCenter extends FHC_Controller
}
/**
* unlocks page from edit by a person, redirects to overview filter page
* Unlocks page from edit by a person, redirects to overview filter page
* @param $person_id
*/
public function unlockPerson($person_id)
@@ -169,7 +169,7 @@ class InfoCenter extends FHC_Controller
}
/**
* Saves if a document has been formal geprueft. saves current timestamp if checked as geprueft, or null if not.
* Saves if a document has been formal geprueft. Saves current timestamp if checked as geprueft, or null if not.
* @param $person_id
*/
public function saveFormalGeprueft($person_id)
@@ -177,37 +177,36 @@ class InfoCenter extends FHC_Controller
$akte_id = $this->input->post('akte_id');
$formalgeprueft = $this->input->post('formal_geprueft');
if (!isset($akte_id) || !isset($formalgeprueft) || !isset($person_id))
show_error('Parameters not set!');
$json = false;
$akte = $this->AkteModel->load($akte_id);
if (isError($akte))
if (isset($akte_id) && isset($formalgeprueft) && isset($person_id))
{
show_error($akte->retval);
$akte = $this->AkteModel->load($akte_id);
if (hasData($akte))
{
$timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null;
$result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp));
if (isSuccess($result))
{
$json = $timestamp;
$this->_log(
$person_id,
'saveformalgep',
array(
empty($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
is_null($timestamp) ? 'NULL' : $timestamp
)
);
}
}
}
$timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null;
$result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp));
if (isError($result))
{
show_error($result->retval);
}
//write person log
$this->_log(
$person_id,
'saveformalgep',
array(
empty($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
is_null($timestamp) ? 'NULL' : $timestamp
)
);
$this->output
->set_content_type('application/json')
->set_output(json_encode($timestamp));
->set_output(json_encode($json));
}
/**
@@ -218,20 +217,13 @@ class InfoCenter extends FHC_Controller
{
$prestudent = $this->PrestudentModel->getLastPrestudent($person_id, true);
if (isError($prestudent))
{
show_error($prestudent->retval);
}
$jsonoutput = count($prestudent->retval) > 0 ? $prestudent->retval[0] : null;
$this->output
->set_content_type('application/json')
->set_output(json_encode($jsonoutput));
->set_output(json_encode($prestudent));
}
/**
* Gets Zugangsvoraussetzungen for a prestudents as a description text
* Gets Zugangsvoraussetzungen for a prestudent as a description text and shows them in a view
* @param $prestudent_id
*/
public function getZgvInfoForPrestudent($prestudent_id)
@@ -242,7 +234,11 @@ class InfoCenter extends FHC_Controller
$studiengangkurzbz = $prestudentdata['studiengang_kurzbz'];
$studiengangbezeichnung = $prestudentdata['studiengang_bezeichnung'];
$data = array('studiengang_bezeichnung' => $studiengangbezeichnung, 'studiengang_kurzbz' => $studiengangkurzbz, 'data' => null);
$data = array(
'studiengang_bezeichnung' => $studiengangbezeichnung,
'studiengang_kurzbz' => $studiengangkurzbz,
'data' => null
);
if (hasData($studienordnung))
{
@@ -255,54 +251,58 @@ class InfoCenter extends FHC_Controller
}
/**
* Saves a zgv for a prestudent. includes Ort, Datum, Nation for bachelor and master.
* Saves a ZGV for a prestudent, includes Ort, Datum, Nation for bachelor and master
* @param $prestudent_id
*/
public function saveZgvPruefung($prestudent_id)
public function saveZgvPruefung()
{
// zgvdata
// Check for string null, in case dropdown changed to default value
$zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');
$zgvort = $this->input->post('zgvort');
$zgvdatum = $this->input->post('zgvdatum');
$zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
$zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
$prestudent_id = $this->input->post('prestudentid');
//zgvmasterdata
$zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
$zgvmaort = $this->input->post('zgvmaort');
$zgvmadatum = $this->input->post('zgvmadatum');
$zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
$zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
$result = $this->PrestudentModel->update(
$prestudent_id,
array(
'zgv_code' => $zgv_code,
'zgvort' => $zgvort,
'zgvdatum' => $zgvdatum,
'zgvnation' => $zgvnation_code,
'zgvmas_code' => $zgvmas_code,
'zgvmaort' => $zgvmaort,
'zgvmadatum' => $zgvmadatum,
'zgvmanation' => $zgvmanation_code,
'updateamum' => date('Y-m-d H:i:s')
)
);
if (isError($result))
if (empty($prestudent_id))
$result = error('Prestudentid missing');
else
{
show_error($result->retval);
// zgvdata
// Check for string null, in case dropdown changed to default value
$zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');
$zgvort = $this->input->post('zgvort');
$zgvdatum = $this->input->post('zgvdatum');
$zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
$zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
//zgvmasterdata
$zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
$zgvmaort = $this->input->post('zgvmaort');
$zgvmadatum = $this->input->post('zgvmadatum');
$zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
$zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
$result = $this->PrestudentModel->update(
$prestudent_id,
array(
'zgv_code' => $zgv_code,
'zgvort' => $zgvort,
'zgvdatum' => $zgvdatum,
'zgvnation' => $zgvnation_code,
'zgvmas_code' => $zgvmas_code,
'zgvmaort' => $zgvmaort,
'zgvmadatum' => $zgvmadatum,
'zgvmanation' => $zgvmanation_code,
'updateamum' => date('Y-m-d H:i:s')
)
);
if (isSuccess($result))
{
//get extended Prestudent data for logging
$logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
$this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id));
}
}
//get extended Prestudent data for logging
$logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
$this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id));
$this->output
->set_content_type('application/json')
->set_output(json_encode($result->retval));
->set_output(json_encode($result));
}
/**
@@ -450,16 +450,14 @@ class InfoCenter extends FHC_Controller
$result = $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->uid);
if (isError($result))
if (isSuccess($result))
{
show_error($result->retval);
$this->_log($person_id, 'savenotiz', array($titel));
}
$this->_log($person_id, 'savenotiz', array($titel));
$this->output
->set_content_type('application/json')
->set_output(json_encode($result->retval));
->set_output(json_encode($result));
}
/**
@@ -484,19 +482,15 @@ class InfoCenter extends FHC_Controller
)
);
$json = false;
if (isSuccess($result))
{
$json = true;
//set log "Notiz updated"
$this->_log($person_id, 'updatenotiz', array($titel));
}
$this->output
->set_content_type('application/json')
->set_output(json_encode($json));
->set_output(json_encode($result));
}
/**
@@ -567,14 +561,18 @@ class InfoCenter extends FHC_Controller
}
/**
* Initializes parking of a person, i.e. a person is not expected to do any actions while it is parked
* Initializes parking of a person, i.e. a person is not expected to do any actions while 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);
$result = $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->uid);
$this->output
->set_content_type('application/json')
->set_output(json_encode($result));
}
/**
@@ -584,7 +582,11 @@ class InfoCenter extends FHC_Controller
{
$person_id = $this->input->post('person_id');
$this->personloglib->unPark($person_id);
$result = $this->personloglib->unPark($person_id);
$this->output
->set_content_type('application/json')
->set_output(json_encode($result));
}
/**
+18 -29
View File
@@ -91,7 +91,7 @@ class PersonLogLib
* @param string $app
* @param null $oe_kurzbz
* @param null $user
* @return bool wether parking was successfull
* @return insert object
*/
public function park($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null)
{
@@ -110,16 +110,13 @@ class PersonLogLib
'insertvon' => $user
);
$result = $this->ci->PersonLogModel->insert($data);
if (isSuccess($result))
return true;
else
show_error($result->retval);
return $this->ci->PersonLogModel->insert($data);
}
/**
* Unparks a person, i.e. removes all log entries in the future
* @param $person_id
* @return array with deleted logids
*/
public function unPark($person_id)
{
@@ -127,24 +124,21 @@ class PersonLogLib
$deleted = array();
if (isSuccess($result))
if (hasData($result))
{
if (count($result->retval) > 0)
foreach ($result->retval as $log)
{
foreach ($result->retval as $log)
$logdata = json_decode($log->logdata);
if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
$logdata = json_decode($log->logdata);
if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
$delresult = $this->ci->PersonLogModel->deleteLog($log->log_id);
if (isSuccess($delresult))
$deleted[] = $log->log_id;
}
$delresult = $this->ci->PersonLogModel->deleteLog($log->log_id);
if (isSuccess($delresult))
$deleted[] = $log->log_id;
}
}
}
else
show_error($result->retval);
return $deleted;
}
/**
@@ -158,23 +152,18 @@ class PersonLogLib
$parkeddate = null;
if (isSuccess($result))
if (hasData($result))
{
if (count($result->retval) > 0)
foreach ($result->retval as $log)
{
foreach ($result->retval as $log)
$logdata = json_decode($log->logdata);
if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
$logdata = json_decode($log->logdata);
if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
$parkeddate = $log->zeitpunkt;
break;
}
$parkeddate = $log->zeitpunkt;
break;
}
}
}
else
show_error($result->retval);
return $parkeddate;
}
@@ -21,6 +21,7 @@
</div>
<div class="text-right">
<!--abbrechen-button only shown when notice is clicked to be changed-->
<span class="text-danger" id="notizmsg"></span>
<button type="reset" class="btn btn-default" style="display: none"><?php echo $this->p->t('ui', 'abbrechen') ?></button>
<button type="submit" class="btn btn-default"><?php echo $this->p->t('ui', 'speichern') ?></button>
</div>