protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false) { // Handle the optional arguments. $options['control'] = MArrayHelper::getValue($options, 'control', false); // Create a signature hash. $hash = md5($source . serialize($options)); // Check if we can use a previously loaded form. if (isset($this->_forms[$hash]) && !$clear) { return $this->_forms[$hash]; } // Get the form. MForm::addFormPath(MPATH_COMPONENT . '/models/forms'); MForm::addFieldPath(MPATH_COMPONENT . '/models/fields'); try { $form = MForm::getInstance($name, $source, $options, false, $xpath); if (isset($options['load_data']) && $options['load_data']) { // Get the data for the form. $data = $this->loadFormData(); } else { $data = array(); } // Allow for additional modification of the form, and events to be triggered. // We pass the data because plugins may require it. $this->preprocessForm($form, $data); // Load the data into the form after the plugins have operated. $form->bind($data); } catch (Exception $e) { $this->setError($e->getMessage()); return false; } // Store the form for later. $this->_forms[$hash] = $form; return $form; }
function __construct() { parent::__construct('Atualizar Dados Pessoais', 'exemplos/main'); }
function __construct() { parent::__construct('Related Grids', "exemplos/main/controls"); }
function __construct() { parent::__construct('Form Partial View', "main/controls"); }
protected static function _load() { if (self::$plugins !== null) { return self::$plugins; } mimport('framework.filesystem.folder'); if (!MFolder::exists(MPATH_PLUGINS)) { self::$plugins = array(); return self::$plugins; } $folders = MFolder::folders(MPATH_PLUGINS); if (empty($folders)) { self::$plugins = array(); return self::$plugins; } self::$plugins = array(); foreach ($folders as $folder) { $folder = str_replace('plg_', '', $folder); list($type, $name) = explode('_', $folder); $plg = new stdClass(); $plg->type = $type; $plg->name = $name; $plg->params = null; $xml_file = MPATH_MIWI . '/plugins/plg_' . $type . '_' . $name . '/' . $name . '.xml'; if (file_exists($xml_file)) { $form = MForm::getInstance($folder . '_form', $xml_file, array(), false, 'config'); $field_sets = $form->getFieldsets(); if (!empty($field_sets)) { $params = array(); foreach ($field_sets as $name => $field_set) { foreach ($form->getFieldset($name) as $field) { $field_name = $field->get('fieldname'); $field_value = $field->get('value'); $params[$field_name] = $field_value; } } $plg->params = json_encode($params); } } self::$plugins[] = $plg; } return self::$plugins; }
function __construct() { parent::__construct('Pesquisar Pessoas', 'exemplos/main'); }
function __construct() { parent::__construct('Obtém dados via JSON', 'exemplos/main'); }
function __construct() { parent::__construct('Dnd Grids', "exemplos/main/controls/grids"); }
public function setForm(MForm $form) { $this->form = $form; $this->formControl = $form->getFormControl(); return $this; }
function __construct() { parent::__construct('Array Grid', "exemplos/main/controls"); }
public function onBeforeCreate() { parent::onBeforeCreate(); $this->property->outerBox = false; }
function __construct() { parent::__construct('Ajax via PHP', ">controls/main"); }
protected function getLayoutsFromViews($plugin, $view) { $options = array(); $layouts = array(); $layoutNames = array(); $app = MFactory::getApplication(); $path = ''; // Get the views for this component. if (is_dir(MPATH_WP_PLG . '/' . $plugin . '/site')) { $folders = MFolder::folders(MPATH_WP_PLG . '/' . $plugin . '/site', '^view[s]?$', false, true); } if (!empty($folders[0])) { $path = $folders[0] . '/' . $view . '/tmpl'; } if (is_dir($path)) { $layouts = array_merge($layouts, MFolder::files($path, '.xml$', false, true)); } else { return $options; } // Build list of standard layout names foreach ($layouts as $layout) { // Ignore private layouts. if (strpos(basename($layout), '_') === false) { // Get the layout name. $layoutNames[] = basename($layout, '.xml'); } } // Get the template layouts $tmpl = $app->getTemplate(); // Array to hold association between template file names and templates $templateName = array(); //@TODO : Do not forget that delete "com_" string if (is_dir(MPATH_THEMES . '/' . $tmpl . '/html/com_' . $plugin . '/' . $view)) { $templateLayouts = MFolder::files(MPATH_THEMES . '/' . $tmpl . '/html/com_' . $plugin . '/' . $view, '.xml$', false, true); foreach ($templateLayouts as $templateLayout) { // Get the layout name. $templateLayoutName = basename($templateLayout, '.xml'); // add to the list only if it is not a standard layout if (array_search($templateLayoutName, $layoutNames) === false) { $layouts[] = $templateLayout; // Set template name array so we can get the right template for the layout $templateName[$templateLayout] = $tmpl; } } } // Process the found layouts. foreach ($layouts as $layout) { $file = $layout; $array = array(); // Ignore private layouts. if (strpos(basename($layout), '_') === false) { $form = new MForm(basename($layout)); $form->loadFile($layout, true, '/metadata'); if (is_file($file)) { // Attempt to load the xml file. if ($xml = simplexml_load_file($file)) { // Look for the first view node off of the root node. if ($menu = $xml->xpath('layout[1]')) { $menu = $menu[0]; // If the view is hidden from the menu, discard it and move on to the next view. if (!empty($menu['hidden']) && $menu['hidden'] == 'true') { unset($xml); unset($o); continue; } // Populate the title and description if they exist. if (!empty($menu['title'])) { $array['title'] = trim((string) $menu['title']); } } } } // Add the layout to the options array. $array['form'] = $form; $options[$view . '_' . basename($layout, '.xml')] = $array; } } return $options; }
function __construct() { parent::__construct('Full DataGrid', "exemplos/main/controls"); }
function __construct($params) { parent::__construct('Form', $params); }
function __construct() { parent::__construct('Form Tree', ">main/controls"); }