示例#1
0
文件: Row.php 项目: laiello/resmania
 /**
  * Delete panel with input ID from internal form state
  *
  * @param string $panelID
  * @return bool - TRUE if panel was found and deleted, FALSE if panel was not in the state
  */
 function deletePanel($panelID)
 {
     $formState = Zend_Json::decode($this->state);
     foreach ($formState as $columnNumber => $column) {
         if (is_array($column) == false) {
             continue;
         }
         foreach ($column as $key => $panel) {
             $currentPanelID = RM_Form_Naming_Manager::generatePanelID($panel['xtype']);
             if ($currentPanelID == $panelID) {
                 unset($formState[$columnNumber][$key]);
                 $this->state = Zend_Json::encode($formState);
                 return true;
             }
         }
     }
     return false;
 }
示例#2
0
 function unsetFromForm($panelID)
 {
     $panel = $this->find($panelID)->current();
     $panelXtype = RM_Form_Naming_Manager::generatePanelXType($panelID);
     $model = new RM_Forms();
     $form = $model->find($panel->form_id)->current()->getForm();
     $formState = Zend_Json::decode($form->state);
     foreach ($formState as $columnKey => $column) {
         foreach ($column as $key => $panel) {
             if ($panel['xtype'] == $panelXtype) {
                 unset($formState[$columnKey][$key]);
                 $form->state = Zend_Json::encode($formState);
                 $form->save();
                 return true;
             }
         }
     }
     return false;
 }
 private function _getPanelJsCode($panel)
 {
     $panelXType = RM_Form_Naming_Manager::generatePanelXType($panel->id);
     $panelClassName = RM_Form_Naming_Manager::generatePanelClassName($panel->id);
     $buttonID = RM_Form_Naming_Manager::generateButtonID($panelXType);
     $divID = RM_Form_Naming_Manager::generateDivID($panel->id);
     $js = "\n            {$panelClassName} = Ext.extend(Ext.Panel, {\n                title: '" . $panel->name . "',\n                style: 'padding:0px 0px 0px 0px',\n                autoHeight: true,\n                closeable: true,\n                collapsible: false,\n                html: document.getElementById('rm_formdesigner_data_iframe').contentWindow.document.getElementById('{$divID}').innerHTML,\n                //preventBodyReset: true,\n                plugins: Ext.ux.PortletPlugin,\n                baseCls: 'RM_form_designer_container',\n                tools: [{\n                    id:'gear',\n                    handler: function(){\n                        RM.Pages.Functions.Formdesigner_SettingsWindow('" . $panel->id . "','" . $panel->name . "','" . $panel->settings . "');\n                    }\n                }],\n                listener: {'close': function(){Ext.getCmp('{$buttonID}').setDisable(false);}}\n            });\n            Ext.reg('{$panelXType}', {$panelClassName});\n        ";
     return $js;
 }
示例#4
0
文件: Row.php 项目: laiello/resmania
 /**
  * Returns div id for HTML code for this panel.
  * Alias for long: RM_Form_Naming_Manager::generateDivID($this->id)
  *
  * @return string
  */
 function getDivID()
 {
     return RM_Form_Naming_Manager::generateDivID($this->id);
 }