pager.inc

  1. cis7 includes/pager.inc
  2. cis7 sites/all/themes/ulmus/aurora/includes/pager.inc
  3. cle7 includes/pager.inc
  4. cle7 sites/all/themes/local_contrib/bootstrap/includes/pager.inc
  5. cle7 sites/all/themes/ulmus/aurora/includes/pager.inc
  6. ecd7 includes/pager.inc
  7. ecd7 sites/all/themes/ulmus/aurora/includes/pager.inc
  8. elmsmedia7 sites/all/themes/ulmus/aurora/includes/pager.inc
  9. elmsmedia7 includes/pager.inc
  10. harmony7 includes/pager.inc
  11. harmony7 sites/all/themes/ulmus/aurora/includes/pager.inc
  12. icor7 sites/all/themes/ulmus/aurora/includes/pager.inc
  13. icor7 includes/pager.inc
  14. meedjum_blog7 sites/all/themes/ulmus/aurora/includes/pager.inc
  15. meedjum_blog7 includes/pager.inc
  16. mooc7 includes/pager.inc
  17. mooc7 sites/all/themes/ulmus/aurora/includes/pager.inc

Functions

Namesort descending Description
aurora_pager Returns HTML for a query pager.
aurora_pager_first Returns HTML for the "first page" link in a query pager.
aurora_pager_last Returns HTML for the "last page" link in query pager.
aurora_pager_link Returns HTML for a link to a specific query result page.
aurora_pager_next Returns HTML for the "next page" link in a query pager.
aurora_pager_previous Returns HTML for the "previous page" link in a query pager.

File

