public function getDocTypesAction() { $list = new Document\DocType\Listing(); 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)); }