public function processEditTypeAction()
 {
     $parentId = (int) $this->_getParam('enumerationParentId');
     $params = $this->_getParam('visit');
     $enumerationId = (int) $params['enumerationId'];
     $ormClass = $params['ormClass'];
     $ormClasses = Visit::ormClasses();
     $data = false;
     if (isset($ormClasses[$ormClass])) {
         if ($parentId > 0) {
             $closure = new EnumerationsClosure();
             $params['active'] = 1;
             $enumerationId = $closure->insertEnumeration($params, $parentId);
         } else {
             $enumeration = new Enumeration();
             $enumeration->enumerationId = $enumerationId;
             $enumeration->populate();
             $enumeration->populateWithArray($params);
             $enumeration->persist();
         }
         $data = true;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
 public function processEditAction()
 {
     $parentId = (int) $this->_getParam('parentId');
     $params = $this->_getParam('enumeration');
     $enumClosure = new EnumerationsClosure();
     $isSelf = true;
     $enumerationId = (int) $params['enumerationId'];
     if ($parentId == 0 && $enumerationId == 0 || $parentId > 0 && !$enumerationId > 0) {
         $enumerationId = $enumClosure->insertEnumeration($params, $parentId);
         $isSelf = false;
     }
     $enumeration = new Enumeration();
     $enumeration->enumerationId = $enumerationId;
     $enumeration->populate();
     if ($isSelf) {
         $enumeration->populateWithArray($params);
         $enumeration->persist();
     }
     $ormClass = 'Enumeration';
     $icon = "<a onclick=\"enumEditObject({$enumeration->enumerationId})\" title=\"Edit Object\"><img src=\"" . Zend_Registry::get('baseUrl') . "img/sm-editproblem.png\" alt=\"Edit Object\" /></a>";
     if (strlen($enumeration->ormClass) > 0 && class_exists($enumeration->ormClass)) {
         $ormClass = $enumeration->ormClass;
     }
     $data['parentId'] = $parentId;
     $data['id'] = $enumeration->enumerationId;
     $data['data'] = array();
     $data['data'][] = $enumeration->name;
     $data['data'][] = $enumeration->category;
     $data['data'][] = $enumeration->active;
     $data['data'][] = $icon;
     $data['userdata']['ormClass'] = $ormClass;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }