protected function getInput()
 {
     require_once JPATH_ADMINISTRATOR . '/components/com_igallery/helpers/tree.php';
     require_once JPATH_ADMINISTRATOR . '/components/com_igallery/helpers/static.php';
     $option = JRequest::getVar('option');
     $hideCurrent = false;
     if ($option == 'com_config') {
         $params = JComponentHelper::getParams('com_igallery');
         $selected = $params->get('default_parent', 0);
     } else {
         if ($option == 'com_menus') {
             $selected = $this->value;
         } else {
             if (strpos($option, 'module')) {
                 $igparams = $this->form->getValue('params');
                 $selected = isset($igparams->category_id) ? $igparams->category_id : 0;
             } else {
                 $selected = $this->form->getValue('parent');
                 $hideCurrent = true;
             }
         }
     }
     $categories = igStaticHelper::getCategories();
     $categoriesbyTree = igTreeHelper::makeCategoryTree($categories);
     if ($hideCurrent) {
         $current = JRequest::getInt('id', 0);
         $categoriesbyTree = igTreeHelper::removeFromTree($categoriesbyTree, 'id', $current, 'numeric-exist');
     }
     if ($option == 'com_igallery' && JRequest::getVar('view') == 'icategory' && JRequest::getInt('id', 0) > 0) {
         $children = igTreeHelper::getChildIds($categories, JRequest::getInt('id', 0));
         if (count($children) > 0) {
             foreach ($children as $child) {
                 $categoriesbyTree = igTreeHelper::removeFromTree($categoriesbyTree, 'id', $child, 'numeric-exist');
             }
         }
     }
     $selectItems = array();
     if ($option != 'com_menus' && !strpos($option, 'module') && JRequest::getVar('view') != 'editorbutton') {
         $selectItems[] = JHTML::_('select.option', '0', JText::_('JGLOBAL_TOP'));
     }
     foreach ($categoriesbyTree as $category) {
         $displayName = $category->name;
         for ($k = 0; $k < $category->level; $k++) {
             $displayName = ' - ' . $displayName;
         }
         $selectItems[] = JHTML::_('select.option', $category->id, $displayName);
     }
     $selectHTML = JHTML::_("select.genericlist", $selectItems, $this->name, 'class="inputbox" size="14"', 'value', 'text', $selected);
     return $selectHTML;
 }
 function getChildIds($parentId)
 {
     $categories = igStaticHelper::getCategories();
     $childIds = igTreeHelper::getChildIds($categories, $parentId);
     return $childIds;
 }
                ?>
                <?php 
                if ($row->numimages > 0) {
                    ?>
                    <div class="menu_text_block menu_text_block_num"><?php 
                    echo $row->numimages;
                    ?>
 <?php 
                    echo JText::_('IMAGES');
                    ?>
</div>
                <?php 
                } else {
                    ?>
                    <?php 
                    $childCategories = igTreeHelper::getChildIds($allCategories, $row->id);
                    ?>
                    <?php 
                    if (count($childCategories) > 0) {
                        ?>
                        <?php 
                        $categoryText = count($childCategories) > 1 ? JText::_('COM_IGALLERY_CATEGORIES') : JText::_('JCATEGORY');
                        ?>
                        <div class="menu_text_block menu_text_block_child"><?php 
                        echo count($childCategories);
                        ?>
 <?php 
                        echo $categoryText;
                        ?>
</div>
                    <?php