setName() public method

Set the name of the country.
public setName ( string $p_value ) : boolean
$p_value string
return boolean
コード例 #1
0
 public static function construct($array)
 {
     $obj = new Country();
     $obj->setName($array['name']);
     $obj->setCode($array['code']);
     $obj->setStates($array['states']);
     return $obj;
 }
コード例 #2
0
ファイル: Country.php プロジェクト: piiskop/pstk
 /**
  * 
  * @return multitype:Country creates an array of all the data a country has.
  */
 public static function getCountries()
 {
     $countries = array();
     $country = new Country();
     $country->setId(1);
     $country->setName('America');
     $countries[$country->getId()] = $country;
     $country2 = new Country();
     $country2->setId(2);
     $country2->setname('Germany');
     $countries[$country2->getId()] = $country2;
     return $countries;
 }
コード例 #3
0
 public function buildMerchants($xml)
 {
     $merchants = new Merchants();
     $merchants->setPageOffset((string) $xml->PageOffset);
     $merchants->setTotalCount((string) $xml->TotalCount);
     // merchant
     $merchantArray = array();
     foreach ($xml->Merchant as $merchant) {
         $tmpMerchant = new Merchant();
         $tmpMerchant->setId((string) $merchant->Id);
         $tmpMerchant->setName((string) $merchant->Name);
         $tmpMerchant->setWebsiteUrl((string) $merchant->WebsiteUrl);
         $tmpMerchant->setPhoneNumber((string) $merchant->PhoneNumber);
         $tmpMerchant->setCategory((string) $merchant->Category);
         $tmpLocation = new Location();
         $location = $merchant->Location;
         $tmpLocation->setName((string) $location->Name);
         $tmpLocation->setDistance((string) $location->Distance);
         $tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
         $tmpAddress = new Address();
         $address = $location->Address;
         $tmpAddress->setLine1((string) $address->Line1);
         $tmpAddress->setLine2((string) $address->Line2);
         $tmpAddress->setCity((string) $address->City);
         $tmpAddress->setPostalCode((string) $address->PostCode);
         $tmpCountry = new Country();
         $tmpCountry->setName((string) $address->Country->Name);
         $tmpCountry->setCode((string) $address->Country->Code);
         $tmpCountrySubdivision = new CountrySubdivision();
         $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
         $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
         $tmpAddress->setCountry($tmpCountry);
         $tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
         $tmpPoint = new Point();
         $point = $location->Point;
         $tmpPoint->setLatitude((string) $point->Latitude);
         $tmpPoint->setLongitude((string) $point->Longitude);
         // ACCEPTANCE FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES>
         //$tmpAcceptance = new Acceptance();
         //$acceptance = $merchant->Acceptance;
         // FEATURES FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES>
         //$tmpFeatures = new Features();
         //$features =  $merchant->Features;
         $tmpLocation->setPoint($tmpPoint);
         $tmpLocation->setAddress($tmpAddress);
         $tmpMerchant->setLocation($tmpLocation);
         array_push($merchantArray, $tmpMerchant);
     }
     $merchants->setMerchant($merchantArray);
     return $merchants;
 }
コード例 #4
0
 private function buildCountries($xml)
 {
     $countries = new Countries();
     $countryArray = array();
     foreach ($xml->Country as $country) {
         $tmpCountry = new Country();
         $tmpCountry->setCode((string) $country->Code);
         $tmpCountry->setGeoCoding((string) $country->Geocoding);
         $tmpCountry->setName((string) $country->Name);
         array_push($countryArray, $tmpCountry);
     }
     $countries->setCountry($countryArray);
     return $countries;
 }
