Пример #1
0
 function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data)
 {
     parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data);
     $nWidth = $this->pageObject->pSetEdit->getNCols($this->field);
     $nHeight = $this->pageObject->pSetEdit->getNRows($this->field);
     if ($this->pageObject->pSetEdit->isUseRTE($this->field)) {
         $value = $this->RTESafe($value);
         // creating src url
         $browser = "";
         if (@$_REQUEST["browser"] == "ie") {
             $browser = "&browser=ie";
         }
         // add JS code
         echo "<iframe frameborder=\"0\" vspace=\"0\" hspace=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" id=\"" . $this->cfield . "\" " . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? "alt=\"" . $this->strLabel . "\" " : "") . "name=\"" . $this->cfield . "\" title=\"Basic rich text editor\" style='";
         if (!isMobile()) {
             echo "width: " . ($nWidth + 1) . "px;";
         }
         echo "height: " . ($nHeight + 100) . "px;'";
         echo " src=\"" . GetTableLink("rte", "", "ptype=" . $this->pageObject->pageType . "&table=" . GetTableURL($this->pageObject->tName) . "&" . "id=" . $this->id . "&" . $this->iquery . $browser . "&" . ($mode == MODE_ADD || $mode == MODE_INLINE_ADD ? "action=add" : '')) . "\">";
         echo "</iframe>";
     } else {
         echo '<textarea id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" style="';
         if (!isMobile()) {
             echo "width: " . $nWidth . "px;";
         }
         echo 'height: ' . $nHeight . 'px;">' . runner_htmlspecialchars($value) . '</textarea>';
     }
     $this->buildControlEnd($validate);
 }
Пример #2
0
 /**
  * @constructor
  * @param &Array params
  */
 function DashboardPage(&$params)
 {
     parent::RunnerPage($params);
     // Set language params, if have more than one language
     $this->setLangParams();
     $this->jsSettings['tableSettings'][$this->tName]['dashElements'] = array();
     //	calculate additional element settings
     foreach ($this->pSet->getDashboardElements() as $key => $elem) {
         $permissions = false;
         $newElem = $elem;
         if ($elem['type'] == DASHBOARD_RECORD) {
             // check tables (add, view, edit) permissinons befor add to js
             $newElem['tabsPageTypes'] = array();
             foreach ($elem['tabsPageTypes'] as $idx => $pageType) {
                 if ($this->CheckPermissions($elem['table'], $pageType)) {
                     $permissions = true;
                     $newElem['tabsPageTypes'][] = $pageType;
                 }
             }
         } elseif ($elem['type'] == DASHBOARD_DETAILS) {
             $eset = new ProjectSettings($elem['table']);
             $details = $eset->getDetailTablesArr();
             // add details shortTableNames
             $newElem['details'] = array();
             foreach ($details as $idx => $d) {
                 if (in_array($d['dDataSourceTable'], $elem['notUsedDetailTables'])) {
                     continue;
                 }
                 if ($this->CheckPermissions($d['dDataSourceTable'], $d['dType'])) {
                     $permissions = true;
                     $newElem['details'][$idx] = $d;
                     $this->jsSettings['tableSettings'][$d['dDataSourceTable']]['shortTName'] = $d['dShortTable'];
                 }
             }
         } elseif ($elem['type'] == DASHBOARD_CHART || $elem['type'] == DASHBOARD_REPORT || $elem['type'] == DASHBOARD_SEARCH) {
             $permissions = $this->CheckPermissions($elem['table'], "Search");
         } elseif ($elem['type'] == DASHBOARD_LIST) {
             $permissions = $this->CheckPermissions($elem['table'], "list");
         }
         $this->elementsPermissions[$key] = $permissions;
         if (!$permissions) {
             continue;
         }
         // add shortTableNames and element
         $this->jsSettings['tableSettings'][$elem['table']]['shortTName'] = GetTableURL($elem['table']);
         $this->jsSettings['tableSettings'][$this->tName]['dashElements'][$key] = $newElem;
     }
 }
Пример #3
0
 function setTable($table)
 {
     $this->_table = $table;
     global $tables_data, $field_labels, $fieldToolTips, $detailsTablesData, $masterTablesData, $tableEvents, $cipherer;
     if (GetTableURL($table) != "") {
         include_once getabspath("include/" . GetTableURL($table) . "_settings.php");
     }
     if (isset($tables_data[$this->_table])) {
         $this->_tableData =& $tables_data[$this->_table];
     }
     $this->_mastersTableData =& $masterTablesData[$this->_table];
     $this->_detailsTableData =& $detailsTablesData[$this->_table];
     $this->_editPage = $this->getDefaultEditPageType($this->isTableType());
     $this->_viewPage = $this->getDefaultViewPageType($this->isTableType());
     $this->_defaultEditPage = $this->_editPage;
     $this->_defaultViewPage = $this->_viewPage;
 }
Пример #4
0
 public function showDBValue(&$data, $keylink)
 {
     if ($this->container->forExport) {
         return "LONG BINARY DATA - CANNOT BE DISPLAYED";
     }
     $value = "";
     $titleField = $this->container->pSet->getAudioTitleField($this->field);
     $title = "";
     if ($titleField) {
         $title = htmlspecialchars($data[$titleField]);
     }
     if (@$data[$this->field] != NULL && $this->container->pageType != PAGE_PRINT) {
         $value = '<a class="htrack" type="audio/mpeg" title="' . $title . '" href="getfile.php?table=' . GetTableURL($this->container->pSet->_table) . '&field=' . rawurlencode($this->field) . $keylink . '">' . $title . '</a>';
     } else {
         $value = $title;
     }
     return $value;
 }
 public function showDBValue(&$data, $keylink)
 {
     $value = "";
     $fileNameF = $this->container->pSet->getFilenameField($this->field);
     if ($fileNameF) {
         $fileName = $data[$fileNameF];
         if (!$fileName) {
             $fileName = "file.bin";
         }
     } else {
         $fileName = "file.bin";
     }
     if (strlen($data[$this->field])) {
         $value = "<a href='" . GetTableLink("getfile", "", "table=" . GetTableURL($this->container->pSet->_table) . "&filename=" . rawurlencode($fileName) . "&field=" . rawurlencode($this->field) . $keylink) . "'>";
         $value .= runner_htmlspecialchars($fileName);
         $value .= "</a>";
     }
     return $value;
 }
 public function showDBValue(&$data, $keylink)
 {
     $value = "";
     $title = "";
     $titleField = $this->container->pSet->getAudioTitleField($this->field);
     if ($titleField) {
         $title = runner_htmlspecialchars($data[$titleField]);
     }
     if (@$data[$this->field] != NULL && $this->container->pageType != PAGE_PRINT) {
         if (!$title) {
             $title = "Track.mp3";
         }
         $href = GetTableLink('getfile', '', 'table=' . GetTableURL($this->container->pSet->_table) . '&field=' . rawurlencode($this->field) . $keylink . '&filename=' . $title);
         $link = '<a title="' . $title . '" href="' . $href . '">' . $title . '</a>';
         $value = '<audio controls preload="none" src="' . $href . '">' . $link . '</audio>';
     } else {
         $value = $title;
     }
     return $value;
 }
Пример #7
0
 public function showDBValue(&$data, $keylink)
 {
     if ($this->container->forExport) {
         return "LONG BINARY DATA - CANNOT BE DISPLAYED";
     }
     $value = "";
     $fileNameF = $this->container->pSet->getFilenameField($this->field);
     if ($fileNameF) {
         $fileName = $data[$fileNameF];
         if (!$fileName) {
             $fileName = "file.bin";
         }
     } else {
         $fileName = "file.bin";
     }
     if (strlen($data[$this->field])) {
         $value = "<a href='getfile.php?table=" . GetTableURL($this->container->pSet->_table) . "&filename=" . rawurlencode($fileName) . "&field=" . rawurlencode($this->field) . $keylink . "'>";
         $value .= htmlspecialchars($fileName);
         $value .= "</a>";
     }
     return $value;
 }
