17 require_once dirname(__FILE__).
'/../../calendar_event/calendar_event.inc';
18 require_once dirname(__FILE__).
'/../calendar_event_recurring/calendar_event_recurring.inc';
60 $parent =& $link[
'asset'];
61 if ($parent->type() !=
'calendar_event_recurring') {
62 trigger_localised_error(
'CAL0052', E_USER_ERROR);
70 if (!parent::_preCreateCheck($link))
return FALSE;
73 trigger_localised_error(
'CAL0049', E_USER_ERROR);
92 protected function _getName($short_name=FALSE, $contextid=NULL)
95 if ($contextid === NULL) {
96 $contextid = $GLOBALS[
'SQ_SYSTEM']->getContextId();
100 return translate(
'cal_event_modified_date', date(
'd M Y', iso8601_ts($this->
attr(
'start_date'))));
104 $values = $GLOBALS[
'SQ_SYSTEM']->am->getAttributeValuesByName(
'name', $this->
type(), Array($this->
id), $contextid);
105 if (empty($values) === TRUE) {
106 return parent::_getName($short_name, $contextid);
108 return $values[$this->id];
126 if (!$parent->hasOccurrenceOnDate($this->getStartDate())) {
127 trigger_localised_error(
'CAL0051', E_USER_WARNING, $this->
getStartDate());
133 $st = $parent->getStartTime();
137 if ($duration = $parent->getDuration()) {
138 $this->
setAttrValue(
'end_date', date(
'Y-m-d', iso8601_ts($this->
attr(
'start_date')) + $duration).substr($parent->attr(
'end_date'), 10));
142 if (!$this->
attr(
'name')) {
143 $this->
setAttrValue(
'name', $parent->attr(
'name').
' - Modified '.date(
'd M Y', iso8601_ts($this->
attr(
'start_date'))));
165 if (!$dont_run_updated) {
168 $recurring_event_ids = array_keys($GLOBALS[
'SQ_SYSTEM']->am->getParents($this->id,
'calendar_event_recurring', FALSE));
169 if (empty($recurring_event_ids)) {
170 trigger_localised_error(
'CAL0052', E_USER_ERROR);
173 $recurring_event =& $GLOBALS[
'SQ_SYSTEM']->am->getAsset($recurring_event_ids[0]);
180 return parent::saveAttributes($dont_run_updated);
193 $root_url = array_values($GLOBALS[
'SQ_SYSTEM']->am->getRootURL());
194 if (is_array($root_url)) $root_url = $root_url[0];
195 require_once SQ_FUDGE_PATH.
'/general/datetime.inc';
197 <table border=
"0" cellspacing=
"2" cellpadding=
"2">
199 <td><b><?php echo translate(
'cal_event_modification_of'); ?></b></td>
202 if ($recurring_events = $GLOBALS[
'SQ_SYSTEM']->am->getParents($this->id,
'calendar_event_recurring', FALSE)) {
203 $recurring_events = array_keys($recurring_events);
204 $recurring_event =& $GLOBALS[
'SQ_SYSTEM']->am->getAsset($recurring_events[0]);
205 echo
'<a href="'.$root_url.
'?a='.$recurring_events[0].
'">'.$recurring_event->attr(
'name').
'</a>';
210 <td><b><?php echo translate(
'cal_event_modified_start_date'); ?></b></td>
214 <td><b><?php echo translate(
'cal_event_modified_end_date'); ?></b></td>
218 <td><b><?php echo translate(
'cal_event_modified_name'); ?></b></td>
219 <td><?php echo $this->
attr(
'name'); ?></td>
222 <td><b><?php echo translate(
'cal_event_modified_description'); ?></b></td>
223 <td><?php echo $this->
attr(
'description'); ?></td>
246 $res[
'start'] = $date;
249 $res[
'start'] .=
' '.$this->getStartTime();
252 $res[
'end'] = date(
'Y-m-d', iso8601_ts($res[
'start']) + $this->
getDuration());
255 $res[
'end'] .=
' '.$this->getEndTime();
279 $keyword = parse_keyword($keyword, $modifiers);
281 if (in_array($keyword, Array(
'instance_start_datetime',
'instance_end_datetime'))) {
282 if (isset($_REQUEST[
'SQ_CALENDAR_DATE'])) {
285 case 'instance_start_datetime':
286 $replacement = $instance_dates[
'start'];
287 case 'instance_end_datetime':
288 $replacement = $instance_dates[
'end'];
293 preg_match(
'/^instance_start_datetime_(.+)/', $keyword, $matches);
294 if ((!empty($matches)) && !empty($_REQUEST[
'SQ_CALENDAR_DATE'])) {
296 $replacement = date($matches[1], iso8601_ts($instance_dates[
'start']));
299 preg_match(
'/^instance_end_datetime_(.+)/', $keyword, $matches);
300 if ((!empty($matches)) && !empty($_REQUEST[
'SQ_CALENDAR_DATE'])) {
302 $replacement = date($matches[1], iso8601_ts($instance_dates[
'end']));
305 if (empty($replacement)) {
306 $replacement = parent::getKeywordReplacement($keyword);
308 apply_keyword_modifiers($replacement, $modifiers, Array(
'assetid' => $this->
id));
331 $res = parent::getAvailableKeywords();
333 $our_keywords[] =
'instance_end_datetime';
334 $our_keywords[] =
'instance_start_datetime';
335 $our_keywords[] =
'instance_start_datetime_';
336 $our_keywords[] =
'instance_end_datetime_';
338 foreach ($our_keywords as $keyword) {
339 $res[$keyword] = translate(
'cal_evt_recur_keyword_'.$keyword);