コード例 #5
0
 public function buildAtms($xml)
 {
     $atms = new Atms();
     $atms->setPageOffset($xml->PageOffset);
     $atms->setTotalCount($xml->TotalCount);
     $atmArray = array();
     foreach ($xml->Atm as $atm) {
         $tmpAtm = new Atm();
         $tmpAtm->setHandicapAccessible((string) $atm->HandicapAccessible);
         $tmpAtm->setCamera((string) $atm->Camera);
         $tmpAtm->setAvailability((string) $atm->Availability);
         $tmpAtm->setAccessFees((string) $atm->AccessFees);
         $tmpAtm->setOwner((string) $atm->Owner);
         $tmpAtm->setSharedDeposit((string) $atm->SharedDeposit);
         $tmpAtm->setSurchargeFreeAlliance((string) $atm->SurchargeFreeAlliance);
         $tmpAtm->setSponsor((string) $atm->Sponsor);
         $tmpAtm->setSupportEMV((string) $atm->SupportEMV);
         $tmpAtm->setSurchargeFreeAllianceNetwork((string) $atm->SurchargeFreeAllianceNetwork);
         $tmpLocation = new Location();
         $location = $atm->Location;
         $tmpLocation->setName((string) $location->Name);
         $tmpLocation->setDistance((string) $location->Distance);
         $tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
         $tmpAddress = new Address();
         $address = $location->Address;
         $tmpAddress->setLine1((string) $address->Line1);
         $tmpAddress->setLine2((string) $address->Line2);
         $tmpAddress->setCity((string) $address->City);
         $tmpAddress->setPostalCode((string) $address->PostCode);
         $tmpCountry = new Country();
         $tmpCountry->setName((string) $address->Country->Name);
         $tmpCountry->setCode((string) $address->Country->Code);
         $tmpCountrySubdivision = new CountrySubdivision();
         $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
         $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
         $tmpAddress->setCountry($tmpCountry);
         $tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
         $tmpPoint = new Point();
         $point = $location->Point;
         $tmpPoint->setLatitude((string) $point->Latitude);
         $tmpPoint->setLongitude((string) $point->Longitude);
         $tmpLocation->setPoint($tmpPoint);
         $tmpLocation->setAddress($tmpAddress);
         $tmpAtm->setLocation($tmpLocation);
         array_push($atmArray, $tmpAtm);
     }
     $atms->setAtm($atmArray);
     return $atms;
 }
コード例 #6
0
 /**
  * Return an associated array of countries to be used for the suggestion tool.
  * @global type $db
  * @param type $term
  * @return array - associated array;
  */
 public function suggestCountries($term)
 {
     global $db;
     $query = "SELECT code, name, ISO_Alpha2 FROM countries WHERE name LIKE '" . strip_tags($term) . "%' ORDER BY name LIMIT 10";
     //echo($query);
     // make query
     $result = $db->getall($query);
     // initialize arrays.
     $countries = array();
     foreach ($result as $r) {
         $country = new Country($r["code"]);
         $country->setName(trim($r["name"]));
         $country->setIso2(trim($r["ISO_Alpha2"]));
         array_push($countries, $country);
     }
     return $countries;
 }
コード例 #7
0
 public function buildAtms($xml)
 {
     $pageOffset = (string) $xml->PageOffset;
     $totalCount = (string) $xml->TotalCount;
     $restaurantArray = array();
     foreach ($xml->Restaurant as $restaurant) {
         $tmpRestaurant = new Restaurant();
         $tmpRestaurant->setId((string) $restaurant->Id);
         $tmpRestaurant->setName((string) $restaurant->Name);
         $tmpRestaurant->setWebsiteUrl((string) $restaurant->WebsiteUrl);
         $tmpRestaurant->setPhoneNumber((string) $restaurant->PhoneNumber);
         $tmpRestaurant->setCategory((string) $restaurant->Category);
         $tmpRestaurant->setLocalFavoriteInd((string) $restaurant->LocalFavoriteInd);
         $tmpRestaurant->setHiddenGemInd((string) $restaurant->HiddenGemInd);
         $tmpLocation = new Location();
         $location = $restaurant->Location;
         $tmpLocation->setName((string) $location->Name);
         $tmpLocation->setDistance((string) $location->Distance);
         $tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
         $tmpAddress = new Address();
         $address = $location->Address;
         $tmpAddress->setLine1((string) $address->Line1);
         $tmpAddress->setLine2((string) $address->Line2);
         $tmpAddress->setCity((string) $address->City);
         $tmpAddress->setPostalCode((string) $address->PostCode);
         $tmpCountry = new Country();
         $tmpCountry->setName((string) $address->Country->Name);
         $tmpCountry->setCode((string) $address->Country->Code);
         $tmpCountrySubdivision = new CountrySubdivision();
         $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
         $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
         $tmpAddress->setCountry($tmpCountry);
         $tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
         $tmpPoint = new Point();
         $point = $location->Point;
         $tmpPoint->setLatitude((string) $point->Latitude);
         $tmpPoint->setLongitude((string) $point->Longitude);
         $tmpLocation->setPoint($tmpPoint);
         $tmpLocation->setAddress($tmpAddress);
         $tmpRestaurant->setLocation($tmpLocation);
         array_push($restaurantArray, $tmpRestaurant);
     }
     $restaurants = new Restaurants($pageOffset, $totalCount, $restaurantArray);
     return $restaurants;
 }
