TableVar = 'vhouseholders'; $this->TableName = 'vhouseholders'; $this->TableType = 'VIEW'; // Update Table $this->UpdateTable = "`vhouseholders`"; $this->DBID = 'DB'; $this->ExportAll = TRUE; $this->ExportPageBreakCount = 0; // Page break per every n record (PDF only) $this->ExportPageOrientation = "portrait"; // Page orientation (PDF only) $this->ExportPageSize = "a4"; // Page size (PDF only) $this->ExportExcelPageOrientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; // Page orientation (PHPExcel only) $this->ExportExcelPageSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4; // Page size (PHPExcel only) $this->DetailAdd = FALSE; // Allow detail add $this->DetailEdit = FALSE; // Allow detail edit $this->DetailView = FALSE; // Allow detail view $this->ShowMultipleDetails = FALSE; // Show multiple details $this->GridAddRowCount = 5; $this->AllowAddDeleteRow = ew_AllowAddDeleteRow(); // Allow add/delete row $this->UserIDAllowSecurity = 0; // User ID Allow $this->BasicSearch = new cBasicSearch($this->TableVar); // idSeeker $this->idSeeker = new cField('vhouseholders', 'vhouseholders', 'x_idSeeker', 'idSeeker', '`idSeeker`', '`idSeeker`', 19, -1, FALSE, '`idSeeker`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'NO'); $this->idSeeker->Sortable = TRUE; // Allow sort $this->idSeeker->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger"); $this->fields['idSeeker'] = &$this->idSeeker; // Name $this->Name = new cField('vhouseholders', 'vhouseholders', 'x_Name', 'Name', '`Name`', '`Name`', 200, -1, FALSE, '`Name`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->Name->Sortable = TRUE; // Allow sort $this->fields['Name'] = &$this->Name; // Surname $this->Surname = new cField('vhouseholders', 'vhouseholders', 'x_Surname', 'Surname', '`Surname`', '`Surname`', 200, -1, FALSE, '`Surname`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->Surname->Sortable = TRUE; // Allow sort $this->fields['Surname'] = &$this->Surname; // BirthDate $this->BirthDate = new cField('vhouseholders', 'vhouseholders', 'x_BirthDate', 'BirthDate', '`BirthDate`', ew_CastDateFieldForLike('`BirthDate`', 0, "DB"), 133, 0, FALSE, '`BirthDate`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->BirthDate->Sortable = TRUE; // Allow sort $this->BirthDate->FldDefaultErrMsg = str_replace("%s", $GLOBALS["EW_DATE_FORMAT"], $Language->Phrase("IncorrectDate")); $this->fields['BirthDate'] = &$this->BirthDate; // BirthPlace $this->BirthPlace = new cField('vhouseholders', 'vhouseholders', 'x_BirthPlace', 'BirthPlace', '`BirthPlace`', '`BirthPlace`', 200, -1, FALSE, '`BirthPlace`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->BirthPlace->Sortable = TRUE; // Allow sort $this->fields['BirthPlace'] = &$this->BirthPlace; // Nationality $this->Nationality = new cField('vhouseholders', 'vhouseholders', 'x_Nationality', 'Nationality', '`Nationality`', '`Nationality`', 200, -1, FALSE, '`EV__Nationality`', TRUE, FALSE, TRUE, 'FORMATTED TEXT', 'TEXT'); $this->Nationality->Sortable = TRUE; // Allow sort $this->fields['Nationality'] = &$this->Nationality; // Citizenship $this->Citizenship = new cField('vhouseholders', 'vhouseholders', 'x_Citizenship', 'Citizenship', '`Citizenship`', '`Citizenship`', 200, -1, FALSE, '`EV__Citizenship`', TRUE, FALSE, TRUE, 'FORMATTED TEXT', 'TEXT'); $this->Citizenship->Sortable = TRUE; // Allow sort $this->fields['Citizenship'] = &$this->Citizenship; // Sex $this->Sex = new cField('vhouseholders', 'vhouseholders', 'x_Sex', 'Sex', '`Sex`', '`Sex`', 200, -1, FALSE, '`Sex`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'SELECT'); $this->Sex->Sortable = TRUE; // Allow sort $this->Sex->UsePleaseSelect = TRUE; // Use PleaseSelect by default $this->Sex->PleaseSelectText = $Language->Phrase("PleaseSelect"); // PleaseSelect text $this->Sex->OptionCount = 2; $this->fields['Sex'] = &$this->Sex; // Phone $this->Phone = new cField('vhouseholders', 'vhouseholders', 'x_Phone', 'Phone', '`Phone`', '`Phone`', 200, -1, FALSE, '`Phone`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->Phone->Sortable = TRUE; // Allow sort $this->fields['Phone'] = &$this->Phone; // Email $this->_Email = new cField('vhouseholders', 'vhouseholders', 'x__Email', 'Email', '`Email`', '`Email`', 200, -1, FALSE, '`Email`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->_Email->Sortable = TRUE; // Allow sort $this->fields['Email'] = &$this->_Email; // Place_of_Residence $this->Place_of_Residence = new cField('vhouseholders', 'vhouseholders', 'x_Place_of_Residence', 'Place_of_Residence', '`Place_of_Residence`', '`Place_of_Residence`', 200, -1, FALSE, '`EV__Place_of_Residence`', TRUE, FALSE, TRUE, 'FORMATTED TEXT', 'TEXT'); $this->Place_of_Residence->Sortable = TRUE; // Allow sort $this->fields['Place_of_Residence'] = &$this->Place_of_Residence; // Address_of_Residence $this->Address_of_Residence = new cField('vhouseholders', 'vhouseholders', 'x_Address_of_Residence', 'Address_of_Residence', '`Address_of_Residence`', '`Address_of_Residence`', 200, -1, FALSE, '`Address_of_Residence`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->Address_of_Residence->Sortable = TRUE; // Allow sort $this->fields['Address_of_Residence'] = &$this->Address_of_Residence; // Town_of_residence $this->Town_of_residence = new cField('vhouseholders', 'vhouseholders', 'x_Town_of_residence', 'Town_of_residence', '`Town_of_residence`', '`Town_of_residence`', 200, -1, FALSE, '`Town_of_residence`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->Town_of_residence->Sortable = TRUE; // Allow sort $this->fields['Town_of_residence'] = &$this->Town_of_residence; // Place_of_Transit $this->Place_of_Transit = new cField('vhouseholders', 'vhouseholders', 'x_Place_of_Transit', 'Place_of_Transit', '`Place_of_Transit`', '`Place_of_Transit`', 200, -1, FALSE, '`EV__Place_of_Transit`', TRUE, FALSE, TRUE, 'FORMATTED TEXT', 'TEXT'); $this->Place_of_Transit->Sortable = TRUE; // Allow sort $this->fields['Place_of_Transit'] = &$this->Place_of_Transit; // Address_of_Transit $this->Address_of_Transit = new cField('vhouseholders', 'vhouseholders', 'x_Address_of_Transit', 'Address_of_Transit', '`Address_of_Transit`', '`Address_of_Transit`', 200, -1, FALSE, '`Address_of_Transit`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->Address_of_Transit->Sortable = TRUE; // Allow sort $this->fields['Address_of_Transit'] = &$this->Address_of_Transit; // Town_of_transit $this->Town_of_transit = new cField('vhouseholders', 'vhouseholders', 'x_Town_of_transit', 'Town_of_transit', '`Town_of_transit`', '`Town_of_transit`', 200, -1, FALSE, '`Town_of_transit`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'TEXT'); $this->Town_of_transit->Sortable = TRUE; // Allow sort $this->fields['Town_of_transit'] = &$this->Town_of_transit; // Householder $this->Householder = new cField('vhouseholders', 'vhouseholders', 'x_Householder', 'Householder', '`Householder`', '`Householder`', 202, -1, FALSE, '`Householder`', FALSE, FALSE, FALSE, 'FORMATTED TEXT', 'RADIO'); $this->Householder->Sortable = TRUE; // Allow sort $this->Householder->FldDataType = EW_DATATYPE_BOOLEAN; $this->Householder->TrueValue = 'Y'; $this->Householder->FalseValue = 'N'; $this->Householder->OptionCount = 2; $this->fields['Householder'] = &$this->Householder; } // Set Field Visibility function SetFieldVisibility($fldparm) { global $Security; return $this->$fldparm->Visible; // Returns original value } // Single column sort function UpdateSort(&$ofld) { if ($this->CurrentOrder == $ofld->FldName) { $sSortField = $ofld->FldExpression; $sLastSort = $ofld->getSort(); if ($this->CurrentOrderType == "ASC" || $this->CurrentOrderType == "DESC") { $sThisSort = $this->CurrentOrderType; } else { $sThisSort = ($sLastSort == "ASC") ? "DESC" : "ASC"; } $ofld->setSort($sThisSort); $this->setSessionOrderBy($sSortField . " " . $sThisSort); // Save to Session $sSortFieldList = ($ofld->FldVirtualExpression <> "") ? $ofld->FldVirtualExpression : $sSortField; $this->setSessionOrderByList($sSortFieldList . " " . $sThisSort); // Save to Session } else { $ofld->setSort(""); } } // Session ORDER BY for List page function getSessionOrderByList() { return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_ORDER_BY_LIST]; } function setSessionOrderByList($v) { $_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_ORDER_BY_LIST] = $v; } // Table level SQL var $_SqlFrom = ""; function getSqlFrom() { // From return ($this->_SqlFrom <> "") ? $this->_SqlFrom : "`vhouseholders`"; } function SqlFrom() { // For backward compatibility return $this->getSqlFrom(); } function setSqlFrom($v) { $this->_SqlFrom = $v; } var $_SqlSelect = ""; function getSqlSelect() { // Select return ($this->_SqlSelect <> "") ? $this->_SqlSelect : "SELECT * FROM " . $this->getSqlFrom(); } function SqlSelect() { // For backward compatibility return $this->getSqlSelect(); } function setSqlSelect($v) { $this->_SqlSelect = $v; } var $_SqlSelectList = ""; function getSqlSelectList() { // Select for List page $select = ""; global $gsLanguage; switch ($gsLanguage) { case "it": $select = "SELECT * FROM (" . "SELECT *, (SELECT `desc_it` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Nationality` LIMIT 1) AS `EV__Nationality`, (SELECT `desc_it` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Citizenship` LIMIT 1) AS `EV__Citizenship`, (SELECT `desc_it` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Place_of_Residence` LIMIT 1) AS `EV__Place_of_Residence`, (SELECT `desc_it` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Place_of_Transit` LIMIT 1) AS `EV__Place_of_Transit` FROM `vhouseholders`" . ") `EW_TMP_TABLE`"; break; default: $select = "SELECT * FROM (" . "SELECT *, (SELECT `desc_en` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Nationality` LIMIT 1) AS `EV__Nationality`, (SELECT `desc_en` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Citizenship` LIMIT 1) AS `EV__Citizenship`, (SELECT `desc_en` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Place_of_Residence` LIMIT 1) AS `EV__Place_of_Residence`, (SELECT `desc_en` FROM `tnations` `EW_TMP_LOOKUPTABLE` WHERE `EW_TMP_LOOKUPTABLE`.`id_nation` = `vhouseholders`.`Place_of_Transit` LIMIT 1) AS `EV__Place_of_Transit` FROM `vhouseholders`" . ") `EW_TMP_TABLE`"; break; } return ($this->_SqlSelectList <> "") ? $this->_SqlSelectList : $select; } function SqlSelectList() { // For backward compatibility return $this->getSqlSelectList(); } function setSqlSelectList($v) { $this->_SqlSelectList = $v; } var $_SqlWhere = ""; function getSqlWhere() { // Where $sWhere = ($this->_SqlWhere <> "") ? $this->_SqlWhere : ""; $this->TableFilter = ""; ew_AddFilter($sWhere, $this->TableFilter); return $sWhere; } function SqlWhere() { // For backward compatibility return $this->getSqlWhere(); } function setSqlWhere($v) { $this->_SqlWhere = $v; } var $_SqlGroupBy = ""; function getSqlGroupBy() { // Group By return ($this->_SqlGroupBy <> "") ? $this->_SqlGroupBy : ""; } function SqlGroupBy() { // For backward compatibility return $this->getSqlGroupBy(); } function setSqlGroupBy($v) { $this->_SqlGroupBy = $v; } var $_SqlHaving = ""; function getSqlHaving() { // Having return ($this->_SqlHaving <> "") ? $this->_SqlHaving : ""; } function SqlHaving() { // For backward compatibility return $this->getSqlHaving(); } function setSqlHaving($v) { $this->_SqlHaving = $v; } var $_SqlOrderBy = ""; function getSqlOrderBy() { // Order By return ($this->_SqlOrderBy <> "") ? $this->_SqlOrderBy : ""; } function SqlOrderBy() { // For backward compatibility return $this->getSqlOrderBy(); } function setSqlOrderBy($v) { $this->_SqlOrderBy = $v; } // Apply User ID filters function ApplyUserIDFilters($sFilter) { return $sFilter; } // Check if User ID security allows view all function UserIDAllow($id = "") { $allow = EW_USER_ID_ALLOW; switch ($id) { case "add": case "copy": case "gridadd": case "register": case "addopt": return (($allow & 1) == 1); case "edit": case "gridedit": case "update": case "changepwd": case "forgotpwd": return (($allow & 4) == 4); case "delete": return (($allow & 2) == 2); case "view": return (($allow & 32) == 32); case "search": return (($allow & 64) == 64); default: return (($allow & 8) == 8); } } // Get SQL function GetSQL($where, $orderby) { return ew_BuildSelectSql($this->getSqlSelect(), $this->getSqlWhere(), $this->getSqlGroupBy(), $this->getSqlHaving(), $this->getSqlOrderBy(), $where, $orderby); } // Table SQL function SQL() { $sFilter = $this->CurrentFilter; $sFilter = $this->ApplyUserIDFilters($sFilter); $sSort = $this->getSessionOrderBy(); return ew_BuildSelectSql($this->getSqlSelect(), $this->getSqlWhere(), $this->getSqlGroupBy(), $this->getSqlHaving(), $this->getSqlOrderBy(), $sFilter, $sSort); } // Table SQL with List page filter function SelectSQL() { $sFilter = $this->getSessionWhere(); ew_AddFilter($sFilter, $this->CurrentFilter); $sFilter = $this->ApplyUserIDFilters($sFilter); $this->Recordset_Selecting($sFilter); if ($this->UseVirtualFields()) { $sSort = $this->getSessionOrderByList(); return ew_BuildSelectSql($this->getSqlSelectList(), $this->getSqlWhere(), $this->getSqlGroupBy(), $this->getSqlHaving(), $this->getSqlOrderBy(), $sFilter, $sSort); } else { $sSort = $this->getSessionOrderBy(); return ew_BuildSelectSql($this->getSqlSelect(), $this->getSqlWhere(), $this->getSqlGroupBy(), $this->getSqlHaving(), $this->getSqlOrderBy(), $sFilter, $sSort); } } // Get ORDER BY clause function GetOrderBy() { $sSort = ($this->UseVirtualFields()) ? $this->getSessionOrderByList() : $this->getSessionOrderBy(); return ew_BuildSelectSql("", "", "", "", $this->getSqlOrderBy(), "", $sSort); } // Check if virtual fields is used in SQL function UseVirtualFields() { $sWhere = $this->getSessionWhere(); $sOrderBy = $this->getSessionOrderByList(); if ($sWhere <> "") $sWhere = " " . str_replace(array("(",")"), array("",""), $sWhere) . " "; if ($sOrderBy <> "") $sOrderBy = " " . str_replace(array("(",")"), array("",""), $sOrderBy) . " "; if ($this->BasicSearch->getKeyword() <> "") return TRUE; if ($this->Nationality->AdvancedSearch->SearchValue <> "" || $this->Nationality->AdvancedSearch->SearchValue2 <> "" || strpos($sWhere, " " . $this->Nationality->FldVirtualExpression . " ") !== FALSE) return TRUE; if (strpos($sOrderBy, " " . $this->Nationality->FldVirtualExpression . " ") !== FALSE) return TRUE; if ($this->Citizenship->AdvancedSearch->SearchValue <> "" || $this->Citizenship->AdvancedSearch->SearchValue2 <> "" || strpos($sWhere, " " . $this->Citizenship->FldVirtualExpression . " ") !== FALSE) return TRUE; if (strpos($sOrderBy, " " . $this->Citizenship->FldVirtualExpression . " ") !== FALSE) return TRUE; if ($this->Place_of_Residence->AdvancedSearch->SearchValue <> "" || $this->Place_of_Residence->AdvancedSearch->SearchValue2 <> "" || strpos($sWhere, " " . $this->Place_of_Residence->FldVirtualExpression . " ") !== FALSE) return TRUE; if (strpos($sOrderBy, " " . $this->Place_of_Residence->FldVirtualExpression . " ") !== FALSE) return TRUE; if ($this->Place_of_Transit->AdvancedSearch->SearchValue <> "" || $this->Place_of_Transit->AdvancedSearch->SearchValue2 <> "" || strpos($sWhere, " " . $this->Place_of_Transit->FldVirtualExpression . " ") !== FALSE) return TRUE; if (strpos($sOrderBy, " " . $this->Place_of_Transit->FldVirtualExpression . " ") !== FALSE) return TRUE; return FALSE; } // Try to get record count function TryGetRecordCount($sSql) { $cnt = -1; if (($this->TableType == 'TABLE' || $this->TableType == 'VIEW' || $this->TableType == 'LINKTABLE') && preg_match("/^SELECT \* FROM/i", $sSql)) { $sSql = "SELECT COUNT(*) FROM" . preg_replace('/^SELECT\s([\s\S]+)?\*\sFROM/i', "", $sSql); $sOrderBy = $this->GetOrderBy(); if (substr($sSql, strlen($sOrderBy) * -1) == $sOrderBy) $sSql = substr($sSql, 0, strlen($sSql) - strlen($sOrderBy)); // Remove ORDER BY clause } else { $sSql = "SELECT COUNT(*) FROM (" . $sSql . ") EW_COUNT_TABLE"; } $conn = &$this->Connection(); if ($rs = $conn->Execute($sSql)) { if (!$rs->EOF && $rs->FieldCount() > 0) { $cnt = $rs->fields[0]; $rs->Close(); } } return intval($cnt); } // Get record count based on filter (for detail record count in master table pages) function LoadRecordCount($sFilter) { $origFilter = $this->CurrentFilter; $this->CurrentFilter = $sFilter; $this->Recordset_Selecting($this->CurrentFilter); //$sSql = $this->SQL(); $sSql = $this->GetSQL($this->CurrentFilter, ""); $cnt = $this->TryGetRecordCount($sSql); if ($cnt == -1) { if ($rs = $this->LoadRs($this->CurrentFilter)) { $cnt = $rs->RecordCount(); $rs->Close(); } } $this->CurrentFilter = $origFilter; return intval($cnt); } // Get record count (for current List page) function SelectRecordCount() { $sSql = $this->SelectSQL(); $cnt = $this->TryGetRecordCount($sSql); if ($cnt == -1) { $conn = &$this->Connection(); if ($rs = $conn->Execute($sSql)) { $cnt = $rs->RecordCount(); $rs->Close(); } } return intval($cnt); } // INSERT statement function InsertSQL(&$rs) { $names = ""; $values = ""; foreach ($rs as $name => $value) { if (!isset($this->fields[$name]) || $this->fields[$name]->FldIsCustom) continue; $names .= $this->fields[$name]->FldExpression . ","; $values .= ew_QuotedValue($value, $this->fields[$name]->FldDataType, $this->DBID) . ","; } while (substr($names, -1) == ",") $names = substr($names, 0, -1); while (substr($values, -1) == ",") $values = substr($values, 0, -1); return "INSERT INTO " . $this->UpdateTable . " ($names) VALUES ($values)"; } // Insert function Insert(&$rs) { $conn = &$this->Connection(); $bInsert = $conn->Execute($this->InsertSQL($rs)); if ($bInsert) { // Get insert id if necessary $this->idSeeker->setDbValue($conn->Insert_ID()); $rs['idSeeker'] = $this->idSeeker->DbValue; } return $bInsert; } // UPDATE statement function UpdateSQL(&$rs, $where = "", $curfilter = TRUE) { $sql = "UPDATE " . $this->UpdateTable . " SET "; foreach ($rs as $name => $value) { if (!isset($this->fields[$name]) || $this->fields[$name]->FldIsCustom) continue; $sql .= $this->fields[$name]->FldExpression . "="; $sql .= ew_QuotedValue($value, $this->fields[$name]->FldDataType, $this->DBID) . ","; } while (substr($sql, -1) == ",") $sql = substr($sql, 0, -1); $filter = ($curfilter) ? $this->CurrentFilter : ""; if (is_array($where)) $where = $this->ArrayToFilter($where); ew_AddFilter($filter, $where); if ($filter <> "") $sql .= " WHERE " . $filter; return $sql; } // Update function Update(&$rs, $where = "", $rsold = NULL, $curfilter = TRUE) { $conn = &$this->Connection(); $bUpdate = $conn->Execute($this->UpdateSQL($rs, $where, $curfilter)); return $bUpdate; } // DELETE statement function DeleteSQL(&$rs, $where = "", $curfilter = TRUE) { $sql = "DELETE FROM " . $this->UpdateTable . " WHERE "; if (is_array($where)) $where = $this->ArrayToFilter($where); if ($rs) { if (array_key_exists('idSeeker', $rs)) ew_AddFilter($where, ew_QuotedName('idSeeker', $this->DBID) . '=' . ew_QuotedValue($rs['idSeeker'], $this->idSeeker->FldDataType, $this->DBID)); } $filter = ($curfilter) ? $this->CurrentFilter : ""; ew_AddFilter($filter, $where); if ($filter <> "") $sql .= $filter; else $sql .= "0=1"; // Avoid delete return $sql; } // Delete function Delete(&$rs, $where = "", $curfilter = TRUE) { $conn = &$this->Connection(); $bDelete = $conn->Execute($this->DeleteSQL($rs, $where, $curfilter)); return $bDelete; } // Key filter WHERE clause function SqlKeyFilter() { return "`idSeeker` = @idSeeker@"; } // Key filter function KeyFilter() { $sKeyFilter = $this->SqlKeyFilter(); if (!is_numeric($this->idSeeker->CurrentValue)) $sKeyFilter = "0=1"; // Invalid key $sKeyFilter = str_replace("@idSeeker@", ew_AdjustSql($this->idSeeker->CurrentValue, $this->DBID), $sKeyFilter); // Replace key value return $sKeyFilter; } // Return page URL function getReturnUrl() { $name = EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL; // Get referer URL automatically if (ew_ServerVar("HTTP_REFERER") <> "" && ew_ReferPage() <> ew_CurrentPage() && ew_ReferPage() <> "login.php") // Referer not same page or login page $_SESSION[$name] = ew_ServerVar("HTTP_REFERER"); // Save to Session if (@$_SESSION[$name] <> "") { return $_SESSION[$name]; } else { return "vhouseholderslist.php"; } } function setReturnUrl($v) { $_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL] = $v; } // List URL function GetListUrl() { return "vhouseholderslist.php"; } // View URL function GetViewUrl($parm = "") { if ($parm <> "") $url = $this->KeyUrl("vhouseholdersview.php", $this->UrlParm($parm)); else $url = $this->KeyUrl("vhouseholdersview.php", $this->UrlParm(EW_TABLE_SHOW_DETAIL . "=")); return $this->AddMasterUrl($url); } // Add URL function GetAddUrl($parm = "") { if ($parm <> "") $url = "vhouseholdersadd.php?" . $this->UrlParm($parm); else $url = "vhouseholdersadd.php"; return $this->AddMasterUrl($url); } // Edit URL function GetEditUrl($parm = "") { $url = $this->KeyUrl("vhouseholdersedit.php", $this->UrlParm($parm)); return $this->AddMasterUrl($url); } // Inline edit URL function GetInlineEditUrl() { $url = $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=edit")); return $this->AddMasterUrl($url); } // Copy URL function GetCopyUrl($parm = "") { $url = $this->KeyUrl("vhouseholdersadd.php", $this->UrlParm($parm)); return $this->AddMasterUrl($url); } // Inline copy URL function GetInlineCopyUrl() { $url = $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=copy")); return $this->AddMasterUrl($url); } // Delete URL function GetDeleteUrl() { return $this->KeyUrl("vhouseholdersdelete.php", $this->UrlParm()); } // Add master url function AddMasterUrl($url) { return $url; } function KeyToJson() { $json = ""; $json .= "idSeeker:" . ew_VarToJson($this->idSeeker->CurrentValue, "number", "'"); return "{" . $json . "}"; } // Add key value to URL function KeyUrl($url, $parm = "") { $sUrl = $url . "?"; if ($parm <> "") $sUrl .= $parm . "&"; if (!is_null($this->idSeeker->CurrentValue)) { $sUrl .= "idSeeker=" . urlencode($this->idSeeker->CurrentValue); } else { return "javascript:ew_Alert(ewLanguage.Phrase('InvalidRecord'));"; } return $sUrl; } // Sort URL function SortUrl(&$fld) { if ($this->CurrentAction <> "" || $this->Export <> "" || in_array($fld->FldType, array(128, 204, 205))) { // Unsortable data type return ""; } elseif ($fld->Sortable) { $sUrlParm = $this->UrlParm("order=" . urlencode($fld->FldName) . "&ordertype=" . $fld->ReverseSort()); return $this->AddMasterUrl(ew_CurrentPage() . "?" . $sUrlParm); } else { return ""; } } // Get record keys from $_POST/$_GET/$_SESSION function GetRecordKeys() { global $EW_COMPOSITE_KEY_SEPARATOR; $arKeys = array(); $arKey = array(); if (isset($_POST["key_m"])) { $arKeys = ew_StripSlashes($_POST["key_m"]); $cnt = count($arKeys); } elseif (isset($_GET["key_m"])) { $arKeys = ew_StripSlashes($_GET["key_m"]); $cnt = count($arKeys); } elseif (!empty($_GET) || !empty($_POST)) { $isPost = ew_IsHttpPost(); if ($isPost && isset($_POST["idSeeker"])) $arKeys[] = ew_StripSlashes($_POST["idSeeker"]); elseif (isset($_GET["idSeeker"])) $arKeys[] = ew_StripSlashes($_GET["idSeeker"]); else $arKeys = NULL; // Do not setup //return $arKeys; // Do not return yet, so the values will also be checked by the following code } // Check keys $ar = array(); if (is_array($arKeys)) { foreach ($arKeys as $key) { if (!is_numeric($key)) continue; $ar[] = $key; } } return $ar; } // Get key filter function GetKeyFilter() { $arKeys = $this->GetRecordKeys(); $sKeyFilter = ""; foreach ($arKeys as $key) { if ($sKeyFilter <> "") $sKeyFilter .= " OR "; $this->idSeeker->CurrentValue = $key; $sKeyFilter .= "(" . $this->KeyFilter() . ")"; } return $sKeyFilter; } // Load rows based on filter function &LoadRs($sFilter) { // Set up filter (SQL WHERE clause) and get return SQL //$this->CurrentFilter = $sFilter; //$sSql = $this->SQL(); $sSql = $this->GetSQL($sFilter, ""); $conn = &$this->Connection(); $rs = $conn->Execute($sSql); return $rs; } // Load row values from recordset function LoadListRowValues(&$rs) { $this->idSeeker->setDbValue($rs->fields('idSeeker')); $this->Name->setDbValue($rs->fields('Name')); $this->Surname->setDbValue($rs->fields('Surname')); $this->BirthDate->setDbValue($rs->fields('BirthDate')); $this->BirthPlace->setDbValue($rs->fields('BirthPlace')); $this->Nationality->setDbValue($rs->fields('Nationality')); $this->Citizenship->setDbValue($rs->fields('Citizenship')); $this->Sex->setDbValue($rs->fields('Sex')); $this->Phone->setDbValue($rs->fields('Phone')); $this->_Email->setDbValue($rs->fields('Email')); $this->Place_of_Residence->setDbValue($rs->fields('Place_of_Residence')); $this->Address_of_Residence->setDbValue($rs->fields('Address_of_Residence')); $this->Town_of_residence->setDbValue($rs->fields('Town_of_residence')); $this->Place_of_Transit->setDbValue($rs->fields('Place_of_Transit')); $this->Address_of_Transit->setDbValue($rs->fields('Address_of_Transit')); $this->Town_of_transit->setDbValue($rs->fields('Town_of_transit')); $this->Householder->setDbValue($rs->fields('Householder')); } // Render list row values function RenderListRow() { global $Security, $gsLanguage, $Language; // Call Row Rendering event $this->Row_Rendering(); // Common render codes // idSeeker // Name // Surname // BirthDate // BirthPlace // Nationality // Citizenship // Sex // Phone // Email // Place_of_Residence // Address_of_Residence // Town_of_residence // Place_of_Transit // Address_of_Transit // Town_of_transit // Householder // idSeeker $this->idSeeker->ViewValue = $this->idSeeker->CurrentValue; $this->idSeeker->ViewCustomAttributes = ""; // Name $this->Name->ViewValue = $this->Name->CurrentValue; $this->Name->ViewCustomAttributes = ""; // Surname $this->Surname->ViewValue = $this->Surname->CurrentValue; $this->Surname->ViewCustomAttributes = ""; // BirthDate $this->BirthDate->ViewValue = $this->BirthDate->CurrentValue; $this->BirthDate->ViewValue = ew_FormatDateTime($this->BirthDate->ViewValue, 0); $this->BirthDate->ViewCustomAttributes = ""; // BirthPlace $this->BirthPlace->ViewValue = $this->BirthPlace->CurrentValue; $this->BirthPlace->ViewCustomAttributes = ""; // Nationality if ($this->Nationality->VirtualValue <> "") { $this->Nationality->ViewValue = $this->Nationality->VirtualValue; } else { $this->Nationality->ViewValue = $this->Nationality->CurrentValue; if (strval($this->Nationality->CurrentValue) <> "") { $sFilterWrk = "`id_nation`" . ew_SearchString("=", $this->Nationality->CurrentValue, EW_DATATYPE_STRING, ""); switch (@$gsLanguage) { case "en": $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Nationality->LookupFilters = array(); break; case "it": $sSqlWrk = "SELECT `id_nation`, `desc_it` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Nationality->LookupFilters = array(); break; default: $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Nationality->LookupFilters = array(); break; } ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->Nationality, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk; $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->Nationality->ViewValue = $this->Nationality->DisplayValue($arwrk); $rswrk->Close(); } else { $this->Nationality->ViewValue = $this->Nationality->CurrentValue; } } else { $this->Nationality->ViewValue = NULL; } } $this->Nationality->ViewCustomAttributes = ""; // Citizenship if ($this->Citizenship->VirtualValue <> "") { $this->Citizenship->ViewValue = $this->Citizenship->VirtualValue; } else { $this->Citizenship->ViewValue = $this->Citizenship->CurrentValue; if (strval($this->Citizenship->CurrentValue) <> "") { $sFilterWrk = "`id_nation`" . ew_SearchString("=", $this->Citizenship->CurrentValue, EW_DATATYPE_STRING, ""); switch (@$gsLanguage) { case "en": $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Citizenship->LookupFilters = array(); break; case "it": $sSqlWrk = "SELECT `id_nation`, `desc_it` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Citizenship->LookupFilters = array(); break; default: $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Citizenship->LookupFilters = array(); break; } ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->Citizenship, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk; $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->Citizenship->ViewValue = $this->Citizenship->DisplayValue($arwrk); $rswrk->Close(); } else { $this->Citizenship->ViewValue = $this->Citizenship->CurrentValue; } } else { $this->Citizenship->ViewValue = NULL; } } $this->Citizenship->ViewCustomAttributes = ""; // Sex if (strval($this->Sex->CurrentValue) <> "") { $this->Sex->ViewValue = $this->Sex->OptionCaption($this->Sex->CurrentValue); } else { $this->Sex->ViewValue = NULL; } $this->Sex->ViewCustomAttributes = ""; // Phone $this->Phone->ViewValue = $this->Phone->CurrentValue; $this->Phone->ViewCustomAttributes = ""; // Email $this->_Email->ViewValue = $this->_Email->CurrentValue; $this->_Email->ViewCustomAttributes = ""; // Place_of_Residence if ($this->Place_of_Residence->VirtualValue <> "") { $this->Place_of_Residence->ViewValue = $this->Place_of_Residence->VirtualValue; } else { $this->Place_of_Residence->ViewValue = $this->Place_of_Residence->CurrentValue; if (strval($this->Place_of_Residence->CurrentValue) <> "") { $sFilterWrk = "`id_nation`" . ew_SearchString("=", $this->Place_of_Residence->CurrentValue, EW_DATATYPE_STRING, ""); switch (@$gsLanguage) { case "en": $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Place_of_Residence->LookupFilters = array(); break; case "it": $sSqlWrk = "SELECT `id_nation`, `desc_it` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Place_of_Residence->LookupFilters = array(); break; default: $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Place_of_Residence->LookupFilters = array(); break; } ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->Place_of_Residence, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk; $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->Place_of_Residence->ViewValue = $this->Place_of_Residence->DisplayValue($arwrk); $rswrk->Close(); } else { $this->Place_of_Residence->ViewValue = $this->Place_of_Residence->CurrentValue; } } else { $this->Place_of_Residence->ViewValue = NULL; } } $this->Place_of_Residence->ViewCustomAttributes = ""; // Address_of_Residence $this->Address_of_Residence->ViewValue = $this->Address_of_Residence->CurrentValue; $this->Address_of_Residence->ViewCustomAttributes = ""; // Town_of_residence $this->Town_of_residence->ViewValue = $this->Town_of_residence->CurrentValue; $this->Town_of_residence->ViewCustomAttributes = ""; // Place_of_Transit if ($this->Place_of_Transit->VirtualValue <> "") { $this->Place_of_Transit->ViewValue = $this->Place_of_Transit->VirtualValue; } else { $this->Place_of_Transit->ViewValue = $this->Place_of_Transit->CurrentValue; if (strval($this->Place_of_Transit->CurrentValue) <> "") { $sFilterWrk = "`id_nation`" . ew_SearchString("=", $this->Place_of_Transit->CurrentValue, EW_DATATYPE_STRING, ""); switch (@$gsLanguage) { case "en": $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Place_of_Transit->LookupFilters = array(); break; case "it": $sSqlWrk = "SELECT `id_nation`, `desc_it` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Place_of_Transit->LookupFilters = array(); break; default: $sSqlWrk = "SELECT `id_nation`, `desc_en` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tnations`"; $sWhereWrk = ""; $this->Place_of_Transit->LookupFilters = array(); break; } ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->Place_of_Transit, $sWhereWrk); // Call Lookup selecting if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk; $rswrk = Conn()->Execute($sSqlWrk); if ($rswrk && !$rswrk->EOF) { // Lookup values found $arwrk = array(); $arwrk[1] = $rswrk->fields('DispFld'); $this->Place_of_Transit->ViewValue = $this->Place_of_Transit->DisplayValue($arwrk); $rswrk->Close(); } else { $this->Place_of_Transit->ViewValue = $this->Place_of_Transit->CurrentValue; } } else { $this->Place_of_Transit->ViewValue = NULL; } } $this->Place_of_Transit->ViewCustomAttributes = ""; // Address_of_Transit $this->Address_of_Transit->ViewValue = $this->Address_of_Transit->CurrentValue; $this->Address_of_Transit->ViewCustomAttributes = ""; // Town_of_transit $this->Town_of_transit->ViewValue = $this->Town_of_transit->CurrentValue; $this->Town_of_transit->ViewCustomAttributes = ""; // Householder if (ew_ConvertToBool($this->Householder->CurrentValue)) { $this->Householder->ViewValue = $this->Householder->FldTagCaption(1) <> "" ? $this->Householder->FldTagCaption(1) : "Y"; } else { $this->Householder->ViewValue = $this->Householder->FldTagCaption(2) <> "" ? $this->Householder->FldTagCaption(2) : "N"; } $this->Householder->ViewCustomAttributes = ""; // idSeeker $this->idSeeker->LinkCustomAttributes = ""; $this->idSeeker->HrefValue = ""; $this->idSeeker->TooltipValue = ""; // Name $this->Name->LinkCustomAttributes = ""; $this->Name->HrefValue = ""; $this->Name->TooltipValue = ""; // Surname $this->Surname->LinkCustomAttributes = ""; $this->Surname->HrefValue = ""; $this->Surname->TooltipValue = ""; // BirthDate $this->BirthDate->LinkCustomAttributes = ""; $this->BirthDate->HrefValue = ""; $this->BirthDate->TooltipValue = ""; // BirthPlace $this->BirthPlace->LinkCustomAttributes = ""; $this->BirthPlace->HrefValue = ""; $this->BirthPlace->TooltipValue = ""; // Nationality $this->Nationality->LinkCustomAttributes = ""; $this->Nationality->HrefValue = ""; $this->Nationality->TooltipValue = ""; // Citizenship $this->Citizenship->LinkCustomAttributes = ""; $this->Citizenship->HrefValue = ""; $this->Citizenship->TooltipValue = ""; // Sex $this->Sex->LinkCustomAttributes = ""; $this->Sex->HrefValue = ""; $this->Sex->TooltipValue = ""; // Phone $this->Phone->LinkCustomAttributes = ""; $this->Phone->HrefValue = ""; $this->Phone->TooltipValue = ""; // Email $this->_Email->LinkCustomAttributes = ""; $this->_Email->HrefValue = ""; $this->_Email->TooltipValue = ""; // Place_of_Residence $this->Place_of_Residence->LinkCustomAttributes = ""; $this->Place_of_Residence->HrefValue = ""; $this->Place_of_Residence->TooltipValue = ""; // Address_of_Residence $this->Address_of_Residence->LinkCustomAttributes = ""; $this->Address_of_Residence->HrefValue = ""; $this->Address_of_Residence->TooltipValue = ""; // Town_of_residence $this->Town_of_residence->LinkCustomAttributes = ""; $this->Town_of_residence->HrefValue = ""; $this->Town_of_residence->TooltipValue = ""; // Place_of_Transit $this->Place_of_Transit->LinkCustomAttributes = ""; $this->Place_of_Transit->HrefValue = ""; $this->Place_of_Transit->TooltipValue = ""; // Address_of_Transit $this->Address_of_Transit->LinkCustomAttributes = ""; $this->Address_of_Transit->HrefValue = ""; $this->Address_of_Transit->TooltipValue = ""; // Town_of_transit $this->Town_of_transit->LinkCustomAttributes = ""; $this->Town_of_transit->HrefValue = ""; $this->Town_of_transit->TooltipValue = ""; // Householder $this->Householder->LinkCustomAttributes = ""; $this->Householder->HrefValue = ""; $this->Householder->TooltipValue = ""; // Call Row Rendered event $this->Row_Rendered(); } // Render edit row values function RenderEditRow() { global $Security, $gsLanguage, $Language; // Call Row Rendering event $this->Row_Rendering(); // idSeeker $this->idSeeker->EditAttrs["class"] = "form-control"; $this->idSeeker->EditCustomAttributes = ""; $this->idSeeker->EditValue = $this->idSeeker->CurrentValue; $this->idSeeker->ViewCustomAttributes = ""; // Name $this->Name->EditAttrs["class"] = "form-control"; $this->Name->EditCustomAttributes = ""; $this->Name->EditValue = $this->Name->CurrentValue; $this->Name->PlaceHolder = ew_RemoveHtml($this->Name->FldCaption()); // Surname $this->Surname->EditAttrs["class"] = "form-control"; $this->Surname->EditCustomAttributes = ""; $this->Surname->EditValue = $this->Surname->CurrentValue; $this->Surname->PlaceHolder = ew_RemoveHtml($this->Surname->FldCaption()); // BirthDate $this->BirthDate->EditAttrs["class"] = "form-control"; $this->BirthDate->EditCustomAttributes = ""; $this->BirthDate->EditValue = ew_FormatDateTime($this->BirthDate->CurrentValue, 8); $this->BirthDate->PlaceHolder = ew_RemoveHtml($this->BirthDate->FldCaption()); // BirthPlace $this->BirthPlace->EditAttrs["class"] = "form-control"; $this->BirthPlace->EditCustomAttributes = ""; $this->BirthPlace->EditValue = $this->BirthPlace->CurrentValue; $this->BirthPlace->PlaceHolder = ew_RemoveHtml($this->BirthPlace->FldCaption()); // Nationality $this->Nationality->EditAttrs["class"] = "form-control"; $this->Nationality->EditCustomAttributes = ""; $this->Nationality->EditValue = $this->Nationality->CurrentValue; $this->Nationality->PlaceHolder = ew_RemoveHtml($this->Nationality->FldCaption()); // Citizenship $this->Citizenship->EditAttrs["class"] = "form-control"; $this->Citizenship->EditCustomAttributes = ""; $this->Citizenship->EditValue = $this->Citizenship->CurrentValue; $this->Citizenship->PlaceHolder = ew_RemoveHtml($this->Citizenship->FldCaption()); // Sex $this->Sex->EditAttrs["class"] = "form-control"; $this->Sex->EditCustomAttributes = ""; $this->Sex->EditValue = $this->Sex->Options(TRUE); // Phone $this->Phone->EditAttrs["class"] = "form-control"; $this->Phone->EditCustomAttributes = ""; $this->Phone->EditValue = $this->Phone->CurrentValue; $this->Phone->PlaceHolder = ew_RemoveHtml($this->Phone->FldCaption()); // Email $this->_Email->EditAttrs["class"] = "form-control"; $this->_Email->EditCustomAttributes = ""; $this->_Email->EditValue = $this->_Email->CurrentValue; $this->_Email->PlaceHolder = ew_RemoveHtml($this->_Email->FldCaption()); // Place_of_Residence $this->Place_of_Residence->EditAttrs["class"] = "form-control"; $this->Place_of_Residence->EditCustomAttributes = ""; $this->Place_of_Residence->EditValue = $this->Place_of_Residence->CurrentValue; $this->Place_of_Residence->PlaceHolder = ew_RemoveHtml($this->Place_of_Residence->FldCaption()); // Address_of_Residence $this->Address_of_Residence->EditAttrs["class"] = "form-control"; $this->Address_of_Residence->EditCustomAttributes = ""; $this->Address_of_Residence->EditValue = $this->Address_of_Residence->CurrentValue; $this->Address_of_Residence->PlaceHolder = ew_RemoveHtml($this->Address_of_Residence->FldCaption()); // Town_of_residence $this->Town_of_residence->EditAttrs["class"] = "form-control"; $this->Town_of_residence->EditCustomAttributes = ""; $this->Town_of_residence->EditValue = $this->Town_of_residence->CurrentValue; $this->Town_of_residence->PlaceHolder = ew_RemoveHtml($this->Town_of_residence->FldCaption()); // Place_of_Transit $this->Place_of_Transit->EditAttrs["class"] = "form-control"; $this->Place_of_Transit->EditCustomAttributes = ""; $this->Place_of_Transit->EditValue = $this->Place_of_Transit->CurrentValue; $this->Place_of_Transit->PlaceHolder = ew_RemoveHtml($this->Place_of_Transit->FldCaption()); // Address_of_Transit $this->Address_of_Transit->EditAttrs["class"] = "form-control"; $this->Address_of_Transit->EditCustomAttributes = ""; $this->Address_of_Transit->EditValue = $this->Address_of_Transit->CurrentValue; $this->Address_of_Transit->PlaceHolder = ew_RemoveHtml($this->Address_of_Transit->FldCaption()); // Town_of_transit $this->Town_of_transit->EditAttrs["class"] = "form-control"; $this->Town_of_transit->EditCustomAttributes = ""; $this->Town_of_transit->EditValue = $this->Town_of_transit->CurrentValue; $this->Town_of_transit->PlaceHolder = ew_RemoveHtml($this->Town_of_transit->FldCaption()); // Householder $this->Householder->EditCustomAttributes = ""; $this->Householder->EditValue = $this->Householder->Options(FALSE); // Call Row Rendered event $this->Row_Rendered(); } // Aggregate list row values function AggregateListRowValues() { } // Aggregate list row (for rendering) function AggregateListRow() { // Call Row Rendered event $this->Row_Rendered(); } var $ExportDoc; // Export data in HTML/CSV/Word/Excel/Email/PDF format function ExportDocument(&$Doc, &$Recordset, $StartRec, $StopRec, $ExportPageType = "") { if (!$Recordset || !$Doc) return; if (!$Doc->ExportCustom) { // Write header $Doc->ExportTableHeader(); if ($Doc->Horizontal) { // Horizontal format, write header $Doc->BeginExportRow(); if ($ExportPageType == "view") { if ($this->Name->Exportable) $Doc->ExportCaption($this->Name); if ($this->Surname->Exportable) $Doc->ExportCaption($this->Surname); if ($this->BirthDate->Exportable) $Doc->ExportCaption($this->BirthDate); if ($this->BirthPlace->Exportable) $Doc->ExportCaption($this->BirthPlace); if ($this->Nationality->Exportable) $Doc->ExportCaption($this->Nationality); if ($this->Citizenship->Exportable) $Doc->ExportCaption($this->Citizenship); if ($this->Sex->Exportable) $Doc->ExportCaption($this->Sex); if ($this->Phone->Exportable) $Doc->ExportCaption($this->Phone); if ($this->_Email->Exportable) $Doc->ExportCaption($this->_Email); if ($this->Place_of_Residence->Exportable) $Doc->ExportCaption($this->Place_of_Residence); if ($this->Address_of_Residence->Exportable) $Doc->ExportCaption($this->Address_of_Residence); if ($this->Town_of_residence->Exportable) $Doc->ExportCaption($this->Town_of_residence); if ($this->Place_of_Transit->Exportable) $Doc->ExportCaption($this->Place_of_Transit); if ($this->Address_of_Transit->Exportable) $Doc->ExportCaption($this->Address_of_Transit); if ($this->Town_of_transit->Exportable) $Doc->ExportCaption($this->Town_of_transit); if ($this->Householder->Exportable) $Doc->ExportCaption($this->Householder); } else { if ($this->idSeeker->Exportable) $Doc->ExportCaption($this->idSeeker); if ($this->Name->Exportable) $Doc->ExportCaption($this->Name); if ($this->Surname->Exportable) $Doc->ExportCaption($this->Surname); if ($this->BirthDate->Exportable) $Doc->ExportCaption($this->BirthDate); if ($this->BirthPlace->Exportable) $Doc->ExportCaption($this->BirthPlace); if ($this->Nationality->Exportable) $Doc->ExportCaption($this->Nationality); if ($this->Citizenship->Exportable) $Doc->ExportCaption($this->Citizenship); if ($this->Sex->Exportable) $Doc->ExportCaption($this->Sex); if ($this->Phone->Exportable) $Doc->ExportCaption($this->Phone); if ($this->_Email->Exportable) $Doc->ExportCaption($this->_Email); if ($this->Place_of_Residence->Exportable) $Doc->ExportCaption($this->Place_of_Residence); if ($this->Address_of_Residence->Exportable) $Doc->ExportCaption($this->Address_of_Residence); if ($this->Town_of_residence->Exportable) $Doc->ExportCaption($this->Town_of_residence); if ($this->Place_of_Transit->Exportable) $Doc->ExportCaption($this->Place_of_Transit); if ($this->Address_of_Transit->Exportable) $Doc->ExportCaption($this->Address_of_Transit); if ($this->Town_of_transit->Exportable) $Doc->ExportCaption($this->Town_of_transit); if ($this->Householder->Exportable) $Doc->ExportCaption($this->Householder); } $Doc->EndExportRow(); } } // Move to first record $RecCnt = $StartRec - 1; if (!$Recordset->EOF) { $Recordset->MoveFirst(); if ($StartRec > 1) $Recordset->Move($StartRec - 1); } while (!$Recordset->EOF && $RecCnt < $StopRec) { $RecCnt++; if (intval($RecCnt) >= intval($StartRec)) { $RowCnt = intval($RecCnt) - intval($StartRec) + 1; // Page break if ($this->ExportPageBreakCount > 0) { if ($RowCnt > 1 && ($RowCnt - 1) % $this->ExportPageBreakCount == 0) $Doc->ExportPageBreak(); } $this->LoadListRowValues($Recordset); // Render row $this->RowType = EW_ROWTYPE_VIEW; // Render view $this->ResetAttrs(); $this->RenderListRow(); if (!$Doc->ExportCustom) { $Doc->BeginExportRow($RowCnt); // Allow CSS styles if enabled if ($ExportPageType == "view") { if ($this->Name->Exportable) $Doc->ExportField($this->Name); if ($this->Surname->Exportable) $Doc->ExportField($this->Surname); if ($this->BirthDate->Exportable) $Doc->ExportField($this->BirthDate); if ($this->BirthPlace->Exportable) $Doc->ExportField($this->BirthPlace); if ($this->Nationality->Exportable) $Doc->ExportField($this->Nationality); if ($this->Citizenship->Exportable) $Doc->ExportField($this->Citizenship); if ($this->Sex->Exportable) $Doc->ExportField($this->Sex); if ($this->Phone->Exportable) $Doc->ExportField($this->Phone); if ($this->_Email->Exportable) $Doc->ExportField($this->_Email); if ($this->Place_of_Residence->Exportable) $Doc->ExportField($this->Place_of_Residence); if ($this->Address_of_Residence->Exportable) $Doc->ExportField($this->Address_of_Residence); if ($this->Town_of_residence->Exportable) $Doc->ExportField($this->Town_of_residence); if ($this->Place_of_Transit->Exportable) $Doc->ExportField($this->Place_of_Transit); if ($this->Address_of_Transit->Exportable) $Doc->ExportField($this->Address_of_Transit); if ($this->Town_of_transit->Exportable) $Doc->ExportField($this->Town_of_transit); if ($this->Householder->Exportable) $Doc->ExportField($this->Householder); } else { if ($this->idSeeker->Exportable) $Doc->ExportField($this->idSeeker); if ($this->Name->Exportable) $Doc->ExportField($this->Name); if ($this->Surname->Exportable) $Doc->ExportField($this->Surname); if ($this->BirthDate->Exportable) $Doc->ExportField($this->BirthDate); if ($this->BirthPlace->Exportable) $Doc->ExportField($this->BirthPlace); if ($this->Nationality->Exportable) $Doc->ExportField($this->Nationality); if ($this->Citizenship->Exportable) $Doc->ExportField($this->Citizenship); if ($this->Sex->Exportable) $Doc->ExportField($this->Sex); if ($this->Phone->Exportable) $Doc->ExportField($this->Phone); if ($this->_Email->Exportable) $Doc->ExportField($this->_Email); if ($this->Place_of_Residence->Exportable) $Doc->ExportField($this->Place_of_Residence); if ($this->Address_of_Residence->Exportable) $Doc->ExportField($this->Address_of_Residence); if ($this->Town_of_residence->Exportable) $Doc->ExportField($this->Town_of_residence); if ($this->Place_of_Transit->Exportable) $Doc->ExportField($this->Place_of_Transit); if ($this->Address_of_Transit->Exportable) $Doc->ExportField($this->Address_of_Transit); if ($this->Town_of_transit->Exportable) $Doc->ExportField($this->Town_of_transit); if ($this->Householder->Exportable) $Doc->ExportField($this->Householder); } $Doc->EndExportRow(); } } // Call Row Export server event if ($Doc->ExportCustom) $this->Row_Export($Recordset->fields); $Recordset->MoveNext(); } if (!$Doc->ExportCustom) { $Doc->ExportTableFooter(); } } // Get auto fill value function GetAutoFill($id, $val) { $rsarr = array(); $rowcnt = 0; // Output if (is_array($rsarr) && $rowcnt > 0) { $fldcnt = count($rsarr[0]); for ($i = 0; $i < $rowcnt; $i++) { for ($j = 0; $j < $fldcnt; $j++) { $str = strval($rsarr[$i][$j]); $str = ew_ConvertToUtf8($str); if (isset($post["keepCRLF"])) { $str = str_replace(array("\r", "\n"), array("\\r", "\\n"), $str); } else { $str = str_replace(array("\r", "\n"), array(" ", " "), $str); } $rsarr[$i][$j] = $str; } } return ew_ArrayToJson($rsarr); } else { return FALSE; } } // Table level events // Recordset Selecting event function Recordset_Selecting(&$filter) { // Enter your code here } // Recordset Selected event function Recordset_Selected(&$rs) { //echo "Recordset Selected"; } // Recordset Search Validated event function Recordset_SearchValidated() { // Example: //$this->MyField1->AdvancedSearch->SearchValue = "your search criteria"; // Search value } // Recordset Searching event function Recordset_Searching(&$filter) { // Enter your code here } // Row_Selecting event function Row_Selecting(&$filter) { // Enter your code here } // Row Selected event function Row_Selected(&$rs) { //echo "Row Selected"; } // Row Inserting event function Row_Inserting($rsold, &$rsnew) { // Enter your code here // To cancel, set return value to FALSE return TRUE; } // Row Inserted event function Row_Inserted($rsold, &$rsnew) { //echo "Row Inserted" } // Row Updating event function Row_Updating($rsold, &$rsnew) { // Enter your code here // To cancel, set return value to FALSE return TRUE; } // Row Updated event function Row_Updated($rsold, &$rsnew) { //echo "Row Updated"; } // Row Update Conflict event function Row_UpdateConflict($rsold, &$rsnew) { // Enter your code here // To ignore conflict, set return value to FALSE return TRUE; } // Grid Inserting event function Grid_Inserting() { // Enter your code here // To reject grid insert, set return value to FALSE return TRUE; } // Grid Inserted event function Grid_Inserted($rsnew) { //echo "Grid Inserted"; } // Grid Updating event function Grid_Updating($rsold) { // Enter your code here // To reject grid update, set return value to FALSE return TRUE; } // Grid Updated event function Grid_Updated($rsold, $rsnew) { //echo "Grid Updated"; } // Row Deleting event function Row_Deleting(&$rs) { // Enter your code here // To cancel, set return value to False return TRUE; } // Row Deleted event function Row_Deleted(&$rs) { //echo "Row Deleted"; } // Email Sending event function Email_Sending(&$Email, &$Args) { //var_dump($Email); var_dump($Args); exit(); return TRUE; } // Lookup Selecting event function Lookup_Selecting($fld, &$filter) { //var_dump($fld->FldName, $fld->LookupFilters, $filter); // Uncomment to view the filter // Enter your code here } // Row Rendering event function Row_Rendering() { // Enter your code here } // Row Rendered event function Row_Rendered() { // To view properties of field class, use: //var_dump($this->); } // User ID Filtering event function UserID_Filtering(&$filter) { // Enter your code here } } ?>