function display($tpl = null) { $app = JFactory::getApplication(); $model = $this->getModel('plansessions'); $user = JFactory::getUser(); $this->state = $this->get('State'); $trainingbook = $app->getUserState("com_htraininglogs.filter.trainingbook", NULL); $this->trainingbook = $trainingbook; $params = $app->getParams(); $doma_installed = $params->get('doma_installed'); $date1 = $this->state->get('filter.date1'); $yachs = $this->state->get('filter.yachs'); $currentpage = $this->state->get('filter.currentpage'); $period = HTraininglogsHelper::getPeriod($date1, $currentpage, $trainingbook->user_id); $groupparams = HTraininglogsHelper::getGroupparams(); $portlets = $model->getpageviewportlets($currentpage, $trainingbook); $this->currentpage = $currentpage; $this->groupparams = $groupparams; $this->period = $period; $this->yachs = $yachs; $this->tdate = $this->period->enddat->format('Y-m-d'); $this->portlets = $portlets; $portletarray = array(); $itemarray = array(); $this->results = array(); foreach ($portlets as $i => $portlet) { $portletexists = array_search($portlet->view_data, $portletarray); if (!$portletexists) { $plansessionshelper = $portlet->view_data . 'HTraininglogsHelper'; JLoader::register($plansessionshelper, JPATH_COMPONENT . '/sessionshelpers/' . $portlet->view_data . 'helper.php'); $this->items[$i] = $plansessionshelper::getItems($period, $user, $yachs, $sport, $currentpage); $itemarray[$i] = $this->items[$i]; } else { $this->items[$i] = $itemarray[$portletexists]; } $this->results[$i] = count($this->items[$i]); if (file_exists(JPATH_COMPONENT . '/plansessionshelpers/' . $portlet->title . 'posthelper.php')) { $plansessionsposthelper = $portlet->title . 'post' . 'HTraininglogsHelper'; JLoader::register($plansessionsposthelper, JPATH_COMPONENT . '/plansessionshelpers/' . $portlet->title . 'posthelper.php'); $this->items[$i] = $plansessionsposthelper::postprocess($this->items[$i], $groupparams, $user, $yachs, $sport, $period); } array_push($portletarray, $portlet->view_data); } if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->_preparePageheader($currentpage); $this->_prepareDocument(); parent::display($tpl); }