コード例 #8
0
 /**
  * @covers OperationalCountryService::getLocationsMappedToOperationalCountry
  */
 public function testGetLocationsMappedToOperationalCountry_Success()
 {
     $locationList = array();
     $locationList[] = new Location();
     $locationList[] = new Location();
     $locationList[] = new Location();
     $sriLanka = new Country();
     $sriLanka->setName('Sri Lanka');
     $operationalCountry = new OperationalCountry();
     $operationalCountry->setId(1);
     $operationalCountry->setCountry($sriLanka);
     $operationalCountry->setCountryCode('LK');
     $operationalCountryDaoMock = $this->getMock('OperationalCountryDao', array('getLocationsMappedToOperationalCountry'));
     $operationalCountryDaoMock->expects($this->once())->method('getLocationsMappedToOperationalCountry')->will($this->returnValue($locationList));
     $result = $this->service->setOperationalCountryDao($operationalCountryDaoMock);
     $result = $this->service->getLocationsMappedToOperationalCountry($operationalCountry);
     $this->assertEquals($locationList, $result);
 }
コード例 #9
0
 public function buildMerchantIds($xml)
 {
     $merchantArray = array();
     foreach ($xml->ReturnedMerchants->Merchant as $merchant) {
         $xmlAddress = $merchant->Address;
         $xmlCountrySubdivision = $merchant->Address->CountrySubdivision;
         $xmlCountry = $merchant->Address->Country;
         $xmlMerchant = $merchant;
         $address = new Address();
         $address->setLine1((string) $xmlAddress->Line1);
         $address->setLine2((string) $xmlAddress->Line2);
         $address->setCity((string) $xmlAddress->City);
         $address->setPostalCode((string) $xmlAddress->PostalCode);
         $countrySubdivision = new CountrySubdivision();
         $countrySubdivision->setCode((string) $xmlCountrySubdivision->Code);
         $countrySubdivision->setName((string) $xmlCountrySubdivision->Name);
         $country = new Country();
         $country->setCode((string) $xmlCountry->Code);
         $country->setName((string) $xmlCountry->Name);
         $address->setCountrySubdivision($countrySubdivision);
         $address->setCountry($country);
         $tmpMerchant = new Merchant();
         $tmpMerchant->setAddress($address);
         $tmpMerchant->setPhoneNumber((string) $xmlMerchant->PhoneNumber);
         $tmpMerchant->setBrandName((string) $xmlMerchant->BrandName);
         $tmpMerchant->setMerchantCategory((string) $xmlMerchant->MerchantCategory);
         $tmpMerchant->setMerchantDbaName((string) $xmlMerchant->MerchantDbaName);
         $tmpMerchant->setDescriptorText((string) $xmlMerchant->DescriptorText);
         $tmpMerchant->setLegalCorporateName((string) $xmlMerchant->LegalCorporateName);
         $tmpMerchant->setBrickCount((string) $xmlMerchant->BrickCount);
         $tmpMerchant->setComment((string) $xmlMerchant->Comment);
         $tmpMerchant->setLocationId((string) $xmlMerchant->LocationId);
         $tmpMerchant->setOnlineCount((string) $xmlMerchant->OnlineCount);
         $tmpMerchant->setOtherCount((string) $xmlMerchant->OtherCount);
         $tmpMerchant->setSoleProprietorName((string) $xmlMerchant->SoleProprietorName);
         array_push($merchantArray, $tmpMerchant);
     }
     $returnedMerchants = new ReturnedMerchants();
     $returnedMerchants->setMerchant($merchantArray);
     $merchantIds = new MerchantIds();
     $merchantIds->setReturnedMerchants($returnedMerchants);
     $merchantIds->setMessage($xml->Message);
     return $merchantIds;
 }
