/** * @return string $statusMessage */ public static function uninstall() { $queries = array('answers' => 'DROP TABLE IF EXISTS `plugin_poll_answers`;', 'questions' => 'DROP TABLE IF EXISTS `plugin_poll_questions`;'); // remove snippet document type $list = new Document_DocType_List(); $list->load(); foreach ($list->docTypes as $docType) { /* @var $docType Document_DocType */ if ($docType->name === 'Poll') { $docType->delete(); } } if (self::_executeQueries($queries)) { return "Poll Plugin successfully uninstalled."; } else { return "Poll Plugin could not be uninstalled. See debug log for more details."; } }
public function getDocTypesAction() { $list = new Document_DocType_List(); if ($this->_getParam("type")) { $type = $this->_getParam("type"); if (Document_Service::isValidType($type)) { $list->setCondition("type = ?", $type); } } $list->setOrderKey(array("priority", "name")); $list->setOrder(array("desc", "ASC")); $list->load(); $docTypes = array(); foreach ($list->getDocTypes() as $type) { $docTypes[] = $type; } $this->_helper->json(array("docTypes" => $docTypes)); }
public function removeDocTypes() { $conf = new Zend_Config_Xml(PIMCORE_PLUGINS_PATH . '/Blog/install/doctypes.xml'); $names = array(); foreach ($conf->doctypes->doctype as $def) { $names[] = $def->name; } $list = new Document_DocType_List(); $list->load(); foreach ($list->docTypes as $docType) { /* @var $docType Document_DocType */ if (in_array($docType->name, $names)) { $docType->delete(); } } }