Example #1
0
 protected function __construct()
 {
     $this->skins = Path::getRoot() . 'Skins/' . Session::getAccountId() . '/';
     $this->default = Path::getRoot() . 'Skins/' . Session::getGuestAccountId() . '/';
 }
 /**
  * @param int $leagueId
  * @param int $year
  * @return array
  *
  * @todo based upon the year and league, return the total number of weeks
  */
 public function getWeeksForLeague($leagueId, $year, $forSelect = false)
 {
     $output = [];
     $this->buildUrl(self::$content);
     $this->gateway->addParam('command', 'getweekrangeforyear');
     $this->gateway->addParam('accountId', Session::getAccountId());
     $this->gateway->addParam('leagueId', $leagueId);
     $this->gateway->addParam('year', $year);
     $result = $this->gateway->request();
     if (ApiResult::success() == $result->result) {
         if ($forSelect) {
             $range = range($result->data[0]->maxWeek, $result->data[0]->minWeek);
             foreach ($range as $week) {
                 $output[$week] = $week;
             }
         } else {
             $output = $result->data;
         }
     }
     return $output;
 }