egroupware_official/calendar/inc/class.calendar_timegrid_etemplate_widget.inc.php
Nathan Gray f0ebb448a2 Calendar et2 conversion work in progress.
- Client side event caching
- Home fixes
2015-07-15 16:29:10 +00:00

58 lines
1.4 KiB
PHP

<?php
/*
* Egroupware
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @link http://www.egroupware.org
* @author Nathan Gray
* @version $Id$
*/
/**
* Creates a grid with rows for the time, columns for (multiple) days containing events
*
* The associated javascript files are loaded by calendar/js/app.js using the
* server-side include manager to get all the dependancies
*
* @author Nathan Gray
*/
class calendar_timegrid_etemplate_widget extends etemplate_widget
{
/**
* Set up what we know on the server side.
*
* Sending a first chunk of rows
*
* @param string $cname
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
*/
public function beforeSendToClient($cname, array $expand=null)
{
$form_name = self::form_name($cname, $this->id, $expand);
$value =& self::get_array(self::$request->content, $form_name, true);
foreach($value as $day => &$events)
{
foreach($events as &$event)
{
if(!is_array($event)) continue;
foreach(array('start','end') as $date)
{
$event[$date] = egw_time::to($event[$date],'Y-m-d\TH:i:s\Z');
}
}
}
}
/**
* Ajax callback to fetch the holidays for a given year.
* @param type $year
*/
public static function ajax_get_holidays($year)
{
$cal_bo = new calendar_bo();
$holidays = $cal_bo->read_holidays((int)$year);
egw_json_response::get()->data($holidays);
}
}