コード例 #10
0
 protected function getCountries()
 {
     $xe = $this->web->get(sfConfig::get('app_source_countries'), null, array('Cache-Control' => 'no-cache'));
     $doc = new DOMDocument();
     // It's rare you'll have valid XHTML, suppress any errors- it'll do its best.
     @$doc->loadhtml($xe->getResponseText());
     $xpath = new DOMXPath($doc);
     foreach ($xpath->query('/html/body//form//select[@name="From"]')->item(0)->getElementsByTagName('option') as $option) {
         $currency = Doctrine::getTable('Currency')->findOneByCode($option->getAttribute('value'));
         $name = substr($option->textContent, 0, strpos($option->textContent, ','));
         if ($currency instanceof Currency && !empty($name)) {
             $country = Doctrine::getTable('Country')->findOneByName($name);
             if (!$country instanceof Country) {
                 $country = new Country();
                 $country->setName($name);
             }
             $country->Currencies[] = $currency;
             $country->save();
         }
     }
 }
コード例 #11
0
 /**
  *
  * @param type $db - ADONewConnection
  * @param type $cropID - Crop ID to search from concepts table.
  * @return array - Array of DistributionType objects representing a geographical distribution.
  */
 public function getDistributionTypes($cropID)
 {
     global $db;
     $query = "SELECT Type FROM distribution WHERE Taxon_ID = " . $cropID . " AND Country IS NOT NULL GROUP BY Type ORDER BY Type ASC";
     $db_regionTypes = $db->getAll($query);
     $distributionTypes = array();
     foreach ($db_regionTypes as $db_regionType) {
         $distributionType = new DistributionType($db_regionType["Type"]);
         // search for Regions, countries and details.
         $query = "SELECT d.ID, c.Code, c.Name, c.Region, c.ISO_Alpha2,\n                        GROUP_CONCAT(dd.Detail SEPARATOR ', ') as Details\n                        FROM distribution d\n                        INNER JOIN countries c ON d.Country = c.Code\n                        LEFT JOIN distribution_detail dd ON d.Detail_ID = dd.ID\n                        WHERE d.Taxon_ID = " . $cropID . "\n                        AND d.Type = '" . $distributionType->getName() . "'\n                        group by c.Code\n                        ORDER BY c.Region, c.Code, dd.Detail";
         $db_regions = $db->getAll($query);
         $regions = array();
         $currentRegion = "";
         // loop regions
         foreach ($db_regions as $db_region) {
             if ($db_region["Region"] != $currentRegion) {
                 // Add last region. The variable $region must have been created before.
                 $currentRegion != "" ? array_push($regions, $region) : false;
                 $currentRegion = $db_region["Region"];
                 $region = new Region($currentRegion);
             }
             // create a country for the current region.
             $country = new Country($db_region["Code"]);
             $country->setName(trim($db_region["Name"]));
             $country->setIso2(trim($db_region["ISO_Alpha2"]));
             if (!empty($db_region["Details"])) {
                 // details are separated by commas, taked directly from the database.
                 $country->setDetails($db_region["Details"]);
             }
             $countries = $region->getCountries();
             array_push($countries, $country);
             $region->setCountries($countries);
         }
         array_push($regions, $region);
         $distributionType->setRegions($regions);
         // insert region type object to the array.
         array_push($distributionTypes, $distributionType);
     }
     return $distributionTypes;
 }
