Viewing file: newsleter_list.php (17.59 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//Include Common Files @1-5471E0F2
define("RelativePath", ".");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
//End Include Common Files
//Include Page implementation @20-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
//Include Page implementation @26-9090FF7A
include_once(RelativePath . "/Header1.php");
//End Include Page implementation
class clsRecordnewsleterSearch { //newsleterSearch Class @2-50CD8FBA
//Variables @2-B2F7A83E
// Public variables
var $ComponentName;
var $HTMLFormAction;
var $PressedButton;
var $Errors;
var $ErrorBlock;
var $FormSubmitted;
var $FormEnctype;
var $Visible;
var $Recordset;
var $CCSEvents = "";
var $CCSEventResult;
var $InsertAllowed = false;
var $UpdateAllowed = false;
var $DeleteAllowed = false;
var $ReadAllowed = false;
var $EditMode = false;
var $ds;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-7ED5B818
function clsRecordnewsleterSearch()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record newsleterSearch/Error";
$this->ReadAllowed = true;
if($this->Visible)
{
$this->ComponentName = "newsleterSearch";
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = ($FormName == $this->ComponentName);
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->s_keyword = new clsControl(ccsTextBox, "s_keyword", "s_keyword", ccsText, "", CCGetRequestParam("s_keyword", $Method));
$this->Button_DoSearch = new clsButton("Button_DoSearch");
}
}
//End Class_Initialize Event
//Validate Method @2-C6CEFB72
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->s_keyword->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
$Validation = $Validation && ($this->s_keyword->Errors->Count() == 0);
return (($this->Errors->Count() == 0) && $Validation);
}
//End Validate Method
//CheckErrors Method @2-D6729123
function CheckErrors()
{
$errors = false;
$errors = ($errors || $this->s_keyword->Errors->Count());
$errors = ($errors || $this->Errors->Count());
return $errors;
}
//End CheckErrors Method
//Operation Method @2-E1726729
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
if(!$this->FormSubmitted) {
return;
}
if($this->FormSubmitted) {
$this->PressedButton = "Button_DoSearch";
if(strlen(CCGetParam("Button_DoSearch", ""))) {
$this->PressedButton = "Button_DoSearch";
}
}
$Redirect = "newsleter_list.php";
if($this->Validate()) {
if($this->PressedButton == "Button_DoSearch") {
if(!CCGetEvent($this->Button_DoSearch->CCSEvents, "OnClick")) {
$Redirect = "";
} else {
$Redirect = "newsleter_list.php" . "?" . CCMergeQueryStrings(CCGetQueryString("Form", Array("Button_DoSearch")));
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @2-69828424
function Show()
{
global $Tpl;
global $FileName;
$Error = "";
if(!$this->Visible)
return;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$RecordBlock = "Record " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if(!$this->FormSubmitted)
{
}
if($this->FormSubmitted || $this->CheckErrors()) {
$Error .= $this->s_keyword->Errors->ToString();
$Error .= $this->Errors->ToString();
$Tpl->SetVar("Error", $Error);
$Tpl->Parse("Error", false);
}
$CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
$this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
$Tpl->SetVar("Action", $this->HTMLFormAction);
$Tpl->SetVar("HTMLFormName", $this->ComponentName);
$Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) {
$Tpl->block_path = $ParentPath;
return;
}
$this->s_keyword->Show();
$this->Button_DoSearch->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
}
//End Show Method
} //End newsleterSearch Class @2-FCB6E20C
class clsGridnewsleter { //newsleter class @6-CB14B0A8
//Variables @6-E19B9E38
// Public variables
var $ComponentName;
var $Visible;
var $Errors;
var $ErrorBlock;
var $ds; var $PageSize;
var $SorterName = "";
var $SorterDirection = "";
var $PageNumber;
var $CCSEvents = "";
var $CCSEventResult;
// Grid Controls
var $StaticControls; var $RowControls;
var $Sorter_id_newsletera;
var $Sorter1;
var $Sorter_datum_newsletera;
var $Navigator;
//End Variables
//Class_Initialize Event @6-C0499FB5
function clsGridnewsleter()
{
global $FileName;
$this->ComponentName = "newsleter";
$this->Visible = True;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid newsleter";
$this->ds = new clsnewsleterDataSource();
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 20;
else
$this->PageSize = intval($this->PageSize);
if ($this->PageSize > 100)
$this->PageSize = 100;
if($this->PageSize == 0)
$this->Errors->addError("<p>Form: Grid " . $this->ComponentName . "<br>Error: (CCS06) Invalid page size.</p>");
$this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1));
$this->SorterName = CCGetParam("newsleterOrder", "");
$this->SorterDirection = CCGetParam("newsleterDir", "");
$this->id_newsletera = new clsControl(ccsLink, "id_newsletera", "id_newsletera", ccsInteger, "", CCGetRequestParam("id_newsletera", ccsGet));
$this->Label1 = new clsControl(ccsLabel, "Label1", "Label1", ccsText, "", CCGetRequestParam("Label1", ccsGet));
$this->datum_newsletera = new clsControl(ccsLabel, "datum_newsletera", "datum_newsletera", ccsDate, Array("GeneralDate"), CCGetRequestParam("datum_newsletera", ccsGet));
$this->Sorter_id_newsletera = new clsSorter($this->ComponentName, "Sorter_id_newsletera", $FileName);
$this->Sorter1 = new clsSorter($this->ComponentName, "Sorter1", $FileName);
$this->Sorter_datum_newsletera = new clsSorter($this->ComponentName, "Sorter_datum_newsletera", $FileName);
$this->newsleter_Insert = new clsControl(ccsLink, "newsleter_Insert", "newsleter_Insert", ccsText, "", CCGetRequestParam("newsleter_Insert", ccsGet));
$this->newsleter_Insert->Parameters = CCGetQueryString("QueryString", Array("id_newsletera", "ccsForm"));
$this->newsleter_Insert->Page = "newsleter_maint.php";
$this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple);
}
//End Class_Initialize Event
//Initialize Method @6-03626367
function Initialize()
{
if(!$this->Visible) return;
$this->ds->PageSize = $this->PageSize;
$this->ds->AbsolutePage = $this->PageNumber;
$this->ds->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//Show Method @6-D7CF4EFE
function Show()
{
global $Tpl;
if(!$this->Visible) return;
$ShownRecords = 0;
$this->ds->Parameters["urls_keyword"] = CCGetFromGet("s_keyword", "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect");
$this->ds->Prepare();
$this->ds->Open();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow");
if(!$this->Visible) return;
$GridBlock = "Grid " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$is_next_record = $this->ds->next_record();
if($is_next_record && $ShownRecords < $this->PageSize)
{
do {
$this->ds->SetValues();
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";
$this->id_newsletera->SetValue($this->ds->id_newsletera->GetValue());
$this->id_newsletera->Parameters = CCGetQueryString("QueryString", Array("ccsForm"));
$this->id_newsletera->Parameters = CCAddParam($this->id_newsletera->Parameters, "id_newsletera", $this->ds->f("id_newsletera"));
$this->id_newsletera->Page = "newsleter_maint.php";
$this->Label1->SetValue($this->ds->Label1->GetValue());
$this->datum_newsletera->SetValue($this->ds->datum_newsletera->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->id_newsletera->Show();
$this->Label1->Show();
$this->datum_newsletera->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
$ShownRecords++;
$is_next_record = $this->ds->next_record();
} while ($is_next_record && $ShownRecords < $this->PageSize);
}
else // Show NoRecords block if no records are found
{
$Tpl->parse("NoRecords", false);
}
$errors = $this->GetErrors();
if(strlen($errors))
{
$Tpl->replaceblock("", $errors);
$Tpl->block_path = $ParentPath;
return;
}
$this->Navigator->PageNumber = $this->ds->AbsolutePage;
$this->Navigator->TotalPages = $this->ds->PageCount();
$this->Sorter_id_newsletera->Show();
$this->Sorter1->Show();
$this->Sorter_datum_newsletera->Show();
$this->newsleter_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
//GetErrors Method @6-56D791EC
function GetErrors()
{
$errors = "";
$errors .= $this->id_newsletera->Errors->ToString();
$errors .= $this->Label1->Errors->ToString();
$errors .= $this->datum_newsletera->Errors->ToString();
$errors .= $this->Errors->ToString();
$errors .= $this->ds->Errors->ToString();
return $errors;
}
//End GetErrors Method
} //End newsleter Class @6-FCB6E20C
class clsnewsleterDataSource extends clsDBConnection1 { //newsleterDataSource Class @6-AE27F51B
//DataSource Variables @6-9DB38567
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $CountSQL;
var $wp;
// Datasource fields
var $id_newsletera;
var $Label1;
var $datum_newsletera;
//End DataSource Variables
//DataSourceClass_Initialize Event @6-1B5E7CDD
function clsnewsleterDataSource()
{
$this->ErrorBlock = "Grid newsleter";
$this->Initialize();
$this->id_newsletera = new clsField("id_newsletera", ccsInteger, "");
$this->Label1 = new clsField("Label1", ccsText, "");
$this->datum_newsletera = new clsField("datum_newsletera", ccsDate, Array("dd", "/", "mm", "/", "yyyy", " ", "HH", ":", "nn", ":", "ss"));
}
//End DataSourceClass_Initialize Event
//SetOrder Method @6-FD1430B4
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "id_newsletera desc";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_id_newsletera" => array("id_newsletera", ""),
"Sorter1" => array("naslov_newsletera", ""),
"Sorter_datum_newsletera" => array("datum_newsletera", "")));
}
//End SetOrder Method
//Prepare Method @6-4257B604
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_keyword", ccsMemo, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->AddParameter("2", "urls_keyword", ccsMemo, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "naslov_newsletera", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsMemo),false);
$this->wp->Criterion[2] = $this->wp->Operation(opContains, "tekst_newsletera", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsMemo),false);
$this->Where = $this->wp->opOR(
false,
$this->wp->Criterion[1],
$this->wp->Criterion[2]);
}
//End Prepare Method
//Open Method @6-A0898564
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM newsleter";
$this->SQL = "SELECT * " .
"FROM newsleter";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
}
//End Open Method
//SetValues Method @6-79B23D11
function SetValues()
{
$this->id_newsletera->SetDBValue(trim($this->f("id_newsletera")));
$this->Label1->SetDBValue($this->f("naslov_newsletera"));
$this->datum_newsletera->SetDBValue(trim($this->f("datum_newsletera")));
}
//End SetValues Method
} //End newsleterDataSource Class @6-FCB6E20C
//Include Page implementation @21-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-3A064C3B
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "newsleter_list.php";
$Redirect = "";
$TemplateFileName = "newsleter_list.html";
$BlockToParse = "main";
$TemplateEncoding = "";
$FileEncoding = "";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-4127453B
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader("");
$Header->BindEvents();
$Header->Initialize();
$Header1 = new clsHeader1("");
$Header1->BindEvents();
$Header1->Initialize();
$newsleterSearch = new clsRecordnewsleterSearch();
$newsleter = new clsGridnewsleter();
$Footer = new clsFooter("");
$Footer->BindEvents();
$Footer->Initialize();
$newsleter->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
if ($Charset)
header("Content-Type: text/html; charset=" . $Charset);
//End Initialize Objects
//Initialize HTML Template @1-51DB8464
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView");
$Tpl = new clsTemplate();
$Tpl->LoadTemplate(TemplatePath . $TemplateFileName, "main", $TemplateEncoding);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow");
//End Initialize HTML Template
//Execute Components @1-775939CC
$Header->Operations();
$Header1->Operations();
$newsleterSearch->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-6FE2D26F
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($newsleterSearch);
unset($newsleter);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-7FC4B4C1
$Header->Show("Header");
$Header1->Show("Header1");
$newsleterSearch->Show();
$newsleter->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-773DFB0F
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
$Header1->Class_Terminate();
unset($Header1);
unset($newsleterSearch);
unset($newsleter);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|