function isFieldEncrypted($field, $table = ""){ $pSet = $this->pSet; if($table == "") $table = $this->strTableName; if(array_key_exists($table, $this->encryptedFields) && array_key_exists($field, $this->encryptedFields[$table])) return $this->encryptedFields[$table][$field]; if($table != $this->strTableName) $pSet = new ProjectSettings($table); if(!array_key_exists($table, $this->encryptedFields)) $this->encryptedFields[$table] = array(); $this->encryptedFields[$table][$field] = $pSet->isFieldEncrypted($field); return $this->encryptedFields[$table][$field]; }
function simpleSearchFieldCombo($fNamesArr, $selOpt) { $options = ""; $settings = new ProjectSettings($this->tName); if (sizeof($settings->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; }
/** * @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; } }
/** * Login method * @param String pUsername * @param String pPassword */ function LogIn($pUsername, $pPassword) { // username and password are stored in the database global $cUserNameFieldType, $cPasswordFieldType, $cUserNameField, $cPasswordField, $cDisplayNameField; $logged = false; $strUsername = (string) $pUsername; $strPassword = (string) $pPassword; $loginSet = ProjectSettings::getForLogin(); $cipherer = RunnerCipherer::getForLogin($loginSet); $sUsername = $strUsername; $sPassword = $strPassword; if ($cipherer->isFieldEncrypted($cUserNameField)) { $strUsername = $cipherer->MakeDBValue($cUserNameField, $strUsername, "", true); } else { if (NeedQuotes($cUserNameFieldType)) { $strUsername = $this->connection->prepareString($strUsername); } else { $strUsername = 0 + $strUsername; } } if ($cipherer->isFieldEncrypted($cPasswordField)) { $strPassword = $cipherer->MakeDBValue($cPasswordField, $strPassword, "", true); } else { if (NeedQuotes($cPasswordFieldType)) { $strPassword = $this->connection->prepareString($strPassword); } else { $strPassword = 0 + $strPassword; } } if ($loginSet) { if (!$this->pSet->isCaseInsensitiveUsername()) { $where = $this->getFieldSQLDecrypt($cUserNameField) . "=" . $strUsername . " and " . $this->getFieldSQLDecrypt($cPasswordField) . "=" . $strPassword; } else { $where = $this->connection->upper($this->getFieldSQLDecrypt($cUserNameField)) . "=" . $this->pSet->getCaseSensitiveUsername($strUsername) . " and " . $this->getFieldSQLDecrypt($cPasswordField) . "=" . $strPassword; } $tempSQLQuery = $loginSet->GetTableData(".sqlquery"); $tempSQLQuery->addWhere($where); $strSQL = $tempSQLQuery->toSql(); } else { $strSQL = "select * from " . $this->connection->addTableWrappers("DashboardUsers") . " where " . $this->connection->addFieldWrappers($cUserNameField) . "=" . $strUsername . " and " . $this->connection->addFieldWrappers($cPasswordField) . "=" . $strPassword; } $data = $cipherer->DecryptFetchedArray($this->connection->query($strSQL)->fetchAssoc()); if ($data) { if ($this->pSet->getCaseSensitiveUsername(@$data[$cUserNameField]) == $this->pSet->getCaseSensitiveUsername($sUsername) && @$data[$cPasswordField] == $sPassword) { $logged = true; $pDisplayUsername = $data[$cDisplayNameField] != '' ? $data[$cDisplayNameField] : $sUsername; } } if ($logged && $this->isCaptchaOk) { DoLogin(false, $pUsername, $pDisplayUsername, "", ACCESS_LEVEL_USER, $pPassword, $this); SetAuthSessionData($pUsername, $data, $this->fromFacebook, $pPassword, $this); return true; } if ($this->auditObj) { $this->auditObj->LogLoginFailed($pUsername); $this->auditObj->LoginUnsuccessful($pUsername); } return false; }
static function readSelectedRecordsFromRequest($table) { if (!$_REQUEST["selection"]) { return array(); } $selected_recs = array(); $pSet = new ProjectSettings($table); $keyFields = $pSet->getTableKeys(); foreach (@$_REQUEST["selection"] as $keyblock) { $arr = explode("&", refine($keyblock)); if (count($arr) < count($keyFields)) { continue; } $keys = array(); foreach ($arr as $i => $value) { $keys[$keyFields[$i]] = urldecode($value); } $selected_recs[] = $keys; } return $selected_recs; }
public static function redirectToList($table) { $settings = new ProjectSettings($table); if ($settings->hasListPage()) { HeaderRedirect($settings->getShortTableName(), "list", "a=return"); exit; } // no List page HeaderRedirect("menu"); exit; }
function DisplayMasterTableInfo_pad_pad_sspd($params) { $detailtable = $params["detailtable"]; $keys = $params["keys"]; global $conn, $strTableName; $xt = new Xtempl(); $oldTableName = $strTableName; $strTableName = "pad.pad_sspd"; //$strSQL = "SELECT id, tahun, sspdno, sspdtgl, sspdjam, invoice_id, keterangan, bulan_telat, hitung_bunga, denda, bunga, jml_bayar, sisa, jenis_bayar, printed, tp_id, is_validated, is_valid, enabled, created, create_uid, updated, update_uid, petugas_id, pejabat_id FROM \"pad\".pad_sspd "; $cipherer = new RunnerCipherer($strTableName); $settings = new ProjectSettings($strTableName, PAGE_PRINT); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_PRINT); $where = ""; global $pageObject, $page_styles, $page_layouts, $page_layout_names, $container_styles; $layout = new TLayout("masterprint", "RoundedGreen", "MobileGreen"); $layout->blocks["bare"] = array(); $layout->containers["0"] = array(); $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1); $layout->skins["0"] = "empty"; $layout->blocks["bare"][] = "0"; $layout->containers["mastergrid"] = array(); $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1); $layout->skins["mastergrid"] = "grid"; $layout->blocks["bare"][] = "mastergrid"; $page_layouts["pad_pad_sspd_masterprint"] = $layout; $showKeys = ""; if ($detailtable == "public.pad_payment") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $xt->assign('showKeys', $showKeys); } if (!$where) { $strTableName = $oldTableName; return; } $str = SecuritySQL("Export"); if (strlen($str)) { $where .= " and " . $str; } $strWhere = whereAdd($masterQuery->m_where->toSql($masterQuery), $where); if (strlen($strWhere)) { $strWhere = " where " . $strWhere . " "; } $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql(); // $strSQL=AddWhere($strSQL,$where); LogInfo($strSQL); $rs = db_query($strSQL, $conn); $data = $cipherer->DecryptFetchedArray($rs); if (!$data) { $strTableName = $oldTableName; return; } $keylink = ""; $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"])); // id - $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink)); // tahun - $xt->assign("tahun_mastervalue", $viewControls->showDBValue("tahun", $data, $keylink)); // sspdno - $xt->assign("sspdno_mastervalue", $viewControls->showDBValue("sspdno", $data, $keylink)); // sspdtgl - Short Date $xt->assign("sspdtgl_mastervalue", $viewControls->showDBValue("sspdtgl", $data, $keylink)); // sspdjam - Time $xt->assign("sspdjam_mastervalue", $viewControls->showDBValue("sspdjam", $data, $keylink)); // invoice_id - $xt->assign("invoice_id_mastervalue", $viewControls->showDBValue("invoice_id", $data, $keylink)); // keterangan - $xt->assign("keterangan_mastervalue", $viewControls->showDBValue("keterangan", $data, $keylink)); // bulan_telat - $xt->assign("bulan_telat_mastervalue", $viewControls->showDBValue("bulan_telat", $data, $keylink)); // hitung_bunga - $xt->assign("hitung_bunga_mastervalue", $viewControls->showDBValue("hitung_bunga", $data, $keylink)); // denda - Number $xt->assign("denda_mastervalue", $viewControls->showDBValue("denda", $data, $keylink)); // bunga - Number $xt->assign("bunga_mastervalue", $viewControls->showDBValue("bunga", $data, $keylink)); // jml_bayar - $xt->assign("jml_bayar_mastervalue", $viewControls->showDBValue("jml_bayar", $data, $keylink)); // sisa - Number $xt->assign("sisa_mastervalue", $viewControls->showDBValue("sisa", $data, $keylink)); // jenis_bayar - $xt->assign("jenis_bayar_mastervalue", $viewControls->showDBValue("jenis_bayar", $data, $keylink)); // printed - $xt->assign("printed_mastervalue", $viewControls->showDBValue("printed", $data, $keylink)); // tp_id - $xt->assign("tp_id_mastervalue", $viewControls->showDBValue("tp_id", $data, $keylink)); // is_validated - $xt->assign("is_validated_mastervalue", $viewControls->showDBValue("is_validated", $data, $keylink)); // is_valid - $xt->assign("is_valid_mastervalue", $viewControls->showDBValue("is_valid", $data, $keylink)); // enabled - $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink)); // created - Short Date $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink)); // create_uid - $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink)); // updated - Short Date $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink)); // update_uid - $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink)); // petugas_id - $xt->assign("petugas_id_mastervalue", $viewControls->showDBValue("petugas_id", $data, $keylink)); // pejabat_id - $xt->assign("pejabat_id_mastervalue", $viewControls->showDBValue("pejabat_id", $data, $keylink)); $xt->display("pad_pad_sspd_masterprint.htm"); $strTableName = $oldTableName; }
function DisplayMasterTableInfo_pad_pad_kelurahan($params) { $detailtable = $params["detailtable"]; $keys = $params["keys"]; $detailPageObj = $params["detailPageObj"]; global $conn, $strTableName; $xt = new Xtempl(); $oldTableName = $strTableName; $strTableName = "pad.pad_kelurahan"; $settings = new ProjectSettings($strTableName, PAGE_LIST); $cipherer = new RunnerCipherer($strTableName); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_LIST); $where = ""; $mKeys = array(); $showKeys = ""; global $page_styles, $page_layouts, $page_layout_names, $container_styles; $layout = new TLayout("masterlist", "RoundedGreen", "MobileGreen"); $layout->blocks["bare"] = array(); $layout->containers["0"] = array(); $layout->containers["0"][] = array("name" => "masterlistheader", "block" => "", "substyle" => 1); $layout->skins["0"] = "empty"; $layout->blocks["bare"][] = "0"; $layout->containers["mastergrid"] = array(); $layout->containers["mastergrid"][] = array("name" => "masterlistfields", "block" => "", "substyle" => 1); $layout->skins["mastergrid"] = "grid"; $layout->blocks["bare"][] = "mastergrid"; $page_layouts["pad_pad_kelurahan_masterlist"] = $layout; if ($detailtable == "pad.pad_customer_usaha") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $xt->assign('showKeys', $showKeys); } if ($detailtable == "pad.pad_customer") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $xt->assign('showKeys', $showKeys); } if ($detailtable == "pad.pad_daftar") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $where .= " and "; $showKeys .= " , "; $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[2 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[2 - 1]; $xt->assign('showKeys', $showKeys); } if (!$where) { $strTableName = $oldTableName; return; } $str = SecuritySQL("Search"); if (strlen($str)) { $where .= " and " . $str; } $strWhere = whereAdd($masterQuery->WhereToSql(), $where); if (strlen($strWhere)) { $strWhere = " where " . $strWhere . " "; } $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql(); // $strSQL = AddWhere($strSQL,$where); LogInfo($strSQL); $rs = db_query($strSQL, $conn); $data = $cipherer->DecryptFetchedArray($rs); if (!$data) { $strTableName = $oldTableName; return; } $keylink = ""; $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"])); // id - $value = ""; $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink)); // kecamatan_id - $value = ""; $xt->assign("kecamatan_id_mastervalue", $viewControls->showDBValue("kecamatan_id", $data, $keylink)); // kode - $value = ""; $xt->assign("kode_mastervalue", $viewControls->showDBValue("kode", $data, $keylink)); // nama - $value = ""; $xt->assign("nama_mastervalue", $viewControls->showDBValue("nama", $data, $keylink)); // tmt - Short Date $value = ""; $xt->assign("tmt_mastervalue", $viewControls->showDBValue("tmt", $data, $keylink)); // enabled - $value = ""; $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink)); // created - Short Date $value = ""; $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink)); // create_uid - $value = ""; $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink)); // updated - Short Date $value = ""; $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink)); // update_uid - $value = ""; $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink)); $viewControls->addControlsJSAndCSS(); $detailPageObj->viewControlsMap['mViewControlsMap'] = $viewControls->viewControlsMap; $layout = GetPageLayout("pad_pad_kelurahan", 'masterlist'); if ($layout) { $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"'); } $xt->display("pad_pad_kelurahan_masterlist.htm"); $strTableName = $oldTableName; }
/** * Create new control (if needed) for view field, and return it * @param {string} field name * @param {string} predefined view format */ public function getControl($field, $format = null) { // if conrol does not created previously if(!array_key_exists($field, $this->viewControls)) { include_once(getabspath("classes/controls/ViewControl.php")); $vcTypes = new ViewControlTypes(); $editFormat = $this->pSet->getEditFormat($field); if(is_null($format)){ $localPSet = $this->pSet; $lookupPageType = ""; if(!$this->isLocal) { $lookupPageType = $this->pSet->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD); if($lookupPageType != "") $localPSet = new ProjectSettings($this->pSet->_table, $lookupPageType); } if(!$this->isLocal && ($editFormat == EDIT_FORMAT_LOOKUP_WIZARD || $lookupPageType != "") && ($localPSet->getLookupType($field) == LT_LOOKUPTABLE || $localPSet->getLookupType($field) == LT_QUERY) && $localPSet->getLWLinkField($field) != $localPSet->getLWDisplayField($field)) { $viewFormat = FORMAT_LOOKUP_WIZARD; }else $viewFormat = $this->pSet->getViewFormat($field); }else $viewFormat = $format; if($viewFormat == FORMAT_FILE_IMAGE && $this->pSet->isCompatibilityMode($field)) $viewFormat = FORMAT_FILE_IMAGE_OLD; $className = $vcTypes->viewTypes[$viewFormat]; if($className == "" && $viewFormat != "") { $className = "View".$viewFormat; $userControl = true; include_once(getabspath("classes/controls/ViewUserControl.php")); } if($className != "") { $this->viewControls[$field] = createViewControlClass($className, $field, $this, $this->pageObject); } else $this->viewControls[$field] = new ViewControl($field, $this, $this->pageObject); if($userControl) { $this->viewControls[$field]->viewFormat = $className; $this->viewControls[$field]->init(); $this->viewControls[$field]->initUserControl(); } } return $this->viewControls[$field]; }
function DisplayMasterTableInfo_app_users($params) { $detailtable = $params["detailtable"]; $keys = $params["keys"]; global $conn, $strTableName; $xt = new Xtempl(); $oldTableName = $strTableName; $strTableName = "app.users"; //$strSQL = "SELECT userid, nama, created, disabled, passwd, id, kd_kantor, kd_kanwil, kd_tp, kd_kanwil_bank, kd_kppbb_bank, kd_bank_tunggal, kd_bank_persepsi, nip, jabatan, handphone, create_uid, update_uid, updated, last_login, is_login, is_logout, last_ip FROM app.users "; $cipherer = new RunnerCipherer($strTableName); $settings = new ProjectSettings($strTableName, PAGE_PRINT); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_PRINT); $where = ""; global $pageObject, $page_styles, $page_layouts, $page_layout_names, $container_styles; $layout = new TLayout("masterprint", "RoundedGreen", "MobileGreen"); $layout->blocks["bare"] = array(); $layout->containers["0"] = array(); $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1); $layout->skins["0"] = "empty"; $layout->blocks["bare"][] = "0"; $layout->containers["mastergrid"] = array(); $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1); $layout->skins["mastergrid"] = "grid"; $layout->blocks["bare"][] = "mastergrid"; $page_layouts["app_users_masterprint"] = $layout; $showKeys = ""; if ($detailtable == "app.user_groups") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $xt->assign('showKeys', $showKeys); } if (!$where) { $strTableName = $oldTableName; return; } $str = SecuritySQL("Export"); if (strlen($str)) { $where .= " and " . $str; } $strWhere = whereAdd($masterQuery->m_where->toSql($masterQuery), $where); if (strlen($strWhere)) { $strWhere = " where " . $strWhere . " "; } $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql(); // $strSQL=AddWhere($strSQL,$where); LogInfo($strSQL); $rs = db_query($strSQL, $conn); $data = $cipherer->DecryptFetchedArray($rs); if (!$data) { $strTableName = $oldTableName; return; } $keylink = ""; $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"])); // userid - $xt->assign("userid_mastervalue", $viewControls->showDBValue("userid", $data, $keylink)); // nama - $xt->assign("nama_mastervalue", $viewControls->showDBValue("nama", $data, $keylink)); // created - Short Date $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink)); // disabled - $xt->assign("disabled_mastervalue", $viewControls->showDBValue("disabled", $data, $keylink)); // passwd - $xt->assign("passwd_mastervalue", $viewControls->showDBValue("passwd", $data, $keylink)); // id - $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink)); // kd_kantor - $xt->assign("kd_kantor_mastervalue", $viewControls->showDBValue("kd_kantor", $data, $keylink)); // kd_kanwil - $xt->assign("kd_kanwil_mastervalue", $viewControls->showDBValue("kd_kanwil", $data, $keylink)); // kd_tp - $xt->assign("kd_tp_mastervalue", $viewControls->showDBValue("kd_tp", $data, $keylink)); // kd_kanwil_bank - $xt->assign("kd_kanwil_bank_mastervalue", $viewControls->showDBValue("kd_kanwil_bank", $data, $keylink)); // kd_kppbb_bank - $xt->assign("kd_kppbb_bank_mastervalue", $viewControls->showDBValue("kd_kppbb_bank", $data, $keylink)); // kd_bank_tunggal - $xt->assign("kd_bank_tunggal_mastervalue", $viewControls->showDBValue("kd_bank_tunggal", $data, $keylink)); // kd_bank_persepsi - $xt->assign("kd_bank_persepsi_mastervalue", $viewControls->showDBValue("kd_bank_persepsi", $data, $keylink)); // nip - $xt->assign("nip_mastervalue", $viewControls->showDBValue("nip", $data, $keylink)); // jabatan - $xt->assign("jabatan_mastervalue", $viewControls->showDBValue("jabatan", $data, $keylink)); // handphone - $xt->assign("handphone_mastervalue", $viewControls->showDBValue("handphone", $data, $keylink)); // create_uid - $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink)); // update_uid - $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink)); // updated - Short Date $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink)); // last_login - Short Date $xt->assign("last_login_mastervalue", $viewControls->showDBValue("last_login", $data, $keylink)); // is_login - $xt->assign("is_login_mastervalue", $viewControls->showDBValue("is_login", $data, $keylink)); // is_logout - $xt->assign("is_logout_mastervalue", $viewControls->showDBValue("is_logout", $data, $keylink)); // last_ip - $xt->assign("last_ip_mastervalue", $viewControls->showDBValue("last_ip", $data, $keylink)); $xt->display("app_users_masterprint.htm"); $strTableName = $oldTableName; }
$xt->assign("row_count", $rowcount); if ($rowcount) { $xt->assign("details_data", true); $display_count = 10; if ($mode == "inline") { $display_count *= 2; } if ($rowcount > $display_count + 2) { $xt->assign("display_first", true); $xt->assign("display_count", $display_count); } else { $display_count = $rowcount; } $rowinfo = array(); require_once getabspath('classes/controls/ViewControlsContainer.php'); $pSet = new ProjectSettings($strTableName, PAGE_LIST); $viewContainer = new ViewControlsContainer($pSet, PAGE_LIST); $viewContainer->isDetailsPreview = true; $b = true; $qResult = $pageObject->connection->query($strSQL); $data = $cipherer->DecryptFetchedArray($qResult->fetchAssoc()); while ($data && $recordsCounter < $display_count) { $recordsCounter++; $row = array(); $keylink = ""; $keylink .= "&key1=" . runner_htmlspecialchars(rawurlencode(@$data["Groupid"])); // Groupid - $viewContainer->recId = $recordsCounter; $value = $viewContainer->showDBValue("Groupid", $data, $keylink); $row["Groupid_value"] = $value; $format = $pSet->getViewFormat("Groupid");
function DisplayMasterTableInfo_pad_pad_jenis_pajak($params) { $detailtable = $params["detailtable"]; $keys = $params["keys"]; global $conn, $strTableName; $xt = new Xtempl(); $oldTableName = $strTableName; $strTableName = "pad.pad_jenis_pajak"; //$strSQL = "SELECT id, usaha_id, nama, rekening_id, rekening_kd_sub, rekdenda_id, masapajak, jatuhtempo, multiple, jalan_kelas_id, tmt, enabled, created, create_uid, updated, update_uid FROM \"pad\".pad_jenis_pajak "; $cipherer = new RunnerCipherer($strTableName); $settings = new ProjectSettings($strTableName, PAGE_PRINT); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_PRINT); $where = ""; global $pageObject, $page_styles, $page_layouts, $page_layout_names, $container_styles; $layout = new TLayout("masterprint", "RoundedGreen", "MobileGreen"); $layout->blocks["bare"] = array(); $layout->containers["0"] = array(); $layout->containers["0"][] = array("name" => "masterprintheader", "block" => "", "substyle" => 1); $layout->skins["0"] = "empty"; $layout->blocks["bare"][] = "0"; $layout->containers["mastergrid"] = array(); $layout->containers["mastergrid"][] = array("name" => "masterprintfields", "block" => "", "substyle" => 1); $layout->skins["mastergrid"] = "grid"; $layout->blocks["bare"][] = "mastergrid"; $page_layouts["pad_pad_jenis_pajak_masterprint"] = $layout; $showKeys = ""; if ($detailtable == "pad.pad_spt") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $xt->assign('showKeys', $showKeys); } if ($detailtable == "pad.pad_tarif_pajak") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $where .= " and "; $showKeys .= " , "; $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[2 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[2 - 1]; $xt->assign('showKeys', $showKeys); } if ($detailtable == "pad.pad_terima_line") { $where .= GetFullFieldName("id", "", false) . "=" . $cipherer->MakeDBValue("id", $keys[1 - 1], "", "", true); $showKeys .= " " . "Id" . ": " . $keys[1 - 1]; $xt->assign('showKeys', $showKeys); } if (!$where) { $strTableName = $oldTableName; return; } $str = SecuritySQL("Export"); if (strlen($str)) { $where .= " and " . $str; } $strWhere = whereAdd($masterQuery->m_where->toSql($masterQuery), $where); if (strlen($strWhere)) { $strWhere = " where " . $strWhere . " "; } $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql(); // $strSQL=AddWhere($strSQL,$where); LogInfo($strSQL); $rs = db_query($strSQL, $conn); $data = $cipherer->DecryptFetchedArray($rs); if (!$data) { $strTableName = $oldTableName; return; } $keylink = ""; $keylink .= "&key1=" . htmlspecialchars(rawurlencode(@$data["id"])); // id - $xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink)); // usaha_id - $xt->assign("usaha_id_mastervalue", $viewControls->showDBValue("usaha_id", $data, $keylink)); // nama - $xt->assign("nama_mastervalue", $viewControls->showDBValue("nama", $data, $keylink)); // rekening_id - $xt->assign("rekening_id_mastervalue", $viewControls->showDBValue("rekening_id", $data, $keylink)); // rekening_kd_sub - $xt->assign("rekening_kd_sub_mastervalue", $viewControls->showDBValue("rekening_kd_sub", $data, $keylink)); // rekdenda_id - $xt->assign("rekdenda_id_mastervalue", $viewControls->showDBValue("rekdenda_id", $data, $keylink)); // masapajak - $xt->assign("masapajak_mastervalue", $viewControls->showDBValue("masapajak", $data, $keylink)); // jatuhtempo - $xt->assign("jatuhtempo_mastervalue", $viewControls->showDBValue("jatuhtempo", $data, $keylink)); // multiple - $xt->assign("multiple_mastervalue", $viewControls->showDBValue("multiple", $data, $keylink)); // jalan_kelas_id - $xt->assign("jalan_kelas_id_mastervalue", $viewControls->showDBValue("jalan_kelas_id", $data, $keylink)); // tmt - Short Date $xt->assign("tmt_mastervalue", $viewControls->showDBValue("tmt", $data, $keylink)); // enabled - $xt->assign("enabled_mastervalue", $viewControls->showDBValue("enabled", $data, $keylink)); // created - Short Date $xt->assign("created_mastervalue", $viewControls->showDBValue("created", $data, $keylink)); // create_uid - $xt->assign("create_uid_mastervalue", $viewControls->showDBValue("create_uid", $data, $keylink)); // updated - Short Date $xt->assign("updated_mastervalue", $viewControls->showDBValue("updated", $data, $keylink)); // update_uid - $xt->assign("update_uid_mastervalue", $viewControls->showDBValue("update_uid", $data, $keylink)); $xt->display("pad_pad_jenis_pajak_masterprint.htm"); $strTableName = $oldTableName; }
function Label($field, $table = "") { global $pageObject; if ($table != "" || !isset($pageObject)) { if ($table == "") { global $strTableName; $table = $strTableName; } $newSet = new ProjectSettings($table); $result = $newSet->label($field); } else { $result = $pageObject->pSet->label($field); } return $result != "" ? $result : $field; }
function getDashTableData($field, $key) { $dashSearchFields = $this->getDashboardSearchFields(); $tableSettings = new ProjectSettings($dashSearchFields[$field][0]["table"], $this->_editPage); return $tableSettings->getTableData($key); }
function GetType() { $pSet = new ProjectSettings($this->m_strTable); return $pSet->getFieldType($this->m_strName); }
$xt->assign("row_count", $rowcount); if ($rowcount) { $xt->assign("details_data", true); $display_count = 10; if ($mode == "inline") { $display_count *= 2; } if ($rowcount > $display_count + 2) { $xt->assign("display_first", true); $xt->assign("display_count", $display_count); } else { $display_count = $rowcount; } $rowinfo = array(); require_once getabspath('classes/controls/ViewControlsContainer.php'); $pSet = new ProjectSettings($strTableName, PAGE_LIST); $viewContainer = new ViewControlsContainer($pSet, PAGE_LIST); $viewContainer->isDetailsPreview = true; $b = true; $qResult = $pageObject->connection->query($strSQL); $data = $cipherer->DecryptFetchedArray($qResult->fetchAssoc()); while ($data && $recordsCounter < $display_count) { $recordsCounter++; $row = array(); $keylink = ""; $keylink .= "&key1=" . runner_htmlspecialchars(rawurlencode(@$data["Grp_id"])); $keylink .= "&key2=" . runner_htmlspecialchars(rawurlencode(@$data["StockCode"])); $keylink .= "&key3=" . runner_htmlspecialchars(rawurlencode(@$data["Coy_Id"])); // Grp_id - $viewContainer->recId = $recordsCounter; $value = $viewContainer->showDBValue("Grp_id", $data, $keylink);
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; $lookupOrderBy = $gSettings->getLookupOrderBy($f); $lwDisplayField = RunnerPage::sqlFormattedDisplayField($f, $lookupConnection, $gSettings); if ($lookupConnection->dbType == nDATABASE_MSSQLServer) { $strUniqueOrderBy = $lookupOrderBy; } if ($LookupType == LT_QUERY) { $lookupPSet = new ProjectSettings($lookupTable, $pageType); $lookupCipherer = new RunnerCipherer($lookupTable); $lookupQueryObj = $lookupPSet->getSQLQuery(); if ($gSettings->getCustomDisplay($f)) { $lookupQueryObj->AddCustomExpression($displayFieldName, $lookupPSet, $strTableName, $f); } $lookupQueryObj->ReplaceFieldsWithDummies($lookupPSet->getBinaryFieldsIndices()); } else { $LookupSQLTable = "SELECT "; $lwLinkField = $lookupConnection->addFieldWrappers($gSettings->getLinkField($f)); if ($gSettings->isLookupUnique($f)) { $LookupSQLTable .= "DISTINCT "; } $LookupSQLTable .= $cipherer->GetLookupFieldName($lwLinkField, $f, null, true); if ($lookupConnection->dbType == nDATABASE_MSSQLServer) { if ($strUniqueOrderBy && $gSettings->isLookupUnique($f)) {
/** * @param String field * @param String id (optional) * @param Array extraParmas (optional) * @return Control */ function getControl($field, $id = "", $extraParmas = array()) { if (count($extraParmas) && $extraParmas["getDetKeyReadOnlyCtrl"]) { include_once getabspath("classes/controls/Control.php"); $cTypes = new ControlTypes(); $className = $cTypes->forEdit[EDIT_FORMAT_READONLY]; $ctrl = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection); $ctrl->container = $this; return $ctrl; } if (count($extraParmas) && $extraParmas["getConrirmFieldCtrl"]) { include_once getabspath("classes/controls/Control.php"); $cTypes = new ControlTypes(); $className = $cTypes->forEdit[EDIT_FORMAT_PASSWORD]; $ctrl = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection); if ($extraParmas['isConfirm']) { $ctrl->field = GetPasswordField(); } $ctrl->container = $this; return $ctrl; } // if conrol does not created previously if (!array_key_exists($field, $this->controls)) { include_once getabspath("classes/controls/Control.php"); $userControl = false; $cTypes = new ControlTypes(); $editFormat = $this->pSetEdit->getEditFormat($field); if ($editFormat == EDIT_FORMAT_TEXT_FIELD && IsDateFieldType($this->pSetEdit->getFieldType($field))) { $editFormat = EDIT_FORMAT_DATE; } if ($this->pageType == PAGE_SEARCH || $this->pageType == PAGE_LIST) { // Text field may be Lookup field on some page $pageTypebyLookupFormat = $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD); if ($editFormat == EDIT_FORMAT_TEXT_FIELD && $pageTypebyLookupFormat != "") { $localPSet = new ProjectSettings($this->pSetEdit->_table, $pageTypebyLookupFormat); if ($localPSet->getLinkField($field) != $localPSet->getDisplayField($field)) { $className = "LookupTextField"; } else { $className = $cTypes->forSearch[$editFormat]; } } else { $className = $cTypes->forSearch[$editFormat]; } } else { $className = $cTypes->forEdit[$editFormat]; } if ($className == $cTypes->forEdit[EDIT_FORMAT_FILE] && $this->pSetEdit->isBasicUploadUsed($field)) { $className = "FileFieldSingle"; } if (!$className) { if ($editFormat != "") { $className = "Edit" . $editFormat; $userControl = true; include_once getabspath("classes/controls/UserControl.php"); if (!is_null($this->pageObject)) { $this->pageObject->AddJSFile("include/runnerJS/controls/" . $className . ".js", "include/runnerJS/Control.js"); } } else { $className = $cTypes->forEdit[EDIT_FORMAT_TEXT_FIELD]; } } $this->controls[$field] = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id, $this->connection); $this->controls[$field]->container = $this; if ($userControl) { $this->controls[$field]->format = $className; $this->controls[$field]->initUserControl(); } } if ($id !== "") { $this->controls[$field]->setID($id); } return $this->controls[$field]; }
require_once "classes/controls/ViewControlsContainer.php"; $mode = postvalue("mode"); $table = postvalue("table"); $field = postvalue("field"); $pageType = postvalue('pagetype'); $mainTable = postvalue("maintable"); $mainField = postvalue("mainfield"); $lookup = false; if ($mainTable && $mainField) { $lookup = true; } if (!checkTableName($table)) { exit(0); } require_once "include/" . $table . "_variables.php"; $pSet = new ProjectSettings(GetTableByShort($table), $pageType); $cipherer = new RunnerCipherer(GetTableByShort($table), $pSet); $_connection = $cman->byTable($strTableName); if (!$pSet->checkFieldPermissions($field)) { $returnJSON = array("success" => false, "error" => 'Error: You have not permission for read this text'); echo printJSON($returnJSON); return; } if (!$gQuery->HasGroupBy()) { // Do not select any fields except current (full text) field. // If query has 'group by' clause then other fields are used in it and we may not simply cut 'em off. // Just don't do anything in that case. $gQuery->RemoveAllFieldsExcept($pSet->getFieldIndex($field)); } $keysArr = $pSet->getTableKeys(); $keys = array();
/** * 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; }
/** * Set the chart xt variable */ public function assignChartElement() { //set params for the 'xt_showchart' method showing the chart $chartXtParams = array("id" => $this->id, "table" => $this->tName, "ctype" => $this->pSet->getChartType(), "resize" => $this->mode !== CHART_SIMPLE && $this->mode != CHART_DASHBOARD, "chartname" => $this->shortTableName, "chartPreview" => $this->mode !== CHART_SIMPLE && $this->mode != CHART_DASHBOARD); if ($this->mode == CHART_DASHBOARD) { $dashSet = new ProjectSettings($this->dashTName); $dashElementData = $dashSet->getDashboardElementData($this->dashElementName); if (isset($dashElementData["width"]) || isset($dashElementData["height"])) { $chartXtParams["dashResize"] = true; $chartXtParams["dashWidth"] = $dashElementData["width"]; $chartXtParams["dashHeight"] = $dashElementData["height"]; } $chartXtParams["dash"] = true; $chartXtParams["dashTName"] = $this->dashTName; $chartXtParams["dashElementName"] = $this->dashElementName; } $this->xt->assign_function($this->shortTableName . "_chart", "xt_showchart", $chartXtParams); }
$pageType = postvalue("pageType"); $fieldName = postvalue("fieldName"); $fieldControlType = postvalue("fieldControlType"); $value = postvalue("value"); if (!checkTableName($tableName)) { exit(0); } require_once "include/" . $tableName . "_variables.php"; if ($pageType != PAGE_REGISTER && (!isLogged() || !CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Search"))) { $returnJSON = array("success" => false, "error" => "Error: You have not permissions to read the " . $tableName . " table's data"); echo printJSON($returnJSON); return; } // set db connection $_connection = $cman->byTable($strTableName); $pSet = new ProjectSettings($strTableName, $pageType); $denyChecking = $pSet->allowDuplicateValues($fieldName); $denyChecking = $denyChecking && ($strTableName != "DashboardUsers" || $fieldName != $cUserNameField && $fieldName != $cEmailField); if ($denyChecking) { $returnJSON = array("success" => false, "error" => "Duplicated values are allowed"); echo printJSON($returnJSON); return; } $cipherer = new RunnerCipherer($strTableName, $pSet); if ($cipherer->isFieldEncrypted($fieldName)) { $value = $cipherer->MakeDBValue($fieldName, $value, $fieldControlType, true); } else { $value = make_db_value($fieldName, $value, $fieldControlType, "", $strTableName); } if ($value == "null") { $fieldSQL = RunnerPage::_getFieldSQL($fieldName, $_connection, $pSet);
} require_once "include/" . $table . "_variables.php"; $searchFor = postvalue('searchFor'); // if nothing to search if ($searchFor == '') { echo printJSON(array('success' => true, 'result' => '')); return; } $_connection = $cman->byTable($strTableName); // array of vals $response = array(); $searchOpt = postvalue("start") ? "Starts with" : "Contains"; $searchField = GoodFieldName(postvalue('searchField')); $strSecuritySql = SecuritySQL("Search", $strTableName); $numberOfSuggests = GetGlobalData("searchSuggestsNumber", 10); $pSet = new ProjectSettings($strTableName, PAGE_SEARCH); if ($searchField == "") { $allSearchFields = $pSet->getGoogleLikeFields(); } else { // array of fields which were added in wizard for search $allSearchFields = $pSet->getAllSearchFields(); } require_once getabspath('classes/controls/EditControlsContainer.php'); $detailKeys = array(); $masterWhere = ""; $cipherer = new RunnerCipherer($strTableName); $controls = new EditControlsContainer(null, $pSet, PAGE_LIST, $cipherer); if (@$_SESSION[$strTableName . "_mastertable"] != "") { $masterTablesInfoArr = $pSet->getMasterTablesArr($strTableName); for ($i = 0; $i < count($masterTablesInfoArr); $i++) { if ($_SESSION[$strTableName . "_mastertable"] != $masterTablesInfoArr[$i]['mDataSourceTable']) {
function LogDelete($str_table, $values, $keys) { global $globalEvents; $retval = true; $table = $str_table; $pSet = new ProjectSettings($str_table); $arr = array(); if ($globalEvents->exists("OnAuditLog")) { $retval = $globalEvents->OnAuditLog($this->strDelete, $this->params, $table, $keys, $values, $arr); } if ($retval) { if (count($keys) > 0) { $key = ""; foreach ($keys as $idx => $val) { if ($key != "") { $key .= ","; } $key .= $val; } } $fp = $this->CreateLogFile(); $str = format_datetime_custom(db2time(now()), "MMM dd,yyyy") . chr(9) . format_datetime_custom(db2time(now()), "HH:mm:ss") . chr(9) . $this->params[0] . chr(9) . $this->params[1] . chr(9) . $table . chr(9) . $this->strDelete . chr(9) . $key; $str_add = ""; if ($this->logValueEnable($str_table)) { foreach ($values as $idx => $val) { $v = ""; if (IsBinaryType($pSet->getFieldType($idx))) { $v = "<binary value>"; } else { $v = str_replace(array("\r\n", "\n", "\t"), " ", $val); if (strlen($v) > $this->maxFieldLength) { $v = substr($v, 0, $this->maxFieldLength); } } if ($fp) { $str_add .= $str . chr(9) . $idx . chr(9) . $v . "\r\n"; } } } else { $str_add = $str . "\r\n"; } if ($fp) { fputs($fp, $str_add); fclose($fp); } } return $retval; }
function DisplayMasterTableInfo_GE_ESTADO_CIVIL($params) { global $cman; $detailtable = $params["detailtable"]; $keys = $params["keys"]; $xt = new Xtempl(); $tName = "GE.ESTADO_CIVIL"; $settings = new ProjectSettings($tName, PAGE_LIST); $cipherer = new RunnerCipherer($tName); $connection = $cman->byTable($tName); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_LIST); $where = ""; $keysAssoc = array(); $showKeys = ""; if ($detailtable == "GE.PERSONA_DISPONIBLE") { $keysAssoc["ESTADO_CIVIL_ID"] = $keys[1 - 1]; $where .= RunnerPage::_getFieldSQLDecrypt("ESTADO_CIVIL_ID", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("ESTADO_CIVIL_ID", $keys[1 - 1], "", true); $keyValue = $viewControls->showDBValue("ESTADO_CIVIL_ID", $keysAssoc); $showKeys .= " " . GetFieldLabel("GE_ESTADO_CIVIL", "ESTADO_CIVIL_ID") . ": " . $keyValue; $xt->assign('showKeys', $showKeys); } if (!$where) { return; } $str = SecuritySQL("Search"); if (strlen($str)) { $where .= " and " . $str; } $strWhere = whereAdd($masterQuery->WhereToSql(), $where); if (strlen($strWhere)) { $strWhere = " where " . $strWhere . " "; } $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql(); LogInfo($strSQL); $data = $cipherer->DecryptFetchedArray($connection->query($strSQL)->fetchAssoc()); if (!$data) { return; } // reassign pagetitlelabel function adding extra params $xt->assign_function("pagetitlelabel", "xt_pagetitlelabel", array("record" => $data, "settings" => $settings)); $keylink = ""; $keylink .= "&key1=" . runner_htmlspecialchars(rawurlencode(@$data["ESTADO_CIVIL_ID"])); $xt->assign("ESTADO_CIVIL_ID_mastervalue", $viewControls->showDBValue("ESTADO_CIVIL_ID", $data, $keylink)); $format = $settings->getViewFormat("ESTADO_CIVIL_ID"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("ESTADO_CIVIL_ID"))) { $class = ' rnr-field-number'; } $xt->assign("ESTADO_CIVIL_ID_class", $class); // add class for field header as field value $xt->assign("NOMBRE_mastervalue", $viewControls->showDBValue("NOMBRE", $data, $keylink)); $format = $settings->getViewFormat("NOMBRE"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("NOMBRE"))) { $class = ' rnr-field-number'; } $xt->assign("NOMBRE_class", $class); // add class for field header as field value $xt->assign("FEC_CREACION_mastervalue", $viewControls->showDBValue("FEC_CREACION", $data, $keylink)); $format = $settings->getViewFormat("FEC_CREACION"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("FEC_CREACION"))) { $class = ' rnr-field-number'; } $xt->assign("FEC_CREACION_class", $class); // add class for field header as field value $xt->assign("USUARIO_CREACION_mastervalue", $viewControls->showDBValue("USUARIO_CREACION", $data, $keylink)); $format = $settings->getViewFormat("USUARIO_CREACION"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("USUARIO_CREACION"))) { $class = ' rnr-field-number'; } $xt->assign("USUARIO_CREACION_class", $class); // add class for field header as field value $xt->assign("FEC_ULTIMA_MOD_mastervalue", $viewControls->showDBValue("FEC_ULTIMA_MOD", $data, $keylink)); $format = $settings->getViewFormat("FEC_ULTIMA_MOD"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("FEC_ULTIMA_MOD"))) { $class = ' rnr-field-number'; } $xt->assign("FEC_ULTIMA_MOD_class", $class); // add class for field header as field value $xt->assign("USUARIO_ULTIMA_MOD_mastervalue", $viewControls->showDBValue("USUARIO_ULTIMA_MOD", $data, $keylink)); $format = $settings->getViewFormat("USUARIO_ULTIMA_MOD"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("USUARIO_ULTIMA_MOD"))) { $class = ' rnr-field-number'; } $xt->assign("USUARIO_ULTIMA_MOD_class", $class); // add class for field header as field value $layout = GetPageLayout("GE_ESTADO_CIVIL", 'masterlist'); if ($layout) { $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"'); } $xt->displayPartial(GetTemplateName("GE_ESTADO_CIVIL", "masterlist")); }
function update_report_totals() { $root =& $_SESSION["webreports"]; // ensure all fields in reports are listed in the tables $tables = getReportTablesList(); if (is_wr_custom()) { $fields = WRGetFieldsList(''); } $arr_unset = array(); foreach ($root["totals"] as $idx => $fld) { if (array_search($fld["table"], $tables) !== false || is_null($fld["table"]) && is_wr_custom()) { if (!is_wr_custom()) { $fields = WRGetFieldsList($fld["table"]); } if (array_search($fld["name"], $fields) !== false) { continue; } } // remove $total if found $arr_unset[] = $idx; } foreach ($arr_unset as $idx => $fld) { unset($root["totals"][$fld]); } // ensure all fields appear in the totals $all_fields = array(); foreach ($tables as $t) { $fields = WRGetFieldsList($t); foreach ($fields as $f) { if (is_wr_db()) { $all_fields[] = $t . "." . $f; } else { $all_fields[] = $f; } } } // ensure all series fields appear in the totals foreach ($all_fields as $fieldItem) { $f = $fieldItem; $table = ""; $fld = ""; if (is_wr_db()) { WRSplitFieldName($f, $table, $fld); } else { $table = $tables[0]; $fld = $f; $f = $table . "_" . $f; } if (array_key_exists(GoodFieldName($f), $root["totals"])) { continue; } $pSet = new ProjectSettings($table, PAGE_LIST); $root['totals'][GoodFieldName($f)] = array(); $root['totals'][GoodFieldName($f)]["name"] = $fld; $root['totals'][GoodFieldName($f)]["table"] = $table; $root['totals'][GoodFieldName($f)]["label"] = $pSet->label($fld); $root['totals'][GoodFieldName($f)]["show"] = "true"; $root['totals'][GoodFieldName($f)]["min"] = "false"; $root['totals'][GoodFieldName($f)]["max"] = "false"; $root['totals'][GoodFieldName($f)]["sum"] = "false"; $root['totals'][GoodFieldName($f)]["avg"] = "false"; $root['totals'][GoodFieldName($f)]["curr"] = "false"; $root['totals'][GoodFieldName($f)]["search"] = ""; $root['totals'][GoodFieldName($f)]["view_format"] = GetGenericViewFormat($table, $fld); $root['totals'][GoodFieldName($f)]["edit_format"] = GetGenericEditFormat($table, $fld); $root['totals'][GoodFieldName($f)]["display_field"] = $pSet->getDisplayField($fld); $root['totals'][GoodFieldName($f)]["linkfield"] = $pSet->getLinkField($fld); $root['totals'][GoodFieldName($f)]["show_thumbnail"] = $pSet->showThumbnail($fld); $root['totals'][GoodFieldName($f)]["need_encode"] = $pSet->NeedEncode($fld); $root['totals'][GoodFieldName($f)]["thumbnail"] = $pSet->getStrThumbnail($fld); $root['totals'][GoodFieldName($f)]["listformatobj_imgwidth"] = $pSet->getImageWidth($fld); $root['totals'][GoodFieldName($f)]["listformatobj_imgheight"] = $pSet->getImageHeight($fld); $root['totals'][GoodFieldName($f)]["hlprefix"] = $pSet->getLinkPrefix($fld); $root['totals'][GoodFieldName($f)]["listformatobj_filename"] = $pSet->getFilenameField($fld); $root['totals'][GoodFieldName($f)]["lookupobj_lookuptype"] = $pSet->getLookupType($fld); $root['totals'][GoodFieldName($f)]["editformatobj_lookupobj_customdispaly"] = $pSet->getDisplayField($fld); $root['totals'][GoodFieldName($f)]["editformatobj_lookupobj_table"] = $pSet->getLookupTable($fld); $root['totals'][GoodFieldName($f)]["editformatobj_lookupobj_where"] = GetLWWhere($fld, PAGE_REPORT); } $_SESSION["webreports"] = $root; }
function DisplayMasterTableInfo_BranchMaster($params) { global $cman; $detailtable = $params["detailtable"]; $keys = $params["keys"]; $xt = new Xtempl(); $tName = "BranchMaster"; $xt->eventsObject = getEventObject($tName); $settings = new ProjectSettings($tName, PAGE_LIST); $cipherer = new RunnerCipherer($tName); $connection = $cman->byTable($tName); $masterQuery = $settings->getSQLQuery(); $viewControls = new ViewControlsContainer($settings, PAGE_LIST); $where = ""; $keysAssoc = array(); $showKeys = ""; if ($detailtable == "Fact_SalesTransaction") { $keysAssoc["GroupID"] = $keys[1 - 1]; $keysAssoc["CompanyID"] = $keys[2 - 1]; $where .= RunnerPage::_getFieldSQLDecrypt("GroupID", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("GroupID", $keys[1 - 1], "", true); $keyValue = $viewControls->showDBValue("GroupID", $keysAssoc); $showKeys .= " " . GetFieldLabel("BranchMaster", "GroupID") . ": " . $keyValue; $where .= " and "; $showKeys .= " , "; $where .= RunnerPage::_getFieldSQLDecrypt("CompanyID", $connection, $settings, $cipherer) . "=" . $cipherer->MakeDBValue("CompanyID", $keys[2 - 1], "", true); $keyValue = $viewControls->showDBValue("CompanyID", $keysAssoc); $showKeys .= " " . GetFieldLabel("BranchMaster", "CompanyID") . ": " . $keyValue; $xt->assign('showKeys', $showKeys); } if (!$where) { return; } $str = SecuritySQL("Search", $tName); if (strlen($str)) { $where .= " and " . $str; } $strWhere = whereAdd($masterQuery->WhereToSql(), $where); if (strlen($strWhere)) { $strWhere = " where " . $strWhere . " "; } $strSQL = $masterQuery->HeadToSql() . ' ' . $masterQuery->FromToSql() . $strWhere . $masterQuery->TailToSql(); LogInfo($strSQL); $data = $cipherer->DecryptFetchedArray($connection->query($strSQL)->fetchAssoc()); if (!$data) { return; } // reassign pagetitlelabel function adding extra params $xt->assign_function("pagetitlelabel", "xt_pagetitlelabel", array("record" => $data, "settings" => $settings)); $keylink = ""; $xt->assign("BranchCloudFolder_mastervalue", $viewControls->showDBValue("BranchCloudFolder", $data, $keylink)); $format = $settings->getViewFormat("BranchCloudFolder"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("BranchCloudFolder"))) { $class = ' rnr-field-number'; } $xt->assign("BranchCloudFolder_class", $class); // add class for field header as field value $xt->assign("BranchLastSyncDate_mastervalue", $viewControls->showDBValue("BranchLastSyncDate", $data, $keylink)); $format = $settings->getViewFormat("BranchLastSyncDate"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("BranchLastSyncDate"))) { $class = ' rnr-field-number'; } $xt->assign("BranchLastSyncDate_class", $class); // add class for field header as field value $xt->assign("l_mastervalue", $viewControls->showDBValue("l", $data, $keylink)); $format = $settings->getViewFormat("l"); $class = " rnr-field-text"; if ($format == FORMAT_FILE) { $class = ' rnr-field-file'; } if ($format == FORMAT_AUDIO) { $class = ' rnr-field-audio'; } if ($format == FORMAT_CHECKBOX) { $class = ' rnr-field-checkbox'; } if ($format == FORMAT_NUMBER || IsNumberType($settings->getFieldType("l"))) { $class = ' rnr-field-number'; } $xt->assign("l_class", $class); // add class for field header as field value $layout = GetPageLayout("BranchMaster", 'masterlist'); if ($layout) { $xt->assign("pageattrs", 'class="' . $layout->style . " page-" . $layout->name . '"'); } $xt->displayPartial(GetTemplateName("BranchMaster", "masterlist")); }
function getControl($field, $id = "") { // if conrol does not created previously if(!array_key_exists($field, $this->controls)) { include_once(getabspath("classes/controls/Control.php")); $userControl = false; $cTypes = new ControlTypes(); $editFormat = $this->pSetEdit->getEditFormat($field); if($editFormat == EDIT_FORMAT_TEXT_FIELD && IsDateFieldType($this->pSetEdit->getFieldType($field))) $editFormat = EDIT_FORMAT_DATE; if($this->pageType == PAGE_SEARCH || $this->pageType == PAGE_LIST) { // Text field may be Lookup field on some page if($editFormat == EDIT_FORMAT_TEXT_FIELD && $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD) != "") { $localPSet = new ProjectSettings($this->pSetEdit->_table, $this->pSetEdit->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD)); if($localPSet->getLWLinkField($field) != $localPSet->getLWDisplayField($field)) $className = "LookupTextField"; else $className = $cTypes->forSearch[$editFormat]; } else $className = $cTypes->forSearch[$editFormat]; } else $className = $cTypes->forEdit[$editFormat]; if(!$className) { if($editFormat != "") { $className = "Edit".$editFormat; $userControl = true; include_once(getabspath("classes/controls/UserControl.php")); if(!is_null($this->pageObject)) $this->pageObject->AddJSFile("include/runnerJS/controls/".$className.".js", "include/runnerJS/Control.js"); } else $className = $cTypes->forEdit[EDIT_FORMAT_TEXT_FIELD]; } else if($className == $cTypes->forEdit[EDIT_FORMAT_FILE] && $this->pSetEdit->isCompatibilityMode($field)) $className = "FileFieldSingle"; $this->controls[$field] = createControlClass($className, $field, $this->pageObject != null ? $this->pageObject : $this, $id); $this->controls[$field]->container = $this; if($userControl) { $this->controls[$field]->format = $className; $this->controls[$field]->initUserControl(); } } if($id !== "") $this->controls[$field]->setID($id); return $this->controls[$field]; }
<?php $strTableName = "company"; $_SESSION["OwnerID"] = $_SESSION["_" . $strTableName . "_OwnerID"]; $strOriginalTableName = "company"; $gstrOrderBy = ""; if (strlen($gstrOrderBy) && strtolower(substr($gstrOrderBy, 0, 8)) != "order by") { $gstrOrderBy = "order by " . $gstrOrderBy; } // alias for 'SQLQuery' object $gSettings = new ProjectSettings("company"); $gQuery = $gSettings->getSQLQuery(); $eventObj =& $tableEvents["company"]; $reportCaseSensitiveGroupFields = false; $gstrSQL = $gQuery->gSQLWhere("");
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 if (!@$_SESSION["UserID"]) { $_SESSION["MyURL"] = $_SERVER["SCRIPT_NAME"] . "?" . $_SERVER["QUERY_STRING"];