33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-12-23 19:39:06 +00:00
patchtester/administrator/components/com_patchtester/views/pulls/view.html.php
2012-06-12 15:38:53 -05:00

82 lines
1.8 KiB
PHP

<?php
/**
* @package PatchTester
* @copyright Copyright (C) 2011 Ian MacLennan, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
/**
* View class for a list of pull requests.
*
* @package PatchTester
*/
class PatchtesterViewPulls extends JView
{
protected $items;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
//@TODO: move the check
$checkErrs = array();
if(false == extension_loaded ('openssl'))
$checkErrs[] = 'The OpenSSL extension must be installed and enabled in your php.ini';
if(false == in_array('https', stream_get_wrappers()))
$checkErrs[] = 'https wrappers must be enabled';
if (count($checkErrs))
{
$application = JFactory::getApplication();
$application->enqueueMessage(
'Your system does not meet the requirements to run the PullTester extension:'
, 'error');
foreach ($checkErrs as $error)
{
$application->enqueueMessage($error, 'error');
}
return $this;
}
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->patches = $this->get('AppliedPatches');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*/
protected function addToolbar()
{
JToolBarHelper::title('Joomla! Patch Tester', 'patchtester');
JToolBarHelper::preferences('com_patchtester');
JFactory::getDocument()->addStyleDeclaration(
'.icon-48-patchtester {background-image: url(components/com_patchtester/assets/images/icon-48-patchtester.png);}'
);
}
}