Пример #8
0
function ProcessLargeText($pSet, $strValue, $iquery = "", $table = "", $mode = MODE_LIST, $format = "", $isMobileLookup = false, $isReport = false)
{
    $cNumberOfChars = $pSet->getNumberOfChars();
    if (substr($strValue, 0, 8) == "<a href=" || substr($strValue, 0, 23) == "<img src=\"images/check_") {
        return $strValue;
    }
    $needShortening = $format != EDIT_FORMAT_LOOKUP_WIZARD && $cNumberOfChars > 0 && strlen($strValue) > $cNumberOfChars;
    if ($needShortening && ($mode == PAGE_LIST || $mode == PAGE_REPORT) && !$isMobileLookup) {
        global $strTableName;
        if (!$table) {
            $table = $strTableName;
        }
        $ret = GetShorteningForLargeText($strValue, $cNumberOfChars);
        $ret .= ' <a href="javascript:void(0);" query="fulltext.php?pagetype=' . $pSet->_viewPage . '&table=' . GetTableURL($table) . '&' . $iquery . '">' . "More" . ' ...</a>';
    } else {
        if ($needShortening && ($mode == PAGE_EXPORT && $isReport || $mode == PAGE_PRINT || $mode == PAGE_RPRINT || $isMobileLookup)) {
            $ret = GetShorteningForLargeText($strValue, $cNumberOfChars) . " ...";
        } else {
            $ret = htmlspecialchars($strValue);
        }
    }
    /*Left to future developments 
    //	highlight search results
    	if ($mode==MODE_LIST && $_SESSION[$strTableName."_search"]==1)
    	{
    		$ind = 0;
    		$searchopt=$_SESSION[$strTableName."_searchoption"];
    		$searchfor=$_SESSION[$strTableName."_searchfor"];
    //		highlight Contains search
    		if($searchopt=="Contains")
    		{
    			while ( ($ind = my_stripos($ret, $searchfor, $ind)) !== false )
    			{
    				$ret = substr($ret, 0, $ind) . "<span class=highlight>". substr($ret, $ind, strlen($searchfor)) ."</span>" . substr($ret, $ind + strlen($searchfor));
    				$ind+= strlen("<span class=highlight>") + strlen($searchfor) + strlen("</span>");
    			}
    		}
    //		highlight Starts with search
    		elseif($searchopt=="Starts with ...")
    		{
    			if( !strncasecmp($ret, $searchfor,strlen($searchfor)) )
    				$ret = "<span class=highlight>". substr($ret, 0, strlen($searchfor)) ."</span>" . substr($ret, strlen($searchfor));
    		}
    		elseif($searchopt=="Equals")
    		{
    			if( !strcasecmp($ret, $searchfor) )
    				$ret = "<span class=highlight>". $ret ."</span>";
    		}
    		elseif($searchopt=="More than ...")
    		{
    			if( strtoupper($ret)>strtoupper($searchfor) )
    				$ret = "<span class=highlight>". $ret ."</span>";
    		}
    		elseif($searchopt=="Less than ...")
    		{
    			if( strtoupper($ret)<strtoupper($searchfor) )
    				$ret = "<span class=highlight>". $ret ."</span>";
    		}
    		elseif($searchopt=="Equal or more than ...")
    		{
    			if( strtoupper($ret)>=strtoupper($searchfor) )
    				$ret = "<span class=highlight>". $ret ."</span>";
    		}
    		elseif($searchopt=="Equal or less than ...")
    		{
    			if( strtoupper($ret)<=strtoupper($searchfor) )
    				$ret = "<span class=highlight>". $ret ."</span>";
    		}
    	}
    */
    return nl2br($ret);
}
 // create second control, if need it
 $xt->assignbyref("Code_editcontrol1", $ctrlBlockArr['searchcontrol1']);
 // create search type select
 $xt->assign("searchtype_Code", $ctrlBlockArr['searchtype']);
 $isFieldNeedSecCtrl = $searchControlBuilder->isNeedSecondCtrl("Code");
 $ctrlInd = 0;
 if ($isFieldNeedSecCtrl) {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "Code", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd, 1 => $ctrlInd + 1));
     $ctrlInd += 2;
 } else {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "Code", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd));
     $ctrlInd++;
 }
 // search fields data
 if (GetLookupTable("Location", $strTableName)) {
     $pageObject->settingsMap["globalSettings"]['shortTNames'][GetLookupTable("Location", $strTableName)] = GetTableURL(GetLookupTable("Location", $strTableName));
 }
 $pageObject->fillFieldToolTips("Location");
 $srchFields = $pageObject->searchClauseObj->getSearchCtrlParams("Location");
 $firstFieldParams = array();
 if (count($srchFields)) {
     $firstFieldParams = $srchFields[0];
 } else {
     $firstFieldParams['fName'] = "Location";
     $firstFieldParams['eType'] = '';
     $firstFieldParams['value1'] = '';
     $firstFieldParams['opt'] = '';
     $firstFieldParams['value2'] = '';
     $firstFieldParams['not'] = false;
 }
 // create control
Пример #10
0
 function addFieldsSettings($arrFields, $pageBased, $pageType)
 {
     $dashSearchFields = $this->pSet->getDashboardSearchFields();
     foreach ($arrFields as $fieldName) {
         $pSet = new ProjectSettings($dashSearchFields[$fieldName][0]["table"]);
         $tableFieldName = $dashSearchFields[$fieldName][0]["field"];
         if (!array_key_exists($fieldName, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'])) {
             $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName] = array();
         }
         if (!array_key_exists($pageType, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName])) {
             $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType] = array();
         }
         foreach ($this->settingsMap["fieldSettings"] as $key => $val) {
             $fData = $pSet->getFieldData($tableFieldName, $key);
             if ($key == "validateAs") {
                 if ($pageType == PAGE_ADD || $pageType == PAGE_EDIT || $pageType == PAGE_REGISTER) {
                     $this->fillValidation($fData, $val, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType]);
                 }
                 continue;
             }
             if ($key == "RTEType") {
                 $fData = $pSet->getRTEType($tableFieldName);
                 if ($fData == "RTECK") {
                     $this->isUseCK = true;
                     $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType]['nWidth'] = $pSet->getNCols($tableFieldName);
                     $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType]['nHeight'] = $pSet->getNRows($tableFieldName);
                 }
             } elseif ($key == "autoCompleteFields") {
                 $fData = $pSet->getAutoCompleteFields($tableFieldName);
             }
             $isDefault = false;
             if (is_array($fData)) {
                 $isDefault = !count($fData);
             } else {
                 if (!is_array($val['default'])) {
                     $isDefault = $fData === $val['default'];
                 }
             }
             if (!$isDefault) {
                 $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fieldName][$pageType][$val['jsName']] = $fData;
             }
         }
         $this->jsSettings['tableSettings'][$this->tName]['isUseCK'] = $this->isUseCK;
         if (count($this->googleMapCfg) != 0 && $this->googleMapCfg['isUseGoogleMap']) {
             $this->jsSettings['tableSettings'][$this->tName]['isUseGoogleMap'] = true;
             $this->jsSettings['tableSettings'][$this->tName]['googleMapCfg'] = $this->googleMapCfg;
         }
         $lookupTableName = $pSet->getLookupTable($tableFieldName);
         if ($lookupTableName) {
             $this->jsSettings['global']['shortTNames'][$lookupTableName] = GetTableURL($lookupTableName);
         }
         if ($pSet->getEditFormat($tableFieldName) == 'Time') {
             $this->fillTimePickSettings($tableFieldName, "", $pSet, $pageType);
         }
     }
 }
 // create second control, if need it
 $xt->assignbyref("Units_editcontrol1", $ctrlBlockArr['searchcontrol1']);
 // create search type select
 $xt->assign("searchtype_Units", $ctrlBlockArr['searchtype']);
 $isFieldNeedSecCtrl = $searchControlBuilder->isNeedSecondCtrl("Units");
 $ctrlInd = 0;
 if ($isFieldNeedSecCtrl) {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "Units", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd, 1 => $ctrlInd + 1));
     $ctrlInd += 2;
 } else {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "Units", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd));
     $ctrlInd++;
 }
 // search fields data
 if (GetLookupTable("PerUnit Price", $strTableName)) {
     $pageObject->settingsMap["globalSettings"]['shortTNames'][GetLookupTable("PerUnit Price", $strTableName)] = GetTableURL(GetLookupTable("PerUnit Price", $strTableName));
 }
 $pageObject->fillFieldToolTips("PerUnit Price");
 $srchFields = $pageObject->searchClauseObj->getSearchCtrlParams("PerUnit Price");
 $firstFieldParams = array();
 if (count($srchFields)) {
     $firstFieldParams = $srchFields[0];
 } else {
     $firstFieldParams['fName'] = "PerUnit Price";
     $firstFieldParams['eType'] = '';
     $firstFieldParams['value1'] = '';
     $firstFieldParams['opt'] = '';
     $firstFieldParams['value2'] = '';
     $firstFieldParams['not'] = false;
 }
 // create control
