Viewing file: topics_list.php (12.43 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 @26-39DC296A
include_once("./Header.php");
//End Include Page implementation
//Include Page implementation @31-B296E705
include_once("./Header1.php");
//End Include Page implementation
class clsGridtopics { //topics class @6-B58EF3FE
//Variables @6-E457DF6D
// 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 $Sorter_title;
var $Sorter_info;
var $Sorter_imageID;
var $Navigator;
//End Variables
//Class_Initialize Event @6-929BC4D2
function clsGridtopics()
{
global $FileName;
$this->ComponentName = "topics";
$this->Visible = True;
$this->Errors = new clsErrors();
$this->ErrorBlock = "Grid topics";
$this->ds = new clstopicsDataSource();
$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("topicsOrder", "");
$this->SorterDirection = CCGetParam("topicsDir", "");
$this->Id = new clsControl(ccsLink, "Id", "Id", ccsInteger, "", CCGetRequestParam("Id", ccsGet));
$this->title = new clsControl(ccsLabel, "title", "title", ccsText, "", CCGetRequestParam("title", ccsGet));
$this->info = new clsControl(ccsLabel, "info", "info", ccsText, "", CCGetRequestParam("info", ccsGet));
$this->Label1 = new clsControl(ccsLabel, "Label1", "Label1", ccsText, "", CCGetRequestParam("Label1", ccsGet));
$this->imageID = new clsControl(ccsLabel, "imageID", "imageID", ccsInteger, "", CCGetRequestParam("imageID", ccsGet));
$this->Sorter_Id = new clsSorter($this->ComponentName, "Sorter_Id", $FileName);
$this->Sorter_title = new clsSorter($this->ComponentName, "Sorter_title", $FileName);
$this->Sorter_info = new clsSorter($this->ComponentName, "Sorter_info", $FileName);
$this->Sorter_imageID = new clsSorter($this->ComponentName, "Sorter_imageID", $FileName);
$this->topics_Insert = new clsControl(ccsLink, "topics_Insert", "topics_Insert", ccsText, "", CCGetRequestParam("topics_Insert", ccsGet));
$this->topics_Insert->Parameters = CCGetQueryString("QueryString", Array("Id", "ccsForm"));
$this->topics_Insert->Page = "topics_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-751CBE17
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 = "topics_maint.php";
$this->title->SetValue($this->ds->title->GetValue());
$this->info->SetValue($this->ds->info->GetValue());
$this->Label1->SetValue($this->ds->Label1->GetValue());
$this->imageID->SetValue($this->ds->imageID->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow");
$this->Id->Show();
$this->title->Show();
$this->info->Show();
$this->Label1->Show();
$this->imageID->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->Sorter_title->Show();
$this->Sorter_info->Show();
$this->Sorter_imageID->Show();
$this->topics_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->ds->close();
}
//End Show Method
//GetErrors Method @6-25D2B445
function GetErrors()
{
$errors = "";
$errors .= $this->Id->Errors->ToString();
$errors .= $this->title->Errors->ToString();
$errors .= $this->info->Errors->ToString();
$errors .= $this->Label1->Errors->ToString();
$errors .= $this->imageID->Errors->ToString();
$errors .= $this->Errors->ToString();
$errors .= $this->ds->Errors->ToString();
return $errors;
}
//End GetErrors Method
} //End topics Class @6-FCB6E20C
class clstopicsDataSource extends clsDBConnection1 { //topicsDataSource Class @6-81BFC8A9
//DataSource Variables @6-4A761E7D
var $CCSEvents = "";
var $CCSEventResult;
var $ErrorBlock;
var $BlockExecution;
var $CountSQL;
var $wp;
// Datasource fields
var $Id;
var $title;
var $info;
var $Label1;
var $imageID;
//End DataSource Variables
//Class_Initialize Event @6-B2F0950D
function clstopicsDataSource()
{
$this->ErrorBlock = "Grid topics";
$this->Initialize();
$this->Id = new clsField("Id", ccsInteger, "");
$this->title = new clsField("title", ccsText, "");
$this->info = new clsField("info", ccsText, "");
$this->Label1 = new clsField("Label1", ccsText, "");
$this->imageID = new clsField("imageID", ccsInteger, "");
}
//End Class_Initialize Event
//SetOrder Method @6-FFE1A01E
function SetOrder($SorterName, $SorterDirection)
{
$this->Order = "";
$this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection,
array("Sorter_Id" => array("Id", ""),
"Sorter_title" => array("title", ""),
"Sorter_info" => array("info", ""),
"Sorter_imageID" => array("imageID", "")));
}
//End SetOrder Method
//Prepare Method @6-8C5BFFEE
function Prepare()
{
$this->wp = new clsSQLParameters($this->ErrorBlock);
$this->wp->AddParameter("1", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->AddParameter("2", "urls_keyword", ccsText, "", "", $this->Parameters["urls_keyword"], "", false);
$this->wp->Criterion[1] = $this->wp->Operation(opContains, "title", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsText),false);
$this->wp->Criterion[2] = $this->wp->Operation(opContains, "info", $this->wp->GetDBValue("2"), $this->ToSQL($this->wp->GetDBValue("2"), ccsText),false);
$this->Where = $this->wp->opOR(false, $this->wp->Criterion[1], $this->wp->Criterion[2]);
}
//End Prepare Method
//Open Method @6-6A1EB4AC
function Open()
{
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect");
$this->CountSQL = "SELECT COUNT(*) " .
"FROM topics";
$this->SQL = "SELECT * " .
"FROM topics";
$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-A25F499C
function SetValues()
{
$this->Id->SetDBValue(trim($this->f("Id")));
$this->title->SetDBValue($this->f("title"));
$this->info->SetDBValue($this->f("status"));
$this->Label1->SetDBValue($this->f("english"));
$this->imageID->SetDBValue(trim($this->f("meni")));
}
//End SetValues Method
} //End topicsDataSource Class @6-FCB6E20C
//Include Page implementation @27-5CD56755
include_once("./Footer.php");
//End Include Page implementation
//Initialize Page @1-6D08B4B6
// Variables
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
// Events;
$CCSEvents = "";
$CCSEventResult = "";
$FileName = "topics_list.php";
$Redirect = "";
$TemplateFileName = "topics_list.html";
$BlockToParse = "main";
$PathToRoot = "./";
//End Initialize Page
//Authenticate User @1-DC94A87D
CCSecurityRedirect("1", "");
//End Authenticate User
//Initialize Objects @1-8B436105
$DBConnection1 = new clsDBConnection1();
// Controls
$Header = new clsHeader();
$Header->BindEvents();
$Header->TemplatePath = "./";
$Header->Initialize();
$Header11 = new clsHeader1();
$Header11->BindEvents();
$Header11->TemplatePath = "./";
$Header11->Initialize();
$topics = new clsGridtopics();
$Footer = new clsFooter();
$Footer->BindEvents();
$Footer->TemplatePath = "./";
$Footer->Initialize();
$topics->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize");
if($Charset) {
header("Content-Type: text/html; charset=" . $Charset);
}
//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-7746A8A1
$Header->Operations();
$Header11->Operations();
$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-B27B68CA
$Header->Show("Header");
$Header11->Show("Header11");
$topics->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
?>
|