<?php
/*
Officity - Web application platform - Version 6.0 - 2011-07-05

François Dispaux, Boris Verdeyen, Thomas Hermant,
Jérémie Roy, Grégory Meurice, Abdelila Harbi, 
Marc Mignonsin, Jonathan Sanchez, Julien Gonzalez, Pierre Fouchez

Sushee and Officity is © Copyright 2011 Nectil SA.

`/sushee-source/sushee/private/event_preprocessing.php` is part of Officity.

Sushee is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Officity and Sushee are distributed in the hope that they will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Sushee. If not, see <http://www.gnu.org/licenses/>.
*/
if(($requestName=="KILL") || ($requestName=="DELETE")){
	$know_masterID_sql = 'SELECT `RepeatMasterID` FROM `events` WHERE `ID`=\''.$IDs_array[0].'\' AND `Activity`=1';
	$event_row = $db_conn->getRow($know_masterID_sql);
	$former_values['RepeatMasterID'] = $event_row['RepeatMasterID'];
}


$start = $xml->getData($firstNodePath."/INFO/START");
$end = $xml->getData($firstNodePath."/INFO/END");

if($start){
	
	$start_year = substr($start,0,4);
	$start_month = substr($start,5,2);
	$start_day = substr($start,8,2);
	
	$start_hour = substr($start,11,2);
	$start_minute = substr($start,14,2);
	$start_second = substr($start,17,2);
	
	if($start_year && $start_month && $start_day){
		$time = mktime(0,0,0,$start_month,$start_day,$start_year);
		$return_values['StartWeekday']=$values['StartWeekday']=date('w',$time);
		$return_values['StartWeekNumber']=$values['StartWeekNumber']=date('W',$time);
	}
}

	
if($end){
	$end_year = substr($end,0,4);
	$end_month = substr($end,5,2);
	$end_day = substr($end,8,2);
	
	$end_hour = substr($end,11,2);
	$end_minute = substr($end,14,2);
	$end_second = substr($end,16,2);
	
	if($end_year && $end_month && $end_day){
		$time = mktime(0,0,0,$end_month,$end_day,$end_year);
		$return_values['EndWeekday']=$values['EndWeekday']=date('w',$time);
		$return_values['EndWeekNumber']=$values['EndWeekNumber']=date('W',$time);
	}
}

return TRUE;
?>