Пример #12
0
    $requestAction = $_REQUEST['_action'];
}
$pSet = new ProjectSettings($strTableName, $pageType);
if ($requestAction == "POST") {
    if ($pageType == PAGE_ADD && !$pSet->appearOnAddPage($field) && !$pSet->appearOnInlineAdd($field) || $pageType == PAGE_EDIT && !$pSet->appearOnEditPage($field) && !$pSet->appearOnInlineEdit($field) || $pageType == PAGE_REGISTER && !$pSet->appearOnRegisterOrSearchPage($field, $pageType) || $pageType != PAGE_ADD && $pageType != PAGE_EDIT && $pageType != PAGE_REGISTER) {
        exit("You have no permissions for this action");
    }
} else {
    if (!$pSet->checkFieldPermissions($field) && ($pageType != PAGE_ADD || !$pSet->appearOnAddPage($field) && !$pSet->appearOnInlineAdd($field))) {
        exit("You have no permissions for this action");
    }
}
if (!$isPDF) {
    add_nocache_headers();
}
include_once "include/" . GetTableURL($strTableName) . "_variables.php";
//	check if logged in
if ($requestAction == 'POST') {
    $havePermission = CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Add") || CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Edit");
} else {
    $havePermission = CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Search");
}
if (!isLogged() && $pageType != PAGE_REGISTER || !$havePermission) {
    header("Location: login.php");
    return;
}
require_once getabspath('classes/uploadhandler.php');
$upload_handler = new UploadHandler(getOptionsForMultiUpload($pSet, $field));
$upload_handler->pSet = $pSet;
$upload_handler->field = $field;
$upload_handler->table = $strTableName;
 /**
  * Get redirect location for menu page
  * @return {mixed}
  */
 function getRedirectForMenuPage()
 {
     $allowedMenuItems = 0;
     $redirect = '';
     for ($i = 0; $i < count($this->menuTables); $i++) {
         $tName = $this->menuTables[$i]['tName'];
         $nType = $this->menuTables[$i]['nType'];
         if ($this->permis[$tName]['add'] || $this->permis[$tName]['search']) {
             $pageType = "";
             if ($this->permis[$tName]['search'] && ($nType == titTABLE || $nType == titVIEW)) {
                 $pageType = "list";
                 if ($this->permis[$tName]['add']) {
                     $strPerm = GetUserPermissions($tName);
                 }
                 if (isset($strPerm) && strpos($strPerm, "A") !== false && strpos($strPerm, "S") === false) {
                     $pageType = "add";
                 }
             } elseif ($this->permis[$tName]['add'] && ($nType == titTABLE || $nType == titVIEW)) {
                 $pageType = "add";
             } elseif ($nType == titREPORT) {
                 $pageType = "report";
             } elseif ($nType == titCHART) {
                 $pageType = "chart";
             }
             $redirect = GetTableURL($tName) . '_' . $pageType . ".php";
             $allowedMenuItems++;
         }
     }
     if ($this->isDynamicPerm && IsAdmin()) {
         $redirect = "admin_rights_list.php";
         $allowedMenuItems++;
     }
     if ($this->isAddWebRep) {
         $redirect = "webreport.php";
         $allowedMenuItems++;
     }
     if ($allowedMenuItems < 2) {
         return $redirect;
     }
     return false;
 }
