Ejemplo n.º 1
0
 /**
  * Draws the pager onto the current template (meant to be invoked from template or ajax
  * function).
  *
  * @param boolean don't draw the overflow contaner.
  * @return void
  */
 public function draw($noOverflow = false)
 {
     /* Get data. */
     $this->_getData();
     $md5InstanceName = md5($this->_instanceName);
     $this->_totalColumnWidths = 0;
     /* Build cell indexes for cell headers. */
     $cellIndexes = array();
     foreach ($this->_currentColumns as $index => $data) {
         $cellIndexes[] = $index;
     }
     /* Do not draw elements that exist outside of the OverflowDiv object (in the case of being called by the ajax redraw function) */
     if (!$noOverflow) {
         /* Filters */
         if (isset($this->_parameters['filter'])) {
             $currentFilterString = $this->_parameters['filter'];
         } else {
             $currentFilterString = '';
         }
         echo '<input type="hidden" id="filterArea' . $md5InstanceName . '" value="', htmlspecialchars($currentFilterString), '" />';
         echo '<script type="text/javascript">', $this->_getApplyFilterFunctionDefinition(), '</script>';
         /* This makes the table able to be wider then the displayable area. */
         echo '<div id="OverflowDiv' . $md5InstanceName . '" style="overflow: auto; width: ', $this->_tableWidth + 10, 'px; padding-left: 1px; overflow-y: hidden; overflow-x: none; padding-bottom: expression(this.scrollWidth > this.offsetWidth ? 14 : 4); ' . $this->globalStyle . '">', "\n";
     }
     /* IE fix for floating dialog boxes not floating over controls like dropdown lists. */
     echo '<iframe id="helpShim' . $md5InstanceName . '" src="lib/IFrameBlank.html" scrolling="no" frameborder="0" style="position:absolute; display:none;"></iframe>', "\n";
     /* Definition for the cell which appears to be showing when dragging a column into a new position (not resizing). */
     echo '<div class="moveableCell" style="cursor: move; position:absolute; width:100px; border:1px solid gray; display:none; zIndex:10000; filter:alpha(opacity=75);-moz-opacity:.75;opacity:.75; ' . $this->globalStyle . '" id="moveColumn' . $md5InstanceName . '"></div>' . "\n";
     /* Actuall definition for the table. */
     if (isset($this->listStyle) && $this->listStyle == true) {
         echo '<table class="sortable" width="' . ($this->_tableWidth + 10) . '" onmouseover="javascript:trackTableHighlight(event)" id="table' . $md5InstanceName . '" style="border:none;">' . "\n";
         echo '<thead style="-moz-user-select:none; -khtml-user-select:none; user-select:none; display:none; ' . $this->globalStyle . '">' . "\n";
     } else {
         echo '<table class="sortable" width="' . ($this->_tableWidth + 10) . '" onmouseover="javascript:trackTableHighlight(event)" id="table' . $md5InstanceName . '">' . "\n";
         echo '<thead style="-moz-user-select:none; -khtml-user-select:none; user-select:none; ' . $this->globalStyle . '">' . "\n";
     }
     echo '<tr>' . "\n";
     if (!isset($this->showExportColumn) || $this->showExportColumn) {
         /* Column selector icon */
         /**/
         echo '<th style="width:10px; border-right:1px solid gray; ' . $this->globalStyle . '" align="center" id="cellHideShow' . $md5InstanceName . '"><div style="width:10px;">' . "\n";
         /* Choose column box */
         if (isset($this->showChooseColumnsBox) && $this->showChooseColumnsBox == true) {
             echo '<a href="javascript:void(0);" id="exportBoxLink' . $md5InstanceName . '" onclick="toggleHideShowControls(\'' . $md5InstanceName . '\'); return false;">' . "\n";
             echo '<img src="images/tab_add.gif" border="0" alt="" />' . "\n";
             echo '</a></div>' . "\n";
             /* Dropdown selector to choose which columns are visible. */
             echo '<div class="ajaxSearchResults" id="ColumnBox' . $md5InstanceName . '" align="left" onclick="toggleHideShowControls(\'' . $md5InstanceName . '\');" style="width:200px; ' . $this->globalStyle . '">' . "\n";
             echo '<span style="font-weight:bold; color:#000000;">Show Columns:</span><br/><br />' . "\n";
             /* Contents of dropdown menu. */
             foreach ($this->_classColumns as $index => $data) {
                 $selected = false;
                 foreach ($this->_currentColumns as $index2 => $data2) {
                     if ($data2['name'] == $index) {
                         $selected = true;
                     }
                 }
                 /* Add / remove columns */
                 if (!isset($data['pagerOptional']) || $data['pagerOptional'] == true) {
                     if ($selected) {
                         $newParameterArray = $this->_parameters;
                         $newParameterArray['removeColumn'] = $index;
                         echo '<span style="font-weight:normal;">' . $this->_makeControlLink($newParameterArray) . '<img src="images/checkbox.gif" border="0" alt="" />&nbsp;&nbsp;&nbsp;&nbsp;' . $index . '</a></span><br />' . "\n";
                     } else {
                         $newParameterArray = $this->_parameters;
                         $newParameterArray['addColumn'] = $index;
                         echo '<span style="font-weight:normal;">' . $this->_makeControlLink($newParameterArray) . '<img src="images/checkbox_blank.gif" border="0" alt="" />&nbsp;&nbsp;&nbsp;&nbsp;' . $index . '</a></span><br />' . "\n";
                     }
                 }
             }
             /* Single option to reset the column sizes / contents. */
             echo '<br />';
             $newParameterArray = $this->_parameters;
             $newParameterArray['resetColumns'] = true;
             echo '<span style="font-weight:bold;">' . $this->_makeControlLink($newParameterArray) . '<img src="images/checkbox_blank.gif" alt="" border="0" />&nbsp;&nbsp;&nbsp;&nbsp;Reset to Default Columns</a></span><br />' . "\n";
             echo '</div>';
         }
         /* Ajax indicator. */
         echo '<span style="display:none;" id="ajaxTableIndicator' . $md5InstanceName . '"><img src="images/indicator_small.gif" alt="" /></span>';
         /* Selected Export ID's Array */
         echo '<script type="text/javascript">exportArray' . $md5InstanceName . ' = new Array();</script>';
         echo '</th>';
     } else {
         /* Ajax indicator. */
         echo '<span style="display:none;" id="ajaxTableIndicator' . $md5InstanceName . '"></span>';
     }
     /* Column headers */
     foreach ($this->_currentColumns as $index => $data) {
         /* Is the column sizable?  If it is, then we need to make a second column to resize that appears to be part of the first column. */
         if ((!isset($data['data']['sizable']) || $data['data']['sizable'] == true) && (isset($this->allowResizing) && $this->allowResizing == true)) {
             $sizable = true;
             $this->_totalColumnWidths += $data['width'] + 1;
         } else {
             $sizable = false;
             $this->_totalColumnWidths += $data['width'];
         }
         /* Opening of header cell. */
         echo '<th align="left" style="width:' . $data['width'] . 'px; border-collapse: collapse; ' . $this->globalStyle;
         if (end(array_keys($this->_currentColumns)) != $index && !$sizable) {
             //Uncomment for gray resize bars
             echo 'border-right:1px solid gray;';
         }
         $newParameterArray = $this->_parameters;
         $newParameterArray['reorderColumns'] = '<dynamic>';
         /* If $this->allowResizing is not set, prevent moving.  Otherwise, write the code to make the cell movable. */
         if (isset($this->allowResizing) && $this->allowResizing == true) {
             $formatString = '" id="cell%s%s" onmouseover="style.cursor = ' . '\'move\'" onmousedown="startMove(\'cell%s%s\', ' . '\'table%s\', \'cell%s%s\', \'%s\', \'%s\', \'%s\', ' . '\'moveColumn%s\', \'OverflowDiv%s\', \'%s\', urlDecode(\'%s\'));">';
             echo sprintf($formatString, $md5InstanceName, $index, $md5InstanceName, $index, $md5InstanceName, $md5InstanceName, end(array_keys($this->_currentColumns)), urlencode($this->_instanceName), $_SESSION['CATS']->getCookie(), $data['name'], $md5InstanceName, $md5InstanceName, urlencode(serialize($newParameterArray)), urlencode($this->_getUnrelatedRequestString()));
         } else {
             echo '" id="cell', $md5InstanceName, $index, '">';
         }
         echo '<div id="cell' . $md5InstanceName . $index . 'div" style="width:' . $data['width'] . 'px;">' . "\n";
         /* Header cell contents. */
         if (isset($data['data']['pagerNoTitle']) && $data['data']['pagerNoTitle'] == true) {
             /* Do nothing */
         } else {
             if (isset($data['data']['sortableColumn'])) {
                 /* If this field is not the current sort-by field, or if it is and the
                  * current sort direction is DESC, the link will use ASC sort order.
                  */
                 if ($this->_parameters['sortBy'] !== $data['data']['sortableColumn'] || $this->_parameters['sortDirection'] === 'DESC') {
                     $sortDirection = 'ASC';
                 } else {
                     $sortDirection = 'DESC';
                 }
                 if ($this->_parameters['sortBy'] == $data['data']['sortableColumn'] && $this->_parameters['sortDirection'] === 'ASC') {
                     $sortImage = '&nbsp;<img src="images/downward.gif" style="border: none;" alt="" />';
                 } else {
                     if ($this->_parameters['sortBy'] == $data['data']['sortableColumn'] && $this->_parameters['sortDirection'] === 'DESC') {
                         $sortImage = '&nbsp;<img src="images/upward.gif" style="border: none;" alt="" />';
                     } else {
                         $sortImage = '&nbsp;<img src="images/nosort.gif" style="border: none;" alt="" />';
                     }
                 }
                 $newParameterArray = $this->_parameters;
                 $newParameterArray['sortBy'] = $data['data']['sortableColumn'];
                 $newParameterArray['sortDirection'] = $sortDirection;
                 if (isset($newParameterArray['filterAlpha'])) {
                     unset($newParameterArray['filterAlpha']);
                 }
                 if (isset($this->allowSorting) && $this->allowSorting == false) {
                     echo sprintf('<nobr>%s</nobr>', !isset($data['data']['columnHeaderText']) ? $data['name'] : $data['data']['columnHeaderText']);
                 } else {
                     if (isset($data['data']['columnHeaderText'])) {
                         echo sprintf('%s<nobr>%s%s</nobr></a>', $this->_makeControlLink($newParameterArray), $data['data']['columnHeaderText'], $sortImage);
                     } else {
                         echo sprintf('%s<nobr>%s%s</nobr></a>', $this->_makeControlLink($newParameterArray), $data['name'], $sortImage);
                     }
                 }
             } else {
                 echo '<span style="font-weight:bold;"><nobr>', $data['name'], '</nobr></span>';
             }
         }
         /* Draw the closing part of the cell. */
         echo '</div></th>', "\n";
         /* If this cell can be resized, make a cell next to it to move around. */
         if ($sizable) {
             $formatString = '<th align="left" class="resizeableCell" ' . 'style="width:5px; border-collapse: collapse; ' . '-moz-user-select: none; -khtml-user-select: none; ' . $this->globalStyle;
             $_keys_current_columns = array_keys($this->_currentColumns);
             if (end($_keys_current_columns) != $index) {
                 //Uncomment for gray resize bars
                 $formatString .= 'border-right:1px solid gray;';
             }
             $formatString .= 'user-select: none;" onmouseover="style.cursor = ' . '\'e-resize\'" onmousedown="startResize(\'cell%s%s\', ' . '\'table%s\', \'cell%s%s\', %s, \'%s\', \'%s\', ' . '\'%s\', \'%s\', this.offsetWidth);">';
             echo sprintf($formatString, $md5InstanceName, $index, $md5InstanceName, $md5InstanceName, end($_keys_current_columns), $this->_tableWidth, urlencode($this->_instanceName), $_SESSION['CATS']->getCookie(), $data['name'], implode(',', $cellIndexes));
             echo '<div class="dataGridResizeAreaInnerDiv"></div></th>', "\n";
         }
     }
     echo '</tr>', "\n";
     echo '</thead>', "\n";
     /* Table Data */
     foreach ($this->_rs as $rsIndex => $rsData) {
         if (isset($this->listStyle) && $this->listStyle == true) {
             echo '<tr>' . "\n";
         } else {
             echo '<tr class="' . TemplateUtility::getAlternatingRowClass($rsIndex) . '">' . "\n";
         }
         if (!isset($this->showExportColumn) || $this->showExportColumn) {
             /* Action/Export */
             echo '<td style="' . $this->globalStyle . '">';
             if (isset($rsData['exportID']) && isset($this->showExportCheckboxes) && $this->showExportCheckboxes == true) {
                 echo '<input type="checkbox" id="checked_' . $rsData['exportID'] . '" name="checked_' . $rsData['exportID'] . '" onclick="addRemoveFromExportArray(exportArray' . $md5InstanceName . ', ' . $rsData['exportID'] . ');" />';
             }
             echo '</td>';
         }
         /* 1 Column of data */
         foreach ($this->_currentColumns as $index => $data) {
             if (isset($data['data']['pagerAlign'])) {
                 echo '<td valign="top" style="' . $this->globalStyle . '" align="' . $data['data']['pagerAlign'] . '"';
             } else {
                 echo '<td valign="top" style="' . $this->globalStyle . '" align="left"';
             }
             if (isset($data['data']['sizable']) && $data['data']['sizable'] == false || (!isset($this->allowResizing) || $this->allowResizing == false)) {
                 echo '>';
             } else {
                 echo ' colspan="2">';
             }
             if (!isset($data['data']['pagerRender'])) {
                 echo $rsData[$data['data']['sortableColumn']];
             } else {
                 echo eval($data['data']['pagerRender']);
             }
             echo '</td>' . "\n";
         }
         echo '</tr>' . "\n";
     }
     echo '</table>' . "\n";
     /* If the table is smaller than the maximum width, JS will extend out the last cell so the table takes up all of its allocated space. */
     echo '<script type="text/javascript">setTableWidth("table' . $md5InstanceName . '", ' . $this->_totalColumnWidths . ', document.getElementById(\'cell' . $md5InstanceName . end($_keys_current_columns) . '\'), document.getElementById(\'cell' . $md5InstanceName . end($_keys_current_columns) . 'div\'), ' . $this->_tableWidth . ');</script>' . "\n";
     /* Close overflowdiv */
     if (!$noOverflow) {
         echo '</div>';
     }
 }
