public function getDocTypesAction()
{
$list = new Document\DocType\Listing();
if ($this->getParam("type")) {
$type = $this->getParam("type");
if (Document\Service::isValidType($type)) {
$list->setFilter(function ($row) use($type) {
if ($row["type"] == $type) {
return true;
}
return false;
});
}
}
$list->load();
$docTypes = [];
foreach ($list->getDocTypes() as $type) {
$docTypes[] = $type;
}
$this->_helper->json(["docTypes" => $docTypes]);
}