Пример #14
0
 /**
  * @constructor
  * @param Array rpt_array
  * @param String strSQL
  */
 function CrossTableReport($rpt_array, $strSQL)
 {
     $this->xml_array = $rpt_array;
     if ($rpt_array["table_type"]) {
         $this->table_type = $rpt_array["table_type"];
     }
     if ($rpt_array["fromWizard"]) {
         $this->fromWizard = true;
     }
     $this->tableName = $this->xml_array["tables"][0];
     $this->setDbConnection();
     $this->shortTableName = GetTableURL($this->tableName);
     if (strlen($this->shortTableName) == 0) {
         $this->shortTableName = $this->tableName;
     }
     $this->pSet = new ProjectSettings($this->tableName, PAGE_REPORT);
     if ($this->fromWizard) {
         include_once getabspath("classes/controls/ViewControlsContainer.php");
         $this->viewControls = new ViewControlsContainer($this->pSet, PAGE_REPORT);
         $this->tableKeys = $this->pSet->getTableKeys();
         if ($rpt_array["dashBased"]) {
             $this->dashBased = true;
             $this->dashTName = $rpt_array["dashTName"];
         }
     }
     $this->setSessionPrefix($rpt_array["sessionPrefix"]);
     $this->fillSessionVariables();
     $this->dataField = $this->getDataField($_SESSION[$this->sessionPrefix . "_field"]);
     if (!strlen($this->dataField)) {
         $this->dataField = $_SESSION['webreports']['group_fields'][0]["name"];
     }
     $this->initDataFieldSettings();
     $this->initDataGroupFunction($_SESSION[$this->sessionPrefix . "_group_func"]);
     // assign index_field_x, index_field_y properties
     $this->setAxisFieldsIndices();
     $crtableSQL = $this->getstrSQL($strSQL);
     $qResult = $this->connection->query($crtableSQL);
     $group_y = array();
     $group_x = array();
     $sort_y = array();
     $arrdata = array();
     $arravgsum = array();
     $arravgcount = array();
     $avgsumx = array();
     $avgcountx = array();
     while ($data = $qResult->fetchNumeric()) {
         if (!in_array($data[1], $group_y)) {
             $group_y[] = $data[1];
             $sort_y[] = count($sort_y);
         }
         if (!in_array($data[2], $group_x)) {
             $group_x[] = $data[2];
             $this->col_summary["data"][count($group_x) - 1]["col_summary"] = "&nbsp;";
             $this->col_summary["data"][count($group_x) - 1]["id_col_summary"] = "total_x_" . (count($group_x) - 1);
         }
         $key_y = array_search($data[1], $group_y);
         $key_x = array_search($data[2], $group_x);
         $avgsumx[$key_x] = 0;
         $avgcountx[$key_x] = 0;
         if (!$this->is_value_empty) {
             $arrdata[$key_y][$key_x] = $data[0];
             $arravgsum[$key_y][$key_x] = $data[3];
             $arravgcount[$key_y][$key_x] = $data[4];
         } else {
             $arrdata[$key_y][$key_x] = "&nbsp;";
         }
     }
     //	sort y groups
     global $group_sort_y;
     $group_sort_y = $group_y;
     SortForCrosstable($sort_y);
     foreach ($sort_y as $key_y) {
         $value_y = $group_y[$key_y];
         $this->rowinfo[$key_y]["row_summary"] = "&nbsp;";
         $this->rowinfo[$key_y]["group_y"] = $this->getAxisDisplayValue($this->index_field_y, $value_y);
         foreach ($group_x as $key_x => $value_x) {
             if (array_key_exists($key_y, $arrdata)) {
                 $rowValue = "&nbsp;";
                 if (array_key_exists($key_x, $arrdata[$key_y]) && !$this->is_value_empty && !is_null($arrdata[$key_y][$key_x])) {
                     $rowValue = $arrdata[$key_y][$key_x];
                     if ($this->dataGroupFunction == "avg") {
                         $rowValue = round($rowValue, 2);
                     }
                 }
                 $this->rowinfo[$key_y]["row_record"]["data"][$key_x]["row_value"] = $rowValue;
                 $this->rowinfo[$key_y]["row_record"]["data"][$key_x]["id_data"] = $key_y . "_" . $key_x;
             }
         }
         $this->rowinfo[$key_y]["id_row_summary"] = "total_y_" . $key_y;
     }
     foreach ($group_x as $key_x => $value_x) {
         if ($value_x != "") {
             $this->group_header["data"][$key_x]["gr_value"] = $this->getAxisDisplayValue($this->index_field_x, $value_x);
         } else {
             $this->group_header["data"][$key_x]["gr_value"] = "&nbsp;";
         }
     }
     $sum_x = $this->xml_array["group_fields"][count($this->xml_array["group_fields"]) - 1]["sum_x"];
     $sum_y = $this->xml_array["group_fields"][count($this->xml_array["group_fields"]) - 1]["sum_y"];
     $sum_total = $this->xml_array["group_fields"][count($this->xml_array["group_fields"]) - 1]["sum_total"];
     $this->total_summary = "&nbsp;";
     foreach ($this->rowinfo as $key_y => $obj_y) {
         $obj_x = $obj_y["row_record"]["data"];
         foreach ($obj_x as $key_x => $value) {
             if ($value["row_value"] !== "&nbsp;") {
                 switch ($this->dataGroupFunction) {
                     case "sum":
                         if (!is_null($value["row_value"])) {
                             $this->rowinfo[$key_y]["row_summary"] += $value["row_value"];
                             $this->col_summary["data"][$key_x]["col_summary"] += $value["row_value"];
                             $this->total_summary += $value["row_value"];
                         }
                         break;
                     case "min":
                         if (($this->rowinfo[$key_y]["row_summary"] === "&nbsp;" || $value["row_value"] < $this->rowinfo[$key_y]["row_summary"]) && !is_null($value["row_value"])) {
                             $this->rowinfo[$key_y]["row_summary"] = $value["row_value"];
                         }
                         if (($this->col_summary["data"][$key_x]["col_summary"] === "&nbsp;" || $this->col_summary["data"][$key_x]["col_summary"] > $value["row_value"]) && !is_null($value["row_value"])) {
                             $this->col_summary["data"][$key_x]["col_summary"] = $value["row_value"];
                         }
                         if (($this->total_summary === "&nbsp;" || $this->total_summary > $value["row_value"]) && !is_null($value["row_value"])) {
                             $this->total_summary = $value["row_value"];
                         }
                         break;
                     case "max":
                         if ($this->rowinfo[$key_y]["row_summary"] === "&nbsp;" || $value["row_value"] > $this->rowinfo[$key_y]["row_summary"]) {
                             $this->rowinfo[$key_y]["row_summary"] = $value["row_value"];
                         }
                         if ($this->col_summary["data"][$key_x]["col_summary"] === "&nbsp;" || $this->col_summary["data"][$key_x]["col_summary"] < $value["row_value"]) {
                             $this->col_summary["data"][$key_x]["col_summary"] = $value["row_value"];
                         }
                         if ($this->total_summary === "&nbsp;" || $this->total_summary < $value["row_value"]) {
                             $this->total_summary = $value["row_value"];
                         }
                         break;
                     case "avg":
                         $this->rowinfo[$key_y]["avgsumy"] += $arravgsum[$key_y][$key_x];
                         $this->rowinfo[$key_y]["avgcounty"] += $arravgcount[$key_y][$key_x];
                         $this->rowinfo[$key_y]["row_record"]["data"][$key_x]["avgsumx"] += $arravgsum[$key_y][$key_x];
                         $this->rowinfo[$key_y]["row_record"]["data"][$key_x]["avgcountx"] += $arravgcount[$key_y][$key_x];
                         break;
                 }
                 if ($sum_x == true && !$this->is_value_empty && !is_null($this->col_summary["data"][$key_x]["col_summary"])) {
                     if (is_numeric($this->col_summary["data"][$key_x]["col_summary"])) {
                         $this->col_summary["data"][$key_x]["col_summary"] = round($this->col_summary["data"][$key_x]["col_summary"], 2);
                     }
                 } else {
                     $this->col_summary["data"][$key_x]["col_summary"] = "&nbsp;";
                 }
             }
         }
         if ($sum_y == true && !$this->is_value_empty && !is_null($this->rowinfo[$key_y]["row_summary"])) {
             if (is_numeric($this->rowinfo[$key_y]["row_summary"])) {
                 $this->rowinfo[$key_y]["row_summary"] = round($this->rowinfo[$key_y]["row_summary"], 2);
             }
         } else {
             $this->rowinfo[$key_y]["row_summary"] = "&nbsp;";
         }
     }
     if ($this->dataGroupFunction == "avg") {
         $total_sum = 0;
         $total_count = 0;
         foreach ($this->rowinfo as $key_y => $valuey) {
             if ($valuey["avgcounty"]) {
                 $this->rowinfo[$key_y]["row_summary"] = round($valuey["avgsumy"] / $valuey["avgcounty"], 2);
                 $total_sum += $valuey["avgsumy"];
                 $total_count += $valuey["avgcounty"];
             }
             foreach ($valuey["row_record"]["data"] as $key_x => $valuex) {
                 if ($valuex["avgcountx"]) {
                     $avgsumx[$key_x] += $valuex["avgsumx"];
                     $avgcountx[$key_x] += $valuex["avgcountx"];
                     $total_sum += $valuex["avgsumx"];
                     $total_count += $valuex["avgcountx"];
                 }
             }
         }
         foreach ($avgsumx as $key => $value) {
             if ($avgcountx[$key]) {
                 $this->col_summary["data"][$key]["col_summary"] = round($value / $avgcountx[$key], 2);
             }
         }
         if ($total_count) {
             $this->total_summary = $total_sum / $total_count;
         }
     }
     if ($sum_total != true || $this->is_value_empty) {
         $this->total_summary = "&nbsp;";
     } elseif (is_numeric($this->total_summary)) {
         $this->total_summary = round($this->total_summary, 2);
     }
     $this->updateRecordsDisplayedFields();
 }
Пример #15
0
 /**
  * Get the More link following the truncated and highlighted field's content
  * @param String value				The field's content
  * @param Number cNumberOfChars		
  * @param String keylink	
  * @param Boolean isLookup			An indicator showing if this is a lookup list page control. 
  *									It's alway equal to false for the view as HTML field	
  * @return String	
  */
 protected function getShorteningTextAndMoreLink($value, $cNumberOfChars, $keylink, $isLookup)
 {
     $data = $this->getPocessedHTMLValueData($value, $cNumberOfChars);
     $isTruncated = $data["isTruncated"];
     $processedValue = $data["value"];
     if ($this->searchHighlight) {
         if ($isTruncated) {
             $processedValue = $this->highlightTruncatedBeforeMore($value, $processedValue, $cNumberOfChars, $data["truncLength"]);
         } else {
             $processedValue = $this->highlightSearchWord($processedValue, false, "");
         }
     }
     if ($isTruncated) {
         $tName = $this->getContainer()->tName;
         $params = 'pagetype=' . $this->container->pSet->_viewPage . '&table=' . GetTableURL($tName) . '&field=' . rawurlencode($this->field) . $keylink;
         $link = ' <a href="javascript:void(0);" data-query="' . GetTableLink("fulltext") . '?' . $params . '">' . "More" . '&nbsp;...</a>';
         $processedValue .= $link;
     }
     return $processedValue;
 }
