/** * a compact list of dates at some anchor * * @param string the anchor to consider (e.g., 'section:123') * @param int maximum number of items * @return array of ($prefix, $label, $suffix, $type, $icon, $hover) */ function render_list_for_anchor($anchor, $count = 7) { global $context; // we will build a list of dates include_once $context['path_to_root'] . 'dates/dates.php'; // list past dates as well if (preg_match('/\\bwith_past_dates\\b/i', $this->attributes['overlay_parameters'])) { $items = Dates::list_for_anchor($anchor, 0, $count, 'compact'); } else { $items = Dates::list_future_for_anchor($anchor, 0, $count, 'compact'); } // we return an array return $items; }
* * @author Bernard Paques * @reference * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License */ // common definitions and initial processing include_once '../shared/global.php'; include_once '../dates/dates.php'; // load the skin load_skin('dates'); // the path to this page $context['path_bar'] = array('users/' => i18n::s('Dates')); // the title of the page $context['page_title'] = i18n::s('Dates'); // list upcoming events $text = Dates::list_future_for_anchor(NULL, 0, 100, 'ics'); // no encoding, no compression and no yacs handler... if (!headers_sent()) { Safe::header('Content-Type: text/calendar'); Safe::header('Content-Transfer-Encoding: binary'); Safe::header('Content-Length: ' . strlen($text)); } // suggest a download if (!headers_sent()) { $file_name = utf8::to_ascii(Skin::strip($context['page_title']) . '.ics'); Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"'); } // enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download http::expire(1800); // strong validator $etag = '"' . md5($text) . '"';
/** * list future dates * * @param int the offset from the start of the list; usually, 0 or 1 * @param int the number of items to display * @param string the list variant, if any * @return NULL on error, else an ordered array with $url => ($prefix, $label, $suffix, $type, $icon, $date) * * @see dates/index.php */ public static function &list_future($offset = 0, $count = 100, $variant = 'family') { $output =& Dates::list_future_for_anchor(NULL, $offset, $count, $variant, TRUE); return $output; }