} else if($c->action == $c->chartActions["figurePrint"]) { if(in_array(User::$PRIVILEGE_VIEW_FLIGHTS, $c->_user->privilege)) { if(isset($c->data['flightId']) && isset($c->data['fromTime']) && isset($c->data['toTime']) && isset($c->data['prms'])) { $flightId = $c->data['flightId']; $fromTime = $c->data['fromTime'] / 1000; //to cast js to php timestamps $toTime = $c->data['toTime'] / 1000; $prms = $c->data['prms']; $step = $c->GetTableStep($flightId); $globalRawParamArr = $c->GetTableRawData($flightId, $prms, $fromTime, $toTime); $totalRecords = count($globalRawParamArr[1]); // 0 is time and may be lager than data $exportFileInfo = $c->GetExportFileName($flightId); $exportedFileName = $exportFileInfo["name"]; $exportedFilePath = $exportFileInfo["path"]; $exportedFileDesc = fopen($exportedFilePath, "w"); $figPrRow = "time;"; for($i = 0; $i < count($prms); $i++) { $paramInfo = $c->GetParamInfo($flightId, $prms[$i]); $figPrRow .= iconv('utf-8', 'windows-1251', $paramInfo['name']) . ";";