version 1.1, 2010/02/28 20:17:33
|
version 1.5, 2010/04/24 18:04:15
|
Line 15 function chgk_db_menu() {
|
Line 15 function chgk_db_menu() {
|
$items['print'] = array( |
$items['print'] = array( |
'path' => 'print', |
'path' => 'print', |
'page callback' => 'chgk_db_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", |
'access callback' => "chgk_db_access", |
|
|
); |
); |
return $items; |
return $items; |
} |
} |
Line 39 function chgk_db_theme() {
|
Line 45 function chgk_db_theme() {
|
); |
); |
$items['chgk_db_tour'] = array( |
$items['chgk_db_tour'] = array( |
'arguments' => array( |
'arguments' => array( |
'tour'=>NULL |
'tour'=>NULL, |
|
'alone' => TRUE |
), |
), |
'template'=>'templates/chgk_db_tour' |
'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( |
$items['chgk_db_question'] = array( |
'arguments' => array( |
'arguments' => array( |
'tour'=>NULL |
'question'=>NULL |
), |
), |
'template'=>'templates/chgk_db_question' |
'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; |
return $items; |
} |
} |
|
|
function chgk_db_print($string) { |
function chgk_db_print($string) { |
$tournament = DbPackage::newFromDb('wc08.1'); |
$tournament = DbPackage::newFromDb($string); |
$all = $tournament->getAll(); |
print $tournament->getPrintVersion(); |
$content = theme('chgk_db_tour', $all); |
} |
print theme('chgk_db_print', $all->getTitle(), $content); |
|
|
function chgk_db_fb2($string) { |
|
$tournament = DbPackage::newFromDb($string); |
|
$tournament->getAll(); |
|
$xml = theme('chgk_db_fb2', $tournament); |
|
$filename = "$string.fb2"; |
|
$zipname = $filename.".zip"; |
|
|
|
header("Content-Type: application/octet-stream\n"); |
|
header("Content-Type: application/force-download\n"); |
|
header("Content-Type: application/download\n"); |
|
header("Content-Type: application/x-zip-compressed; name=$filename\n"); |
|
header("Content-Disposition: attachment; filename=$filename.zip \n"); |
|
chdir(file_directory_temp()); |
|
$f = fopen ($filename, "w"); |
|
fputs($f, $xml); |
|
fclose($f); |
|
system("zip $zipname $filename>/dev/null"); |
|
print passthru("cat $zipname"); |
|
exit; |
|
#print $tournament->getFb2(); |
} |
} |
|
|
|
|