UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token return $PageUrl; } // Message function getMessage() { return @$_SESSION[EW_SESSION_MESSAGE]; } function setMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v); } function getFailureMessage() { return @$_SESSION[EW_SESSION_FAILURE_MESSAGE]; } function setFailureMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v); } function getSuccessMessage() { return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE]; } function setSuccessMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v); } function getWarningMessage() { return @$_SESSION[EW_SESSION_WARNING_MESSAGE]; } function setWarningMessage($v) { ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v); } // Methods to clear message function ClearMessage() { $_SESSION[EW_SESSION_MESSAGE] = ""; } function ClearFailureMessage() { $_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; } function ClearSuccessMessage() { $_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; } function ClearWarningMessage() { $_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; } function ClearMessages() { $_SESSION[EW_SESSION_MESSAGE] = ""; $_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; $_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; $_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; } // Show message function ShowMessage() { $hidden = FALSE; $html = ""; // Message $sMessage = $this->getMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sMessage, ""); if ($sMessage <> "") { // Message in Session, display if (!$hidden) $sMessage = "" . $sMessage; $html .= "
" . $sHeader . "
"; } } // Show Page Footer function ShowPageFooter() { $sFooter = $this->PageFooter; $this->Page_DataRendered($sFooter); if ($sFooter <> "") { // Footer exists, display echo "" . $sFooter . "
"; } } // Validate page request function IsPageRequest() { global $objForm; if ($this->UseTokenInUrl) { if ($objForm) return ($this->TableVar == $objForm->GetValue("t")); if (@$_GET["t"] <> "") return ($this->TableVar == $_GET["t"]); } else { return TRUE; } } var $Token = ""; var $TokenTimeout = 0; var $CheckToken = EW_CHECK_TOKEN; var $CheckTokenFn = "ew_CheckToken"; var $CreateTokenFn = "ew_CreateToken"; // Valid Post function ValidPost() { if (!$this->CheckToken || !ew_IsHttpPost()) return TRUE; if (!isset($_POST[EW_TOKEN_NAME])) return FALSE; $fn = $this->CheckTokenFn; if (is_callable($fn)) return $fn($_POST[EW_TOKEN_NAME], $this->TokenTimeout); return FALSE; } // Create Token function CreateToken() { global $gsToken; if ($this->CheckToken) { $fn = $this->CreateTokenFn; if ($this->Token == "" && is_callable($fn)) // Create token $this->Token = $fn(); $gsToken = $this->Token; // Save to global variable } } // // Page class constructor // function __construct() { global $conn, $Language; global $UserTable, $UserTableConn; $GLOBALS["Page"] = &$this; $this->TokenTimeout = ew_SessionTimeoutTime(); // Language object if (!isset($Language)) $Language = new cLanguage(); // Parent constuctor parent::__construct(); // Table object (taccomodations) if (!isset($GLOBALS["taccomodations"]) || get_class($GLOBALS["taccomodations"]) == "ctaccomodations") { $GLOBALS["taccomodations"] = &$this; $GLOBALS["Table"] = &$GLOBALS["taccomodations"]; } // Table object (tofferers) if (!isset($GLOBALS['tofferers'])) $GLOBALS['tofferers'] = new ctofferers(); // Table object (users) if (!isset($GLOBALS['users'])) $GLOBALS['users'] = new cusers(); // Page ID if (!defined("EW_PAGE_ID")) define("EW_PAGE_ID", 'preview', TRUE); // Table name (for backward compatibility) if (!defined("EW_TABLE_NAME")) define("EW_TABLE_NAME", 'taccomodations', TRUE); // Start timer if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer(); // Open connection if (!isset($conn)) $conn = ew_Connect($this->DBID); // User table object (users) if (!isset($UserTable)) { $UserTable = new cusers(); $UserTableConn = Conn($UserTable->DBID); } // List options $this->ListOptions = new cListOptions(); $this->ListOptions->TableVar = $this->TableVar; // Other options $this->OtherOptions['addedit'] = new cListOptions(); $this->OtherOptions['addedit']->Tag = "div"; $this->OtherOptions['addedit']->TagClassName = "ewAddEditOption"; } // // Page_Init // function Page_Init() { global $gsExport, $gsCustomExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm; // Security $Security = new cAdvancedSecurity(); if (is_null($Security)) $Security = new cAdvancedSecurity(); if (!$Security->IsLoggedIn()) $Security->AutoLogin(); if ($Security->IsLoggedIn()) $Security->TablePermission_Loading(); $Security->LoadCurrentUserLevel(CurrentProjectID() . 'taccomodations'); if ($Security->IsLoggedIn()) $Security->TablePermission_Loaded(); if (!$Security->CanList()) { echo ew_DeniedMsg(); exit(); } $this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action // Set up list options $this->SetupListOptions(); $this->idOfferer->SetVisibility(); $this->Accom_Type->SetVisibility(); $this->Address->SetVisibility(); $this->Town->SetVisibility(); $this->District->SetVisibility(); $this->Region->SetVisibility(); $this->Beds->SetVisibility(); $this->Rooms->SetVisibility(); $this->Bathrooms->SetVisibility(); $this->Private_Kitchen->SetVisibility(); $this->Available_from->SetVisibility(); $this->Available_to->SetVisibility(); $this->Rel_type->SetVisibility(); // Global Page Loading event (in userfn*.php) Page_Loading(); // Page Load event $this->Page_Load(); // Check token if (!$this->ValidPost()) { echo $Language->Phrase("InvalidPostRequest"); $this->Page_Terminate(); exit(); } // Create Token $this->CreateToken(); // Setup other options $this->SetupOtherOptions(); } // // Page_Terminate // function Page_Terminate($url = "") { global $gsExportFile, $gTmpImages; // Page Unload event $this->Page_Unload(); // Global Page Unloaded event (in userfn*.php) Page_Unloaded(); // Export global $EW_EXPORT, $taccomodations; if ($this->CustomExport <> "" && $this->CustomExport == $this->Export && array_key_exists($this->CustomExport, $EW_EXPORT)) { $sContent = ob_get_contents(); if ($gsExportFile == "") $gsExportFile = $this->TableVar; $class = $EW_EXPORT[$this->CustomExport]; if (class_exists($class)) { $doc = new $class($taccomodations); $doc->Text = $sContent; if ($this->Export == "email") echo $this->ExportEmail($doc->Text); else $doc->Export(); ew_DeleteTmpImages(); // Delete temp images exit(); } } $this->Page_Redirecting($url); // Close connection ew_CloseConn(); // Go to URL if specified if ($url <> "") { if (!EW_DEBUG_ENABLED && ob_get_length()) ob_end_clean(); header("Location: " . $url); } exit(); } var $Recordset; var $TotalRecs; var $RowCnt; var $RecCount; var $ListOptions; // List options var $OtherOptions; // Other options // // Page main // function Page_Main() { global $Language; // Load filter $filter = @$_GET["f"]; $filter = ew_Decrypt($filter); if ($filter == "") $filter = "0=1"; // Set up foreign keys from filter $this->SetupForeignKeysFromFilter($filter); // Call Recordset Selecting event $this->Recordset_Selecting($filter); // Load recordset $filter = $this->ApplyUserIDFilters($filter); $this->TotalRecs = 0; $this->Recordset = $this->LoadRs($filter); if ($this->Recordset) { $this->TotalRecs = $this->Recordset->RecordCount(); // Call Recordset Selected event $this->Recordset_Selected($this->Recordset); $this->LoadListRowValues($this->Recordset); } $this->RenderOtherOptions(); } // Set up list options function SetupListOptions() { global $Security, $Language; // Add group option item $item = &$this->ListOptions->Add($this->ListOptions->GroupOptionName); $item->Body = ""; $item->OnLeft = FALSE; $item->Visible = FALSE; // "view" $item = &$this->ListOptions->Add("view"); $item->CssStyle = "white-space: nowrap;"; $item->Visible = $Security->CanView(); $item->OnLeft = FALSE; // "edit" $item = &$this->ListOptions->Add("edit"); $item->CssStyle = "white-space: nowrap;"; $item->Visible = $Security->CanEdit(); $item->OnLeft = FALSE; // "delete" $item = &$this->ListOptions->Add("delete"); $item->CssStyle = "white-space: nowrap;"; $item->Visible = $Security->CanDelete(); $item->OnLeft = FALSE; // Drop down button for ListOptions $this->ListOptions->UseDropDownButton = FALSE; $this->ListOptions->DropDownButtonPhrase = $Language->Phrase("ButtonListOptions"); $this->ListOptions->UseButtonGroup = TRUE; $this->ListOptions->UseImageAndText = TRUE; $this->ListOptions->ButtonClass = "btn-sm"; // Class for button group // Call ListOptions_Load event $this->ListOptions_Load(); $item = &$this->ListOptions->GetItem($this->ListOptions->GroupOptionName); $item->Visible = $this->ListOptions->GroupOptionVisible(); } // Render list options function RenderListOptions() { global $Security, $Language, $objForm; $this->ListOptions->LoadDefault(); $masterkeyurl = $this->MasterKeyUrl(); // "view" $oListOpt = &$this->ListOptions->Items["view"]; if ($Security->CanView()) $oListOpt->Body = "Phrase("ViewLink")) . "\" data-caption=\"" . ew_HtmlTitle($Language->Phrase("ViewLink")) . "\" href=\"" . ew_HtmlEncode($this->GetViewUrl($masterkeyurl)) . "\">" . $Language->Phrase("ViewLink") . ""; else $oListOpt->Body = ""; // "edit" $oListOpt = &$this->ListOptions->Items["edit"]; if ($Security->CanEdit()) { $oListOpt->Body = "Phrase("EditLink")) . "\" data-caption=\"" . ew_HtmlTitle($Language->Phrase("EditLink")) . "\" href=\"" . ew_HtmlEncode($this->GetEditUrl($masterkeyurl)) . "\">" . $Language->Phrase("EditLink") . ""; } else { $oListOpt->Body = ""; } // "delete" $oListOpt = &$this->ListOptions->Items["delete"]; if ($Security->CanDelete()) $oListOpt->Body = "Phrase("DeleteLink")) . "\" data-caption=\"" . ew_HtmlTitle($Language->Phrase("DeleteLink")) . "\" href=\"" . ew_HtmlEncode($this->GetDeleteUrl()) . "\">" . $Language->Phrase("DeleteLink") . ""; else $oListOpt->Body = ""; // Call ListOptions_Rendered event $this->ListOptions_Rendered(); } // Set up other options function SetupOtherOptions() { global $Language, $Security; $options = &$this->OtherOptions; $option = $options["addedit"]; $option->UseButtonGroup = TRUE; // Add group option item $item = &$option->Add($option->GroupOptionName); $item->Body = ""; $item->OnLeft = FALSE; $item->Visible = FALSE; // Add $item = &$option->Add("add"); $item->Visible = $Security->CanAdd(); } // Render other options function RenderOtherOptions() { global $Language, $Security; $options = &$this->OtherOptions; $option = $options["addedit"]; // Add $item = &$option->GetItem("add"); $item->Body = "Phrase("AddLink")) . "\" data-caption=\"" . ew_HtmlTitle($Language->Phrase("AddLink")) . "\" href=\"" . ew_HtmlEncode($this->GetAddUrl($this->MasterKeyUrl())) . "\">" . $Language->Phrase("AddLink") . ""; } // Get master foreign key url function MasterKeyUrl() { $mastertblvar = @$_GET["t"]; $url = ""; if ($mastertblvar == "tofferers") { $url = "" . EW_TABLE_SHOW_MASTER . "=tofferers&fk_idOfferer=" . urlencode(strval($this->idOfferer->QueryStringValue)) . ""; } return $url; } // Set up foreign keys from filter function SetupForeignKeysFromFilter($f) { $mastertblvar = @$_GET["t"]; if ($mastertblvar == "tofferers") { $find = "`idOfferer`="; $x = strpos($f, $find); if ($x !== FALSE) { $x += strlen($find); $val = substr($f, $x); $val = $this->UnquoteValue($val, "DB"); $this->idOfferer->setQueryStringValue($val); } } } // Unquote value function UnquoteValue($val, $dbid) { if (substr($val,0,1) == "'" && substr($val,strlen($val)-1) == "'") { if (ew_GetConnectionType($dbid) == "MYSQL") return stripslashes(substr($val, 1, strlen($val)-2)); else return str_replace("''", "'", substr($val, 1, strlen($val)-2)); } else { return $val; } } // Page Load event function Page_Load() { //echo "Page Load"; } // Page Unload event function Page_Unload() { //echo "Page Unload"; } // Page Redirecting event function Page_Redirecting(&$url) { // Example: //$url = "your URL"; } // Message Showing event // $type = ''|'success'|'failure'|'warning' function Message_Showing(&$msg, $type) { if ($type == 'success') { //$msg = "your success message"; } elseif ($type == 'failure') { //$msg = "your failure message"; } elseif ($type == 'warning') { //$msg = "your warning message"; } else { //$msg = "your message"; } } // Page Render event function Page_Render() { //echo "Page Render"; } // Page Data Rendering event function Page_DataRendering(&$header) { // Example: //$header = "your header"; } // Page Data Rendered event function Page_DataRendered(&$footer) { // Example: //$footer = "your footer"; } // ListOptions Load event function ListOptions_Load() { // Example: //$opt = &$this->ListOptions->Add("new"); //$opt->Header = "xxx"; //$opt->OnLeft = TRUE; // Link on left //$opt->MoveTo(0); // Move to first column } // ListOptions Rendered event function ListOptions_Rendered() { // Example: //$this->ListOptions->Items["new"]->Body = "xxx"; } } ?> Page_Init(); // Page main $taccomodations_preview->Page_Main(); // Global Page Rendering event (in userfn*.php) Page_Rendering(); // Page Rendering event $taccomodations_preview->Page_Render(); ?> ShowPageHeader(); ?> TotalRecs > 0) { ?>| idOfferer->FldCaption() ?> | Accom_Type->Visible) { // Accom_Type ?>Accom_Type->FldCaption() ?> | Address->Visible) { // Address ?>Address->FldCaption() ?> | Town->Visible) { // Town ?>Town->FldCaption() ?> | District->Visible) { // District ?>District->FldCaption() ?> | Region->Visible) { // Region ?>Region->FldCaption() ?> | Beds->Visible) { // Beds ?>Beds->FldCaption() ?> | Rooms->Visible) { // Rooms ?>Rooms->FldCaption() ?> | Bathrooms->Visible) { // Bathrooms ?>Bathrooms->FldCaption() ?> | Private_Kitchen->Visible) { // Private_Kitchen ?>Private_Kitchen->FldCaption() ?> | Available_from->Visible) { // Available_from ?>Available_from->FldCaption() ?> | Available_to->Visible) { // Available_to ?>Available_to->FldCaption() ?> | Rel_type->Visible) { // Rel_type ?>Rel_type->FldCaption() ?> | ListOptions->Render("header", "right"); ?>
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| idOfferer->CellAttributes() ?>> idOfferer->ViewAttributes() ?>> idOfferer->ListViewValue())) && $taccomodations->idOfferer->LinkAttributes() <> "") { ?> idOfferer->LinkAttributes() ?>>idOfferer->ListViewValue() ?> idOfferer->ListViewValue() ?> | Accom_Type->Visible) { // Accom_Type ?>Accom_Type->CellAttributes() ?>> Accom_Type->ViewAttributes() ?>> Accom_Type->ListViewValue() ?> | Address->Visible) { // Address ?>Address->CellAttributes() ?>> Address->ViewAttributes() ?>> Address->ListViewValue() ?> | Town->Visible) { // Town ?>Town->CellAttributes() ?>> Town->ViewAttributes() ?>> Town->ListViewValue() ?> | District->Visible) { // District ?>District->CellAttributes() ?>> District->ViewAttributes() ?>> District->ListViewValue() ?> | Region->Visible) { // Region ?>Region->CellAttributes() ?>> Region->ViewAttributes() ?>> Region->ListViewValue() ?> | Beds->Visible) { // Beds ?>Beds->CellAttributes() ?>> Beds->ViewAttributes() ?>> Beds->ListViewValue() ?> | Rooms->Visible) { // Rooms ?>Rooms->CellAttributes() ?>> Rooms->ViewAttributes() ?>> Rooms->ListViewValue() ?> | Bathrooms->Visible) { // Bathrooms ?>Bathrooms->CellAttributes() ?>> Bathrooms->ViewAttributes() ?>> Bathrooms->ListViewValue() ?> | Private_Kitchen->Visible) { // Private_Kitchen ?>Private_Kitchen->CellAttributes() ?>> Private_Kitchen->ViewAttributes() ?>> Private_Kitchen->ListViewValue() ?> | Available_from->Visible) { // Available_from ?>Available_from->CellAttributes() ?>> Available_from->ViewAttributes() ?>> Available_from->ListViewValue() ?> | Available_to->Visible) { // Available_to ?>Available_to->CellAttributes() ?>> Available_to->ViewAttributes() ?>> Available_to->ListViewValue() ?> | Rel_type->Visible) { // Rel_type ?>Rel_type->CellAttributes() ?>> Rel_type->ViewAttributes() ?>> Rel_type->ListViewValue() ?> | ListOptions->Render("body", "right", $taccomodations_preview->RowCnt); ?>