1<?php
2/**
3 * @package    Joomla.Administrator
4 *
5 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
6 * @license    GNU General Public License version 2 or later; see LICENSE.txt
7 */
8
9defined('_JEXEC') or die;
10
11/**
12 * Utility class for the submenu.
13 *
14 * @package     Joomla.Administrator
15 * @since       1.5
16 * @deprecated  4.0  Use JHtmlSidebar instead.
17 */
18abstract class JSubMenuHelper
19{
20	/**
21	 * Menu entries
22	 *
23	 * @var    array
24	 * @since  3.0
25	 * @deprecated  4.0
26	 */
27	protected static $entries = array();
28
29	/**
30	 * Filters
31	 *
32	 * @var    array
33	 * @since  3.0
34	 * @deprecated  4.0
35	 */
36	protected static $filters = array();
37
38	/**
39	 * Value for the action attribute of the form.
40	 *
41	 * @var    string
42	 * @since  3.0
43	 * @deprecated  4.0
44	 */
45	protected static $action = '';
46
47	/**
48	 * Method to add a menu item to submenu.
49	 *
50	 * @param   string   $name    Name of the menu item.
51	 * @param   string   $link    URL of the menu item.
52	 * @param   boolean  $active  True if the item is active, false otherwise.
53	 *
54	 * @return  void
55	 *
56	 * @since   1.5
57	 * @deprecated  4.0  Use JHtmlSidebar::addEntry() instead.
58	 */
59	public static function addEntry($name, $link = '', $active = false)
60	{
61		try
62		{
63			JLog::add(
64				sprintf('%s() is deprecated. Use JHtmlSidebar::addEntry() instead.', __METHOD__),
65				JLog::WARNING,
66				'deprecated'
67			);
68		}
69		catch (RuntimeException $exception)
70		{
71			// Informational log only
72		}
73
74		self::$entries[] = array($name, $link, $active);
75	}
76
77	/**
78	 * Returns an array of all submenu entries
79	 *
80	 * @return  array
81	 *
82	 * @since   3.0
83	 * @deprecated  4.0  Use JHtmlSidebar::getEntries() instead.
84	 */
85	public static function getEntries()
86	{
87		try
88		{
89			JLog::add(
90				sprintf('%s() is deprecated. Use JHtmlSidebar::getEntries() instead.', __METHOD__),
91				JLog::WARNING,
92				'deprecated'
93			);
94		}
95		catch (RuntimeException $exception)
96		{
97			// Informational log only
98		}
99
100		return self::$entries;
101	}
102
103	/**
104	 * Method to add a filter to the submenu
105	 *
106	 * @param   string   $label      Label for the menu item.
107	 * @param   string   $name       name for the filter. Also used as id.
108	 * @param   string   $options    options for the select field.
109	 * @param   boolean  $noDefault  Don't show the label as the empty option
110	 *
111	 * @return  void
112	 *
113	 * @since   3.0
114	 * @deprecated  4.0  Use JHtmlSidebar::addFilter() instead.
115	 */
116	public static function addFilter($label, $name, $options, $noDefault = false)
117	{
118		try
119		{
120			JLog::add(
121				sprintf('%s() is deprecated. Use JHtmlSidebar::addFilter() instead.', __METHOD__),
122				JLog::WARNING,
123				'deprecated'
124			);
125		}
126		catch (RuntimeException $exception)
127		{
128			// Informational log only
129		}
130
131		self::$filters[] = array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault);
132	}
133
134	/**
135	 * Returns an array of all filters
136	 *
137	 * @return  array
138	 *
139	 * @since   3.0
140	 * @deprecated  4.0  Use JHtmlSidebar::getFilters() instead.
141	 */
142	public static function getFilters()
143	{
144		try
145		{
146			JLog::add(
147				sprintf('%s() is deprecated. Use JHtmlSidebar::getFilters() instead.', __METHOD__),
148				JLog::WARNING,
149				'deprecated'
150			);
151		}
152		catch (RuntimeException $exception)
153		{
154			// Informational log only
155		}
156
157		return self::$filters;
158	}
159
160	/**
161	 * Set value for the action attribute of the filter form
162	 *
163	 * @param   string  $action  Value for the action attribute of the form
164	 *
165	 * @return  void
166	 *
167	 * @since   3.0
168	 * @deprecated  4.0  Use JHtmlSidebar::setAction() instead.
169	 */
170	public static function setAction($action)
171	{
172		try
173		{
174			JLog::add(
175				sprintf('%s() is deprecated. Use JHtmlSidebar::setAction() instead.', __METHOD__),
176				JLog::WARNING,
177				'deprecated'
178			);
179		}
180		catch (RuntimeException $exception)
181		{
182			// Informational log only
183		}
184
185		self::$action = $action;
186	}
187
188	/**
189	 * Get value for the action attribute of the filter form
190	 *
191	 * @return  string  Value for the action attribute of the form
192	 *
193	 * @since   3.0
194	 * @deprecated  4.0  Use JHtmlSidebar::getAction() instead.
195	 */
196	public static function getAction()
197	{
198		try
199		{
200			JLog::add(
201				sprintf('%s() is deprecated. Use JHtmlSidebar::getAction() instead.', __METHOD__),
202				JLog::WARNING,
203				'deprecated'
204			);
205		}
206		catch (RuntimeException $exception)
207		{
208			// Informational log only
209		}
210
211		return self::$action;
212	}
213}
214