Пример #16
0
 /**
  * Get the page's layout
  * @return {string}
  */
 function getPageLayout($tName = "", $pageType = "", $suffix = "")
 {
     global $page_layouts;
     if (!$tName) {
         $tName = $this->tName;
     }
     if (!$pageType) {
         $pageType = $this->pageType;
     }
     $templateName = GetTableURL($tName) . "_" . $pageType;
     if ($suffix) {
         $templateName = $templateName . "_" . $suffix;
     }
     if (!$this->isPageTableBased() || $this->pageType == PAGE_REGISTER) {
         //the name of the non table page's layout
         $templateName = $pageType;
     }
     return $page_layouts[$templateName];
 }
Пример #17
0
include("include/dbcommon.php");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");

include("include/reportfunctions.php");

	if(!@$_SESSION["UserID"])
	{
		$_SESSION["MyURL"] = GetTableLink("webreport");
		header("Location: ".GetTableLink("login", "", "message=expired"));
		return;
	}

Reload_Report(postvalue("rname"));

if (is_wr_project()) 
	include("include/" . GetTableURL( $_SESSION['webreports']['tables'][0] ) . "_variables.php");

//$conn=db_connect();

include('include/xtempl.php');
$xt = new Xtempl();

$arr_tables = getReportTablesList();
$group_fields = array();

foreach($arr_tables as $t)
{
	$tfields = WRGetNBFieldsList($t);
	foreach($tfields as $f)
	{
		if(is_wr_db())
Пример #18
0
function comlete_chart_session_default_values($isedit = "")
{
    $root =& $_SESSION["webcharts"];
    $table = $root['tables'][0];
    $arr_fields = WRGetNBFieldsList($table);
    $arr_fields_all = WRGetFieldsList($table);
    $root['chart_type'] = array("type" => "2d_column");
    $arr_data_series = array();
    $arr_label_series = array();
    get_chart_series_fields($arr_data_series, $arr_label_series);
    $datafield = array("field" => $arr_fields[0], "label" => WRChartLabel($arr_fields[0]));
    $labelfield = $datafield;
    if (count($arr_label_series)) {
        $labelfield = $arr_label_series[0];
        $ttable = "";
        $tfield = "";
        WRSplitFieldName($labelfield["field"], $ttable, $tfield);
        $labelfield["field"] = $tfield;
    }
    if (count($arr_data_series)) {
        $datafield = $arr_data_series[0];
        $ttable = "";
        $tfield = "";
        WRSplitFieldName($datafield["field"], $ttable, $tfield);
        $datafield["field"] = $tfield;
    }
    $root['parameters'] = array(array("name" => $datafield["field"], "ohlcOpen" => $datafield["field"], "ohlcClose" => $datafield["field"], "ohlcHigh" => $datafield["field"], "ohlcLow" => $datafield["field"], "table" => $table, "agr_func" => "", "label" => $datafield["label"]), array("name" => $labelfield["field"], "table" => $table, "agr_func" => "", "label" => "undefined"));
    $root['fields'] = array();
    foreach ($arr_fields_all as $fld) {
        $root['fields'][] = array("name" => $fld, "label" => WRChartLabel($fld), "search" => "");
    }
    $root['appearance']["series_color"] = "FF0000";
    $root['appearance']["color51"] = "";
    $root['appearance']["color52"] = "";
    $root['appearance']["color61"] = "";
    $root['appearance']["color62"] = "";
    $root['appearance']["color71"] = "";
    $root['appearance']["color72"] = "";
    $root['appearance']["color81"] = "";
    $root['appearance']["color82"] = "";
    $root['appearance']["color91"] = "";
    $root['appearance']["color92"] = "";
    $root['appearance']["color101"] = "";
    $root['appearance']["color102"] = "";
    $root['appearance']["color111"] = "";
    $root['appearance']["color112"] = "";
    $root['appearance']["color121"] = "";
    $root['appearance']["color122"] = "";
    $root['appearance']["color131"] = "";
    $root['appearance']["color132"] = "";
    $root['appearance']["color141"] = "";
    $root['appearance']["color142"] = "";
    $root['appearance']["slegend"] = "true";
    $root['appearance']["sgrid"] = "true";
    $root['appearance']["sname"] = "true";
    $root['appearance']["sval"] = "true";
    $root['appearance']["sanim"] = "true";
    $root['appearance']["scur"] = "false";
    $root['appearance']["sstacked"] = "false";
    $root['appearance']["saxes"] = "false";
    $root['appearance']["slog"] = "false";
    $root['appearance']["dec"] = "2";
    $root['appearance']["head"] = $root['tables'][0] . ' Chart ' . CheckLastID('chart');
    $root['appearance']["foot"] = $root['tables'][0] . ' Chart ' . CheckLastID('chart');
    $root['appearance']["aqua"] = "0";
    $root['appearance']["cview"] = "0";
    $root['appearance']["is3d"] = "false";
    $root['appearance']["isstacked"] = "false";
    $root['appearance']["cscroll"] = "true";
    $root['appearance']["autoupdate"] = "false";
    $root['appearance']["maxbarscroll"] = "10";
    $root['appearance']["update_interval"] = "5";
    $root['appearance']["accumulstyle"] = "0";
    $root['appearance']["accumulinvert"] = "false";
    $root['appearance']["linestyle"] = "0";
    $root['appearance']["gaugestyle"] = "0";
    if (!$isedit) {
        $root['settings'] = array("name" => GoodFieldName($root['tables'][0]) . '_' . CheckLastID('chart'), "title" => $root['tables'][0] . ' Chart ' . CheckLastID('chart'), "status" => "private", "owner" => $_SESSION["UserID"], "table_name" => $root['tables'][0], "short_table_name" => GetTableURL($root['tables'][0]));
        $_SESSION["webobject"]["name"] = GoodFieldName($root['tables'][0]) . '_' . CheckLastID('chart');
        $root['owner'] = $_SESSION["UserID"];
        $_SESSION['webcharts']['tmp_active'] = "x";
    } else {
        $root['settings'] = array("name" => $_SESSION['webcharts']['settings']['name'], "title" => $_SESSION['webcharts']['settings']['title'], "status" => $_SESSION['webcharts']['settings']['status'], "owner" => $_SESSION['webcharts']['settings']['owner'], "table_name" => $root['tables'][0], "short_table_name" => GetTableURL($root['tables'][0]));
    }
    $root['table_name'] = $root['tables'][0];
    $root['short_table_name'] = GetTableURL($root['tables'][0]);
}
Пример #19
0
 function GetLockInfo($strtable, $keys, $links, $pageid)
 {
     $page = GetTableURL($strtable) . "_edit.php";
     $skeys = "";
     foreach ($keys as $ind => $val) {
         if (strlen($skeys)) {
             $skeys .= "&";
         }
         $skeys .= rawurlencode($val);
     }
     $rstmp = $this->TableObj->Query(AddFieldWrappers("table") . "=" . db_prepare_string($strtable) . " and " . AddFieldWrappers("keys") . "=" . db_prepare_string($skeys) . " and " . AddFieldWrappers("sessionid") . "<>'" . session_id() . "' and " . AddFieldWrappers("action") . "=1", AddFieldWrappers("id") . " asc");
     if ($data = db_fetch_array($rstmp)) {
         $sdate = now();
         $arrDateTime = db2time($data["startdatetime"]);
         $str = mysprintf($this->LockAdmin, array($data["userid"], round(secondsPassedFrom($data["startdatetime"]) / 60, 2)));
         if ($links) {
             $str .= '<a class="unlock" href="#" onclick="Runner.pages.PageManager.getAt(\'' . htmlspecialchars(jsreplace($strtable)) . '\', ' . $pageid . ').locking.UnlockAdmin(\'' . htmlspecialchars(jsreplace($skeys)) . '\',\'' . $data["sessionid"] . '\',\'no\');return false;">' . "Unlock record" . '</a>';
             $str .= '<a class="edit" href="#" onclick="Runner.pages.PageManager.getAt(\'' . htmlspecialchars(jsreplace($strtable)) . '\', ' . $pageid . ').locking.UnlockAdmin(\'' . htmlspecialchars(jsreplace($skeys)) . '\',\'' . $data["sessionid"] . '\',\'yes\');return false;">' . "Edit record" . '</a>';
         }
         return $str;
     } else {
         return "";
     }
 }
Пример #20
0
 /**
  * @deprecated
  * @param Mixed rs
  * @param Number nPageSize	 
  */
 public function ExportToExcel_old($rs, $nPageSize)
 {
     global $cCharset;
     header("Content-Type: application/vnd.ms-excel");
     header("Content-Disposition: attachment;Filename=" . GetTableURL($this->tName) . ".xls");
     echo "<html>";
     echo "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">";
     echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $cCharset . "\">";
     echo "<body>";
     echo "<table border=1>";
     $this->WriteTableData($rs, $nPageSize);
     echo "</table>";
     echo "</body>";
     echo "</html>";
 }
Пример #21
0
	/**
	 * Assign values for links
	 *
	 * @param link $xt
	 */
	function assignLinks(&$xt) 
	{	
		// assign title between tag a
		$xt->assign("item".$this->id."_title", $this->title);
		// assign common attr
//		$attrForAssign = ' id="itemlink'.$this->id.'" title="'.$this->title.'" '.($this->style ? 'style="'.$this->style.'"' : '');
		$attrForAssign = ' id="itemlink'.$this->id.'" itemtitle="'.$this->title.'" '.($this->style ? 'style="'.$this->style.'"' : '');
		
		// add target blank attr
		if ($this->openType == "NewWindow"){
			//$attrForAssign .= ' target="_blank"';
			$attrForAssign .= ' rel="external"';
		}
		
		// for Internal links
		if ($this->linkType == "Internal")
		{
			if ($this->pageType!="WebReports")
			{
				// add menu id param. Used for setting current menu element
				$menuIdGetParam = '';
				if ($this->pageTypesInMenuForThisTable[$this->pageType]["count"]>1)
					$menuIdGetParam = 'menuItemId='.$this->id;
				if($this->params)
				{
					if($menuIdGetParam)
						$menuIdGetParam .='&'.$this->params;
					else
						$menuIdGetParam .= $this->params;
				}
				
				$attrForAssign .= ' href="'.GetTableLink(GetTableURL($this->table), strtolower($this->pageType), $menuIdGetParam).'"';					
				$xt->assign("item".$this->id."_optionattrs",'value="'.GetTableLink(GetTableURL($this->table), strtolower($this->pageType))
					.'" '.($this->openType == "NewWindow" ? 'link="External"' : ''));
			}
			else
			{
				$attrForAssign .= ' href="'.GetTableLink("webreport").'"';
				$xt->assign("item".$this->id."_optionattrs",' value="'.GetTableLink("webreport").'"');
			}
		// for External links
		}elseif($this->linkType == "External")
		{
			$attrForAssign .= ' href="'.$this->href.'"';
			$xt->assign("item".$this->id."_optionattrs",'value="'.$this->href.'" '.($this->openType == "NewWindow" ? 'link="External"' : ''));	
		}
		$xt->assign("item".$this->id."_menulink_attrs", $attrForAssign);

		
	}
Пример #22
0
 // create second control, if need it
 $xt->assignbyref("sspd_id_editcontrol1", $ctrlBlockArr['searchcontrol1']);
 // create search type select
 $xt->assign("searchtype_sspd_id", $ctrlBlockArr['searchtype']);
 $isFieldNeedSecCtrl = $searchControlBuilder->isNeedSecondCtrl("sspd_id");
 $ctrlInd = 0;
 if ($isFieldNeedSecCtrl) {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "sspd_id", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd, 1 => $ctrlInd + 1));
     $ctrlInd += 2;
 } else {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "sspd_id", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd));
     $ctrlInd++;
 }
 // search fields data
 if ($pageObject->pSet->getLookupTable("tanggal")) {
     $pageObject->settingsMap["globalSettings"]['shortTNames'][$pageObject->pSet->getLookupTable("tanggal")] = GetTableURL($pageObject->pSet->getLookupTable("tanggal"));
 }
 $pageObject->fillFieldToolTips("tanggal");
 $srchFields = $pageObject->searchClauseObj->getSearchCtrlParams("tanggal");
 $firstFieldParams = array();
 if (count($srchFields)) {
     $firstFieldParams = $srchFields[0];
 } else {
     $firstFieldParams['fName'] = "tanggal";
     $firstFieldParams['eType'] = '';
     $firstFieldParams['value1'] = '';
     $firstFieldParams['opt'] = '';
     $firstFieldParams['value2'] = '';
     $firstFieldParams['not'] = false;
 }
 // create control
