last note update feedback

This commit is contained in:
2019-09-07 13:09:26 +02:00
parent 2874694292
commit 32d4917964
3 changed files with 8 additions and 4 deletions

View File

@@ -159,7 +159,7 @@ class CATC extends Main
$sError = $oNote->setNote($asOps); $sError = $oNote->setNote($asOps);
$bSuccess = ($sError==''); $bSuccess = ($sError=='');
$asData = ($bSuccess)?array('led' => $oNote->getNote()['led']):array(); $asData = ($bSuccess)?array('led_time' => $oNote->getNote()['led_time']):array();
return self::getJsonResult($bSuccess, $sError, $asData); return self::getJsonResult($bSuccess, $sError, $asData);
} }

View File

@@ -37,7 +37,11 @@ class Note extends PhpObject {
public function getNote() { public function getNote() {
$asCourse = $this->oDb->selectRow(self::NOTE_TABLE, $this->getNoteKeys()); $asCourse = $this->oDb->selectRow(self::NOTE_TABLE, $this->getNoteKeys());
if(!empty($asCourse)) $asCourse['notes'] = json_decode($asCourse['notes'], true); if(!empty($asCourse)) {
$asCourse['notes'] = json_decode($asCourse['notes'], true);
$asCourse['led_date'] = date('d/m/Y', strtotime($asCourse['led']));
$asCourse['led_time'] = date('H:i');
}
return $asCourse; return $asCourse;
} }

View File

@@ -25,7 +25,7 @@ oCATC.pageInit = function(asHash, bFirstPage) {
'get_note', 'get_note',
(asData) => { (asData) => {
oEditor.setContent(asData.notes); oEditor.setContent(asData.notes);
oCATC.feedback('notice', 'Last update on ('+asData.led.substr(11, 5)+')'); oCATC.feedback('notice', 'Last update at '+asData.led_time+' on '+asData.led_date);
}, },
{id: self.tmp('id_course')}, {id: self.tmp('id_course')},
() => {console.log('Note not found for course ID = '+self.tmp('id_course'))} () => {console.log('Note not found for course ID = '+self.tmp('id_course'))}
@@ -68,7 +68,7 @@ function save(bForce)
getInfo( getInfo(
'set_note', 'set_note',
function(sDesc, asData) { function(sDesc, asData) {
oCATC.feedback('notice', 'Note saved ('+asData.led.substr(11, 5)+')'); oCATC.feedback('notice', 'Note saved ('+asData.led_time+')');
self.tmp('saving', false); self.tmp('saving', false);
}, },
{ {