public function display() { $task = JRequest::getCmd('task','default'); switch($task) { case 'showcomment': JToolBarHelper::title(JText::_('AKEEBA').': <small>'.JText::_('BUADMIN').'</small>','akeeba'); JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option='.JRequest::getCmd('option')); JToolBarHelper::save(); JToolBarHelper::cancel(); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::base().'../media/com_akeeba/theme/akeebaui.css?'.AKEEBAMEDIATAG); $id = JRequest::getInt('id',0); $record = AEPlatform::get_statistics($id); $this->assign('record', $record); $this->assign('record_id', $id); JRequest::setVar('tpl','comment'); break; default: $registry =& AEFactory::getConfiguration(); if($task == 'default') { JToolBarHelper::title(JText::_('AKEEBA').': <small>'.JText::_('BUADMIN').'</small>','akeeba'); } else { JToolBarHelper::title(JText::_('AKEEBA').': <small>'.JText::_('BUADMINSRP').'</small>','akeeba'); } JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option='.JRequest::getCmd('option')); JToolBarHelper::spacer(); JToolBarHelper::deleteList(); JToolBarHelper::custom( 'deletefiles', 'delete.png', 'delete_f2.png', JText::_('STATS_LABEL_DELETEFILES'), true ); // Add custom submenus JSubMenuHelper::addEntry( JText::_('BUADMIN_LABEL_BACKUPS'), JURI::base().'index.php?option=com_akeeba&view='.JRequest::getCmd('view').'&task=default', ($task == 'default') ); JSubMenuHelper::addEntry( JText::_('BUADMIN_LABEL_SRP'), JURI::base().'index.php?option=com_akeeba&view='.JRequest::getCmd('view').'&task=restorepoint', ($task == 'restorepoint') ); if(AKEEBA_PRO && ($task == 'default')) { $bar = & JToolBar::getInstance('toolbar'); $bar->appendButton( 'Link', 'restore', JText::_('DISCOVER'), 'index.php?option=com_akeeba&view=discover' ); JToolBarHelper::publish('restore', JText::_('STATS_LABEL_RESTORE')); } if(($task == 'default')) { JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_EDITCOMMENT')); $pModel = JModel::getInstance('Profiles','AkeebaModel'); $enginesPerPprofile = $pModel->getPostProcessingEnginePerProfile(); $this->assign('enginesPerProfile', $enginesPerPprofile); } JToolBarHelper::spacer(); // "Show warning first" download button. Joomlantastic! $confirmationText = AkeebaHelperEscape::escapeJS( JText::_('STATS_LOG_DOWNLOAD_CONFIRM'), "'\n" ); $baseURI = JURI::base(); $js = <<<ENDSCRIPT function confirmDownloadButton() { var answer = confirm('$confirmationText'); if(answer) submitbutton('download'); } function confirmDownload(id, part) { var answer = confirm('$confirmationText'); var newURL = '$baseURI'; if(answer) { newURL += 'index.php?option=com_akeeba&view=buadmin&task=download&id='+id; if( part != '' ) newURL += '&part=' + part window.location = newURL; } } ENDSCRIPT; $document =& JFactory::getDocument(); $document->addScriptDeclaration($js); $document->addStyleSheet(JURI::base().'../media/com_akeeba/theme/akeebaui.css?'.AKEEBAMEDIATAG); $hash = 'akeebabuadmin'; // ...ordering $app = JFactory::getApplication(); $this->lists->set('order', $app->getUserStateFromRequest($hash.'filter_order', 'filter_order', 'backupstart')); $this->lists->set('order_Dir', $app->getUserStateFromRequest($hash.'filter_order_Dir', 'filter_order_Dir', 'DESC')); // ...filter state $this->lists->set('fltDescription', $app->getUserStateFromRequest($hash.'filter_description', 'description', null)); $this->lists->set('fltFrom', $app->getUserStateFromRequest($hash.'filter_from', 'from', null)); $this->lists->set('fltTo', $app->getUserStateFromRequest($hash.'filter_to', 'to', null)); $this->lists->set('fltOrigin', $app->getUserStateFromRequest($hash.'filter_origin', 'origin', null)); $this->lists->set('fltProfile', $app->getUserStateFromRequest($hash.'filter_profile', 'profile', null)); $filters = $this->_getFilters(); $ordering = $this->_getOrdering(); require_once JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'statistics.php'; $model = new AkeebaModelStatistics(); $list =& $model->getStatisticsListWithMeta(false, $filters, $ordering); // Assign data to the view $this->assignRef( 'lists', $this->lists); // Filter lists $this->assignRef( 'list', $list); // Data $this->assignRef( 'pagination', $model->getPagination($filters)); // Pagination object break; } // Add live help AkeebaHelperIncludes::addHelp(); parent::display(JRequest::getVar('tpl')); }
public function onBrowse($tpl = null) { $session = JFactory::getSession(); $task = $session->get('buadmin.task', 'default', 'akeeba'); if ($task != 'restorepoint') { $task = 'default'; } $aeconfig = AEFactory::getConfiguration(); // Add custom submenus if (AKEEBA_PRO) { $toolbar = F0FToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config); $toolbar->appendLink(JText::_('BUADMIN_LABEL_BACKUPS'), JURI::base() . 'index.php?option=com_akeeba&view=buadmin&task=browse', $task == 'default'); $toolbar->appendLink(JText::_('BUADMIN_LABEL_SRP'), JURI::base() . 'index.php?option=com_akeeba&view=buadmin&task=restorepoint', $task == 'restorepoint'); } if (AKEEBA_PRO && $task == 'default') { $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'restore', JText::_('DISCOVER'), 'index.php?option=com_akeeba&view=discover'); JToolBarHelper::publish('restore', JText::_('STATS_LABEL_RESTORE')); } if ($task == 'default') { JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_EDITCOMMENT')); $pModel = F0FModel::getTmpInstance('Profiles', 'AkeebaModel'); $enginesPerPprofile = $pModel->getPostProcessingEnginePerProfile(); $this->enginesPerProfile = $enginesPerPprofile; } JToolBarHelper::spacer(); // "Show warning first" download button. Joomlantastic! $confirmationText = AkeebaHelperEscape::escapeJS(JText::_('STATS_LOG_DOWNLOAD_CONFIRM'), "'\n"); $baseURI = JURI::base(); $js = <<<JS // This comment is intentionally put here to prevent badly written plugins from causing a Javascript error // due to missing trailing semicolon and/or newline in their code. function confirmDownloadButton() { \tvar answer = confirm('{$confirmationText}'); \tif(answer) submitbutton('download'); } function confirmDownload(id, part) { \tvar answer = confirm('{$confirmationText}'); \tvar newURL = '{$baseURI}'; \tif(answer) { \t\tnewURL += 'index.php?option=com_akeeba&view=buadmin&task=download&id='+id; \t\tif( part != '' ) newURL += '&part=' + part \t\twindow.location = newURL; \t} } JS; $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $hash = 'akeebabuadmin'; // ...ordering $app = JFactory::getApplication(); $this->lists->set('order', $app->getUserStateFromRequest($hash . 'filter_order', 'filter_order', 'backupstart')); $this->lists->set('order_Dir', $app->getUserStateFromRequest($hash . 'filter_order_Dir', 'filter_order_Dir', 'DESC')); // ...filter state $this->lists->set('fltDescription', $app->getUserStateFromRequest($hash . 'filter_description', 'description', null)); $this->lists->set('fltFrom', $app->getUserStateFromRequest($hash . 'filter_from', 'from', null)); $this->lists->set('fltTo', $app->getUserStateFromRequest($hash . 'filter_to', 'to', null)); $this->lists->set('fltOrigin', $app->getUserStateFromRequest($hash . 'filter_origin', 'origin', null)); $this->lists->set('fltProfile', $app->getUserStateFromRequest($hash . 'filter_profile', 'profile', null)); $filters = $this->_getFilters(); $ordering = $this->_getOrdering(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/statistics.php'; $model = new AkeebaModelStatistics(); $list = $model->getStatisticsListWithMeta(false, $filters, $ordering); // Assign data to the view $this->lists = $this->lists; // Filter lists $this->list = $list; // Data $this->pagination = $model->getPagination($filters); // Pagination object // Add live help if ($task == 'restorepoint') { $this->setLayout('restorepoint'); AkeebaHelperIncludes::addHelp('restorepoint'); } else { AkeebaHelperIncludes::addHelp('buadmin'); } return true; }
public function onBrowse($tpl = null) { $this->loadHelper('Utils'); $task = 'default'; if (AKEEBA_PRO && $task == 'default') { $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'restore', JText::_('DISCOVER'), 'index.php?option=com_akeeba&view=discover'); JToolBarHelper::publish('restore', JText::_('STATS_LABEL_RESTORE')); } if ($task == 'default') { JToolBarHelper::editList('showcomment', JText::_('STATS_LOG_EDITCOMMENT')); $pModel = F0FModel::getTmpInstance('Profiles', 'AkeebaModel'); $enginesPerPprofile = $pModel->getPostProcessingEnginePerProfile(); $this->enginesPerProfile = $enginesPerPprofile; } JToolBarHelper::spacer(); // "Show warning first" download button. Joomlantastic! $confirmationText = AkeebaHelperEscape::escapeJS(JText::_('STATS_LOG_DOWNLOAD_CONFIRM'), "'\n"); $baseURI = JUri::base(); $js = <<<JS ;// This comment is intentionally put here to prevent badly written plugins from causing a Javascript error // due to missing trailing semicolon and/or newline in their code. function confirmDownloadButton() { \tvar answer = confirm('{$confirmationText}'); \tif(answer) submitbutton('download'); } function confirmDownload(id, part) { \tvar answer = confirm('{$confirmationText}'); \tvar newURL = '{$baseURI}'; \tif(answer) { \t\tnewURL += 'index.php?option=com_akeeba&view=buadmin&task=download&id='+id; \t\tif( part != '' ) newURL += '&part=' + part \t\twindow.location = newURL; \t} } JS; $document = JFactory::getDocument(); $document->addScriptDeclaration($js); $hash = 'akeebabuadmin'; // ...ordering $app = JFactory::getApplication(); $this->lists->set('order', $app->getUserStateFromRequest($hash . 'filter_order', 'filter_order', 'backupstart')); $this->lists->set('order_Dir', $app->getUserStateFromRequest($hash . 'filter_order_Dir', 'filter_order_Dir', 'DESC')); // ...filter state $this->lists->set('fltDescription', $app->getUserStateFromRequest($hash . 'filter_description', 'description', null)); $this->lists->set('fltFrom', $app->getUserStateFromRequest($hash . 'filter_from', 'from', null)); $this->lists->set('fltTo', $app->getUserStateFromRequest($hash . 'filter_to', 'to', null)); $this->lists->set('fltOrigin', $app->getUserStateFromRequest($hash . 'filter_origin', 'origin', null)); $this->lists->set('fltProfile', $app->getUserStateFromRequest($hash . 'filter_profile', 'profile', null)); $filters = $this->_getFilters(); $ordering = $this->_getOrdering(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/statistics.php'; $model = new AkeebaModelStatistics(); $list = $model->getStatisticsListWithMeta(false, $filters, $ordering); $profilesModel = F0FModel::getTmpInstance('Profiles', 'AkeebaModel'); $profilesModel->reset()->clearState()->clearInput(); // Let's create an array indexed with the profile id for better handling $profiles = $profilesModel->getItemList(true, 'id'); $profilesList = array(JHtml::_('select.option', '', '–' . JText::_('STATS_LABEL_PROFILEID') . '–')); if (!empty($profiles)) { foreach ($profiles as $profile) { $profilesList[] = JHtml::_('select.option', $profile->id, '#' . $profile->id . '. ' . $profile->description); } } // Assign data to the view $this->profiles = $profiles; // Profiles $this->profilesList = $profilesList; // Profiles list for select box $this->list = $list; // Data $this->pagination = $model->getPagination($filters); // Pagination object return true; }