Пример #23
0
$_SESSION["webobject"]["table_type"] = $rpt_array["table_type"];

if (!postvalue("crosstable_refresh")) {
    $reportFilename = GetTableLink("dreport");
}

$cross_table = $rpt_array["group_fields"][count($rpt_array["group_fields"]) - 1]["cross_table"];
if ($cross_table == "true") {
    include("classes/crosstable_report.php");
    $includes.='<script type="text/javascript" src="' . GetRootPathForResources("include/crosstable.js") . '"></script>';
    $includes.='<script type="text/javascript" src="' . GetRootPathForResources("include/json.js") . '"></script>';
} else
    $_SESSION["crossLink"] = "";
// if old
if (is_wr_project())
    include("include/" . GetTableURL($rpt_array['tables'][0]) . "_variables.php");

$gSettings = new ProjectSettings($rpt_array['tables'][0], PAGE_REPORT);
$tbl = $rpt_array['tables'][0];
$strTableName = $tbl;

include_once getabspath('classes/controls/ViewControlsContainer.php');
$viewControls = new ViewControlsContainer($gSettings, PAGE_REPORT);

$sessPrefix = "";
if (!is_wr_project())
    $sessPrefix = "webreport" . postvalue("rname");
else
    $sessPrefix = $tbl;

// Check user permissions
Пример #24
0
 protected function prepareFields()
 {
     foreach ($this->pSet->getAdvSearchFields() as $field) {
         $gfield = GoodFieldName($field);
         $lookupTable = $this->pSet->getLookupTable($field);
         if ($lookupTable) {
             $this->settingsMap["globalSettings"]['shortTNames'][$lookupTable] = GetTableURL($lookupTable);
         }
         $this->fillFieldToolTips($field);
         $srchFields = $this->searchClauseObj->getSearchCtrlParams($field);
         $firstFieldParams = array();
         if (count($srchFields)) {
             $firstFieldParams = $srchFields[0];
         } else {
             $firstFieldParams['fName'] = $field;
             $firstFieldParams['eType'] = '';
             $firstFieldParams['value1'] = $this->pSet->getDefaultValue($field);
             $firstFieldParams['opt'] = '';
             $firstFieldParams['value2'] = '';
             $firstFieldParams['not'] = false;
         }
         // create control
         $ctrlBlockArr = $this->searchControlBuilder->buildSearchCtrlBlockArr($this->id, $firstFieldParams['fName'], 0, $firstFieldParams['opt'], $firstFieldParams['not'], false, $firstFieldParams['value1'], $firstFieldParams['value2']);
         if ($firstFieldParams['opt'] == "") {
             $firstFieldParams['opt'] = $this->pSet->getDefaultSearchOption($firstFieldParams['fName']);
         }
         $srchTypeFull = $this->searchControlBuilder->getCtrlSearchType($firstFieldParams['fName'], $this->id, 0, $firstFieldParams['opt'], $firstFieldParams['not'], true, true);
         if (isEnableSection508()) {
             $this->xt->assign_section($gfield . "_label", "<label for=\"" . $this->getInputElementId($field, $this->pSet) . "\">", "</label>");
         } else {
             $this->xt->assign($gfield . "_label", true);
         }
         $this->xt->assign($gfield . "_fieldblock", true);
         $this->xt->assignbyref($gfield . "_editcontrol", $ctrlBlockArr['searchcontrol']);
         $this->xt->assign($gfield . "_notbox", $ctrlBlockArr['notbox']);
         // create second control, if need it
         $this->xt->assignbyref($gfield . "_editcontrol1", $ctrlBlockArr['searchcontrol1']);
         // create search type select
         $this->xt->assign("searchtype_" . $gfield, $ctrlBlockArr['searchtype']);
         $this->xt->assign("searchtypefull_" . $gfield, $srchTypeFull);
         $isFieldNeedSecCtrl = $this->searchControlBuilder->isNeedSecondCtrl($field);
         $ctrlInd = 0;
         if ($isFieldNeedSecCtrl) {
             $this->controlsMap["search"]["searchBlocks"][] = array('fName' => $field, 'recId' => $this->id, 'ctrlsMap' => array(0 => $ctrlInd, 1 => $ctrlInd + 1));
             $ctrlInd += 2;
         } else {
             $this->controlsMap["search"]["searchBlocks"][] = array('fName' => $field, 'recId' => $this->id, 'ctrlsMap' => array(0 => $ctrlInd));
             $ctrlInd++;
         }
     }
 }
