function display($tpl = null) { $model = $this->getModel(); $app = JFactory::getApplication(); $latest_surveys = $model->get_surveys(array(), 5, 0); $this->assignRef('latest_surveys', $latest_surveys['surveys']); $pending_surveys = $model->get_surveys(array(), 10, 0, 2); $this->assignRef('pending_surveys', $pending_surveys['surveys']); $version = $app->getUserState(S_APP_NAME . '.VERSION'); if (!$version) { $version = CJFunctions::get_component_update_check(S_APP_NAME, S_CURR_VERSION); $v = array(); if (!empty($version)) { $v['connect'] = (int) $version['connect']; $v['version'] = (string) $version['version']; $v['released'] = (string) $version['released']; $v['changelog'] = (string) $version['changelog']; $v['status'] = (string) $version['status']; $app->setUserState(S_APP_NAME . '.VERSION', $v); } } $this->assignRef('version', $version); $this->addToolBar(); parent::display($tpl); }
function display($tpl = null) { JToolBarHelper::title(JText::_('COM_CJBLOG') . " <small>[" . JText::_("COM_CJBLOG_CONTROL_PANEL") . "]</small>"); $app = JFactory::getApplication(); $version = $app->getUserState(CJBLOG . '.VERSION', null); if (!$version) { $version = CJFunctions::get_component_update_check(CJBLOG, CJBLOG_VERSION); $v = array(); if (!empty($version)) { $v['connect'] = (int) $version['connect']; $v['version'] = (string) $version['version']; $v['released'] = (string) $version['released']; $v['changelog'] = (string) $version['changelog']; $v['status'] = (string) $version['status']; $app->setUserState(CJBLOG . '.VERSION', $v); } } $this->assignRef('version', $version); parent::display($tpl); }
} $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); } } if (!empty($version['status']) && $version['status'] != 0 && !empty($version['version'])) { echo '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <i class="icon-info-sign"></i> Community Surveys ' . $version['version'] . ' is now available, please <a target="_blank" href="http://www.corejoomla.com/downloads.html">download it here</a>.
JSubMenuHelper::addEntry(JText::_('COM_CJBLOG_POINTS'), 'index.php?option=' . CJBLOG . '&view=points', $view == 'points'); JSubMenuHelper::addEntry(JText::_('COM_CJBLOG_POINT_RULES'), 'index.php?option=' . CJBLOG . '&view=pointrules', $view == 'pointrules'); JToolBarHelper::preferences(CJBLOG); if (APP_VERSION > 2.5) { JToolbarHelper::help('JHELP_CONTENT_ARTICLE_MANAGER'); JHtmlSidebar::setAction('index.php?option=com_content&view=articles'); } $document->addStyleSheet(JUri::root(true) . '/administrator/components/' . CJBLOG . '/assets/css/cjblog.admin.min.css'); $document->addScript(JUri::root(true) . '/administrator/components/' . CJBLOG . '/assets/js/cjblog.admin.min.js'); $class = 'CjBlogController' . JString::ucfirst($view); $controller = new $class(); /********************************* VERSION CHECK *******************************/ if (empty($task)) { $version = $app->getUserState(CJBLOG . '.VERSION'); if (!$version) { $version = CJFunctions::get_component_update_check(CJBLOG, CJBLOG_VERSION); $v = array(); if (!empty($version)) { $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']; $app->setUserState(CJBLOG . '.VERSION', $v); } } if (!empty($version['status']) && $version['status'] == 1 && !empty($version['version'])) { echo '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> CjBlog ' . $version['version'] . ' is now available, <a href="' . JUri::base(true) . '/index.php?option=com_installer&view=update">Update it now</a>. </div>';