grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026deprecated($deprecatedMessage); } else { trigger_error($deprecatedMessage, E_USER_DEPRECATED); } self::__construct(); } /* * This function creates the html and uses the args parameter to call the class file * ideally, you would want to call the displayScriptTags() function, * followed by the displayDefinitionScript(); * and lastly call the display function */ public function display() { /* valid entries for expected arguments array are as follow: * args['left_header'] = value of left table header * args['mid_header'] = value of middle table header * args['right_header'] = value of right table header * args['left_data'] = array to use in left data. * args['mid_data'] = array to use in middle data. * args['right_data'] =array to use in right data. * args['title'] = title (if any) to be used. * args['classname'] = name to be used as class. This helps when defining multiple templates on one screen. * args['left_div_name'] = Name to be used for left div (should be unique) * args['mid_div_name'] = Name to be used for middle div (should be unique) * args['right_div_name'] = Name to be used for right div (should be unique) * args['gridcount'] = Number of grids to show. Acceptable Values are 'one','two' and 'three' * The string is converted to numeric values, so you could also set these directly * The values are Zero Based, so to display one column, set to '0' * To display two columns set to '1', to display three columns set to '2'. * $this->args['return_array']= if this is set to true, then 'display()' function returns html and javascript * in array format. This will allow granular control of html so that you can * separate the tables and customize the grid */ //convert values for gridcount in case they are in string form if ($this->args['gridcount'] == 'one') { $this->args['gridcount'] = 0; } elseif ($this->args['gridcount'] == 'two') { $this->args['gridcount'] = 1; } elseif ( $this->args['gridcount'] == 'three') { $this->args['gridcount'] = 2; } if (!isset($this->args['classname']) || empty($this->args['classname'])) { $this->args['classname'] = 'DragDropGrid'; } $json = getJSONobj(); //use Json to encode the arrays of data, for passing to javascript. //we will always display at least one column, so set left column $this->args['left_data'][] = array(' ', ' '); $data0_enc = $json->encode($this->args['left_data']); $left_div_name = $this->args['left_div_name']; //if count is set to 1, then we are displaying two columns, set the 2 column variables if ($this->args['gridcount']==1) { $this->args['right_data'][] = array(' ', ' '); $data1_enc = $json->encode($this->args['right_data']); $right_div_name = $this->args['right_div_name']; } //if count is set to 2, then we are displaying three columns, set the 3 column variables if ($this->args['gridcount']==2) { $this->args['mid_data'][] = array(' ', ' '); $data1_enc = $json->encode($this->args['mid_data']); $mid_div_name = $this->args['mid_div_name']; $this->args['right_data'][] = array(' ', ' '); $data2_enc = $json->encode($this->args['right_data']); $right_div_name = $this->args['right_div_name']; } $html_str_arr = array(); //create the table, with the divs that will get populated. Populate both the string and array version $html_str = "
"; $html_str_arr['begin'] = $html_str; $html_str .= ""; $html_str_arr['left'] = ""; //set the middle column only if we are displaying 3 columns if ($this->args['gridcount']==2) { $html_str .= ""; $html_str_arr['middle'] = ""; } //set the right column if we are not in 1 column only mode if ($this->args['gridcount']>0) { $html_str .= ""; $html_str_arr['right'] = ""; } $html_str .= "
"; $html_str_arr['end'] = ""; //create the needed javascript to set the values and invoke listener $j_str = " "; //return display string $str = $j_str . ' ' . $html_str; $html_str_arr['script'] = $j_str; if (isset($this->args['return_array']) && $this->args['return_array']) { return $html_str_arr; } else { return $str; } } /* * This script is the javascript class definition for the template drag drop object. This * makes use of the args['classname'] parameter to name the class and to prefix variables with. This is done * dynamically so that multiple template dragdrop objects can be defined on the same page if needed * without having the variables mix up as you drag rows around. */ public function displayDefinitionScript() { //create some defaults in case arguments are missing //convert values for gridcount in case they are in string form if (!isset($this->args['gridcount']) || empty($this->args['gridcount']) || $this->args['gridcount'] == 'one') { $this->args['gridcount'] = 0; } elseif ($this->args['gridcount'] == 'two') { $this->args['gridcount'] = 1; } elseif ( $this->args['gridcount'] == 'three') { $this->args['gridcount'] = 2; } //default class name if (!isset($this->args['classname']) || empty($this->args['classname'])) { $this->args['classname'] = 'DragDropGrid'; } //default columns to one if the value is set to anything other than the expected 0,1 or 2 if (($this->args['gridcount'] != 0) && ($this->args['gridcount'] != 1) && ($this->args['gridcount'] != 2)) { $this->args['gridcount'] = 0; } //default div names if (!isset($this->args['left_div_name']) || empty($this->args['left_div_name'])) { $this->args['left_div_name'] = 'left'; } if (!isset($this->args['mid_div_name']) || empty($this->args['mid_div_name'])) { $this->args['mid_div_name'] = 'mid'; } if (!isset($this->args['right_div_name']) || empty($this->args['right_div_name'])) { $this->args['right_div_name'] = 'right'; } //create javascript that defines the javascript class for this instance //start by defining the variables that the grids will be referenced by $j_str = " "; //all done, return final script return $j_str; } /* * this function returns the src style sheet and script tags that need to be included * for the template chooser to work */ public function displayScriptTags() { global $sugar_version, $sugar_config; $j_str = " "; return $j_str; } }