public static function add(ConcreteFile $f, FileSet $fs) { $db = Loader::db(); $fsDisplayOrder = $db->GetOne('SELECT count(fID) FROM FileSetFiles WHERE fsID = ?', array($fs->getFileSetID())); $db->insert('FileSetFiles', array('fsID' => $fs->getFileSetID(), 'timestamp' => date('Y-m-d H:i:s'), 'fID' => $f->getFileID(), 'fsDisplayOrder' => $fsDisplayOrder)); $fsfID = $db->lastInsertId(); return File::getByID($fsfID); }
/** * Returns an array of File objects from the current set * * @return ConcreteFile[] */ public function getFiles() { if (!$this->fileSetFiles) { $this->populateFiles(); } $files = array(); foreach ($this->fileSetFiles as $file) { $files[] = ConcreteFile::getByID($file->fID); } return $files; }