コード例 #1
0
ファイル: versions.php プロジェクト: rair/yacs
 /**
  * list most recent versions for one anchor
  *
  * @param string the target anchor
  * @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, $icon)
  *
  * @see versions/list.php
  */
 public static function list_by_date_for_anchor($anchor, $offset = 0, $count = 10, $variant = NULL)
 {
     global $context;
     // locate where we are
     if (!isset($variant)) {
         $variant = $anchor;
     }
     // the list of versions
     $query = "SELECT * FROM " . SQL::table_name('versions') . " AS versions" . " WHERE (anchor LIKE '" . SQL::escape($anchor) . "')" . " ORDER BY versions.edit_date DESC LIMIT " . $offset . ',' . $count;
     $output = Versions::list_selected(SQL::query($query), $variant);
     return $output;
 }