Пример #1
0
 public static function getNoteById($bdd, $id)
 {
     $note = $bdd->prepare('SELECT * FROM note_frais WHERE id = :id LIMIT 1');
     $note->execute(array(':id' => $id));
     $array = $note->fetch();
     $CloneNote = new Note();
     $CloneNote->setDate($array['date']);
     $CloneNote->setId($array['id']);
     $CloneNote->setName($array['name']);
     $CloneNote->setStatut($array['statut_id']);
     $CloneNote->setUser($array['user_id']);
     return $CloneNote;
 }
Пример #2
0
 /**
  * Updates Submission Note
  * @param $articleId int
  */
 function updateSubmissionNote($articleId, $request)
 {
     import('classes.file.ArticleFileManager');
     $noteDao =& DAORegistry::getDAO('NoteDAO');
     $user =& $request->getUser();
     $journal =& $request->getJournal();
     $note = new Note();
     $note->setId($request->getUserVar('noteId'));
     $note->setAssocType(ASSOC_TYPE_ARTICLE);
     $note->setAssocId($articleId);
     $note->setUserId($user->getId());
     $note->setDateModified(Core::getCurrentDate());
     $note->setContextId($journal->getId());
     $note->setTitle($request->getUserVar('title'));
     $note->setContents($request->getUserVar('note'));
     $note->setFileId($request->getUserVar('fileId'));
     if (HookRegistry::call('SectionEditorAction::updateSubmissionNote', array(&$articleId, &$note))) {
         return;
     }
     $articleFileManager = new ArticleFileManager($articleId);
     // if there is a new file being uploaded
     if ($articleFileManager->uploadedFileExists('upload')) {
         // Attach the new file to the note, overwriting existing file if necessary
         $fileId = $articleFileManager->uploadSubmissionNoteFile('upload', $note->getFileId(), true);
         $note->setFileId($fileId);
     } else {
         if ($request->getUserVar('removeUploadedFile')) {
             $articleFileManager = new ArticleFileManager($articleId);
             $articleFileManager->deleteFile($note->getFileId());
             $note->setFileId(0);
         }
     }
     $noteDao->updateObject($note);
 }
Пример #3
0
 /**
  * Updates Submission Note
  * @param $paperId int
  */
 function updateSubmissionNote($paperId)
 {
     import('classes.file.PaperFileManager');
     $noteDao = DAORegistry::getDAO('NoteDAO');
     $user =& Request::getUser();
     $conference =& Request::getConference();
     $note = new Note();
     $note->setId(Request::getUserVar('noteId'));
     $note->setAssocType(ASSOC_TYPE_PAPER);
     $note->setAssocId($paperId);
     $note->setUserId($user->getId());
     $note->setDateModified(Core::getCurrentDate());
     $note->setContextId($conference->getId());
     $note->setTitle(Request::getUserVar('title'));
     $note->setContents(Request::getUserVar('note'));
     $note->setFileId(Request::getUserVar('fileId'));
     if (HookRegistry::call('SectionEditorAction::updateSubmissionNote', array(&$paperId, &$note))) {
         return;
     }
     $paperFileManager = new PaperFileManager($paperId);
     // if there is a new file being uploaded
     if ($paperFileManager->uploadedFileExists('upload')) {
         // Attach the new file to the note, overwriting existing file if necessary
         $fileId = $paperFileManager->uploadSubmissionNoteFile('upload', $note->getFileId(), true);
         $note->setFileId($fileId);
     } else {
         if (Request::getUserVar('removeUploadedFile')) {
             $paperFileManager = new PaperFileManager($paperId);
             $paperFileManager->deleteFile($note->getFileId());
             $note->setFileId(0);
         }
     }
     $noteDao->updateObject($note);
 }
Пример #4
0
 public function getFachNoten($schueler_id, $fach_id)
 {
     $sql = "SELECT n.note_id AS note_id, \n\t\t\t\tn.schueler_id AS schueler_id, \n\t\t\t\tn.typ AS typ, \n\t\t\t\tn.punkte AS punkte,\n\t\t\t\tu.unterrichtsstunde_id AS unterrichtsstunde_id\n\t\t\t\tFROM note n, unterrichtsstunde u\n\t\t\t\tWHERE u.unterrichtsstunde_id=n.unterrichtsstunde_id\n\t\t\t\tAND n.schueler_id=" . $schueler_id . " \n\t\t\t\tAND u.fach_id=" . $fach_id . ";";
     try {
         $result = mysql_query($sql);
         if (!$result) {
             throw new MysqlException();
         }
         $noten = array();
         while ($row = mysql_fetch_assoc($result)) {
             $n = new Note();
             $n->setId($row['note_id']);
             $n->setSchueler_id($row['schueler_id']);
             $n->setTyp($row['typ']);
             $n->setPunkte($row['punkte']);
             $n->setUnterrichtsstunde_id($row['unterrichtsstunde_id']);
             $noten[$n->getId()] = $n;
         }
     } catch (MysqlException $e) {
         Html::showAll($e);
     }
     return $noten;
 }