--- db/prgsrc/drupal/modules/chgk_db/chgk_db.module 2010/02/28 20:17:33 1.1 +++ db/prgsrc/drupal/modules/chgk_db/chgk_db.module 2010/03/21 18:06:04 1.4 @@ -15,8 +15,14 @@ function chgk_db_menu() { $items['print'] = array( 'path' => 'print', 'page callback' => 'chgk_db_print', + 'page arguments' => array(1), + 'access callback' => "chgk_db_access", + ); + $items['fb2'] = array( + 'path' => 'fb2', + 'page callback' => 'chgk_db_fb2', + 'page arguments' => array(1), 'access callback' => "chgk_db_access", - ); return $items; } @@ -39,25 +45,70 @@ function chgk_db_theme() { ); $items['chgk_db_tour'] = array( 'arguments' => array( - 'tour'=>NULL + 'tour'=>NULL, + 'alone' => TRUE ), 'template'=>'templates/chgk_db_tour' ); + $items['chgk_db_tour_fb2'] = array( + 'arguments' => array( + 'tour'=>NULL, + 'alone' => TRUE + ), + 'template'=>'templates/chgk_db_tour_fb2' + ); + + $items['chgk_db_question'] = array( 'arguments' => array( - 'tour'=>NULL + 'question'=>NULL ), 'template'=>'templates/chgk_db_question' - ); + ); + + $items['chgk_db_question_fb2'] = array( + 'arguments' => array( + 'question'=>NULL + ), + 'template'=>'templates/chgk_db_question_fb2' + ); + + + $items['chgk_db_jeopardy_question'] = array( + 'arguments' => array( + 'question'=>NULL + ), + 'template'=>'templates/chgk_db_jeopardy_question' + ); + + $items['chgk_db_champ_full'] = array( + 'arguments' => array( + 'tour' => NULL + ), + 'template'=>'templates/chgk_db_champ_full' + ); + $items['chgk_db_fb2'] = array( + 'arguments' => array('tournament'=>''), + 'template' => 'templates/chgk_db_fb2' + ); return $items; } function chgk_db_print($string) { - $tournament = DbPackage::newFromDb('wc08.1'); - $all = $tournament->getAll(); - $content = theme('chgk_db_tour', $all); - print theme('chgk_db_print', $all->getTitle(), $content); + $tournament = DbPackage::newFromDb($string); + print $tournament->getPrintVersion(); +} + +function chgk_db_fb2($string) { + $tournament = DbPackage::newFromDb($string); + $tournament->getAll(); + $xml = theme('chgk_db_fb2', $tournament); + header("Content-Type: application/octet-stream"); + header("Content-Disposition: attachment; filename=\"$string.fb2\"\n"); + print $xml;; + exit; + #print $tournament->getFb2(); }