0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-03-15 22:04:51 +00:00
salesagility_SuiteCRM/include/templates/TemplateGroupChooser.php

186 lines
10 KiB
PHP
Raw Permalink Normal View History

2013-09-23 19:30:44 +00:00
<?php
/**
*
2013-09-23 19:30:44 +00:00
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
2018-01-19 13:22:29 +00:00
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
2014-07-07 15:33:23 +00:00
*
2013-09-23 19:30:44 +00:00
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
2014-07-07 15:33:23 +00:00
*
2013-09-23 19:30:44 +00:00
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
2013-09-23 19:30:44 +00:00
* details.
2014-07-07 15:33:23 +00:00
*
2013-09-23 19:30:44 +00:00
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
2014-07-07 15:33:23 +00:00
*
2013-09-23 19:30:44 +00:00
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
2014-07-07 15:33:23 +00:00
*
2013-09-23 19:30:44 +00:00
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
2014-07-07 15:33:23 +00:00
*
2013-09-23 19:30:44 +00:00
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
2014-07-07 15:33:23 +00:00
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
2013-09-23 19:30:44 +00:00
2019-01-25 13:51:46 +00:00
if (!defined('sugarEntry') || !sugarEntry) {
2016-11-30 11:05:03 +00:00
die('Not A Valid Entry Point');
}
2013-09-23 19:30:44 +00:00
$js_loaded = false;
require_once("include/templates/Template.php");
2019-01-25 13:51:46 +00:00
class TemplateGroupChooser extends Template
{
public $args;
public $js_loaded = false;
public $display_hide_tabs = true;
public $display_third_tabs = false;
2013-09-23 19:30:44 +00:00
public function __construct()
2019-01-25 13:51:46 +00:00
{
2013-09-23 19:30:44 +00:00
}
public function display()
2019-01-25 13:51:46 +00:00
{
2013-09-23 19:30:44 +00:00
global $app_strings, $mod_strings, $js_loaded;
2016-03-24 09:22:57 +00:00
2013-09-23 19:30:44 +00:00
$left_size = (empty($this->args['left_size']) ? '10' : $this->args['left_size']);
$right_size = (empty($this->args['right_size']) ? '10' : $this->args['right_size']);
$third_size = (empty($this->args['third_size']) ? '10' : $this->args['third_size']);
$max_left = (empty($this->args['max_left']) ? '' : $this->args['max_left']);
$alt_tip_up = $app_strings['LBL_ALT_MOVE_COLUMN_UP'];
$alt_tip_down = $app_strings['LBL_ALT_MOVE_COLUMN_DOWN'];
$alt_tip_left = $app_strings['LBL_ALT_MOVE_COLUMN_LEFT'];
$alt_tip_right = $app_strings['LBL_ALT_MOVE_COLUMN_RIGHT'];
2016-03-24 09:22:57 +00:00
2013-09-23 19:30:44 +00:00
$str = '';
2019-01-25 13:51:46 +00:00
if ($js_loaded == false) {
2013-09-23 19:30:44 +00:00
// $this->template_groups_chooser_js();
$js_loaded = true;
}
2019-01-25 13:51:46 +00:00
if (!isset($this->args['display'])) {
2013-09-23 19:30:44 +00:00
$table_style = "";
2019-01-25 13:51:46 +00:00
} else {
2013-09-23 19:30:44 +00:00
$table_style = "display: ".$this->args['display'];
}
$str .= "<div id=\"{$this->args['id']}\" style=\"{$table_style}\">";
2019-01-25 13:51:46 +00:00
if (!empty($this->args['title'])) {
$str .= "<h4>{$this->args['title']}</h4>";
}
2013-09-23 19:30:44 +00:00
$str .= <<<EOQ
<table cellpadding="0" cellspacing="0" border="0">
2016-03-24 09:22:57 +00:00
2013-09-23 19:30:44 +00:00
<tr>
<td>&nbsp;</td>
<td scope="row" id="chooser_{$this->args['left_name']}_text" align="center"><nobr>{$this->args['left_label']}</nobr></td>
EOQ;
2019-01-25 13:51:46 +00:00
if ($this->display_hide_tabs == true) {
$str .= <<<EOQ
2013-09-23 19:30:44 +00:00
<td>&nbsp;</td>
<td scope="row" id="chooser_{$this->args['right_name']}" align="center"><nobr>{$this->args['right_label']}</nobr></td>
EOQ;
}
2016-03-24 09:22:57 +00:00
2019-01-25 13:51:46 +00:00
if ($this->display_third_tabs == true) {
$str .= <<<EOQ
2013-09-23 19:30:44 +00:00
<td>&nbsp;</td>
<td>&nbsp;</td>
<td scope="row" id="chooser_{$this->args['third_name']}" align="center"><nobr>{$this->args['third_label']}</nobr></td>
EOQ;
}
2016-03-24 09:22:57 +00:00
2013-09-23 19:30:44 +00:00
$str .= '<td>&nbsp;</td></tr><tr><td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
2019-01-25 13:51:46 +00:00
if (!isset($this->args['disable'])) {
2019-01-25 14:14:52 +00:00
$str .= "<a id='chooser_{$this->args['left_name']}_up_arrow' onclick=\"return SUGAR.tabChooser.up('{$this->args['left_name']}','{$this->args['left_name']}','{$this->args['right_name']}');\">" . SugarThemeRegistry::current()->getImage('uparrow_big', 'border="0" style="margin-bottom: 1px;"', null, null, '.gif', $alt_tip_up) . "</a><br>
<a id='chooser_{$this->args['right_name']}_down_arrow' onclick=\"return SUGAR.tabChooser.down('{$this->args['left_name']}','{$this->args['left_name']}','{$this->args['right_name']}');\">" . SugarThemeRegistry::current()->getImage('downarrow_big', 'border="0" style="margin-top: 1px;"', null, null, '.gif', $alt_tip_down) . "</a>";
2013-09-23 19:30:44 +00:00
}
2016-03-24 09:22:57 +00:00
2013-09-23 19:30:44 +00:00
$str .= <<<EOQ
2016-03-24 09:22:57 +00:00
</td>
2013-09-23 19:30:44 +00:00
<td align="center">
<table border="0" cellspacing=0 cellpadding="0" align="center">
<tr>
<td id="{$this->args['left_name']}_td" align="center">
<select id="{$this->args['left_name']}" name="{$this->args['left_name']}[]" size=
EOQ;
2016-11-24 10:12:03 +00:00
$str .= '"' . (empty($this->args['left_size']) ? '10' : $this->args['left_size']) . '" multiple="multiple" ' . (isset($this->args['disable']) ? "DISABLED" : '') . 'class="templateGroupChooser">';
2013-09-23 19:30:44 +00:00
2019-01-25 13:51:46 +00:00
foreach ($this->args['values_array'][0] as $key=>$value) {
2013-09-23 19:30:44 +00:00
$str .= "<option value='{$key}'>{$value}</option>";
}
$str .= "</select></td>
</tr>
</table>
</td>";
if ($this->display_hide_tabs == true) {
$str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
2019-01-25 13:51:46 +00:00
if (!isset($this->args['disable'])) {
2019-01-25 14:14:52 +00:00
$str .= "<a id='chooser_{$this->args['left_name']}_left_arrow' onclick=\"return SUGAR.tabChooser.right_to_left('{$this->args['left_name']}','{$this->args['right_name']}', '{$left_size}', '{$right_size}', '{$max_left}');\">" . SugarThemeRegistry::current()->getImage('leftarrow_big', 'border="0" style="margin-right: 1px;"', null, null, '.gif', $alt_tip_left) . "</a><a id='chooser_{$this->args['left_name']}_left_to_right' onclick=\"return SUGAR.tabChooser.left_to_right('{$this->args['left_name']}','{$this->args['right_name']}', '{$left_size}', '{$right_size}');\">" . SugarThemeRegistry::current()->getImage('rightarrow_big', 'border="0" style="margin-left: 1px;"', null, null, '.gif', $alt_tip_right) . "</a>";
2013-09-23 19:30:44 +00:00
}
$str .= "</td>
<td id=\"{$this->args['right_name']}_td\" align=\"center\">
2016-11-24 10:12:03 +00:00
<select id=\"{$this->args['right_name']}\" name=\"{$this->args['right_name']}[]\" size=\"" . (empty($this->args['right_size']) ? '10' : $this->args['right_size']) . "\" multiple=\"multiple\" " . (isset($this->args['disable']) ? "DISABLED" : '') . 'class="groupChooser">';
2019-01-25 13:51:46 +00:00
foreach ($this->args['values_array'][1] as $key=>$value) {
2013-09-23 19:30:44 +00:00
$str .= "<option value=\"{$key}\">{$value}</option>";
}
$str .= "</select></td><td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">"
. "<script>var object_refs = new Object();object_refs['{$this->args['right_name']}'] = document.getElementById('{$this->args['right_name']}');</script>";
}
2016-03-24 09:22:57 +00:00
if ($this->display_third_tabs == true) {
2013-09-23 19:30:44 +00:00
$str .= '<td valign="top" style="padding-right: 2px; padding-left: 2px;" align="center">';
2019-01-25 13:51:46 +00:00
if (!isset($this->args['disable'])) {
2019-01-25 14:14:52 +00:00
$str .= "<a id='chooser_{$this->args['right_name']}_right_arrow' onclick=\"return SUGAR.tabChooser.right_to_left('{$this->args['right_name']}','{$this->args['third_name']}', '{$right_size}', '{$third_size}');\">" . SugarThemeRegistry::current()->getImage('leftarrow_big', 'border="0" style="margin-right: 1px;"', null, null, '.gif', $alt_tip_left) . "</a><a id='chooser_{$this->args['right_name']}_left_to_right' onclick=\"return SUGAR.tabChooser.left_to_right('{$this->args['right_name']}','{$this->args['third_name']}', '{$right_size}', '{$third_size}');\">" . SugarThemeRegistry::current()->getImage('rightarrow_big', 'border="0" style="margin-left: 1px;"', null, null, '.gif', $alt_tip_right) . "</a>";
2013-09-23 19:30:44 +00:00
}
$str .= "</td>
<td id=\"{$this->args['third_name']}_td\" align=\"center\">
2016-11-24 10:12:03 +00:00
<select id=\"{$this->args['third_name']}\" name=\"{$this->args['third_name']}[]\" size=\"" . (empty($this->args['third_size']) ? '10' : $this->args['third_size']) . "\" multiple=\"multiple\" " . (isset($this->args['disable']) ? "DISABLED" : '') . 'class="templateGroupChooser">';
2019-01-25 13:51:46 +00:00
foreach ($this->args['values_array'][2] as $key=>$value) {
2013-09-23 19:30:44 +00:00
$str .= "<option value=\"{$key}\">{$value}</option>";
}
$str .= "</select>
<script>
object_refs['{$this->args['third_name']}'] = document.getElementById('{$this->args['third_name']}');
</script>
<td valign=\"top\" style=\"padding-right: 2px; padding-left: 2px;\" align=\"center\">
</td>";
}
$str .= "<script>
2013-09-23 19:30:44 +00:00
object_refs['{$this->args['left_name']}'] = document.getElementById('{$this->args['left_name']}');
</script></tr>
</table></div>";
2016-03-24 09:22:57 +00:00
2013-09-23 19:30:44 +00:00
return $str;
}
2013-09-23 19:30:44 +00:00
/*
* All Moved to sugar_3.js in class tabChooser;
* Please follow style that Dashlet configuration is done.
2016-03-24 09:22:57 +00:00
*/
public function template_groups_chooser_js()
2019-01-25 13:51:46 +00:00
{
2013-09-23 19:30:44 +00:00
//return '<script>var object_refs = new Object();</script>';
}
}