Example #1
0
 public function display($tpl = null)
 {
     // Set toolbar items for the page
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::deleteList();
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX();
     JToolBarHelper::preferences('com_simplelists', '480');
     JHTML::_('behavior.tooltip');
     // Automatically fetch items, total and pagination - and assign them to the template
     $this->fetchItems();
     // Re-order the items by parent
     $listview = $this->getFilter('listview');
     if ($listview == 'tree') {
         $tree = new SimplelistsCategoryTree();
         $tree->setItems($this->items);
         $this->items = $tree->getList();
     } else {
         $listview = 'flat';
     }
     // Listview box
     $options[] = array('id' => 'tree', 'title' => 'Tree');
     $options[] = array('id' => 'flat', 'title' => 'Flat list');
     $extra = 'onchange="document.adminForm.submit();"';
     $this->lists['listview'] = JHTML::_('select.genericlist', $options, 'filter_listview', $extra, 'id', 'title', $listview);
     parent::display($tpl);
 }
Example #2
0
 /**
  * Method to parse a list of categories into a HTML selectbox
  *
  * @access public
  * @param int ID of current item 
  * @param int ID of parent category
  * @return string HTML output
  */
 public function getCategories($parent_id = null)
 {
     // Include the SimplelistsCategoryTree helper-class
     require_once JPATH_ADMINISTRATOR . '/components/com_simplelists/helpers/category.php';
     // Fetch the categories and parse them in a tree
     $categories = SimplelistsHelper::getCategories(null, $parent_id);
     $tree = new SimplelistsCategoryTree($categories);
     $categories = $tree->getList();
     // Add a prefix to the category-title depending on the category-level
     foreach ($categories as $cid => $category) {
         // Add a simple prefix to the category name
         $prefix = '';
         for ($i = 1; $i < $category->level; $i++) {
             $prefix .= '--';
         }
         if (!empty($prefix)) {
             $category->title = $prefix . ' ' . $category->title;
         }
         $categories[$cid] = $category;
     }
     return $categories;
 }
Example #3
0
        ?>
">
                <td>
                    <?php 
        echo $this->pagination->getRowOffset($i);
        ?>
                </td>
                <td>
                    <?php 
        echo $this->getGridCell('checked', $item, $i);
        ?>
                </td>
                <td>
                    <?php 
        if (isset($item->level)) {
            echo SimplelistsCategoryTree::getIndent($item->level);
        }
        if (JTable::isCheckedOut($this->user->get('id'), $item->checked_out)) {
            echo $item->title;
        } else {
            ?>
                        <a href="<?php 
            echo $link;
            ?>
" title="<?php 
            echo JText::_('Edit category');
            ?>
">
                            <?php 
            echo $item->title;
            ?>