18 require_once SQ_INCLUDE_PATH.
'/asset.inc';
19 require_once SQ_CORE_PACKAGE_PATH.
'/data_source/data_source/data_source.inc';
20 require_once SQ_LIB_PATH.
'/html_form/html_form.inc';
21 require_once SQ_FUDGE_PATH.
'/general/datetime.inc';
22 require_once(SQ_INCLUDE_PATH.
'/general_occasional.inc');
47 parent::__construct($assetid);
68 $allowed_link[
'asset'][
'card'] =
'M';
69 $allowed_link[
'asset'][
'exclusive'] = FALSE;
71 $links[SQ_LINK_TYPE_1] = $allowed_link;
72 $links[SQ_LINK_TYPE_2] = $allowed_link;
73 $links[SQ_LINK_TYPE_3] = $allowed_link;
74 $links[SQ_LINK_NOTICE] = $allowed_link;
89 $GLOBALS[
'SQ_SYSTEM']->pm->startTimer($this);
91 $hash = md5($this->name);
93 if (!isset($this->_tmp[$hash])) {
94 $result = parent::getResultSet($hash);
97 if (!empty($result)) {
98 $this->_tmp[$hash] = $result;
99 parent::setResultSet($result, $hash);
102 $this->_tmp[$hash] = $result;
105 $result = $this->_tmp[$hash];
108 $GLOBALS[
'SQ_SYSTEM']->pm->stopTimer($this);
126 $file = $this->
attr(
'path');
127 if ((strpos($file,
'http://') === 0) || (strpos($file,
'ftp://') === 0)) {
128 $file = str_replace(
' ',
'%20', $file);
130 $ical_data = @file_get_contents($file);
132 $startCalendar = FALSE;
138 $ical_data = str_replace(
"\r\n ",
'', str_replace(
"\r\n\t",
'', $ical_data));
139 $ical_lines = explode(
"\r\n", $ical_data);
140 foreach($ical_lines as $line) {
143 $pattern =
'/([^;:]*)([^:]*):(.*)/is';
144 $status = preg_match($pattern, $line, $matches);
145 $command = array_get_index($matches, 1,
'');
146 $parameter = array_get_index($matches, 3,
'');
148 if (!empty($command)) {
151 if ($startCalendar) {
153 if ($parameter ==
'VEVENT') {
155 $results[$index] = Array();
159 if ($parameter ==
'VCALENDAR') {
160 $startCalendar = TRUE;
165 if ($parameter ==
'VEVENT') {
168 }
else if ($parameter ==
'VCALENDAR') {
169 $startCalendar = TRUE;
179 case 'LAST-MODIFIED':
180 $results[$index][strtolower($command.
'-raw')] = $parameter;
181 $date_str = $parameter;
182 if (strlen($parameter) == 8) {
183 $date_str .=
'T------';
185 if (substr($date_str, 15, 1) ===
'Z') {
186 $timestamp = gmmktime( substr($date_str, 9, 2),
187 substr($date_str, 11, 2),
188 substr($date_str, 13, 2),
189 substr($date_str, 4, 2),
190 substr($date_str, 6, 2),
191 substr($date_str, 0, 4) );
192 $value = readable_datetime($timestamp);
194 $date_value = substr($date_str, 0, 4);
195 $date_value .=
'-'.substr($date_str, 4, 2);
196 $date_value .=
'-'.substr($date_str, 6, 2);
197 $date_value .=
'T'.substr($date_str, 9, 2);
198 $date_value .=
':'.substr($date_str, 11, 2);
199 $date_value .=
':'.substr($date_str, 13, 2);
200 $value = readable_datetime(iso8601_ts($date_value));
206 $results[$index][strtolower($command)] = $value;
207 if ($command ==
'SUMMARY') {
208 $results[$index][
'title'] = ellipsisize($value, 20);