/**
  * Static function for create list page
  * Read params from setting 
  * Create object of class in accordance with mode displaying page 
  */
 function &createListPage($table, $options)
 {
     global $bSubqueriesSupported, $strTableName, $conn, $locale_info, $isGroupSecurity;
     $gQuery = GetTableData($table, ".sqlquery", null);
     $params = array();
     $params = $options;
     $params['origTName'] = GetTableData($table, ".OriginalTable", '');
     $params['sessionPrefix'] = $strTableName;
     $params['tName'] = $table;
     $params['conn'] =& $conn;
     $params['gPageSize'] = GetTableData($table, ".pageSize", 0);
     $params['gOrderIndexes'] = GetTableData($table, ".orderindexes", array());
     $params['gstrOrderBy'] = GetTableData($table, ".strOrderBy", '');
     $params['gsqlHead'] = GetTableData($table, ".sqlHead", '');
     $params['gsqlFrom'] = GetTableData($table, ".sqlFrom", '');
     $params['gsqlWhereExpr'] = GetTableData($table, ".sqlWhereExpr", '');
     $params['gsqlGroupBy'] = $gQuery->GroupByToSql();
     $oHaving = $gQuery->Having();
     $params['gsqlHaving'] = $oHaving->toSql($gQuery);
     $params['locale_info'] =& $locale_info;
     $params["subQueriesSupp"] = $bSubqueriesSupported;
     $params['nSecOptions'] = GetTableData($table, ".nSecOptions", 0);
     $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0);
     $params['recsPerRowList'] = GetTableData($table, ".recsPerRowList", 0);
     $params['tableGroupBy'] = GetTableData($table, ".tableGroupBy", '');
     $params['dbType'] = GetGlobalData("dbType", 0);
     $params['mainTableOwnerID'] = GetTableData($table, ".mainTableOwnerID", '');
     $params['moveNext'] = GetTableData($table, ".moveNext", 0);
     $params['exportTo'] = GetTableData($table, ".exportTo", false);
     $params['printFriendly'] = GetTableData($table, ".printFriendly", false);
     $params['deleteRecs'] = GetTableData($table, ".delete", false);
     $params['rowHighlite'] = GetTableData($table, ".rowHighlite", false);
     $params["delFile"] = GetGlobalData("delFile", false);
     $params["isGroupSecurity"] = $isGroupSecurity;
     $params['arrKeyFields'] = GetTableData($table, ".arrKeyFields", array());
     $params["useIbox"] = GetTableData($table, ".useIbox", false);
     $params["isUseInlineAdd"] = GetTableData($table, ".isUseInlineAdd", false);
     $params["isUseInlineEdit"] = GetTableData($table, ".isUseInlineEdit", false);
     $params["isUseInlineJs"] = $params["isUseInlineAdd"] || $params["isUseInlineEdit"];
     $params["globSearchFields"] = GetTableData($table, ".globSearchFields", array());
     $params["panelSearchFields"] = GetTableData($table, ".panelSearchFields", array());
     $params['isVerLayout'] = GetTableData($table, ".isVerLayout", false);
     $params['isDisplayLoading'] = GetTableData($table, ".isDisplayLoading", false);
     $params['createLoginPage'] = GetGlobalData("createLoginPage", false);
     $params['subQueriesSupAccess'] = GetTableData($table, ".subQueriesSupAccess", false);
     $params['noRecordsFirstPage'] = GetTableData($table, ".noRecordsFirstPage", false);
     $params['totalsFields'] = GetTableData($table, ".totalsFields", array());
     $params['listIcons'] = GetTableData($table, ".listIcons", false);
     $params['edit'] = GetTableData($table, ".edit", false);
     $params['inlineEdit'] = GetTableData($table, ".inlineEdit", false);
     $params['iCopy'] = GetTableData($table, ".copy", false);
     $params['iView'] = GetTableData($table, ".view", false);
     $params['listAjax'] = GetTableData($table, ".listAjax", false);
     $params['arrRecsPerPage'] = GetTableData($table, ".arrRecsPerPage", array());
     $params['audit'] = GetAuditObject($table);
     $params['listFields'] = array();
     $allfields = GetFieldsList($table);
     foreach ($allfields as $f) {
         if (!AppearOnListPage($f, $table)) {
             continue;
         }
         $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => GetFieldData($table, $f, "ViewFormat", ""), "editFormat" => GetFieldData($table, $f, "EditFormat", ""));
     }
     // choose class by mode
     if ($params["mode"] == LIST_SIMPLE) {
         $pageObject = new ListPage_Simple($params);
     } else {
         if ($params["mode"] == LIST_AJAX) {
             $pageObject = new ListPage_Ajax($params);
         } else {
             if ($params["mode"] == LIST_LOOKUP) {
                 $pageObject = new ListPage_Lookup($params);
             } else {
                 if ($params["mode"] == LIST_DETAILS) {
                     $pageObject = new ListPage_DPInline($params);
                 } else {
                     if ($params["mode"] == RIGHTS_PAGE) {
                         $pageObject = new RightsPage($params);
                     } else {
                         if ($params["mode"] == MEMBERS_PAGE) {
                             $pageObject = new MembersPage($params);
                         }
                     }
                 }
             }
         }
     }
     return $pageObject;
 }
 function searchAssign()
 {
     parent::searchAssign();
     $searchGlobalParams = $this->searchClauseObj->getSearchGlobalParams();
     $searchPanelAttrs = $this->searchClauseObj->getSrchPanelAttrs();
     // show hide window
     $this->pageObj->xt->assign("showHideSearchWin_attrs", 'align="absmiddle" title="Floating window" alt="Floating window"');
     $searchOpt_mess = $searchPanelAttrs['srchOptShowStatus'] ? mlang_message("SEARCH_HIDE_OPTIONS") : mlang_message("SEARCH_SHOW_OPTIONS");
     $this->pageObj->xt->assign("showHideSearchPanel_attrs", 'align="absmiddle" title="' . $searchOpt_mess . '" alt="' . $searchOpt_mess . '"');
     $searchforAttrs = "";
     if ($this->isUseAjaxSuggest) {
         $searchforAttrs .= "autocomplete=off ";
     }
     if (!$this->searchClauseObj->isUsedSrch()) {
         $searchforAttrs .= 'class="ctlSearchFor"';
     }
     $searchforAttrs .= " name=\"ctlSearchFor" . $this->id . "\" id=\"ctlSearchFor" . $this->id . "\"";
     $valSrchFor = $this->searchClauseObj->isUsedSrch() ? $searchGlobalParams["simpleSrch"] : mlang_message("SEARCH_TIP");
     $searchforAttrs .= " value=\"" . htmlspecialchars($valSrchFor) . "\"";
     $this->pageObj->xt->assignbyref("searchfor_attrs", $searchforAttrs);
     $this->pageObj->xt->assign('searchPanelTopButtons', $this->isDisplaySearchPanel);
     if (GetTableData($this->tName, ".showSimpleSearchOptions", false)) {
         $simpleSearchTypeCombo = '<select id="simpleSrchTypeCombo' . $this->id . '" name="simpleSrchTypeCombo' . $this->id . '" size="1">';
         $simpleSearchTypeCombo .= $this->searchControlBuilder->getSimpleSearchTypeCombo($searchGlobalParams["simpleSrchTypeComboOpt"], $searchGlobalParams["simpleSrchTypeComboNot"]);
         $simpleSearchTypeCombo .= "</select>";
         $this->pageObj->xt->assign('simpleSearchTypeCombo', $simpleSearchTypeCombo);
         $simpleSearchFieldCombo = '<select id="simpleSrchFieldsCombo' . $this->id . '" name="simpleSrchFieldsCombo' . $this->id . '" size="1">';
         $simpleSearchFieldCombo .= $this->searchControlBuilder->simpleSearchFieldCombo($this->allSearchFields, $searchGlobalParams["simpleSrchFieldsComboOpt"]);
         $simpleSearchFieldCombo .= "</select>";
         $this->pageObj->xt->assign('simpleSearchFieldCombo', $simpleSearchFieldCombo);
     }
 }
 function SearchClause(&$params)
 {
     global $strTableName;
     $this->tName = $params['tName'] ? $params['tName'] : $strTableName;
     $this->sessionPrefix = $params['sessionPrefix'] ? $params['sessionPrefix'] : $this->tName;
     $this->searchFieldsArr = $params['searchFieldsArr'];
     $this->panelSearchFields = $params['panelSearchFields'] ? $params['panelSearchFields'] : GetTableData($this->tName, ".panelSearchFields", array());
     $this->googleLikeFields = $params['googleLikeFields'] ? $params['googleLikeFields'] : GetTableData($this->tName, ".googleLikeFields", array());
 }
 function simpleSearchFieldCombo($fNamesArr, $selOpt)
 {
     $options = "";
     if (sizeof(GetTableData($this->tName, ".googleLikeFields", array())) != 0) {
         $options = '<option value="" >' . mlang_message("ANY_FIELD") . '</option>';
     }
     foreach ($fNamesArr as $fName) {
         $fLabel = GetFieldLabel(GoodFieldName($this->tName), GoodFieldName($fName));
         $options .= '<option value="' . $fName . '" ' . ($selOpt == $fName ? 'selected' : '') . '>' . $fLabel . '</option>';
     }
     return $options;
 }
