|
|
|
ผมมีปัญหาเรื่องการใช้ Array เพื่อให้มันแสดงใน List box มือใหม่ พอดีกำลังทำโปรเจ็กส่งอาจารย์คับ |
|
|
|
|
|
|
|
พอดีมันขึ้นคำว่า Parse error: syntax error, unexpected '[' in C:\AppServ\www\bmsbasicmy3\asset_mast_search.php on line 65
แก้ยังไงคับ
Code (PHP)
<?php
class clsRecordasset_masterSearch
{
public $ComponentType = "Record";
public $ComponentName = NULL;
public $Parent = NULL;
public $HTMLFormAction = NULL;
public $PressedButton = NULL;
public $Errors = NULL;
public $ErrorBlock = NULL;
public $FormSubmitted = NULL;
public $FormEnctype = NULL;
public $Visible = NULL;
public $IsEmpty = NULL;
public $CCSEvents = "";
public $CCSEventResult = NULL;
public $RelativePath = "";
public $InsertAllowed = false;
public $UpdateAllowed = false;
public $DeleteAllowed = false;
public $ReadAllowed = false;
public $EditMode = false;
public $ds = NULL;
public $DataSource = NULL;
public $ValidatingControls = NULL;
public $Controls = NULL;
public $Attributes = NULL;
public function clsRecordasset_masterSearch( $RelativePath, &$Parent )
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->Visible = true;
$this->Parent =& $Parent;
$this->RelativePath = $RelativePath;
$this->Errors = new clsErrors( );
$this->ErrorBlock = "Record asset_masterSearch/Error";
$this->ReadAllowed = true;
if ( $this->Visible )
{
$this->ComponentName = "asset_masterSearch";
$this->Attributes = new clsAttributes( $this->ComponentName.":" );
$CCSForm = split( ":", CCGetFromGet( "ccsForm", "" ), 2 );
if ( sizeof( $CCSForm ) == 1 )
{
$CCSForm[1] = "";
}
list( $FormName, $FormMethod ) = FormName;
$this->FormEnctype = "application/x-www-form-urlencoded";
$this->FormSubmitted = $FormName == $this->ComponentName;
$Method = $this->FormSubmitted ? ccsPost : ccsGet;
$this->s_code = new clsControl( ccsTextBox, "s_code", "s_code", ccsText, "", CCGetRequestParam( "s_code", $Method, NULL ), $this );
$this->s_sap_code = new clsControl( ccsTextBox, "s_sap_code", "s_sap_code", ccsText, "", CCGetRequestParam( "s_sap_code", $Method, NULL ), $this );
$this->s_aname = new clsControl( ccsTextBox, "s_aname", "s_aname", ccsText, "", CCGetRequestParam( "s_aname", $Method, NULL ), $this );
$this->s_process_id = new clsControl( ccsTextBox, "s_process_id", "s_process_id", ccsInteger, "", CCGetRequestParam( "s_process_id", $Method, NULL ), $this );
$this->s_bcode = new clsControl( ccsListBox, "s_bcode", "s_bcode", ccsText, "", CCGetRequestParam( "s_bcode", $Method, NULL ), $this );
$this->s_bcode->DSType = dsTable;
$this->s_bcode->DataSource = new clsDBbmss_conection( );
$this->s_bcode->ds =& $this->s_bcode->DataSource;
$this->s_bcode->DataSource->SQL = "SELECT * \n"."FROM loc_building {SQL_Where} {SQL_OrderBy}";
$this->s_bcode->DataSource->Order = "bname";
$this->s_bcode->DBFormat = array( "bcode", "bname", "" )[2];
$this->s_bcode->TextColumn = array( "bcode", "bname", "" )[1];
$this->s_bcode->BoundColumn = array( "bcode", "bname", "" )[0];
array( "bcode", "bname", "" );
$this->s_bcode->DataSource->Order = "bname";
$this->s_branchid = new clsControl( ccsListBox, "s_branchid", "s_branchid", ccsText, "", CCGetRequestParam( "s_branchid", $Method, NULL ), $this );
$this->s_branchid->DSType = dsTable;
$this->s_branchid->DataSource = new clsDBbmss_conection( );
$this->s_branchid->ds =& $this->s_branchid->DataSource;
$this->s_branchid->DataSource->SQL = "SELECT * \n"."FROM m_branch {SQL_Where} {SQL_OrderBy}";
$this->s_branchid->DBFormat = array( "branchid", "descriptions", "" )[2];
$this->s_branchid->TextColumn = array( "branchid", "descriptions", "" )[1];
$this->s_branchid->BoundColumn = array( "branchid", "descriptions", "" )[0];
array( "branchid", "descriptions", "" );
$this->s_groupid = new clsControl( ccsListBox, "s_groupid", "s_groupid", ccsText, "", CCGetRequestParam( "s_groupid", $Method, NULL ), $this );
$this->s_groupid->DSType = dsTable;
$this->s_groupid->DataSource = new clsDBbmss_conection( );
$this->s_groupid->ds =& $this->s_groupid->DataSource;
$this->s_groupid->DataSource->SQL = "SELECT * \n"."FROM asset_m_group {SQL_Where} {SQL_OrderBy}";
$this->s_groupid->DataSource->Order = "description";
$this->s_groupid->DBFormat = array( "groupid", "description", "" )[2];
$this->s_groupid->TextColumn = array( "groupid", "description", "" )[1];
$this->s_groupid->BoundColumn = array( "groupid", "description", "" )[0];
array( "groupid", "description", "" );
$this->s_groupid->DataSource->Order = "description";
$this->s_catagory = new clsControl( ccsListBox, "s_catagory", "s_catagory", ccsText, "", CCGetRequestParam( "s_catagory", $Method, NULL ), $this );
$this->s_catagory->DSType = dsSQL;
$this->s_catagory->DataSource = new clsDBbmss_conection( );
$this->s_catagory->ds =& $this->s_catagory->DataSource;
$this->s_catagory->DBFormat = array( "catagory", "descriptions", "" )[2];
$this->s_catagory->TextColumn = array( "catagory", "descriptions", "" )[1];
$this->s_catagory->BoundColumn = array( "catagory", "descriptions", "" )[0];
array( "catagory", "descriptions", "" );
$this->s_catagory->DataSource->Parameters['ctrls_groupid'] = $this->s_groupid->GetValue( true );
$this->s_catagory->DataSource->wp = new clsSQLParameters( );
$this->s_catagory->DataSource->wp->AddParameter( "1", "ctrls_groupid", ccsText, "", "", $this->s_catagory->DataSource->Parameters['ctrls_groupid'], "", false );
$this->s_catagory->DataSource->SQL = "SELECT * \n"."FROM asset_m_acatagory \n"."WHERE groupid = '".$this->s_catagory->DataSource->SQLValue( $this->s_catagory->DataSource->wp->GetDBValue( "1" ), ccsText )."' {SQL_OrderBy}";
$this->s_catagory->DataSource->Order = "descriptions";
$this->s_a_status = new clsControl( ccsListBox, "s_a_status", "s_a_status", ccsText, "", CCGetRequestParam( "s_a_status", $Method, NULL ), $this );
$this->s_a_status->DSType = dsTable;
$this->s_a_status->DataSource = new clsDBbmss_conection( );
$this->s_a_status->ds =& $this->s_a_status->DataSource;
$this->s_a_status->DataSource->SQL = "SELECT * \n"."FROM asset_m_astatus {SQL_Where} {SQL_OrderBy}";
$this->s_a_status->DBFormat = array( "a_status", "descriptions", "" )[2];
$this->s_a_status->TextColumn = array( "a_status", "descriptions", "" )[1];
$this->s_a_status->BoundColumn = array( "a_status", "descriptions", "" )[0];
array( "a_status", "descriptions", "" );
$this->asset_masterPageSize = new clsControl( ccsListBox, "asset_masterPageSize", "asset_masterPageSize", ccsText, "", CCGetRequestParam( "asset_masterPageSize", $Method, NULL ), $this );
$this->asset_masterPageSize->DSType = dsListOfValues;
$this->asset_masterPageSize->Values = array(
array( "", "เลือกค่าที่ต้องการ" ),
array( "5", "5" ),
array( "10", "10" ),
array( "25", "25" ),
array( "100", "100" )
);
$this->s_dept = new clsControl( ccsListBox, "s_dept", "s_dept", ccsText, "", CCGetRequestParam( "s_dept", $Method, NULL ), $this );
$this->s_dept->DSType = dsSQL;
$this->s_dept->DataSource = new clsDBbmss_conection( );
$this->s_dept->ds =& $this->s_dept->DataSource;
$this->s_dept->DBFormat = array( "dept", "descriptions", "" )[2];
$this->s_dept->TextColumn = array( "dept", "descriptions", "" )[1];
$this->s_dept->BoundColumn = array( "dept", "descriptions", "" )[0];
array( "dept", "descriptions", "" );
$this->s_dept->DataSource->Parameters['ctrls_branchid'] = $this->s_branchid->GetValue( true );
$this->s_dept->DataSource->wp = new clsSQLParameters( );
$this->s_dept->DataSource->wp->AddParameter( "1", "ctrls_branchid", ccsText, "", "", $this->s_dept->DataSource->Parameters['ctrls_branchid'], "", false );
$this->s_dept->DataSource->SQL = "SELECT * \n"."FROM m_dept\n"."WHERE branchid = '".$this->s_dept->DataSource->SQLValue( $this->s_dept->DataSource->wp->GetDBValue( "1" ), ccsText )."' ";
$this->s_dept->DataSource->Order = "";
$this->s_serial_no = new clsControl( ccsTextBox, "s_serial_no", "s_serial_no", ccsText, "", CCGetRequestParam( "s_serial_no", $Method, NULL ), $this );
$this->ClearParameters = new clsControl( ccsLink, "ClearParameters", "ClearParameters", ccsText, "", CCGetRequestParam( "ClearParameters", $Method, NULL ), $this );
$this->ClearParameters->Page = "asset_mast_search.php";
$this->Button_DoSearch = new clsButton( "Button_DoSearch", $Method, $this );
}
}
public function Validate( )
{
global $CCSLocales;
$Validation = true;
$Where = "";
$Validation = $this->s_code->Validate( ) && $Validation;
$Validation = $this->s_sap_code->Validate( ) && $Validation;
$Validation = $this->s_aname->Validate( ) && $Validation;
$Validation = $this->s_process_id->Validate( ) && $Validation;
$Validation = $this->s_bcode->Validate( ) && $Validation;
$Validation = $this->s_branchid->Validate( ) && $Validation;
$Validation = $this->s_groupid->Validate( ) && $Validation;
$Validation = $this->s_catagory->Validate( ) && $Validation;
$Validation = $this->s_a_status->Validate( ) && $Validation;
$Validation = $this->asset_masterPageSize->Validate( ) && $Validation;
$Validation = $this->s_dept->Validate( ) && $Validation;
$Validation = $this->s_serial_no->Validate( ) && $Validation;
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "OnValidate", $this );
$Validation = $Validation && $this->s_code->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_sap_code->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_aname->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_process_id->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_bcode->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_branchid->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_groupid->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_catagory->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_a_status->Errors->Count( ) == 0;
$Validation = $Validation && $this->asset_masterPageSize->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_dept->Errors->Count( ) == 0;
$Validation = $Validation && $this->s_serial_no->Errors->Count( ) == 0;
return $this->Errors->Count( ) == 0 && $Validation;
}
public function CheckErrors( )
{
$errors = false;
$errors = $errors || $this->s_code->Errors->Count( );
$errors = $errors || $this->s_sap_code->Errors->Count( );
$errors = $errors || $this->s_aname->Errors->Count( );
$errors = $errors || $this->s_process_id->Errors->Count( );
$errors = $errors || $this->s_bcode->Errors->Count( );
$errors = $errors || $this->s_branchid->Errors->Count( );
$errors = $errors || $this->s_groupid->Errors->Count( );
$errors = $errors || $this->s_catagory->Errors->Count( );
$errors = $errors || $this->s_a_status->Errors->Count( );
$errors = $errors || $this->asset_masterPageSize->Errors->Count( );
$errors = $errors || $this->s_dept->Errors->Count( );
$errors = $errors || $this->s_serial_no->Errors->Count( );
$errors = $errors || $this->ClearParameters->Errors->Count( );
$errors = $errors || $this->Errors->Count( );
return $errors;
}
public function Operation( )
{
if ( !$this->Visible )
{
return;
}
global $Redirect;
global $FileName;
if ( !$this->FormSubmitted )
{
return;
}
if ( $this->FormSubmitted )
{
$this->PressedButton = "Button_DoSearch";
if ( $this->Button_DoSearch->Pressed )
{
$this->PressedButton = "Button_DoSearch";
}
}
$Redirect = "asset_mast_search.php";
if ( $this->Validate( ) )
{
if ( $this->PressedButton == "Button_DoSearch" )
{
$Redirect = "asset_mast_search.php"."?".CCMergeQueryStrings( CCGetQueryString( "Form", array( "Button_DoSearch", "Button_DoSearch_x", "Button_DoSearch_y" ) ) );
if ( !CCGetEvent( $this->Button_DoSearch->CCSEvents, "OnClick", $this->Button_DoSearch ) )
{
$Redirect = "";
}
}
}
else
{
$Redirect = "";
}
}
public function Show( )
{
global $CCSUseAmp;
global $Tpl;
global $FileName;
global $CCSLocales;
$Error = "";
if ( !$this->Visible )
{
return;
}
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "BeforeSelect", $this );
$this->s_bcode->Prepare( );
$this->s_branchid->Prepare( );
$this->s_groupid->Prepare( );
$this->s_catagory->Prepare( );
$this->s_a_status->Prepare( );
$this->asset_masterPageSize->Prepare( );
$this->s_dept->Prepare( );
$RecordBlock = "Record ".$this->ComponentName;
$ParentPath = $Tpl->block_path;
$Tpl->block_path = $ParentPath."/".$RecordBlock;
$this->EditMode = $this->EditMode && $this->ReadAllowed;
if ( !$this->FormSubmitted )
{
}
if ( $this->FormSubmitted || $this->CheckErrors( ) )
{
$Error = "";
$Error = ComposeStrings( $Error, $this->s_code->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_sap_code->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_aname->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_process_id->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_bcode->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_branchid->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_groupid->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_catagory->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_a_status->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->asset_masterPageSize->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_dept->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->s_serial_no->Errors->ToString( ) );
$Error = ComposeStrings( $Error, $this->ClearParameters->Errors->ToString( ) );
$Error = ComposeStrings( $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", !$CCSUseAmp ? $this->HTMLFormAction : str_replace( "&", "&", $this->HTMLFormAction ) );
$Tpl->SetVar( "HTMLFormName", $this->ComponentName );
$Tpl->SetVar( "HTMLFormEnctype", $this->FormEnctype );
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "BeforeShow", $this );
$this->Attributes->Show( );
if ( !$this->Visible )
{
$Tpl->block_path = $ParentPath;
}
else
{
$this->s_code->Show( );
$this->s_sap_code->Show( );
$this->s_aname->Show( );
$this->s_process_id->Show( );
$this->s_bcode->Show( );
$this->s_branchid->Show( );
$this->s_groupid->Show( );
$this->s_catagory->Show( );
$this->s_a_status->Show( );
$this->asset_masterPageSize->Show( );
$this->s_dept->Show( );
$this->s_serial_no->Show( );
$this->ClearParameters->Show( );
$this->Button_DoSearch->Show( );
$Tpl->parse( );
$Tpl->block_path = $ParentPath;
}
}
}
class clsGridasset_master
{
public $ComponentType = "Grid";
public $ComponentName = NULL;
public $Visible = NULL;
public $Errors = NULL;
public $ErrorBlock = NULL;
public $ds = NULL;
public $DataSource = NULL;
public $PageSize = NULL;
public $IsEmpty = NULL;
public $ForceIteration = false;
public $HasRecord = false;
public $SorterName = "";
public $SorterDirection = "";
public $PageNumber = NULL;
public $RowNumber = NULL;
public $ControlsVisible = array( );
public $CCSEvents = "";
public $CCSEventResult = NULL;
public $RelativePath = "";
public $Attributes = NULL;
public $StaticControls = NULL;
public $RowControls = NULL;
public $AltRowControls = NULL;
public $IsAltRow = NULL;
public $Sorter_code = NULL;
public $Sorter_sap_code = NULL;
public $Sorter_aname = NULL;
public $Sorter_dept = NULL;
public $Sorter_bcode = NULL;
public $Sorter_floorno = NULL;
public $Sorter_roomno = NULL;
public $Sorter_astatus_desc = NULL;
public function clsGridasset_master( $RelativePath, &$Parent )
{
global $FileName;
global $CCSLocales;
global $DefaultDateFormat;
$this->ComponentName = "asset_master";
$this->Visible = True;
$this->Parent =& $Parent;
$this->RelativePath = $RelativePath;
$this->IsAltRow = false;
$this->Errors = new clsErrors( );
$this->ErrorBlock = "Grid asset_master";
$this->Attributes = new clsAttributes( $this->ComponentName.":" );
$this->DataSource = new clsasset_masterDataSource( $this );
$this->ds =& $this->DataSource;
$this->PageSize = CCGetParam( $this->ComponentName."PageSize", "" );
if ( !is_numeric( $this->PageSize ) || !strlen( $this->PageSize ) )
{
$this->PageSize = 50;
}
else
{
$this->PageSize = intval( $this->PageSize );
}
if ( 100 < $this->PageSize )
{
$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( "asset_masterOrder", "" );
$this->SorterDirection = CCGetParam( "asset_masterDir", "" );
$this->code = new clsControl( ccsLink, "code", "code", ccsInteger, "", CCGetRequestParam( "code", ccsGet, NULL ), $this );
$this->code->Page = "asset_mast_show.php";
$this->sap_code = new clsControl( ccsLabel, "sap_code", "sap_code", ccsText, "", CCGetRequestParam( "sap_code", ccsGet, NULL ), $this );
$this->serial_no = new clsControl( ccsLabel, "serial_no", "serial_no", ccsText, "", CCGetRequestParam( "serial_no", ccsGet, NULL ), $this );
$this->aname = new clsControl( ccsLabel, "aname", "aname", ccsText, "", CCGetRequestParam( "aname", ccsGet, NULL ), $this );
$this->dept = new clsControl( ccsLabel, "dept", "dept", ccsText, "", CCGetRequestParam( "dept", ccsGet, NULL ), $this );
$this->bcode = new clsControl( ccsLabel, "bcode", "bcode", ccsText, "", CCGetRequestParam( "bcode", ccsGet, NULL ), $this );
$this->floorno = new clsControl( ccsLabel, "floorno", "floorno", ccsText, "", CCGetRequestParam( "floorno", ccsGet, NULL ), $this );
$this->roomno = new clsControl( ccsLabel, "roomno", "roomno", ccsText, "", CCGetRequestParam( "roomno", ccsGet, NULL ), $this );
$this->a_status = new clsControl( ccsLabel, "a_status", "a_status", ccsText, "", CCGetRequestParam( "a_status", ccsGet, NULL ), $this );
$this->Alt_code = new clsControl( ccsLink, "Alt_code", "Alt_code", ccsInteger, "", CCGetRequestParam( "Alt_code", ccsGet, NULL ), $this );
$this->Alt_code->Page = "asset_mast_show.php";
$this->Alt_sap_code = new clsControl( ccsLabel, "Alt_sap_code", "Alt_sap_code", ccsText, "", CCGetRequestParam( "Alt_sap_code", ccsGet, NULL ), $this );
$this->serial_no1 = new clsControl( ccsLabel, "serial_no1", "serial_no1", ccsText, "", CCGetRequestParam( "serial_no1", ccsGet, NULL ), $this );
$this->Alt_aname = new clsControl( ccsLabel, "Alt_aname", "Alt_aname", ccsText, "", CCGetRequestParam( "Alt_aname", ccsGet, NULL ), $this );
$this->Alt_dept = new clsControl( ccsLabel, "Alt_dept", "Alt_dept", ccsText, "", CCGetRequestParam( "Alt_dept", ccsGet, NULL ), $this );
$this->Alt_bcode = new clsControl( ccsLabel, "Alt_bcode", "Alt_bcode", ccsText, "", CCGetRequestParam( "Alt_bcode", ccsGet, NULL ), $this );
$this->Alt_floorno = new clsControl( ccsLabel, "Alt_floorno", "Alt_floorno", ccsText, "", CCGetRequestParam( "Alt_floorno", ccsGet, NULL ), $this );
$this->Alt_roomno = new clsControl( ccsLabel, "Alt_roomno", "Alt_roomno", ccsText, "", CCGetRequestParam( "Alt_roomno", ccsGet, NULL ), $this );
$this->Alt_a_status = new clsControl( ccsLabel, "Alt_a_status", "Alt_a_status", ccsText, "", CCGetRequestParam( "Alt_a_status", ccsGet, NULL ), $this );
$this->asset_master_TotalRecords = new clsControl( ccsLabel, "asset_master_TotalRecords", "asset_master_TotalRecords", ccsInteger, array(
False,
0,
Null,
Null,
False,
"",
"",
1,
True,
""
), CCGetRequestParam( "asset_master_TotalRecords", ccsGet, NULL ), $this );
$this->Sorter_code = new clsSorter( $this->ComponentName, "Sorter_code", $FileName, $this );
$this->Sorter_sap_code = new clsSorter( $this->ComponentName, "Sorter_sap_code", $FileName, $this );
$this->Sorter_aname = new clsSorter( $this->ComponentName, "Sorter_aname", $FileName, $this );
$this->Sorter_dept = new clsSorter( $this->ComponentName, "Sorter_dept", $FileName, $this );
$this->Sorter_bcode = new clsSorter( $this->ComponentName, "Sorter_bcode", $FileName, $this );
$this->Sorter_floorno = new clsSorter( $this->ComponentName, "Sorter_floorno", $FileName, $this );
$this->Sorter_roomno = new clsSorter( $this->ComponentName, "Sorter_roomno", $FileName, $this );
$this->Sorter_astatus_desc = new clsSorter( $this->ComponentName, "Sorter_astatus_desc", $FileName, $this );
$this->Navigator = new clsNavigator( $this->ComponentName, "Navigator", $FileName, 10, tpCentered, $this );
}
public function Initialize( )
{
if ( !$this->Visible )
{
return;
}
$this->DataSource->PageSize =& $this->PageSize;
$this->DataSource->AbsolutePage =& $this->PageNumber;
$this->DataSource->SetOrder( $this->SorterName, $this->SorterDirection );
}
public function Show( )
{
global $Tpl;
global $CCSLocales;
if ( !$this->Visible )
{
return;
}
$this->RowNumber = 0;
$this->DataSource->Parameters['urls_code'] = CCGetFromGet( "s_code", NULL );
$this->DataSource->Parameters['urls_sap_code'] = CCGetFromGet( "s_sap_code", NULL );
$this->DataSource->Parameters['urls_aname'] = CCGetFromGet( "s_aname", NULL );
$this->DataSource->Parameters['urls_groupid'] = CCGetFromGet( "s_groupid", NULL );
$this->DataSource->Parameters['urls_catagory'] = CCGetFromGet( "s_catagory", NULL );
$this->DataSource->Parameters['urls_bcode'] = CCGetFromGet( "s_bcode", NULL );
$this->DataSource->Parameters['urls_a_status'] = CCGetFromGet( "s_a_status", NULL );
$this->DataSource->Parameters['urls_dept'] = CCGetFromGet( "s_dept", NULL );
$this->DataSource->Parameters['urls_process_id'] = CCGetFromGet( "s_process_id", NULL );
$this->DataSource->Parameters['urls_branchid'] = CCGetFromGet( "s_branchid", NULL );
$this->DataSource->Parameters['urls_serial_no'] = CCGetFromGet( "s_serial_no", NULL );
$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['code'] = $this->code->Visible;
$this->ControlsVisible['sap_code'] = $this->sap_code->Visible;
$this->ControlsVisible['serial_no'] = $this->serial_no->Visible;
$this->ControlsVisible['aname'] = $this->aname->Visible;
$this->ControlsVisible['dept'] = $this->dept->Visible;
$this->ControlsVisible['bcode'] = $this->bcode->Visible;
$this->ControlsVisible['floorno'] = $this->floorno->Visible;
$this->ControlsVisible['roomno'] = $this->roomno->Visible;
$this->ControlsVisible['a_status'] = $this->a_status->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( );
}
if ( !$this->IsAltRow )
{
$Tpl->block_path = $ParentPath."/".$GridBlock."/Row";
$this->code->SetValue( $this->DataSource->code->GetValue( ) );
$this->code->Parameters = CCGetQueryString( "QueryString", array( "ccsForm" ) );
$this->code->Parameters = CCAddParam( $this->code->Parameters, "code", $this->DataSource->f( "code" ) );
$this->sap_code->SetValue( $this->DataSource->sap_code->GetValue( ) );
$this->serial_no->SetValue( $this->DataSource->serial_no->GetValue( ) );
$this->aname->SetValue( $this->DataSource->aname->GetValue( ) );
$this->dept->SetValue( $this->DataSource->dept->GetValue( ) );
$this->bcode->SetValue( $this->DataSource->bcode->GetValue( ) );
$this->floorno->SetValue( $this->DataSource->floorno->GetValue( ) );
$this->roomno->SetValue( $this->DataSource->roomno->GetValue( ) );
$this->a_status->SetValue( $this->DataSource->a_status->GetValue( ) );
$this->Attributes->SetValue( "rowNumber", $this->RowNumber );
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "BeforeShowRow", $this );
$this->Attributes->Show( );
$this->code->Show( );
$this->sap_code->Show( );
$this->serial_no->Show( );
$this->aname->Show( );
$this->dept->Show( );
$this->bcode->Show( );
$this->floorno->Show( );
$this->roomno->Show( );
$this->a_status->Show( );
$Tpl->block_path = $ParentPath."/".$GridBlock;
$Tpl->parse( "Row", true );
}
else
{
$Tpl->block_path = $ParentPath."/".$GridBlock."/AltRow";
$this->Alt_code->SetValue( $this->DataSource->Alt_code->GetValue( ) );
$this->Alt_code->Parameters = CCGetQueryString( "QueryString", array( "ccsForm" ) );
$this->Alt_code->Parameters = CCAddParam( $this->Alt_code->Parameters, "code", $this->DataSource->f( "code" ) );
$this->Alt_sap_code->SetValue( $this->DataSource->Alt_sap_code->GetValue( ) );
$this->serial_no1->SetValue( $this->DataSource->serial_no1->GetValue( ) );
$this->Alt_aname->SetValue( $this->DataSource->Alt_aname->GetValue( ) );
$this->Alt_dept->SetValue( $this->DataSource->Alt_dept->GetValue( ) );
$this->Alt_bcode->SetValue( $this->DataSource->Alt_bcode->GetValue( ) );
$this->Alt_floorno->SetValue( $this->DataSource->Alt_floorno->GetValue( ) );
$this->Alt_roomno->SetValue( $this->DataSource->Alt_roomno->GetValue( ) );
$this->Alt_a_status->SetValue( $this->DataSource->Alt_a_status->GetValue( ) );
$this->Attributes->SetValue( "rowNumber", $this->RowNumber );
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "BeforeShowRow", $this );
$this->Attributes->Show( );
$this->Alt_code->Show( );
$this->Alt_sap_code->Show( );
$this->serial_no1->Show( );
$this->Alt_aname->Show( );
$this->Alt_dept->Show( );
$this->Alt_bcode->Show( );
$this->Alt_floorno->Show( );
$this->Alt_roomno->Show( );
$this->Alt_a_status->Show( );
$Tpl->block_path = $ParentPath."/".$GridBlock;
$Tpl->parseto( "AltRow", true, "Row" );
}
$this->IsAltRow = !$this->IsAltRow;
}
}
else
{
$this->Attributes->Show( );
$Tpl->parse( "NoRecords", false );
}
$errors = $this->GetErrors( );
if ( strlen( $errors ) )
{
$Tpl->replaceblock( "", $errors );
$Tpl->block_path = $ParentPath;
}
else
{
$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->asset_master_TotalRecords->Show( );
$this->Sorter_code->Show( );
$this->Sorter_sap_code->Show( );
$this->Sorter_aname->Show( );
$this->Sorter_dept->Show( );
$this->Sorter_bcode->Show( );
$this->Sorter_floorno->Show( );
$this->Sorter_roomno->Show( );
$this->Sorter_astatus_desc->Show( );
$this->Navigator->Show( );
$Tpl->parse( );
$Tpl->block_path = $ParentPath;
$this->DataSource->close( );
}
}
public function GetErrors( )
{
$errors = "";
$errors = ComposeStrings( $errors, $this->code->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->sap_code->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->serial_no->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->aname->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->dept->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->bcode->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->floorno->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->roomno->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->a_status->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_code->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_sap_code->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->serial_no1->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_aname->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_dept->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_bcode->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_floorno->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_roomno->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Alt_a_status->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->Errors->ToString( ) );
$errors = ComposeStrings( $errors, $this->DataSource->Errors->ToString( ) );
return $errors;
}
}
define( "RelativePath", "." );
define( "PathToCurrentPage", "/" );
define( "FileName", "asset_mast_search.php" );
include( RelativePath."/Common.php" );
include( RelativePath."/Template.php" );
include( RelativePath."/Sorter.php" );
include( RelativePath."/Navigator.php" );
class clsasset_masterDataSource extends clsDBbmss_conection
{
public $Parent = "";
public $CCSEvents = "";
public $CCSEventResult = NULL;
public $ErrorBlock = NULL;
public $CmdExecution = NULL;
public $CountSQL = NULL;
public $wp = NULL;
public $code = NULL;
public $sap_code = NULL;
public $serial_no = NULL;
public $aname = NULL;
public $dept = NULL;
public $bcode = NULL;
public $floorno = NULL;
public $roomno = NULL;
public $a_status = NULL;
public $Alt_code = NULL;
public $Alt_sap_code = NULL;
public $serial_no1 = NULL;
public $Alt_aname = NULL;
public $Alt_dept = NULL;
public $Alt_bcode = NULL;
public $Alt_floorno = NULL;
public $Alt_roomno = NULL;
public $Alt_a_status = NULL;
public function clsasset_masterDataSource( &$Parent )
{
$this->Parent =& $Parent;
$this->ErrorBlock = "Grid asset_master";
$this->Initialize( );
$this->code = new clsField( "code", ccsInteger, "" );
$this->sap_code = new clsField( "sap_code", ccsText, "" );
$this->serial_no = new clsField( "serial_no", ccsText, "" );
$this->aname = new clsField( "aname", ccsText, "" );
$this->dept = new clsField( "dept", ccsText, "" );
$this->bcode = new clsField( "bcode", ccsText, "" );
$this->floorno = new clsField( "floorno", ccsText, "" );
$this->roomno = new clsField( "roomno", ccsText, "" );
$this->a_status = new clsField( "a_status", ccsText, "" );
$this->Alt_code = new clsField( "Alt_code", ccsInteger, "" );
$this->Alt_sap_code = new clsField( "Alt_sap_code", ccsText, "" );
$this->serial_no1 = new clsField( "serial_no1", ccsText, "" );
$this->Alt_aname = new clsField( "Alt_aname", ccsText, "" );
$this->Alt_dept = new clsField( "Alt_dept", ccsText, "" );
$this->Alt_bcode = new clsField( "Alt_bcode", ccsText, "" );
$this->Alt_floorno = new clsField( "Alt_floorno", ccsText, "" );
$this->Alt_roomno = new clsField( "Alt_roomno", ccsText, "" );
$this->Alt_a_status = new clsField( "Alt_a_status", ccsText, "" );
}
public function SetOrder( $SorterName, $SorterDirection )
{
$this->Order = "code desc";
$this->Order = CCGetOrder( $this->Order, $SorterName, $SorterDirection, array(
"Sorter_code" => array( "code", "" ),
"Sorter_sap_code" => array( "sap_code", "" ),
"Sorter_aname" => array( "aname", "" ),
"Sorter_dept" => array( "dept", "" ),
"Sorter_bcode" => array( "bcode", "" ),
"Sorter_floorno" => array( "floorno", "" ),
"Sorter_roomno" => array( "roomno", "" ),
"Sorter_astatus_desc" => array( "asset_m_astatus.descriptions", "" )
) );
}
public function Prepare( )
{
global $CCSLocales;
global $DefaultDateFormat;
$this->wp = new clsSQLParameters( $this->ErrorBlock );
$this->wp->AddParameter( "1", "urls_code", ccsInteger, "", "", $this->Parameters['urls_code'], "", false );
$this->wp->AddParameter( "2", "urls_sap_code", ccsText, "", "", $this->Parameters['urls_sap_code'], "", false );
$this->wp->AddParameter( "3", "urls_aname", ccsText, "", "", $this->Parameters['urls_aname'], "", false );
$this->wp->AddParameter( "4", "urls_groupid", ccsText, "", "", $this->Parameters['urls_groupid'], "", false );
$this->wp->AddParameter( "5", "urls_catagory", ccsText, "", "", $this->Parameters['urls_catagory'], "", false );
$this->wp->AddParameter( "6", "urls_bcode", ccsText, "", "", $this->Parameters['urls_bcode'], "", false );
$this->wp->AddParameter( "7", "urls_a_status", ccsText, "", "", $this->Parameters['urls_a_status'], "", false );
$this->wp->AddParameter( "8", "urls_dept", ccsText, "", "", $this->Parameters['urls_dept'], "", false );
$this->wp->AddParameter( "9", "urls_process_id", ccsInteger, "", "", $this->Parameters['urls_process_id'], "", false );
$this->wp->AddParameter( "10", "urls_branchid", ccsText, "", "", $this->Parameters['urls_branchid'], "", false );
$this->wp->AddParameter( "11", "urls_serial_no", ccsText, "", "", $this->Parameters['urls_serial_no'], "", false );
$this->wp->Criterion[1] = $this->wp->Operation( opEqual, "code", $this->wp->GetDBValue( "1" ), $this->ToSQL( $this->wp->GetDBValue( "1" ), ccsInteger ), false );
$this->wp->Criterion[2] = $this->wp->Operation( opContains, "sap_code", $this->wp->GetDBValue( "2" ), $this->ToSQL( $this->wp->GetDBValue( "2" ), ccsText ), false );
$this->wp->Criterion[3] = $this->wp->Operation( opContains, "aname", $this->wp->GetDBValue( "3" ), $this->ToSQL( $this->wp->GetDBValue( "3" ), ccsText ), false );
$this->wp->Criterion[4] = $this->wp->Operation( opEqual, "groupid", $this->wp->GetDBValue( "4" ), $this->ToSQL( $this->wp->GetDBValue( "4" ), ccsText ), false );
$this->wp->Criterion[5] = $this->wp->Operation( opEqual, "catagory", $this->wp->GetDBValue( "5" ), $this->ToSQL( $this->wp->GetDBValue( "5" ), ccsText ), false );
$this->wp->Criterion[6] = $this->wp->Operation( opEqual, "bcode", $this->wp->GetDBValue( "6" ), $this->ToSQL( $this->wp->GetDBValue( "6" ), ccsText ), false );
$this->wp->Criterion[7] = $this->wp->Operation( opEqual, "a_status", $this->wp->GetDBValue( "7" ), $this->ToSQL( $this->wp->GetDBValue( "7" ), ccsText ), false );
$this->wp->Criterion[8] = $this->wp->Operation( opEqual, "dept", $this->wp->GetDBValue( "8" ), $this->ToSQL( $this->wp->GetDBValue( "8" ), ccsText ), false );
$this->wp->Criterion[9] = $this->wp->Operation( opEqual, "process_id", $this->wp->GetDBValue( "9" ), $this->ToSQL( $this->wp->GetDBValue( "9" ), ccsInteger ), false );
$this->wp->Criterion[10] = $this->wp->Operation( opEqual, "branchid", $this->wp->GetDBValue( "10" ), $this->ToSQL( $this->wp->GetDBValue( "10" ), ccsText ), false );
$this->wp->Criterion[11] = $this->wp->Operation( opContains, "serial_no", $this->wp->GetDBValue( "11" ), $this->ToSQL( $this->wp->GetDBValue( "11" ), ccsText ), false );
$this->Where = $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->opAND( false, $this->wp->Criterion[1], $this->wp->Criterion[2] ), $this->wp->Criterion[3] ), $this->wp->Criterion[4] ), $this->wp->Criterion[5] ), $this->wp->Criterion[6] ), $this->wp->Criterion[7] ), $this->wp->Criterion[8] ), $this->wp->Criterion[9] ), $this->wp->Criterion[10] ), $this->wp->Criterion[11] );
}
public function Open( )
{
$this->CCSEventResult = CCGetEvent( $this->CCSEvents, "BeforeBuildSelect", $this->Parent );
$this->CountSQL = "SELECT COUNT(*)\n\n"."FROM asset_master";
$this->SQL = "SELECT * \n\n"."FROM asset_master {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 );
}
public function SetValues( )
{
$this->code->SetDBValue( trim( $this->f( "code" ) ) );
$this->sap_code->SetDBValue( $this->f( "sap_code" ) );
$this->serial_no->SetDBValue( $this->f( "serial_no" ) );
$this->aname->SetDBValue( $this->f( "aname" ) );
$this->dept->SetDBValue( $this->f( "dept" ) );
$this->bcode->SetDBValue( $this->f( "bcode" ) );
$this->floorno->SetDBValue( $this->f( "floorno" ) );
$this->roomno->SetDBValue( $this->f( "roomno" ) );
$this->a_status->SetDBValue( $this->f( "a_status" ) );
$this->Alt_code->SetDBValue( trim( $this->f( "code" ) ) );
$this->Alt_sap_code->SetDBValue( $this->f( "sap_code" ) );
$this->serial_no1->SetDBValue( $this->f( "serial_no" ) );
$this->Alt_aname->SetDBValue( $this->f( "aname" ) );
$this->Alt_dept->SetDBValue( $this->f( "dept" ) );
$this->Alt_bcode->SetDBValue( $this->f( "bcode" ) );
$this->Alt_floorno->SetDBValue( $this->f( "floorno" ) );
$this->Alt_roomno->SetDBValue( $this->f( "roomno" ) );
$this->Alt_a_status->SetDBValue( $this->f( "a_status" ) );
}
}
$FileName = "";
$Redirect = "";
$Tpl = "";
$TemplateFileName = "";
$BlockToParse = "";
$ComponentName = "";
$Attributes = "";
$CCSEvents = "";
$CCSEventResult = "";
$FileName = FileName;
$Redirect = "";
$TemplateFileName = "asset_mast_search.html";
$BlockToParse = "main";
$TemplateEncoding = "CP874";
$PathToRoot = "./";
include( "./asset_mast_search_events.php" );
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeInitialize", $MainPage );
$DBbmss_conection = new clsDBbmss_conection( );
$MainPage->Connections['bmss_conection'] =& $DBbmss_conection;
$Attributes = new clsAttributes( "page:" );
$MainPage->Attributes =& $Attributes;
$ImageLink1 = new clsControl( ccsImageLink, "ImageLink1", "ImageLink1", ccsText, "", CCGetRequestParam( "ImageLink1", ccsGet, NULL ), $MainPage );
$ImageLink1->Parameters = CCGetQueryString( "QueryString", array( "ccsForm" ) );
$ImageLink1->Page = "Default.php";
$Label2 = new clsControl( ccsLabel, "Label2", "Label2", ccsText, "", CCGetRequestParam( "Label2", ccsGet, NULL ), $MainPage );
$asset_masterSearch = new clsRecordasset_masterSearch( "", $MainPage );
$asset_master = new clsGridasset_master( "", $MainPage );
$MainPage->ImageLink1 =& $ImageLink1;
$MainPage->Label2 =& $Label2;
$MainPage->asset_masterSearch =& $asset_masterSearch;
$MainPage->asset_master =& $asset_master;
$asset_master->Initialize( );
BindEvents( );
$CCSEventResult = CCGetEvent( $CCSEvents, "AfterInitialize", $MainPage );
$Charset = $Charset ? $Charset : "windows-874";
if ( $Charset )
{
header( "Content-Type: text/html; charset=".$Charset );
}
$CCSEventResult = CCGetEvent( $CCSEvents, "OnInitializeView", $MainPage );
$Tpl = new clsTemplate( $FileEncoding, $TemplateEncoding );
$Tpl->LoadTemplate( PathToCurrentPage.$TemplateFileName, $BlockToParse, "CP874" );
$Tpl->block_path = "/{$BlockToParse}";
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeShow", $MainPage );
$Attributes->Show( );
$asset_masterSearch->Operation( );
if ( $Redirect )
{
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeUnload", $MainPage );
$DBbmss_conection->close( );
if ( $CCSFormFilter )
{
$Redirect = CCAddParam( $Redirect, "FormFilter", $CCSFormFilter );
}
header( "Location: ".$Redirect );
unset( $asset_masterSearch );
unset( $asset_master );
unset( $Tpl );
exit( );
}
$asset_masterSearch->Show( );
$asset_master->Show( );
$ImageLink1->Show( );
$Label2->Show( );
$Tpl->block_path = "";
$Tpl->Parse( $BlockToParse, false );
$main_block = $Tpl->GetVar( $BlockToParse );
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeOutput", $MainPage );
if ( $CCSEventResult )
{
echo $main_block;
}
$CCSEventResult = CCGetEvent( $CCSEvents, "BeforeUnload", $MainPage );
$DBbmss_conection->close( );
unset( $asset_masterSearch );
unset( $asset_master );
unset( $Tpl );
?>
Tag : PHP
|
|
|
|
|
|
Date :
2011-12-12 11:50:51 |
By :
วิศรุต |
View :
961 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้าโค้ดที่ให้มามีเท่านี้น่ะ
น่าจะมีปัญหาตรงบรรทัดที่ 62 ตรงคำสั่ง select น่ะ
ก็ไม่รู้น่ะ ไม่ค่อยได้เจอการเขียนโค้ดรูปแบบนี้น่ะ
|
|
|
|
|
Date :
2011-12-12 12:47:37 |
By :
บังเอิญผ่านมาเห็น |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
array( "bcode", "bname", "" )[1];
php มันเขียน แบบนี้ได้หรือไง?
|
|
|
|
|
Date :
2011-12-12 12:54:33 |
By :
pjgunner.com |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากมายคับ
|
|
|
|
|
Date :
2011-12-12 12:59:29 |
By :
วิศรุต |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|