1<?php
2/**
3 * @package     Joomla.Administrator
4 * @subpackage  com_actionlogs
5 *
6 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
7 * @license     GNU General Public License version 2 or later; see LICENSE.txt
8 */
9
10defined('_JEXEC') or die;
11
12use Joomla\CMS\Factory;
13use Joomla\CMS\Form\FormHelper;
14
15FormHelper::loadFieldClass('predefinedlist');
16
17/**
18 * Field to show a list of range dates to sort with
19 *
20 * @since  3.9.0
21 */
22class JFormFieldLogsDateRange extends JFormFieldPredefinedList
23{
24	/**
25	 * The form field type.
26	 *
27	 * @var     string
28	 * @since   3.9.0
29	 */
30	protected $type = 'logsdaterange';
31
32	/**
33	 * Available options
34	 *
35	 * @var    array
36	 * @since  3.9.0
37	 */
38	protected $predefinedOptions = array(
39		'today'       => 'COM_ACTIONLOGS_OPTION_RANGE_TODAY',
40		'past_week'   => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_WEEK',
41		'past_1month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_1MONTH',
42		'past_3month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_3MONTH',
43		'past_6month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_6MONTH',
44		'past_year'   => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_YEAR',
45	);
46
47	/**
48	 * Method to instantiate the form field object.
49	 *
50	 * @param   JForm  $form  The form to attach to the form field object.
51	 *
52	 * @since  3.9.0
53	 */
54	public function __construct($form = null)
55	{
56		parent::__construct($form);
57
58		// Load the required language
59		$lang = Factory::getLanguage();
60		$lang->load('com_actionlogs', JPATH_ADMINISTRATOR);
61	}
62}
63