ComponentName = "departments"; $this->Visible = True; $this->Errors = new clsErrors(); $this->ErrorBlock = "Grid departments"; $this->ds = new clsdepartmentsDataSource(); $this->PageSize = CCGetParam($this->ComponentName . "PageSize", ""); if(!is_numeric($this->PageSize) || !strlen($this->PageSize)) $this->PageSize = 10; else if ($this->PageSize > 100) $this->PageSize = 100; else $this->PageSize = intval($this->PageSize); if($this->PageSize == 0) $this->Errors->addError("

Form: Grid " . $this->ComponentName . "
Error: (CCS06) Invalid page size.

"); $this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1)); $this->department_name = new clsControl(ccsLink, "department_name", "department_name", ccsText, "", CCGetRequestParam("department_name", ccsGet)); $this->department_name->Parameters = CCGetQueryString("QueryString", Array("ccsForm")); $this->department_name->Parameters = CCAddParam($this->department_name->Parameters, "id", CCGetFromGet("id", "")); $this->department_name->Page = "index.htm"; $this->department_descripcion = new clsControl(ccsLabel, "department_descripcion", "department_descripcion", ccsMemo, "", CCGetRequestParam("department_descripcion", ccsGet)); $this->department_descripcion->HTML = true; $this->activo = new clsControl(ccsLabel, "activo", "activo", ccsText, "", CCGetRequestParam("activo", ccsGet)); } //End Class_Initialize Event //Initialize Method @109-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 @109-643F647B function Show() { global $Tpl; if(!$this->Visible) return; $ShownRecords = 0; $this->ds->Parameters["urlid"] = CCGetFromGet("id", ""); $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_name->SetValue($this->ds->department_name->GetValue()); $this->department_descripcion->SetValue($this->ds->department_descripcion->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->department_name->Show(); $this->department_descripcion->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->activo->SetValue($this->ds->activo->GetValue()); $this->activo->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->ds->close(); } //End Show Method //GetErrors Method @109-620E630F function GetErrors() { $errors = ""; $errors .= $this->department_name->Errors->ToString(); $errors .= $this->department_descripcion->Errors->ToString(); $errors .= $this->Errors->ToString(); $errors .= $this->ds->Errors->ToString(); return $errors; } //End GetErrors Method } //End departments Class @109-FCB6E20C class clsdepartmentsDataSource extends clsDBIntranet { //departmentsDataSource Class @109-2BF64B92 //DataSource Variables @109-3B0A1F2B var $CCSEvents = ""; var $CCSEventResult; var $ErrorBlock; var $CountSQL; var $wp; // Datasource fields var $department_name; var $department_descripcion; var $activo; //End DataSource Variables //Class_Initialize Event @109-CE54EF1C function clsdepartmentsDataSource() { $this->ErrorBlock = "Grid departments"; $this->Initialize(); $this->department_name = new clsField("department_name", ccsText, ""); $this->department_descripcion = new clsField("department_descripcion", ccsMemo, ""); $this->activo = new clsField("activo", ccsText, ""); } //End Class_Initialize Event //SetOrder Method @109-9E1383D1 function SetOrder($SorterName, $SorterDirection) { $this->Order = ""; $this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection, ""); } //End SetOrder Method //Prepare Method @109-5380D785 function Prepare() { $this->wp = new clsSQLParameters($this->ErrorBlock); $this->wp->AddParameter("1", "urlid", ccsInteger, "", "", $this->Parameters["urlid"], 0, false); $this->wp->Criterion[1] = $this->wp->Operation(opEqual, "department_id", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false); $this->wp->Criterion[2] = "department_manager_id = '1'"; $this->Where = $this->wp->opAND(false, $this->wp->Criterion[1], $this->wp->Criterion[2]); } //End Prepare Method //Open Method @109-05059776 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect"); $this->CountSQL = "SELECT COUNT(*) " . "FROM departments"; $this->SQL = "SELECT * " . "FROM departments"; $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 @109-C44F1EDF function SetValues() { $this->department_name->SetDBValue($this->f("department_name")); $this->department_descripcion->SetDBValue($this->f("department_descripcion")); $this->activo->SetDBValue($this->f("department_manager_id")); } //End SetValues Method } //End departmentsDataSource Class @109-FCB6E20C class clsGriddepartments_employees_gro { //departments_employees_gro class @3-D90CCADD //Variables @3-5466DCA4 // 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_emp_name; var $Sorter_city; var $Sorter_title; var $Sorter_picture; var $Sorter_phone_home; var $Sorter_phone_work; var $Sorter_phone_cell; var $Navigator; //End Variables //Class_Initialize Event @3-75120687 function clsGriddepartments_employees_gro() { global $FileName; $this->ComponentName = "departments_employees_gro"; $this->Visible = True; $this->Errors = new clsErrors(); $this->ErrorBlock = "Grid departments_employees_gro"; $this->ds = new clsdepartments_employees_groDataSource(); $this->PageSize = CCGetParam($this->ComponentName . "PageSize", ""); if(!is_numeric($this->PageSize) || !strlen($this->PageSize)) $this->PageSize = 100; else if ($this->PageSize > 1000) $this->PageSize = 1000; else $this->PageSize = intval($this->PageSize); if($this->PageSize == 0) $this->Errors->addError("

