You are here

function _photos_order_link in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos.module \_photos_order_link()
6 calls to _photos_order_link()
photos_album_page in inc/photos.album.inc
photos_page_image in inc/photos.page.inc
photos_share in inc/photos.page.inc
photos_sub_album_page in inc/photos.album.inc
_photos_edit_page_album in inc/photos.edit.inc

... See full list

File

./photos.module, line 1501

Code

function _photos_order_link($arg, $count = 0, $link = 0, $limit = 0) {
  $field = array(
    'weight' => t('By weight'),
    'timestamp' => t('By time'),
    'comments' => t('By comments '),
    'visits' => t('By visits'),
    'filesize' => t('By filesize'),
  );
  if ($limit) {
    $query = _pager_get_querystring();
    $links['limit'] = l(t('Default'), $_GET['q'], array(
      'query' => $query ? $query : NULL,
    ));
    if (!is_array($limit)) {
      $limit = array(
        5,
        10,
        20,
        30,
        40,
        50,
      );
    }
    foreach ($limit as $tt) {
      $links['limit'] .= l($tt, $_GET['q'], array(
        'query' => ($query ? $query . '&' : NULL) . 'limit=' . $tt,
        'attributes' => array(
          'class' => $_GET['limit'] == $tt ? 'orderac' : NULL,
        ),
      ));
    }
  }
  $links['count'] = $count;
  $links['link'] = $link ? $link : NULL;
  $links['sort'] = l(t('Default'), $arg);
  foreach ($field as $key => $t) {
    if ($_GET['field'] != $key) {
      $sort = 'desc';
      $class = 'photos_order_desc';
      array(
        'attributes' => array(
          'class' => 'photos_order_desc',
        ),
      );
    }
    else {
      if ($_GET['sort'] == 'desc') {
        $sort = 'asc';
        $class = 'photos_order_desc orderac';
      }
      else {
        $sort = 'desc';
        $class = 'photos_order_asc orderac';
      }
    }
    $links['sort'] .= l($t, $arg, array(
      'query' => array(
        'sort' => $sort,
        'field' => $key,
      ),
      'attributes' => array(
        'class' => $class,
      ),
    ));
  }
  return theme('photos_albumlinks', $links);
}