File:  [Local Repository] / db / prgsrc / drupal / modules / chgk_db / chgk_db.module
Revision 1.5: download - view: text, annotated - select for diffs - revision graph
Sat Apr 24 18:04:15 2010 UTC (14 years ago) by roma7
Branches: MAIN
CVS tags: HEAD
chgk.cnf

    1: <?php
    2: /**********************
    3: *
    4: * Tournament
    5: *
    6: *********************/
    7: 
    8: require_once(dirname(__FILE__)."/classes/DbPackage.class.php");
    9: 
   10: 
   11: /**
   12:  * Implementation of hook_menu().
   13:  */
   14: function chgk_db_menu() {
   15:   $items['print'] = array(
   16:     'path'  => 'print',
   17:     'page callback' => 'chgk_db_print',
   18:     'page arguments' => array(1),
   19:     'access callback' => "chgk_db_access",
   20:   );
   21:   $items['fb2'] = array(
   22:     'path'  => 'fb2',
   23:     'page callback' => 'chgk_db_fb2',
   24:     'page arguments' => array(1),
   25:     'access callback' => "chgk_db_access",
   26:   );
   27:   return $items;
   28: }
   29: 
   30: /**
   31:  * Implementation of hook_theme().
   32:  */
   33: function chgk_db_theme() {
   34:   $items['chgk_db_print'] = array(
   35:     'arguments' => array(
   36:       'title' =>'',
   37:       'content' => ''
   38:     ),
   39:     'template'=>'templates/chgk_db_print' 
   40:   );
   41:   $items['chgk_db_field'] = array(
   42:     'arguments' => array(
   43:       'field' => NULL
   44:     )  
   45:   );
   46:   $items['chgk_db_tour'] = array(
   47:     'arguments' => array(
   48:       'tour'=>NULL,
   49:       'alone' => TRUE
   50:     ),
   51:     'template'=>'templates/chgk_db_tour'
   52:   );
   53: 
   54:   $items['chgk_db_tour_fb2'] = array(
   55:     'arguments' => array(
   56:       'tour'=>NULL,
   57:       'alone' => TRUE
   58:     ),
   59:     'template'=>'templates/chgk_db_tour_fb2'
   60:   );
   61: 
   62: 
   63:   $items['chgk_db_question'] = array(
   64:     'arguments' => array(
   65:       'question'=>NULL
   66:     ),
   67:     'template'=>'templates/chgk_db_question'
   68:   );
   69: 
   70:   $items['chgk_db_question_fb2'] = array(
   71:     'arguments' => array(
   72:       'question'=>NULL
   73:     ),
   74:     'template'=>'templates/chgk_db_question_fb2'
   75:   );
   76: 
   77: 
   78:   $items['chgk_db_jeopardy_question'] = array(
   79:     'arguments' => array(
   80:       'question'=>NULL
   81:     ),
   82:     'template'=>'templates/chgk_db_jeopardy_question'
   83:   );
   84: 
   85:   $items['chgk_db_champ_full'] = array(
   86:     'arguments' => array(
   87:         'tour' => NULL
   88:     ),
   89:     'template'=>'templates/chgk_db_champ_full'
   90:   );
   91:   $items['chgk_db_fb2'] = array(
   92:       'arguments' => array('tournament'=>''),
   93:       'template' => 'templates/chgk_db_fb2'
   94:   );
   95:   return $items;
   96: }
   97: 
   98: function chgk_db_print($string) {
   99:   $tournament = DbPackage::newFromDb($string);
  100:   print $tournament->getPrintVersion();
  101: }
  102: 
  103: function chgk_db_fb2($string) {
  104:   $tournament = DbPackage::newFromDb($string);
  105:   $tournament->getAll();
  106:   $xml = theme('chgk_db_fb2', $tournament);
  107:   $filename = "$string.fb2"; 
  108:   $zipname = $filename.".zip";
  109:   
  110:   header("Content-Type: application/octet-stream\n");
  111:   header("Content-Type: application/force-download\n");
  112:   header("Content-Type: application/download\n");
  113:   header("Content-Type: application/x-zip-compressed; name=$filename\n");
  114:   header("Content-Disposition: attachment; filename=$filename.zip \n");
  115:   chdir(file_directory_temp());
  116:   $f = fopen ($filename, "w");
  117:   fputs($f, $xml);
  118:   fclose($f);
  119:   system("zip $zipname $filename>/dev/null");
  120:   print passthru("cat $zipname");
  121:   exit;
  122:   #print $tournament->getFb2();
  123: }
  124: 
  125: 
  126: function chgk_db_access() {
  127:   return TRUE;
  128: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>