예제 #1
0
 /**
  * Creates a round Iterator
  *
  * @param $resultSet array Associative array containing an array of rows of round data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     /**
      * Populate the iterator with round objects
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         $round = null;
         try {
             /*$round = $objLayer->createRound(
                   $resultSet[$i]['number']
               );*/
             $round = $objLayer->createRound();
             $round->setNumber($resultSet[$i]['number']);
             $round->setId($resultSet[$i]['round_id']);
             //find the league that is assoc with this round
             $modelLeague = $this->objLayer->createLeague();
             $modelLeague->setId($resultSet[$i]['league_id']);
             $league = $this->objLayer->findLeague($modelLeague)->current();
             //set the league into this round
             $round->setLeague($league);
             array_push($this->array, $round);
         } catch (RDException $rde) {
             echo $rde;
         }
     }
 }
예제 #2
0
 /**
  * Creates a Match Iterator.
  *
  * @param $resultSet array Associative array containing an array of rows of match data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     //echo 'dump : ' . var_dump($resultSet);
     /**
      * Populate the iterator with Match objects
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         $match = null;
         try {
             //create team obj
             $homeTeam = $objLayer->createTeam();
             $homeTeam->setId($resultSet[$i]['home_team_id']);
             $homeTeam = $objLayer->findTeam($homeTeam)->current();
             $league = $objLayer->restoreTeamParticipatesInLeague($homeTeam)->current();
             $homeTeam->setParticipatesInLeague($league);
             $awayTeam = $objLayer->createTeam();
             $awayTeam->setId($resultSet[$i]['away_team_id']);
             $awayTeam = $objLayer->findTeam($awayTeam)->current();
             $league2 = $objLayer->restoreTeamParticipatesInLeague($awayTeam)->current();
             $awayTeam->setParticipatesInLeague($league2);
             //create match obj to get sports venue from
             $match = $objLayer->createMatch();
             $match->setId($resultSet[$i]['match_id']);
             $sportsVenue = $objLayer->restoreMatchSportsVenue($match);
             /*$match = $objLayer->createMatch(
                   $resultSet[$i]['home_points'],
                   $resultSet[$i]['away_points'],
                   $resultSet[$i]['date'],
                   $resultSet[$i]['is_completed'],
                   $homeTeam,
                   $awayTeam
               );*/
             //$match = $objLayer->createMatch();
             //get round obj
             $round = $this->objLayer->createRound();
             $round->setId($resultSet[$i]['round_id']);
             //die(var_dump($round));
             //die(var_dump($resultSet));
             $round = $objLayer->findRound($round)->current();
             $match->setHomePoints($resultSet[$i]['home_points']);
             $match->setAwayPoints($resultSet[$i]['away_points']);
             $match->setDate($resultSet[$i]['date']);
             $match->setIsCompleted($resultSet[$i]['is_completed']);
             $match->setHomeTeam($homeTeam);
             $match->setAwayTeam($awayTeam);
             $match->setSportsVenue($sportsVenue);
             $match->setRound($round);
             //$match->setId($resultSet[$i]['match_id']);
             array_push($this->array, $match);
         } catch (RDException $rde) {
             echo $rde;
         }
     }
     // echo 'match iterator' .  var_dump($this->array);
 }
예제 #3
0
 /**
  * Creates a Team  Iterator
  *
  * @param $resultSet array Associative array containing an array of rows of team data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     /**
      * Populate the iterator with sports venue objects
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         $team = null;
         $student = null;
         $league = null;
         try {
             //create student obj who is team captain
             $student = $objLayer->createStudent();
             $student->setId(intval($resultSet[$i]['captain_id']));
             //use ID to get specific student
             $studentIter = $objLayer->findStudent($student);
             //->current();
             $captain = $studentIter->current();
             //create league obj that the team belongs to
             $league = $objLayer->createLeague();
             //$league->setId(intval($resultSet[$i]['league_id']));
             //$league = $objLayer->findLeague($league)->current();
             //echo var_dump($league);
             $team = $objLayer->createTeam();
             $team->setId($resultSet[$i]['team_id']);
             $team->setName($resultSet[$i]['name']);
             $team->setCaptain($captain);
             //get league
             $leagueIter = $objLayer->restoreTeamParticipatesInLeague($team, null);
             //die(var_dump($leagueIter));
             while ($leagueIter->valid()) {
                 $team->setParticipatesInLeague($leagueIter->current());
                 $leagueIter->next();
             }
             // $resultSet[$i]['name'],
             //$captain,
             //$league
             //);
             array_push($this->array, $team);
         } catch (RDException $rde) {
             echo $rde;
         }
     }
     //echo 'Team iterator lime 76' . var_dump($this->array);
 }
예제 #4
0
 /**
  * Creates a ScoreReport Iterator
  *
  * @param $resultSet array Associative array containing an array of rows of scorereport data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     //echo 'result set of score report: ' . var_dump($resultSet);
     /**
      * Populate the iterator with score report objects
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         $report = null;
         $match = null;
         $student = null;
         try {
             //create student obj who is team captain
             $student = $objLayer->createStudent();
             $student->setId($resultSet[$i]['student_id']);
             //use ID to get specific student
             $student = $objLayer->findStudent($student)->current();
             //create match obj that the report belongs to
             $match = $objLayer->createMatch();
             $match->setId($resultSet[$i]['match_id']);
             $match = $objLayer->findMatch($match)->current();
             /*$report = $objLayer->createScoreReport(
                   $resultSet[$i]['home_points'],
                   $resultSet[$i]['away_points'],
                   $resultSet[$i]['date'],
                   $student,
                   $match
               );*/
             $report = $objLayer->createScoreReport();
             $report->setHomePoints($resultSet[$i]['home_points']);
             $report->setAwayPoints($resultSet[$i]['away_points']);
             $report->setDate($resultSet[$i]['date']);
             $report->setStudent($student);
             $report->setMatch($match);
             $report->setId($resultSet[$i]['score_report_id']);
             array_push($this->array, $report);
         } catch (RDException $rde) {
             echo $rde;
         }
     }
 }
