/** * Remove a file * * @param \thebuggenie\core\entities\File $file The file to be removed * * @return boolean */ public function detachFile(File $file) { tables\ArticleFiles::getTable()->removeByArticleIDandFileID($this->getID(), $file->getID()); if (is_array($this->_files) && array_key_exists($file->getID(), $this->_files)) { unset($this->_files[$file->getID()]); } $file->delete(); }
public function listen_fileHasAccess(framework\Event $event) { $article_ids = \thebuggenie\modules\publish\entities\tables\ArticleFiles::getTable()->getArticlesByFileID($event->getSubject()->getID()); foreach ($article_ids as $article_id) { $article = new Article($article_id); if ($article->canRead()) { $event->setProcessed(); $event->setReturnValue(true); break; } } }
/** * Removes an article from the list of flagged articles * * @param framework\Event $event */ public function Files__getUnattachedFiles(framework\Event $event) { $event->setProcessed(); $event->addToReturnList(ArticleFiles::getTable()->getLinkedFileIds()); }
public static function getByArticleID($article_id) { return ArticleFiles::getTable()->getByArticleID($article_id); }