Don't like ads? PRO users don't see any ads ;-)
Guest

Squash Portal

By: a guest on May 1st, 2012  |  syntax: PHP  |  size: 1.87 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //settings.php
  2.  
  3. function teamMatchesSchedule()
  4.    {
  5.                 $this->load->library('settings_lib',array());
  6.                
  7.                 $this->_setLayoutData(
  8.                         array( 
  9.                                 'errorMessage'  => $this->session->flashdata('errorMessage')                           
  10.                         )
  11.                 );
  12.  
  13.                 //creating timeslots for all clubs
  14.                 $seasonID=3;
  15.                
  16.                 //Feching the courts info from t_clubdetails
  17.                 $this->settings_lib->getClubCourtsData($seasonID);
  18.                 $clubCourtsData =       $this->settings_lib->clubCourtsData;
  19.                
  20.                 //Fetching the rounds info from t_dkrounds
  21.                 $this->settings_lib->getRoundDates($seasonID);
  22.                 $roundDates             =       $this->settings_lib->roundDates;
  23.                
  24.                 foreach($roundDates as $round)
  25.                 {
  26.                         echo "<br /><br />".$round['RoundName'];
  27.                         $startDate      =       strtotime("+1 day", $round['startDate']);
  28.                         $endDate        =       strtotime("+1 day", $round['endDate']);
  29.                         foreach($clubCourtsData as $club)
  30.                         {
  31.                                 echo "<br /><br /> Club ID ".$club['ClubID'];
  32.                                 for($i = $startDate; $i <= $endDate; $i = strtotime("+1 day", $i))
  33.                                 {
  34.                                         $day    =       date('l', $i);// Day name in full text (lowercase of 'L')
  35.                                         $date   =       date('Y-m-d', $i);
  36.                                        
  37.                                         echo "<br />".$date."  ".$day;
  38.                                         //insertTimeSlots($i);
  39.                                 }
  40.                         }              
  41.  
  42.  
  43.                 }
  44.  
  45.  
  46. ===========================================================================================
  47. //settings_lib.php
  48.  
  49.   function getClubCourtsData($sessionID)
  50.   {
  51.         $queryString    =       'select * FROM t_clubdetails WHERE SeasonID = '.$sessionID;
  52.         $query                  =       $this->CI->query_model->executeQuery($queryString);
  53.        
  54.         $this->clubCourtsData   =       $query->result_array();
  55.   }
  56.  
  57.   function getRoundDates($sessionID)
  58.   {
  59.         $queryString    =       'select RoundID, RoundName, UNIX_TIMESTAMP(DATE(RoundStartDate)) AS startDate, UNIX_TIMESTAMP(DATE(RoundEndDate)) AS endDate FROM t_dkrounds WHERE SeasonID = '.$sessionID;
  60.         $query                  =       $this->CI->query_model->executeQuery($queryString);
  61.        
  62.         $this->roundDates       =       $query->result_array();
  63.        
  64.   }