function GetTableDataBySidAndName()
{
    $sid = $_POST["sid"];
    $table_name = $_POST["table_name"];
    $perPage = $_POST["perPage"];
    $pageNo = $_POST["pageNo"];
    //$logger->info("In GetTableDataBySidAndName for sid = $sid, tableName = $table_name, perPage = $perPage, pageNo = $pageNo");
    if (is_string($sid)) {
        $sid = json_decode($sid);
    }
    echo json_encode(GetTableData($sid, $table_name, $perPage, $pageNo));
}
 public function testGetTableDataBySidAndTableName()
 {
     $sid = 2122;
     $table_name = 's6.xlsx';
     $perPage = 10;
     $pageNo = 1;
     $expected = array();
     $expected['data'][] = array('rownum' => "1", "F" => "F1", "G" => "G1");
     $expected['data'][] = array('rownum' => "2", "F" => "F2", "G" => "G2");
     $expected['data'][] = array('rownum' => "3", "F" => "F3", "G" => "G3");
     $expected['Control'] = array('perPage' => $perPage, 'totalPage' => 1, 'pageNo' => $pageNo, 'cols' => "rownum,F,G");
     $result = GetTableData($sid, $table_name, $perPage, $pageNo);
     $this->assertEquals(json_encode($result), json_encode($expected));
 }
    if ($moduleManager->VersionHandler()->CompareVersionsNewer($infos['CurrentVersion'], $infos['Version'])) {
        $infos['AvailableVersion'] = $infos['Version'];
        $versionAttribute = 'color:red;';
        $updateButton = true;
    }
    if ($infos['State'] != 'OK') {
        $stateAttribute = 'color:red;';
    }
    $html .= '  <tr>';
    $html .= GetTableData(null, null, $module, '', 'Module', $module);
    $html .= GetTableData($infos, 'CurrentVersion');
    $html .= GetTableData($infos, 'AvailableVersion', '', $versionAttribute, 'Updates');
    $html .= GetTableData($infos, 'State', '', $stateAttribute);
    //$html .=  GetTableData($infos, 'LastRepository');
    //$html .=  GetTableData($infos, 'Repository');
    $html .= GetTableData($infos, 'Description');
    $html .= '</tr>' . PHP_EOL;
}
echo $html;
?>
</table>


