isAdmin()) die('Access Denied'); $qs = array(); $sortOptions=array( 'name' => 'name', 'status' => 'isenabled', 'members' => 'members_count', 'lead' => 'lead__lastname', 'created' => 'created', 'updated' => 'updated', ); $orderWays = array('DESC'=>'DESC', 'ASC'=>'ASC'); $sort = ($_REQUEST['sort'] && $sortOptions[strtolower($_REQUEST['sort'])]) ? strtolower($_REQUEST['sort']) : 'name'; //Sorting options... if ($sort && $sortOptions[$sort]) { $order_column = $sortOptions[$sort]; } $order_column = $order_column ? $order_column : 'name'; if ($_REQUEST['order'] && isset($orderWays[strtoupper($_REQUEST['order'])])) { $order = $orderWays[strtoupper($_REQUEST['order'])]; } else { $order = 'ASC'; } if ($order_column && strpos($order_column,',')) { $order_column=str_replace(','," $order,",$order_column); } $x=$sort.'_sort'; $$x=' class="'.strtolower($order).'" '; $page = ($_GET['p'] && is_numeric($_GET['p'])) ? $_GET['p'] : 1; $count = Team::objects()->count(); $pageNav = new Pagenate($count, $page, PAGE_LIMIT); $qstr = '&'. Http::build_query($qs); $qs += array('sort' => $_REQUEST['sort'], 'order' => $_REQUEST['order']); $pageNav->setURL('teams.php', $qs); $showing = $pageNav->showing().' '._N('team', 'teams', $count); $qstr .= '&order='.urlencode($order=='DESC' ? 'ASC' : 'DESC'); ?>
annotate(array( 'members_count'=>SqlAggregate::COUNT('members__staff', true), )) ->order_by(sprintf('%s%s', strcasecmp($order, 'DESC') ? '' : '-', $order_column)) ->limit($pageNav->getLimit()) ->offset($pageNav->getStart()); foreach ($teams as $team) { $id = $team->getId(); $sel=false; if ($ids && in_array($id, $ids)) $sel=true; ?>
  href="teams.php?&sort=name"> href="teams.php?&sort=status"> href="teams.php?&sort=members"> href="teams.php?&sort=lead"> href="teams.php?&sort=created"> href="teams.php?&sort=updated">
> getName(); ?>    isActive() ? __('Active') : ''.__('Disabled').''; ?>    members_count > 0) { ?> members_count; ?> 0   lead ?: ''; ?>  created); ?>  updated); ?> 
        
 '.__('Page').':'.$pageNav->getPageLinks().' '; ?>