Changeset 1042 for trunk


Ignore:
Timestamp:
Feb 15, 2006, 3:29:26 AM (19 years ago)
Author:
rvelices
Message:

feature 288: manage rates for administrators

Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r1029 r1042  
    8484    'U_WAITING'=> $link_start.'waiting',
    8585    'U_COMMENTS'=> $link_start.'comments',
     86    'U_RATING'=> $link_start.'rating',
    8687    'U_CADDIE'=> $link_start.'element_set&cat=caddie',
    8788    'U_THUMBNAILS'=> $link_start.'thumbnail',
  • trunk/admin/include/functions.php

    r1028 r1042  
    13121312/**
    13131313 * update images.average_rate field
    1314  *
     1314 * param int $element_id optional, otherwise applies to all
    13151315 * @return void
    13161316 */
    1317 function update_average_rate()
     1317function update_average_rate( $element_id=-1 )
    13181318{
    13191319  $average_rates = array();
     
    13221322SELECT element_id,
    13231323       ROUND(AVG(rate),2) AS average_rate
    1324   FROM '.RATE_TABLE.'
    1325   GROUP BY element_id
    1326 ;';
     1324  FROM '.RATE_TABLE;
     1325  if ( $element_id != -1 )
     1326  {
     1327    $query .= ' WHERE element_id=' . $element_id;
     1328  }
     1329  $query .= ' GROUP BY element_id;';
     1330 
    13271331  $result = pwg_query($query);
    13281332  while ($row = mysql_fetch_array($result))
     
    13441348  $fields = array('primary' => array('id'), 'update' => array('average_rate'));
    13451349  mass_updates(IMAGES_TABLE, $fields, $datas);
     1350
     1351  $query='
     1352UPDATE '.IMAGES_TABLE .'
     1353  LEFT JOIN '.RATE_TABLE.' ON id=element_id
     1354  SET average_rate=NULL
     1355  WHERE element_id IS NULL';
     1356  if ( $element_id != -1 )
     1357  {
     1358    $query .= ' AND id=' . $element_id;
     1359  }
     1360  pwg_query($query);
    13461361}
    13471362
  • trunk/include/functions_category.inc.php

    r1036 r1042  
    260260  return array(
    261261    array('Default', '', true),
    262     array(l10n('best_rated_cat'),  'average_rate DESC', $conf['rate']),
     262    array(l10n('Average rate'), 'average_rate DESC', $conf['rate']),
    263263    array(l10n('most_visited_cat'), 'hit DESC', true),
    264264    array(l10n('Creation date'), 'date_creation DESC', true),
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r927 r1042  
    5454$lang['Check for upgrade'] = 'Check for upgrade';
    5555$lang['Comments for all'] = 'Comments for all';
     56$lang['Controversy'] = 'Controversy';
    5657$lang['Creation date'] = 'Creation date';
    5758$lang['Database'] = 'Database';
     
    9899$lang['Number of comments per page'] = 'Number of comments per page';
    99100$lang['Number of images per row'] = 'Number of images per row';
     101$lang['Number of rates'] = 'Number of rates';
    100102$lang['Number of rows per page'] = 'Number of rows per page';
    101103$lang['Number of thumbnails to create'] = 'Number of thumbnails to create';
     
    117119$lang['Properties'] = 'Properties';
    118120$lang['Random picture'] = 'Random picture';
     121$lang['Rate date'] = 'Rate date';
     122$lang['Rating'] = 'Rating';
    119123$lang['Recent period'] = 'Recent period';
    120124$lang['Registration date'] = 'Registration date';
     
    134138$lang['Storage category'] = 'Storage category';
    135139$lang['Submit'] = 'Submit';
     140$lang['Sum of rates'] = 'Sum of rates';
    136141$lang['Take selected elements out of caddie'] = 'Take selected elements out of caddie';
    137142$lang['Unable to check for upgrade since allow_url_fopen is disabled.'] = 'Unable to check for upgrade since allow_url_fopen is disabled.';
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r1029 r1042  
    9191$lang['Profile'] = 'Profile';
    9292$lang['Quick connect'] = 'Quick connect';
     93$lang['Rate'] = 'Rate';
    9394$lang['RSS feed'] = 'RSS feed';
    9495$lang['Register'] = 'Register';
     
    297298$lang['title_menu'] = 'Menu';
    298299$lang['title_send_mail'] = 'A comment on your site';
    299 $lang['to_rate'] = 'Rate';
    300300$lang['today'] = 'today';
    301301$lang['total'] = 'images';
  • trunk/language/fr_FR.iso-8859-1/admin.lang.php

    r1025 r1042  
    5454$lang['Check for upgrade'] = 'Dernière version ?';
    5555$lang['Comments for all'] = 'Commentaires utilisateur pour tous';
     56$lang['Controversy'] = 'Controverse';
    5657$lang['Creation date'] = 'Date de création';
    5758$lang['Database'] = 'Base de données';
     
    9899$lang['Number of comments per page'] = 'Nombre de commentaires utilisateur par page';
    99100$lang['Number of images per row'] = 'Nombre de miniatures par ligne';
     101$lang['Number of rates'] = 'Nombre de notes';
    100102$lang['Number of rows per page'] = 'Nombre de lignes par page';
    101103$lang['Number of thumbnails to create'] = 'Nombre de miniatures à créer';
     
    117119$lang['Properties'] = 'Propriétés';
    118120$lang['Random picture'] = 'Au hasard';
     121$lang['Rate date'] = 'Date de notation';
     122$lang['Rating'] = 'Notation';
    119123$lang['Recent period'] = 'Période récente';
    120124$lang['Registration date'] = 'Date d\'enregistrement';
     
    134138$lang['Storage category'] = 'Catégorie de stockage';
    135139$lang['Submit'] = 'Valider';
     140$lang['Sum of rates'] = 'Somme des notes';
    136141$lang['Take selected elements out of caddie'] = 'Sortir les éléments sélectionnés du panier';
    137142$lang['Unable to check for upgrade since allow_url_fopen is disabled.'] = 'Impossible de connaître la dernière version cat la fonction allow_url_fopen est désactivée.';
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r1029 r1042  
    9090$lang['Profile'] = 'Profil';
    9191$lang['Quick connect'] = 'Connexion rapide';
     92$lang['Rate'] = 'Note';
    9293$lang['RSS feed'] = 'flux RSS';
    9394$lang['Register'] = 'S\'enregistrer';
     
    296297$lang['title_menu'] = 'Menu';
    297298$lang['title_send_mail'] = 'Un commentaire sur le site';
    298 $lang['to_rate'] = 'Note';
    299299$lang['today'] = 'aujourd\'hui';
    300300$lang['total'] = 'images';
  • trunk/picture.php

    r1041 r1042  
    10431043      else
    10441044      {
    1045         $sentence = $lang['never_rated'].'. '.$lang['to_rate'];
     1045        $sentence = $lang['never_rated'].'. '.$lang['Rate'];
    10461046      }
    10471047    }
    10481048    else 
    10491049    {
    1050       $sentence = $lang['never_rated'].'. '.$lang['to_rate'];
     1050      $sentence = $lang['never_rated'].'. '.$lang['Rate'];
    10511051    }
    10521052    $template->assign_block_vars(
  • trunk/template/yoga/admin.tpl

    r1029 r1042  
    5353        <li><a href="{U_THUMBNAILS}">{lang:thumbnails}</a></li>
    5454        <li><a href="{U_COMMENTS}">{lang:comments}</a></li>
     55        <li><a href="{U_RATING}">{lang:Rating}</a></li>
    5556        <li><a href="{U_CADDIE}">{lang:Caddie}</a></li>
    5657      </ul>
Note: See TracChangeset for help on using the changeset viewer.