protected function getInput() { $this->element['onchange'] = 'ajax_reloadTypes(\'' . $this->formControl . $this->group . $this->element['type_elem_name'] . '\', this.value);'; $html = parent::getInput(); $doc = JFactory::getDocument(); $uri = JFactory::getURI(); $doc->addScriptDeclaration("\n\t\t\tfunction ajax_reloadTypes(id, value)\n\t\t\t{\n\t\t\t\tvar sel = \$(id);\n\t\t\t\tnew Request.HTML({\n\t\t\t\t\turl:'" . JURI::root() . "administrator/index.php?option=com_cobalt&task=ajax.loadsectiontypes&no_html=1',\n\t\t\t\t\tmethod:'post',\n\t\t\t\t\tautoCancel:true,\n\t\t\t\t\tdata:{section_id: value, selected: selected_types},\n\t\t\t\t\tupdate: \$(id),\n\t\t }).send();\n\t\t\t}\n\t\t\t\t\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t\tajax_reloadTypes('" . $this->formControl . $this->group . $this->element['type_elem_name'] . "', '" . $this->value . "');\n\t\t\t});\n\t\t"); return $html; }
protected function getInput() { $html = parent::getInput(); if ($this->element['prepend']) { $html = $this->element['prepend'] . "<br>{$html}"; } if ($this->element['append']) { $html .= '<br><br>' . $this->element['append']; } return $html; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { // Initialize variables. JModelLegacy::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_mightytouch' . DIRECTORY_SEPARATOR . 'models'); $fieldsModel = JModelLegacy::getInstance('Fields', 'MightyTouchModel'); $options = array(); $fieldsModel->populateAllFieldsState(); $fields = $fieldsModel->getItems(); foreach ($fields as $fld) { $options[] = JHTML::_('select.option', $fld->id, $fld->title); } $options = array_merge(parent::getOptions(), $options); return $options; }
/** * Method to get the field options. * * @return array The field option objects. * @since 1.6 */ protected function getOptions() { // Initialize variables. $options = array(); $_ds = '/'; // path to images directory $path = JPATH_ROOT . $_ds . $this->element['directory']; $path = preg_replace("#([\\\\/]*)\$#", '', $path); if ($path) { $path = realpath($path); $path = str_replace(array('\\', '/'), $_ds, $path); } else { $path = $_ds; } $filter = $this->element['filter']; $exclude = $this->element['exclude']; $levels = $this->element['levels']; $levels = $levels == '' ? -1 : $levels; $relative_path = $this->element['relative_path']; $relative_path_value = $this->element['relative_path_value']; $invite_label = $this->element['invite_label']; $folders = $this->JS_folders($path, $path, $filter, $levels); $options = array(); foreach ($folders as $key => $folder) { $folders[$key] = str_replace(array('\\', '/'), $_ds, $folder); } foreach ($folders as $folder) { if ($relative_path == 1) { $folder_label = str_replace($path . $_ds, '', $folder); } else { $folder_label = str_replace(JPATH_ROOT . $_ds, '', $folder); } if ($relative_path_value == 'root') { $folder = str_replace($path . $_ds, '', $folder); } else { if ($relative_path_value == 'absolute') { //doing nothing } else { $folder = str_replace(JPATH_ROOT . $_ds, '', $folder); } } if ($exclude) { if (preg_match(chr(1) . $exclude . chr(1), $folder_label)) { continue; } } $folder_temp = ''; while ($folder_temp != $folder) { //if in path exist '..' cut this $folder_temp = $folder; $folder = preg_replace('#(\\' . $_ds . '[^\\' . $_ds . ']*\\' . $_ds . '\\.\\.)#', '', $folder); } $options[] = JHTML::_('select.option', $folder, $folder_label); } if (!$this->element['hide_none']) { if (!$invite_label) { $invite_label = 'Do not use'; } array_unshift($options, JHTML::_('select.option', '-1', '- ' . JText::_($invite_label) . ' -')); } if (!$this->element['hide_default']) { array_unshift($options, JHTML::_('select.option', '', '- ' . JText::_('Use default') . ' -')); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }