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;
    }
Ejemplo n.º 2
0
    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;
    }
Ejemplo n.º 3
0
    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;
    }
Ejemplo n.º 4
0
    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;
    }
Ejemplo n.º 5
0
 function getInput()
 {
     //Check to make sure EasyBlog has been installed
     if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_easyblog/easyblog.php')) {
         return "<div id='" . $this->id . "' class='" . $this->element['class'] . "'>" . JText::_('EASYBLOG_HAS_NOT_BEEN_INSTALLED') . "</div>";
     }
     require_once JPATH_ROOT . '/components/com_easyblog/models/categories.php';
     $EasyBlogModelCategories = new EasyBlogModelCategories();
     $categorytree = $EasyBlogModelCategories->getCategoryTree();
     $cats = $cat = array();
     foreach ($categorytree as $category) {
         $cat['id'] = $category->id;
         $cat['name'] = str_repeat('- ', $category->depth) . $category->title;
         $cats[] = $cat;
     }
     // Add select all options
     array_unshift($cats, array('id' => '', 'name' => JText::_('EASYBLOG_ALL_CATS')));
     // Initialize some field attributes
     $attr = $this->multiple ? ' multiple="multiple"' : '';
     $attr .= count($cats) >= 20 ? ' size="20"' : (count($cats) <= 5 ? ' size="5"' : ' size="10"');
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     return JHTML::_('select.genericlist', $cats, $this->name, $attr, 'id', 'name', $this->value, $this->id);
 }
Ejemplo n.º 6
0
 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;
 }