Form: Grid " . $this->ComponentName . "
Error: (CCS06) Invalid page size.

"); $this->PageNumber = intval(CCGetParam($this->ComponentName . "Page", 1)); $this->SorterName = CCGetParam("departments_employees_groOrder", ""); $this->SorterDirection = CCGetParam("departments_employees_groDir", ""); $this->emp_name = new clsControl(ccsLabel, "emp_name", "emp_name", ccsText, "", CCGetRequestParam("emp_name", ccsGet)); $this->city = new clsControl(ccsLabel, "city", "city", ccsText, "", CCGetRequestParam("city", ccsGet)); $this->title = new clsControl(ccsLabel, "title", "title", ccsText, "", CCGetRequestParam("title", ccsGet)); $this->picture = new clsControl(ccsLabel, "picture", "picture", ccsText, "", CCGetRequestParam("picture", ccsGet)); $this->phone_home = new clsControl(ccsLabel, "phone_home", "phone_home", ccsText, "", CCGetRequestParam("phone_home", ccsGet)); $this->phone_work = new clsControl(ccsLabel, "phone_work", "phone_work", ccsText, "", CCGetRequestParam("phone_work", ccsGet)); $this->phone_cell = new clsControl(ccsLabel, "phone_cell", "phone_cell", ccsText, "", CCGetRequestParam("phone_cell", ccsGet)); $this->Sorter_emp_name = new clsSorter($this->ComponentName, "Sorter_emp_name", $FileName); $this->Sorter_city = new clsSorter($this->ComponentName, "Sorter_city", $FileName); $this->Sorter_title = new clsSorter($this->ComponentName, "Sorter_title", $FileName); $this->Sorter_picture = new clsSorter($this->ComponentName, "Sorter_picture", $FileName); $this->Sorter_phone_home = new clsSorter($this->ComponentName, "Sorter_phone_home", $FileName); $this->Sorter_phone_work = new clsSorter($this->ComponentName, "Sorter_phone_work", $FileName); $this->Sorter_phone_cell = new clsSorter($this->ComponentName, "Sorter_phone_cell", $FileName); $this->Inscribirse = new clsControl(ccsLink, "Inscribirse", "Inscribirse", ccsText, "", CCGetRequestParam("Inscribirse", ccsGet)); $this->Inscribirse->Parameters = CCGetQueryString("QueryString", Array("ccsForm")); $this->Inscribirse->Parameters = CCAddParam($this->Inscribirse->Parameters, "id", CCGetFromGet("id", "")); $this->Inscribirse->Page = "inscripcion.htm"; $this->Navigator = new clsNavigator($this->ComponentName, "Navigator", $FileName, 10, tpCentered); } //End Class_Initialize Event //Initialize Method @3-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 @3-B7AE587E function Show() { global $Tpl; if(!$this->Visible) return; $ShownRecords = 0; $this->ds->Parameters["urlid"] = CCGetFromGet("id", ""); $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->emp_name->SetValue($this->ds->emp_name->GetValue()); $this->city->SetValue($this->ds->city->GetValue()); $this->title->SetValue($this->ds->title->GetValue()); $this->picture->SetValue($this->ds->picture->GetValue()); $this->phone_home->SetValue($this->ds->phone_home->GetValue()); $this->phone_work->SetValue($this->ds->phone_work->GetValue()); $this->phone_cell->SetValue($this->ds->phone_cell->GetValue()); $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow"); $this->emp_name->Show(); $this->city->Show(); $this->title->Show(); $this->picture->Show(); $this->phone_home->Show(); $this->phone_work->Show(); $this->phone_cell->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_emp_name->Show(); $this->Sorter_city->Show(); $this->Sorter_title->Show(); $this->Sorter_picture->Show(); $this->Sorter_phone_home->Show(); $this->Sorter_phone_work->Show(); $this->Sorter_phone_cell->Show(); $this->Inscribirse->Show(); $this->Navigator->Show(); $Tpl->parse(); $Tpl->block_path = $ParentPath; $this->ds->close(); } //End Show Method //GetErrors Method @3-C7EDB10B function GetErrors() { $errors = ""; $errors .= $this->emp_name->Errors->ToString(); $errors .= $this->city->Errors->ToString(); $errors .= $this->title->Errors->ToString(); $errors .= $this->picture->Errors->ToString(); $errors .= $this->phone_home->Errors->ToString(); $errors .= $this->phone_work->Errors->ToString(); $errors .= $this->phone_cell->Errors->ToString(); $errors .= $this->Errors->ToString(); $errors .= $this->ds->Errors->ToString(); return $errors; } //End GetErrors Method } //End departments_employees_gro Class @3-FCB6E20C class clsdepartments_employees_groDataSource extends clsDBIntranet { //departments_employees_groDataSource Class @3-5A0667E0 //DataSource Variables @3-CFB77C63 var $CCSEvents = ""; var $CCSEventResult; var $ErrorBlock; var $CountSQL; var $wp; // Datasource fields var $emp_name; var $city; var $title; var $picture; var $phone_home; var $phone_work; var $phone_cell; //End DataSource Variables //Class_Initialize Event @3-83DA5EEA function clsdepartments_employees_groDataSource() { $this->ErrorBlock = "Grid departments_employees_gro"; $this->Initialize(); $this->emp_name = new clsField("emp_name", ccsText, ""); $this->city = new clsField("city", ccsText, ""); $this->title = new clsField("title", ccsText, ""); $this->picture = new clsField("picture", ccsText, ""); $this->phone_home = new clsField("phone_home", ccsText, ""); $this->phone_work = new clsField("phone_work", ccsText, ""); $this->phone_cell = new clsField("phone_cell", ccsText, ""); } //End Class_Initialize Event //SetOrder Method @3-BB3010AB function SetOrder($SorterName, $SorterDirection) { $this->Order = "emp_id, emp_name"; $this->Order = CCGetOrder($this->Order, $SorterName, $SorterDirection, array("Sorter_emp_name" => array("emp_name", ""), "Sorter_city" => array("city", ""), "Sorter_title" => array("title", ""), "Sorter_picture" => array("picture", ""), "Sorter_phone_home" => array("phone_home", ""), "Sorter_phone_work" => array("phone_work", ""), "Sorter_phone_cell" => array("phone_cell", ""))); } //End SetOrder Method //Prepare Method @3-A42F6EF7 function Prepare() { $this->wp = new clsSQLParameters($this->ErrorBlock); $this->wp->AddParameter("1", "urlid", ccsInteger, "", "", $this->Parameters["urlid"], 0, false); $this->wp->Criterion[1] = $this->wp->Operation(opEqual, "employees.department_id", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false); $this->wp->Criterion[2] = "employees.group_id = 1"; $this->wp->Criterion[3] = "departments.department_manager_id = '1'"; $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 @3-02239C91 function Open() { $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect"); $this->CountSQL = "SELECT COUNT(*) " . "FROM (employees INNER JOIN departments ON " . "employees.department_id = departments.department_id) INNER JOIN groups ON " . "groups.group_id = employees.group_id"; $this->SQL = "SELECT department_name, emp_login, emp_name, title, phone_home, phone_work, phone_cell, fax, email, city, zip, address, picture " . "FROM (employees INNER JOIN departments ON " . "employees.department_id = departments.department_id) INNER JOIN groups ON " . "groups.group_id = employees.group_id"; $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 @3-76FD7771 function SetValues() { $this->emp_name->SetDBValue($this->f("emp_name")); $this->city->SetDBValue($this->f("city")); $this->title->SetDBValue($this->f("title")); $this->picture->SetDBValue($this->f("picture")); $this->phone_home->SetDBValue($this->f("phone_home")); $this->phone_work->SetDBValue($this->f("phone_work")); $this->phone_cell->SetDBValue($this->f("phone_cell")); } //End SetValues Method } //End departments_employees_groDataSource Class @3-FCB6E20C //Initialize Page @1-9BD5B7FB // Variables $FileName = ""; $Redirect = ""; $Tpl = ""; $TemplateFileName = ""; $BlockToParse = ""; $ComponentName = ""; // Events; $CCSEvents = ""; $CCSEventResult = ""; $FileName = "index.htm"; $Redirect = ""; $TemplateFileName = "index.html"; $BlockToParse = "main"; $PathToRoot = "./"; //End Initialize Page //Initialize Objects @1-7DB799ED $DBIntranet = new clsDBIntranet(); // Controls $departments = new clsGriddepartments(); $Inscribirse = new clsControl(ccsLink, "Inscribirse", "Inscribirse", ccsText, "", CCGetRequestParam("Inscribirse", ccsGet)); $Inscribirse->Parameters = CCGetQueryString("QueryString", Array("ccsForm")); $Inscribirse->Parameters = CCAddParam($Inscribirse->Parameters, "id", CCGetFromGet("id", "")); $Inscribirse->Page = "inscripcion.htm"; $departments_employees_gro = new clsGriddepartments_employees_gro(); $Link1 = new clsControl(ccsLink, "Link1", "Link1", ccsText, "", CCGetRequestParam("Link1", ccsGet)); $Link1->Parameters = CCGetQueryString("QueryString", Array("ccsForm")); $Link1->Parameters = CCAddParam($Link1->Parameters, "id", CCGetFromGet("id", "")); $Link1->Page = "listado.htm"; $departments->Initialize(); $departments_employees_gro->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 //Go to destination page @1-22C088D1 if($Redirect) { $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); $DBIntranet->close(); header("Location: " . $Redirect); exit; } //End Go to destination page //Show Page @1-F8CA0B52 $departments->Show(); $departments_employees_gro->Show(); $Inscribirse->Show(); $Link1->Show(); $Tpl->Parse("main", false); $main_block = $Tpl->GetVar("main"); $generated_with = "
Copyright www.minizz.com
"; if(preg_match("/<\/body>/i", $main_block)) { $main_block = preg_replace("/<\/body>/i", $generated_with . "", $main_block); } else if(preg_match("/<\/html>/i", $main_block) && !preg_match("/<\/frameset>/i", $main_block)) { $main_block = preg_replace("/<\/html>/i", $generated_with . "", $main_block); } else if(!preg_match("/<\/frameset>/i", $main_block)) { $main_block .= $generated_with; } echo $main_block; //End Show Page //Unload Page @1-0E2619CD $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload"); $DBIntranet->close(); unset($Tpl); //End Unload Page ?>