コード例 #12
0
 /**
  * @dataProvider getNames
  */
 public function testToString($in, $out)
 {
     $this->assertSame($this->entity, $this->entity->setName($in));
     $this->assertSame($out, $this->entity->__toString());
 }
コード例 #13
0
ファイル: AddCountries.php プロジェクト: Tom-Byrne/gocdb
<?php

require_once __DIR__ . "/../bootstrap.php";
require_once __DIR__ . "/AddUtils.php";
/* AddCountries.php: Loads a list of countries from an XML file and inserts them into
 * the doctrine prototype.
 */
$countriesFileName = __DIR__ . "/" . $GLOBALS['dataDir'] . "/Countries.xml";
$countries = simplexml_load_file($countriesFileName);
foreach ($countries as $country) {
    $doctrineCountry = new Country();
    $code = "";
    $name = "";
    foreach ($country as $key => $value) {
        if ($key == "name") {
            $code = (string) $value;
        }
        if ($key == "description") {
            $name = (string) $value;
        }
    }
    $doctrineCountry->setName($name);
    $doctrineCountry->setCode($code);
    $entityManager->persist($doctrineCountry);
}
$entityManager->flush();
コード例 #14
0
ファイル: do_edit.php プロジェクト: sourcefabric/newscoop
    camp_html_display_error($translator->trans('Invalid security token!'));
    exit;
}
if (!$g_user->hasPermission('ManageCountries')) {
    camp_html_display_error($translator->trans("You do not have the right to change country names.", array(), 'country'));
    exit;
}
$f_country_code = Input::Get('f_country_code');
$f_country_language = Input::Get('f_country_language');
$f_country_name = trim(Input::Get('f_country_name'));
$country = new Country($f_country_code, $f_country_language);
$language = new Language($f_country_language);
if (empty($f_country_name)) {
    $errorMsgs[] = $translator->trans("You must fill in the \$1 field.", array('$1' => "<B>" . $translator->trans("Name") . "</B>"));
} else {
    if ($country->setName($f_country_name)) {
        camp_html_goto_page("/{$ADMIN}/country/index.php");
    } else {
        $errorMsgs[] = $translator->trans('The country name $1 could not be changed', array('$1' => '<B>' . htmlspecialchars($country->getName()) . '</B>'), 'country');
    }
}
$crumbs = array();
$crumbs[] = array($translator->trans("Configure"), "");
$crumbs[] = array($translator->trans("Countries"), "/{$ADMIN}/country/");
$crumbs[] = array($translator->trans("Changing country name", array(), 'country'), "");
echo camp_html_breadcrumbs($crumbs);
?>

<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
コード例 #15
0
ファイル: CountryTest.php プロジェクト: delboy1978uk/country
 public function testGetSetName()
 {
     $this->country->setName('GREAT BRITAIN');
     $this->assertEquals('GREAT BRITAIN', $this->country->getName());
 }
コード例 #16
0
 /**
  * @covers OperationalCountryService::getOperationalCountriesForLocations
  */
 public function testGetOperationalCountriesForLocations_Success()
 {
     $locationIdList = array(1, 3, 4, 5);
     $sriLanka = new Country();
     $sriLanka->setName('Sri Lanka');
     $operationalCountryList = array();
     $operationalCountryList[] = new OperationalCountry();
     $operationalCountryList[] = new OperationalCountry();
     $operationalCountryList[] = new OperationalCountry();
     $operationalCountryDaoMock = $this->getMock('OperationalCountryDao', array('getOperationalCountriesForLocations'));
     $operationalCountryDaoMock->expects($this->once())->method('getOperationalCountriesForLocations')->with($locationIdList)->will($this->returnValue($operationalCountryList));
     $this->service->setOperationalCountryDao($operationalCountryDaoMock);
     $result = $this->service->getOperationalCountriesForLocations($locationIdList);
     $this->assertEquals($operationalCountryList, $result);
 }
