Passed
Pull Request — develop (#922)
by Tito
07:09
created

RedcoreViewWebservice_History_Log   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 32
c 1
b 0
f 0
dl 0
loc 90
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTitle() 0 3 1
A display() 0 34 3
A getToolbar() 0 20 2
1
<?php
2
/**
3
 * @package     Redcore.Admin
4
 * @subpackage  Views
5
 *
6
 * @copyright   Copyright (C) 2008 - 2016 redCOMPONENT.com. All rights reserved.
7
 * @license     GNU General Public License version 2 or later, see LICENSE.
8
 */
9
10
defined('_JEXEC') or die;
11
12
/**
13
 * Webservice History Log View
14
 *
15
 * @package     Redcore.Admin
16
 * @subpackage  Views
17
 * @since       1.2
18
 */
19
class RedcoreViewWebservice_History_Log extends RedcoreHelpersView
20
{
21
	/**
22
	 * @var JForm
23
	 */
24
	public $form;
25
26
	/**
27
	 * @var object
28
	 */
29
	public $item;
30
31
	/**
32
	 * Display method
33
	 *
34
	 * @param   string  $tpl  The template name
35
	 *
36
	 * @return  void
37
	 */
38
	public function display($tpl = null)
39
	{
40
		$this->form	= $this->get('Form');
41
		$this->item	= $this->get('Item');
42
43
		// Check if option is enabled
44
		if (RBootstrap::getConfig('enable_webservices', 0) == 0)
45
		{
46
			JFactory::getApplication()->enqueueMessage(
47
				JText::sprintf(
48
					'COM_REDCORE_WEBSERVICES_PLUGIN_LABEL_WARNING',
49
					'<a href="index.php?option=com_redcore&view=config&layout=edit&component=com_redcore">'
50
					. JText::_('COM_REDCORE_CONFIGURE')
51
					. '</a>'
52
				),
53
				'error'
54
			);
55
		}
56
57
		// Check if option is enabled
58
		if (RBootstrap::getConfig('enable_webservice_history_log', 0) == 0)
59
		{
60
			JFactory::getApplication()->enqueueMessage(
61
				JText::sprintf(
62
					'COM_REDCORE_WEBSERVICES_HISTORY_LOGS_PLUGIN_LABEL_WARNING',
63
					'<a href="index.php?option=com_redcore&view=config&layout=edit&component=com_redcore&return=' . $this->return . '">'
64
					. JText::_('COM_REDCORE_CONFIGURE')
65
					. '</a>'
66
				),
67
				'error'
68
			);
69
		}
70
71
		parent::display($tpl);
72
	}
73
74
	/**
75
	 * Get the view title.
76
	 *
77
	 * @return string  The view title.
78
	 */
79
	public function getTitle()
80
	{
81
		return JText::_('COM_REDCORE_WEBSERVICE_HISTORY_LOG_TITLE');
82
	}
83
84
	/**
85
	 * Get the toolbar to render.
86
	 *
87
	 * @return RToolbar
88
	 */
89
	public function getToolbar()
90
	{
91
		$group = new RToolbarButtonGroup;
92
93
		if (empty($this->item->id))
94
		{
95
			$cancel = RToolbarBuilder::createCancelButton('webservice_history_log.cancel');
96
		}
97
98
		else
99
		{
100
			$cancel = RToolbarBuilder::createCloseButton('webservice_history_log.cancel');
101
		}
102
103
		$group->addButton($cancel);
104
105
		$toolbar = new RToolbar;
106
		$toolbar->addGroup($group);
107
108
		return $toolbar;
109
	}
110
}
111