public function setCountryCode($countryCode) { $this->countryCode = $countryCode; if (!$countryCode) { return; } if (is_numeric($this->countryCode)) { $this->countryName = Model_Registry::getRegionNameFromCode($this->countryCode); } else { $this->countryName = Model_Registry::getCountryNameFromCode($this->countryCode); } }
/** * * Generate json input to feed to the registry. */ protected function _prepareRegistryInputJson() { $identity = Zend_Auth::getInstance()->getIdentity(); $filename = explode('.', $this->file); $title = $this->publisher_name ? $this->publisher_name . ' Activity File' : 'Activity File ' . $filename[0]; if ($this->country_code && $this->publisher_name) { if (is_numeric($this->country_code)) { $countryName = Model_Registry::getRegionNameFromCode($this->country_code); } else { $countryName = Model_Registry::getCountryNameFromCode($this->country_code); } if ($countryName) { $title .= " for " . $countryName; } } $data = array("name" => $filename[0], "title" => $title, "author_email" => $identity->email, "resources" => array(array("url" => $this->file_url, "format" => "IATI-XML")), "extras" => array("filetype" => "activity", "country" => $this->country_code, "activity_period-from" => '', "activity_period-to" => '', "data_updated" => date('Y-m-d', strtotime($this->activity_updated_datetime)), "record_updated" => date('Y-m-d'), "activity_count" => $this->activity_count, "verified" => "no", "language" => "en"), "groups" => array($this->publisher_id)); $jsonData = json_encode($data); $this->json_data = $jsonData; }