Пример #25
0
	}*/
  if (!isset($_SESSION["login"])) {
	echo "<p>" . "Acesso negado" . "</p>";
	exit();
    }

if (strpos($xml_array['table_relations']['join_tables'], ",") !== false) {
	$arr_join_tables = array_slice(explode(",", $xml_array['table_relations']['join_tables']), 0, -1);	
}
$arr_join_tables[] = $xml_array['tables'][0];

if(is_wr_project())
{
	foreach ($arr_join_tables as $tbl) 
	{
		include_once("include/" . GetTableURL($tbl) . "_settings.php");	
	}
}

if (postvalue("rname")) {
	$inspect_fields = $xml_array["totals"];
} elseif (postvalue("cname")) {
	//$inspect_fields = $xml_array["parameters"];
	$inspect_fields = array();
	for ($i=0; $i < count($arr_join_tables); $i++ ) {
		$t = $arr_join_tables[$i];
		$arr_fields = WRGetNBFieldsList($t);
		for ($j=0; $j < count($arr_fields); $j++) {
			$slabel=$arr_fields[$j];
			for ($k=0; $k < count($xml_array["parameters"])-1; $k++) 
				if($xml_array["parameters"][$k]["name"]==$slabel)
Пример #26
0
 function buildControl($value, $mode, $fieldNum = 0, $validate, $additionalCtrlParams, $data)
 {
     parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data);
     $disp = "";
     $strfilename = "";
     if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) {
         $value = db_stripslashesbinary($value);
         $itype = SupposeImageType($value);
         if ($itype) {
             if ($this->pageObject->pSetEdit->showThumbnail($this->field)) {
                 $disp = "<a target=_blank";
                 $disp .= " href=\"imager.php?table=" . GetTableURL($this->pageObject->tName) . "&" . $this->iquery . "&rndVal=" . rand(0, 32768) . "\" class='zoombox'>";
                 $disp .= "<img id=\"image_" . GoodFieldName($this->field) . "_" . $this->id . "\" name=\"" . $this->cfield . "\" border=0";
                 if ($this->is508) {
                     $disp .= " alt=\"Image from DB\"";
                 }
                 $disp .= " src=\"imager.php?table=" . GetTableURL($this->pageObject->tName) . "&field=" . rawurlencode($this->pageObject->pSetEdit->getStrThumbnail($this->field)) . "&alt=" . rawurlencode($this->field) . $this->keylink . "&rndVal=" . rand(0, 32768) . "\">";
                 $disp .= "</a>";
             } else {
                 $disp = '<img id="image_' . GoodFieldName($this->field) . '_' . $this->id . '" name="' . $this->cfield . '"';
                 if ($this->is508) {
                     $disp .= ' alt="Image from DB"';
                 }
                 $disp .= ' border=0 src="imager.php?table=' . GetTableURL($this->pageObject->tName) . '&' . $this->iquery . "&src=1&rndVal=" . rand(0, 32768) . '">';
             }
         } else {
             if (strlen($value)) {
                 $disp = '<img id="image_' . GoodFieldName($this->field) . '_' . $this->id . '" name="' . $this->cfield . '" border=0 ';
                 if ($this->is508) {
                     $disp .= ' alt="file"';
                 }
                 $disp .= ' src="images/file.gif">';
             } else {
                 $disp = '<img id="image_' . GoodFieldName($this->field) . '_' . $this->id . '" name="' . $this->cfield . '" border="0"';
                 if ($this->is508) {
                     $disp .= ' alt=" "';
                 }
                 $disp .= ' src="images/no_image.gif">';
             }
         }
         //	filename
         if ($this->format == EDIT_FORMAT_DATABASE_FILE && !$itype && strlen($value)) {
             if (!($filename = @$data[$this->pageObject->pSetEdit->getFilenameField($this->field)])) {
                 $filename = "file.bin";
             }
             $disp = '<a href="getfile.php?table=' . GetTableURL($this->pageObject->tName) . '&filename=' . htmlspecialchars($filename) . '&' . $this->iquery . '".>' . $disp . '</a>';
         }
         //	filename edit
         if ($this->format == EDIT_FORMAT_DATABASE_FILE && $this->pageObject->pSetEdit->getFilenameField($this->field)) {
             if (!($filename = @$data[$this->pageObject->pSetEdit->getFilenameField($this->field)])) {
                 $filename = "";
             }
             if ($mode == MODE_INLINE_EDIT) {
                 $strfilename = '<br><label for="filename_' . $this->cfieldname . '">' . "Filename" . '</label>&nbsp;&nbsp;<input type="text" ' . $this->inputStyle . ' id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="20" maxlength="50" value="' . htmlspecialchars($filename) . '">';
             } else {
                 $strfilename = '<br><label for="filename_' . $this->cfieldname . '">' . "Filename" . '</label>&nbsp;&nbsp;<input type="text" ' . $this->inputStyle . ' id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="20" maxlength="50" value="' . htmlspecialchars($filename) . '">';
             }
         }
         $strtype = '<br><input id="' . $this->ctype . '_keep" type="Radio" name="' . $this->ctype . '" value="file0" checked>' . "Keep";
         if (strlen($value) && !$this->pageObject->pSetEdit->isRequired($this->field)) {
             $strtype .= '<input id="' . $this->ctype . '_delete" type="Radio" name="' . $this->ctype . '" value="file1">' . "Delete";
         }
         $strtype .= '<input id="' . $this->ctype . '_update" type="Radio" name="' . $this->ctype . '" value="file2">' . "Update";
     } else {
         //	if Add mode
         $strtype = '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="file2">';
         if ($this->format == EDIT_FORMAT_DATABASE_FILE && $this->pageObject->pSetEdit->getFilenameField($this->field)) {
             $strfilename = '<br><label for="filename_' . $this->cfieldname . '">' . "Filename" . '</label>&nbsp;&nbsp;<input type="text" ' . $this->inputStyle . ' id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="20" maxlength="50">';
         }
     }
     if ($mode == MODE_INLINE_EDIT && $this->format == EDIT_FORMAT_DATABASE_FILE) {
         $disp = "";
     }
     echo $disp . $strtype;
     if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) {
         echo '<br>';
     }
     echo '<input type="File" ' . $this->inputStyle . ' id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 ? 'alt="' . $this->strLabel . '" ' : '') . ' name="' . $this->cfield . '" >' . $strfilename;
     echo '<input type="Hidden" id="notempty_' . $this->cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">';
     $this->buildControlEnd($validate);
 }
 // create second control, if need it
 $xt->assignbyref("IsSync_editcontrol1", $ctrlBlockArr['searchcontrol1']);
 // create search type select
 $xt->assign("searchtype_IsSync", $ctrlBlockArr['searchtype']);
 $isFieldNeedSecCtrl = $searchControlBuilder->isNeedSecondCtrl("IsSync");
 $ctrlInd = 0;
 if ($isFieldNeedSecCtrl) {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "IsSync", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd, 1 => $ctrlInd + 1));
     $ctrlInd += 2;
 } else {
     $pageObject->controlsMap["search"]["searchBlocks"][] = array('fName' => "IsSync", 'recId' => $id, 'ctrlsMap' => array(0 => $ctrlInd));
     $ctrlInd++;
 }
 // search fields data
 if (GetLookupTable("Currunt Readings", $strTableName)) {
     $pageObject->settingsMap["globalSettings"]['shortTNames'][GetLookupTable("Currunt Readings", $strTableName)] = GetTableURL(GetLookupTable("Currunt Readings", $strTableName));
 }
 $pageObject->fillFieldToolTips("Currunt Readings");
 $srchFields = $pageObject->searchClauseObj->getSearchCtrlParams("Currunt Readings");
 $firstFieldParams = array();
 if (count($srchFields)) {
     $firstFieldParams = $srchFields[0];
 } else {
     $firstFieldParams['fName'] = "Currunt Readings";
     $firstFieldParams['eType'] = '';
     $firstFieldParams['value1'] = '';
     $firstFieldParams['opt'] = '';
     $firstFieldParams['value2'] = '';
     $firstFieldParams['not'] = false;
 }
 // create control
