Source for file StatsController.php

Documentation is available at StatsController.php

  1. <?php
  2. /**
  3.  * Controller class for managing competition statistics.
  4.  * 
  5.  * @author Margus Sellin <margus@bitweb.ee>
  6.  * @copyright Copyright (C) 2011. All rights reserved. Margus Sellin
  7.  * @project olymp
  8.  * 
  9.  */
  10. class StatsController extends Zend_Controller_Action
  11. {
  12.     /**
  13.      * Index action.
  14.      * User chooses a competition, a year and a class from dropdownlists.
  15.      * Based on parameters chosen by user, the statistics table is displayed.
  16.      * 
  17.      * Not all the parameters are required.
  18.      */
  19.     public function indexAction()
  20.     {
  21.         $modelPiirkondKoond new Model_Piirkondkoond();
  22.         $modelValikKoond new Model_Valikkoond();
  23.         $modelLoppKoond new Model_Loppkoond();
  24.         $modelLahtineKoond new Model_Lahtinekoond();
  25.         
  26.         if($this->_request->isPost()) {
  27.             $competition $this->_getParam('competition');
  28.             $year $this->_getParam('year');
  29.             $class $this->_getParam('class');
  30.             
  31.             $competitionName '';
  32.             if($competition != 0{
  33.                 switch($competition{
  34.                     case 11:
  35.                         $stats $modelPiirkondKoond->fetchAreaStatistics($year$class);
  36.                         $competitionName .= 'Piirkonnavoor 'break;
  37.                     case 13:
  38.                         $stats $modelValikKoond->fetchAreaStatistics($year$class);
  39.                         $competitionName .= 'Valivõistlus 'break;
  40.                     case 2:
  41.                         $stats $modelLoppKoond->fetchAreaStatistics($year$class);
  42.                         $competitionName .= 'Lõppvoor 'break;
  43.                     case 15:
  44.                         $stats $modelLahtineKoond->fetchAreaStatistics($year$class);
  45.                         $competitionName .= 'Lahtine võistlus 'break;
  46.                 }
  47.                 $competitionName .= $year '.a ' $class '.klass';
  48.                 $this->view->competitionName $competitionName;
  49.                 $this->view->stats $stats;
  50.             }
  51.         }
  52.     }
  53.  
  54. }

Documentation generated on Tue, 14 Jun 2011 19:53:26 +0300 by phpDocumentor 1.4.1