-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolbar.php
172 lines (140 loc) · 5.28 KB
/
toolbar.php
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/**
* @package AdminTools
* @copyright Copyright (c)2010-2013 Nicholas K. Dionysopoulos
* @license GNU General Public License version 3, or later
*/
// Protect from unauthorized access
defined('_JEXEC') or die();
class BgToolbar extends FOFToolbar
{
public function onBrowse()
{
parent::onBrowse();
JToolBarHelper::divider();
JToolBarHelper::spacer('100%');
$this->addListsBtn();
$this->addLabelsBtn();
JToolbarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_bg&view=profiles');
}
public function onProfilesBrowse()
{
//custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true)
$subtitle_key = 'Customers';//'COM_BG_TITLE_PROFILES';//.strtoupper($this->input->getCmd('view','printings'));
JToolBarHelper::title(JText::_('COM_BG').' – '.JText::_($subtitle_key), 'users');
//$this->onBrowse();
// Add toolbar buttons
// if($this->perms->delete) {
// JToolBarHelper::deleteList();
// }
if($this->perms->edit) {
JToolBarHelper::editList();
JToolBarHelper::archiveList('archive', 'Pick Up Only');
// JToolBarHelper::publishList();
JToolBarHelper::unpublishList('unpublish', 'Missing');
JToolBarHelper::trash('trash', 'Close');
}
// if($this->perms->create) {
// JToolBarHelper::addNew();
// }
JToolBarHelper::divider();
JToolBarHelper::spacer('100%');
$this->addListsBtn();
$this->addLabelsBtn();
// JToolBarHelper::preferences('com_bg', '500');
//JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', 'JLIB_HTML_BATCH_COPY', false);
//JToolBarHelper::custom('printings.browse', 'copy.png', 'copy_f2.png', 'Labels', false);
$this->renderSubmenu();
}
public function onPrintingsBrowse()
{
//custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true)
$subtitle_key = 'Things to Print';//'COM_BG_TITLE_PROFILES';//.strtoupper($this->input->getCmd('view','printings'));
JToolBarHelper::title(JText::_('COM_BG').' – '.JText::_($subtitle_key), 'print');
JToolBarHelper::divider();
$this->addListsBtn();
$this->addLabelsBtn();
JToolbarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_bg&view=profiles');
}
protected function addLabelsBtn()
{
$options['class'] = 'copy';
$options['a.class'] = '';
$options['a.href'] = 'index.php?option=com_bg&view=printings&tmpl=component&print=1&layout=labels';
$options['a.target'] = '_blank';
$options['text'] = JText::_('Labels');
$this->addCustomBtn('print-labels', $options);
}
protected function addListsBtn()
{
$deloptions['class'] = 'list';
$deloptions['a.class'] = 'btn-primary';
$deloptions['a.href'] = 'index.php?option=com_bg&view=printings&tmpl=component&print=1&layout=deliverlist&page=';
$deloptions['a.target'] = '_blank';
$deloptions['text'] = JText::_('Delivery List');
$this->addCustomBtn('print-deliverlist', $deloptions);
$packoptions['class'] = 'cart';
$packoptions['a.class'] = 'btn-inverse';
$packoptions['a.href'] = 'index.php?option=com_bg&view=printings&tmpl=component&print=1&layout=packlist&page=';
$packoptions['a.target'] = '_blank';
$packoptions['text'] = JText::_('Packing List');
$this->addCustomBtn('print-packlist', $packoptions);
}
protected function addCustomBtn($id, $options = array())
{
$options = (array) $options;
if (version_compare(JVERSION, '3.0', 'ge'))
{
$a_class = 'btn btn-small';
}
else
{
$a_class = 'toolbar';
}
$href = '';
$task = '';
$text = '';
$rel = '';
$target = '';
$other = '';
if(isset($options['a.class'])) $a_class .= ' ' . $options['a.class'];
if(isset($options['a.href'])) $href = $options['a.href'];
if(isset($options['a.task'])) $task = $options['a.task'];
if(isset($options['a.target'])) $target = $options['a.target'];
if(isset($options['a.other'])) $other = $options['a.other'];
if(isset($options['text'])) $text = $options['text'];
if(isset($options['class']))
{
$class = $options['class'];
}
else
{
$class = 'default';
}
if(isset($options['modal']))
{
JHTML::_('behavior.modal');
$a_class .= ' modal';
$rel = "'handler':'iframe'";
if(is_array($options['modal']))
{
if(isset($options['modal']['size']['x']) && isset($options['modal']['size']['y']))
{
$rel .= ", 'size' : {'x' : ".$options['modal']['size']['x'].", 'y' : ".$options['modal']['size']['y']."}";
}
}
}
$html = '<a id="'.$id.'" class="'.$a_class.'" alt="'.$text.'"';
if($rel) $html .= ' rel="{'.$rel.'}"';
if($href) $html .= ' href="'.$href.'"';
if($task) $html .= " onclick=\"javascript:submitbutton('".$task."')\"";
if($target) $html .= ' target="'.$target.'"';
if($other) $html .= ' '.$other;
$html .= ' >';
$html .= '<span class="icon icon-'.$class.'" title="'.$text.'" > </span>';
$html .= ' ' . $text;
$html .= '</a>';
$bar = JToolBar::getInstance();
$bar->appendButton('Custom', $html, $id);
}
}