id = $id; $this->is_label_copy = $is_label_copy; $this->setAllCountryDates($wrapperObj); } /** * Sets all country release dates, sales start dates and preorder dates for the specified catalog or label copy item * * @return unknown_type */ private function setAllCountryDates($wrapperObj) { if ($this->is_label_copy) { $sql = 'SELECT country_id, release_date, sale_start_date, vod_start_date, preorder_date FROM release_country_dates WHERE release_id = ?'; } else { $sql = 'SELECT country_id, release_date, sale_start_date, vod_start_date, preorder_date FROM release_country_dates WHERE upc = ?'; } $dataParams = new QueryData(); $dataParams->addDataParam('i', $this->id); $rs = $wrapperObj->executeQuery($sql, $dataParams); if ($rs === false) { showierror($sql); } $result = array(); foreach ($rs as $row) { $result[$row['country_id']]['release_date'] = $row['release_date']; $result[$row['country_id']]['sale_start_date'] = $row['sale_start_date']; $result[$row['country_id']]['vod_start_date'] = $row['vod_start_date']; $result[$row['country_id']]['preorder_date'] = $row['preorder_date']; } $this->all_country_dates = $result; } /** * Gets all country release dates, sales start dates and preorder dates for the specified catalog or label copy item * * @return array */ public function getAllCountryDates() { return $this->all_country_dates; } /** * Gets country release dates for the specified country * * @param int $country_id * @return string|null */ public function getCountryReleaseDate($country_id) { if (isset($this->all_country_dates[$country_id]['release_date'])) { return $this->all_country_dates[$country_id]['release_date']; } else { return; } } /** * Gets country sale start dates for the specified country * * @param int $country_id * @return string|null */ public function getCountrySaleStartDate($country_id) { if (isset($this->all_country_dates[$country_id]['sale_start_date'])) { return $this->all_country_dates[$country_id]['sale_start_date']; } else { return; } } /** * Gets country VOD start dates for the specified country * * @param int $country_id * @return string|null */ public function getCountryVodStartDate($country_id) { if (isset($this->all_country_dates[$country_id]['vod_start_date'])) { return $this->all_country_dates[$country_id]['vod_start_date']; } else { return; } } /** * Gets country pre-order dates for the specified country * * @param int $country_id * @return string|null */ public function getCountryPreorderDate($country_id) { if (isset($this->all_country_dates[$country_id]['preorder_date'])) { return $this->all_country_dates[$country_id]['preorder_date']; } else { return; } } /** * Gets all country Ids which exist in release country date table * * @return array */ public function getExistingCountries() { return array_keys($this->all_country_dates); } }