itemid.php
2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/* ======================================================
# Monthly Archive - Joomla! Component v4.3.3 (PRO version)
# -------------------------------------------------------
# For Joomla! 3.x
# Author: Yiannis Christodoulou (yiannis@web357.eu)
# Copyright (©) 2009-2018 Web357. All rights reserved.
# License: GNU/GPLv3, http://www.gnu.org/licenses/gpl-3.0.html
# Website: https://www.web357.eu/
# Demo: http://demo.web357.eu/?item=monthlyarchive
# Support: support@web357.eu
# Last modified: 09 Feb 2018, 13:55:18
========================================================= */
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
jimport( 'joomla.form.form' );
class JFormFielditemid extends JFormField {
protected $type = 'itemid';
protected function getLabel()
{
return '<label id="jform_params_itemid-lbl" for="jform_params_itemid" class="hasTooltip" title="<strong>'.JText::_('MOD_MONTHLYARCHIVE').' - '.JText::_('MOD_MONTHLYARCHIVE_MENU_ITEMID_LBL').'</strong><br />'.JText::_('MOD_MONTHLYARCHIVE_MENU_ITEMID_DESC').'">'.JText::_('MOD_MONTHLYARCHIVE_MENU_ITEMID_LBL').'</label>';
}
protected function getInput()
{
// Get item ids from menu manager, that are assigned with Monthly Archive.
$db = JFactory::getDBO();
$query = "SELECT m.*, ext.* "
."FROM #__menu AS m "
."LEFT JOIN #__extensions AS ext ON ext.extension_id = m.component_id "
."WHERE m.link = 'index.php?option=com_monthlyarchive&view=archive' AND m.client_id = 0 AND m.published = 1 AND (ext.type = 'component' OR ext.type = 'module') "
;
$db->setQuery($query);
$db->query();
$item_ids = $db->loadObjectlist();
$html = '';
$html .= '<select id="'.$this->id.'" name="'.$this->name.'" class="bg_layout_type" style="width: 300px;">';
$html .= '<option value="">Select a Menu Item</option>';
foreach ($item_ids as $item_id):
$html .= '<option value="'.$item_id->id.'"'.(($this->value == $item_id->id) ? ' selected="selected"' : '').'>';
$html .= $item_id->title.' (';
$html .= 'id:'.$item_id->id;
$html .= ($item_id->language != '*') ? ' - language: '.$item_id->language : '';
$html .= ')';
$html .= '</option>';
endforeach;
$html .= '</select> ';
return $html;
}
}