Example #1
0
 /**
  * @param FilesystemInterface $_fs
  * @return File
  */
 public function getSyllabusFile(FilesystemInterface $_fs)
 {
     if ($this->syllabus_id && !$this->_syllabus) {
         $this->_syllabus = File::find($this->_pdo, $_fs, $this->syllabus_id);
     }
     return $this->_syllabus;
 }
Example #2
0
 public function create(User $_user, array $file_array) : File
 {
     if (!array_key_exists("name", $file_array) || !array_key_exists("tmp_name", $file_array)) {
         throw new InvalidArgumentException("Expecting uploaded file array.");
     }
     $this->name = pathinfo($file_array["name"], PATHINFO_FILENAME);
     $this->location = $file_array["tmp_name"];
     $this->mime_type = $file_array["type"];
     $this->extension = pathinfo($file_array["name"], PATHINFO_EXTENSION);
     $this->size = $file_array["size"];
     $this->error_id = $file_array["error"];
     $this->isValid();
     $file = new File($this->_pdo, $this->_filesystem);
     $file->create($_user, $this->extension, $this->mime_type, $this->name, $this->location, $this->is_image);
     return $file;
 }
Example #3
0
 /**
  * @param FilesystemInterface $_fs
  * @return File
  */
 public function getImageFile(FilesystemInterface $_fs)
 {
     if ($this->image_file_id && !$this->_image_file) {
         $this->_image_file = File::find($this->_pdo, $_fs, $this->image_file_id);
     }
     return $this->_image_file;
 }