/** * sort iCal compoments * * ascending sort on properties (if exist) x-current-dtstart, dtstart, * x-current-dtend, dtend, x-current-due, due, duration, created, dtstamp, uid if called without arguments, * otherwise sorting on specific (argument) property values * * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**> * @since 2.18.4 - 2013-08-18 * @param string $sortArg, optional * @uses iCalUtilityFunctions::_setSortArgs() * @uses iCalUtilityFunctions::_cmpfcn() * @return void */ function sort($sortArg = FALSE) { if (!is_array($this->components) || 2 > count($this->components)) { return; } if ($sortArg) { $sortArg = strtoupper($sortArg); if (!in_array($sortArg, array('ATTENDEE', 'CATEGORIES', 'CONTACT', 'DTSTAMP', 'LOCATION', 'ORGANIZER', 'PRIORITY', 'RELATED-TO', 'RESOURCES', 'STATUS', 'SUMMARY', 'UID', 'URL'))) { $sortArg = FALSE; } } foreach ($this->components as &$c) { iCalUtilityFunctions::_setSortArgs($c, $sortArg); } usort($this->components, array('iCalUtilityFunctions', '_cmpfcn')); }
/** * sort iCal compoments * * ascending sort on properties (if exist) x-current-dtstart, dtstart, * x-current-dtend, dtend, x-current-due, due, duration, created, dtstamp, uid if called without arguments, * otherwise sorting on specific (argument) property values * * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**> * @since 2.21.11 - 2015-03-21 * @param string $sortArg * @uses vcalendar::$components * @uses iCalUtilityFunctions::$otherProps * @uses iCalUtilityFunctions::_setSortArgs() * @uses iCalUtilityFunctions::_cmpfcn() * @return void */ function sort($sortArg = FALSE) { if (!is_array($this->components) || 2 > count($this->components)) { return; } if ($sortArg) { $sortArg = strtoupper($sortArg); if (!in_array($sortArg, iCalUtilityFunctions::$otherProps) && 'DTSTAMP' != $sortArg) { $sortArg = FALSE; } } foreach ($this->components as &$c) { iCalUtilityFunctions::_setSortArgs($c, $sortArg); } usort($this->components, array('iCalUtilityFunctions', '_cmpfcn')); }