<?php
global $xajax;
$xajax -> register( XAJAX_FUNCTION, 'changePhrasePosition' );
$xajax -> register( XAJAX_FUNCTION, 'refreshPhrase' );

function changePhrasePosition( $phrase_id, $date, $position )
{  
  global $mdb;
  \factory\Ranker::changePhrasePosition( $phrase_id, $date, $position );
}

function refreshPhrase( $phrase_id )
{
  global $mdb;
  \factory\Ranker::refreshPhrase( $phrase_id );
  
  $ajax = new \xajaxResponse;
  $ajax -> script( '$( "#' . $phrase_id . '-' . date( 'Y-m-d' ) . ' span" ).html( "" );' );
  return $ajax;
}