Viewing file: partije_list.php (15.53 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 @19-39DC296A
include_once("./Header.php");
//End Include Page implementation
Class clsRecordpartijeSearch { //partijeSearch Class @2-4C888E34
//Variables @2-CB19EB75
// 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 $ds;
var $EditMode;
var $ValidatingControls;
var $Controls;
// Class variables
//End Variables
//Class_Initialize Event @2-660EF078
function clsRecordpartijeSearch()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record partijeSearch/Error";
$this->ReadAllowed = false;
$this->InsertAllowed = false;
$this->UpdateAllowed = false;
$this->DeleteAllowed = false;
if($this->Visible)
{
$this->ComponentName = "partijeSearch";
$CCSForm = split(":", CCGetFromGet("ccsForm", ""), 2);
if(sizeof($CCSForm) == 1)
$CCSForm[1] = "";
list($FormName, $FormMethod) = $CCSForm;
$this->EditMode = ($FormMethod == "Edit");
$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-F230E30A
function Validate()
{
$Validation = true;
$Where = "";
$Validation = ($this->s_keyword->Validate() && $Validation);
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate");
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-F8AD7456
function Operation()
{
if(!$this->Visible)
return;
global $Redirect;
global $FileName;
$this->EditMode = false;
if(!$this->FormSubmitted)
return;
if($this->FormSubmitted) {
$this->PressedButton = "Button_DoSearch";
if(strlen(CCGetParam("Button_DoSearch", ""))) {
$this->PressedButton = "Button_DoSearch";
}
}
$Redirect = "partije_list.php";
if($this->Validate()) {
if($this->PressedButton == "Button_DoSearch") {
if(!CCGetEvent($this->Button_DoSearch->CCSEvents, "OnClick")) {
$Redirect = "";
} else {
$Redirect = "partije_list.php" . "?" . CCMergeQueryStrings(CCGetQueryString("Form", Array("Button_DoSearch")));
}
}
} else {
$Redirect = "";
}
}
//End Operation Method
//Show Method @2-7C48BB57
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;
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 partijeSearch Class @2-FCB6E20C
class clsGridpartije { //partije class @6-E6A3D60A
//Variables @6-6E9200F2
// 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_department_id;
var $Sorter_department_name;
var $Navigator;
//End Variables
//Class_Initialize Event @6-984995D4
function clsGridpartije()
{
global $FileName;
$this->ComponentName = "partije";
$this->Visible = True;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid partije";
$this->ds = new clspartijeDataSource();
$this->PageSize = CCGetParam($this->ComponentName . "PageSize", "");
if(!is_numeric($this->PageSize) || !strlen($this->PageSize))
$this->PageSize = 20;
else if ($this->PageSize > 100)
$this->PageSize = 100;
else
$this->PageSize = intval($this->PageSize);
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("partijeOrder", "");
$this->SorterDirection = CCGetParam("partijeDir", "");
$this->department_id = new clsControl(ccsLink, "department_id", "department_id", ccsInteger, "", CCGetRequestParam("department_id", ccsGet));
$this->department_name = new clsControl(ccsLabel, "department_name", "department_name", ccsText, "", CCGetRequestParam("department_name", ccsGet));
$this->Sorter_department_id = new clsSorter($this->ComponentName, "Sorter_department_id", $FileName);
$this->Sorter_department_name = new clsSorter($this->ComponentName, "Sorter_department_name", $FileName);
$this->partije_Insert = new clsControl(ccsLink, "partije_Insert", "partije_Insert", ccsText, "", CCGetRequestParam("partije_Insert", ccsGet));
$this->partije_Insert->Parameters = CCGetQueryString("QueryString", Array("department_id", "ccsForm"));
$this->partije_Insert->Page = "partije_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-2928AF67
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->department_id->SetValue($this->ds->department_id->GetValue());
$this->department_id->Parameters = CCGetQueryString("QueryString", Array("ccsForm"));
$this->department_id->Parameters = CCAddParam($this->department_id->Parameters, "department_id", $this->ds->f("department_id"));
$this->department_id->Page = "partije_maint.php";
$this->department_name->SetValue($this->ds->department_name->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->department_id->Show();
$this->department_name->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_department_id->Show();
$this->Sorter_department_name->Show();
$this->partije_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
//GetErrors Method @6-E1E229A0
function GetErrors()
{
$errors = "";
$errors .= $this->department_id->Errors->ToString();
$errors .= $this->department_name->Errors->ToString();
$errors .= $this->Errors->ToString();
$errors .= $this->ds->Errors->ToString();
return $errors;
}
//End GetErrors Method
} //End partije Class @6-FCB6E20C
class clspartijeDataSource extends clsDBConnection1 { //partijeDataSource Class @6-03D8EFD8
//DataSource Variables @6-CC140861
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CountSQL;
var $wp;
// Datasource fields
var $department_id;
var $department_name;
//End DataSource Variables
//Class_Initialize Event @6-6522BB12
function clspartijeDataSource()
{
$this->ErrorBlock = "Grid partije";
$this->Initialize();
$this->department_id = new clsField("department_id", ccsInteger, "");
$this->department_name = new clsField("department_name", ccsText, "");
}
//End Class_Initialize Event
//SetOrder Method @6-07327CDA
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_department_id" => array("department_id", ""),
"Sorter_department_name" => array("department_name", "")));
}
//End SetOrder Method
//Prepare Method @6-81347FE1
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "department_name", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsText),false);
$this->Where = $this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @6-6CE6F986
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM partije";
$this->SQL = "SELECT department_id, department_name " .
"FROM partije";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect");
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
$this->query(CCBuildSQL($this->SQL, $this->Where, $this->Order));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect");
$this->MoveToPage($this->AbsolutePage);
}
//End Open Method
//SetValues Method @6-7204BF17
function SetValues()
{
$this->department_id->SetDBValue(trim($this->f("department_id")));
$this->department_name->SetDBValue($this->f("department_name"));
}
//End SetValues Method
} //End partijeDataSource Class @6-FCB6E20C
//Include Page implementation @20-5CD56755
include_once("./Footer.php");
//End Include Page implementation
//Initialize Page @1-4273A79B
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "partije_list.php";
$Redirect = "";
$TemplateFileName = "partije_list.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-EC4D3AB3
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader();
$Header->BindEvents();
$Header->TemplatePath = "./";
$Header->Initialize();
$partijeSearch = new clsRecordpartijeSearch();
$partije = new clsGridpartije();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
$partije->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
//End Initialize Objects
//Initialize HTML Template @1-A0111C9D
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView");
$Tpl = new clsTemplate();
$Tpl->LoadTemplate(TemplatePath . $TemplateFileName, "main");
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow");
//End Initialize HTML Template
//Execute Components @1-BA9C2B41
$Header->Operations();
$partijeSearch->Operation();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-6F9FD7CC
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
header("Location: " . $Redirect);
exit;
}
//End Go to destination page
//Show Page @1-84928FD8
$Header->Show("Header");
$partijeSearch->Show();
$partije->Show();
$Footer->Show("Footer");
$Tpl->PParse("main", false);
//End Show Page
//Unload Page @1-A4D34ABE
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload");
$DBConnection1->close();
unset($Tpl);
//End Unload Page
?>
|