コード例 #17
0
ファイル: country_create.php プロジェクト: jeffreycai/ct21
    }
    // validation for $banner_image
    $banner_image = isset($_POST["banner_image"]) ? strip_tags(trim($_POST["banner_image"])) : null;
    if (empty($banner_image)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "banner_image is required.", "zh" => "请填写banner_image"))));
        $error_flag = true;
    }
    // validation for $content
    $content = isset($_POST["content"]) ? $_POST["content"] : null;
    if (empty($content)) {
        Message::register(new Message(Message::DANGER, i18n(array("en" => "content is required.", "zh" => "请填写content"))));
        $error_flag = true;
    }
    /// proceed submission
    // proceed for $name
    $object->setName($name);
    // proceed for $image
    $object->setImage($image);
    // proceed for $banner_image
    $object->setBannerImage($banner_image);
    // proceed for $content
    $object->setContent($content);
    if ($error_flag == false) {
        if ($object->save()) {
            Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Record saved", "zh" => "记录保存成功"))));
            HTML::forwardBackToReferer();
        } else {
            Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败"))));
        }
    }
}
コード例 #18
0
ファイル: fixture.php プロジェクト: jeffreycai/ct21
Technological academies with professional courses are also called “Special Schools”. These schools belong to higher educational institutions that teach occupational skills and technology that are....
Technical secondary schools
With an aim to foster the necessary vocational abilities, technical secondary schools focus on the 5-year education of junior high school graduates (courses in relation to trader require an additional 6...</p>
');
    $country->save();
    $country = new Country();
    $country->setName('USA');
    $country->setImage('modules/site/assets/images/usa.jpg');
    $country->setBannerImage('modules/site/assets/images/usa_banner.jpg');
    $country->setContent('
<h2>Introduction to Educational System of the USA</h2>
<p>Postsecondary education institutions in the United States generally are ofthree broad types, each of which includes both public and private institutions: (1)two-year colleges, usually called community, junior, or technical colleges; (2) fouryearcolleges, which usually offer either four years of general undergraduate education (liberal arts) or a combination of general and preprofessional education; and (3) comprehensive universities, which offer both undergraduate and graduate education as well as professional degrees. Institutional titles can be confusing, however, because states have different regulations and traditions. For example, many institutions called "universities" do not offer degrees beyond the master\'s degree; some offer no degrees beyond the bachelor\'s degree. Some "colleges" offer doctorates. A few prestigious comprehensive research universities in the country are known as "institutes" (for example, California Institute of Technology and Massachusetts Institute of Technology). In addition, there are institutions called colleges, institutes, or universities that are not accredited but that offer degrees and certificates.</p>
');
    $country->save();
    $country = new Country();
    $country->setName('China');
    $country->setImage('modules/site/assets/images/china.jpg');
    $country->setBannerImage('modules/site/assets/images/china_banner.jpg');
    $country->setContent('
<h2>An Introduction to China</h2>
<p>China is staggeringly vast and a land of great diversity.It is the world\'s most populous nation and the third largest country, almost a continent in itself.
</p>
<p>
Stretching from its southern borders in the Himalayas to the deserts of Mongolia in the north, and from the East China Sea through the Yangzi River Valley plains, to the Tibetan Plateau in the western mainland, China covers an area of 9.6 million square kilometers or 3.7 million square miles...</p>
<p>
China encompasses over 5000 islands and comprises five autonomous regions and twenty-two provinces, as well as Hong Kong and Macau, which are now known as “Special Administrative Regions”.The seat of government is Beijing, an enormous city of 11 million people.In Beijing, like all of China\'s urban metropolises, life contrasts immensely with that of the peasant farmers in rural areas.Because of its size, China\'s climate is very diverse, ranging from an unbearable 48oC in the northwest summer to a freezing cold minus 40oC in the winter in the far north.
</p>
<p>
The official language in China is Mandarin, as spoken in Beijing, but there are also many different dialects to listen for.Chinese food, and much of the ingredients used to create it, is like no other cuisine, and again this differs greatly between regions.Art in China is also stunningly unique, perhaps best typified by its calligraphy, created with ink and brush and held in extremely high esteem by the Chinese.
</p>
<h2>Education System of China</h2>