You are here

function views_handler_arg_userpoints_uid in User Points 5.2

1 string reference to 'views_handler_arg_userpoints_uid'
userpoints_views_views_arguments in ./userpoints_views.module

File

./userpoints_views.module, line 283

Code

function views_handler_arg_userpoints_uid($op, &$query, $argtype, $arg = '') {
  switch ($op) {
    case 'summary':
      $table_data = _views_get_tables();
      $joininfo = $table_data['userpoints_txn']['join'];
      $joininfo['type'] = 'inner';
      $query
        ->add_table('userpoints_txn', true, 1, $joininfo);
      $query
        ->add_field('uid', 'userpoints_txn');
      $fieldinfo['field'] = "userpoints_txn.uid";
      return $fieldinfo;
      break;
    case 'sort':
      $query
        ->add_orderby('userpoints_txn', 'uid', $argtype);
      break;
    case 'link':
      return l($query->name, "{$arg}/" . intval($query->uid));
    case 'filter':
      $uid = intval($arg);
      $table_data = _views_get_tables();
      $joininfo = $table_data['userpoints_txn']['join'];
      $joininfo['extra'] = array(
        'uid' => $uid,
      );
      $query
        ->add_table("userpoints_txn", true, 1, $joininfo);
      break;
    case 'title':
      $user = db_fetch_object(db_query("SELECT name FROM {users} WHERE uid = '%d'", $query));
      return $user->name;
  }
}