Exemple #1
0
 /**
  * Returns the file indicated by the $id if it exists otherwise
  * returns NULL. If the file exists, halt the router with a 403,
  * if the user does not have access.
  */
 private function loadFile($id)
 {
     $file = new \StudipDocument($id);
     // return NULL unless it exists
     if ($file->isNew()) {
         return null;
     }
     if (!$file->checkAccess($GLOBALS['user']->id)) {
         $this->error(401);
     }
     return $file;
 }
Exemple #2
0
 /**
  * @param $dokument_id
  * @return StudipMail provides fluent interface
  */
 function addStudipAttachment($dokument_id)
 {
     $doc = new StudipDocument($dokument_id);
     if (!$doc->isNew()) {
         $this->addFileAttachment(get_upload_file_path($doc->getId()), $doc->getValue('filename'));
     }
     return $this;
 }