Viewing file: admin_list.php (13.27 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php //Include Common Files @1-E2E215CA define("RelativePath", "."); define("PathToCurrentPage", "/"); define("FileName", "admin_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 @14-3DD2EFDC include_once(RelativePath . "/Header.php"); //End Include Page implementation
class clsGridadmin { //admin class @2-6C9B64E4
//Variables @2-D7C0CAAD
// Public variables public $ComponentType = "Grid"; public $ComponentName; public $Visible; public $Errors; public $ErrorBlock; public $ds; public $DataSource; public $PageSize; public $IsEmpty; public $ForceIteration = false; public $HasRecord = false; public $SorterName = ""; public $SorterDirection = ""; public $PageNumber; public $RowNumber; public $ControlsVisible = array();
public $CCSEvents = ""; public $CCSEventResult;
public $RelativePath = ""; public $Attributes;
// Grid Controls public $StaticControls; public $RowControls; public $Sorter_admin_id; public $Sorter_username_admin; public $Sorter_grupa; //End Variables
//Class_Initialize Event @2-441429A1 function clsGridadmin($RelativePath, & $Parent) { global $FileName; global $CCSLocales; global $DefaultDateFormat; $this->ComponentName = "admin"; $this->Visible = True; $this->Parent = & $Parent; $this->RelativePath = $RelativePath; $this->Errors = new clsErrors(); $this->ErrorBlock = "Grid admin"; $this->Attributes = new clsAttributes($this->ComponentName . ":"); $this->DataSource = new clsadminDataSource($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("adminOrder", ""); $this->SorterDirection = CCGetParam("adminDir", "");
$this->admin_id = new clsControl(ccsLink, "admin_id", "admin_id", ccsInteger, "", CCGetRequestParam("admin_id", ccsGet, NULL), $this); $this->admin_id->Page = "admin_maint.php"; $this->username_admin = new clsControl(ccsLabel, "username_admin", "username_admin", ccsText, "", CCGetRequestParam("username_admin", ccsGet, NULL), $this); $this->grupa = new clsControl(ccsLabel, "grupa", "grupa", ccsInteger, "", CCGetRequestParam("grupa", ccsGet, NULL), $this); $this->Sorter_admin_id = new clsSorter($this->ComponentName, "Sorter_admin_id", $FileName, $this); $this->Sorter_username_admin = new clsSorter($this->ComponentName, "Sorter_username_admin", $FileName, $this); $this->Sorter_grupa = new clsSorter($this->ComponentName, "Sorter_grupa", $FileName, $this); $this->admin_Insert = new clsControl(ccsLink, "admin_Insert", "admin_Insert", ccsText, "", CCGetRequestParam("admin_Insert", ccsGet, NULL), $this); $this->admin_Insert->Parameters = CCGetQueryString("QueryString", array("admin_id", "ccsForm")); $this->admin_Insert->Page = "admin_maint.php"; $this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpSimple, $this); } //End Class_Initialize Event
//Initialize Method @2-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 @2-B7D37668 function Show() { global $Tpl; global $CCSLocales; if(!$this->Visible) return;
$this->RowNumber = 0;
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);
$this->DataSource->Prepare(); $this->DataSource->Open(); $this->HasRecord = $this->DataSource->has_next_record(); $this->IsEmpty = ! $this->HasRecord; $this->Attributes->Show();
$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 (!$this->IsEmpty) { $this->ControlsVisible["admin_id"] = $this->admin_id->Visible; $this->ControlsVisible["username_admin"] = $this->username_admin->Visible; $this->ControlsVisible["grupa"] = $this->grupa->Visible; while ($this->ForceIteration || (($this->RowNumber < $this->PageSize) && ($this->HasRecord = $this->DataSource->has_next_record()))) { $this->RowNumber++; if ($this->HasRecord) { $this->DataSource->next_record(); $this->DataSource->SetValues(); } $Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row"; $this->admin_id->SetValue($this->DataSource->admin_id->GetValue()); $this->admin_id->Parameters = CCGetQueryString("QueryString", array("ccsForm")); $this->admin_id->Parameters = CCAddParam($this->admin_id->Parameters, "admin_id", $this->DataSource->f("admin_id")); $this->username_admin->SetValue($this->DataSource->username_admin->GetValue()); $this->grupa->SetValue($this->DataSource->grupa->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this); $this->Attributes->Show(); $this->admin_id->Show(); $this->username_admin->Show(); $this->grupa->Show(); $Tpl->block_path = $ParentPath . "/" . $GridBlock; $Tpl->parse("Row", true); } } else { // Show NoRecords block if no records are found $this->Attributes->Show(); $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_admin_id->Show(); $this->Sorter_username_admin->Show(); $this->Sorter_grupa->Show(); $this->admin_Insert->Show(); $this->Navigator->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->DataSource->close(); } //End Show Method
//GetErrors Method @2-1C76CC91 function GetErrors() { $errors = ""; $errors = ComposeStrings($errors, $this->admin_id->Errors->ToString()); $errors = ComposeStrings($errors, $this->username_admin->Errors->ToString()); $errors = ComposeStrings($errors, $this->grupa->Errors->ToString()); $errors = ComposeStrings($errors, $this->Errors->ToString()); $errors = ComposeStrings($errors, $this->DataSource->Errors->ToString()); return $errors; } //End GetErrors Method
} //End admin Class @2-FCB6E20C
class clsadminDataSource extends clsDBConnection1 { //adminDataSource Class @2-45192E89
//DataSource Variables @2-C5A6A9BA public $Parent = ""; public $CCSEvents = ""; public $CCSEventResult; public $ErrorBlock; public $CmdExecution;
public $CountSQL; public $wp;
// Datasource fields public $admin_id; public $username_admin; public $grupa; //End DataSource Variables
//DataSourceClass_Initialize Event @2-22FF289C function clsadminDataSource(& $Parent) { $this->Parent = & $Parent; $this->ErrorBlock = "Grid admin"; $this->Initialize(); $this->admin_id = new clsField("admin_id", ccsInteger, ""); $this->username_admin = new clsField("username_admin", ccsText, ""); $this->grupa = new clsField("grupa", ccsInteger, "");
} //End DataSourceClass_Initialize Event
//SetOrder Method @2-292F9BB7 function SetOrder($SorterName, $SorterDirection) { $this->Order = ""; $this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection, array("Sorter_admin_id" => array("admin_id", ""), "Sorter_username_admin" => array("username_admin", ""), "Sorter_grupa" => array("grupa", ""))); } //End SetOrder Method
//Prepare Method @2-14D6CD9D function Prepare() { global $CCSLocales; global $DefaultDateFormat; } //End Prepare Method
//Open Method @2-1AC5A737 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent); $this->CountSQL = "SELECT COUNT(*)\n\n" . "FROM admin"; $this->SQL = "SELECT * \n\n" . "FROM admin {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 @2-B5F4C2E3 function SetValues() { $this->admin_id->SetDBValue(trim($this->f("admin_id"))); $this->username_admin->SetDBValue($this->f("username_admin")); $this->grupa->SetDBValue(trim($this->f("grupa"))); } //End SetValues Method
} //End adminDataSource Class @2-FCB6E20C
//Include Page implementation @15-58DBA1E3 include_once(RelativePath . "/Footer.php"); //End Include Page implementation
//Initialize Page @1-379A8290 // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; $Attributes = "";
// Events; $CCSEvents = ""; $CCSEventResult = "";
$FileName = FileName; $Redirect = ""; $TemplateFileName = "admin_list.html"; $BlockToParse = "main"; $TemplateEncoding = "CP1252"; $PathToRoot = "./"; //End Initialize Page
//Authenticate User @1-DC94A87D CCSecurityRedirect("1", ""); //End Authenticate User
//Before Initialize @1-E870CEBC $CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage); //End Before Initialize
//Initialize Objects @1-F39CFE58 $DBConnection1 = new clsDBConnection1(); $MainPage->Connections["Connection1"] = & $DBConnection1; $Attributes = new clsAttributes("page:"); $MainPage->Attributes = & $Attributes;
// Controls $Header = new clsHeader("", "Header", $MainPage); $Header->Initialize(); $admin = new clsGridadmin("", $MainPage); $Footer = new clsFooter("", "Footer", $MainPage); $Footer->Initialize(); $MainPage->Header = & $Header; $MainPage->admin = & $admin; $MainPage->Footer = & $Footer; $admin->Initialize();
$CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);
if ($Charset) header("Content-Type: text/html; charset=" . $Charset); //End Initialize Objects
//Initialize HTML Template @1-593C2978 $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); $Attributes->Show(); //End Initialize HTML Template
//Execute Components @1-351F985C $Header->Operations(); $Footer->Operations(); //End Execute Components
//Go to destination page @1-DEF7AD75 if($Redirect) { $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage); $DBConnection1->close(); header("Location: " . $Redirect); $Header->Class_Terminate(); unset($Header); unset($admin); $Footer->Class_Terminate(); unset($Footer); unset($Tpl); exit; } //End Go to destination page
//Show Page @1-AD353A24 $Header->Show(); $admin->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-545F716F $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage); $DBConnection1->close(); $Header->Class_Terminate(); unset($Header); unset($admin); $Footer->Class_Terminate(); unset($Footer); unset($Tpl); //End Unload Page
?>
|