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 .= "
" . $sMessage . "
"; $_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session } // Warning message $sWarningMessage = $this->getWarningMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sWarningMessage, "warning"); if ($sWarningMessage <> "") { // Message in Session, display if (!$hidden) $sWarningMessage = "" . $sWarningMessage; $html .= "
" . $sWarningMessage . "
"; $_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session } // Success message $sSuccessMessage = $this->getSuccessMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sSuccessMessage, "success"); if ($sSuccessMessage <> "") { // Message in Session, display if (!$hidden) $sSuccessMessage = "" . $sSuccessMessage; $html .= "
" . $sSuccessMessage . "
"; $_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session } // Failure message $sErrorMessage = $this->getFailureMessage(); if (method_exists($this, "Message_Showing")) $this->Message_Showing($sErrorMessage, "failure"); if ($sErrorMessage <> "") { // Message in Session, display if (!$hidden) $sErrorMessage = "" . $sErrorMessage; $html .= "
" . $sErrorMessage . "
"; $_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session } echo "
" . $html . "
"; } var $PageHeader; var $PageFooter; // Show Page Header function ShowPageHeader() { $sHeader = $this->PageHeader; $this->Page_DataRendering($sHeader); if ($sHeader <> "") { // Header exists, display echo "

" . $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 (tofferers) if (!isset($GLOBALS["tofferers"]) || get_class($GLOBALS["tofferers"]) == "ctofferers") { $GLOBALS["tofferers"] = &$this; $GLOBALS["Table"] = &$GLOBALS["tofferers"]; } // Table object (users) if (!isset($GLOBALS['users'])) $GLOBALS['users'] = new cusers(); // Page ID if (!defined("EW_PAGE_ID")) define("EW_PAGE_ID", 'delete', TRUE); // Table name (for backward compatibility) if (!defined("EW_TABLE_NAME")) define("EW_TABLE_NAME", 'tofferers', 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); } } // // Page_Init // function Page_Init() { global $gsExport, $gsCustomExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm; // Security $Security = new cAdvancedSecurity(); if (!$Security->IsLoggedIn()) $Security->AutoLogin(); if ($Security->IsLoggedIn()) $Security->TablePermission_Loading(); $Security->LoadCurrentUserLevel($this->ProjectID . $this->TableName); if ($Security->IsLoggedIn()) $Security->TablePermission_Loaded(); if (!$Security->CanDelete()) { $Security->SaveLastUrl(); $this->setFailureMessage(ew_DeniedMsg()); // Set no permission if ($Security->CanList()) $this->Page_Terminate(ew_GetUrl("toffererslist.php")); else $this->Page_Terminate(ew_GetUrl("login.php")); } $this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action $this->Name->SetVisibility(); $this->Surname->SetVisibility(); $this->Institution_Type->SetVisibility(); $this->Institution_Name->SetVisibility(); $this->Address->SetVisibility(); $this->Phone->SetVisibility(); $this->Phone_Mobile->SetVisibility(); $this->Town->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(); } // // 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, $tofferers; 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($tofferers); $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 $DbMasterFilter = ""; var $DbDetailFilter = ""; var $StartRec; var $TotalRecs = 0; var $RecCnt; var $RecKeys = array(); var $Recordset; var $StartRowCnt = 1; var $RowCnt = 0; // // Page main // function Page_Main() { global $Language; // Set up Breadcrumb $this->SetupBreadcrumb(); // Load key parameters $this->RecKeys = $this->GetRecordKeys(); // Load record keys $sFilter = $this->GetKeyFilter(); if ($sFilter == "") $this->Page_Terminate("toffererslist.php"); // Prevent SQL injection, return to list // Set up filter (SQL WHHERE clause) and get return SQL // SQL constructor in tofferers class, tofferersinfo.php $this->CurrentFilter = $sFilter; // Get action if (@$_POST["a_delete"] <> "") { $this->CurrentAction = $_POST["a_delete"]; } elseif (@$_GET["a_delete"] == "1") { $this->CurrentAction = "D"; // Delete record directly } else { $this->CurrentAction = "I"; // Display record } if ($this->CurrentAction == "D") { $this->SendEmail = TRUE; // Send email on delete success if ($this->DeleteRows()) { // Delete rows if ($this->getSuccessMessage() == "") $this->setSuccessMessage($Language->Phrase("DeleteSuccess")); // Set up success message $this->Page_Terminate($this->getReturnUrl()); // Return to caller } else { // Delete failed $this->CurrentAction = "I"; // Display record } } if ($this->CurrentAction == "I") { // Load records for display if ($this->Recordset = $this->LoadRecordset()) $this->TotalRecs = $this->Recordset->RecordCount(); // Get record count if ($this->TotalRecs <= 0) { // No record found, exit if ($this->Recordset) $this->Recordset->Close(); $this->Page_Terminate("toffererslist.php"); // Return to list } } } // Load recordset function LoadRecordset($offset = -1, $rowcnt = -1) { // Load List page SQL $sSql = $this->SelectSQL(); $conn = &$this->Connection(); // Load recordset $dbtype = ew_GetConnectionType($this->DBID); if ($this->UseSelectLimit) { $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; if ($dbtype == "MSSQL") { $rs = $conn->SelectLimit($sSql, $rowcnt, $offset, array("_hasOrderBy" => trim($this->getOrderBy()) || trim($this->getSessionOrderBy()))); } else { $rs = $conn->SelectLimit($sSql, $rowcnt, $offset); } $conn->raiseErrorFn = ''; } else { $rs = ew_LoadRecordset($sSql, $conn); } // Call Recordset Selected event $this->Recordset_Selected($rs); return $rs; } // Load row based on key values function LoadRow() { global $Security, $Language; $sFilter = $this->KeyFilter(); // Call Row Selecting event $this->Row_Selecting($sFilter); // Load SQL based on filter $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn = &$this->Connection(); $res = FALSE; $rs = ew_LoadRecordset($sSql, $conn); if ($rs && !$rs->EOF) { $res = TRUE; $this->LoadRowValues($rs); // Load row values $rs->Close(); } return $res; } // Load row values from recordset function LoadRowValues(&$rs) { if (!$rs || $rs->EOF) return; // Call Row Selected event $row = &$rs->fields; $this->Row_Selected($row); $this->idOfferer->setDbValue($rs->fields('idOfferer')); $this->Name->setDbValue($rs->fields('Name')); $this->Surname->setDbValue($rs->fields('Surname')); $this->Institution_Type->setDbValue($rs->fields('Institution_Type')); $this->Institution_Name->setDbValue($rs->fields('Institution_Name')); $this->Address->setDbValue($rs->fields('Address')); $this->Phone->setDbValue($rs->fields('Phone')); $this->Phone_Mobile->setDbValue($rs->fields('Phone_Mobile')); $this->_Email->setDbValue($rs->fields('Email')); $this->Town->setDbValue($rs->fields('Town')); $this->District->setDbValue($rs->fields('District')); $this->Region->setDbValue($rs->fields('Region')); $this->Suggest_by->setDbValue($rs->fields('Suggest_by')); $this->Suggest_by_note->setDbValue($rs->fields('Suggest_by_note')); $this->Referent->setDbValue($rs->fields('Referent')); $this->add_network->setDbValue($rs->fields('add_network')); $this->add_documents->setDbValue($rs->fields('add_documents')); $this->add_care->setDbValue($rs->fields('add_care')); $this->add_food->setDbValue($rs->fields('add_food')); $this->add_clothes->setDbValue($rs->fields('add_clothes')); $this->add_utilities->setDbValue($rs->fields('add_utilities')); $this->add_job->setDbValue($rs->fields('add_job')); } // Load DbValue from recordset function LoadDbValues(&$rs) { if (!$rs || !is_array($rs) && $rs->EOF) return; $row = is_array($rs) ? $rs : $rs->fields; $this->idOfferer->DbValue = $row['idOfferer']; $this->Name->DbValue = $row['Name']; $this->Surname->DbValue = $row['Surname']; $this->Institution_Type->DbValue = $row['Institution_Type']; $this->Institution_Name->DbValue = $row['Institution_Name']; $this->Address->DbValue = $row['Address']; $this->Phone->DbValue = $row['Phone']; $this->Phone_Mobile->DbValue = $row['Phone_Mobile']; $this->_Email->DbValue = $row['Email']; $this->Town->DbValue = $row['Town']; $this->District->DbValue = $row['District']; $this->Region->DbValue = $row['Region']; $this->Suggest_by->DbValue = $row['Suggest_by']; $this->Suggest_by_note->DbValue = $row['Suggest_by_note']; $this->Referent->DbValue = $row['Referent']; $this->add_network->DbValue = $row['add_network']; $this->add_documents->DbValue = $row['add_documents']; $this->add_care->DbValue = $row['add_care']; $this->add_food->DbValue = $row['add_food']; $this->add_clothes->DbValue = $row['add_clothes']; $this->add_utilities->DbValue = $row['add_utilities']; $this->add_job->DbValue = $row['add_job']; } // Render row values based on field settings function RenderRow() { global $Security, $Language, $gsLanguage; // Initialize URLs // Call Row_Rendering event $this->Row_Rendering(); // Common render codes for all row types // idOfferer // Name // Surname // Institution_Type // Institution_Name // Address // Phone // Phone_Mobile // Email // Town // District // Region // Suggest_by // Suggest_by_note // Referent // add_network $this->add_network->CellCssStyle = "white-space: nowrap;"; // add_documents // add_care // add_food // add_clothes // add_utilities // add_job if ($this->RowType == EW_ROWTYPE_VIEW) { // View row // idOfferer $this->idOfferer->ViewValue = $this->idOfferer->CurrentValue; $this->idOfferer->ViewCustomAttributes = ""; // Name $this->Name->ViewValue = $this->Name->CurrentValue; $this->Name->ViewCustomAttributes = ""; // Surname $this->Surname->ViewValue = $this->Surname->CurrentValue; $this->Surname->ViewCustomAttributes = ""; // Institution_Type if (strval($this->Institution_Type->CurrentValue) <> "") { $sFilterWrk = "`Institution_Type`" . ew_SearchString("=", $this->Institution_Type->CurrentValue, EW_DATATYPE_STRING, ""); switch (@$gsLanguage) { case "en": $sSqlWrk = "SELECT `Institution_Type`, `Description` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tinstitutions`"; $sWhereWrk = ""; $this->Institution_Type->LookupFilters = array(); break; case "it": $sSqlWrk = "SELECT `Institution_Type`, `Description_it` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tinstitutions`"; $sWhereWrk = ""; $this->Institution_Type->LookupFilters = array(); break; default: $sSqlWrk = "SELECT `Institution_Type`, `Description` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tinstitutions`"; $sWhereWrk = ""; $this->Institution_Type->LookupFilters = array(); break; } ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->Institution_Type, $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->Institution_Type->ViewValue = $this->Institution_Type->DisplayValue($arwrk); $rswrk->Close(); } else { $this->Institution_Type->ViewValue = $this->Institution_Type->CurrentValue; } } else { $this->Institution_Type->ViewValue = NULL; } $this->Institution_Type->ViewCustomAttributes = ""; // Institution_Name $this->Institution_Name->ViewValue = $this->Institution_Name->CurrentValue; $this->Institution_Name->ViewCustomAttributes = ""; // Address $this->Address->ViewValue = $this->Address->CurrentValue; $this->Address->ViewCustomAttributes = ""; // Phone $this->Phone->ViewValue = $this->Phone->CurrentValue; $this->Phone->ViewCustomAttributes = ""; // Phone_Mobile $this->Phone_Mobile->ViewValue = $this->Phone_Mobile->CurrentValue; $this->Phone_Mobile->ViewCustomAttributes = ""; // Email $this->_Email->ViewValue = $this->_Email->CurrentValue; $this->_Email->ViewCustomAttributes = ""; // Town $this->Town->ViewValue = $this->Town->CurrentValue; $this->Town->ViewCustomAttributes = ""; // District $this->District->ViewValue = $this->District->CurrentValue; $this->District->ViewCustomAttributes = ""; // Region $this->Region->ViewValue = $this->Region->CurrentValue; $this->Region->ViewCustomAttributes = ""; // Suggest_by if (strval($this->Suggest_by->CurrentValue) <> "") { $sFilterWrk = "`suggesttype`" . ew_SearchString("=", $this->Suggest_by->CurrentValue, EW_DATATYPE_STRING, ""); switch (@$gsLanguage) { case "en": $sSqlWrk = "SELECT `suggesttype`, `Description` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tsuggest_type`"; $sWhereWrk = ""; $this->Suggest_by->LookupFilters = array(); break; case "it": $sSqlWrk = "SELECT `suggesttype`, `Description_IT` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tsuggest_type`"; $sWhereWrk = ""; $this->Suggest_by->LookupFilters = array(); break; default: $sSqlWrk = "SELECT `suggesttype`, `Description` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `tsuggest_type`"; $sWhereWrk = ""; $this->Suggest_by->LookupFilters = array(); break; } ew_AddFilter($sWhereWrk, $sFilterWrk); $this->Lookup_Selecting($this->Suggest_by, $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->Suggest_by->ViewValue = $this->Suggest_by->DisplayValue($arwrk); $rswrk->Close(); } else { $this->Suggest_by->ViewValue = $this->Suggest_by->CurrentValue; } } else { $this->Suggest_by->ViewValue = NULL; } $this->Suggest_by->ViewCustomAttributes = ""; // Referent $this->Referent->ViewValue = $this->Referent->CurrentValue; $this->Referent->ViewCustomAttributes = ""; // add_documents if (ew_ConvertToBool($this->add_documents->CurrentValue)) { $this->add_documents->ViewValue = $this->add_documents->FldTagCaption(1) <> "" ? $this->add_documents->FldTagCaption(1) : "Y"; } else { $this->add_documents->ViewValue = $this->add_documents->FldTagCaption(2) <> "" ? $this->add_documents->FldTagCaption(2) : "N"; } $this->add_documents->ViewCustomAttributes = ""; // add_care if (ew_ConvertToBool($this->add_care->CurrentValue)) { $this->add_care->ViewValue = $this->add_care->FldTagCaption(1) <> "" ? $this->add_care->FldTagCaption(1) : "Y"; } else { $this->add_care->ViewValue = $this->add_care->FldTagCaption(2) <> "" ? $this->add_care->FldTagCaption(2) : "N"; } $this->add_care->ViewCustomAttributes = ""; // add_food if (ew_ConvertToBool($this->add_food->CurrentValue)) { $this->add_food->ViewValue = $this->add_food->FldTagCaption(1) <> "" ? $this->add_food->FldTagCaption(1) : "Y"; } else { $this->add_food->ViewValue = $this->add_food->FldTagCaption(2) <> "" ? $this->add_food->FldTagCaption(2) : "N"; } $this->add_food->ViewCustomAttributes = ""; // add_clothes if (ew_ConvertToBool($this->add_clothes->CurrentValue)) { $this->add_clothes->ViewValue = $this->add_clothes->FldTagCaption(1) <> "" ? $this->add_clothes->FldTagCaption(1) : "Y"; } else { $this->add_clothes->ViewValue = $this->add_clothes->FldTagCaption(2) <> "" ? $this->add_clothes->FldTagCaption(2) : "N"; } $this->add_clothes->ViewCustomAttributes = ""; // add_utilities if (ew_ConvertToBool($this->add_utilities->CurrentValue)) { $this->add_utilities->ViewValue = $this->add_utilities->FldTagCaption(1) <> "" ? $this->add_utilities->FldTagCaption(1) : "Y"; } else { $this->add_utilities->ViewValue = $this->add_utilities->FldTagCaption(2) <> "" ? $this->add_utilities->FldTagCaption(2) : "N"; } $this->add_utilities->ViewCustomAttributes = ""; // add_job if (ew_ConvertToBool($this->add_job->CurrentValue)) { $this->add_job->ViewValue = $this->add_job->FldTagCaption(1) <> "" ? $this->add_job->FldTagCaption(1) : "Y"; } else { $this->add_job->ViewValue = $this->add_job->FldTagCaption(2) <> "" ? $this->add_job->FldTagCaption(2) : "N"; } $this->add_job->ViewCustomAttributes = ""; // Name $this->Name->LinkCustomAttributes = ""; $this->Name->HrefValue = ""; $this->Name->TooltipValue = ""; // Surname $this->Surname->LinkCustomAttributes = ""; $this->Surname->HrefValue = ""; $this->Surname->TooltipValue = ""; // Institution_Type $this->Institution_Type->LinkCustomAttributes = ""; $this->Institution_Type->HrefValue = ""; $this->Institution_Type->TooltipValue = ""; // Institution_Name $this->Institution_Name->LinkCustomAttributes = ""; $this->Institution_Name->HrefValue = ""; $this->Institution_Name->TooltipValue = ""; // Address $this->Address->LinkCustomAttributes = ""; $this->Address->HrefValue = ""; $this->Address->TooltipValue = ""; // Phone $this->Phone->LinkCustomAttributes = ""; $this->Phone->HrefValue = ""; $this->Phone->TooltipValue = ""; // Phone_Mobile $this->Phone_Mobile->LinkCustomAttributes = ""; $this->Phone_Mobile->HrefValue = ""; $this->Phone_Mobile->TooltipValue = ""; // Town $this->Town->LinkCustomAttributes = ""; $this->Town->HrefValue = ""; $this->Town->TooltipValue = ""; } // Call Row Rendered event if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT) $this->Row_Rendered(); } // // Delete records based on current filter // function DeleteRows() { global $Language, $Security; if (!$Security->CanDelete()) { $this->setFailureMessage($Language->Phrase("NoDeletePermission")); // No delete permission return FALSE; } $DeleteRows = TRUE; $sSql = $this->SQL(); $conn = &$this->Connection(); $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) { return FALSE; } elseif ($rs->EOF) { $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found $rs->Close(); return FALSE; //} else { // $this->LoadRowValues($rs); // Load row values } $rows = ($rs) ? $rs->GetRows() : array(); $conn->BeginTrans(); // Clone old rows $rsold = $rows; if ($rs) $rs->Close(); // Call row deleting event if ($DeleteRows) { foreach ($rsold as $row) { $DeleteRows = $this->Row_Deleting($row); if (!$DeleteRows) break; } } if ($DeleteRows) { $sKey = ""; foreach ($rsold as $row) { $sThisKey = ""; if ($sThisKey <> "") $sThisKey .= $GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"]; $sThisKey .= $row['idOfferer']; $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $DeleteRows = $this->Delete($row); // Delete $conn->raiseErrorFn = ''; if ($DeleteRows === FALSE) break; if ($sKey <> "") $sKey .= ", "; $sKey .= $sThisKey; } } else { // Set up error message if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") { // Use the message, do nothing } elseif ($this->CancelMessage <> "") { $this->setFailureMessage($this->CancelMessage); $this->CancelMessage = ""; } else { $this->setFailureMessage($Language->Phrase("DeleteCancelled")); } } if ($DeleteRows) { $conn->CommitTrans(); // Commit the changes } else { $conn->RollbackTrans(); // Rollback changes } // Call Row Deleted event if ($DeleteRows) { foreach ($rsold as $row) { $this->Row_Deleted($row); } } return $DeleteRows; } // Set up Breadcrumb function SetupBreadcrumb() { global $Breadcrumb, $Language; $Breadcrumb = new cBreadcrumb(); $url = substr(ew_CurrentUrl(), strrpos(ew_CurrentUrl(), "/")+1); $Breadcrumb->Add("list", $this->TableVar, $this->AddMasterUrl("toffererslist.php"), "", $this->TableVar, TRUE); $PageId = "delete"; $Breadcrumb->Add("delete", $PageId, $url); } // Setup lookup filters of a field function SetupLookupFilters($fld, $pageId = null) { global $gsLanguage; $pageId = $pageId ?: $this->PageID; switch ($fld->FldVar) { } } // Setup AutoSuggest filters of a field function SetupAutoSuggestFilters($fld, $pageId = null) { global $gsLanguage; $pageId = $pageId ?: $this->PageID; switch ($fld->FldVar) { } } // 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"; } } ?> Page_Init(); // Page main $tofferers_delete->Page_Main(); // Global Page Rendering event (in userfn*.php) Page_Rendering(); // Page Rendering event $tofferers_delete->Page_Render(); ?>
Render(); ?> SelectionForm(); ?>
ShowPageHeader(); ?> ShowMessage(); ?>
CheckToken) { ?> RecKeys as $key) { ?>
ewGridMiddlePanel"> TableCustomInnerHtml ?> Name->Visible) { // Name ?> Surname->Visible) { // Surname ?> Institution_Type->Visible) { // Institution_Type ?> Institution_Name->Visible) { // Institution_Name ?> Address->Visible) { // Address ?> Phone->Visible) { // Phone ?> Phone_Mobile->Visible) { // Phone_Mobile ?> Town->Visible) { // Town ?> RecCnt = 0; $i = 0; while (!$tofferers_delete->Recordset->EOF) { $tofferers_delete->RecCnt++; $tofferers_delete->RowCnt++; // Set row properties $tofferers->ResetAttrs(); $tofferers->RowType = EW_ROWTYPE_VIEW; // View // Get the field contents $tofferers_delete->LoadRowValues($tofferers_delete->Recordset); // Render row $tofferers_delete->RenderRow(); ?> RowAttributes() ?>> Name->Visible) { // Name ?> Name->CellAttributes() ?>> Name->ViewAttributes() ?>> Name->ListViewValue() ?> Surname->Visible) { // Surname ?> Surname->CellAttributes() ?>> Surname->ViewAttributes() ?>> Surname->ListViewValue() ?> Institution_Type->Visible) { // Institution_Type ?> Institution_Type->CellAttributes() ?>> Institution_Type->ViewAttributes() ?>> Institution_Type->ListViewValue() ?> Institution_Name->Visible) { // Institution_Name ?> Institution_Name->CellAttributes() ?>> Institution_Name->ViewAttributes() ?>> Institution_Name->ListViewValue() ?> Address->Visible) { // Address ?> Address->CellAttributes() ?>> Address->ViewAttributes() ?>> Address->ListViewValue() ?> Phone->Visible) { // Phone ?> Phone->CellAttributes() ?>> Phone->ViewAttributes() ?>> Phone->ListViewValue() ?> Phone_Mobile->Visible) { // Phone_Mobile ?> Phone_Mobile->CellAttributes() ?>> Phone_Mobile->ViewAttributes() ?>> Phone_Mobile->ListViewValue() ?> Town->Visible) { // Town ?> Town->CellAttributes() ?>> Town->ViewAttributes() ?>> Town->ListViewValue() ?> Recordset->MoveNext(); } $tofferers_delete->Recordset->Close(); ?>
Name->FldCaption() ?> Surname->FldCaption() ?> Institution_Type->FldCaption() ?> Institution_Name->FldCaption() ?> Address->FldCaption() ?> Phone->FldCaption() ?> Phone_Mobile->FldCaption() ?> Town->FldCaption() ?>
ShowPageFooter(); if (EW_DEBUG_ENABLED) echo ew_DebugMsg(); ?> Page_Terminate(); ?>