UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token return $PageUrl; } // Page URLs var $AddUrl; var $EditUrl; var $CopyUrl; var $DeleteUrl; var $ViewUrl; var $ListUrl; // Export URLs var $ExportPrintUrl; var $ExportHtmlUrl; var $ExportExcelUrl; var $ExportWordUrl; var $ExportXmlUrl; var $ExportCsvUrl; var $ExportPdfUrl; // Custom export var $ExportExcelCustom = FALSE; var $ExportWordCustom = FALSE; var $ExportPdfCustom = FALSE; var $ExportEmailCustom = FALSE; // Update URLs var $InlineAddUrl; var $InlineCopyUrl; var $InlineEditUrl; var $GridAddUrl; var $GridEditUrl; var $MultiDeleteUrl; var $MultiUpdateUrl; // 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 (tofferers) if (!isset($GLOBALS["tofferers"]) || get_class($GLOBALS["tofferers"]) == "ctofferers") { $GLOBALS["tofferers"] = &$this; $GLOBALS["Table"] = &$GLOBALS["tofferers"]; } // Initialize URLs $this->ExportPrintUrl = $this->PageUrl() . "export=print"; $this->ExportExcelUrl = $this->PageUrl() . "export=excel"; $this->ExportWordUrl = $this->PageUrl() . "export=word"; $this->ExportHtmlUrl = $this->PageUrl() . "export=html"; $this->ExportXmlUrl = $this->PageUrl() . "export=xml"; $this->ExportCsvUrl = $this->PageUrl() . "export=csv"; $this->ExportPdfUrl = $this->PageUrl() . "export=pdf"; $this->AddUrl = "tofferersadd.php?" . EW_TABLE_SHOW_DETAIL . "="; $this->InlineAddUrl = $this->PageUrl() . "a=add"; $this->GridAddUrl = $this->PageUrl() . "a=gridadd"; $this->GridEditUrl = $this->PageUrl() . "a=gridedit"; $this->MultiDeleteUrl = "tofferersdelete.php"; $this->MultiUpdateUrl = "tofferersupdate.php"; // Table object (users) if (!isset($GLOBALS['users'])) $GLOBALS['users'] = new cusers(); // Page ID if (!defined("EW_PAGE_ID")) define("EW_PAGE_ID", 'list', 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); } // List options $this->ListOptions = new cListOptions(); $this->ListOptions->TableVar = $this->TableVar; // Export options $this->ExportOptions = new cListOptions(); $this->ExportOptions->Tag = "div"; $this->ExportOptions->TagClassName = "ewExportOption"; // Other options $this->OtherOptions['addedit'] = new cListOptions(); $this->OtherOptions['addedit']->Tag = "div"; $this->OtherOptions['addedit']->TagClassName = "ewAddEditOption"; $this->OtherOptions['detail'] = new cListOptions(); $this->OtherOptions['detail']->Tag = "div"; $this->OtherOptions['detail']->TagClassName = "ewDetailOption"; $this->OtherOptions['action'] = new cListOptions(); $this->OtherOptions['action']->Tag = "div"; $this->OtherOptions['action']->TagClassName = "ewActionOption"; // Filter options $this->FilterOptions = new cListOptions(); $this->FilterOptions->Tag = "div"; $this->FilterOptions->TagClassName = "ewFilterOption ftoffererslistsrch"; // List actions $this->ListActions = new cListActions(); } // // 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->CanList()) { $Security->SaveLastUrl(); $this->setFailureMessage(ew_DeniedMsg()); // Set no permission $this->Page_Terminate(ew_GetUrl("index.php")); } // Get export parameters $custom = ""; if (@$_GET["export"] <> "") { $this->Export = $_GET["export"]; $custom = @$_GET["custom"]; } elseif (@$_POST["export"] <> "") { $this->Export = $_POST["export"]; $custom = @$_POST["custom"]; } elseif (ew_IsHttpPost()) { if (@$_POST["exporttype"] <> "") $this->Export = $_POST["exporttype"]; $custom = @$_POST["custom"]; } else { $this->setExportReturnUrl(ew_CurrentUrl()); } $gsExportFile = $this->TableVar; // Get export file, used in header // Get custom export parameters if ($this->Export <> "" && $custom <> "") { $this->CustomExport = $this->Export; $this->Export = "print"; } $gsCustomExport = $this->CustomExport; $gsExport = $this->Export; // Get export parameter, used in header // Update Export URLs if (defined("EW_USE_PHPEXCEL")) $this->ExportExcelCustom = FALSE; if ($this->ExportExcelCustom) $this->ExportExcelUrl .= "&custom=1"; if (defined("EW_USE_PHPWORD")) $this->ExportWordCustom = FALSE; if ($this->ExportWordCustom) $this->ExportWordUrl .= "&custom=1"; if ($this->ExportPdfCustom) $this->ExportPdfUrl .= "&custom=1"; $this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action // Get grid add count $gridaddcnt = @$_GET[EW_TABLE_GRID_ADD_ROW_COUNT]; if (is_numeric($gridaddcnt) && $gridaddcnt > 0) $this->GridAddRowCount = $gridaddcnt; // Set up list options $this->SetupListOptions(); // Setup export options $this->SetupExportOptions(); $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(); } // Process auto fill if (@$_POST["ajax"] == "autofill") { // Process auto fill for detail table 'taccomodations' if (@$_POST["grid"] == "ftaccomodationsgrid") { if (!isset($GLOBALS["taccomodations_grid"])) $GLOBALS["taccomodations_grid"] = new ctaccomodations_grid; $GLOBALS["taccomodations_grid"]->Page_Init(); $this->Page_Terminate(); exit(); } $results = $this->GetAutoFill(@$_POST["name"], @$_POST["q"]); if ($results) { // Clean output buffer if (!EW_DEBUG_ENABLED && ob_get_length()) ob_end_clean(); echo $results; $this->Page_Terminate(); exit(); } } // Create Token $this->CreateToken(); // Setup other options $this->SetupOtherOptions(); // Set up custom action (compatible with old version) foreach ($this->CustomActions as $name => $action) $this->ListActions->Add($name, $action); // Show checkbox column if multiple action foreach ($this->ListActions->Items as $listaction) { if ($listaction->Select == EW_ACTION_MULTIPLE && $listaction->Allow) { $this->ListOptions->Items["checkbox"]->Visible = TRUE; break; } } } // // 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(); } // Class variables var $ListOptions; // List options var $ExportOptions; // Export options var $SearchOptions; // Search options var $OtherOptions = array(); // Other options var $FilterOptions; // Filter options var $ListActions; // List actions var $SelectedCount = 0; var $SelectedIndex = 0; var $DisplayRecs = 20; var $StartRec; var $StopRec; var $TotalRecs = 0; var $RecRange = 10; var $Pager; var $DefaultSearchWhere = ""; // Default search WHERE clause var $SearchWhere = ""; // Search WHERE clause var $RecCnt = 0; // Record count var $EditRowCnt; var $StartRowCnt = 1; var $RowCnt = 0; var $Attrs = array(); // Row attributes and cell attributes var $RowIndex = 0; // Row index var $KeyCount = 0; // Key count var $RowAction = ""; // Row action var $RowOldKey = ""; // Row old key (for copy) var $RecPerRow = 0; var $MultiColumnClass; var $MultiColumnEditClass = "col-sm-12"; var $MultiColumnCnt = 12; var $MultiColumnEditCnt = 12; var $GridCnt = 0; var $ColCnt = 0; var $DbMasterFilter = ""; // Master filter var $DbDetailFilter = ""; // Detail filter var $MasterRecordExists; var $MultiSelectKey; var $Command; var $RestoreSearch = FALSE; var $taccomodations_Count; var $DetailPages; var $Recordset; var $OldRecordset; // // Page main // function Page_Main() { global $objForm, $Language, $gsFormError, $gsSearchError, $Security; // Search filters $sSrchAdvanced = ""; // Advanced search filter $sSrchBasic = ""; // Basic search filter $sFilter = ""; // Get command $this->Command = strtolower(@$_GET["cmd"]); if ($this->IsPageRequest()) { // Validate request // Process list action first if ($this->ProcessListAction()) // Ajax request $this->Page_Terminate(); // Set up records per page $this->SetUpDisplayRecs(); // Handle reset command $this->ResetCmd(); // Set up Breadcrumb if ($this->Export == "") $this->SetupBreadcrumb(); // Hide list options if ($this->Export <> "") { $this->ListOptions->HideAllOptions(array("sequence")); $this->ListOptions->UseDropDownButton = FALSE; // Disable drop down button $this->ListOptions->UseButtonGroup = FALSE; // Disable button group } elseif ($this->CurrentAction == "gridadd" || $this->CurrentAction == "gridedit") { $this->ListOptions->HideAllOptions(); $this->ListOptions->UseDropDownButton = FALSE; // Disable drop down button $this->ListOptions->UseButtonGroup = FALSE; // Disable button group } // Hide options if ($this->Export <> "" || $this->CurrentAction <> "") { $this->ExportOptions->HideAllOptions(); $this->FilterOptions->HideAllOptions(); } // Hide other options if ($this->Export <> "") { foreach ($this->OtherOptions as &$option) $option->HideAllOptions(); } // Get default search criteria ew_AddFilter($this->DefaultSearchWhere, $this->BasicSearchWhere(TRUE)); // Get basic search values $this->LoadBasicSearchValues(); // Process filter list $this->ProcessFilterList(); // Restore search parms from Session if not searching / reset / export if (($this->Export <> "" || $this->Command <> "search" && $this->Command <> "reset" && $this->Command <> "resetall") && $this->CheckSearchParms()) $this->RestoreSearchParms(); // Call Recordset SearchValidated event $this->Recordset_SearchValidated(); // Set up sorting order $this->SetUpSortOrder(); // Get basic search criteria if ($gsSearchError == "") $sSrchBasic = $this->BasicSearchWhere(); } // Restore display records if ($this->getRecordsPerPage() <> "") { $this->DisplayRecs = $this->getRecordsPerPage(); // Restore from Session } else { $this->DisplayRecs = 20; // Load default } // Load Sorting Order $this->LoadSortOrder(); // Load search default if no existing search criteria if (!$this->CheckSearchParms()) { // Load basic search from default $this->BasicSearch->LoadDefault(); if ($this->BasicSearch->Keyword != "") $sSrchBasic = $this->BasicSearchWhere(); } // Build search criteria ew_AddFilter($this->SearchWhere, $sSrchAdvanced); ew_AddFilter($this->SearchWhere, $sSrchBasic); // Call Recordset_Searching event $this->Recordset_Searching($this->SearchWhere); // Save search criteria if ($this->Command == "search" && !$this->RestoreSearch) { $this->setSearchWhere($this->SearchWhere); // Save to Session $this->StartRec = 1; // Reset start record counter $this->setStartRecordNumber($this->StartRec); } else { $this->SearchWhere = $this->getSearchWhere(); } // Build filter $sFilter = ""; if (!$Security->CanList()) $sFilter = "(0=1)"; // Filter all records ew_AddFilter($sFilter, $this->DbDetailFilter); ew_AddFilter($sFilter, $this->SearchWhere); // Set up filter in session $this->setSessionWhere($sFilter); $this->CurrentFilter = ""; // Export data only if ($this->CustomExport == "" && in_array($this->Export, array("html","word","excel","xml","csv","email","pdf"))) { $this->ExportData(); $this->Page_Terminate(); // Terminate response exit(); } // Load record count first if (!$this->IsAddOrEdit()) { $bSelectLimit = $this->UseSelectLimit; if ($bSelectLimit) { $this->TotalRecs = $this->SelectRecordCount(); } else { if ($this->Recordset = $this->LoadRecordset()) $this->TotalRecs = $this->Recordset->RecordCount(); } } // Search options $this->SetupSearchOptions(); } // Set up number of records displayed per page function SetUpDisplayRecs() { $sWrk = @$_GET[EW_TABLE_REC_PER_PAGE]; if ($sWrk <> "") { if (is_numeric($sWrk)) { $this->DisplayRecs = intval($sWrk); } else { if (strtolower($sWrk) == "all") { // Display all records $this->DisplayRecs = -1; } else { $this->DisplayRecs = 20; // Non-numeric, load default } } $this->setRecordsPerPage($this->DisplayRecs); // Save to Session // Reset start position $this->StartRec = 1; $this->setStartRecordNumber($this->StartRec); } } // Build filter for all keys function BuildKeyFilter() { global $objForm; $sWrkFilter = ""; // Update row index and get row key $rowindex = 1; $objForm->Index = $rowindex; $sThisKey = strval($objForm->GetValue($this->FormKeyName)); while ($sThisKey <> "") { if ($this->SetupKeyValues($sThisKey)) { $sFilter = $this->KeyFilter(); if ($sWrkFilter <> "") $sWrkFilter .= " OR "; $sWrkFilter .= $sFilter; } else { $sWrkFilter = "0=1"; break; } // Update row index and get row key $rowindex++; // Next row $objForm->Index = $rowindex; $sThisKey = strval($objForm->GetValue($this->FormKeyName)); } return $sWrkFilter; } // Set up key values function SetupKeyValues($key) { $arrKeyFlds = explode($GLOBALS["EW_COMPOSITE_KEY_SEPARATOR"], $key); if (count($arrKeyFlds) >= 1) { $this->idOfferer->setFormValue($arrKeyFlds[0]); if (!is_numeric($this->idOfferer->FormValue)) return FALSE; } return TRUE; } // Get list of filters function GetFilterList() { global $UserProfile; // Load server side filters if (EW_SEARCH_FILTER_OPTION == "Server") { $sSavedFilterList = isset($UserProfile) ? $UserProfile->GetSearchFilters(CurrentUserName(), "ftoffererslistsrch") : ""; } else { $sSavedFilterList = ""; } // Initialize $sFilterList = ""; $sFilterList = ew_Concat($sFilterList, $this->idOfferer->AdvancedSearch->ToJSON(), ","); // Field idOfferer $sFilterList = ew_Concat($sFilterList, $this->Name->AdvancedSearch->ToJSON(), ","); // Field Name $sFilterList = ew_Concat($sFilterList, $this->Surname->AdvancedSearch->ToJSON(), ","); // Field Surname $sFilterList = ew_Concat($sFilterList, $this->Institution_Type->AdvancedSearch->ToJSON(), ","); // Field Institution_Type $sFilterList = ew_Concat($sFilterList, $this->Institution_Name->AdvancedSearch->ToJSON(), ","); // Field Institution_Name $sFilterList = ew_Concat($sFilterList, $this->Address->AdvancedSearch->ToJSON(), ","); // Field Address $sFilterList = ew_Concat($sFilterList, $this->Phone->AdvancedSearch->ToJSON(), ","); // Field Phone $sFilterList = ew_Concat($sFilterList, $this->Phone_Mobile->AdvancedSearch->ToJSON(), ","); // Field Phone_Mobile $sFilterList = ew_Concat($sFilterList, $this->_Email->AdvancedSearch->ToJSON(), ","); // Field Email $sFilterList = ew_Concat($sFilterList, $this->Town->AdvancedSearch->ToJSON(), ","); // Field Town $sFilterList = ew_Concat($sFilterList, $this->District->AdvancedSearch->ToJSON(), ","); // Field District $sFilterList = ew_Concat($sFilterList, $this->Region->AdvancedSearch->ToJSON(), ","); // Field Region $sFilterList = ew_Concat($sFilterList, $this->Suggest_by->AdvancedSearch->ToJSON(), ","); // Field Suggest_by $sFilterList = ew_Concat($sFilterList, $this->Suggest_by_note->AdvancedSearch->ToJSON(), ","); // Field Suggest_by_note $sFilterList = ew_Concat($sFilterList, $this->Referent->AdvancedSearch->ToJSON(), ","); // Field Referent $sFilterList = ew_Concat($sFilterList, $this->add_documents->AdvancedSearch->ToJSON(), ","); // Field add_documents $sFilterList = ew_Concat($sFilterList, $this->add_care->AdvancedSearch->ToJSON(), ","); // Field add_care $sFilterList = ew_Concat($sFilterList, $this->add_food->AdvancedSearch->ToJSON(), ","); // Field add_food $sFilterList = ew_Concat($sFilterList, $this->add_clothes->AdvancedSearch->ToJSON(), ","); // Field add_clothes $sFilterList = ew_Concat($sFilterList, $this->add_utilities->AdvancedSearch->ToJSON(), ","); // Field add_utilities $sFilterList = ew_Concat($sFilterList, $this->add_job->AdvancedSearch->ToJSON(), ","); // Field add_job if ($this->BasicSearch->Keyword <> "") { $sWrk = "\"" . EW_TABLE_BASIC_SEARCH . "\":\"" . ew_JsEncode2($this->BasicSearch->Keyword) . "\",\"" . EW_TABLE_BASIC_SEARCH_TYPE . "\":\"" . ew_JsEncode2($this->BasicSearch->Type) . "\""; $sFilterList = ew_Concat($sFilterList, $sWrk, ","); } $sFilterList = preg_replace('/,$/', "", $sFilterList); // Return filter list in json if ($sFilterList <> "") $sFilterList = "\"data\":{" . $sFilterList . "}"; if ($sSavedFilterList <> "") { if ($sFilterList <> "") $sFilterList .= ","; $sFilterList .= "\"filters\":" . $sSavedFilterList; } return ($sFilterList <> "") ? "{" . $sFilterList . "}" : "null"; } // Process filter list function ProcessFilterList() { global $UserProfile; if (@$_POST["ajax"] == "savefilters") { // Save filter request (Ajax) $filters = ew_StripSlashes(@$_POST["filters"]); $UserProfile->SetSearchFilters(CurrentUserName(), "ftoffererslistsrch", $filters); // Clean output buffer if (!EW_DEBUG_ENABLED && ob_get_length()) ob_end_clean(); echo ew_ArrayToJson(array(array("success" => TRUE))); // Success $this->Page_Terminate(); exit(); } elseif (@$_POST["cmd"] == "resetfilter") { $this->RestoreFilterList(); } } // Restore list of filters function RestoreFilterList() { // Return if not reset filter if (@$_POST["cmd"] <> "resetfilter") return FALSE; $filter = json_decode(ew_StripSlashes(@$_POST["filter"]), TRUE); $this->Command = "search"; // Field idOfferer $this->idOfferer->AdvancedSearch->SearchValue = @$filter["x_idOfferer"]; $this->idOfferer->AdvancedSearch->SearchOperator = @$filter["z_idOfferer"]; $this->idOfferer->AdvancedSearch->SearchCondition = @$filter["v_idOfferer"]; $this->idOfferer->AdvancedSearch->SearchValue2 = @$filter["y_idOfferer"]; $this->idOfferer->AdvancedSearch->SearchOperator2 = @$filter["w_idOfferer"]; $this->idOfferer->AdvancedSearch->Save(); // Field Name $this->Name->AdvancedSearch->SearchValue = @$filter["x_Name"]; $this->Name->AdvancedSearch->SearchOperator = @$filter["z_Name"]; $this->Name->AdvancedSearch->SearchCondition = @$filter["v_Name"]; $this->Name->AdvancedSearch->SearchValue2 = @$filter["y_Name"]; $this->Name->AdvancedSearch->SearchOperator2 = @$filter["w_Name"]; $this->Name->AdvancedSearch->Save(); // Field Surname $this->Surname->AdvancedSearch->SearchValue = @$filter["x_Surname"]; $this->Surname->AdvancedSearch->SearchOperator = @$filter["z_Surname"]; $this->Surname->AdvancedSearch->SearchCondition = @$filter["v_Surname"]; $this->Surname->AdvancedSearch->SearchValue2 = @$filter["y_Surname"]; $this->Surname->AdvancedSearch->SearchOperator2 = @$filter["w_Surname"]; $this->Surname->AdvancedSearch->Save(); // Field Institution_Type $this->Institution_Type->AdvancedSearch->SearchValue = @$filter["x_Institution_Type"]; $this->Institution_Type->AdvancedSearch->SearchOperator = @$filter["z_Institution_Type"]; $this->Institution_Type->AdvancedSearch->SearchCondition = @$filter["v_Institution_Type"]; $this->Institution_Type->AdvancedSearch->SearchValue2 = @$filter["y_Institution_Type"]; $this->Institution_Type->AdvancedSearch->SearchOperator2 = @$filter["w_Institution_Type"]; $this->Institution_Type->AdvancedSearch->Save(); // Field Institution_Name $this->Institution_Name->AdvancedSearch->SearchValue = @$filter["x_Institution_Name"]; $this->Institution_Name->AdvancedSearch->SearchOperator = @$filter["z_Institution_Name"]; $this->Institution_Name->AdvancedSearch->SearchCondition = @$filter["v_Institution_Name"]; $this->Institution_Name->AdvancedSearch->SearchValue2 = @$filter["y_Institution_Name"]; $this->Institution_Name->AdvancedSearch->SearchOperator2 = @$filter["w_Institution_Name"]; $this->Institution_Name->AdvancedSearch->Save(); // Field Address $this->Address->AdvancedSearch->SearchValue = @$filter["x_Address"]; $this->Address->AdvancedSearch->SearchOperator = @$filter["z_Address"]; $this->Address->AdvancedSearch->SearchCondition = @$filter["v_Address"]; $this->Address->AdvancedSearch->SearchValue2 = @$filter["y_Address"]; $this->Address->AdvancedSearch->SearchOperator2 = @$filter["w_Address"]; $this->Address->AdvancedSearch->Save(); // Field Phone $this->Phone->AdvancedSearch->SearchValue = @$filter["x_Phone"]; $this->Phone->AdvancedSearch->SearchOperator = @$filter["z_Phone"]; $this->Phone->AdvancedSearch->SearchCondition = @$filter["v_Phone"]; $this->Phone->AdvancedSearch->SearchValue2 = @$filter["y_Phone"]; $this->Phone->AdvancedSearch->SearchOperator2 = @$filter["w_Phone"]; $this->Phone->AdvancedSearch->Save(); // Field Phone_Mobile $this->Phone_Mobile->AdvancedSearch->SearchValue = @$filter["x_Phone_Mobile"]; $this->Phone_Mobile->AdvancedSearch->SearchOperator = @$filter["z_Phone_Mobile"]; $this->Phone_Mobile->AdvancedSearch->SearchCondition = @$filter["v_Phone_Mobile"]; $this->Phone_Mobile->AdvancedSearch->SearchValue2 = @$filter["y_Phone_Mobile"]; $this->Phone_Mobile->AdvancedSearch->SearchOperator2 = @$filter["w_Phone_Mobile"]; $this->Phone_Mobile->AdvancedSearch->Save(); // Field Email $this->_Email->AdvancedSearch->SearchValue = @$filter["x__Email"]; $this->_Email->AdvancedSearch->SearchOperator = @$filter["z__Email"]; $this->_Email->AdvancedSearch->SearchCondition = @$filter["v__Email"]; $this->_Email->AdvancedSearch->SearchValue2 = @$filter["y__Email"]; $this->_Email->AdvancedSearch->SearchOperator2 = @$filter["w__Email"]; $this->_Email->AdvancedSearch->Save(); // Field Town $this->Town->AdvancedSearch->SearchValue = @$filter["x_Town"]; $this->Town->AdvancedSearch->SearchOperator = @$filter["z_Town"]; $this->Town->AdvancedSearch->SearchCondition = @$filter["v_Town"]; $this->Town->AdvancedSearch->SearchValue2 = @$filter["y_Town"]; $this->Town->AdvancedSearch->SearchOperator2 = @$filter["w_Town"]; $this->Town->AdvancedSearch->Save(); // Field District $this->District->AdvancedSearch->SearchValue = @$filter["x_District"]; $this->District->AdvancedSearch->SearchOperator = @$filter["z_District"]; $this->District->AdvancedSearch->SearchCondition = @$filter["v_District"]; $this->District->AdvancedSearch->SearchValue2 = @$filter["y_District"]; $this->District->AdvancedSearch->SearchOperator2 = @$filter["w_District"]; $this->District->AdvancedSearch->Save(); // Field Region $this->Region->AdvancedSearch->SearchValue = @$filter["x_Region"]; $this->Region->AdvancedSearch->SearchOperator = @$filter["z_Region"]; $this->Region->AdvancedSearch->SearchCondition = @$filter["v_Region"]; $this->Region->AdvancedSearch->SearchValue2 = @$filter["y_Region"]; $this->Region->AdvancedSearch->SearchOperator2 = @$filter["w_Region"]; $this->Region->AdvancedSearch->Save(); // Field Suggest_by $this->Suggest_by->AdvancedSearch->SearchValue = @$filter["x_Suggest_by"]; $this->Suggest_by->AdvancedSearch->SearchOperator = @$filter["z_Suggest_by"]; $this->Suggest_by->AdvancedSearch->SearchCondition = @$filter["v_Suggest_by"]; $this->Suggest_by->AdvancedSearch->SearchValue2 = @$filter["y_Suggest_by"]; $this->Suggest_by->AdvancedSearch->SearchOperator2 = @$filter["w_Suggest_by"]; $this->Suggest_by->AdvancedSearch->Save(); // Field Suggest_by_note $this->Suggest_by_note->AdvancedSearch->SearchValue = @$filter["x_Suggest_by_note"]; $this->Suggest_by_note->AdvancedSearch->SearchOperator = @$filter["z_Suggest_by_note"]; $this->Suggest_by_note->AdvancedSearch->SearchCondition = @$filter["v_Suggest_by_note"]; $this->Suggest_by_note->AdvancedSearch->SearchValue2 = @$filter["y_Suggest_by_note"]; $this->Suggest_by_note->AdvancedSearch->SearchOperator2 = @$filter["w_Suggest_by_note"]; $this->Suggest_by_note->AdvancedSearch->Save(); // Field Referent $this->Referent->AdvancedSearch->SearchValue = @$filter["x_Referent"]; $this->Referent->AdvancedSearch->SearchOperator = @$filter["z_Referent"]; $this->Referent->AdvancedSearch->SearchCondition = @$filter["v_Referent"]; $this->Referent->AdvancedSearch->SearchValue2 = @$filter["y_Referent"]; $this->Referent->AdvancedSearch->SearchOperator2 = @$filter["w_Referent"]; $this->Referent->AdvancedSearch->Save(); // Field add_documents $this->add_documents->AdvancedSearch->SearchValue = @$filter["x_add_documents"]; $this->add_documents->AdvancedSearch->SearchOperator = @$filter["z_add_documents"]; $this->add_documents->AdvancedSearch->SearchCondition = @$filter["v_add_documents"]; $this->add_documents->AdvancedSearch->SearchValue2 = @$filter["y_add_documents"]; $this->add_documents->AdvancedSearch->SearchOperator2 = @$filter["w_add_documents"]; $this->add_documents->AdvancedSearch->Save(); // Field add_care $this->add_care->AdvancedSearch->SearchValue = @$filter["x_add_care"]; $this->add_care->AdvancedSearch->SearchOperator = @$filter["z_add_care"]; $this->add_care->AdvancedSearch->SearchCondition = @$filter["v_add_care"]; $this->add_care->AdvancedSearch->SearchValue2 = @$filter["y_add_care"]; $this->add_care->AdvancedSearch->SearchOperator2 = @$filter["w_add_care"]; $this->add_care->AdvancedSearch->Save(); // Field add_food $this->add_food->AdvancedSearch->SearchValue = @$filter["x_add_food"]; $this->add_food->AdvancedSearch->SearchOperator = @$filter["z_add_food"]; $this->add_food->AdvancedSearch->SearchCondition = @$filter["v_add_food"]; $this->add_food->AdvancedSearch->SearchValue2 = @$filter["y_add_food"]; $this->add_food->AdvancedSearch->SearchOperator2 = @$filter["w_add_food"]; $this->add_food->AdvancedSearch->Save(); // Field add_clothes $this->add_clothes->AdvancedSearch->SearchValue = @$filter["x_add_clothes"]; $this->add_clothes->AdvancedSearch->SearchOperator = @$filter["z_add_clothes"]; $this->add_clothes->AdvancedSearch->SearchCondition = @$filter["v_add_clothes"]; $this->add_clothes->AdvancedSearch->SearchValue2 = @$filter["y_add_clothes"]; $this->add_clothes->AdvancedSearch->SearchOperator2 = @$filter["w_add_clothes"]; $this->add_clothes->AdvancedSearch->Save(); // Field add_utilities $this->add_utilities->AdvancedSearch->SearchValue = @$filter["x_add_utilities"]; $this->add_utilities->AdvancedSearch->SearchOperator = @$filter["z_add_utilities"]; $this->add_utilities->AdvancedSearch->SearchCondition = @$filter["v_add_utilities"]; $this->add_utilities->AdvancedSearch->SearchValue2 = @$filter["y_add_utilities"]; $this->add_utilities->AdvancedSearch->SearchOperator2 = @$filter["w_add_utilities"]; $this->add_utilities->AdvancedSearch->Save(); // Field add_job $this->add_job->AdvancedSearch->SearchValue = @$filter["x_add_job"]; $this->add_job->AdvancedSearch->SearchOperator = @$filter["z_add_job"]; $this->add_job->AdvancedSearch->SearchCondition = @$filter["v_add_job"]; $this->add_job->AdvancedSearch->SearchValue2 = @$filter["y_add_job"]; $this->add_job->AdvancedSearch->SearchOperator2 = @$filter["w_add_job"]; $this->add_job->AdvancedSearch->Save(); $this->BasicSearch->setKeyword(@$filter[EW_TABLE_BASIC_SEARCH]); $this->BasicSearch->setType(@$filter[EW_TABLE_BASIC_SEARCH_TYPE]); } // Return basic search SQL function BasicSearchSQL($arKeywords, $type) { $sWhere = ""; $this->BuildBasicSearchSQL($sWhere, $this->Name, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Surname, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Institution_Type, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Institution_Name, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Address, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Phone, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Phone_Mobile, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->_Email, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Town, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->District, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Region, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Suggest_by, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Suggest_by_note, $arKeywords, $type); $this->BuildBasicSearchSQL($sWhere, $this->Referent, $arKeywords, $type); return $sWhere; } // Build basic search SQL function BuildBasicSearchSQL(&$Where, &$Fld, $arKeywords, $type) { global $EW_BASIC_SEARCH_IGNORE_PATTERN; $sDefCond = ($type == "OR") ? "OR" : "AND"; $arSQL = array(); // Array for SQL parts $arCond = array(); // Array for search conditions $cnt = count($arKeywords); $j = 0; // Number of SQL parts for ($i = 0; $i < $cnt; $i++) { $Keyword = $arKeywords[$i]; $Keyword = trim($Keyword); if ($EW_BASIC_SEARCH_IGNORE_PATTERN <> "") { $Keyword = preg_replace($EW_BASIC_SEARCH_IGNORE_PATTERN, "\\", $Keyword); $ar = explode("\\", $Keyword); } else { $ar = array($Keyword); } foreach ($ar as $Keyword) { if ($Keyword <> "") { $sWrk = ""; if ($Keyword == "OR" && $type == "") { if ($j > 0) $arCond[$j-1] = "OR"; } elseif ($Keyword == EW_NULL_VALUE) { $sWrk = $Fld->FldExpression . " IS NULL"; } elseif ($Keyword == EW_NOT_NULL_VALUE) { $sWrk = $Fld->FldExpression . " IS NOT NULL"; } elseif ($Fld->FldIsVirtual) { $sWrk = $Fld->FldVirtualExpression . ew_Like(ew_QuotedValue("%" . $Keyword . "%", EW_DATATYPE_STRING, $this->DBID), $this->DBID); } elseif ($Fld->FldDataType != EW_DATATYPE_NUMBER || is_numeric($Keyword)) { $sWrk = $Fld->FldBasicSearchExpression . ew_Like(ew_QuotedValue("%" . $Keyword . "%", EW_DATATYPE_STRING, $this->DBID), $this->DBID); } if ($sWrk <> "") { $arSQL[$j] = $sWrk; $arCond[$j] = $sDefCond; $j += 1; } } } } $cnt = count($arSQL); $bQuoted = FALSE; $sSql = ""; if ($cnt > 0) { for ($i = 0; $i < $cnt-1; $i++) { if ($arCond[$i] == "OR") { if (!$bQuoted) $sSql .= "("; $bQuoted = TRUE; } $sSql .= $arSQL[$i]; if ($bQuoted && $arCond[$i] <> "OR") { $sSql .= ")"; $bQuoted = FALSE; } $sSql .= " " . $arCond[$i] . " "; } $sSql .= $arSQL[$cnt-1]; if ($bQuoted) $sSql .= ")"; } if ($sSql <> "") { if ($Where <> "") $Where .= " OR "; $Where .= "(" . $sSql . ")"; } } // Return basic search WHERE clause based on search keyword and type function BasicSearchWhere($Default = FALSE) { global $Security; $sSearchStr = ""; if (!$Security->CanSearch()) return ""; $sSearchKeyword = ($Default) ? $this->BasicSearch->KeywordDefault : $this->BasicSearch->Keyword; $sSearchType = ($Default) ? $this->BasicSearch->TypeDefault : $this->BasicSearch->Type; if ($sSearchKeyword <> "") { $sSearch = trim($sSearchKeyword); if ($sSearchType <> "=") { $ar = array(); // Match quoted keywords (i.e.: "...") if (preg_match_all('/"([^"]*)"/i', $sSearch, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { $p = strpos($sSearch, $match[0]); $str = substr($sSearch, 0, $p); $sSearch = substr($sSearch, $p + strlen($match[0])); if (strlen(trim($str)) > 0) $ar = array_merge($ar, explode(" ", trim($str))); $ar[] = $match[1]; // Save quoted keyword } } // Match individual keywords if (strlen(trim($sSearch)) > 0) $ar = array_merge($ar, explode(" ", trim($sSearch))); // Search keyword in any fields if (($sSearchType == "OR" || $sSearchType == "AND") && $this->BasicSearch->BasicSearchAnyFields) { foreach ($ar as $sKeyword) { if ($sKeyword <> "") { if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " "; $sSearchStr .= "(" . $this->BasicSearchSQL(array($sKeyword), $sSearchType) . ")"; } } } else { $sSearchStr = $this->BasicSearchSQL($ar, $sSearchType); } } else { $sSearchStr = $this->BasicSearchSQL(array($sSearch), $sSearchType); } if (!$Default) $this->Command = "search"; } if (!$Default && $this->Command == "search") { $this->BasicSearch->setKeyword($sSearchKeyword); $this->BasicSearch->setType($sSearchType); } return $sSearchStr; } // Check if search parm exists function CheckSearchParms() { // Check basic search if ($this->BasicSearch->IssetSession()) return TRUE; return FALSE; } // Clear all search parameters function ResetSearchParms() { // Clear search WHERE clause $this->SearchWhere = ""; $this->setSearchWhere($this->SearchWhere); // Clear basic search parameters $this->ResetBasicSearchParms(); } // Load advanced search default values function LoadAdvancedSearchDefault() { return FALSE; } // Clear all basic search parameters function ResetBasicSearchParms() { $this->BasicSearch->UnsetSession(); } // Restore all search parameters function RestoreSearchParms() { $this->RestoreSearch = TRUE; // Restore basic search values $this->BasicSearch->Load(); } // Set up sort parameters function SetUpSortOrder() { // Check for "order" parameter if (@$_GET["order"] <> "") { $this->CurrentOrder = ew_StripSlashes(@$_GET["order"]); $this->CurrentOrderType = @$_GET["ordertype"]; $this->UpdateSort($this->Name); // Name $this->UpdateSort($this->Surname); // Surname $this->UpdateSort($this->Institution_Type); // Institution_Type $this->UpdateSort($this->Institution_Name); // Institution_Name $this->UpdateSort($this->Address); // Address $this->UpdateSort($this->Phone); // Phone $this->UpdateSort($this->Phone_Mobile); // Phone_Mobile $this->UpdateSort($this->Town); // Town $this->setStartRecordNumber(1); // Reset start position } } // Load sort order parameters function LoadSortOrder() { $sOrderBy = $this->getSessionOrderBy(); // Get ORDER BY from Session if ($sOrderBy == "") { if ($this->getSqlOrderBy() <> "") { $sOrderBy = $this->getSqlOrderBy(); $this->setSessionOrderBy($sOrderBy); } } } // Reset command // - cmd=reset (Reset search parameters) // - cmd=resetall (Reset search and master/detail parameters) // - cmd=resetsort (Reset sort parameters) function ResetCmd() { // Check if reset command if (substr($this->Command,0,5) == "reset") { // Reset search criteria if ($this->Command == "reset" || $this->Command == "resetall") $this->ResetSearchParms(); // Reset sorting order if ($this->Command == "resetsort") { $sOrderBy = ""; $this->setSessionOrderBy($sOrderBy); $this->Name->setSort(""); $this->Surname->setSort(""); $this->Institution_Type->setSort(""); $this->Institution_Name->setSort(""); $this->Address->setSort(""); $this->Phone->setSort(""); $this->Phone_Mobile->setSort(""); $this->Town->setSort(""); } // Reset start position $this->StartRec = 1; $this->setStartRecordNumber($this->StartRec); } } // 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; // "detail_taccomodations" $item = &$this->ListOptions->Add("detail_taccomodations"); $item->CssStyle = "white-space: nowrap;"; $item->Visible = $Security->AllowList(CurrentProjectID() . 'taccomodations') && !$this->ShowMultipleDetails; $item->OnLeft = FALSE; $item->ShowInButtonGroup = FALSE; if (!isset($GLOBALS["taccomodations_grid"])) $GLOBALS["taccomodations_grid"] = new ctaccomodations_grid; // Multiple details if ($this->ShowMultipleDetails) { $item = &$this->ListOptions->Add("details"); $item->CssStyle = "white-space: nowrap;"; $item->Visible = $this->ShowMultipleDetails; $item->OnLeft = FALSE; $item->ShowInButtonGroup = FALSE; } // Set up detail pages $pages = new cSubPages(); $pages->Add("taccomodations"); $this->DetailPages = $pages; // List actions $item = &$this->ListOptions->Add("listactions"); $item->CssStyle = "white-space: nowrap;"; $item->OnLeft = FALSE; $item->Visible = FALSE; $item->ShowInButtonGroup = FALSE; $item->ShowInDropDown = FALSE; // "checkbox" $item = &$this->ListOptions->Add("checkbox"); $item->Visible = FALSE; $item->OnLeft = FALSE; $item->Header = ""; $item->ShowInDropDown = FALSE; $item->ShowInButtonGroup = FALSE; // Drop down button for ListOptions $this->ListOptions->UseImageAndText = TRUE; $this->ListOptions->UseDropDownButton = FALSE; $this->ListOptions->DropDownButtonPhrase = $Language->Phrase("ButtonListOptions"); $this->ListOptions->UseButtonGroup = TRUE; if ($this->ListOptions->UseButtonGroup && ew_IsMobile()) $this->ListOptions->UseDropDownButton = TRUE; $this->ListOptions->ButtonClass = "btn-sm"; // Class for button group // Call ListOptions_Load event $this->ListOptions_Load(); $this->SetupListOptionsExt(); $item = &$this->ListOptions->GetItem($this->ListOptions->GroupOptionName); $item->Visible = $this->ListOptions->GroupOptionVisible(); } // Render list options function RenderListOptions() { global $Security, $Language, $objForm; $this->ListOptions->LoadDefault(); // "view" $oListOpt = &$this->ListOptions->Items["view"]; $viewcaption = ew_HtmlTitle($Language->Phrase("ViewLink")); if ($Security->CanView()) { $oListOpt->Body = "ViewUrl) . "\">" . $Language->Phrase("ViewLink") . ""; } else { $oListOpt->Body = ""; } // "edit" $oListOpt = &$this->ListOptions->Items["edit"]; $editcaption = ew_HtmlTitle($Language->Phrase("EditLink")); if ($Security->CanEdit()) { $oListOpt->Body = "Phrase("EditLink")) . "\" data-caption=\"" . ew_HtmlTitle($Language->Phrase("EditLink")) . "\" href=\"" . ew_HtmlEncode($this->EditUrl) . "\">" . $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->DeleteUrl) . "\">" . $Language->Phrase("DeleteLink") . ""; else $oListOpt->Body = ""; // Set up list action buttons $oListOpt = &$this->ListOptions->GetItem("listactions"); if ($oListOpt && $this->Export == "" && $this->CurrentAction == "") { $body = ""; $links = array(); foreach ($this->ListActions->Items as $listaction) { if ($listaction->Select == EW_ACTION_SINGLE && $listaction->Allow) { $action = $listaction->Action; $caption = $listaction->Caption; $icon = ($listaction->Icon <> "") ? "Icon)) . "\" data-caption=\"" . ew_HtmlTitle($caption) . "\"> " : ""; $links[] = "" . $errmsg . "
"; else $this->setFailureMessage($errmsg); return FALSE; } } $this->CurrentFilter = $sFilter; $sSql = $this->SQL(); $conn = &$this->Connection(); $conn->raiseErrorFn = $GLOBALS["EW_ERROR_FN"]; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; $this->CurrentAction = $UserAction; // Call row action event if ($rs && !$rs->EOF) { $conn->BeginTrans(); $this->SelectedCount = $rs->RecordCount(); $this->SelectedIndex = 0; while (!$rs->EOF) { $this->SelectedIndex++; $row = $rs->fields; $Processed = $this->Row_CustomAction($UserAction, $row); if (!$Processed) break; $rs->MoveNext(); } if ($Processed) { $conn->CommitTrans(); // Commit the changes if ($this->getSuccessMessage() == "") $this->setSuccessMessage(str_replace('%s', $ActionCaption, $Language->Phrase("CustomActionCompleted"))); // Set up success message } else { $conn->RollbackTrans(); // Rollback changes // 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(str_replace('%s', $ActionCaption, $Language->Phrase("CustomActionFailed"))); } } } if ($rs) $rs->Close(); $this->CurrentAction = ""; // Clear action if (@$_POST["ajax"] == $UserAction) { // Ajax if ($this->getSuccessMessage() <> "") { echo "" . $this->getSuccessMessage() . "
"; $this->ClearSuccessMessage(); // Clear message } if ($this->getFailureMessage() <> "") { echo "" . $this->getFailureMessage() . "
"; $this->ClearFailureMessage(); // Clear message } return TRUE; } } return FALSE; // Not ajax request } // Set up search options function SetupSearchOptions() { global $Language; $this->SearchOptions = new cListOptions(); $this->SearchOptions->Tag = "div"; $this->SearchOptions->TagClassName = "ewSearchOption"; // Search button $item = &$this->SearchOptions->Add("searchtoggle"); $SearchToggleClass = ($this->SearchWhere <> "") ? " active" : ""; $item->Body = ""; $item->Visible = TRUE; // Show all button $item = &$this->SearchOptions->Add("showall"); $item->Body = "Phrase("ShowAll") . "\" data-caption=\"" . $Language->Phrase("ShowAll") . "\" href=\"" . $this->PageUrl() . "cmd=reset\">" . $Language->Phrase("ShowAllBtn") . ""; $item->Visible = ($this->SearchWhere <> $this->DefaultSearchWhere && $this->SearchWhere <> "0=101"); // Button group for search $this->SearchOptions->UseDropDownButton = FALSE; $this->SearchOptions->UseImageAndText = TRUE; $this->SearchOptions->UseButtonGroup = TRUE; $this->SearchOptions->DropDownButtonPhrase = $Language->Phrase("ButtonSearch"); // Add group option item $item = &$this->SearchOptions->Add($this->SearchOptions->GroupOptionName); $item->Body = ""; $item->Visible = FALSE; // Hide search options if ($this->Export <> "" || $this->CurrentAction <> "") $this->SearchOptions->HideAllOptions(); global $Security; if (!$Security->CanSearch()) { $this->SearchOptions->HideAllOptions(); $this->FilterOptions->HideAllOptions(); } } function SetupListOptionsExt() { global $Security, $Language; // Hide detail items for dropdown if necessary $this->ListOptions->HideDetailItemsForDropDown(); } function RenderListOptionsExt() { global $Security, $Language; $links = ""; $btngrps = ""; $sSqlWrk = "`idOfferer`=" . ew_AdjustSql($this->idOfferer->CurrentValue, $this->DBID) . ""; // Column "detail_taccomodations" if ($this->DetailPages->Items["taccomodations"]->Visible) { $link = ""; $option = &$this->ListOptions->Items["detail_taccomodations"]; $url = "taccomodationspreview.php?t=tofferers&f=" . ew_Encrypt($sSqlWrk); $btngrp = "" . $Language->Phrase("EnterSenderEmail") . "
"; } if (!ew_CheckEmail($sSender)) { return "" . $Language->Phrase("EnterProperSenderEmail") . "
"; } // Check recipient if (!ew_CheckEmailList($sRecipient, EW_MAX_EMAIL_RECIPIENT)) { return "" . $Language->Phrase("EnterProperRecipientEmail") . "
"; } // Check cc if (!ew_CheckEmailList($sCc, EW_MAX_EMAIL_RECIPIENT)) { return "" . $Language->Phrase("EnterProperCcEmail") . "
"; } // Check bcc if (!ew_CheckEmailList($sBcc, EW_MAX_EMAIL_RECIPIENT)) { return "" . $Language->Phrase("EnterProperBccEmail") . "
"; } // Check email sent count if (!isset($_SESSION[EW_EXPORT_EMAIL_COUNTER])) $_SESSION[EW_EXPORT_EMAIL_COUNTER] = 0; if (intval($_SESSION[EW_EXPORT_EMAIL_COUNTER]) > EW_MAX_EMAIL_SENT_COUNT) { return "" . $Language->Phrase("ExceedMaxEmailExport") . "
"; } // Send email $Email = new cEmail(); $Email->Sender = $sSender; // Sender $Email->Recipient = $sRecipient; // Recipient $Email->Cc = $sCc; // Cc $Email->Bcc = $sBcc; // Bcc $Email->Subject = $sEmailSubject; // Subject $Email->Format = ($sContentType == "url") ? "text" : "html"; if ($sEmailMessage <> "") { $sEmailMessage = ew_RemoveXSS($sEmailMessage); $sEmailMessage .= ($sContentType == "url") ? "\r\n\r\n" : "" . $Language->Phrase("SendEmailSuccess") . "
"; // Set up success message } else { // Sent email failure return "" . $Email->SendErrDescription . "
"; } } // Export QueryString function ExportQueryString() { // Initialize $sQry = "export=html"; // Build QueryString for search if ($this->BasicSearch->getKeyword() <> "") { $sQry .= "&" . EW_TABLE_BASIC_SEARCH . "=" . urlencode($this->BasicSearch->getKeyword()) . "&" . EW_TABLE_BASIC_SEARCH_TYPE . "=" . urlencode($this->BasicSearch->getType()); } // Build QueryString for pager $sQry .= "&" . EW_TABLE_REC_PER_PAGE . "=" . urlencode($this->getRecordsPerPage()) . "&" . EW_TABLE_START_REC . "=" . urlencode($this->getStartRecordNumber()); return $sQry; } // Add search QueryString function AddSearchQueryString(&$Qry, &$Fld) { $FldSearchValue = $Fld->AdvancedSearch->getValue("x"); $FldParm = substr($Fld->FldVar,2); if (strval($FldSearchValue) <> "") { $Qry .= "&x_" . $FldParm . "=" . urlencode($FldSearchValue) . "&z_" . $FldParm . "=" . urlencode($Fld->AdvancedSearch->getValue("z")); } $FldSearchValue2 = $Fld->AdvancedSearch->getValue("y"); if (strval($FldSearchValue2) <> "") { $Qry .= "&v_" . $FldParm . "=" . urlencode($Fld->AdvancedSearch->getValue("v")) . "&y_" . $FldParm . "=" . urlencode($FldSearchValue2) . "&w_" . $FldParm . "=" . urlencode($Fld->AdvancedSearch->getValue("w")); } } // Set up Breadcrumb function SetupBreadcrumb() { global $Breadcrumb, $Language; $Breadcrumb = new cBreadcrumb(); $url = substr(ew_CurrentUrl(), strrpos(ew_CurrentUrl(), "/")+1); $url = preg_replace('/\?cmd=reset(all){0,1}$/i', '', $url); // Remove cmd=reset / cmd=resetall $Breadcrumb->Add("list", $this->TableVar, $url, "", $this->TableVar, TRUE); } // 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"; } // Form Custom Validate event function Form_CustomValidate(&$CustomError) { // Return error message in CustomError return TRUE; } // 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"; } // Row Custom Action event function Row_CustomAction($action, $row) { // Return FALSE to abort return TRUE; } // Page Exporting event // $this->ExportDoc = export document object function Page_Exporting() { //$this->ExportDoc->Text = "my header"; // Export header //return FALSE; // Return FALSE to skip default export and use Row_Export event return TRUE; // Return TRUE to use default export and skip Row_Export event } // Row Export event // $this->ExportDoc = export document object function Row_Export($rs) { //$this->ExportDoc->Text .= "my content"; // Build HTML with field value: $rs["MyField"] or $this->MyField->ViewValue } // Page Exported event // $this->ExportDoc = export document object function Page_Exported() { //$this->ExportDoc->Text .= "my footer"; // Export footer //echo $this->ExportDoc->Text; } } ?> Page_Init(); // Page main $tofferers_list->Page_Main(); // Global Page Rendering event (in userfn*.php) Page_Rendering(); // Page Rendering event $tofferers_list->Page_Render(); ?> Export == "") { ?>