public function allpanelsAction()
 {
     $unitModel = new RM_Units();
     $unitTypeID = $this->_getParam('unitTypeID');
     $unitTypeModel = new RM_UnitTypes();
     $unitType = $unitTypeModel->find($unitTypeID)->current();
     $unit = $unitModel->getAll(new RM_Unit_Search_Criteria(array('type' => $unitType, 'includeOptionUnits' => true, 'includeExcursionUnits' => true)))->current();
     if ($unitTypeID == RM_UnitTypes::DEFAULT_TYPE && $unit == null) {
         $unit = $unitModel->getAll(new RM_Unit_Search_Criteria())->current();
     }
     if ($unit == null) {
         $unit = $unitModel->createRow();
     }
     $this->view->unit = $unit;
     $this->view->admin = true;
     // this is required by captcha
     $panelModel = new RM_FormPanels();
     $panels = $panelModel->fetchAll();
     $this->view->panels = $panels;
 }
 /**
  * Returns all javascript for form panels
  *
  * @return string js code
  */
 private function _getFormPanels()
 {
     $jsCode = "Ext.namespace('Ext.rm', 'Ext.rm.Formdesigner');";
     $model = new RM_FormPanels();
     $panels = $model->fetchAll();
     $jsCode .= 'RM.Pages.Functions.Formdesigner_InitPanels = function (){';
     foreach ($panels as $panel) {
         $jsCode .= $this->_getPanelJsCode($panel);
     }
     $jsCode .= '}
     ';
     return $jsCode;
 }