protected function addToolBar() { $state = $this->get('State'); $this->canDo = CommunitySurveysHelper::getActions($state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_COMMUNITYSURVEYS') . ': <small><small>[ ' . JText::_('COM_COMMUNITYSURVEYS_DASHBOARD') . ' ]</small></small>', 'logo.png'); if ($this->canDo->get('core.admin')) { JToolBarHelper::preferences(S_APP_NAME); } }
function display($tpl = null) { $model = $this->getModel(); $this->canDo = CommunitySurveysHelper::getActions(); $id = JRequest::getInt('id', 0); $result = $model->get_survey_responses($id); $this->assignRef('survey', $result->survey); $this->assignRef('responses', $result->responses); $this->assignRef('pagination', $result->pagination); $this->assignRef('lists', $result->lists); $this->addToolBar(); parent::display($tpl); }
protected function addToolBar() { $user = JFactory::getUser(); $this->state = $this->get('State'); $this->canDo = CommunitySurveysHelper::getActions($this->state->get('filter.category_id')); JToolBarHelper::title(JText::_('COM_COMMUNITYSURVEYS') . ': <small><small>[ ' . JText::_('COM_COMMUNITYSURVEYS_SURVEYS') . ' ]</small></small>', 'logo.png'); if ($this->canDo->get('core.admin')) { JToolBarHelper::preferences(S_APP_NAME); JToolBarHelper::divider(); } if (count($user->getAuthorisedCategories(S_APP_NAME, 'core.create')) > 0) { JToolBarHelper::addNew(); JToolBarHelper::custom('copy', 'copy', 'copy', 'Copy', true, false); } JToolBarHelper::custom('refresh', 'default', 'default', 'Refresh Hits', false, false); JToolBarHelper::divider(); if ($this->canDo->get('core.edit.state')) { JToolBarHelper::publish('surveys.publish', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::unpublish('surveys.unpublish', 'JTOOLBAR_UNPUBLISH', true); } if ($this->canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'surveys.delete', 'JTOOLBAR_DELETE'); } }
/********************************* MAIN CONTENT ***********************************************/ CJLib::import('corejoomla.ui.bootstrap'); $view = $app->input->getCmd('view', 'dashboard'); if (JFile::exists(JPATH_COMPONENT . DS . 'controllers' . DS . $view . '.php')) { require_once JPATH_COMPONENT . DS . 'controllers' . DS . $view . '.php'; } else { CJFunctions::throw_error('View ' . JString::ucfirst($view) . ' not found!', 500); } $classname = 'CommunitySurveysController' . JString::ucfirst($view); $controller = new $classname(); $document = JFactory::getDocument(); CJFunctions::load_jquery(array('libs' => array('fontawesome'))); $document->addStyleSheet(CJLIB_URI . '/framework/assets/cj.framework.css'); $document->addStyleSheet(JURI::base(true) . '/components/' . S_APP_NAME . '/assets/css/cj.surveys.admin.min.css'); $document->addScript(JURI::base(true) . '/components/' . S_APP_NAME . '/assets/js/cj.surveys.admin.min.js'); CommunitySurveysHelper::addSubmenu($view); $params = JComponentHelper::getParams(S_APP_NAME); define('S_DEBUG_ENABLED', $params->get('enable_debugging', 0) == '1'); /********************************* VERSION CHECK *******************************/ if (empty($task)) { $version = $app->getUserState(S_APP_NAME . '.VERSION'); if (!$version) { $version = CJFunctions::get_component_update_check(S_APP_NAME, S_CURR_VERSION); $v = array(); $v['connect'] = (int) $version['connect']; $v['version'] = (string) $version['version']; $v['released'] = (string) $version['released']; $v['changelog'] = (string) $version['changelog']; $v['status'] = (int) $version['status']; if ($version['connect'] == 1) { $app->setUserState(S_APP_NAME . '.VERSION', $v);