/**
  * Construct a SimpleLists output
  * 
  * @access private
  * @param array $arguments
  * @return text
  */
 private function getSimpleLists($arguments)
 {
     // Construct the paths to SimpleLists
     $component_path = JPATH_SITE . DS . 'components' . DS . 'com_simplelists' . DS;
     $component_admin_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_simplelists' . DS;
     // Include all the required classes
     require_once $component_admin_path . 'tables' . DS . 'item.php';
     require_once $component_admin_path . 'tables' . DS . 'category.php';
     require_once $component_admin_path . 'helpers' . DS . 'helper.php';
     require_once $component_admin_path . 'helpers' . DS . 'plugin.php';
     require_once $component_path . 'helpers' . DS . 'icon.php';
     require_once $component_path . 'helpers' . DS . 'html.php';
     require_once $component_path . 'models' . DS . 'items.php';
     require_once $component_path . 'views' . DS . 'items' . DS . 'view.html.php';
     // Create and initialize a model
     $model = new SimplelistsModelItems();
     $model->setId($arguments['id']);
     // Create and initialize a view
     $view = new SimplelistsViewItems(array('name' => 'items', 'option' => 'com_simplelists'));
     $view->addTemplatePath($component_path . 'views' . DS . 'items' . DS . 'tmpl');
     $view->setModel($model, true);
     // Prepare and load the view
     $view->prepareDisplay();
     $content = $view->loadTemplate($view->getLayout());
     // Return the template-output
     return $content;
 }
Example #2
0
 public function getCharacterCount($character = null)
 {
     static $characters = null;
     if (!is_array($characters)) {
         $characters = array();
         $model = new SimplelistsModelItems();
         $model->setLimitQuery(false);
         $model->setState('no_char_filter', 1);
         $model->initLimit(1000);
         $model->initLimitstart(0);
         $rows = $model->getData();
         if (!empty($rows)) {
             foreach ($rows as $row) {
                 $c = substr(strtolower(trim($row->title)), 0, 1);
                 if (isset($characters[$c])) {
                     $characters[$c]++;
                 } else {
                     $characters[$c] = 1;
                 }
             }
         }
     }
     if (isset($characters[$character])) {
         return $characters[$character];
     }
     return 0;
 }