Пример #28
0
 /**
  * Fill field settings for current table 
  * @intellisense
  */
 function fillFieldSettings()
 {
     $arrFields = $this->pSet->getFieldsList();
     foreach ($arrFields as $fName) {
         if (!array_key_exists($fName, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'])) {
             $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName] = array();
         }
         if (!array_key_exists($this->pageType, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName])) {
             $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName][$this->pageType] = array();
         }
         $matchDK = false;
         if ($this->matchWithDetailKeys($fName)) {
             $matchDK = true;
         }
         foreach ($this->settingsMap["fieldSettings"] as $key => $val) {
             $fData = $this->pSet->getFieldData($fName, $key);
             if ($key != "validateAs") {
                 if ($key == "EditFormat") {
                     if ($matchDK) {
                         $fData = EDIT_FORMAT_READONLY;
                     }
                 } elseif ($key == "RTEType") {
                     if ($this->pSet->isUseRTEBasic($fName)) {
                         $fData = "RTE";
                     } elseif ($this->pSet->isUseRTEFCK($fName)) {
                         $fData = "RTECK";
                         if (!$this->isUseCK) {
                             $this->isUseCK = true;
                         }
                         $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName][$this->pageType]['nWidth'] = $this->pSet->getNCols($fName);
                         $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName][$this->pageType]['nHeight'] = $this->pSet->getNRows($fName);
                     } elseif ($this->pSet->isUseRTEInnova($fName)) {
                         $fData = "RTEINNOVA";
                     }
                 } elseif ($key == "autoCompleteFieldsAdd") {
                     $fData = $this->pSet->getAutoCompleteFields($fName);
                 } elseif ($key == "autoCompleteFieldsEdit") {
                     if ($this->pSet->isAutoCompleteFieldsOnEdit($fName)) {
                         $fData = $this->pSet->getAutoCompleteFields($fName);
                     } else {
                         $fData = array();
                     }
                 }
                 $isDefault = false;
                 if (is_array($fData)) {
                     $isDefault = !count($fData);
                 } else {
                     if (!is_array($val['default'])) {
                         $isDefault = $fData === $val['default'];
                     }
                 }
                 if (!$isDefault && !$matchDK) {
                     $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName][$this->pageType][$val['jsName']] = $fData;
                 } else {
                     if ($matchDK && ($key == "EditFormat" || $key == "strName")) {
                         $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName][$this->pageType][$val['jsName']] = $fData;
                     }
                 }
             } elseif (!$matchDK) {
                 $this->fillValidation($fData, $val, $this->jsSettings['tableSettings'][$this->tName]['fieldSettings'][$fName][$this->pageType]);
             }
         }
         $this->jsSettings['tableSettings'][$this->tName]['isUseCK'] = $this->isUseCK;
         if (!empty($this->googleMapCfg) and $this->googleMapCfg['isUseGoogleMap']) {
             $this->jsSettings['tableSettings'][$this->tName]['isUseGoogleMap'] = true;
             $this->jsSettings['tableSettings'][$this->tName]['googleMapCfg'] = $this->googleMapCfg;
         }
         if ($this->pSet->getLookupTable($fName)) {
             $this->jsSettings['global']['shortTNames'][$this->pSet->getLookupTable($fName)] = GetTableURL($this->pSet->getLookupTable($fName));
         }
         if ($this->pSet->getEditFormat($fName) == 'Time') {
             $this->fillTimePickSettings($fName);
         }
     }
     if ($this->pageType == PAGE_REGISTER) {
         $this->addConfirmToFieldSettings();
     }
 }
Пример #29
0
     include "classes/searchclause.php";
 }
 $dControlsMap = array();
 $dViewControlsMap = array();
 $flyId = $ids + 1;
 for ($d = 0; $d < count($dpParams['ids']); $d++) {
     $options = array();
     //array of params for classes
     $options["mode"] = LIST_DETAILS;
     $options["pageType"] = PAGE_LIST;
     $options["masterPageType"] = PAGE_ADD;
     $options["mainMasterPageType"] = PAGE_ADD;
     $options['masterTable'] = "pad.pad_customer";
     $options['firstTime'] = 1;
     $strTableName = $dpParams['strTableNames'][$d];
     include_once "include/" . GetTableURL($strTableName) . "_settings.php";
     $layout = GetPageLayout(GoodFieldName($strTableName), PAGE_LIST);
     if ($layout) {
         $rtl = $xt->getReadingOrder() == 'RTL' ? 'RTL' : '';
         $xt->cssFiles[] = array("stylepath" => "styles/" . $layout->style . '/style' . $rtl . ".css", "pagestylepath" => "pagestyles/" . $layout->name . $rtl . ".css");
         $xt->IEcssFiles[] = array("stylepathIE" => "styles/" . $layout->style . '/styleIE' . ".css");
     }
     $options['xt'] = new Xtempl();
     $options['id'] = $dpParams['ids'][$d];
     $options['flyId'] = $flyId++;
     $mkr = 1;
     foreach ($mKeys[$strTableName] as $mk) {
         if ($defvalues[$mk]) {
             $options['masterKeysReq'][$mkr++] = $defvalues[$mk];
         } else {
             $options['masterKeysReq'][$mkr++] = '';
Пример #30
0
		$b_includes.='
		$("#sql_name").hide();
		$("#check_button").hide();
		$("#sql_textarea").attr("readonly","readonly");
	});
	';
	$b_includes.="</script>";
	$xt->assign("b_includes", $b_includes);
	if(is_wr_project()) 
	{
		if($type=="webreports")
			$arr_tables = getReportTablesList();
		else
			$arr_tables = getChartTablesList();
		foreach ($arr_tables as $tbl) 
			include("include/" . GetTableURL($tbl) . "_variables.php");
		$gSettings = new ProjectSettings($arr_tables[0], PAGE_REPORT);
	}
	else 
	{
		global $strTableName;
		$gSettings = new ProjectSettings($strTableName, PAGE_REPORT);
	}

	if(!is_wr_project())
	{
		$sql_query_display = $_SESSION[$type]['sql'].$_SESSION[$type]['where'].$_SESSION[$type]['group_by'].$_SESSION[$type]['order_by'];	
		if(strlen($_SESSION[$type]['sql_preview']))
			$sql_query = $_SESSION[$type]['sql_preview'];
		else
			$sql_query = $_SESSION[$type]['sql'];