Пример #1
0
 /**
  * list newest tables for one anchor
  *
  * Example:
  * [php]
  * include_once 'tables/tables.php';
  * $items = Tables::list_by_date_for_anchor(0, 10, '', 'section:12');
  * $context['text'] .= Skin::build_list($items, 'compact');
  * [/php]
  *
  * @param int the id of the 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)
  */
 public static function list_by_date_for_anchor($anchor, $offset = 0, $count = 20, $variant = 'no_anchor')
 {
     global $context;
     // the request
     $query = "SELECT * FROM " . SQL::table_name('tables') . " WHERE (anchor LIKE '" . SQL::escape($anchor) . "') " . " ORDER BY edit_date DESC, title LIMIT " . $offset . ',' . $count;
     // the list of tables
     $output = Tables::list_selected(SQL::query($query), $variant);
     return $output;
 }