CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 add rows in grid manually(PHP)

Print topic Send  topic

Author Message
NilovSerge

Posts: 16
Posted: 09/23/2006, 8:31 AM

I making a list of weeks in a year. In database can be some weeks by their data and some not.
I show list of weeks based on my database datas. Weeks which are in my database are shown all wright.
but if not all weeks are in database I want to show this week too. So I have manually show
some rows in my Grid. Problem is that when I tried to show my own rows they are not shown. I did it so(shortly):

function Show() // function in class clsGridweeks_schedule { //weeks_schedule class @12-F0190AA2
{
global $Tpl;
global $CCSLocales;
if(!$this->Visible) return;

$this->RowNumber = 0;

$this->DataSource->Parameters["urlYear_Param"] = CCGetFromGet("Year_Param", NULL); // params
$this->DataSource->Parameters["urlis_enabled"] = CCGetFromGet("is_enabled", NULL);
$this->DataSource->Parameters["urlschedule_id"] = CCGetFromGet("schedule_id", NULL);

$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);


$this->DataSource->Prepare();
$this->DataSource->Open();
$this->IsEmpty = ! $this->DataSource->next_record();

$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) {
$WeeksOfYearArray= $this->GetWeeksOfYear(2006); // my function to get list of all weeks
// print_r($WeeksOfYearArray);
$this->IsEmpty = false;
$this->ControlsVisible["week_number"] = $this->week_number->Visible;
$this->ControlsVisible["break_end2"] = $this->break_end2->Visible; ... all columns ....
$this->ControlsVisible["time_end"] = $this->time_end->Visible;
$this->ControlsVisible["is_enabled"] = $this->is_enabled->Visible;
$PriorDat= array( 'Year'=> 0, 'Month'=> 0, 'Day'=> 0, 'Dat'=> mktime( 0,0,0,0,0,0 ) ); // _nsn
do {
$this->RowNumber++;
$this->DataSource->SetValues();
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";

$A= $this->DataSource->week_begin->GetValue(); // _nsn
$CurrentDat= array( 'Year'=> $A[1], 'Month'=> $A[2], 'Day'=> $A[3], 'Dat'=> mktime( 0,0,0,$A[2],$A[3],$A[1] ) );
// in this function I tried to write my own rows like in this function
$this->WriteNonExistingWeekSchedules( $WeeksOfYearArray, $CurrentDat, $PriorDat, $ParentPath, $GridBlock, $Tpl );

$this->week_number->SetValue($this->DataSource->week_number->GetValue()); all columns ....
$this->is_enabled->SetValue($this->DataSource->is_enabled->GetValue());
$this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShowRow", $this);
$this->week_number->Show(); ... all columns ....
$this->is_enabled->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
$Tpl->parse("Row", true);
$PriorDat= array( 'Year'=> $A[1], 'Month'=> $A[2], 'Day'=> $A[3], 'Dat'=> mktime( 0,0,0,$A[2],$A[3],$A[1] ) ); // _nsn
} while (($this->RowNumber < $this->PageSize) && $this->DataSource->next_record());
}
else // Show NoRecords block if no records are found
{
$this->IsEmpty = true;
$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->weeks_schedule_Insert->Show();
$this->Navigator->Show();
$Tpl->parse();
$Tpl->block_path = $ParentPath;
$this->DataSource->close();
}
//End Show Method


function WriteNonExistingWeekSchedules( $WeeksOfYearArray, $CurrentDat, $PriorDat, $ParentPath, $GridBlock, $Tpl ) { // _nsn
reset($WeeksOfYearArray);
foreach($WeeksOfYearArray as $WeekNumber=> $WeekBegin) { // choose my dates
if ( $CurrentDat['Month']== 1 ) {
}
if ( $WeekBegin['Dat']> $PriorDat['Dat'] and $WeekBegin['Dat']< $CurrentDat['Dat'] ) { // found a day to write
echo '<br><br>INSIDE $WeekBegin::'.print_r($WeekBegin,true).'.<br>';
$Day= $WeekBegin['Day'];
$Month= $WeekBegin['Month'];
$Year= $WeekBegin['Year'];

$this->RowNumber++;
$this->DataSource->SetValues();
$Tpl->block_path = $ParentPath . "/" . $GridBlock . "/Row";
$this->ImageLink1->Parameters = CCGetQueryString("QueryString", array("ccsForm"));
$this->ImageLink1->Parameters = CCAddParam($this->ImageLink1->Parameters, "week_begin", $this->DataSource->f("week_begin"));
$this->ImageLink1->Parameters = CCAddParam($this->ImageLink1->Parameters, "weeks_schedule_id", $this->DataSource->f("weeks_schedule_weeks_schedule_id"));
$this->ImageLink1->Parameters = CCAddParam($this->ImageLink1->Parameters, "schedule_id", $this->DataSource->f("schedule_id"));

$this->week_begin->SetValue( '2004-08-06');//($Month<9?'0':'').$Month.'/'.($Day<9?'0':'').$Day.'/'.$Year );
$this->week_end->SetValue( '2004-09-12' ); // my columns with sample datas
$this->time_begin->SetValue('09:00:00');

$this->break_begin1->SetValue( '11:00:00' );
$this->break_end1->SetValue( '11:30:00' );
$this->break_begin2->SetValue( '15:00:00' );
$this->break_end2->SetValue('15:30:00');
$this->time_end->SetValue('09:00:00');
$this->weeks_schedule_is_enabled->SetValue('N');

$this->week_begin->Show();
$this->week_end->Show();
$this->time_begin->Show();
$this->break_begin1->Show();
$this->break_end1->Show();
$this->break_begin2->Show();
$this->break_end2->Show();
$this->time_end->Show();
$this->weeks_schedule_is_enabled->Show();
$Tpl->block_path = $ParentPath . "/" . $GridBlock;
echo 'Create:::'; // It works
$Tpl->parse("Row", true);

}
}
}

...
I tried make like in original function show and using its methods show my rows.
i saw that i am inside this function(by echo) and it works but NO any more rows are inserdetr in my grid.
Maybe that is the wrong way I do? Haw can I do this? Please give an example if you did something like that.
_________________
With respect,
Nilov Serge.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.