From: Jonny B. <jo...@ti...> - 2010-07-26 20:38:17
|
Hi Sylvie This sounds intriguing - and related possibly to the idea of adding a 'trackerId' attribute (initially to calendars). Let's discuss sometime..? jb On 26 Jul 2010, at 21:31, sy...@us... wrote: > Revision: 28146 > http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=28146&view=rev > Author: sylvieg > Date: 2010-07-26 20:31:25 +0000 (Mon, 26 Jul 2010) > > Log Message: > ----------- > [FIX]calendar: preparation to the split of tiki-calendar.setup to be reused for tracker- work in progress > > Modified Paths: > -------------- > trunk/lib/calendar/calendarlib.php > > Modified: trunk/lib/calendar/calendarlib.php > =================================================================== > --- trunk/lib/calendar/calendarlib.php 2010-07-26 19:56:48 UTC (rev 28145) > +++ trunk/lib/calendar/calendarlib.php 2010-07-26 20:31:25 UTC (rev 28146) > @@ -690,6 +690,71 @@ > $query = "delete from `tiki_calendar_items` where ".implode(' and ', $mid); > $tikilib->query($query, $bindvars); > } > + // Compute a table view of dates (one line per week) > + // $firstWeekDay = 0 (Synday), 1 (Monday) > + function getTableViewCells($focusDate, $view='month', $firstWeekDay = 0) { > + $focus = array ( > + 'day' => intval(TikiLib::date_format('%d', $focusDate)), > + 'month' => intval(TikiLib::date_format('%m', $focusDate)), > + 'year' => TikiLib::date_format('%Y', $focusDate), > + 'date' => $focusDate > + ); > + // start of the period > + $start = array( > + 'day' => 1, > + 'month' => $focus['month'], > + 'year' => $focus['year'], > + ); > + $start['date'] = TikiLib::make_time(0, 0, 0, $start['month'], $start['day'], $start['year']); > + $start['weekDay'] = TikiLib::date_format('%w', $start['date']); // in (0, 6) > + // start of the view > + $nbBackDays = $start['weekDay'] < $firstWeekDay? 6: $start['weekDay'] - $firstWeekDay; > + if ($nbBackDays == 0) { > + $viewStart = $start; > + } else { > + $viewStart = array( > + 'month' => $start['month'] == 1? 12: $start['month'] - 1, > + 'year' => $start['month'] == 1? $start['year'] -1 : $start['year'] > + ); > + $d = Date_Calc::daysInMonth($viewStart['month'], $viewStart['year']); > + $viewStart['day'] = $d - $nbBackDays + 1; > + $viewStart['date'] = TikiLib::make_time(0, 0, 0, $viewStart['month'], $viewStart['day'], $viewStart['year']); > + $viewStart['daysInMonth'] = $d; > + } > + //echo '<br/>VIEWSTART'; print_r($viewStart); > + // end of the period > + $nbMonths = array('month' => 1, 'trimester' => 3, 'quarter' => 4, 'semester' => 6, 'year' => 12); > + $end['date'] = TikiLib::make_time(0, 0, 0, $start['month'] + $nbMonths[$view], $start['day'], $start['year']); > + $cell = array(); > + for ($ilign = 0, $icol = 0, $loop = $viewStart; ; ) { > + if ($loop['date'] >= $end['date'] && $icol == 0) { > + break; > + } > + $cell[$ilign][$icol] = $loop; > + $cell[$ilign][$icol]['focus'] = $loop['date'] < $start['date'] || $loop['date'] >= $end['date']? false: true; > + if ($icol >= 6) { > + ++$ilign; > + $icol = 0; > + } else { > + ++$icol; > + } > + if ($loop['day'] >= $loop['daysInMonth']) { > + $loop['day'] = 1; > + if ($loop['month'] == 12) { > + $loop['month'] = 1; > + $loop['year'] += 1; > + } else { > + $loop['month'] += 1; > + } > + $loop['daysInMonth'] = Date_Calc::daysInMonth($loop['month'], $loop['year']); > + } else { > + $loop['day'] = $loop['day'] + 1; > + } > + $loop['date'] = TikiLib::make_time(0, 0, 0, $loop['month'], $loop['day'], $loop['year']); > + } > + // echo '<pre>CELL'; print_r($cell); echo '<pre>'; > + return $cell; > + } > function getCalendar($calIds, &$viewstart, &$viewend, $group_by = '', $item_name = 'events') { > global $user, $prefs, $smarty; > > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://ad.doubleclick.net/clk;226879339;13503038;l? > http://clk.atdmt.com/CRS/go/247765532/direct/01/ > _______________________________________________ > Tikiwiki-cvs mailing list > Tik...@li... > https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs |