2, 'path' => drupal_get_path('module', 'chess') . '/views', ); } /** * Implementation of hook_help(). */ function chess_help($section) { $api = variable_get('devel_api_url', 'api.drupal.org'); global $user; if($user) { //print_r($user); } else { echo "NO \$USER DEFINED!"; } //return '
'. t('This is a list of the variables and their values currently stored in variables table and the $conf array of your settings.php file. These variables are usually accessed with variable_get() and variable_set(). Variables that are too long can slow down your pages.', array('@variable-get-doc' => "http://$api/api/HEAD/function/variable_get", '@variable-set-doc' => 'http://$api/api/HEAD/function/variable_set')).'
${sql} ";
//echo " ${sql_count} ";
$num_per_page=50;
// gameID moves white black Next Move date created last move
$header = array(
array('data' => t('gameID'), 'field' => 'gameID', 'sort' => 'desc'),
array('data' => t('moves'), 'field' => 'moveCount'),
array('data' => t('white'), 'field' => 'whiteName'),
array('data' => t('black'), 'field' => 'blackName'),
array('data' => t('Next move'), 'field' => 'nextMove'),
array('data' => t('date created'), 'field' => 'dateCreated'),
array('data' => t('last move'), 'field' => 'lastMove'),
);
$tablesort = db_rewrite_sql(tablesort_sql($header));
$result = pager_query($sql . $tablesort, $num_per_page, 0, $sql_count);
while ($items = db_fetch_object($result)) {
$rows[] = array('data' =>
array(
" {$items->gameID} ",
t($items->moveCount),
l(t($items->whiteName), "user/{$items->whitePlayer}/chess", array(), NULL, NULL, FALSE, TRUE),
l(t($items->blackName), "user/{$items->blackPlayer}/chess", array(), NULL, NULL, FALSE, TRUE),
t($items->nextMove),
t($items->dateCreated),
t($items->lastMove),
),
);
}
$output .= " ${sql} ";
//echo " ${sql_count} ";
$num_per_page=50;
// gameID moves white black gameMessage datecreated lastmove
$header = array(
array('data' => t('gameID'), 'field' => 'gameID', 'sort' => 'desc'),
array('data' => t('moves'), 'field' => 'moveCount'),
array('data' => t('white'), 'field' => 'whiteName'),
array('data' => t('black'), 'field' => 'blackName'),
array('data' => t('Result'), 'field' => 'gameMessage'),
array('data' => t('date created'), 'field' => 'dateCreated'),
array('data' => t('last move'), 'field' => 'lastMove'),
);
$tablesort = tablesort_sql($header);
$result = pager_query($sql . $tablesort, $num_per_page, 0, $sql_count);
while ($items = db_fetch_object($result)) {
switch ($items->gameMessage)
{
case 'playerResigned':
$gameMessage = $items->messageFrom . " resigned";
break;
case 'checkMate':
$gameWinner = ($items->messageFrom == 'white' ? 'black' : 'white');
// kj changes - check mate is not certain lately so dont put message to say it is
//$gameMessage = "checkmate by {$gameWinner}";
$gameMessage = "possible checkmate by {$gameWinner}. Post here if is and wasn't caught so ADMIN can fix.";
break;
case 'draw':
$gameMessage = $items->gameMessage;
break;
}
$rows[] = array('data' =>
array(
" {$items->gameID} ",
t($items->moveCount),
l(t($items->whiteName), "user/{$items->whitePlayer}/chess", array(), NULL, NULL, FALSE, TRUE),
l(t($items->blackName), "user/{$items->blackPlayer}/chess", array(), NULL, NULL, FALSE, TRUE),
t($gameMessage),
t($items->dateCreated),
t($items->lastMove),
),
);
$gameWinner=NULL;
}
$output .= " ${sql} ";
//echo " ${sql_count} ";
$num_per_page=50;
//white black Invited by date created lastmove
// Should be : white black Invited by date of invite
$header = array(
array('data' => t('white'), 'field' => 'whiteName'),
array('data' => t('black'), 'field' => 'blackName'),
array('data' => t('Invited by'), 'field' => 'messageFrom'),
array('data' => t('date created'), 'field' => 'dateCreated', 'sort' => 'desc'),
);
$tablesort = tablesort_sql($header);
$result = pager_query($sql . $tablesort, $num_per_page, 0, $sql_count);
while ($items = db_fetch_object($result)) {
$rows[] = array('data' =>
array(
l(t($items->whiteName), "user/{$items->whitePlayer}/chess", array(), NULL, NULL, FALSE, TRUE),
l(t($items->blackName), "user/{$items->blackPlayer}/chess", array(), NULL, NULL, FALSE, TRUE),
t($items->messageFrom),
t($items->dateCreated),
),
);
}
$output .= "'. t("Select a game to view from the list by clicking on the game id") .'
'. "Select an opponent and challenge him to a new game." .'