function EditControl($field, $pageObject, $id) { $this->field = $field; $this->goodFieldName = GoodFieldName($field); $this->setID($id); $this->pageObject = $pageObject; $this->is508 = isEnableSection508(); $this->strLabel = $pageObject->pSetEdit->label($field); $this->type = $pageObject->pSetEdit->getFieldType($this->field); $this->like = "ilike"; $this->searchOptions[CONTAINS] = "Contains"; $this->searchOptions[EQUALS] = "Equals"; $this->searchOptions[STARTS_WITH] = "Starts with"; $this->searchOptions[MORE_THAN] = "More than"; $this->searchOptions[LESS_THAN] = "Less than"; $this->searchOptions[BETWEEN] = "Between"; $this->searchOptions[EMPTY_SEARCH] = "Empty"; $this->searchOptions[NOT_CONTAINS] = "Doesn't contain"; $this->searchOptions[NOT_EQUALS] = "Doesn't equal"; $this->searchOptions[NOT_STARTS_WITH] = "Doesn't start with"; $this->searchOptions[NOT_MORE_THAN] = "Is not more than"; $this->searchOptions[NOT_LESS_THAN] = "Is not less than"; $this->searchOptions[NOT_BETWEEN] = "Is not between"; $this->searchOptions[NOT_EMPTY] = "Is not empty"; $this->init(); }
public function FilterControl($fName, $pageObj, $id, $viewControls) { global $conn; $this->id = $id; $this->conn = $conn; $this->fName = $fName; $this->gfName = GoodFieldName($this->fName); $this->tName = $pageObj->tName; $this->pSet = $pageObj->pSet; $this->cipherer = $pageObj->cipherer; $this->totalsOptions = array(FT_COUNT => "COUNT", FT_MIN => "MIN", FT_MAX => "MAX"); $this->totals = $this->pSet->getFilterFieldTotal($fName); $this->totalsfName = $this->pSet->getFilterTotalsField($fName); if(!$this->totalsfName || $this->totals == FT_COUNT) $this->totalsfName = $this->fName; $this->useTotals = $this->totals != FT_NONE; $this->multiSelect = $this->pSet->getFilterFiledMultiSelect($fName); $this->whereComponents = $pageObj->getWhereComponents(); $this->filteredFields = $pageObj->searchClauseObj->filteredFields; $this->fieldType = $this->pSet->getFieldType($this->fName); if( count($this->filteredFields[ $this->fName ]) ) $this->filtered = true; $this->assignViewControls($viewControls); $this->showCollapsed = $this->pSet->showCollapsed($this->fName); }
public function showDBValue(&$data, $keylink) { if ($this->container->forExport) { return "LONG BINARY DATA - CANNOT BE DISPLAYED"; } $value = ""; if (@$data[$this->field] != NULL && $this->container->pageType != PAGE_PRINT) { $videoId = 'video_' . GoodFieldName(htmlspecialchars($this->field)) . '_'; $videoId .= $this->getContainer()->id . "_"; if ($this->getContainer()->pageType != PAGE_ADD) { $videoId .= $this->getContainer()->recId; } else { $videoId .= postvalue("id"); } $type = 'video/flv'; $fileName = 'file.flv'; $fileNameF = $this->getContainer()->pSet->getFilenameField($this->field); if ($fileNameF) { $fileName = $data[$fileNameF]; if (!$fileName) { $fileName = 'file.flv'; } else { $type = getContentTypeByExtension(substr($fileName, strrpos($fileName, '.'))); } } $href = "mfhandler.php?filename=" . $fileName . "&table=" . rawurlencode($this->getContainer()->pSet->_table) . "&field=" . rawurlencode($this->field) . "&pageType=" . $this->getContainer()->pageType . $keylink; if (isMobileIOS()) { $value = '<video width="' . $this->getContainer()->pSet->getVideoWidth($this->field) . '" height="' . $this->getContainer()->pSet->getVideoHeight($this->field) . '" controls="controls"> <source src="' . $href . '" type="' . $type . '" /> Your browser does not support the video tag. </video>'; } else { $vWidth = $this->getContainer()->pSet->getVideoWidth($this->field); $vHeight = $this->getContainer()->pSet->getVideoHeight($this->field); if ($vWidth == 0) { $vWidth = 300; } if ($vHeight == 0) { $vHeight = 200; } $value .= ' <div style="width:' . $vWidth . 'px; height:' . $vHeight . 'px;"> <video class="projekktor" width="' . $vWidth . '" height="' . $vHeight . '" id="' . $videoId . '" type="' . $type . '" src="' . $href . '" > </video></div>'; } if ($this->pageObject != null) { $this->pageObject->controlsMap['video'][] = $videoId; } } else { $fileNameF = $this->getContainer()->pSet->getFilenameField($this->field); if ($fileNameF) { $fileName = $data[$fileNameF]; if (!$fileName) { $value = $fileName; } } } return $value; }
function simpleSearchFieldCombo($fNamesArr, $selOpt) { $options = ""; if (sizeof($this->pSet->getGoogleLikeFields()) != 0) { $options = '<option value="" >' . "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 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; }
public function showDBValue(&$data, $keylink) { $value = ""; if (@$data[$this->field] != NULL && $this->container->pageType != PAGE_PRINT) { $videoId = 'video_' . GoodFieldName(runner_htmlspecialchars($this->field)) . '_'; $videoId .= $this->getContainer()->id . "_"; if ($this->getContainer()->pageType != PAGE_ADD) { $videoId .= $this->getContainer()->recId; } else { $videoId .= postvalue("id"); } $type = 'video/mp4'; $fileName = 'file.mp4'; $fileNameF = $this->getContainer()->pSet->getFilenameField($this->field); if ($fileNameF) { $fileName = $data[$fileNameF]; if (!$fileName) { $fileName = 'file.mp4'; } else { $type = getContentTypeByExtension(substr($fileName, strrpos($fileName, '.'))); } } $href = GetTableLink("mfhandler", "", "filename=" . $fileName . "&table=" . rawurlencode($this->getContainer()->pSet->_table) . "&field=" . rawurlencode($this->field) . "&pageType=" . $this->getContainer()->pageType . $keylink); $vWidth = $this->getContainer()->pSet->getVideoWidth($this->field); $vHeight = $this->getContainer()->pSet->getVideoHeight($this->field); if ($vWidth == 0) { $vWidth = 300; } if ($vHeight == 0) { $vHeight = 200; } $value .= ' <div style="width:' . $vWidth . 'px; height:' . $vHeight . 'px;"> <video class="projekktor" width="' . $vWidth . '" height="' . $vHeight . '" id="' . $videoId . '" type="' . $type . '" src="' . $href . '" > </video></div>'; if ($this->pageObject != null) { $this->pageObject->controlsMap['video'][] = $videoId; } } else { $fileNameF = $this->getContainer()->pSet->getFilenameField($this->field); if ($fileNameF) { $fileName = $data[$fileNameF]; if (!$fileName) { $value = $fileName; } } } return $value; }
public function showDBValue(&$data, $keylink) { if (!$this->pageObject) { return htmlspecialchars($data[$this->field]); } if ($this->pageObject->pageType != PAGE_LIST) { $mapData = $this->pageObject->addGoogleMapData($this->field, $data); } if ($this->pageObject->pageType != PAGE_PRINT && $this->pageObject->pageType != PAGE_RPRINT) { return '<div id="littleMap_' . GoodFieldName($this->field) . '_' . $this->pageObject->recId . '" style="width: ' . $this->pageObject->googleMapCfg['fieldsAsMap'][$this->field]['width'] . 'px; height: ' . $this->pageObject->googleMapCfg['fieldsAsMap'][$this->field]['height'] . 'px;"></div>'; } else { if ($mapData['markers'][0]['lat'] == "" && $mapData['markers'][0]['lng'] == "") { $location = $mapData['markers'][0]['address']; } else { $location = $mapData['markers'][0]['lat'] . ',' . $mapData['markers'][0]['lng']; } $src = 'http://maps.googleapis.com/maps/api/staticmap?center=' . $location . '&zoom=' . $mapData['zoom'] . '&size=' . $this->pageObject->googleMapCfg['fieldsAsMap'][$this->field]['width'] . 'x' . $this->pageObject->googleMapCfg['fieldsAsMap'][$this->field]['height'] . '&maptype=mobile&markers=' . $location . '&sensor=false'; return '<img border="0" alt="" src="' . $src . '">'; } }
function EditControl($field, $pageObject, $id, $connection) { $this->field = $field; $this->goodFieldName = GoodFieldName($field); $this->setID($id); $this->connection = $connection; $this->pageObject = $pageObject; $this->is508 = isEnableSection508(); $this->strLabel = $pageObject->pSetEdit->label($field); $this->type = $pageObject->pSetEdit->getFieldType($this->field); if ($this->connection->dbType == nDATABASE_Oracle) { $this->isOracle = true; } if ($this->connection->dbType == nDATABASE_MSSQLServer) { $this->ismssql = true; } if ($this->connection->dbType == nDATABASE_DB2) { $this->isdb2 = true; } if ($this->connection->dbType == nDATABASE_MySQL) { $this->isMysql = true; } if ($this->connection->dbType == nDATABASE_PostgreSQL) { $this->like = "ilike"; } $this->searchOptions[CONTAINS] = "Contiene"; $this->searchOptions[EQUALS] = "Equivale"; $this->searchOptions[STARTS_WITH] = "Empieza con"; $this->searchOptions[MORE_THAN] = "Más que"; $this->searchOptions[LESS_THAN] = "Menos que"; $this->searchOptions[BETWEEN] = "Entre"; $this->searchOptions[EMPTY_SEARCH] = "Vacio"; $this->searchOptions[NOT_CONTAINS] = "No contiene"; $this->searchOptions[NOT_EQUALS] = "No es igual"; $this->searchOptions[NOT_STARTS_WITH] = "No empieza por"; $this->searchOptions[NOT_MORE_THAN] = "No mayor que"; $this->searchOptions[NOT_LESS_THAN] = "No menor que"; $this->searchOptions[NOT_BETWEEN] = "No está entre"; $this->searchOptions[NOT_EMPTY] = "No está vacÃo"; $this->init(); }
function EditControl($field, $pageObject, $id, $connection) { $this->field = $field; $this->goodFieldName = GoodFieldName($field); $this->setID($id); $this->connection = $connection; $this->pageObject = $pageObject; $this->is508 = isEnableSection508(); $this->strLabel = $pageObject->pSetEdit->label($field); $this->type = $pageObject->pSetEdit->getFieldType($this->field); if ($this->connection->dbType == nDATABASE_Oracle) { $this->isOracle = true; } if ($this->connection->dbType == nDATABASE_MSSQLServer) { $this->ismssql = true; } if ($this->connection->dbType == nDATABASE_DB2) { $this->isdb2 = true; } if ($this->connection->dbType == nDATABASE_MySQL) { $this->isMysql = true; } if ($this->connection->dbType == nDATABASE_PostgreSQL) { $this->like = "ilike"; } $this->searchOptions[CONTAINS] = "Contains"; $this->searchOptions[EQUALS] = "Equals"; $this->searchOptions[STARTS_WITH] = "Starts with"; $this->searchOptions[MORE_THAN] = "More than"; $this->searchOptions[LESS_THAN] = "Less than"; $this->searchOptions[BETWEEN] = "Between"; $this->searchOptions[EMPTY_SEARCH] = "Empty"; $this->searchOptions[NOT_CONTAINS] = "Doesn't contain"; $this->searchOptions[NOT_EQUALS] = "Doesn't equal"; $this->searchOptions[NOT_STARTS_WITH] = "Doesn't start with"; $this->searchOptions[NOT_MORE_THAN] = "Is not more than"; $this->searchOptions[NOT_LESS_THAN] = "Is not less than"; $this->searchOptions[NOT_BETWEEN] = "Is not between"; $this->searchOptions[NOT_EMPTY] = "Is not empty"; $this->init(); }
function buildSearchCtrlBlockArr($recId, $fName, $ctrlInd, $opt, $not, $isChached, $val1, $val2, $panelField = false, $flexible = true, $immutable = false) { $srchCtrlBlock = array(); $postfix = ''; if($panelField) $postfix = '_'.GoodFieldName($fName); // if the search option isn't set by search params use the user's search option settings if($opt == "") $opt = $this->pSet->getDefaultSearchOption($fName); // create the first control $renderHidden = strtolower($opt) == 'empty' || strtolower($opt) == 'not empty'; $srchCtrlBlock['searchcontrol'.$postfix] = $this->getCtrlParamsArr($fName, $recId, $ctrlInd, $val1, $opt, $renderHidden, $isChached); $renderHidden = strtolower($opt) != 'between' && strtolower($opt) != 'not between'; if($flexible || !$renderHidden) { // create the second control $srchCtrlBlock['searchcontrol1'.$postfix] = $this->getSecCtrlParamsArr($fName, $recId, $ctrlInd, $val2, $opt, $renderHidden, $isChached); } // del button if( !$immutable ) $srchCtrlBlock['delCtrlButt'] = $this->getDelButtonHtml($fName, $recId); // one control with options container attr $filterRowId = $this->getFilterRowId($recId, $fName); $filterRowAttrs = 'id="'.$filterRowId.'" '; if($isChached) $filterRowAttrs.= $this->dispNoneStyle; $srchCtrlBlock['filterRow_attrs'.$postfix] = $filterRowAttrs; if($immutable) $srchCtrlBlock['filterRow_class'.$postfix] = 'rnr-basic-search-field'; $srchCtrlBlock['fName'] = $fName; // combo with attrs $srchCtrlBlock['searchtype'.$postfix] = $this->getCtrlSearchType($fName, $recId, $ctrlInd, $opt, $not, $flexible); // checkbox attrs $srchCtrlBlock['notbox'] = $this->getNotBox($fName, $recId, $not); $srchCtrlBlock['fLabel'.$postfix] = GetFieldLabel(GoodFieldName($this->tName),GoodFieldName($fName)); return $srchCtrlBlock; }
/** * buildFieldLabels * Draw arrows near field label if field engaged in sorting and build sorting links */ function buildFieldLabels() { for ($i = 0; $i < count($this->fieldsList); $i++) { $order_field = $this->listObject->pSet->GetFieldByIndex($this->fieldsList[$i]->fieldIndex); $orderFieldName = GoodFieldName($order_field); $order_dir = $this->fieldsList[$i]->orderDirection == "ASC" ? "a" : "d"; if ($this->fieldsList[$i]->userDefined) { $this->listObject->xt->assign_section($orderFieldName . "_fieldheader", "", "<span data-icon=\"" . ($order_dir == "a" ? "sortasc" : "sortdesc") . "\"></span>"); } // default ASC for key fields $orderlinkattrs = $this->listObject->setLinksAttr($orderFieldName, $order_dir, $this->fieldsList[$i]->userDefined); $this->listObject->xt->assign($orderFieldName . "_orderlinkattrs", $orderlinkattrs); } }
function getFieldNamesByHeaders($fields) { global $strTableName, $conn, $strOriginalTableName, $ext; // check fields in column headers // check that we have labes in column headers $fieldsNotFoundArr = array(); $fNamesArr = array(); $fNamesFromQuery = GetFieldsList($strTableName); $fieldLabelError = false; $labelFieldsNotFoundArr = array(); for ($j = 0; $j < count($fields); $j++) { $labelNotFound = true; for ($i = 0; $i < count($fNamesFromQuery); $i++) { if ($ext == ".CSV") { $label = GoodFieldName($fNamesFromQuery[$i]); } else { $label = GetFieldLabel(GoodFieldName($strTableName), GoodFieldName($fNamesFromQuery[$i])); } if ($fields[$j] == $label) { $fNamesArr[$j] = $fNamesFromQuery[$i]; $labelNotFound = false; break; } } if ($labelNotFound) { $fieldLabelError = true; $labelFieldsNotFoundArr[] = $fields[$j]; } } // if field names are not labels, than compare them with fields from query $fieldsListError = false; $queryFieldsNotFoundArr = array(); if ($fieldLabelError) { $fieldFromListNotFound = true; $fNamesArr = array(); for ($j = 0; $j < count($fields); $j++) { $fieldNotFound = true; for ($i = 0; $i < count($fNamesFromQuery); $i++) { if ($fields[$j] == $fNamesFromQuery[$i]) { $fNamesArr[$j] = $fNamesFromQuery[$i]; $fieldNotFound = false; $fieldFromListNotFound = false; break; } } if ($fieldNotFound) { $fieldsListError = true; $queryFieldsNotFoundArr[] = $fields[$j]; } } } // if field list not lables or fields from query, than compare fields from DB $fieldsDbError = false; $dbFieldsNotFoundArr = array(); if ($fieldLabelError && $fieldsListError) { $fNamesArr = array(); $strSQL = "select * from " . AddTableWrappers($strOriginalTableName); $rs = db_query($strSQL, $conn); $dbFieldNum = db_numfields($rs); for ($j = 0; $j < count($fields); $j++) { $fieldFromDBNotFound = true; for ($i = 0; $i < $dbFieldNum; $i++) { $fNameFromDB = db_fieldname($rs, $i); if ($fields[$j] == $fNameFromDB) { $fNamesArr[$j] = $fNameFromDB; $fieldFromDBNotFound = false; break; } } if ($fieldFromDBNotFound) { $fieldsDbError = true; $dbFieldsNotFoundArr[] = $fields[$j]; } } } // if fields are not labels, fields from list and fields from table if ($fieldLabelError && $fieldsListError && $fieldsDbError) { if (count($labelFieldsNotFoundArr) < count($dbFieldsNotFoundArr) && count($labelFieldsNotFoundArr) < count($queryFieldsNotFoundArr)) { $fieldsNotFoundArr = $labelFieldsNotFoundArr; } elseif (count($dbFieldsNotFoundArr) < count($labelFieldsNotFoundArr) && count($dbFieldsNotFoundArr) < count($queryFieldsNotFoundArr)) { $fieldsNotFoundArr = $dbFieldsNotFoundArr; } elseif (count($queryFieldsNotFoundArr) < count($labelFieldsNotFoundArr) && count($queryFieldsNotFoundArr) < count($dbFieldsNotFoundArr)) { $fieldsNotFoundArr = $queryFieldsNotFoundArr; } elseif (count($queryFieldsNotFoundArr) == count($labelFieldsNotFoundArr) && count($queryFieldsNotFoundArr) == count($dbFieldsNotFoundArr)) { $fieldsNotFoundArr = $dbFieldsNotFoundArr; } echo "Import didn't succeed, couldn't find followind fields: " . implode(", ", $fieldsNotFoundArr); exit; } else { return $fNamesArr; } }
function FieldSubmitted($field) { return in_assoc_array("type_" . GoodFieldName($field), $_POST) || in_assoc_array("value_" . GoodFieldName($field), $_POST) || in_assoc_array("value_" . GoodFieldName($field), $_FILES); }
$listPageObject->fillSetCntrlMaps(); $pageObject->jsSettings['tableSettings'][$strTableName] = $listPageObject->jsSettings['tableSettings'][$strTableName]; $dControlsMap[$strTableName] = $listPageObject->controlsMap; $dViewControlsMap[$strTableName] = $listPageObject->viewControlsMap; foreach ($listPageObject->jsSettings['global']['shortTNames'] as $keySet => $val) { if (!array_key_exists($keySet, $pageObject->settingsMap["globalSettings"]['shortTNames'])) { $pageObject->settingsMap["globalSettings"]['shortTNames'][$keySet] = $val; } } //Add detail's js files to master's files $pageObject->copyAllJSFiles($listPageObject->grabAllJSFiles()); //Add detail's css files to master's files $pageObject->copyAllCSSFiles($listPageObject->grabAllCSSFiles()); $xtParams = array("method" => 'showPage', "params" => false); $xtParams['object'] = $listPageObject; $xt->assign("displayDetailTable_" . GoodFieldName($listPageObject->tName), $xtParams); $pageObject->controlsMap['dpTablesParams'][] = array('tName' => $strTableName, 'id' => $options['id']); } } $pageObject->controlsMap['dControlsMap'] = $dControlsMap; $pageObject->viewControlsMap['dViewControlsMap'] = $dViewControlsMap; $strTableName = "pad.pad_customer"; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Begin prepare for Next Prev button if (!@$_SESSION[$strTableName . "_noNextPrev"] && !$inlineview && !$pdf) { $pageObject->getNextPrevRecordKeys($data, "Search", $next, $prev); } //End prepare for Next Prev button ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ($pageObject->googleMapCfg['isUseGoogleMap']) {
function db_fld_value(&$data, $field) { global $rpt_array; if (is_wr_db()) return $data[GoodFieldName($field)]; return $data[$field]; }
/** * Simple assign for grid block */ function addAssignForGrid() { parent::addAssignForGrid(); //edit permissions $editPermis = $this->permis[$this->tName]['edit']; //add permissions $addPermis = $this->permis[$this->tName]['add']; //search permissions $searchPermis = $this->permis[$this->tName]['search']; //checkbox column $this->checkboxColumnAttrs(); //edit column $this->xt->assign("edit_column", $editPermis); $this->xt->assign("edit_headercolumn", $editPermis); $this->xt->assign("edit_footercolumn", $editPermis); //inline edit column $this->xt->assign("inlineedit_column", $editPermis); $this->xt->assign("inlineedit_headercolumn", $editPermis); $this->xt->assign("inlineedit_footercolumn", $editPermis); //copy link $this->xt->assign("copy_column", $addPermis); //view column $this->xt->assign("view_column", $searchPermis); //for list icons instead of list links $this->assignListIconsColumn($editPermis, $addPermis, $searchPermis); for ($i = 0; $i < count($this->allDetailsTablesArr); $i++) { $permis = $this->permis[$this->allDetailsTablesArr[$i]['dDataSourceTable']]['add'] || $this->permis[$this->allDetailsTablesArr[$i]['dDataSourceTable']]['search']; if ($permis) { $this->xt->assign(GoodFieldName($this->tName) . "_dtable_column", $permis); break; } } //delete link and attr $this->deleteSelectedLink(); }
} break; } } $result = array(); // traversing searchable fields foreach ($allSearchFields as $f) { // filter fields by type $fType = $pSet->getFieldType($f); if (!IsCharType($fType) && !IsNumberType($fType) && !IsGuid($fType) || in_array($f, $detailKeys)) { continue; } if ($_connection->dbType == nDATABASE_Oracle && IsTextType($fType)) { continue; } if ($searchField != '' && $searchField != GoodFieldName($f) || !$pSet->checkFieldPermissions($f)) { continue; } $fieldControl = $controls->getControl($f); $isAggregateField = $pSet->isAggregateField($f); $where = $fieldControl->getSuggestWhere($searchOpt, $searchFor, $isAggregateField); $having = $fieldControl->getSuggestHaving($searchOpt, $searchFor, $isAggregateField); if (!strlen($where) && !strlen($having)) { continue; } $where = whereAdd($where . $masterWhere, $strSecuritySql); $clausesData = $fieldControl->getSelectColumnsAndJoinFromPart($searchFor, $searchOpt, true); $selectColumns = $clausesData["selectColumns"]; $fromClause = $gQuery->FromToSql() . $clausesData["joinFromPart"]; $distinct = "DISTINCT"; if ($_connection->dbType == nDATABASE_MSSQLServer || $_connection->dbType == nDATABASE_Access) {
/** * Fills info in array about grid. * For new add row * @param array $rowInfoArr array with total info, that assignes grid */ function fillGridShowInfo(&$rowInfoArr) { $rowInfoArr["data"] = array(); $editlink = ""; $copylink = ""; // add inline add row if ($this->mainPSet->isAllowToAdd($this->mainField) && $this->permis[$this->tName]['add']) { $row = array(); $row["rowclass"] = "gridRowAdd " . $this->makeClassName("hiddenelem"); $row["rsclass"] = "gridRowSepAdd " . $this->makeClassName("hiddenelem"); if ($this->listGridLayout == gltVERTICAL) { $row["rowattrs"] .= "vertical=\"1\""; } $record = array(); $record["edit_link"] = true; $record["inlineedit_link"] = true; $record["view_link"] = true; $record["copy_link"] = true; $record["checkbox"] = true; $record["checkbox"] = true; $record["editlink_attrs"] = "id=\"editLink_add" . $this->id . "\""; $record["copylink_attrs"] = "id=\"copyLink_add" . $this->id . "\" name=\"copyLink_add" . $this->id . "\""; $record["viewlink_attrs"] = "id=\"viewLink_add" . $this->id . "\" name=\"viewLink_add" . $this->id . "\""; $record["checkbox_attrs"] = "id=\"check_add" . $this->id . "\" name=\"selection[]\""; // add container for inline add controls $addedInlineAddContainer = false; if ($this->permis[$this->tName]['edit'] && $this->isUseInlineEdit) { $record["inlineeditlink_attrs"] = "id=\"inlineEdit_add" . $this->id . "\" "; $addedInlineAddContainer = true; } for ($i = 0; $i < count($this->allDetailsTablesArr); $i++) { //detail tables $dDataSourceTable = $this->allDetailsTablesArr[$i]['dDataSourceTable']; $dShortTable = $this->allDetailsTablesArr[$i]['dShortTable']; $record[$dShortTable . "_dtable_link"] = $this->permis[$dDataSourceTable]['add'] || $this->permis[$dDataSourceTable]['search']; $record[$dShortTable . "_dtablelink_attrs"] = " href=\"" . GetTableLink($dShortTable, "list") . "\" id=\"master_" . $dShortTable . "_add" . $this->id . "\" "; if ($this->allDetailsTablesArr[$i]['previewOnList'] == DP_INLINE) { $record[$dShortTable . "_dtablelink_attrs"] = "id = \"" . $dShortTable . "_preview" . $this->id . "\"\n\t\t\t\t\t\tcaption = \"" . GetTableCaption(GoodFieldName($dDataSourceTable)) . "\" \n\t\t\t\t\t\thref = \"" . GetTableLink($dShortTable, "list") . "\"\n\t\t\t\t\t\tstyle = \"display:none;\""; } } $this->addSpansForGridCells('add', $record); for ($i = 0; $i < count($this->listFields); $i++) { $field = $this->listFields[$i]['fName']; $gFieldName = GoodFieldName($field); if (!$addedInlineAddContainer) { if ($i == 0 && !($this->permis[$this->tName]['edit'] && $this->isUseInlineEdit)) { $record[$gFieldName . "_value"] .= "<span id=\"inlineEdit_add" . $this->id . "\"></span>"; } } $record[$gFieldName . "_class"] .= $this->fieldClass($field); if (isset($this->hiddenColumnClasses[$field])) { $record[$gFieldName . "_class"] .= " " . $this->hiddenColumnClasses[$field]; if ($this->listGridLayout != gltHORIZONTAL) { $record[$gFieldName . "_label_class"] = $this->hiddenColumnClasses[$field]; } } } if ($this->colsOnPage > 1) { $record["endrecord_block"] = true; } $record["grid_recordheader"] = true; $record["grid_vrecord"] = true; $row["grid_record"] = array("data" => array()); //set the $row["grid_record"] value $this->setRowsGridRecord($row, $record); for ($i = 1; $i < $this->colsOnPage; $i++) { $rec = array(); if ($i < $this->colsOnPage - 1) { $rec["endrecord_block"] = true; } if ($row["grid_record"]["data"]) { $row["grid_record"]["data"][] = $rec; } } $row["grid_rowspace"] = true; $row["grid_recordspace"] = array("data" => array()); for ($i = 0; $i < $this->colsOnPage * 2 - 1; $i++) { $row["grid_recordspace"]["data"][] = true; } $rowInfoArr["data"][] = $row; } }
/** * Extract the array containing the open search panel control's names * from the Search panel coockie * @return Array */ function getOpenFilters() { $panelsStates = my_json_decode(@$_COOKIE["searchPanel"]); if (!is_array($panelsStates)) { return array(); } $panelKey = "panelState_" . GoodFieldName($this->pageObj->tName) . "_" . $this->pageObj->id; if (!array_key_exists($panelKey, $panelsStates)) { return array(); } $panelStateObj = $panelsStates[$panelKey]; return $this->refineOpenFilters($panelStateObj["openFilters"]); }
function buildSearchCtrlBlockArr($recId, $fName, $ctrlInd, $opt, $not, $isChached, $val1, $val2) { $srchCtrlBlock = array(); $srchCtrlBlock['searchcontrol'] = $this->getCtrlParamsArr($fName, $recId, $ctrlInd, $val1, false, $isChached); // create second control, if need it $renderHidden = strtolower($opt) != 'between' && strtolower($opt) != 'not between'; $srchCtrlBlock['searchcontrol1'] = $this->getSecCtrlParamsArr($fName, $recId, $ctrlInd, $val2, $renderHidden, $isChached); // del button $srchCtrlBlock['delCtrlButt'] = $this->getDelButtonHtml($fName, $recId); // one control with options container attr $filterRowId = $this->getFilterRowId($recId, $fName); $srchCtrlBlock['filterRow_attrs'] = ($isChached ? $this->dispNoneStyle : '') . ' id="' . $filterRowId . '" '; $srchCtrlBlock['fName'] = $fName; // combo with attrs $srchCtrlBlock['searchtype'] = $this->getCtrlSearchType($fName, $recId, $ctrlInd, $opt, $not); // checkbox attrs $srchCtrlBlock['notbox'] = $this->getNotBox($fName, $recId, $not); $srchCtrlBlock['fLabel'] = GetFieldLabel(GoodFieldName($this->tName), GoodFieldName($fName)); return $srchCtrlBlock; }
function ExportToExcel($rs, $nPageSize, $eventObj, $cipherer, $pageObj) { if ($eventObj->exists("ListFetchArray")) { $row = $eventObj->ListFetchArray($rs, $pageObj); } else { $row = $cipherer->DecryptFetchedArray($pageObj->connection->fetch_array($rs)); } $tmpArr = array(); $totals = array(); $arrLabel = array(); $arrTotal = array(); $arrFields = array(); $arrTmpTotal = array(); $arrColumnWidth = array(); $arrTotalMessage = array(); $tmpArr = $pageObj->pSet->getExportFields(); foreach ($tmpArr as $value) { if ($pageObj->pSet->appearOnExportPage($value)) { $arrFields[] = $value; } } $arrTmpTotal = $pageObj->pSet->getTotalsFields(); $pageObj->viewControls->forExport = "excel"; foreach ($arrFields as $value) { $arrLabel[$value] = GetFieldLabel(GoodFieldName($pageObj->tName), GoodFieldName($value)); $arrColumnWidth[$value] = 10; $totals[$value] = array("value" => 0, "numRows" => 0); $totalsType = ""; foreach ($arrTmpTotal as $tvalue) { if ($tvalue["fName"] == $value) { $totalsType = $tvalue["totalsType"]; $totalsFields[] = array('fName' => $value, 'totalsType' => $totalsType, 'viewFormat' => $pageObj->pSet->getViewFormat($value)); } } } // 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 $field) { if (IsBinaryType($pageObj->pSet->getFieldType($field))) { $values[$field] = $row[$field]; } else { $values[$field] = $pageObj->getExportValue($field, $row); } } $eventRes = true; if ($eventObj->exists('BeforeOut')) { $eventRes = $eventObj->BeforeOut($row, $values, $pageObj); } if ($eventRes) { $iNumberOfRows++; $i = 0; foreach ($arrFields as $field) { if (IsBinaryType($pageObj->pSet->getFieldType($field))) { $arrDataType[$field] = "binary"; } elseif ($pageObj->pSet->getViewFormat($field) == FORMAT_DATE_SHORT || $pageObj->pSet->getViewFormat($field) == FORMAT_DATE_LONG || $pageObj->pSet->getViewFormat($field) == FORMAT_DATE_TIME) { $arrDataType[$field] = "date"; } elseif ($pageObj->pSet->getViewFormat($field) == FORMAT_FILE_IMAGE) { $arrDataType[$field] = "file"; } else { $arrDataType[$field] = ""; } $arrData[$field] = $values[$field]; } ExportExcelRecord($arrData, $arrDataType, $iNumberOfRows, $objPHPExcel, $pageObj); } if ($eventObj->exists("ListFetchArray")) { $row = $eventObj->ListFetchArray($rs, $pageObj); } else { $row = $cipherer->DecryptFetchedArray($pageObj->connection->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"], $value["totalsType"], $totals[$fName]["numRows"], $value["viewFormat"], "export"); } $arrTotal[$fName] = $total; $arrTotalMessage[$fName] = $totalMess; } } ExportExcelTotals($arrTotal, $arrTotalMessage, ++$iNumberOfRows, $objPHPExcel); $extExcel = ".xlsx"; $formatExcel = "Excel2007"; if (@$_REQUEST["type"] == "excel5") { $formatExcel = "Excel5"; $extExcel = ".xls"; } ExportExcelSave(GoodFieldName($pageObj->tName) . $extExcel, $formatExcel, $objPHPExcel); }
$arr_alias = array(); $arr_unset = array(); foreach ($arr_page_order_fields["data"] as $key => $value){ $ftable = $arr_page_order_fields["data"][$key]["table"]; $gtable= GoodFieldName($ftable); $fname = $arr_page_order_fields["data"][$key]["name"]; if(is_wr_db()) { $table_field=$ftable.".".$fname; $gname = $gtable."_".GoodFieldName($fname); } else { $table_field=$fname; $gname = GoodFieldName($fname); } // remove duplicate search parameters if (array_key_exists($gname, $arr_alias) || GetGenericEditFormat($ftable, $fname) == EDIT_FORMAT_DATABASE_IMAGE) { $arr_unset[]=$key; continue; } else { $arr_alias[$fname] = 1; } // $opt = ""; $not = false; // edit format if (GetGenericEditFormat($ftable, $fname) == EDIT_FORMAT_TEXT_AREA || GetGenericEditFormat($ftable, $fname) == EDIT_FORMAT_PASSWORD || GetGenericEditFormat($ftable, $fname) == EDIT_FORMAT_HIDDEN
// update_uid - $viewContainer->recId = $recordsCounter; $value = $viewContainer->showDBValue("update_uid", $data, $keylink); $row["update_uid_value"] = $value; // npwpd_old - $viewContainer->recId = $recordsCounter; $value = $viewContainer->showDBValue("npwpd_old", $data, $keylink); $row["npwpd_old_value"] = $value; // id_old - $viewContainer->recId = $recordsCounter; $value = $viewContainer->showDBValue("id_old", $data, $keylink); $row["id_old_value"] = $value; $rowinfo[] = $row; $data = $cipherer->DecryptFetchedArray($rs); } $xt->assign_loopsection("details_row", $rowinfo); } $returnJSON = array("success" => true); $xt->load_template("pad_pad_customer_detailspreview.htm"); $returnJSON["body"] = $xt->fetch_loaded(); if ($mode != "inline") { $returnJSON["counter"] = postvalue("counter"); $layout = GetPageLayout(GoodFieldName($strTableName), 'detailspreview'); if ($layout) { $rtl = $xt->getReadingOrder() == 'RTL' ? 'RTL' : ''; $returnJSON["style"] = "styles/" . $layout->style . "/style" . $rtl . ".css"; $returnJSON["pageStyle"] = "pagestyles/" . $layout->name . $rtl . ".css"; $returnJSON["layout"] = $layout->style . " page-" . $layout->name . ".css"; } } echo "<textarea>" . htmlspecialchars(my_json_encode($returnJSON)) . "</textarea>";
} if ($strMessage != "") { $xt->assign("message", "<div class='message rnr-error'>" . $strMessage . "</div>"); $xt->assign("message_block", true); } } } if (!isMobile()) { $includes .= "<div id=\"search_suggest\"></div>\r\n"; } // assign values to the controls if (!count($values)) { } $regFields = $pageObject->pSet->getFieldsForRegister(); foreach ($regFields as $fName) { $gfName = GoodFieldName($fName); $parameters = array(); $parameters["id"] = $id; $parameters["mode"] = "add"; $parameters["field"] = $fName; $parameters["value"] = @$values[$fName]; $parameters["pageObj"] = $pageObject; if ($fName == GetPasswordField() or $fName == GetUserNameField() or $fName == GetEmailField()) { $parameters["suggest"] = true; } else { $parameters["suggest"] = false; } if ($pageObject->pSet->getEditFormat($fName) == 'Time') { $pageObject->fillTimePickSettings($fName, @$values[$fName]); } if ($fName == GetPasswordField()) {
$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->body["end"] .= "<script>" . $pageObject->PrepareJs() . "</script>"; $xt->assignbyref("body", $pageObject->body); $xt->display($templatefile); exit; } else { if ($mode == SEARCH_LOAD_CONTROL) { $searchControlBuilder = new PanelSearchControl($searchControllerId, $strTableName, $pageObject->searchClauseObj, $pageObject); $ctrlField = postvalue('ctrlField'); $ctrlBlockArr = $searchControlBuilder->buildSearchCtrlBlockArr($id, $ctrlField, 0, '', false, true, '', ''); // build array for encode $resArr = array(); $resArr['control1'] = trim($xt->call_func($ctrlBlockArr['searchcontrol'])); $resArr['control2'] = trim($xt->call_func($ctrlBlockArr['searchcontrol1'])); $resArr['comboHtml'] = trim($ctrlBlockArr['searchtype']); $resArr['delButt'] = trim($ctrlBlockArr['delCtrlButt']); $resArr['delButtId'] = trim($searchControlBuilder->getDelButtonId($ctrlField, $id)); $resArr['divInd'] = trim($id); $resArr['fLabel'] = GetFieldLabel(GoodFieldName($strTableName), GoodFieldName($ctrlField)); $resArr['ctrlMap'] = $pageObject->controlsMap['controls']; if (postvalue('isNeedSettings') == 'true') { $pageObject->fillSettings(); $resArr['settings'] = $pageObject->jsSettings; } // return JSON echo my_json_encode($resArr); exit; } }
/** * Add common assign for current mode * */ function commonAssign() { parent::commonAssign(); $this->xt->assign("left_block", false); //select all link and attr if ($this->masterPageType == PAGE_ADD || $this->masterPageType == PAGE_VIEW || $this->mainMasterPageType == PAGE_VIEW) { $this->xt->assign("selectall_link", false); $this->xt->assign("checkbox_column", false); $this->xt->assign("checkbox_header", false); $this->xt->assign("editselected_link", false); $this->xt->assign("delete_link", false); $this->xt->assign("saveall_link", false); if ($this->masterPageType == PAGE_VIEW || $this->mainMasterPageType == PAGE_VIEW) { $this->xt->assign("recordcontrols_block", false); } } else { //selectall link attrs $this->selectAllLinkAttrs(); //checkbox column $this->checkboxColumnAttrs(); //edit selected link and attr $this->editSelectedLinkAttrs(); //save all link, attr, span $this->saveAllLinkAttrs(); //delete link and attr $this->deleteSelectedLink(); if ($this->masterPageType != PAGE_EDIT) { $searchPermis = $this->permis[$this->tName]['search']; $this->xt->assign("details_block", $searchPermis && $this->rowsFound); $this->xt->assign("details_attrs", "id=\"detFound" . $this->id . "\" name=\"detFound" . $this->id . "\""); $this->xt->assign("pages_block", $searchPermis && $this->rowsFound); } } if ($this->masterPageType != PAGE_VIEW && $this->mainMasterPageType != PAGE_VIEW) { //inline edit column $editPermis = $this->permis[$this->tName]['edit']; $this->xt->assign("inlineedit_column", $editPermis); //for list icons instead of list links $this->assignListIconsColumn($editPermis); //cancel all link, attr, span $this->cancelAllLinkAttrs(); } for ($i = 0; $i < count($this->allDetailsTablesArr); $i++) { $permis = $this->isGroupSecurity && $this->permis[$this->allDetailsTablesArr[$i]['dDataSourceTable']]['add'] && $this->permis[$this->allDetailsTablesArr[$i]['dDataSourceTable']]['search'] || !$this->isGroupSecurity; if ($permis) { $this->xt->assign(GoodFieldName($this->tName) . "_dtable_column", $permis); break; } } }
$xt->load_template($templatefile); $returnJSON['html'] = $xt->fetch_loaded('style_block') . $xt->fetch_loaded('body'); if (count($pageObject->includes_css)) { $returnJSON['CSSFiles'] = array_unique($pageObject->includes_css); } if (count($pageObject->includes_cssIE)) { $returnJSON['CSSFilesIE'] = array_unique($pageObject->includes_cssIE); } $returnJSON["additionalJS"] = $pageObject->grabAllJsFiles(); $returnJSON['idStartFrom'] = $id + 1; echo my_json_encode($returnJSON); } elseif ($inlineadd == ADD_INLINE) { $xt->load_template($templatefile); $returnJSON["html"] = array(); foreach ($addFields as $fName) { $returnJSON["html"][$fName] = $xt->fetchVar(GoodFieldName($fName) . "_editcontrol"); } $returnJSON["additionalJS"] = $pageObject->grabAllJsFiles(); $returnJSON["additionalCSS"] = $pageObject->grabAllCSSFiles(); echo my_json_encode($returnJSON); } else { $xt->display($templatefile); } function GetAddedDataLookupQuery($pageObject, $keys, $forLookup) { global $conn, $strTableName, $strOriginalTableName; $LookupSQL = ""; $linkfield = ""; $dispfield = ""; $noBlobReplace = false; $lookupFieldName = "";
if (!checkTableName($table)) { exit(0); } require_once "include/" . $table . "_variables.php"; $cipherer = new RunnerCipherer($strTableName); $gSettings = new ProjectSettings($strTableName, $pageType); } $hasWhere = false; $fieldsArr = $gSettings->getFieldsList(); $lwLinkField = ''; $lookupField = ''; $lwDisplayField = ''; $lookupConnection = $cman->getDefault(); foreach ($fieldsArr as $f) { $fEditFormat = $gSettings->getEditFormat($f); if ($fEditFormat != EDIT_FORMAT_LOOKUP_WIZARD || GoodFieldName($f) != $field) { continue; } $lookupField = $f; $LookupType = $gSettings->getLookupType($f); if ($LookupType == LT_LOOKUPTABLE || $LookupType == LT_QUERY) { $lookupTable = $gSettings->getLookupTable($f); if ($LookupType == LT_QUERY) { $lookupConnection = $cman->byTable($lookupTable); } else { $connId = $gSettings->getNotProjectLookupTableConnId($f); $lookupConnection = strlen($connId) ? $cman->byId($connId) : $cman->getDefault(); } $linkFieldName = $gSettings->getLinkField($f); $displayFieldName = $gSettings->getDisplayField($f); $linkAndDisplaySame = $displayFieldName == $linkFieldName;
function label($field) { $result = GetFieldLabel( GoodFieldName($this->_table), GoodFieldName($field) ); return $result != "" ? $result : $field; }
$h_includes .= ' <link rel="stylesheet" href="'.GetRootPathForResources("include/css/jquery-ui.css").'" type="text/css"> <link rel="stylesheet" href="'.GetRootPathForResources("include/css/dstyle.css").'" type="text/css"> <link rel="stylesheet" href="'.GetRootPathForResources("include/fancybox/jquery.fancybox.css").'" type="text/css" media="screen"> <script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery.min.js").'"></script> <script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery.dimensions.pack.js").'"></script> <script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery.easing.js").'"></script> <script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery.fancybox.pack.js").'"></script> <script type="text/javascript" src="'.GetRootPathForResources("include/js/jquery-ui.js").'"></script> <script type="text/javascript" src="'.GetRootPathForResources("include/js/json.js").'"></script> '."\r\n"; $xt->assign("h_includes", $h_includes); $_SESSION["webreport".GoodFieldName($_SESSION["webreports"]["settings"]["name"])."_search"]=""; $b_includes .= ' <script type="text/javascript">'."\r\n"; if (is_wr_db() && count($arr_tables_db)) { $b_includes .= ' var NEXT_PAGE_URL = "'.GetTableLink("webreport1").'", PREV_PAGE_URL = "'.GetTableLink("webreport").'"; '."\r\n"; } else { $b_includes .= ' var NEXT_PAGE_URL = "'.GetTableLink("webreport3").'", PREV_PAGE_URL = "'.GetTableLink("webreport").'"; '."\r\n"; }