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); }
/** * @param int|\File $f_id */ public function removeFileFromSet($f_id) { if (is_object($f_id)) { $f_id = $f_id->getFileID(); } $file_set_file = File::createAndGetFile($f_id, $this->fsID); $db = Loader::db(); $db->Execute('DELETE FROM FileSetFiles WHERE fID = ? AND fsID = ?', array($f_id, $this->getFileSetID())); $fe = new \Concrete\Core\File\Event\FileSetFile($file_set_file); Events::dispatch('on_file_removed_from_set', $fe); }