sites/all/themes/ulmus/aurora/includes/pager.inc
View source
  1. <?php
  2. /**
  3. * Returns HTML for a query pager.
  4. *
  5. * Menu callbacks that display paged query results should call theme('pager') to
  6. * retrieve a pager control so that users can view other results. Format a list
  7. * of nearby pages with additional query results.
  8. *
  9. * @param $variables
  10. * An associative array containing:
  11. * - tags: An array of labels for the controls in the pager.
  12. * - element: An optional integer to distinguish between multiple pagers on
  13. * one page.
  14. * - parameters: An associative array of query string parameters to append to
  15. * the pager links.
  16. * - quantity: The number of pages in the list.
  17. *
  18. * @ingroup themeable
  19. */
  20. function aurora_pager($variables) {
  21. $tags = $variables['tags'];
  22. $element = $variables['element'];
  23. $parameters = $variables['parameters'];
  24. $quantity = $variables['quantity'];
  25. global $pager_page_array, $pager_total;
  26. // Calculate various markers within this pager piece:
  27. // Middle is used to "center" pages around the current page.
  28. $pager_middle = ceil($quantity / 2);
  29. // current is the page we are currently paged to
  30. $pager_current = $pager_page_array[$element] + 1;
  31. // first is the first page listed by this pager piece (re quantity)
  32. $pager_first = $pager_current - $pager_middle + 1;
  33. // last is the last page listed by this pager piece (re quantity)
  34. $pager_last = $pager_current + $quantity - $pager_middle;
  35. // max is the maximum page number
  36. $pager_max = $pager_total[$element];
  37. // End of marker calculations.
  38. // Prepare for generation loop.
  39. $i = $pager_first;
  40. if ($pager_last > $pager_max) {
  41. // Adjust "center" if at end of query.
  42. $i = $i + ($pager_max - $pager_last);
  43. $pager_last = $pager_max;
  44. }
  45. if ($i <= 0) {
  46. // Adjust "center" if at start of query.
  47. $pager_last = $pager_last + (1 - $i);
  48. $i = 1;
  49. }
  50. // End of generation loop preparation.
  51. $li_first = theme('pager_first', array('text' => (isset($tags[0]) ? $tags[0] : t('« first')), 'element' => $element, 'parameters' => $parameters));
  52. $li_previous = theme('pager_previous', array('text' => (isset($tags[1]) ? $tags[1] : t('‹ previous')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  53. $li_next = theme('pager_next', array('text' => (isset($tags[3]) ? $tags[3] : t('next ›')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  54. $li_last = theme('pager_last', array('text' => (isset($tags[4]) ? $tags[4] : t('last »')), 'element' => $element, 'parameters' => $parameters));
  55. if ($pager_total[$element] > 1) {
  56. if ($li_first) {
  57. $items[] = array(
  58. 'class' => array('pager-first'),
  59. 'data' => $li_first,
  60. );
  61. }
  62. if ($li_previous) {
  63. $items[] = array(
  64. 'class' => array('pager-previous'),
  65. 'data' => $li_previous,
  66. );
  67. }
  68. // When there is more than one page, create the pager list.
  69. if ($i != $pager_max) {
  70. if ($i > 1) {
  71. $items[] = array(
  72. 'class' => array('pager-ellipsis'),
  73. 'data' => '…',
  74. );
  75. }
  76. // Now generate the actual pager piece.
  77. for (; $i <= $pager_last && $i <= $pager_max; $i++) {
  78. if ($i < $pager_current) {
  79. $items[] = array(
  80. 'class' => array('pager-item'),
  81. 'data' => theme('pager_previous', array('text' => $i, 'element' => $element, 'interval' => ($pager_current - $i), 'parameters' => $parameters)),
  82. );
  83. }
  84. if ($i == $pager_current) {
  85. $items[] = array(
  86. 'class' => array('pager-current'),
  87. 'data' => $i,
  88. );
  89. }
  90. if ($i > $pager_current) {
  91. $items[] = array(
  92. 'class' => array('pager-item'),
  93. 'data' => theme('pager_next', array('text' => $i, 'element' => $element, 'interval' => ($i - $pager_current), 'parameters' => $parameters)),
  94. );
  95. }
  96. }
  97. if ($i < $pager_max) {
  98. $items[] = array(
  99. 'class' => array('pager-ellipsis'),
  100. 'data' => '…',
  101. );
  102. }
  103. }
  104. // End generation.
  105. if ($li_next) {
  106. $items[] = array(
  107. 'class' => array('pager-next'),
  108. 'data' => $li_next,
  109. );
  110. }
  111. if ($li_last) {
  112. $items[] = array(
  113. 'class' => array('pager-last'),
  114. 'data' => $li_last,
  115. );
  116. }
  117. return '<h2 class="element-invisible">' . t('Pages') . '</h2>' . theme('item_list', array(
  118. 'items' => $items,
  119. 'attributes' => array('class' => array('pager')),
  120. ));
  121. }
  122. }
  123. /**
  124. * @defgroup pagerpieces Pager pieces
  125. * @{
  126. * Theme functions for customizing pager elements.
  127. *
  128. * Note that you should NOT modify this file to customize your pager.
  129. */
  130. /**
  131. * Returns HTML for the "first page" link in a query pager.
  132. *
  133. * @param $variables
  134. * An associative array containing:
  135. * - text: The name (or image) of the link.
  136. * - element: An optional integer to distinguish between multiple pagers on
  137. * one page.
  138. * - parameters: An associative array of query string parameters to append to
  139. * the pager links.
  140. *
  141. * @ingroup themeable
  142. */
  143. function aurora_pager_first($variables) {
  144. $text = $variables['text'];
  145. $element = $variables['element'];
  146. $parameters = $variables['parameters'];
  147. global $pager_page_array;
  148. $output = '';
  149. // If we are anywhere but the first page
  150. if ($pager_page_array[$element] > 0) {
  151. $output = theme('pager_link', array('text' => $text, 'page_new' => pager_load_array(0, $element, $pager_page_array), 'element' => $element, 'parameters' => $parameters));
  152. }
  153. return $output;
  154. }
  155. /**
  156. * Returns HTML for the "previous page" link in a query pager.
  157. *
  158. * @param $variables
  159. * An associative array containing:
  160. * - text: The name (or image) of the link.
  161. * - element: An optional integer to distinguish between multiple pagers on
  162. * one page.
  163. * - interval: The number of pages to move backward when the link is clicked.
  164. * - parameters: An associative array of query string parameters to append to
  165. * the pager links.
  166. *
  167. * @ingroup themeable
  168. */
  169. function aurora_pager_previous($variables) {
  170. $text = $variables['text'];
  171. $element = $variables['element'];
  172. $interval = $variables['interval'];
  173. $parameters = $variables['parameters'];
  174. global $pager_page_array;
  175. $output = '';
  176. // If we are anywhere but the first page
  177. if ($pager_page_array[$element] > 0) {
  178. $page_new = pager_load_array($pager_page_array[$element] - $interval, $element, $pager_page_array);
  179. // If the previous page is the first page, mark the link as such.
  180. if ($page_new[$element] == 0) {
  181. $output = theme('pager_first', array('text' => $text, 'element' => $element, 'parameters' => $parameters));
  182. }
  183. // The previous page is not the first page.
  184. else {
  185. $output = theme('pager_link', array('text' => $text, 'page_new' => $page_new, 'element' => $element, 'parameters' => $parameters));
  186. }
  187. }
  188. return $output;
  189. }
  190. /**
  191. * Returns HTML for the "next page" link in a query pager.
  192. *
  193. * @param $variables
  194. * An associative array containing:
  195. * - text: The name (or image) of the link.
  196. * - element: An optional integer to distinguish between multiple pagers on
  197. * one page.
  198. * - interval: The number of pages to move forward when the link is clicked.
  199. * - parameters: An associative array of query string parameters to append to
  200. * the pager links.
  201. *
  202. * @ingroup themeable
  203. */
  204. function aurora_pager_next($variables) {
  205. $text = $variables['text'];
  206. $element = $variables['element'];
  207. $interval = $variables['interval'];
  208. $parameters = $variables['parameters'];
  209. global $pager_page_array, $pager_total;
  210. $output = '';
  211. // If we are anywhere but the last page
  212. if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
  213. $page_new = pager_load_array($pager_page_array[$element] + $interval, $element, $pager_page_array);
  214. // If the next page is the last page, mark the link as such.
  215. if ($page_new[$element] == ($pager_total[$element] - 1)) {
  216. $output = theme('pager_last', array('text' => $text, 'element' => $element, 'parameters' => $parameters));
  217. }
  218. // The next page is not the last page.
  219. else {
  220. $output = theme('pager_link', array('text' => $text, 'page_new' => $page_new, 'element' => $element, 'parameters' => $parameters));
  221. }
  222. }
  223. return $output;
  224. }
  225. /**
  226. * Returns HTML for the "last page" link in query pager.
  227. *
  228. * @param $variables
  229. * An associative array containing:
  230. * - text: The name (or image) of the link.
  231. * - element: An optional integer to distinguish between multiple pagers on
  232. * one page.
  233. * - parameters: An associative array of query string parameters to append to
  234. * the pager links.
  235. *
  236. * @ingroup themeable
  237. */
  238. function aurora_pager_last($variables) {
  239. $text = $variables['text'];
  240. $element = $variables['element'];
  241. $parameters = $variables['parameters'];
  242. global $pager_page_array, $pager_total;
  243. $output = '';
  244. // If we are anywhere but the last page
  245. if ($pager_page_array[$element] < ($pager_total[$element] - 1)) {
  246. $output = theme('pager_link', array('text' => $text, 'page_new' => pager_load_array($pager_total[$element] - 1, $element, $pager_page_array), 'element' => $element, 'parameters' => $parameters));
  247. }
  248. return $output;
  249. }
  250. /**
  251. * Returns HTML for a link to a specific query result page.
  252. *
  253. * @param $variables
  254. * An associative array containing:
  255. * - text: The link text. Also used to figure out the title attribute of the
  256. * link, if it is not provided in $variables['attributes']['title']; in
  257. * this case, $variables['text'] must be one of the standard pager link
  258. * text strings that would be generated by the pager theme functions, such
  259. * as a number or t('« first').
  260. * - page_new: The first result to display on the linked page.
  261. * - element: An optional integer to distinguish between multiple pagers on
  262. * one page.
  263. * - parameters: An associative array of query string parameters to append to
  264. * the pager link.
  265. * - attributes: An associative array of HTML attributes to apply to the
  266. * pager link.
  267. *
  268. * @see theme_pager()
  269. *
  270. * @ingroup themeable
  271. */
  272. function aurora_pager_link($variables) {
  273. $text = $variables['text'];
  274. $page_new = $variables['page_new'];
  275. $element = $variables['element'];
  276. $parameters = $variables['parameters'];
  277. $attributes = $variables['attributes'];
  278. $page = isset($_GET['page']) ? $_GET['page'] : '';
  279. if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
  280. $parameters['page'] = $new_page;
  281. }
  282. $query = array();
  283. if (count($parameters)) {
  284. $query = drupal_get_query_parameters($parameters, array());
  285. }
  286. if ($query_pager = pager_get_query_parameters()) {
  287. $query = array_merge($query, $query_pager);
  288. }
  289. // Set each pager link title
  290. if (!isset($attributes['title'])) {
  291. static $titles = NULL;
  292. if (!isset($titles)) {
  293. $titles = array(
  294. t('« first') => t('Go to first page'),
  295. t('‹ previous') => t('Go to previous page'),
  296. t('next ›') => t('Go to next page'),
  297. t('last »') => t('Go to last page'),
  298. );
  299. }
  300. if (isset($titles[$text])) {
  301. $attributes['title'] = $titles[$text];
  302. }
  303. elseif (is_numeric($text)) {
  304. $attributes['title'] = t('Go to page @number', array('@number' => $text));
  305. }
  306. }
  307. // @todo l() cannot be used here, since it adds an 'active' class based on the
  308. // path only (which is always the current path for pager links). Apparently,
  309. // none of the pager links is active at any time - but it should still be
  310. // possible to use l() here.
  311. // @see http://drupal.org/node/1410574
  312. $attributes['href'] = url($_GET['q'], array('query' => $query));
  313. return '<a' . drupal_attributes($attributes) . '>' . check_plain($text) . '</a>';
  314. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.