Added Notice-Update functionality

. added notice updates functionality by clicking on a row in the notice-table
. log "Notice updated" is set into log-table when note was updated successfully
This commit is contained in:
Cris
2018-04-18 14:34:36 +02:00
parent 4b58ed44ab
commit daab764a14
4 changed files with 133 additions and 22 deletions
@@ -42,6 +42,11 @@ class InfoCenter extends VileSci_Controller
'logtype' => 'Action',
'name' => 'Note added',
'message' => 'Note with title %s was added'
),
'updatenotiz' => array(
'logtype' => 'Action',
'name' => 'Note updated',
'message' => 'Note with title %s was updated'
)
);
private $uid; // contains the UID of the logged user
@@ -381,6 +386,44 @@ class InfoCenter extends VileSci_Controller
->set_content_type('application/json')
->set_output(json_encode($result->retval));
}
/**
* Updates a new Notiz for a person
* @param int $notiz_id
* @param int $person_id
* @return bool true if success
*/
public function updateNotiz($notiz_id, $person_id)
{
$titel = $this->input->post('notiztitel');
$text = $this->input->post('notiz');
$result = $this->NotizModel->update(
$notiz_id,
array(
'titel' => $titel,
'text' => $text,
'verfasser_uid' => $this->uid,
"updateamum" => 'NOW()',
"updatevon" => $this->uid
)
);
$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));
}
/**
* Loads Notizen view for a person, helper for reloading after ajax request