]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/Smarty/plugins/function.sugar_button_slider.php
Release 6.5.0
[Github/sugarcrm.git] / include / Smarty / plugins / function.sugar_button_slider.php
1 <?php
2
3 /*
4
5 Modification information for LGPL compliance
6
7 r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
8
9 r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
10
11 r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
12
13 r53865 - 2010-01-19 21:51:54 -0800 (Tue, 19 Jan 2010) - lam - updated styles for button slider
14
15 r53792 - 2010-01-18 13:37:35 -0800 (Mon, 18 Jan 2010) - roger - adding code to support slider buttons.
16
17
18 */
19
20
21 /**
22  * smarty_function_sugar_button
23  * This is the constructor for the Smarty plugin.
24  *
25  * @param $params The runtime Smarty key/value arguments
26  * @param $smarty The reference to the Smarty object used in this invocation
27  */
28 function smarty_function_sugar_button_slider($params, &$smarty)
29 {
30    if(empty($params['module'])) {
31           $smarty->trigger_error("sugar_button_slider: missing required param (module)");
32    } else if(empty($params['buttons'])) {
33           $smarty->trigger_error("sugar_button_slider: missing required param (buttons)");
34    } else if(empty($params['view'])) {
35           $smarty->trigger_error("sugar_button_slider: missing required param (view)");
36    }
37         $module = $params['module'];
38         $view = $params['view'];
39         $buttons = $params['buttons'];
40         $str = '';
41    if(is_array($buttons)) {
42           if(count($buttons) <= 2){
43                 foreach($buttons as $val => $button){
44                         $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty);
45                 }
46           }else{
47                 $str  = '<div id="buttonSlide" class="yui-module">';
48                 $str .= '<table border="0">';
49                 $str .='<tr><td>';
50                 $str .='<div class="yui-hd">';
51                 for($i = 0; $i < 2; $i++){
52                         $button = $buttons[$i];
53                         $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty);
54                         $str .= ' ';
55                 }
56                 $str .= '</div></td>';
57                 $str .='<td align="right"> <div class="yui-bd">';
58                 for($i = 2; $i < count($buttons); $i++){
59                         $button = $buttons[$i];
60                         $str .= smarty_function_sugar_button(array('module' => $module, 'id' => $button, 'view' => $view), $smarty);
61                         $str .= ' ';
62                 }
63                 $str .='</div></td>';
64                 $str .='</tr></table>';
65           }
66    }
67         return $str;
68 }
69
70 ?>