Viewing file: izdanja_list.php (14.06 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//Include Common Files @1-7F7B618F
define("RelativePath", ".");
define("PathToCurrentPage", "/");
define("FileName", "izdanja_list.php");
include(RelativePath . "/Common.php");
include(RelativePath . "/Template.php");
include(RelativePath . "/Sorter.php");
include(RelativePath . "/Navigator.php");
//End Include Common Files
//Include Page implementation @26-3DD2EFDC
include_once(RelativePath . "/Header.php");
//End Include Page implementation
class clsGridizdanja { //izdanja class @8-64BA30F7
//Variables @8-91271114
// Public variables
var $ComponentType = "Grid";
var $ComponentName;
var $Visible;
var $Errors;
var $ErrorBlock;
var $ds;
var $DataSource;
var $PageSize;
var $SorterName = "";
var $SorterDirection = "";
var $PageNumber;
var $CCSEvents = "";
var $CCSEventResult;
var $RelativePath = "";
// Grid Controls
var $StaticControls;
var $RowControls;
var $Sorter_br_izdanja;
var $Sorter_datum;
var $Sorter_file_izdanja;
//End Variables
//Class_Initialize Event @8-92A84272
function clsGridizdanja($RelativePath, & $Parent)
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->ComponentName = "izdanja";
$this->Visible = True;
$this->Parent = & $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid izdanja";
$this->DataSource = new clsizdanjaDataSource($this);
$this->ds = & $this->DataSource;
$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));
if ($this->PageNumber <= 0) $this->PageNumber = 1;
$this->SorterName = CCGetParam("izdanjaOrder", "");
$this->SorterDirection = CCGetParam("izdanjaDir", "");
$this->br_izdanja = & new clsControl(ccsLink, "br_izdanja", "br_izdanja", ccsInteger, "", CCGetRequestParam("br_izdanja", ccsGet), $this);
$this->br_izdanja->Page = "izdanja_maint.php";
$this->datum = & new clsControl(ccsLabel, "datum", "datum", ccsDate, $DefaultDateFormat, CCGetRequestParam("datum", ccsGet), $this);
$this->file_izdanja = & new clsControl(ccsLabel, "file_izdanja", "file_izdanja", ccsText, "", CCGetRequestParam("file_izdanja", ccsGet), $this);
$this->Sorter_br_izdanja = & new clsSorter($this->ComponentName, "Sorter_br_izdanja", $FileName, $this);
$this->Sorter_datum = & new clsSorter($this->ComponentName, "Sorter_datum", $FileName, $this);
$this->Sorter_file_izdanja = & new clsSorter($this->ComponentName, "Sorter_file_izdanja", $FileName, $this);
$this->izdanja_Insert = & new clsControl(ccsLink, "izdanja_Insert", "izdanja_Insert", ccsText, "", CCGetRequestParam("izdanja_Insert", ccsGet), $this);
$this->izdanja_Insert->Parameters = CCGetQueryString("QueryString", array("br_izdanja", "ccsForm"));
$this->izdanja_Insert->Page = "izdanja_maint.php";
$this->Navigator = & new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple, $this);
}
//End Class_Initialize Event
//Initialize Method @8-90E704C5
function Initialize()
{
if(!$this->Visible) return;
$this->DataSource->PageSize = & $this->PageSize;
$this->DataSource->AbsolutePage = & $this->PageNumber;
$this->DataSource->SetOrder($this->SorterName, $this->SorterDirection);
}
//End Initialize Method
//Show Method @8-8BD3FE3F
function Show()
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;
$ShownRecords = 0;
$this->DataSource->Parameters["urls_subject"] = CCGetFromGet("s_subject", "");
$this->DataSource->Parameters["urls_body"] = CCGetFromGet("s_body", "");
$this->DataSource->Parameters["urls_file_izdanja"] = CCGetFromGet("s_file_izdanja", "");
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->DataSource->Prepare();
$this->DataSource->Open();
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
if(!$this->Visible) return;
$GridBlock = "Grid " . $this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
if(($ShownRecords < $this->PageSize) && $this->DataSource->next_record())
{
do {
$this->DataSource->SetValues();
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";
$this->br_izdanja->SetValue($this->DataSource->br_izdanja->GetValue());
$this->br_izdanja->Parameters = CCGetQueryString("QueryString", array("ccsForm"));
$this->br_izdanja->Parameters = CCAddParam($this->br_izdanja->Parameters, "br_izdanja", $this->DataSource->f("br_izdanja"));
$this->datum->SetValue($this->DataSource->datum->GetValue());
$this->file_izdanja->SetValue($this->DataSource->file_izdanja->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->br_izdanja->Show();
$this->datum->Show();
$this->file_izdanja->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
$ShownRecords++;
} while (($ShownRecords < $this->PageSize) && $this->DataSource->next_record());
}
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->DataSource->AbsolutePage;
if ($this->DataSource->RecordsCount == "CCS not counted")
$this->Navigator->TotalPages = $this->DataSource->AbsolutePage + ($this->DataSource->next_record() ? 1 : 0);
else
$this->Navigator->TotalPages = $this->DataSource->PageCount();
$this->Sorter_br_izdanja->Show();
$this->Sorter_datum->Show();
$this->Sorter_file_izdanja->Show();
$this->izdanja_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method
//GetErrors Method @8-EDE49DF3
function GetErrors()
{
$errors = "";
$errors = ComposeStrings($errors, $this->br_izdanja->Errors->ToString());
$errors = ComposeStrings($errors, $this->datum->Errors->ToString());
$errors = ComposeStrings($errors, $this->file_izdanja->Errors->ToString());
$errors = ComposeStrings($errors, $this->Errors->ToString());
$errors = ComposeStrings($errors, $this->DataSource->Errors->ToString());
return $errors;
}
//End GetErrors Method
} //End izdanja Class @8-FCB6E20C
class clsizdanjaDataSource extends clsDBConnection1 { //izdanjaDataSource Class @8-A8BDB0FC
//DataSource Variables @8-8134A1F1
var $Parent = "";
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CmdExecution;
var $CountSQL;
var $wp;
// Datasource fields
var $br_izdanja;
var $datum;
var $file_izdanja;
//End DataSource Variables
//DataSourceClass_Initialize Event @8-89FA6129
function clsizdanjaDataSource(& $Parent)
{
$this->Parent = & $Parent;
$this->ErrorBlock = "Grid izdanja";
$this->Initialize();
$this->br_izdanja = new clsField("br_izdanja", ccsInteger, "");
$this->datum = new clsField("datum", ccsDate, array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn", ":", "ss"));
$this->file_izdanja = new clsField("file_izdanja", ccsText, "");
}
//End DataSourceClass_Initialize Event
//SetOrder Method @8-75129A92
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_br_izdanja" => array("br_izdanja", ""),
"Sorter_datum" => array("datum", ""),
"Sorter_file_izdanja" => array("file_izdanja", "")));
}
//End SetOrder Method
//Prepare Method @8-502D67D2
function Prepare()
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_subject", ccsMemo, "", "", $this->Parameters["urls_subject"], "", false);
$this->wp->AddParameter("2", "urls_body", ccsMemo, "", "", $this->Parameters["urls_body"], "", false);
$this->wp->AddParameter("3", "urls_file_izdanja", ccsText, "", "", $this->Parameters["urls_file_izdanja"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "subject", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsMemo),false);
$this->wp->Criterion[2] = $this->wp->Operation(opContains, "body", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsMemo),false);
$this->wp->Criterion[3] = $this->wp->Operation(opContains, "file_izdanja", $this->wp->GetDBValue("3"), $this->ToSQL($this->wp->GetDBValue("3"), ccsText),false);
$this->Where = $this->wp->opAND(
false, $this->wp->opAND(
false,
$this->wp->Criterion[1],
$this->wp->Criterion[2]),
$this->wp->Criterion[3]);
}
//End Prepare Method
//Open Method @8-8896C933
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
$this->CountSQL = "SELECT COUNT(*) " .
"FROM izdanja";
$this->SQL = "SELECT br_izdanja, datum, file_izdanja " .
"FROM izdanja {SQL_Where} {SQL_OrderBy}";
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
if ($this->CountSQL)
$this->RecordsCount = CCGetDBValue(CCBuildSQL($this->CountSQL, $this->Where, ""), $this);
else
$this->RecordsCount = "CCS not counted";
$this->query($this->OptimizeSQL(CCBuildSQL($this->SQL, $this->Where, $this->Order)));
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
}
//End Open Method
//SetValues Method @8-B3AE8439
function SetValues()
{
$this->br_izdanja->SetDBValue(trim($this->f("br_izdanja")));
$this->datum->SetDBValue(trim($this->f("datum")));
$this->file_izdanja->SetDBValue($this->f("file_izdanja"));
}
//End SetValues Method
} //End izdanjaDataSource Class @8-FCB6E20C
//Include Page implementation @27-58DBA1E3
include_once(RelativePath . "/Footer.php");
//End Include Page implementation
//Initialize Page @1-8B8986DE
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "izdanja_list.html";
$BlockToParse = "main";
$TemplateEncoding = "CP1252";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-8564AA8B
$DBConnection1 = new clsDBConnection1();
$MainPage->Connections["Connection1"] = & $DBConnection1;
// Controls
$Header = & new clsHeader("", "Header", $MainPage);
$Header->Initialize();
$izdanja = & new clsGridizdanja("", $MainPage);
$Footer = & new clsFooter("", "Footer", $MainPage);
$Footer->Initialize();
$MainPage->Header = & $Header;
$MainPage->izdanja = & $izdanja;
$MainPage->Footer = & $Footer;
$izdanja->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
if ($Charset)
header("Content-Type: text/html; charset=" . $Charset);
//End Initialize Objects
//Initialize HTML Template @1-8F4531F3
$CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
$Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
$Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "CP1252");
$Tpl->block_path = "/$BlockToParse";
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
//End Initialize HTML Template
//Execute Components @1-351F985C
$Header->Operations();
$Footer->Operations();
//End Execute Components
//Go to destination page @1-FAAB3D78
if($Redirect)
{
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
header("Location: " . $Redirect);
$Header->Class_Terminate();
unset($Header);
unset($izdanja);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
exit;
}
//End Go to destination page
//Show Page @1-87141A33
$Header->Show();
$izdanja->Show();
$Footer->Show();
$Tpl->block_path = "";
$Tpl->Parse($BlockToParse, false);
$main_block = $Tpl->GetVar($BlockToParse);
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
if ($CCSEventResult) echo $main_block;
//End Show Page
//Unload Page @1-618CDA42
$CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
$DBConnection1->close();
$Header->Class_Terminate();
unset($Header);
unset($izdanja);
$Footer->Class_Terminate();
unset($Footer);
unset($Tpl);
//End Unload Page
?>
|