/** * Returns an array with data indexed by name. * * @return array */ public function toArray() { $adminLevels = []; foreach ($this->adminLevels as $adminLevel) { $adminLevels[$adminLevel->getLevel()] = ['name' => $adminLevel->getName(), 'code' => $adminLevel->getCode()]; } return array('latitude' => $this->getLatitude(), 'longitude' => $this->getLongitude(), 'bounds' => $this->bounds->toArray(), 'kind' => $this->kind, 'streetNumber' => $this->streetNumber, 'streetName' => $this->streetName, 'postalCode' => $this->postalCode, 'locality' => $this->locality, 'subLocality' => $this->subLocality, 'adminLevels' => $adminLevels, 'country' => $this->country->getName(), 'countryCode' => $this->country->getCode(), 'timezone' => $this->timezone); }
/** * 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(); }
</TD> </TR> <TR> <TD ALIGN="RIGHT" valign="top"><?php putGS("Country"); ?>:</TD> <TD> <?php $names = array(); foreach ($countryTranslations as $translation) { $names[] = htmlspecialchars($translation->getName()); } echo implode(", ", $names); ?> <TR> <TD ALIGN="RIGHT" ><?php putGS("Name"); ?>:</TD> <TD> <INPUT TYPE="TEXT" class="input_text" NAME="f_country_name" SIZE="32" VALUE="<?php p(htmlspecialchars($country->getName())); ?>"> </TD> </TR> <TR> <TD COLSPAN="2"> <DIV ALIGN="CENTER"> <INPUT TYPE="HIDDEN" NAME="f_country_code" VALUE="<?php print $country->getCode(); ?>"> <INPUT TYPE="HIDDEN" NAME="f_country_language" VALUE="<?php print $country->getLanguageId(); ?>"> <INPUT TYPE="submit" class="button" NAME="OK" VALUE="<?php putGS('Save'); ?>"> <!--<INPUT TYPE="button" class="button" NAME="Cancel" VALUE="<?php putGS('Cancel'); ?>" ONCLICK="location.href='/admin/country/'">--> </DIV> </TD> </TR> </TABLE> </FORM> <P>
$correct = false; $errorMsgs[] = getGS("You must fill in the $1 field.", "<B>".getGS("Name")."</B>"); } if (!$language->exists()) { $correct = false; $errorMsgs[] = getGS('You must select a language.'); } if ($correct) { $newCountry = new Country($f_country_code, $f_country_new_language); $created = $newCountry->create(array('Name' => $f_country_name)); if ($created) { camp_html_goto_page("/$ADMIN/country/"); } else { $errorMsgs[] = getGS('The country name $1 could not be translated','<B>'.$country->getName().'</B>'); } } $crumbs = array(); $crumbs[] = array(getGS("Configure"), ""); $crumbs[] = array(getGS("Countries"), "/$ADMIN/country/"); $crumbs[] = array(getGS("Adding new translation"), ""); echo camp_html_breadcrumbs($crumbs); ?> <P> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box"> <TR> <TD COLSPAN="2"> <B> <?php putGS("Adding new translation"); ?> </B>
public function testGetSetName() { $this->country->setName('GREAT BRITAIN'); $this->assertEquals('GREAT BRITAIN', $this->country->getName()); }
> <TD> <A HREF="/<?php p($ADMIN); ?> /pub/editdeftime.php?Pub=<?php p($Pub); ?> &CountryCode=<?php p($time->getCountryCode()); ?> &Language=<?php p($Language); ?> "><?php p(htmlspecialchars($country->getName())); ?> (<?php p(htmlspecialchars($country->getCode())); ?> )</A> </TD> <TD ALIGN="center"> <?php p(htmlspecialchars($time->getTrialTime())); ?> </TD> <TD ALIGN="center"> <?php p(htmlspecialchars($time->getPaidTime())); ?>
<TD ALIGN="LEFT" VALIGN="TOP" rowspan="2"><B><?php putGS("Country<BR><SMALL>(click to edit)</SMALL>"); ?></B></TD> <td colspan="2"><?php putGS('Default time period'); ?> (<?php p($pubTimeUnit->getName()); ?>):</td> <TD ALIGN="LEFT" VALIGN="TOP" rowspan="2"><B><?php putGS("Delete"); ?></B></TD> </TR> <tr class="table_list_header"> <TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php putGS("trial subscription"); ?></B></TD> <TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php putGS("paid subscription"); ?></B></TD> </tr> <?php $color = 0; foreach ($defaultTimes as $time) { $country = new Country($time->getCountryCode(), $Language); ?> <TR <?php if ($color) { $color=0; ?>class="list_row_even"<?php } else { $color=1; ?>class="list_row_odd"<?php } ?>> <TD> <A HREF="/<?php p($ADMIN); ?>/pub/editdeftime.php?Pub=<?php p($Pub); ?>&CountryCode=<?php p($time->getCountryCode()); ?>&Language=<?php p($Language); ?>"><?php p(htmlspecialchars($country->getName())); ?> (<?php p(htmlspecialchars($country->getCode())); ?>)</A> </TD> <TD ALIGN="center"> <?php p(htmlspecialchars($time->getTrialTime())); ?> </TD> <TD ALIGN="center"> <?php p(htmlspecialchars($time->getPaidTime())); ?> </TD> <TD ALIGN="CENTER"> <A HREF="/<?php p($ADMIN); ?>/pub/do_deldeftime.php?Pub=<?php p($Pub); ?>&CountryCode=<?php p($time->getCountryCode()); ?>&Language=<?php p($Language); ?>&<?php echo SecurityToken::URLParameter(); ?>" onclick="return confirm('<?php putGS('Are you sure you want to delete the subscription settings for $1?', """.htmlspecialchars($publicationObj->getName()).':'.htmlspecialchars($time->getCountryCode())."""); ?>');"><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/delete.png" BORDER="0" ALT="<?php putGS('Delete'); ?>" TITLE="<?php putGS('Delete'); ?>" ></A> </TD> </TR> <?php } ?> <TR><TD COLSPAN="2" NOWRAP> </TABLE>
echo camp_html_breadcrumbs($crumbs); ?> <P> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box"> <TR> <TD COLSPAN="2"> <B> <?php putGS("Delete country"); ?> </B> <HR NOSHADE SIZE="1" COLOR="BLACK"> </TD> </TR> <TR> <TD COLSPAN="2"> <BLOCKQUOTE> <LI><?php putGS('The country $1 could not be deleted.' ,'<B>'.htmlspecialchars($country->getName()).'('.htmlspecialchars($language->getNativeName()).')</B>'); ?></LI> </BLOCKQUOTE> </TD> </TR> <TR> <TD COLSPAN="2"> <DIV ALIGN="CENTER"> <INPUT TYPE="button" class="button" NAME="OK" VALUE="<?php putGS('OK'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/country/'"> </DIV> </TD> </TR> </TABLE> <P> <?php camp_html_copyright_notice(); ?>
/** * Get the name of the country of the registered user * * @return string */ protected function getCountry() { require_once dirname(__FILE__) . '/../../classes/Country.php'; require_once dirname(__FILE__) . '/../../classes/Language.php'; $countryCode = $this->m_dbObject->getAttribute('country_code'); $smartyObj = CampTemplate::singleton(); $contextObj = $smartyObj->get_template_vars('gimme'); $country = new Country($countryCode, $contextObj->language->number); return !$country->exists() ? '' : $country->getName(); }
include_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/javascript_common.php"); $crumbs = array(getGS("Subscriptions") => "deftime.php?Pub=$Pub&Language=$Language"); camp_html_content_top(getGS("Change country subscription settings"), array("Pub" => $publicationObj), true, false, $crumbs); ?> <P> <FORM NAME="subscription_settings" METHOD="POST" ACTION="do_editdeftime.php" onsubmit="return <?php camp_html_fvalidate(); ?>;"> <?php echo SecurityToken::FormParameter(); ?> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="box_table"> <INPUT TYPE="HIDDEN" NAME="Pub" VALUE="<?php p($Pub); ?>"> <INPUT TYPE="HIDDEN" NAME="CountryCode" VALUE="<?php p($CountryCode); ?>"> <INPUT TYPE="HIDDEN" NAME="Language" VALUE="<?php p($Language); ?>"> <TR> <TD ALIGN="center" colspan="2"> <b><?php putGS("Country"); ?>: <?php p(htmlspecialchars($country->getName()." (".$country->getCode().")")); ?></b> </TD> </TR> <tr> <td colspan="2" align="left"><?php putGS('Default time periods:'); ?></td> </tr> <TR> <TD ALIGN="RIGHT" >- <?php putGS("trial subscription"); ?>:</TD> <TD> <INPUT TYPE="TEXT" NAME="cTrialTime" VALUE="<?php p($defaultTime->getTrialTime()); ?>" SIZE="5" MAXLENGTH="5" class="input_text" alt="number|0|1|100000" emsg="<?php putGS("You must input a number greater than 0 into the $1 field.", """.getGS("trial subscription")."""); ?>"> <?php p($pubTimeUnit->getName()); ?> </TD> </TR> <TR> <TD ALIGN="RIGHT" >- <?php putGS("paid subscription"); ?>:</TD> <TD>
/** * @dataProvider getNames */ public function testName($in, $out) { $this->assertSame($this->entity, $this->entity->setName($in)); $this->assertSame($out, $this->entity->getName()); }
$created = false; if (empty($f_country_name)) { $correct = false; $errorMsgs[] = $translator->trans("You must fill in the \$1 field.", array('$1' => "<B>" . $translator->trans("Name") . "</B>")); } if (!$language->exists()) { $correct = false; $errorMsgs[] = $translator->trans('You must select a language.'); } if ($correct) { $newCountry = new Country($f_country_code, $f_country_new_language); $created = $newCountry->create(array('Name' => $f_country_name)); if ($created) { camp_html_goto_page("/{$ADMIN}/country/"); } else { $errorMsgs[] = $translator->trans('The country name $1 could not be translated', array('$1' => '<B>' . $country->getName() . '</B>'), 'country'); } } $crumbs = array(); $crumbs[] = array($translator->trans("Configure"), ""); $crumbs[] = array($translator->trans("Countries"), "/{$ADMIN}/country/"); $crumbs[] = array($translator->trans("Adding new translation"), ""); echo camp_html_breadcrumbs($crumbs); ?> <P> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box"> <TR> <TD COLSPAN="2"> <B> <?php echo $translator->trans("Adding new translation"); ?>
<div class="row"> <div class="box col-md-12"> <div class="box-inner"> <div class="box-header well" data-original-title=""> <h2><i class="glyphicon glyphicon-edit"></i>Add/Edit Country</h2> </div> <div class="box-content"> <?php $id = Request::get("id"); if (is_numeric($id) && $id > 0) { $countryObj = new Country(); $countryObj->set("country_id", $id); $result = $countryObj->getName(); if (count($result)) { $row = $result[0]; $country_id = $row['id']; $country_name = $row['name']; $country_status = $row['active']; } } ?> <form action="" method="POST" name="country_frm" id="country_frm"> <table class="table table-striped table-bordered bootstrap-datatable datatable responsive"> <tr> <td><label class="control-label" for="selectError">Country</label></td> <td><div class="input-group" > <span class="input-group-addon"></span> <input type="text" name="country_name" value="<?php
"> <INPUT TYPE="HIDDEN" NAME="CountryCode" VALUE="<?php p($CountryCode); ?> "> <INPUT TYPE="HIDDEN" NAME="Language" VALUE="<?php p($Language); ?> "> <TR> <TD ALIGN="center" colspan="2"> <b><?php putGS("Country"); ?> : <?php p(htmlspecialchars($country->getName() . " (" . $country->getCode() . ")")); ?> </b> </TD> </TR> <tr> <td colspan="2" align="left"><?php putGS('Default time periods:'); ?> </td> </tr> <TR> <TD ALIGN="RIGHT" >- <?php putGS("trial subscription"); ?> :</TD>
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> <TD COLSPAN="2"> <B> <?php echo $translator->trans("Changing country name", array(), 'country');
<P> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box"> <TR> <TD COLSPAN="2"> <B> <?php echo $translator->trans("Delete country", array(), 'country'); ?> </B> <HR NOSHADE SIZE="1" COLOR="BLACK"> </TD> </TR> <TR> <TD COLSPAN="2"> <BLOCKQUOTE> <LI><?php echo $translator->trans('The country $1 could not be deleted.', array('$1' => '<B>' . htmlspecialchars($country->getName()) . '(' . htmlspecialchars($language->getNativeName()) . ')</B>'), 'country'); ?> </LI> </BLOCKQUOTE> </TD> </TR> <TR> <TD COLSPAN="2"> <DIV ALIGN="CENTER"> <INPUT TYPE="button" class="button" NAME="OK" VALUE="<?php echo $translator->trans('OK'); ?> " ONCLICK="location.href='/<?php p($ADMIN); ?> /country/'">
} $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[] = getGS("You must fill in the $1 field.", "<B>".getGS("Name")."</B>"); } else { if ($country->setName($f_country_name)) { camp_html_goto_page("/$ADMIN/country/index.php"); } else { $errorMsgs[] = getGS('The country name $1 could not be changed','<B>'.htmlspecialchars($country->getName()).'</B>'); } } $crumbs = array(); $crumbs[] = array(getGS("Configure"), ""); $crumbs[] = array(getGS("Countries"), "/$ADMIN/country/"); $crumbs[] = array(getGS("Changing country name"), ""); echo camp_html_breadcrumbs($crumbs); ?> <P> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box"> <TR> <TD COLSPAN="2">