Back to PhocaGalleryCategoryhtml class

Method options

public static
options
(mixed $type = 0, mixed $ignorePublished = 0)

Method options - Source code

public static function options($type = 0, $ignorePublished = 0)
{
    if ($type == 1) {
        $tree[0] = new CMSObject();
        $tree[0]->text = Text::_('COM_PHOCAGALLERY_MAIN_CSS');
        $tree[0]->value = 1;
        $tree[1] = new CMSObject();
        $tree[1]->text = Text::_('COM_PHOCAGALLERY_CUSTOM_CSS');
        $tree[1]->value = 2;
        return $tree;
    }
    $db = Factory::getDBO();
    //build the list of categories
    $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocagallery_categories AS a';
    if ($ignorePublished == 0) {
        $query .= ' WHERE a.published = 1';
    }
    $query .= ' ORDER BY a.ordering';
    $db->setQuery($query);
    $phocagallerys = $db->loadObjectList();
    $catId = -1;
    $javascript = 'class="form-control" size="1" onchange="Joomla.submitform( );"';
    $tree = array();
    $text = '';
    $tree = self::CategoryTreeOption($phocagallerys, $tree, 0, $text, $catId);
    return $tree;
}