/** * Static function for create list page * Read params from setting * Create object of class in accordance with mode displaying page * @param String strTableName * @param Array options */ static function &createListPage($strTableName, $options) { global $isGroupSecurity; $gSettings = new ProjectSettings($strTableName, $options['pageType']); $gQuery = $gSettings->getSQLQuery(); $params = $options; $params['tName'] = $strTableName; $params['origTName'] = $gSettings->getOriginalTableName(); $params['gPageSize'] = $gSettings->getInitialPageSize(); $params['gOrderIndexes'] = $gSettings->getOrderIndexes(); $params['gstrOrderBy'] = $gQuery->OrderByToSql(); $params['gsqlHead'] = $gQuery->HeadToSql(); $params['gsqlFrom'] = $gQuery->FromToSql(); $params['gsqlWhereExpr'] = $gQuery->WhereToSql(); $params['gsqlGroupBy'] = $gQuery->GroupByToSql(); $params['gsqlHaving'] = $gQuery->Having()->toSql($gQuery); $params['nSecOptions'] = $gSettings->getAdvancedSecurityType(); $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0); $params['recsPerRowList'] = isMobile() ? 1 : $gSettings->getRecordsPerRowList(); $params['mainTableOwnerID'] = $gSettings->getTableOwnerIdField(); $params['exportTo'] = $gSettings->hasExportPage(); $params['printFriendly'] = $gSettings->hasPrintPage(); $params['deleteRecs'] = $gSettings->hasDelete(); $params["isGroupSecurity"] = $isGroupSecurity; $params['arrKeyFields'] = $gSettings->getTableKeys(); $params["isUseInlineAdd"] = $gSettings->hasInlineAdd(); $params["isUseInlineEdit"] = $gSettings->hasInlineEdit(); $params["panelSearchFields"] = $gSettings->getPanelSearchFields(); $params['listGridLayout'] = $gSettings->getListGridLayout(); $params['createLoginPage'] = GetGlobalData("createLoginPage", false); $params['noRecordsFirstPage'] = $gSettings->noRecordsOnFirstPage(); $params['totalsFields'] = $gSettings->getTotalsFields(); $params['listAjax'] = $gSettings->ajaxBasedListPage(); $params['arrRecsPerPage'] = $gSettings->getRecordsPerPageArray(); $params['isScrollGridBody'] = $gSettings->getScrollGridBody(); $params['viewPDF'] = $gSettings->isViewPagePDF() || $gSettings->isPrinterPagePDF(); $params['audit'] = GetAuditObject($table); $params['listFields'] = array(); $allfields = $gSettings->getListFields(); foreach ($allfields as $f) { if (!$gSettings->appearOnListPage($f)) { continue; } $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => $gSettings->getViewFormat($f), "editFormat" => $gSettings->getEditFormat($f)); } // choose class by mode if ($params["mode"] == LIST_SIMPLE) { $pageObject = new ListPage_Simple($params); } else { if ($params["mode"] == LIST_AJAX) { $pageObject = new ListPage_Ajax($params); } else { if ($params["mode"] == LIST_LOOKUP) { $pageObject = new ListPage_Lookup($params); } else { if ($params["mode"] == LIST_DETAILS || $params["mode"] == LIST_DASHDETAILS) { $pageObject = new ListPage_DPInline($params); } else { if ($params["mode"] == RIGHTS_PAGE) { $pageObject = new RightsPage($params); } else { if ($params["mode"] == MEMBERS_PAGE) { $pageObject = new MembersPage($params); } else { if ($params["mode"] == LIST_DASHBOARD) { $pageObject = new ListPage_Dashboard($params); } } } } } } } $pageObject->init(); return $pageObject; }
/** * Static function for create list page * Read params from setting * Create object of class in accordance with mode displaying page */ function &createListPage($table, $options) { global $bSubqueriesSupported, $strTableName, $conn, $locale_info, $isGroupSecurity; $gQuery = GetTableData($table, ".sqlquery", null); $params = array(); $params = $options; $params['origTName'] = GetTableData($table, ".OriginalTable", ''); $params['sessionPrefix'] = $strTableName; $params['tName'] = $table; $params['conn'] =& $conn; $params['gPageSize'] = GetTableData($table, ".pageSize", 0); $params['gOrderIndexes'] = GetTableData($table, ".orderindexes", array()); $params['gstrOrderBy'] = GetTableData($table, ".strOrderBy", ''); $params['gsqlHead'] = GetTableData($table, ".sqlHead", ''); $params['gsqlFrom'] = GetTableData($table, ".sqlFrom", ''); $params['gsqlWhereExpr'] = GetTableData($table, ".sqlWhereExpr", ''); $params['gsqlGroupBy'] = $gQuery->GroupByToSql(); $oHaving = $gQuery->Having(); $params['gsqlHaving'] = $oHaving->toSql($gQuery); $params['locale_info'] =& $locale_info; $params["subQueriesSupp"] = $bSubqueriesSupported; $params['nSecOptions'] = GetTableData($table, ".nSecOptions", 0); $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0); $params['recsPerRowList'] = GetTableData($table, ".recsPerRowList", 0); $params['tableGroupBy'] = GetTableData($table, ".tableGroupBy", ''); $params['dbType'] = GetGlobalData("dbType", 0); $params['mainTableOwnerID'] = GetTableData($table, ".mainTableOwnerID", ''); $params['moveNext'] = GetTableData($table, ".moveNext", 0); $params['exportTo'] = GetTableData($table, ".exportTo", false); $params['printFriendly'] = GetTableData($table, ".printFriendly", false); $params['deleteRecs'] = GetTableData($table, ".delete", false); $params['rowHighlite'] = GetTableData($table, ".rowHighlite", false); $params["delFile"] = GetGlobalData("delFile", false); $params["isGroupSecurity"] = $isGroupSecurity; $params['arrKeyFields'] = GetTableData($table, ".arrKeyFields", array()); $params["useIbox"] = GetTableData($table, ".useIbox", false); $params["isUseInlineAdd"] = GetTableData($table, ".isUseInlineAdd", false); $params["isUseInlineEdit"] = GetTableData($table, ".isUseInlineEdit", false); $params["isUseInlineJs"] = $params["isUseInlineAdd"] || $params["isUseInlineEdit"]; $params["globSearchFields"] = GetTableData($table, ".globSearchFields", array()); $params["panelSearchFields"] = GetTableData($table, ".panelSearchFields", array()); $params['isVerLayout'] = GetTableData($table, ".isVerLayout", false); $params['isDisplayLoading'] = GetTableData($table, ".isDisplayLoading", false); $params['createLoginPage'] = GetGlobalData("createLoginPage", false); $params['subQueriesSupAccess'] = GetTableData($table, ".subQueriesSupAccess", false); $params['noRecordsFirstPage'] = GetTableData($table, ".noRecordsFirstPage", false); $params['totalsFields'] = GetTableData($table, ".totalsFields", array()); $params['listIcons'] = GetTableData($table, ".listIcons", false); $params['edit'] = GetTableData($table, ".edit", false); $params['inlineEdit'] = GetTableData($table, ".inlineEdit", false); $params['iCopy'] = GetTableData($table, ".copy", false); $params['iView'] = GetTableData($table, ".view", false); $params['listAjax'] = GetTableData($table, ".listAjax", false); $params['arrRecsPerPage'] = GetTableData($table, ".arrRecsPerPage", array()); $params['audit'] = GetAuditObject($table); $params['listFields'] = array(); $allfields = GetFieldsList($table); foreach ($allfields as $f) { if (!AppearOnListPage($f, $table)) { continue; } $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => GetFieldData($table, $f, "ViewFormat", ""), "editFormat" => GetFieldData($table, $f, "EditFormat", "")); } // choose class by mode if ($params["mode"] == LIST_SIMPLE) { $pageObject = new ListPage_Simple($params); } else { if ($params["mode"] == LIST_AJAX) { $pageObject = new ListPage_Ajax($params); } else { if ($params["mode"] == LIST_LOOKUP) { $pageObject = new ListPage_Lookup($params); } else { if ($params["mode"] == LIST_DETAILS) { $pageObject = new ListPage_DPInline($params); } else { if ($params["mode"] == RIGHTS_PAGE) { $pageObject = new RightsPage($params); } else { if ($params["mode"] == MEMBERS_PAGE) { $pageObject = new MembersPage($params); } } } } } } return $pageObject; }
/** * @constructor */ function EditPage(&$params) { parent::RunnerPage($params); $this->setKeysForJs(); $this->auditObj = GetAuditObject($this->tName); $this->editFields = $this->getPageFields(); $this->formBricks["header"] = "editheader"; $this->formBricks["footer"] = "editbuttons"; $this->assignFormFooterAndHeaderBricks(true); }
function LoginPage(&$params) { // call parent constructor parent::RunnerPage($params); $this->auditObj = GetAuditObject(); $this->formBricks["header"] = "loginheader"; $this->formBricks["footer"] = "loginbuttons"; }
/** * @constructor */ function LoginPage(&$params) { // call parent constructor parent::RunnerPage($params); $this->pSet = new ProjectSettings("ConsolidatedStockEnquiry_users", $this->pageType); $this->pSetEdit = $this->pSet; $this->pSetSearch = new ProjectSettings($this->tName, PAGE_SEARCH); $this->auditObj = GetAuditObject(); $this->formBricks["header"] = "loginheader"; $this->formBricks["footer"] = "loginbuttons"; $this->assignFormFooterAndHeaderBricks(true); }
} else { $templatefile = "pad_pad_customer_add.htm"; } $id = postvalue("id"); if (intval($id) == 0) { $id = 1; } //If undefined session value for mastet table, but exist post value master table, than take second //It may be happen only when use dpInline mode on page add if (!@$_SESSION[$sessionPrefix . "_mastertable"] && postvalue("mastertable")) { $_SESSION[$sessionPrefix . "_mastertable"] = postvalue("mastertable"); } $xt = new Xtempl(); // assign an id $xt->assign("id", $id); $auditObj = GetAuditObject($strTableName); //array of params for classes $params = array("pageType" => PAGE_ADD, "id" => $id, "mode" => $inlineadd); $params['xt'] =& $xt; $params['tName'] = $strTableName; $params['includes_js'] = $includes_js; $params['locale_info'] = $locale_info; $params['includes_css'] = $includes_css; $params['useTabsOnAdd'] = $gSettings->useTabsOnAdd(); $params['templatefile'] = $templatefile; $params['includes_jsreq'] = $includes_jsreq; $params['pageAddLikeInline'] = $inlineadd == ADD_INLINE; $params['needSearchClauseObj'] = false; $params['strOriginalTableName'] = $strOriginalTableName; if ($params['useTabsOnAdd']) { $params['arrAddTabs'] = $gSettings->getAddTabs();
/** * @constructor */ function AddPage(&$params) { parent::RunnerPage($params); $this->addFields = $this->getPageFields(); $this->auditObj = GetAuditObject($this->tName); $this->formBricks["header"] = "addheader"; $this->formBricks["footer"] = "addbuttons"; $this->assignFormFooterAndHeaderBricks(true); }
/** * Static function for create list page * Read params from setting * Create object of class in accordance with mode displaying page */ function &createListPage($table, $options) { global $bSubqueriesSupported, $strTableName, $conn, $locale_info, $isGroupSecurity; $gSettings = new ProjectSettings($strTableName, $options['pageType']); $gQuery = $gSettings->getSQLQuery(); $params = array(); $params = $options; $params['origTName'] = $gSettings->getOriginalTableName(); $params['sessionPrefix'] = $strTableName; $params['tName'] = $table; $params['conn'] =& $conn; $params['gPageSize'] = $gSettings->getInitialPageSize(); $params['gOrderIndexes'] = $gSettings->getOrderIndexes(); $params['gstrOrderBy'] = $gQuery->OrderByToSql(); $params['gsqlHead'] = $gQuery->HeadToSql(); $params['gsqlFrom'] = $gQuery->FromToSql(); $params['gsqlWhereExpr'] = $gQuery->WhereToSql(); $params['gsqlGroupBy'] = $gQuery->GroupByToSql(); $params['gsqlHaving'] = $gQuery->Having()->toSql($gQuery); $params['locale_info'] =& $locale_info; $params["subQueriesSupp"] = $bSubqueriesSupported; $params['nSecOptions'] = $gSettings->getAdvancedSecurityType(); $params['nLoginMethod'] = GetGlobalData("nLoginMethod", 0); $params['recsPerRowList'] = $gSettings->getRecordsPerRowList(); $params['dbType'] = GetGlobalData("dbType", 0); $params['mainTableOwnerID'] = $gSettings->getTableOwnerIdField(); $params['moveNext'] = $gSettings->useMoveNext(); $params['exportTo'] = $gSettings->hasExportPage(); $params['printFriendly'] = $gSettings->hasPrintPage(); $params['deleteRecs'] = $gSettings->hasDelete(); $params['rowHighlite'] = $gSettings->highlightRows(); $params["isGroupSecurity"] = $isGroupSecurity; $params['arrKeyFields'] = $gSettings->getTableKeys(); $params["isUseInlineAdd"] = $gSettings->hasInlineAdd(); $params["isUseInlineEdit"] = $gSettings->hasInlineEdit(); $params["isUseInlineJs"] = $params["isUseInlineAdd"] || $params["isUseInlineEdit"]; $params["panelSearchFields"] = $gSettings->getPanelSearchFields(); $params['isVerLayout'] = $gSettings->isVerticalLayoutList(); $params['isDisplayLoading'] = $gSettings->displayLoading(); $params['createLoginPage'] = GetGlobalData("createLoginPage", false); $params['subQueriesSupAccess'] = $gSettings->tableSupportsSubqueries(); $params['noRecordsFirstPage'] = $gSettings->noRecordsOnFirstPage(); $params['totalsFields'] = $gSettings->getTotalsFields(); $params['listIcons'] = $gSettings->iconsOnList(); $params['edit'] = $gSettings->hasEditPage(); $params['inlineEdit'] = $gSettings->hasInlineEdit(); $params['iCopy'] = $gSettings->hasCopyPage(); $params['iView'] = $gSettings->hasViewPage(); $params['listAjax'] = $gSettings->ajaxBasedListPage(); $params['arrRecsPerPage'] = $gSettings->getRecordsPerPageArray(); $params['isScrollGridBody'] = $gSettings->getScrollGridBody(); $params['audit'] = GetAuditObject($table); $params['listFields'] = array(); $allfields = $gSettings->getListFields(); foreach ($allfields as $f) { if (!$gSettings->appearOnListPage($f)) { continue; } $params['listFields'][] = array("fName" => $f, "goodFieldName" => GoodFieldName($f), "valueFieldName" => GoodFieldName($f) . "_value", "viewFormat" => $gSettings->getViewFormat($f), "editFormat" => $gSettings->getEditFormat($f)); } // choose class by mode if ($params["mode"] == LIST_SIMPLE) { $pageObject = new ListPage_Simple($params); } else { if ($params["mode"] == LIST_AJAX) { $pageObject = new ListPage_Ajax($params); } else { if ($params["mode"] == LIST_LOOKUP) { $pageObject = new ListPage_Lookup($params); } else { if ($params["mode"] == LIST_DETAILS) { $pageObject = new ListPage_DPInline($params); } else { if ($params["mode"] == RIGHTS_PAGE) { $pageObject = new RightsPage($params); } else { if ($params["mode"] == MEMBERS_PAGE) { $pageObject = new MembersPage($params); } } } } } } return $pageObject; }
function DoInsertRecordSQL($table, &$avalues, &$blobfields, $pageid, &$pageObject, &$cipherer) { global $error_happened, $conn, $inlineadd, $usermessage, $message, $failed_inline_add, $keys, $strTableName; // make SQL string $strSQL = "insert into " . AddTableWrappers($table) . " "; $strFields = "("; $strValues = "("; $blobs = PrepareBlobs($avalues, $blobfields); foreach ($avalues as $akey => $value) { $strFields .= $pageObject->pSet->getTableField($akey) . ", "; if (in_array($akey, $blobfields)) { $strValues .= $value . ", "; } else { if (is_null($cipherer)) { $strValues .= add_db_quotes($akey, $value) . ", "; } else { $strValues .= $cipherer->AddDBQuotes($akey, $value) . ", "; } } } if (substr($strFields, -2) == ", ") { $strFields = substr($strFields, 0, strlen($strFields) - 2); } if (substr($strValues, -2) == ", ") { $strValues = substr($strValues, 0, strlen($strValues) - 2); } $strSQL .= $strFields . ") values " . $strValues . ")"; if (!ExecuteUpdate($pageObject, $strSQL, $blobs, true)) { return false; } if ($error_happened) { return false; } $pageObject->ProcessFiles(); if ($inlineadd == ADD_INLINE) { $status = "ADDED"; $message = "" . "Record was added" . ""; $IsSaved = true; } else { $message = "<<< " . "Record was added" . " >>>"; } if ($usermessage != "") { $message = $usermessage; } $auditObj = GetAuditObject($table); if ($inlineadd == ADD_SIMPLE || $inlineadd == ADD_INLINE || $inlineadd == ADD_ONTHEFLY || $inlineadd == ADD_POPUP || $inlineadd == ADD_MASTER || tableEventExists("AfterAdd", $strTableName) || $auditObj) { $failed_inline_add = false; $keyfields = $pageObject->pSet->getTableKeys(); foreach ($keyfields as $k) { if (array_key_exists($k, $avalues)) { $keys[$k] = $avalues[$k]; } elseif ($pageObject->pSet->isAutoincField($k)) { $lastrs = @db_query("SELECT lastval()", $conn); if ($lastdata = db_fetch_numarray($lastrs)) { $keys[$k] = $lastdata[0]; } } else { $failed_inline_add = true; } } } return true; }
function ImportPage(&$params) { parent::RunnerPage($params); $this->audit = GetAuditObject($this->tName); $this->jsSettings['tableSettings'][$this->tName]["importFieldsLables"] = $this->getImportfieldsLabels(); }
function LoginPage(&$params) { // call parent constructor parent::RunnerPage($params); $this->auditObj = GetAuditObject(); }
/** * @intellisense */ function DoLogin($callAfterLoginEvent = false, $userID = "Guest", $userName = "", $groupID = "<Guest>", $accessLevel = ACCESS_LEVEL_GUEST, $password = "", &$pageObject = null) { global $globalEvents; if ($userID == "Guest" && $userName == "") { $userName = "******"; } $_SESSION["UserID"] = $userID; $_SESSION["UserName"] = runner_htmlspecialchars($userName); $_SESSION["GroupID"] = $groupID; $_SESSION["AccessLevel"] = $accessLevel; $auditObj = GetAuditObject(); if ($auditObj) { $auditObj->LogLogin($userID); $auditObj->LoginSuccessful(); } if ($callAfterLoginEvent && $globalEvents->exists("AfterSuccessfulLogin")) { $dummy = array(); $globalEvents->AfterSuccessfulLogin($userID != "Guest" ? $userID : "", $password, $dummy, $pageObject); } }
$params['xt'] =& $xt; $params['tName'] = NOT_TABLE_BASED_TNAME; $params['templatefile'] = "changepwd.htm"; $params['needSearchClauseObj'] = false; $pageObject = new ChangePasswordPage($params); $pageObject->init(); $onFly = postvalue("onFly"); $referer = @$_SERVER["HTTP_REFERER"] != "" && strpos($_SERVER["HTTP_REFERER"], GetTableLink("changepwd")) != strlen($_SERVER["HTTP_REFERER"]) - strlen(GetTableLink("changepwd")) ? $_SERVER["HTTP_REFERER"] : ""; if (!isset($_SESSION["changepwd_referer"])) { $_SESSION["changepwd_referer"] = $referer != "" ? $referer : GetTableLink("menu"); } else { if ($referer != "") { $_SESSION["changepwd_referer"] = $referer; } } $auditObj = GetAuditObject(); // Before Process event if ($globalEvents->exists("BeforeProcessChangePwd")) { $globalEvents->BeforeProcessChangePwd($pageObject); } if (@$_POST["btnSubmit"] == "Change") { $xt->assign("backlink_attrs", "href=\"" . runner_htmlspecialchars($_SESSION["changepwd_referer"]) . "\""); $filename_values = array(); $blobfields = array(); $values = array(); $strTableName = $cLoginTable; foreach ($changePwdFields as $fName) { $fControl = $pageObject->getControl($fName, $id); $fControl->readWebValue($values, $blobfields, NULL, NULL, $filename_values); } $value = @$_SESSION["UserID"];
/** * insert record on Add & Register pages * @intellisense */ function DoInsertRecordSQL($table,&$avalues,&$blobfields, $pageid, &$pageObject, &$cipherer, &$keys) { global $error_happened,$conn,$inlineadd,$message,$failed_inline_add,$strTableName; // make SQL string $strSQL = "insert into ".AddTableWrappers($table)." "; $strFields="("; $strValues="("; $blobs = PrepareBlobs($avalues,$blobfields); foreach($avalues as $akey=>$value) { $strFields .= $pageObject->pSet->getTableField($akey).", "; if(in_array($akey, $blobfields)) $strValues.=$value.", "; else if(is_null($cipherer)) $strValues .= add_db_quotes($akey,$value).", "; else $strValues .= $cipherer->AddDBQuotes($akey,$value).", "; } if(substr($strFields,-2)==", ") $strFields=substr($strFields,0,strlen($strFields)-2); if(substr($strValues,-2)==", ") $strValues=substr($strValues,0,strlen($strValues)-2); $strSQL.=$strFields.") values ".$strValues.")"; if(!ExecuteUpdate($pageObject,$strSQL,$blobs,true)) return false; if($error_happened) return false; $pageObject->ProcessFiles(); if ( $inlineadd==ADD_INLINE ) { $status="ADDED"; $message=""."Record was added".""; $IsSaved = true; } else $message="<<< "."Record was added"." >>>"; $auditObj = GetAuditObject($table); if($inlineadd==ADD_SIMPLE || $inlineadd==ADD_INLINE || $inlineadd==ADD_ONTHEFLY || $inlineadd==ADD_POPUP || $inlineadd==ADD_MASTER || tableEventExists("AfterAdd",$strTableName) || $auditObj) { $keys = prepareTableKeysAfterInsert($table, $avalues, $pageObject, $keys); } return true; }