protected function getInput() { if (!JFile::exists(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'constants.php')) { return JText::_('PLG_DJMEDIATOOLS_EASYBLOG_COMPONENT_DISABLED'); } require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'constants.php'; require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'helper.php'; $mainframe = JFactory::getApplication(); $db = EasyBlogHelper::db(); $doc = JFactory::getDocument(); JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'categories.php'; $model = new EasyBlogModelCategories(); $categories = $model->getAllCategories(); if (!is_array($this->value)) { $this->value = array($this->value); } ob_start(); ?> <select name="<?php echo $this->name; ?> []" multiple="multiple" style="width:220px;height:200px;" class="<?php echo $this->element['class']; ?> "> <?php $selected = in_array('all', $this->value) ? ' selected="selected"' : ''; ?> <option value="all"<?php echo $selected; ?> ><?php echo JText::_('COM_EASYBLOG_ALL_CATEGORIES'); ?> </option> <?php foreach ($categories as $category) { $selected = in_array($category->id, $this->value) ? ' selected="selected"' : ''; ?> <option value="<?php echo $category->id; ?> "<?php echo $selected; ?> ><?php echo $category->title; ?> </option> <?php } ?> </select> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
function fetchElement($name, $value, &$node, $control_name) { $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $doc = JFactory::getDocument(); JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_easyblog' . DS . 'models' . DS . 'categories.php'; $model = new EasyBlogModelCategories(); $categories = $model->getAllCategories(true); if (!is_array($value)) { $value = array($value); } ob_start(); ?> <select name="<?php echo $control_name; ?> [<?php echo $name; ?> ][]" multiple="multiple" style="width:300px;height:250px;"> <?php $selected = in_array('all', $value) ? ' selected="selected"' : ''; ?> <option value="all"<?php echo $selected; ?> ><?php echo JText::_('COM_EASYBLOG_ALL_PARENT_CATEGORIES'); ?> </option> <?php foreach ($categories as $category) { $selected = in_array($category->id, $value) ? ' selected="selected"' : ''; ?> <option value="<?php echo $category->id; ?> "<?php echo $selected; ?> ><?php echo $category->title; ?> </option> <?php } ?> </select> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
protected function getInput() { $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $doc = JFactory::getDocument(); JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT); require_once JPATH_ROOT . '/administrator/components/com_easyblog/models/categories.php'; $model = new EasyBlogModelCategories(); $categories = $model->getAllCategories(true); if (!is_array($this->value)) { $this->value = array($this->value); } ob_start(); ?> <select name="<?php echo $this->name; ?> []" multiple="multiple" style="width:250px;height:200px;" class="<?php echo $this->element['class']; ?> "> <?php $selected = in_array('all', $this->value) ? ' selected="selected"' : ''; ?> <option value="all"<?php echo $selected; ?> ><?php echo JText::_('COM_EASYBLOG_ALL_PARENT_CATEGORIES'); ?> </option> <?php foreach ($categories as $category) { $selected = in_array($category->id, $this->value) ? ' selected="selected"' : ''; ?> <option value="<?php echo $category->id; ?> "<?php echo $selected; ?> ><?php echo $category->title; ?> </option> <?php } ?> </select> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
function fetchElement($name, $value, &$node, $control_name) { $mainframe = JFactory::getApplication(); $doc = JFactory::getDocument(); require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'categories.php'; $model = new EasyBlogModelCategories(); $categories = $model->getAllCategories(); ob_start(); ?> <select name="<?php echo $control_name; ?> [<?php echo $name; ?> ]"> <option value="0"<?php echo $value == 0 ? ' selected="selected"' : ''; ?> ><?php echo JText::_('Select a category'); ?> </option> <?php foreach ($categories as $category) { $selected = $category->id == $value ? ' selected="selected"' : ''; ?> <option value="<?php echo $category->id; ?> "<?php echo $selected; ?> ><?php echo $category->title; ?> </option> <?php } ?> </select> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }
protected function getInput() { $mainframe = JFactory::getApplication(); $doc = JFactory::getDocument(); require_once JPATH_ROOT . '/components/com_easyblog/constants.php'; $options = array(); $attr = ''; $categoryList = array(); // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : 'class="inputbox chzn-select"'; // To avoid user's confusion, readonly="true" should imply disabled="true". if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') { $attr .= ' disabled="disabled"'; } $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $attr .= $this->multiple ? ' multiple="multiple"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $attr .= 'multiple="multiple"'; $attr .= 'style="width:280px;"'; $attr .= 'data-placeholder="Click here to select categories"'; require_once JPATH_ROOT . '/administrator/components/com_easyblog/models/categories.php'; $model = new EasyBlogModelCategories(); $categories = $model->getAllCategories(); if (count($categories) > 0) { $optgroup = JHTML::_('select.optgroup', 'Select category', 'id', 'title'); array_push($categoryList, $optgroup); foreach ($categories as $row) { $opt = new stdClass(); $opt->id = $row->id; $opt->title = $row->title; array_push($categoryList, $opt); } } $html = JHTML::_('select.genericlist', $categoryList, $this->name, trim($attr), 'id', 'title', $this->value); return $html; }