<?php 
if (!$processing) {
    if (count($modules) > 0) {
        echo '<input type="button" name="Text" value="Update aller Module" onclick="trigger_button(\'UpdateAll\', \'\', \'\')">';
    }
    echo '<input type="button" name="Text" value="Nach neuen Update\'s Suchen" onclick="trigger_button(\'SearchUpdates\', \'\', \'\')">';
} else {
    echo 'processing ...';
@ini_set("display_startup_errors", "1");
include "include/dbcommon.php";
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
$table = postvalue("table");
$strTableName = GetTableByShort($table);
if (!checkTableName($table)) {
    exit(0);
}
include "include/" . $table . "_variables.php";
$field = postvalue('searchField');
$value = postvalue('searchFor');
$lookupValue = postvalue('lookupValue');
$LookupSQL = "";
$response = array();
$output = "";
$strDataSourceTable = GetTableData($strTableName, '.OriginalTable', '');
$strLoginTable = "dbo.System Users";
if ($strDataSourceTable != $strLoginTable) {
    if (!@$_SESSION["UserID"]) {
        return;
    }
    if (!CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Edit") && !CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Add") && !CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Search")) {
        return;
    }
} else {
    $checkResult = true;
    if ($field == "UserID") {
        $checkResult = false;
    }
    if ($field == "Password") {
        $checkResult = false;
Esempio n. 9
0
 * Далее если пользователь желает уточнить данные то в данный скрипт передаются запрашиваемые данные.
 */
require_once '../conf/login.php';
$mssqlConn = sqlsrv_connect($serverName, $connectionInfo);
if ($mssqlConn === false) {
    die(print_r(sqlsrv_errors(), true));
}
//Получаем полную информацию для каждой вкладки.
$tab = $_POST['tab'];
$predicate = $_POST['queryId'];
//Функиции получения данных и отрисовки таблицы
//GetInfo($mssqlConn,$tab);
//Формируем заголовоки столбцов таблицы и строки для поиска
$thead = MakeTableHead(GetTableHeaders($mssqlConn, $tab), $tab);
//Содержимое таблицы
$tbody = GetTableData($mssqlConn, $tab, $predicate);
//Отрисовка таблицы
DrawTable($thead, $tbody);
function GetTableHeaders($conn, $table)
{
    $queryFields = "Select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='" . $table . "'";
    $resultFields = sqlsrv_query($conn, $queryFields) or die(print_r(sqlsrv_errors(), true));
    return $resultFields;
}
function MakeTableHead($th, $tid)
{
    //Заголовоки столбцов
    $headersCount = 0;
    $tableHead = '<table class="table" border="1" id="' . $tid . 'Table"> <thead><tr>';
    while ($row = sqlsrv_fetch_array($th, SQLSRV_FETCH_NUMERIC)) {
        $tableHead .= '<td>' . $row[0] . '</td>';
 /**
  * Use for count details recs number, if subQueryes not supported, or keys have different types
  *
  * @param integer $i
  * @param array $detailid
  */
 function countDetailsRecsNoSubQ($dInd, &$detailid)
 {
     global $tables_data;
     global $masterTablesData;
     global $detailsTablesData;
     $dDataSourceTable = $this->allDetailsTablesArr[$dInd]['dDataSourceTable'];
     $gQuery = GetTableData($dDataSourceTable, '.sqlquery', null);
     $dObjHaving = $gQuery->Having();
     $dSqlHaving = $dObjHaving->toSql($gQuery);
     $dSqlGroupBy = $gQuery->GroupByToSql();
     $dSqlHead = $this->allDetailsTablesArr[$dInd]['sqlHead'];
     $dSqlFrom = $this->allDetailsTablesArr[$dInd]['sqlFrom'];
     $dSqlWhere = $this->allDetailsTablesArr[$dInd]['sqlWhere'];
     //$sqlTail = $detailTableInfo['sqlTail'];
     $detailKeys = GetDetailKeysByMasterTable($this->tName, $dDataSourceTable);
     $securityClause = SecuritySQL("Search", $dDataSourceTable);
     // add where
     if (strlen($securityClause)) {
         $dSqlWhere = whereAdd($dSqlWhere, $securityClause);
     }
     $masterwhere = "";
     foreach ($this->masterKeysByD[$dInd] as $idx => $val) {
         if ($masterwhere) {
             $masterwhere .= " and ";
         }
         $masterwhere .= GetFullFieldName($detailKeys[$idx], $dDataSourceTable) . "=" . make_db_value($detailKeys[$idx], $detailid[$idx]);
     }
     return gSQLRowCount_int($dSqlHead, $dSqlFrom, $dSqlWhere, $dSqlGroupBy, $dSqlHaving, $masterwhere, "");
 }
 function buildSearchPanel($xtVarName)
 {
     $this->xt->enable_section("searchPanel");
     $params = array();
     $params['pageObj'] =& $this;
     $params['globSearchFields'] = $this->globSearchFields;
     $params['panelSearchFields'] = $this->panelSearchFields;
     $panelSearchFields = array();
     $allSearchFields = GetTableData($this->tName, '.allSearchFields', array());
     for ($i = 0; $i < count($allSearchFields); $i++) {
         if (!$this->matchWithDetailKeys($allSearchFields[$i])) {
             $panelSearchFields[] = $allSearchFields[$i];
         }
     }
     $params['allSearchFields'] = $panelSearchFields;
     $this->searchPanel = new SearchPanelSimple($params);
     $this->searchPanel->buildSearchPanel($xtVarName);
 }
    $xt->assign("mastertable_block", true);
}
$strSQL = $_SESSION[$strTableName . "_sql"];
$isPdfView = false;
if (GetTableData($strTableName, ".isUsebuttonHandlers", false) || $isPdfView) {
    $pageObject->body["begin"] .= "<script type=\"text/javascript\" src=\"include/loadfirst.js\"></script>\r\n";
    $pageObject->body["begin"] .= "<script type=\"text/javascript\" src=\"include/lang/" . getLangFileName(mlang_getcurrentlang()) . ".js\"></script>";
    $pageObject->fillSetCntrlMaps();
    $pageObject->body['end'] .= '<script>';
    $pageObject->body['end'] .= "window.controlsMap = " . my_json_encode($pageObject->controlsHTMLMap) . ";";
    $pageObject->body['end'] .= "window.settings = " . my_json_encode($pageObject->jsSettings) . ";";
    $pageObject->body['end'] .= '</script>';
    $pageObject->body["end"] .= "<script language=\"JavaScript\" src=\"include/runnerJS/RunnerAll.js\"></script>\r\n";
    $pageObject->addCommonJs();
}
if (GetTableData($strTableName, ".isUsebuttonHandlers", false) || $isPdfView) {
    $pageObject->body["end"] .= "<script>" . $pageObject->PrepareJS() . "</script>";
}
$xt->assignbyref("body", $pageObject->body);
$xt->assign("grid_block", true);
$xt->assign("UserID_fieldheadercolumn", true);
$xt->assign("UserID_fieldheader", true);
$xt->assign("UserID_fieldcolumn", true);
$xt->assign("UserID_fieldfootercolumn", true);
$xt->assign("Password_fieldheadercolumn", true);
$xt->assign("Password_fieldheader", true);
$xt->assign("Password_fieldcolumn", true);
$xt->assign("Password_fieldfootercolumn", true);
$xt->assign("User_Name_fieldheadercolumn", true);
$xt->assign("User_Name_fieldheader", true);
$xt->assign("User_Name_fieldcolumn", true);
$knownModules = $moduleManager->VersionHandler()->GetKnownModules();
$installedModules = $moduleManager->VersionHandler()->GetInstalledModules();
$html = '';
foreach ($knownModules as $module => $data) {
    $infos = $moduleManager->GetModuleInfos($module);
    $html .= '  <tr>';
    $html .= GetTableData($module, '', 'Module', $module);
    $html .= GetTableData($infos['Version']);
    if (array_key_exists($module, $installedModules)) {
        $html .= '<td></td>';
    } elseif ($processing) {
        $html .= '<td>processing ...</td>';
    } else {
        $html .= '<td><input type="button" name="Text" value="Modul Laden" onclick="trigger_button(\'Load\', \'' . $module . '\', \'\')"></td>';
    }
    $html .= GetTableData($infos['Description']);
    $html .= '</tr>' . PHP_EOL;
}
echo $html;
?>
</table>

<?php 
function GetTableData($value = '', $displayAttributes = '', $action = '', $module = '', $info = '')
{
    $text = $value;
    if ($text == '') {
        $text = '-';
    }
    $text = htmlentities($text);
    if ($action != '') {
$modules = $moduleManager->VersionHandler()->GetKnownUpdates();
$html = '';
foreach ($modules as $idx => $module) {
    $moduleManager = new IPSModuleManager($module);
    $infos = $moduleManager->GetModuleInfos();
    $changes = $moduleManager->VersionHandler()->GetChangeList($module);
    $text = '<table><tr><td><div style="text-align:left; color:grey; padding-left:10px; padding-right:10px;">Aktuelles Repository</div></td>' . '<td><div style="text-align:left; color:grey; padding-left:10px; padding-right:10px;">' . $infos['LastRepository'] . '</div></td></tr>';
    $text .= '<tr><td><div style="text-align:left; color:grey; padding-left:10px; padding-right:10px;">Neues Repository</div></td>' . '<td><div style="text-align:left; color:grey; padding-left:10px; padding-right:10px;">' . $infos['Repository'] . '</div></td></tr>';
    foreach ($changes as $version => $change) {
        $text .= '<tr><td><div style="text-align:left; color:white; padding-left:10px; padding-right:10px;">Version ' . $version . '</div></td>' . '<td><div style="text-align:left; color:white; padding-left:10px; padding-right:10px;">' . htmlentities($change, ENT_COMPAT, 'ISO-8859-1') . '</div></td></tr>';
    }
    $text .= '</table>';
    $html .= '  <tr>';
    $html .= GetTableData($module, '', 'Module', $module);
    $html .= GetTableData($infos['CurrentVersion']);
    $html .= GetTableData($infos['Version']);
    if (!$processing) {
        $html .= '<td><input type="button" name="Text" value="Update" onclick="trigger_button(\'Update\', \'' . $module . '\', \'\')"></td>';
    } else {
        $html .= '<td>processing ...</td>';
    }
    $html .= '<td><div style="text-align:left; overflow:hidden; padding-left:10px; padding-right:10px;">' . $text . '</div></td>';
    $html .= '</tr>' . PHP_EOL;
}
echo $html;
?>
</table>


<?php 
if (!$processing) {
Esempio n. 15
0
if ($dump['num_tables'] > 0 && $action != 'backupnow') {
    $info_text = TEXT_INFO_DO_BACKUP;
    @xtc_set_time_limit(0);
    if ($dump['nr'] < $dump['num_tables']) {
        $nr = $dump['nr'];
        $dump['aufruf']++;
        $table_ok = 'Tabellen gesichert: ' . ($nr + 1) . '<br><br>Zuletzt bearbeitet: ' . $dump['tables'][$nr] . '<br><br>Seitenaufrufe: ' . $dump['aufruf'];
        //Neue Tabelle
        if ($dump['table_offset'] == 0) {
            $dump['table_records'] = GetTableInfo($dump['tables'][$nr]);
            $dump['anzahl_zeilen'] = ANZAHL_ZEILEN_BKUP;
            $dump['table_offset'] = 1;
            $dump['zeilen_offset'] = 0;
        } else {
            //Daten aus  Tabelle lesen
            GetTableData($dump['tables'][$nr]);
        }
        $_SESSION['dump'] = $dump;
        $selbstaufruf = '<script language="javascript" type="text/javascript">setTimeout("document.dump.submit()", 10);</script></div>';
        //Verhindert Endlosschleife - Script wir nach MAX_RELOADS beendet
        if ($dump['aufruf'] > MAX_RELOADS) {
            $selbstaufruf = '';
        }
    } else {
        //Fertig
        $info_wait = '';
        $info_text = TEXT_INFO_DO_BACKUP_OK;
        $table_ok = 'Tabellen gesichert: ' . $dump['nr'] . '<br><br>Seitenaufrufe: ' . $dump['aufruf'];
        $button_back = '<a href="backup.php" class="btn btn-default">' . BUTTON_BACK . '</a>';
        $selbstaufruf = '';
        unset($_SESSION['dump']);
Esempio n. 16
0
 function Chart(&$ch_array, $param)
 {
     global $field_labels;
     if ($this->webchart) {
         $this->chrt_array = Convert_Old_Chart($ch_array);
     } else {
         $this->chrt_array = $ch_array;
     }
     $this->numRecordsToShow = $this->chrt_array['appearance']['maxbarscroll'];
     if ($this->numRecordsToShow < 1) {
         $this->numRecordsToShow = 1;
     }
     $this->table_type = $this->chrt_array["table_type"];
     if (!$this->table_type) {
         $this->table_type = "project";
     }
     $this->webchart = $param["webchart"];
     $this->cname = $param["cname"];
     $this->sessionPrefix = $this->chrt_array['tables'][0];
     $this->gstrOrderBy = $param["gstrOrderBy"];
     $TableName = GoodFieldName($this->chrt_array['tables'][0]);
     $this->header = $this->chrt_array['appearance']['head'];
     $this->footer = $this->chrt_array['appearance']['foot'];
     $this->y_axis_label = $this->chrt_array['appearance']['y_axis_label'];
     for ($i = 0; $i < count($this->chrt_array['parameters']) - 1; $i++) {
         if (isset($this->chrt_array['parameters'][$i]['currencyFormat'])) {
             $this->arrFormatCurrency[] = $this->chrt_array['parameters'][$i]['currencyFormat'];
         } else {
             if ($this->chrt_array['appearance']['scur'] == "false") {
                 $this->arrFormatCurrency[] = "";
             } else {
                 $this->arrFormatCurrency[] = $this->chrt_array['appearance']['scur'];
             }
         }
         if (isset($this->chrt_array['parameters'][$i]['decimalFormat'])) {
             $this->arrFormatDecimal[] = $this->chrt_array['parameters'][$i]['decimalFormat'];
         } else {
             $this->arrFormatDecimal[] = $this->chrt_array['appearance']['dec'];
         }
         $this->arrFormatCustomer[] = $this->chrt_array['parameters'][$i]['customFormat'];
         $this->arrFormatCustomerStr[] = $this->chrt_array['parameters'][$i]['customFormatStr'];
         if ($this->chrt_array["chart_type"]["type"] == "ohlc" || $this->chrt_array["chart_type"]["type"] == "candlestick") {
             $this->arrOHLC_open[] = $this->chrt_array['parameters'][$i]['ohlcOpen'];
             $this->arrOHLC_high[] = $this->chrt_array['parameters'][$i]['ohlcHigh'];
             $this->arrOHLC_low[] = $this->chrt_array['parameters'][$i]['ohlcLow'];
             $this->arrOHLC_close[] = $this->chrt_array['parameters'][$i]['ohlcClose'];
             $this->arrOHLC_color[] = "#" . $this->chrt_array['parameters'][$i]['ohlcColor'];
             if ($this->chrt_array["chart_type"]["type"] == "candlestick") {
                 $this->arrOHLC_candle[] = "#" . $this->chrt_array['parameters'][$i]['ohlcCandleColor'];
             }
         } elseif ($this->chrt_array['parameters'][$i]['name'] != "") {
             $this->arrDataSeries[] = $this->chrt_array['parameters'][$i]['agr_func'] ? $this->chrt_array['parameters'][$i]['label'] : $this->chrt_array['parameters'][$i]['name'];
             if (isset($this->chrt_array['appearance']['scolor' . ($i + 1) . '1'])) {
                 $this->arrDataColor[] = $this->chrt_array['appearance']['scolor' . ($i + 1) . '1'];
             } else {
                 $this->arrDataColor[] = $this->chrt_array['parameters'][$i]['series_color'];
             }
             if ($this->chrt_array["chart_type"]["type"] == "bubble") {
                 $this->arrDataSize[] = $this->chrt_array['parameters'][$i]['size'];
             }
             if ($this->chrt_array["chart_type"]["type"] == "gauge") {
                 for ($k = 0; is_array($this->chrt_array["parameters"][$i]["gaugeColorZone"]) && $k < count($this->chrt_array["parameters"][$i]["gaugeColorZone"]); $k++) {
                     $beginColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeBeginColor"];
                     $endColor = (double) @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeEndColor"];
                     $gColor = "#" . @$this->chrt_array["parameters"][$i]["gaugeColorZone"][$k]["gaugeColor"];
                     $this->arrGaugeColor[count($this->arrDataSeries) - 1][] = array($beginColor, $endColor, $gColor);
                 }
             }
         }
         if ($this->table_type == "project" && !$this->webchart) {
             $this->arrDataLabels[] = $this->chart_xmlencode(GetFieldLabel(GoodFieldName($TableName), GoodFieldName($this->chrt_array['parameters'][$i]['name'])));
         } else {
             if (!$this->chart_xmlencode($this->chrt_array['parameters'][$i]['label'])) {
                 $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['name']);
             } else {
                 $this->arrDataLabels[] = $this->chart_xmlencode($this->chrt_array['parameters'][$i]['label']);
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "gauge") {
         $this->strLabel = $this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'];
         for ($j = 0; $j < count($this->chrt_array['fields']); $j++) {
             if ($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] == $this->chrt_array['fields'][$j]['name']) {
                 if ($this->table_type == "project") {
                     $this->label2 = $this->chart_xmlencode(GetFieldLabel($TableName, GoodFieldName($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'])));
                 } else {
                     $this->label2 = $this->chart_xmlencode($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']);
                 }
             }
         }
     }
     if ($this->chrt_array["chart_type"]["type"] != "ohlc" && $this->chrt_array["chart_type"]["type"] != "candlestick") {
         foreach ($this->arrDataColor as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrDataColor[$ind];
             }
         }
     } else {
         foreach ($this->arrOHLC_color as $ind => $val) {
             if ($ind == 0) {
                 $this->arrAxesColor = "#000000";
             } else {
                 $this->arrAxesColor = "#" . $this->arrOHLC_color[$ind];
             }
         }
     }
     // prepare search params
     global $gsqlFrom, $gsqlWhereExpr;
     $gQuery = GetTableData($this->sessionPrefix, ".sqlquery", null);
     $strWhereClause = "";
     $searchHavingClause = "";
     // search where for basic charts
     if (!$this->webchart) {
         global $strTableName;
         if (isset($_SESSION[$this->sessionPrefix . '_advsearch'])) {
             $searchClauseObj = unserialize($_SESSION[$this->sessionPrefix . '_advsearch']);
             $strWhereClause = $searchClauseObj->getWhere(GetListOfFieldsByExprType(false));
             $searchHavingClause = $searchClauseObj->getWhere(GetListOfFieldsByExprType(true));
         }
     } else {
         if ($this->table_type != "project") {
             $strTableName = "webchart" . $this->cname;
         } else {
             $strTableName = $TableName;
         }
         $strWhereClause = CalcSearchParam($this->table_type != "project");
     }
     if ($strWhereClause) {
         $this->chrt_array['where'] .= $this->chrt_array['where'] ? " AND (" . $strWhereClause . ")" : " WHERE (" . $strWhereClause . ")";
     }
     if ($this->table_type == "project") {
         if (SecuritySQL("Search")) {
             $strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search"));
         }
         $this->strSQL = gSQLWhere($strWhereClause, $searchHavingClause);
         $strOrderBy = $this->gstrOrderBy;
         $this->strSQL .= " " . $strOrderBy;
         $strSQLbak = $this->strSQL;
         if (tableEventExists("BeforeQueryChart", $strTableName)) {
             $tstrSQL = $this->strSQL;
             $eventObj = getEventObject($strTableName);
             $eventObj->BeforeQueryChart($tstrSQL, $strWhereClause, $strOrderBy);
             $this->strSQL = $tstrSQL;
         }
         if ($strSQLbak == $this->strSQL) {
             $this->strSQL = gSQLWhere($strWhereClause, $searchHavingClause);
             $this->strSQL .= " " . $strOrderBy;
         }
     }
     if ($this->cname && $this->table_type == "db") {
         $this->strSQL = $this->chrt_array['sql'] . $this->chrt_array['where'] . $this->chrt_array['group_by'] . $this->chrt_array['order_by'];
     } elseif ($this->cname && $this->table_type == "custom") {
         if (!IsStoredProcedure($this->chrt_array['sql'])) {
             $sql_query = $this->chrt_array['sql'];
             if (GetDatabaseType() == 2) {
                 $pos = strrpos(strtoupper($sql_query), "ORDER BY");
                 if ($pos) {
                     $sql_query = substr($sql_query, 0, $pos);
                 }
             }
             if (GetDatabaseType() != 1) {
                 //Oracle
                 $this->strSQL = "select * from (" . $sql_query . ") as custom_query" . $this->chrt_array['where'];
             } else {
                 $this->strSQL = "select * from (" . $sql_query . ")" . $this->chrt_array['where'];
             }
         } else {
             $this->strSQL = $this->chrt_array['sql'];
         }
     }
     if (tableEventExists("UpdateChartSettings", $strTableName)) {
         $eventObj = getEventObject($strTableName);
         $eventObj->UpdateChartSettings($this);
     }
 }
 /**
  * Constructor, accepts array of parametres, which will be copied to object properties by link
  *
  * @param array $params
  * @return SearchPanel
  */
 function SearchPanel(&$params)
 {
     // copy properties to object
     RunnerApply($this, $params);
     $this->searchClauseObj =& $this->pageObj->searchClauseObj;
     $this->id = $this->pageObj->id;
     $this->tName = $this->pageObj->tName;
     $this->panelState = $this->searchClauseObj->getSrchPanelAttrs();
     $this->isUseAjaxSuggest = GetTableData($this->tName, ".isUseAjaxSuggest", true);
     $this->searchControlBuilder = new PanelSearchControl($this->id, $this->tName, $this->searchClauseObj, $this->pageObj);
     // get search permissions if not passed to constructor
     if (!isset($params['searchPerm'])) {
         $this->searchPerm = $this->getSearchPerm();
     }
     // get search fields if not passed to contructor
     if (!isset($params['panelSearchFields'])) {
         $this->panelSearchFields = GetTableData($this->tName, ".panelSearchFields", array());
     }
     if (!isset($params['globSearchFields'])) {
         $this->globSearchFields = GetTableData($this->tName, ".globSearchFields", array());
     }
     if (!isset($params['allSearchFields'])) {
         $this->allSearchFields = GetTableData($this->tName, '.allSearchFields', array());
     }
 }
    $params['searchFieldsArr'] = $allSearchFields;
    $params['sessionPrefix'] = $sessionPrefix;
    $params['panelSearchFields'] = GetTableData($strTableName, ".panelSearchFields", array());
    $params['googleLikeFields'] = GetTableData($strTableName, ".googleLikeFields", array());
    $searchClauseObj = new SearchClause($params);
}
// array of vals
$response = array();
if (postvalue("start")) {
    $suggestAllContent = false;
}
$searchFor = postvalue('searchFor');
$searchField = GoodFieldName(postvalue('searchField'));
$strSecuritySql = SecuritySQL("Search", $strTableName);
if ($searchField == "") {
    $allSearchFields = GetTableData($strTableName, '.googleLikeFields', array());
}
// proccess fields and create sql
foreach ($allSearchFields as $f) {
    $fType = GetFieldType($f, $strTableName);
    // filter fields by type
    if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || IsTextType($fType)) {
        continue;
    }
    // get suggest for field
    if (($searchField == '' || $searchField == GoodFieldName($f)) && CheckFieldPermissions($f)) {
        $where = "";
        $having = "";
        if (!$gQuery->IsAggrFuncField(GetFieldIndex($f) - 1)) {
            $where = $searchClauseObj->getSuggestWhere($f, $fType, $suggestAllContent, $searchFor);
        } elseif ($gQuery->IsAggrFuncField(GetFieldIndex($f) - 1)) {
Esempio n. 19
0
function xt_showchart($params)
{
    $width = 700;
    $height = 530;
    if (array_key_exists("custom1", $params)) {
        $width = $params["custom1"];
    }
    if (array_key_exists("custom2", $params)) {
        $height = $params["custom2"];
    }
    $refresh = GetTableData($params["table"], ".ChartRefreshTime", 10) * 60000;
    if ($_SERVER["SERVER_PORT"] == 443) {
        $http = "https";
    } else {
        $http = "http";
    }
    ?>
<div id='<?php 
    echo $params["chartname"];
    ?>
'>
<noscript>
	<object id="<?php 
    echo $params['chartname'];
    ?>
" 
			name="<?php 
    echo $params['chartname'];
    ?>
" 
			classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
			width="100%" 
			height="100%" 
			codebase="<?php 
    echo $http;
    ?>
://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
		<param name="movie" value="libs/swf/Preloader.swf" />
		<param name="bgcolor" value="#FFFFFF" />
		<param name="wmode" value="opaque" />
		<param name="allowScriptAccess" value="always" />
		<param name="flashvars" value="swfFile=<?php 
    echo 'dchartdata.php%3Fchartname%3D' . $params['chartname'];
    ?>
" />
		
		<embed type="application/x-shockwave-flash" 
			   pluginspage="<?php 
    echo $http;
    ?>
://www.adobe.com/go/getflashplayer" 
			   src="libs/swf/Preloader.swf" 
			   width="100%" 
			   height="100%" 
			   id="<?php 
    echo $params['chartname'];
    ?>
" 
			   name="<?php 
    echo $params['chartname'];
    ?>
" 
			   bgColor="#FFFFFF" 
			   allowScriptAccess="always" 
			   flashvars="swfFile=<?php 
    echo 'dchartdata.php%3Fchartname%3D' . $params['chartname'];
    ?>
" />
	</object>				
</noscript>
<script type="text/javascript">
	//<![CDATA[
	document.write('<center>');
	document.write("You need to have Adobe Flash Player 9 (or above) to view the chart.<br /><br />");
	document.write("<a href=\"<?php 
    echo $http;
    ?>
://www.adobe.com/go/getflashplayer\"><img border=\"0\" src=\"<?php 
    echo $http;
    ?>
://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" /></a><br />");
	document.write('</center>');
	//]]>
</script>
<script type="text/javascript" language="javascript" src="libs/js/AnyChart.js"></script>
<script type="text/javascript" language="javascript">
	//<![CDATA[
	var chart = new AnyChart('libs/swf/AnyChart.swf','libs/swf/Preloader.swf');
	chart.width = '<?php 
    echo $width;
    ?>
';
	chart.height = '<?php 
    echo $height;
    ?>
';
	chart.wMode='opaque';

	var xmlFile = 'dchartdata.php?chartname=<?php 
    echo jsreplace($params["chartname"]);
    ?>
';
	xmlFile += '&ctype=<?php 
    echo $params["ctype"];
    ?>
';
	chart.setXMLFile(xmlFile);
	chart.write('<?php 
    echo $params["chartname"];
    ?>
');
	if("<?php 
    echo $refresh;
    ?>
"!="0")
		setInterval('refreshChart()',<?php 
    echo $refresh;
    ?>
);
	function refreshChart()
	{
		page='dchartdata.php?chartname=<?php 
    echo jsreplace($params["chartname"]);
    ?>
';
		params={
				action:'refresh',
				rndval:Math.random()
				};
		$.get(page,params,function(xml)
			{
				var arr = new Array();
				arr=xml.split("\n");
				for(i=0; i<arr.length;i+=2)
				{
					chart.removeSeries(arr[i]);
					chart.addSeries(arr[i+1]);
					chart.updatePointData(arr[i]+"_gauge",arr[i]+"_point",{value: arr[i+1]});
				}
				chart.refresh();
			});

	}
	//]]>
</script>
</div>
<?php 
}
                $permis = array();
                $keylink = "";
                $k = 0;
                foreach ($keys as $idx => $val) {
                    if ($k != 0) {
                        $keylink .= "&";
                    }
                    $keylink .= "editid" . ++$k . "=" . htmlspecialchars(rawurlencode(@$val));
                }
                $permis = $pageObject->getPermissions();
                if (count($keys)) {
                    $message .= "</br>";
                    if (GetTableData($strTableName, ".edit", false) && $permis['edit']) {
                        $message .= '&nbsp;<a href=\'Month_Billings_edit.php?' . $keylink . '\'>' . mlang_message("EDIT") . '</a>&nbsp;';
                    }
                    if (GetTableData($strTableName, ".view", false) && $permis['search']) {
                        $message .= '&nbsp;<a href=\'Month_Billings_view.php?' . $keylink . '\'>' . mlang_message("VIEW") . '</a>&nbsp;';
                    }
                }
                $mesClass = "mes_ok";
            }
        } elseif ($inlineadd != ADD_INLINE) {
            $mesClass = "mes_not";
        }
    } else {
        $message = $usermessage;
        $status = "DECLINED";
        $readavalues = true;
    }
}
$message = "<div class='message " . $mesClass . "'>" . $message . "</div>";
    $returnJSON = array("success" => false, "error" => 'Error: You have not permission for read this text');
    echo my_json_encode($returnJSON);
    return;
}
if (!$gQuery->HasGroupBy()) {
    // Do not select any fields except current (full text) field.
    // If query has 'group by' clause then other fields are used in it and we may not simply cut 'em off.
    // Just don't do anything in that case.
    $gQuery->RemoveAllFieldsExcept(GetFieldIndex($field));
}
$keysArr = GetTableData($strTableName, '.Keys', array());
$keys = array();
foreach ($keysArr as $ind => $k) {
    $keys[$k] = postvalue("key" . ($ind + 1));
}
$where = KeyWhere($keys);
$secOpt = GetTableData($strTableName, '.nSecOptions', array());
if ($secOpt == ADVSECURITY_VIEW_OWN) {
    $where = whereAdd($where, SecuritySQL("Search"));
}
$sql = gSQLWhere($where);
$rs = db_query($sql, $conn);
if (!$rs || !($data = db_fetch_array($rs))) {
    $returnJSON = array("success" => false, "error" => 'Error: Wrong SQL query');
    echo my_json_encode($returnJSON);
    return;
}
$value = nl2br(htmlspecialchars($data[$field]));
$returnJSON = array("success" => true, "textCont" => $value);
echo my_json_encode($returnJSON);
return;
$arr['fName'] = "Peak Power";
$arr['viewFormat'] = ViewFormat("Peak Power", $strTableName);
$fieldsArr[] = $arr;
$arr = array();
$arr['fName'] = "Date Time";
$arr['viewFormat'] = ViewFormat("Date Time", $strTableName);
$fieldsArr[] = $arr;
$arr = array();
$arr['fName'] = "IsSync";
$arr['viewFormat'] = ViewFormat("IsSync", $strTableName);
$fieldsArr[] = $arr;
$arr = array();
$arr['fName'] = "Currunt Readings";
$arr['viewFormat'] = ViewFormat("Currunt Readings", $strTableName);
$fieldsArr[] = $arr;
$mainTableOwnerID = GetTableData($strTableName, ".mainTableOwnerID", '');
$ownerIdValue = "";
$pageObject->setGoogleMapsParams($fieldsArr);
while ($data) {
    $xt->assign("show_key1", htmlspecialchars(GetData($data, "Record ID", "")));
    $keylink = "";
    $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["Record ID"]));
    ////////////////////////////////////////////
    //Record ID -
    $value = "";
    $value = ProcessLargeText(GetData($data, "Record ID", ""), "", "", MODE_VIEW);
    if ($mainTableOwnerID == "Record ID") {
        $ownerIdValue = $value;
    }
    $xt->assign("Record_ID_value", $value);
    if (!$pageObject->isAppearOnTabs("Record ID")) {
function GetLockingObject($table = "")
{
    return NULL;
    if (!$table) {
        global $strTableName;
        $table = $strTableName;
    }
    if (GetTableData($table, '.locking', false)) {
        require_once getabspath("include/locking.php");
        return new oLocking();
    } else {
        return NULL;
    }
}
         $rowcount = $eventObj->ListGetRowCount($pageObject->searchClauseObj, $_SESSION[$strTableName . "_mastertable"], $masterKeysReq, $selected_recs);
     }
     if ($rowcount !== false) {
         $numrows = $rowcount;
     } else {
         $numrows = gSQLRowCount($strWhereClause, $strHavingClause);
     }
 }
 LogInfo($strSQL);
 //	 Pagination:
 $nPageSize = 0;
 if (@$_REQUEST["records"] == "page" && $numrows) {
     $mypage = (int) @$_SESSION[$strTableName . "_pagenumber"];
     $nPageSize = (int) @$_SESSION[$strTableName . "_pagesize"];
     if (!$nPageSize) {
         $nPageSize = GetTableData($strTableName, ".pageSize", 0);
     }
     if ($nPageSize < 0) {
         $nPageSize = 0;
     }
     if ($nPageSize > 0) {
         if ($numrows <= ($mypage - 1) * $nPageSize) {
             $mypage = ceil($numrows / $nPageSize);
         }
         if (!$mypage) {
             $mypage = 1;
         }
         $strSQL = AddTop($strSQL, $mypage * $nPageSize);
     }
 }
 $listarray = false;
function ExportToExcel()
{
    global $rs, $nPageSize, $strTableName, $conn, $eventObj;
    if ($eventObj->exists("ListFetchArray")) {
        $row = $eventObj->ListFetchArray($rs);
    } else {
        $row = db_fetch_array($rs);
    }
    //	if(!$row)
    //		return;
    $arrLabel = array();
    $arrColumnWidth = array();
    $arrTotal = array();
    $arrTotalMessage = array();
    $totals = array();
    $arrFields = array();
    $arrTmpTotal = array();
    $arrFields = GetFieldsList($strTableName);
    $arrTmpTotal = GetTableData($strTableName, ".totalsFields", array());
    foreach ($arrFields as $value) {
        $arrLabel[$value] = label($value, $strTableName);
        $arrColumnWidth[$value] = 10;
        $totals[$value] = 0;
        $totalsType = "";
        foreach ($arrTmpTotal as $tvalue) {
            if ($tvalue["fName"] == $value) {
                $totalsType = $tvalue["totalsType"];
            }
        }
        $totalsFields[] = array('fName' => $value, 'totalsType' => $totalsType, 'viewFormat' => ViewFormat($value, $strTableName));
    }
    // write data rows
    $iNumberOfRows = 0;
    $objPHPExcel = ExportExcelInit($arrLabel, $arrColumnWidth);
    while ((!$nPageSize || $iNumberOfRows < $nPageSize) && $row) {
        countTotals($totals, $totalsFields, $row);
        $values = array();
        $arrData = array();
        $arrDataType = array();
        foreach ($arrFields as $value) {
            if (GetEditFormat($value, $strTableName) == EDIT_FORMAT_LOOKUP_WIZARD || GetEditFormat($value, $strTableName) == EDIT_FORMAT_RADIO) {
                $values[$value] = "";
                if (strlen($row[$value])) {
                    $values[$value] = DisplayLookupWizard($value, $row[$value], $row, "", MODE_EXPORT);
                }
            } elseif (IsBinaryType(GetFieldType($value, $strTableName))) {
                $values[$value] = $row[$value];
            } else {
                if (ViewFormat($value, $strTableName) != FORMAT_FILE_IMAGE && ViewFormat($value, $strTableName) != FORMAT_FILE && ViewFormat($value, $strTableName) != FORMAT_HYPERLINK && ViewFormat($value, $strTableName) != FORMAT_EMAILHYPERLINK && ViewFormat($value, $strTableName) != FORMAT_CHECKBOX) {
                    $format = ViewFormat($value, $strTableName);
                } else {
                    $format = FORMAT_NONE;
                }
                $values[$value] = GetData($row, $value, $format);
            }
        }
        $eventRes = true;
        if ($eventObj->exists('BeforeOut')) {
            $eventRes = $eventObj->BeforeOut($row, $values, $arrColumnWidth, $iNumberOfRows + 1, $objPHPExcel);
        }
        if ($eventRes) {
            $iNumberOfRows++;
            $i = 0;
            foreach ($arrFields as $value) {
                if (IsBinaryType(GetFieldType($value, $strTableName))) {
                    $arrDataType[$value] = "binary";
                } elseif (ViewFormat($value, $strTableName) == FORMAT_FILE_IMAGE) {
                    $arrDataType[$value] = "file";
                } elseif (ViewFormat($value, $strTableName) == FORMAT_DATE_SHORT || ViewFormat($value, $strTableName) == FORMAT_DATE_LONG || ViewFormat($value, $strTableName) == FORMAT_DATE_TIME) {
                    $arrDataType[$value] = "date";
                } else {
                    $arrDataType[$value] = "";
                }
                $arrData[$value] = $values[$value];
            }
            ExportExcelRecord($arrData, $arrDataType, $iNumberOfRows, $objPHPExcel);
        }
        if ($eventObj->exists("ListFetchArray")) {
            $row = $eventObj->ListFetchArray($rs);
        } else {
            $row = db_fetch_array($rs);
        }
    }
    if (count($arrTmpTotal)) {
        foreach ($arrFields as $fName) {
            $value = array();
            foreach ($arrTmpTotal as $tvalue) {
                if ($tvalue["fName"] == $fName) {
                    $value = $tvalue;
                }
            }
            $total = "";
            $totalMess = "";
            if ($value["totalsType"]) {
                if ($value["totalsType"] == "COUNT") {
                    $totalMess = "Count" . ": ";
                } elseif ($value["totalsType"] == "TOTAL") {
                    $totalMess = "Total" . ": ";
                } elseif ($value["totalsType"] == "AVERAGE") {
                    $totalMess = "Average" . ": ";
                }
                $total = GetTotals($fName, $totals[$fName], $value["totalsType"], $iNumberOfRows, $value["viewFormat"]);
            }
            $arrTotal[$fName] = $total;
            $arrTotalMessage[$fName] = $totalMess;
        }
    }
    ExportExcelTotals($arrTotal, $arrTotalMessage, ++$iNumberOfRows, $objPHPExcel);
    $formatExcel = "Excel2007";
    $extExcel = ".xlsx";
    if (@$_REQUEST["type"] == "excel5") {
        $formatExcel = "Excel5";
        $extExcel = ".xls";
    }
    ExportExcelSave(GoodFieldName($strTableName) . $extExcel, $formatExcel, $objPHPExcel);
}