I have a situation that (I think) screams for components, but I don't get how to pull it off. The way I learn is to get something working and then refine.
so, my very un-mvc partial is <?php $totals = array(null,null,null,null,null,null,null,null); ?> <table id="dmr_rep"> <tr> <th></th> <th class="row-tot">SUN</th><th class="row-tot">MON</th><th class="row-tot">TUE</th> <th class="row-tot">WED</th><th class="row-tot">THUR</th><th class="row-tot">FRI</th><th class="row-tot">SAT</th> <th class="row-tot">ACTIVITY TOTALS </th> </tr> <?php foreach ($sf_user->getMonthObj()->getWeeksOfMonth() as $week): ? > <?php $tot = $consumer->getFilteredWeekTotals($week- >firstDayOfWeek()->format('Y-m-j')); ?> <?php if ($tot[7] > 0): ?> <?php echo include_partial('activity/dmr_th_grid', array('month' => $sf_user->getMonth(), 'date' => $week ) ); ?> <?php echo include_partial('activity/dmr_tr_grid', array('saturday' => $week->finalDayOfWeek()->format('Y-m-j'), 'day_totals' => $tot, ) ); ?> <?php for($i = 0; $i <= 7; $i++): ?> <?php $totals[$i] = array_key_exists($i, $tot) ? $totals[$i] + $tot[$i] : $totals[$i]; ?></td> <?php endfor ?> <?php endif ?> <?php endforeach ?> <tr> <th scope="cal">Monthly Totals</th> <?php for($day = 0; $day <= 7; $day++): ?> <td><?php echo $totals[$day] ?></td> <?php endfor ?> </tr> </table> so my attempt is something like class activityComponents extends sfComponents { /** * Executes month grid action * */ public $totals = array(); protected $week_row = array(); public function executeGrid() { // $this->month = $this->getUser()->getMonthObj(); $this->weeks = $this->month->getWeeksOfMonth(); // $ts } public function executeWeekrow() { $day_totals = $this->getFilteredWeekTotals($this->week- >firstDayOfWeek()->format('Y-m-j')); } public function getFilteredWeekTotals($week ) { $month = clone $this->month; $totals = $this->consumer->getWeekTotals( $week); $filtered = array(); for($day = 0; $day <= 6; $day++) { $newDay = new sfDate($week); if ($newDay->addDay($day)->format('m') == $month->format('m')) { if (array_key_exists($day, $totals)) { $filtered[$day] = $totals[$day]; $sum = $sum + $totals[$day]; $this->setDayTotal($day, $totals[$day] ); } } } $filtered['7'] = $sum; return $filtered; } public function setDayTotal ($day, $hours) { $this->totals[$day] = $totals[$day] + $hours; } public function getDayTotal ($day) { return $this->totals[$day] ? $this->totals[$day] : null; } } but my $this vars never seem to be initialized. Please explain if this is the right approach --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---