예제 #5
0
 /**
  * Creates a sports venue Iterator
  *
  * @param $resultSet array Associative array containing an array of rows of sports venue data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     /**
      * Populate the iterator with sports venue objects
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         $venue = null;
         try {
             $venue = $objLayer->createSportsVenue($resultSet[$i]['name'], $resultSet[$i]['address'], $resultSet[$i]['is_indoor']);
             $venue->setId($resultSet[$i]['sports_venue_id']);
             array_push($this->array, $venue);
         } catch (RDException $rde) {
             echo $rde;
         }
     }
 }
예제 #6
0
 /**
  * Creates a Student Iterator
  *
  * @param $resultSet array Associative array containing an array of rows of student data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     //echo 'result set of student iterator.' . var_dump($resultSet);
     /**
      * Populate the iterator with Student objects
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         $student = null;
         try {
             $student = $objLayer->createStudent($resultSet[$i]['first_name'], $resultSet[$i]['last_name'], $resultSet[$i]['user_name'], $resultSet[$i]['password'], $resultSet[$i]['email_address'], $resultSet[$i]['student_id'], $resultSet[$i]['major'], $resultSet[$i]['address']);
             $student->setId($resultSet[$i]['user_id']);
             array_push($this->array, $student);
         } catch (RDException $rde) {
             echo $rde;
         }
     }
     // echo 'studnet iterator: ' . var_dump($this->array);
 }
 /**
  * Creates an Admin Iterator.
  *
  * @param $resultSet array Associative array containing an array of rows of admin data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     //echo "REsult SET: " . var_dump($resultSet);
     //echo "REsult SET: " . var_dump($resultSet['first_name']);
     /**
      * Populate the iterator with admub objects
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         try {
             $admin = $objLayer->createAdministrator($firstName = $resultSet[$i]['first_name'], $lastName = $resultSet[$i]['last_name'], $userName = $resultSet[$i]['user_name'], $password = $resultSet[$i]['password'], $emailAddress = $resultSet[$i]['email_address']);
             $admin->setId($resultSet[$i]['user_id']);
             //var_dump($admin->getUserName());
             array_push($this->array, $admin);
         } catch (RDException $rde) {
             echo $rde;
         }
     }
 }
예제 #8
0
 /**
  * Creates a League Iterator.
  *
  * @param $resultSet array Associative array containing an array of rows of league data returned from a DB query
  * @param $objLayer ObjectLayerImpl instance of the object layer object
  */
 public function __construct($resultSet, $objLayer)
 {
     parent::__construct();
     $this->resultSet = $resultSet;
     $this->objLayer = $objLayer;
     /**
      * Populate the iterator with leagueobjects
      *
      *
      */
     for ($i = 0; $i < count($resultSet); $i++) {
         $league = null;
         try {
             $league = $objLayer->createLeague($resultSet[$i]['name'], $resultSet[$i]['league_rules'], $resultSet[$i]['match_rules'], $resultSet[$i]['is_indoor'], intval($resultSet[$i]['min_teams']), intval($resultSet[$i]['max_teams']), intval($resultSet[$i]['min_members']), intval($resultSet[$i]['max_members']));
             $league->setId(intval($resultSet[$i]['league_id']));
             array_push($this->array, $league);
         } catch (RDException $rde) {
             echo $rde->getMessage();
         }
     }
 }