Viewing file: korisnici_list.php (15.71 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 clsRecordkorisniciSearch { //korisniciSearch Class @2-7B8E5249
//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-7BE653F0
function clsRecordkorisniciSearch()
{
global $FileName;
$this->Visible = true;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Record korisniciSearch/Error";
$this->ReadAllowed = false;
$this->InsertAllowed = false;
$this->UpdateAllowed = false;
$this->DeleteAllowed = false;
if($this->Visible)
{
$this->ComponentName = "korisniciSearch";
$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-C3DFD1D6
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 = "korisnici_list.php";
if($this->Validate()) {
if($this->PressedButton == "Button_DoSearch") {
if(!CCGetEvent($this->Button_DoSearch->CCSEvents, "OnClick")) {
$Redirect = "";
} else {
$Redirect = "korisnici_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 korisniciSearch Class @2-FCB6E20C
class clsGridkorisnici { //korisnici class @6-B9C585A3
//Variables @6-8D849B0A
// 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;
var $Sorter1;
var $Sorter_nivo;
var $Navigator;
//End Variables
//Class_Initialize Event @6-4A354D94
function clsGridkorisnici()
{
global $FileName;
$this->ComponentName = "korisnici";
$this->Visible = True;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid korisnici";
$this->ds = new clskorisniciDataSource();
$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("korisniciOrder", "");
$this->SorterDirection = CCGetParam("korisniciDir", "");
$this->id = new clsControl(ccsLink, "id", "id", ccsInteger, "", CCGetRequestParam("id", ccsGet));
$this->Label1 = new clsControl(ccsLabel, "Label1", "Label1", ccsText, "", CCGetRequestParam("Label1", ccsGet));
$this->nivo = new clsControl(ccsLabel, "nivo", "nivo", ccsInteger, "", CCGetRequestParam("nivo", ccsGet));
$this->Sorter_id = new clsSorter($this->ComponentName, "Sorter_id", $FileName);
$this->Sorter1 = new clsSorter($this->ComponentName, "Sorter1", $FileName);
$this->Sorter_nivo = new clsSorter($this->ComponentName, "Sorter_nivo", $FileName);
$this->korisnici_Insert = new clsControl(ccsLink, "korisnici_Insert", "korisnici_Insert", ccsText, "", CCGetRequestParam("korisnici_Insert", ccsGet));
$this->korisnici_Insert->Parameters = CCGetQueryString("QueryString", Array("id", "ccsForm"));
$this->korisnici_Insert->Page = "korisnici_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-D384CA73
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->SetValue($this->ds->id->GetValue());
$this->id->Parameters = CCGetQueryString("QueryString", Array("ccsForm"));
$this->id->Parameters = CCAddParam($this->id->Parameters, "id", $this->ds->f("id"));
$this->id->Page = "korisnici_maint.php";
$this->Label1->SetValue($this->ds->Label1->GetValue());
$this->nivo->SetValue($this->ds->nivo->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->id->Show();
$this->Label1->Show();
$this->nivo->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->Show();
$this->Sorter1->Show();
$this->Sorter_nivo->Show();
$this->korisnici_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
//GetErrors Method @6-C38E8D82
function GetErrors()
{
$errors = "";
$errors .= $this->id->Errors->ToString();
$errors .= $this->Label1->Errors->ToString();
$errors .= $this->nivo->Errors->ToString();
$errors .= $this->Errors->ToString();
$errors .= $this->ds->Errors->ToString();
return $errors;
}
//End GetErrors Method
} //End korisnici Class @6-FCB6E20C
class clskorisniciDataSource extends clsDBConnection1 { //korisniciDataSource Class @6-3EEB31B4
//DataSource Variables @6-11013128
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $CountSQL;
var $wp;
// Datasource fields
var $id;
var $Label1;
var $nivo;
//End DataSource Variables
//Class_Initialize Event @6-358F781A
function clskorisniciDataSource()
{
$this->ErrorBlock = "Grid korisnici";
$this->Initialize();
$this->id = new clsField("id", ccsInteger, "");
$this->Label1 = new clsField("Label1", ccsText, "");
$this->nivo = new clsField("nivo", ccsInteger, "");
}
//End Class_Initialize Event
//SetOrder Method @6-029DA6D2
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_id" => array("id", ""),
"Sorter1" => array("username", ""),
"Sorter_nivo" => array("nivo", "")));
}
//End SetOrder Method
//Prepare Method @6-B1498237
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_keyword", ccsMemo, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "username", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsMemo),false);
$this->Where = $this->wp->Criterion[1];
}
//End Prepare Method
//Open Method @6-91C3D754
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM korisnici";
$this->SQL = "SELECT * " .
"FROM korisnici";
$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-A2A9E0AA
function SetValues()
{
$this->id->SetDBValue(trim($this->f("id")));
$this->Label1->SetDBValue($this->f("username"));
$this->nivo->SetDBValue(trim($this->f("nivo")));
}
//End SetValues Method
} //End korisniciDataSource Class @6-FCB6E20C
//Include Page implementation @20-5CD56755
include_once("./Footer.php");
//End Include Page implementation
//Initialize Page @1-7FC6BB28
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "korisnici_list.php";
$Redirect = "";
$TemplateFileName = "korisnici_list.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-0E171770
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader();
$Header->BindEvents();
$Header->TemplatePath = "./";
$Header->Initialize();
$korisniciSearch = new clsRecordkorisniciSearch();
$korisnici = new clsGridkorisnici();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
$korisnici->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-4F9C3B2A
$Header->Operations();
$korisniciSearch->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-5EA28F18
$Header->Show("Header");
$korisniciSearch->Show();
$korisnici->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
?>
|