public function testTranslate() { $c = new Country(); $c->setDataSourceDir(SOURCE_DIR); $c->setLang('en'); $this->assertEquals('Sweden', $c->translate('se')); }
private function manageArmy(Army $army, Country $country) { if ($country->isFree()) { return; } $army->increaseSize(); }
public function createCountry($name) { $tmp = new Country(); $tmp->name = $name; $tmp->save(); return $tmp; }
/** * For listing the Country * @author Praveen Singh * @method getCountry * @param $module_id,$group_id * @return one row of Module Role table * @since version 0.0.1 * @version 0.2.9 */ function getCountry($cntId) { App::import("Model", "Country"); $model = new Country(); $datas = $model->find("first", array('conditions' => array('Country.id' => $cntId))); return $datas; }
public function actionModel() { $country = new Country(); // $validate = $country->getValidators(); $meta = $country->getMetaData(); var_dump($meta); }
public static function factory(Storage $storage, $row) { $country = new Country($storage); $country->setCountryID($row["countryid"]); $country->setLabel($row["label"]); return $country; }
public function CityList($cuntry_id) { $h = new Country(); echo json_encode($h->CityList($cuntry_id)); // or render View return TRUE; }
public function get() { $uid = (int) $_REQUEST['uid']; if ($uid == 0) { $uid = $this->user->id; } $user = new User(); $user->get($uid); $userData = $user->getRaw(); //region data $region = new Region(); $regionData = $region->getRaw($userData['region']); $userData['region'] = array('id' => $regionData['id'], 'name' => $regionData['name']); //counrry data $country = new Country(); $countryData = $country->getRaw($userData['country']); $userData['country'] = array('id' => $countryData['id'], 'name' => $countryData['name']); // myself if ($uid == $this->user->id) { $currencyQuantity = $user->getCurrency($userData['currency']); $userData['currencyName'] = $userData['currency']; $userData['currency'] = $currencyQuantity; } else { unset($userData['gold']); unset($userData['currency']); } unset($userData['password']); return $userData; }
public static function construct($array) { $obj = new Country(); $obj->setName($array['name']); $obj->setCode($array['code']); $obj->setStates($array['states']); return $obj; }
public function testAddContact() { $person = $this->getMock('JLM\\ModelBundle\\Entity\\SiteContact'); $this->assertTrue($this->entity->addContact($person)); $this->assertCount(1, $this->entity->getContacts()); $this->assertTrue($this->entity->removeContact($person)); $this->assertCount(0, $this->entity->getContacts()); }
public function testCountry() { $country = new Country('au'); $this->assertEquals('AU', $country->getCountryCode()); $country = new Country('AU'); $this->assertEquals('AU', $country->getCountryCode()); $this->assertEquals('Australia', $country->getCountryName()); }
public function actionAdmin() { $model = new Country('search'); $model->unsetAttributes(); if (isset($_GET['Country'])) { $model->setAttributes($_GET['Country']); } $this->render('admin', array('model' => $model)); }
public function actionAdmin() { $this->getMaxSorter(); $this->getMinSorter(); $this->rememberPage(); $model = new Country('search'); $model->setRememberScenario('country_remember'); $this->render('admin', array_merge(array('model' => $model), $this->params)); }
function get($Code) { $parametros = array(); $parametros['Code'] = $Code; $this->bd->select($this->tabla, '*', "Code=:Code", $parametros); $fila = $this->bd->getRow(); $country = new Country(); $country->set($fila); return $country; }
public function postCountry() { $posted = Input::get(); $country = new Country(); $country->country_name = $posted['country_name']; $country->category_id = $posted['category_id']; $country->category_name = $posted['category_name']; $country->save(); return Redirect::back()->with('success', 'Country has been created'); }
function all() { $this->is_loggedin(); $this->title = "Countries"; $this->message = "BeBuntu Countries"; $all_countries = new Country(); pass_var('all_countries', $all_countries->find_all()); pass_var('title', $this->title); pass_var('message', $this->message); }
function getList() { $this->bd->select($this->tabla, "*", "1=1", array(), "Name, Continent, Code"); $r = array(); while ($fila = $this->bd->getRow()) { $country = new Country(); $country->set($fila); $r[] = $country; } return $r; }
function testGetCountryList() { $result = $this->Country->getCountryList(array('AU', 'US')); $expectedTop2 = array('AU' => 'Australia', 'US' => 'United States'); // Fetch top 2 items $top2 = array(); $top2[key($result)] = current($result); next($result); $top2[key($result)] = current($result); $this->assertEqual($expectedTop2, $top2); }
/** * Returns the name of the country of the registered user. * * @return string */ protected function getCountry() { $countryCode = $this->m_dbObject->getProperty('CountryCode'); $smartyObj = CampTemplate::singleton(); $contextObj = $smartyObj->get_template_vars('gimme'); $country = new Country($countryCode, $contextObj->language->number); if (!$country->exists()) { return null; } return $country->getName(); }
public function getCountiesByGivenCountry($country_id) { $countryObj = new Country(); $country = $countryObj->findById($country_id); $data = $country->topTerritories; $ret = array(); foreach ($data as $territory) { $ret[$territory->county] = $territory->name; } return $ret; }
public function delete($id = null) { if ($this->perm->can_delete == 'y') { if ($id) { $data = new Country($id); $action = 'DELETE'; save_logs($this->menu_id, $action, $data->id, $action . ' ' . $data->country_name . ' Country'); $data->delete(); } } redirect("admin/" . $this->modules_name); }
public function Delete() { global $obj, $model, $param1; include_once 'Model/country.php'; $model = new Country(); $model->Id = $param1; if ($model->Delete()) { print '<span class="success">Country Updated</span>'; } else { print '<span class="error">' . $model->Error . '</span>'; } include_once 'View/Country/index.php'; }
/** * * @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; }
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; }
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; }
function testGetCountryByHost() { $hu = new Country("HU"); $this->assertEquals(array("hu" => "Magyarország"), $hu->getNativeName()); $this->assertEquals(array("hu" => "Magyarország"), $hu->getNativeShortName()); $this->assertEquals(array("hu" => "Magyarország"), $hu->getNativeOfficialName()); $this->assertEquals("Hungary (Magyarország)", $hu->getDisplayName("en")); $this->assertEquals("Europe/Budapest", $hu->getMainTimezone()); $this->assertEquals(true, $hu->isEUMember()); $hu = new Country("PT"); $this->assertEquals(array("pt" => "Portugal"), $hu->getNativeName()); $this->assertEquals(array("pt" => "Portugal"), $hu->getNativeShortName()); $this->assertEquals(array("pt" => "República Portuguesa"), $hu->getNativeOfficialName()); $this->assertEquals("Portugal", $hu->getDisplayName("en")); $this->assertEquals("Atlantic/Azores", $hu->getMainTimezone()); $this->assertEquals(true, $hu->isEUMember()); $countries = $hu->getAllCountries(); foreach ($countries as $country) { $this->assertNotNull($country->getShortNameByLocale('hu')); $this->assertNotNull($country->getShortNameByLocale('en')); $this->assertNotNull($country->getNativeShortName()); } foreach ($this->countries as $countryCode) { $this->assertTrue(array_key_exists($countryCode, $countries), $countryCode . ' not found'); } }
public static function check($_cpt, $_shrt) { $country = Country::model()->find('short=:shrt', array(':shrt' => $_shrt)); if ($country !== null) { return $country->getPrimaryKey(); } $country = new Country(); $country->attributes = array('caption' => $_cpt, 'short' => $_shrt); if ($country->save()) { return $country->getPrimaryKey(); } return 1; //false; }
/** * Load your component. * * @param \Cx\Core\ContentManager\Model\Entity\Page $page The resolved page */ public function load(\Cx\Core\ContentManager\Model\Entity\Page $page) { global $_CORELANG, $subMenuTitle; $subMenuTitle = $_CORELANG['TXT_CORE_COUNTRY']; // TODO: Move this define() somewhere else, allocate the IDs properly define('PERMISSION_COUNTRY_VIEW', 145); define('PERMISSION_COUNTRY_EDIT', 146); $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html'); $cachedRoot = $this->cx->getTemplate()->getRoot(); \Permission::checkAccess(PERMISSION_COUNTRY_VIEW, 'static'); $objCountry = new Country(); $objCountry->getPage(); $this->cx->getTemplate()->setRoot($cachedRoot); }
/** * Add Country check */ public function add_check() { $validator = Validator::make(Input::all(), Country::$rulesAdd); if (!$validator->fails()) { $country = new Country(Input::all()); if ($country->save()) { return Redirect::route('country_list', $country->id)->with('mSuccess', 'Le pays a bien été modifié'); } else { return Redirect::route('country_add')->with('mError', 'Impossible de créer ce pays')->withInput(); } } else { return Redirect::route('country_add')->with('mError', 'Il y a des erreurs')->withErrors($validator->messages())->withInput(); } }
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; }