/** * @param null|array $allowed_mimetypes * @param bool $force * @param bool $doupload * * @return bool */ public function store($allowed_mimetypes = null, $force = true, $doupload = true) { if ($this->isNew()) { $errors = array(); if ($doupload) { $ret = $this->storeUpload('item_upload_file', $allowed_mimetypes, $errors); } else { $ret = true; } if (!$ret) { foreach ($errors as $error) { $this->setErrors($error); } return false; } } return $this->publisher->getFileHandler()->insert($this, $force); }
/** * delete an item from the database * * @param XoopsObject $item reference to the ITEM to delete * @param bool $force * * @return bool FALSE if failed. */ public function delete(XoopsObject $item, $force = false) { $xoops = Xoops::getInstance(); // Deleting the files if (!$this->publisher->getFileHandler()->deleteItemFiles($item)) { $item->setErrors('An error while deleting a file.'); } if (!parent::delete($item, $force)) { $item->setErrors('An error while deleting.'); return false; } // Removing tags information if ($xoops->isActiveModule('tag')) { $tag_handler = $xoops->getModuleHandler('tag', 'tag'); $tag_handler->updateByItem('', $item->getVar('itemid'), PUBLISHER_DIRNAME, 0); } return true; }