Ejemplo n.º 2
0
 /**
  * Draws the pager onto the current template (meant to be invoked from template or ajax
  * function).
  *
  * @param boolean don't draw the overflow contaner.
  * @return void
  */
 public function draw($noOverflow = false)
 {
     $arrrTplVar = array();
     /* Get data. */
     $this->_getData();
     $md5InstanceName = md5($this->_instanceName);
     $this->_totalColumnWidths = 0;
     /* Build cell indexes for cell headers. */
     $cellIndexes = array();
     foreach ($this->_currentColumns as $index => $data) {
         $cellIndexes[] = $index;
     }
     /* Do not draw elements that exist outside of the OverflowDiv object (in the case of being called by the ajax redraw function) */
     if (!$noOverflow) {
         /* Filters */
         if (isset($this->_parameters['filter'])) {
             $currentFilterString = $this->_parameters['filter'];
         } else {
             $currentFilterString = '';
         }
         ob_start();
         $this->_getApplyFilterFunctionDefinition();
         $filterDefinition = ob_get_clean();
         $currentFilterString = htmlspecialchars($currentFilterString);
         $globalStyle = $this->globalStyle;
         $tableWidth = strpos($this->_tableWidth, "%") ? $this->_tableWidth : $this->_tableWidth + 10 . "px";
         $arrrTplVar["md5InstanceName"] = $md5InstanceName;
         $arrrTplVar["currentFilterString"] = $currentFilterString;
         $arrrTplVar["filterDefinition"] = $filterDefinition;
         $arrrTplVar["tableWidth"] = $tableWidth;
         $arrrTplVar["globalStyle"] = $globalStyle;
     }
     $listStyleBorder = "";
     $listStyleDisplay = "";
     /* Actuall definition for the table. */
     if (isset($this->listStyle) && $this->listStyle == true) {
         $listStyleBorder = " style='border:none;'";
         $listStyleDisplay = " display:none;";
     }
     $arrrTplVar["listStyleBorder"] = $listStyleBorder;
     $arrrTplVar["listStyleDisplay"] = $listStyleDisplay;
     $arrHTMLTableData = array();
     $indexTableData = 0;
     ob_start();
     if (!isset($this->showExportColumn) || $this->showExportColumn) {
         /* Column selector icon */
         /**/
         //echo ('<th style="width:10px; border-right:1px solid gray; ' . $this->globalStyle . '" align="center" id="cellHideShow'.$md5InstanceName.'"><div style="width:10px;">' . "\n");
         $arrHTMLTableData[$indexTableData]["tag"] = "th";
         //$arrHTMLTableData[$indexTableData]["param"]=' style="width:10px; border-right:1px solid gray; ' . $this->globalStyle . '" align="center" id="cellHideShow'.$md5InstanceName.'"';
         $arrHTMLTableData[$indexTableData]["param"] = "class='param1' id='cellHideShow{$md5InstanceName}'";
         $arrHTMLTableData[$indexTableData]["data"] = '<div style="width:10px;">';
         /* Choose column box */
         if (isset($this->showChooseColumnsBox) && $this->showChooseColumnsBox == true) {
             $arrHTMLTableData[$indexTableData]["data"] .= '<a href="javascript:void(0);" id="exportBoxLink' . $md5InstanceName . '" onclick="toggleHideShowControls(\'' . $md5InstanceName . '\'); return false;">';
             $arrHTMLTableData[$indexTableData]["data"] .= '<img src="images/tab_add.gif" border="0" alt="" />';
             $arrHTMLTableData[$indexTableData]["data"] .= '</a></div>';
             /* Dropdown selector to choose which columns are visible. */
             $arrHTMLTableData[$indexTableData]["data"] .= '<div class="ajaxSearchResults" id="ColumnBox' . $md5InstanceName . '" align="left" onclick="toggleHideShowControls(\'' . $md5InstanceName . '\');" style="width:200px; ' . $this->globalStyle . '">';
             $arrHTMLTableData[$indexTableData]["data"] .= '<span style="font-weight:bold; color:#000000;">Show Columns:</span><br/><br />';
             /* Contents of dropdown menu. */
             foreach ($this->_classColumns as $index => $data) {
                 $selected = false;
                 foreach ($this->_currentColumns as $index2 => $data2) {
                     if ($data2['name'] == $index) {
                         $selected = true;
                     }
                 }
                 /* Add / remove columns */
                 if (!isset($data['pagerOptional']) || $data['pagerOptional'] == true) {
                     if ($selected) {
                         $newParameterArray = $this->_parameters;
                         $newParameterArray['removeColumn'] = $index;
                         $arrHTMLTableData[$indexTableData]["data"] .= '<span style="font-weight:normal;">' . $this->_makeControlLink($newParameterArray) . '<img src="images/checkbox.gif" border="0" alt="" />&nbsp;&nbsp;&nbsp;&nbsp;' . $index . '</a></span><br />';
                     } else {
                         $newParameterArray = $this->_parameters;
                         $newParameterArray['addColumn'] = $index;
                         $arrHTMLTableData[$indexTableData]["data"] .= '<span style="font-weight:normal;">' . $this->_makeControlLink($newParameterArray) . '<img src="images/checkbox_blank.gif" border="0" alt="" />&nbsp;&nbsp;&nbsp;&nbsp;' . $index . '</a></span><br />';
                     }
                 }
             }
             /* Single option to reset the column sizes / contents. */
             $arrHTMLTableData[$indexTableData]["data"] .= '<br />';
             $newParameterArray = $this->_parameters;
             $newParameterArray['resetColumns'] = true;
             $arrHTMLTableData[$indexTableData]["data"] .= '<span style="font-weight:bold;">' . $this->_makeControlLink($newParameterArray) . '<img src="images/checkbox_blank.gif" alt="" border="0" />&nbsp;&nbsp;&nbsp;&nbsp;Reset to Default Columns</a></span><br />';
             $arrHTMLTableData[$indexTableData]["data"] .= '</div>';
         }
         /* Ajax indicator. */
         $arrHTMLTableData[$indexTableData]["data"] .= '<span style="display:none;" id="ajaxTableIndicator' . $md5InstanceName . '"><img src="images/indicator_small.gif" alt="" /></span>';
         /* Selected Export ID's Array */
         $arrHTMLTableData[$indexTableData]["data"] .= '<script type="text/javascript">exportArray' . $md5InstanceName . ' = new Array();</script>';
         echo "<{$arrHTMLTableData[$indexTableData]["tag"]} {$arrHTMLTableData[$indexTableData]["param"]}>{$arrHTMLTableData[$indexTableData]["data"]}</{$arrHTMLTableData[$indexTableData]["tag"]}>";
     } else {
         /* Ajax indicator. */
         echo '<span style="display:none;" id="ajaxTableIndicator' . $md5InstanceName . '"></span>';
     }
     $indexTableData++;
     /* Column headers */
     foreach ($this->_currentColumns as $index => $data) {
         /* Is the column sizable?  If it is, then we need to make a second column to resize that appears to be part of the first column. */
         $widthvalue = '';
         if ((!isset($data['data']['sizable']) || $data['data']['sizable'] == true) && (isset($this->allowResizing) && $this->allowResizing == true)) {
             $sizable = true;
             $widthvalue = $this->_totalColumnWidths += $data['width'] + 1;
             //$arrHTMLTableData[$indexTableData]["param"]="<class='param2'>";
         } else {
             $sizable = false;
             $widthvalue = $this->_totalColumnWidths += $data['width'];
             //$arrHTMLTableData[$indexTableData]["param"]="<class='param3'>";
         }
         /* Opening of header cell. */
         //echo ('<th align="left" style="width:'.$data['width'].'px; border-collapse: collapse; ' . $this->globalStyle);
         $arrHTMLTableData[$indexTableData]["tag"] = "th";
         $arrHTMLTableData[$indexTableData]["param"] = "class='param3' width={$widthvalue}";
         //$arrHTMLTableData[$indexTableData]["param"]=' align="left" style="width:'.$data['width'].'px; border-collapse: collapse; ' . $this->globalStyle;
         $arrKeys = array_keys($this->_currentColumns);
         if (end($arrKeys) != $index && !$sizable) {
             //Uncomment for gray resize bars
             $arrHTMLTableData[$indexTableData]["param"] .= "class='param4'";
             //$arrHTMLTableData[$indexTableData]["param"].= 'border-right:1px solid gray;';
         }
         $newParameterArray = $this->_parameters;
         $newParameterArray['reorderColumns'] = '<dynamic>';
         /* If $this->allowResizing is not set, prevent moving.  Otherwise, write the code to make the cell movable. */
         if (isset($this->allowResizing) && $this->allowResizing == true) {
             $formatString = '" id="cell%s%s" onmouseover="style.cursor = ' . '\'move\'" onmousedown="startMove(\'cell%s%s\', ' . '\'table%s\', \'cell%s%s\', \'%s\', \'%s\', \'%s\', ' . '\'moveColumn%s\', \'OverflowDiv%s\', \'%s\', urlDecode(\'%s\'));"';
             $arrKeys = array_keys($this->_currentColumns);
             $arrHTMLTableData[$indexTableData]["param"] .= sprintf($formatString, $md5InstanceName, $index, $md5InstanceName, $index, $md5InstanceName, $md5InstanceName, end($arrKeys), urlencode($this->_instanceName), $_SESSION['CATS']->getCookie(), $data['name'], $md5InstanceName, $md5InstanceName, urlencode(serialize($newParameterArray)), urlencode($this->_getUnrelatedRequestString()));
         } else {
             $arrHTMLTableData[$indexTableData]["param"] .= '" id="cell' . $md5InstanceName . $index . '"';
         }
         $arrHTMLTableData[$indexTableData]["data"] = '<div id="cell' . $md5InstanceName . $index . 'div" style="width:' . $data['width'] . 'px;">';
         /* Header cell contents. */
         if (isset($data['data']['pagerNoTitle']) && $data['data']['pagerNoTitle'] == true) {
             /* Do nothing */
         } else {
             if (isset($data['data']['sortableColumn'])) {
                 /* If this field is not the current sort-by field, or if it is and the
                  * current sort direction is DESC, the link will use ASC sort order.
                  */
                 if ($this->_parameters['sortBy'] !== $data['data']['sortableColumn'] || $this->_parameters['sortDirection'] === 'DESC') {
                     $sortDirection = 'ASC';
                 } else {
                     $sortDirection = 'DESC';
                 }
                 if ($this->_parameters['sortBy'] == $data['data']['sortableColumn'] && $this->_parameters['sortDirection'] === 'ASC') {
                     $sortImage = '&nbsp;<img src="images/downward.gif" style="border: none;" alt="" />';
                 } else {
                     if ($this->_parameters['sortBy'] == $data['data']['sortableColumn'] && $this->_parameters['sortDirection'] === 'DESC') {
                         $sortImage = '&nbsp;<img src="images/upward.gif" style="border: none;" alt="" />';
                     } else {
                         $sortImage = '&nbsp;<img src="images/nosort.gif" style="border: none;" alt="" />';
                     }
                 }
                 $newParameterArray = $this->_parameters;
                 $newParameterArray['sortBy'] = $data['data']['sortableColumn'];
                 $newParameterArray['sortDirection'] = $sortDirection;
                 if (isset($newParameterArray['filterAlpha'])) {
                     unset($newParameterArray['filterAlpha']);
                 }
                 if (isset($this->allowSorting) && $this->allowSorting == false) {
                     $arrHTMLTableData[$indexTableData]["data"] .= sprintf('<nobr>%s</nobr>', !isset($data['data']['columnHeaderText']) ? $data['name'] : $data['data']['columnHeaderText']);
                 } else {
                     if (isset($data['data']['columnHeaderText'])) {
                         $arrHTMLTableData[$indexTableData]["data"] .= sprintf('%s<nobr>%s%s</nobr></a>', $this->_makeControlLink($newParameterArray), $data['data']['columnHeaderText'], $sortImage);
                     } else {
                         $arrHTMLTableData[$indexTableData]["data"] .= sprintf('%s<nobr>%s%s</nobr></a>', $this->_makeControlLink($newParameterArray), $data['name'], $sortImage);
                     }
                 }
             } else {
                 $arrHTMLTableData[$indexTableData]["data"] .= '<span style="font-weight:bold;"><nobr>' . $data['name'] . '</nobr></span>';
             }
         }
         /* Draw the closing part of the cell. */
         $arrHTMLTableData[$indexTableData]["data"] .= '</div>';
         echo "<{$arrHTMLTableData[$indexTableData]["tag"]} {$arrHTMLTableData[$indexTableData]["param"]}>{$arrHTMLTableData[$indexTableData]["data"]}</{$arrHTMLTableData[$indexTableData]["tag"]}>";
         /* If this cell can be resized, make a cell next to it to move around. */
         if ($sizable) {
             $indexTableData++;
             $arrHTMLTableData[$indexTableData]["tag"] = "th";
             //$arrHTMLTableData[$indexTableData]["param"]=' align="left" class="resizeableCell" style="width:5px; border-collapse: collapse; -moz-user-select: none; -khtml-user-select: none; ' . $this->globalStyle;
             $arrHTMLTableData[$indexTableData]["param"] = "class='param5 resizeableCell'";
             $formatString = '';
             $arrTmp = array_keys($this->_currentColumns);
             if (end($arrTmp) != $index) {
                 //Uncomment for gray resize bars
                 $arrHTMLTableData[$indexTableData]["param"] .= "class='param4'";
                 //$arrHTMLTableData[$indexTableData]["param"] .= 'border-right:1px solid gray;';
             }
             $formatString .= 'user-select: none;" onmouseover="style.cursor = ' . '\'e-resize\'" onmousedown="startResize(\'cell%s%s\', ' . '\'table%s\', \'cell%s%s\', %s, \'%s\', \'%s\', ' . '\'%s\', \'%s\', this.offsetWidth);"';
             $arrTmp = array_keys($this->_currentColumns);
             $formatString = sprintf($formatString, $md5InstanceName, $index, $md5InstanceName, $md5InstanceName, end($arrTmp), $this->_tableWidth, urlencode($this->_instanceName), $_SESSION['CATS']->getCookie(), $data['name'], implode(',', $cellIndexes));
             $arrHTMLTableData[$indexTableData]["param"] .= $formatString;
             $arrHTMLTableData[$indexTableData]["data"] = '<div class="dataGridResizeAreaInnerDiv"></div>';
             echo "<{$arrHTMLTableData[$indexTableData]["tag"]} {$arrHTMLTableData[$indexTableData]["param"]} >{$arrHTMLTableData[$indexTableData]["data"]}</{$arrHTMLTableData[$indexTableData]["tag"]}>";
         }
     }
     echo '</thead>';
     /* Table Data */
     foreach ($this->_rs as $rsIndex => $rsData) {
         if (isset($this->listStyle) && $this->listStyle == true) {
             echo '<tr>' . "\n";
         } else {
             echo '<tr class="' . TemplateUtility::getAlternatingRowClass($rsIndex) . '">' . "\n";
         }
         if (!isset($this->showExportColumn) || $this->showExportColumn) {
             $indexTableData++;
             $arrHTMLTableData[$indexTableData]["tag"] = "td";
             /* Action/Export */
             $arrHTMLTableData[$indexTableData]["param"] = "class='paramGlobal'";
             //$arrHTMLTableData[$indexTableData]["param"]=' style="' . $this->globalStyle . '"';
             $arrHTMLTableData[$indexTableData]["data"] = "";
             //echo ('<td>');
             if (isset($rsData['exportID']) && isset($this->showExportCheckboxes) && $this->showExportCheckboxes == true) {
                 $arrHTMLTableData[$indexTableData]["data"] = '<input type="checkbox" id="checked_' . $rsData['exportID'] . '" name="checked_' . $rsData['exportID'] . '" onclick="addRemoveFromExportArray(exportArray' . $md5InstanceName . ', ' . $rsData['exportID'] . ');" />';
                 //echo ('<input type="checkbox" id="checked_' . $rsData['exportID'] . '" name="checked_' . $rsData['exportID'] . '" onclick="addRemoveFromExportArray(exportArray'.$md5InstanceName.', '.$rsData['exportID'].');" />');
             }
             //echo ('</td>');
             echo "<{$arrHTMLTableData[$indexTableData]["tag"]} {$arrHTMLTableData[$indexTableData]["param"]} >{$arrHTMLTableData[$indexTableData]["data"]}</{$arrHTMLTableData[$indexTableData]["tag"]}>";
         }
         /* 1 Column of data */
         foreach ($this->_currentColumns as $index => $data) {
             $indexTableData++;
             $arrHTMLTableData[$indexTableData]["tag"] = "td";
             // Action/Export
             $arrHTMLTableData[$indexTableData]["param"] = '';
             $arrHTMLTableData[$indexTableData]["data"] = "";
             if (isset($data['data']['pagerAlign'])) {
                 $arrHTMLTableData[$indexTableData]["param"] = "class='paramGlobal' align='{$data['data']['pagerAlign']}'";
                 //$arrHTMLTableData[$indexTableData]["param"]=' style="' . $this->globalStyle . '" align="' . $data['data']['pagerAlign'] . '"';
             } else {
                 $arrHTMLTableData[$indexTableData]["param"] = "class='paramGlobalText'";
                 //$arrHTMLTableData[$indexTableData]["param"]=' style="' . $this->globalStyle . '" align="left"';
             }
             if (isset($data['data']['sizable']) && $data['data']['sizable'] == false || (!isset($this->allowResizing) || $this->allowResizing == false)) {
                 $arrHTMLTableData[$indexTableData]["param"] = '';
                 //echo ('>');
             } else {
                 //$arrHTMLTableData[$indexTableData]["param"]="class='param7'";
                 $arrHTMLTableData[$indexTableData]["param"] = ' colspan="2"';
                 //echo (' colspan="2">');
             }
             if (!isset($data['data']['pagerRender'])) {
                 $arrHTMLTableData[$indexTableData]["data"] = $rsData[$data['data']['sortableColumn']];
                 //echo ($rsData[$data['data']['sortableColumn']]);
             } else {
                 $arrHTMLTableData[$indexTableData]["data"] = eval($data['data']['pagerRender']);
                 //echo (eval($data['data']['pagerRender']));
             }
             //echo ('</td>' . "\n");
             echo "<{$arrHTMLTableData[$indexTableData]["tag"]} {$arrHTMLTableData[$indexTableData]["param"]} >{$arrHTMLTableData[$indexTableData]["data"]}</{$arrHTMLTableData[$indexTableData]["tag"]}>";
         }
         ///priya original
         /*foreach ($this->_currentColumns as $index => $data)
                     {
                         
                         if (isset($data['data']['pagerAlign']))
                         {
                             echo ('<td valign="top" style="' . $this->globalStyle . '" align="' . $data['data']['pagerAlign'] . '"');
                         }
                         else
                         {
                             echo ('<td valign="top" style="' . $this->globalStyle . '" align="left"');
                         }
         
                         if (isset($data['data']['sizable']) && $data['data']['sizable'] == false || (!isset($this->allowResizing) || $this->allowResizing == false))
                         {
                              echo ('>');
                         }
                         else
                         {
                             echo (' colspan="2">');
                         }
         
                         if (!isset($data['data']['pagerRender']))
                         {
                             echo ($rsData[$data['data']['sortableColumn']]);
                         }
                         else
                         {
                             echo (eval($data['data']['pagerRender']));
                         }
         
                         echo ('</td>' . "\n");
                     }
         
         
                     echo ('</tr>' . "\n");*/
     }
     /* If the table is smaller than the maximum width, JS will extend out the last cell so the table takes up all of its allocated space. */
     $arrTmp = array_keys($this->_currentColumns);
     $arrTmpEnd = end($arrTmp);
     $_tableWidth = $this->_tableWidth;
     $arrrTplVar["arrTmpEnd"] = $arrTmpEnd;
     $arrrTplVar["_tableWidth"] = $_tableWidth;
     $_totalColumnWidths = $this->_totalColumnWidths;
     $arrrTplVar["_totalColumnWidths"] = $_totalColumnWidths;
     $arrrTplVar["md5InstanceName"] = $md5InstanceName;
     $arrrTplVar["globalStyle"] = $this->globalStyle;
     $content = ob_get_clean();
     //echo $content;exit;
     $arrrTplVar["AUIEO_CONTENT"] = $content;
     if (!$noOverflow) {
         $content = loadDoubleLayerTemplate("themes/default/datagrid_overflow.php", "themes/default/datagrid_overflow.html", $arrrTplVar);
     } else {
         $content = loadDoubleLayerTemplate("themes/default/datagrid.php", "themes/default/datagrid.html", $arrrTplVar);
     }
     echo $content;
 }