]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/Smarty/plugins/function.sugar_link.php
Release 6.5.0
[Github/sugarcrm.git] / include / Smarty / plugins / function.sugar_link.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 r54347 - 2010-02-08 09:41:14 -0800 (Mon, 08 Feb 2010) - jmertic - Bug 35509 - Have any module that is not a submodule of one of the modules in the module bar list show up at the end of the module bar when it is active. Also, disable the sub-nav bar for now.
14
15 r53116 - 2009-12-09 17:24:37 -0800 (Wed, 09 Dec 2009) - mitani - Merge Kobe into Windex Revision 51633 to 53087
16
17 r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3  tags and updated the build system 
18
19 r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
20
21 r50752 - 2009-09-10 15:18:28 -0700 (Thu, 10 Sep 2009) - dwong - Merged branches/tokyo from revision 50372 to 50729 to branches/kobe2
22 Discard lzhang r50568 changes in Email.php and corresponding en_us.lang.php
23
24 r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
25
26 r49253 - 2009-07-02 16:46:02 -0700 (Thu, 02 Jul 2009) - faissah - 31534 The site name can't show in navigation bar
27
28 r42807 - 2008-12-29 11:16:59 -0800 (Mon, 29 Dec 2008) - dwong - Branch from trunk/sugarcrm r42806 to branches/tokyo/sugarcrm
29
30 r42268 - 2008-12-02 13:29:54 -0800 (Tue, 02 Dec 2008) - rob - Get some tweaks to core code done to prepare for an AJAX UI
31
32
33 */
34
35
36 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
37 /*********************************************************************************
38  * SugarCRM Community Edition is a customer relationship management program developed by
39  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
40  * 
41  * This program is free software; you can redistribute it and/or modify it under
42  * the terms of the GNU Affero General Public License version 3 as published by the
43  * Free Software Foundation with the addition of the following permission added
44  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
45  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
46  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
47  * 
48  * This program is distributed in the hope that it will be useful, but WITHOUT
49  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
50  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
51  * details.
52  * 
53  * You should have received a copy of the GNU Affero General Public License along with
54  * this program; if not, see http://www.gnu.org/licenses or write to the Free
55  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
56  * 02110-1301 USA.
57  * 
58  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
59  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
60  * 
61  * The interactive user interfaces in modified source and object code versions
62  * of this program must display Appropriate Legal Notices, as required under
63  * Section 5 of the GNU Affero General Public License version 3.
64  * 
65  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
66  * these Appropriate Legal Notices must retain the display of the "Powered by
67  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
68  * technical reasons, the Appropriate Legal Notices must display the words
69  * "Powered by SugarCRM".
70  ********************************************************************************/
71
72
73
74 function smarty_function_sugar_link($params, &$smarty)
75 {
76         if(empty($params['module'])){
77                 $smarty->trigger_error("sugar_link: missing 'module' parameter");
78                 return;
79         }
80         if(!empty($params['data']) && is_array($params['data'])){
81                 $link_url = 'index.php?';
82                 $link_url .= 'module=iFrames&action=index';
83                 $link_url .= '&record='.$params['data']['0'];
84                 $link_url .= '&tab=true';
85     }else{
86                 $action = (!empty($params['action']))?$params['action']:'index';
87             
88             $link_url = 'index.php?';
89             $link_url .= 'module='.$params['module'].'&action='.$action;
90         
91             if (!empty($params['record'])) { $link_url .= "&record=".$params['record']; }
92             if (!empty($params['extraparams'])) { $link_url .= '&'.$params['extraparams']; }
93         }
94         
95         if (isset($params['link_only']) && $params['link_only'] == 1 ) {
96         // Let them just get the url, they want to put it someplace
97         return ajaxLink($link_url);
98     }
99         
100         $id = (!empty($params['id']))?' id="'.$params['id'].'"':'';
101         $class = (!empty($params['class']))?' class="'.$params['class'].'"':'';
102         $style = (!empty($params['style']))?' style="'.$params['style'].'"':'';
103         $title = (!empty($params['title']))?' title="'.$params['title'].'"':'';
104     $module = ' module="'.$params['module'].'"';
105         $accesskey = (!empty($params['accesskey']))?' accesskey="'.$params['accesskey'].'" ':'';
106     $options = (!empty($params['options']))?' '.$params['options'].'':'';
107     if(!empty($params['data']) && is_array($params['data']))
108                 $label =$params['data']['4'];
109         elseif ( !empty($params['label']) )
110             $label = $params['label'];
111         else
112             $label = (!empty($GLOBALS['app_list_strings']['moduleList'][$params['module']]))?$GLOBALS['app_list_strings']['moduleList'][$params['module']]:$params['module'];
113
114     $link = '<a href="'.ajaxLink($link_url).'"'.$id.$class.$style.$options.$title.$module.'>'.$label.'</a>';
115     return $link;
116 }