new text editor: tinyMCE

This commit is contained in:
2020-02-24 21:37:14 +01:00
parent abcb059355
commit 3fd854ddf1
15 changed files with 425 additions and 145 deletions

View File

@@ -130,6 +130,13 @@ class CATC extends Main
/* Notes*/
public function getNoteOld($iCourseId) {
$oNote = new Note($this->oDb, $this->oAuth->getUserId(), $iCourseId);
$asNote = $oNote->getNoteOld();
return self::getJsonResult(!empty($asNote), '', $asNote);
}
public function getNote($iCourseId) {
$oNote = new Note($this->oDb, $this->oAuth->getUserId(), $iCourseId);
$asNote = $oNote->getNote();
@@ -137,10 +144,9 @@ class CATC extends Main
return self::getJsonResult(!empty($asNote), '', $asNote);
}
public function setNote($iCourseId, $asOps) {
if(is_string($asOps)) $asOps = json_decode($asOps, true);
public function setNote($iCourseId, $sNotes) {
$oNote = new Note($this->oDb, $this->oAuth->getUserId(), $iCourseId);
$sError = $oNote->setNote($asOps);
$sError = $oNote->setNote($sNotes);
$bSuccess = ($sError=='');
$asData = ($bSuccess)?array('led_time' => $oNote->getNote()['led_time']):array();

View File

@@ -35,10 +35,10 @@ class Note extends PhpObject {
return array(Db::getId(Auth::USER_TABLE) => $this->iUserId, Db::getId(Course::COURSE_TABLE) => $this->iCourseId);
}
public function getNote() {
public function getNoteOld() {
$asCourse = $this->oDb->selectRow(self::NOTE_TABLE, $this->getNoteKeys());
if(!empty($asCourse)) {
$asCourse['notes'] = json_decode($asCourse['notes'], true);
$asCourse['notes'] = json_decode($asCourse['notes_old'], true);
$asCourse['led_date'] = date('d/m/Y', strtotime($asCourse['led']));
$asCourse['led_time'] = date('H:i');
}
@@ -46,11 +46,21 @@ class Note extends PhpObject {
return $asCourse;
}
public function setNote($asOps) {
public function getNote() {
$asCourse = $this->oDb->selectRow(self::NOTE_TABLE, $this->getNoteKeys());
if(!empty($asCourse)) {
$asCourse['led_date'] = date('d/m/Y', strtotime($asCourse['led']));
$asCourse['led_time'] = date('H:i');
}
return $asCourse;
}
public function setNote($sNotes) {
$sError = '';
if($this->iUserId > 0 && $this->iCourseId > 0) {
$asData = array_merge($this->getNoteKeys(), array('notes'=>json_encode($asOps)));
$asData = array_merge($this->getNoteKeys(), array('notes'=>$sNotes));
$iNoteId = $this->oDb->insertUpdateRow(self::NOTE_TABLE, $asData, array_keys($this->getNoteKeys()));
if(!$iNoteId) $sError = $this->oDb->getLastError();
}