Changeset 12624


Ignore:
Timestamp:
Nov 14, 2011, 9:10:37 PM (12 years ago)
Author:
rvelices
Message:

feature 2486: Add an admin view for rates by user

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/rating.php

    r12528 r12624  
    3333// +-----------------------------------------------------------------------+
    3434check_status(ACCESS_ADMINISTRATOR);
     35
     36
     37include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
     38$tabsheet = new tabsheet();
     39$tabsheet->add('rating', l10n('Photos'), get_root_url().'admin.php?page=rating');
     40$tabsheet->add('rating_user', l10n('Users'), get_root_url().'admin.php?page=rating_user');
     41$tabsheet->select('rating');
     42$tabsheet->assign();
    3543
    3644// +-----------------------------------------------------------------------+
  • trunk/include/calendar_base.class.php

    r12118 r12624  
    216216$this->inner_sql.
    217217$this->get_date_where($level).'
    218   GROUP BY period
    219   ORDER BY period ASC
    220 ;';
     218  GROUP BY period;';
    221219
    222220    $level_items = simple_hash_from_query($query, 'period', 'nb_images');
  • trunk/include/ws_functions.inc.php

    r12544 r12624  
    18841884}
    18851885
     1886function ws_rates_delete($params, &$service)
     1887{
     1888  global $conf;
     1889
     1890  if (!$service->isPost())
     1891  {
     1892    return new PwgError(405, 'This method requires HTTP POST');
     1893  }
     1894
     1895  if (!is_admin())
     1896  {
     1897    return new PwgError(401, 'Access denied');
     1898  }
     1899
     1900  $user_id = (int)$params['user_id'];
     1901  if ($user_id<=0)
     1902  {
     1903    return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid user_id');
     1904  }
     1905 
     1906  $query = '
     1907DELETE FROM '.RATE_TABLE.'
     1908  WHERE user_id='.$user_id;
     1909 
     1910  if (!empty($params['anonymous_id']))
     1911  {
     1912    $query .= ' AND anonymous_id=\''.$params['anonymous_id'].'\'';
     1913  }
     1914 
     1915  $changes = pwg_db_changes(pwg_query($query));
     1916  if ($changes)
     1917  {
     1918    include_once(PHPWG_ROOT_PATH.'include/functions_rate.inc.php');
     1919    update_rating_score();
     1920  }
     1921  return $changes;
     1922}
     1923
     1924
    18861925/**
    18871926 * perform a login (web service method)
  • trunk/ws.php

    r11962 r12624  
    155155    'sets the rank of a photo for a given album (POST method only, for admins)'
    156156    );
    157  
     157
     158
     159  $service->addMethod('pwg.rates.delete', 'ws_rates_delete',
     160    array(
     161      'user_id' => array(),
     162      'anonymous_id' => array( 'default'=>'' ),
     163      ),
     164    'deletes all rates for a user (POST method only, admins only)'
     165    );
     166   
    158167  $service->addMethod('pwg.session.getStatus', 'ws_session_getStatus', null, '' );
    159168  $service->addMethod('pwg.session.login', 'ws_session_login',
Note: See TracChangeset for help on using the changeset viewer.