/** * Get css icon clas for object * @param string $objClass */ public static function getIconClass($objClass) { $config = array('Docked' => 'objectDocked', 'Window' => 'objectWindowIcon', 'Text' => 'textFieldIcon', 'Textarea' => 'textareaIcon', 'Checkbox' => 'checkboxIcon', 'Checkboxgroup' => 'checkboxGroupIcon', 'Container' => 'containerIcon', 'Time' => 'clockIcon', 'Date' => 'dateIcon', 'Display' => 'displayfieldIcon', 'Fieldset' => 'fieldsetIcon', 'Fieldcontainer' => 'fieldContainerIcon', 'File' => 'fileIcon', 'Htmleditor' => 'htmlEditorIcon', 'Picker' => 'pickerIcon', 'Radio' => 'radioIcon', 'Radiogroup' => 'radioGroupIcon', 'Number' => 'numberFieldIcon', 'Panel' => 'panelIcon', 'Tabpanel' => 'tabIcon', 'Grid' => 'gridIcon', 'Form' => 'formIcon', 'Form_Field_Text' => 'textFieldIcon', 'Form_Field_Number' => 'textFieldIcon', 'Form_Field_Hidden' => 'hiddenFieldIcon', 'Form_Field_Checkbox' => 'checkboxIcon', 'Form_Field_Textarea' => 'textareaIcon', 'Form_Field_Htmleditor' => 'htmlEditorIcon', 'Form_Field_File' => 'fileIcon', 'Form_Field_Radio' => 'radioIcon', 'Form_Field_Time' => 'clockIcon', 'Form_Field_Date' => 'dateIcon', 'Form_Fieldset' => 'fieldsetIcon', 'Form_Field_Display' => 'displayfieldIcon', 'Form_Fieldcontainer' => 'fieldContainerIcon', 'Form_Checkboxgroup' => 'checkboxGroupIcon', 'Form_Radiogroup' => 'radioGroupIcon', 'Form_Field_Combobox' => 'comboboxFieldIcon', 'Button' => 'buttonIcon', 'Button_Split' => 'buttonSplitIcon', 'Buttongroup' => 'buttonGroupIcon', 'Tree' => 'treeIcon', 'Window' => 'windowIcon', 'Store' => 'storeIcon', 'Data_Store' => 'storeIcon', 'Data_Store_Tree' => 'storeIcon', 'Model' => 'modelIcon', 'Component_Window_System_Crud' => 'objectWindowIcon', 'Component_Window_System_Crud_Vc' => 'objectWindowIcon', 'Component_Field_System_Searchfield' => 'olinkIcon', 'Component_Field_System_Dictionary' => 'comboboxFieldIcon', 'Component_Field_System_Medialibhtml' => 'textMediaFieldIcon', 'Component_Field_System_Medialibitem' => 'resourceFieldIcon', 'Component_Field_System_Related' => 'gridIcon', 'Component_Field_System_Objectlink' => 'olinkIcon', 'Component_Field_System_Objectslist' => 'gridIcon', 'Toolbar' => 'toolbarIcon', 'Toolbar_Separator' => 'toolbarSeparatorIcon', 'Toolbar_Spacer' => 'toolbarSpacerIcon', 'Toolbar_Fill' => 'toolbarFillIcon', 'Toolbar_Textitem' => 'toolbarTextitemIcon', 'Menu' => 'menuItemsIcon', 'Menu_Separator' => 'menuSeparatorIcon', 'Menu_Item' => 'toolbarTextitemIcon', 'Menu_Datepicker' => 'dateIcon', 'Menu_Colorpicker' => 'colorPickerIcon', 'Menu_Checkitem' => 'checkboxIcon'); if (Designer_Project::isWindowComponent($objClass)) { return 'objectWindowIcon'; } if (isset($config[$objClass])) { return $config[$objClass]; } else { if (Designer_Project::isContainer($objClass)) { return 'objectIcon'; } else { return 'objectLeafIcon'; } } }
/** * Generate and add components */ public function addtemplateAction() { $this->_checkLoaded(); $name = Request::post('name', 'alphanum', false); $adapter = Request::post('adapter', 'alphanum', false); $parent = Request::post('parent', 'alphanum', 0); if (!class_exists($adapter)) { Response::jsonError($this->_lang->get('WRONG_REQUEST') . ' invalid adapter ' . $adapter); } $adapterObject = new $adapter(); if (!$adapterObject instanceof Backend_Designer_Generator_Component) { Response::jsonError($this->_lang->get('WRONG_REQUEST') . ' invalid adapter interface'); } $project = $this->_getProject(); if (!strlen($parent)) { $parent = 0; } if ($name == false) { Response::jsonError($this->_lang->INVALID_VALUE); } /* * Check if name starts with digits */ if (intval($name) > 0) { Response::jsonError($this->_lang->INVALID_VALUE); } /* * Check if parent object exists and can has childs */ if (!$project->objectExists($parent) || !Designer_Project::isContainer($project->getObject($parent)->getClass())) { $parent = 0; } if (!$adapterObject->addComponent($project, $name, $parent)) { Response::jsonError($this->_lang->get('CANT_EXEC')); } $this->_storeProject(); Response::jsonSuccess(); }