本文整理汇总了PHP中Countries::getShortCountryName方法的典型用法代码示例。如果您正苦于以下问题:PHP Countries::getShortCountryName方法的具体用法?PHP Countries::getShortCountryName怎么用?PHP Countries::getShortCountryName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Countries
的用法示例。
在下文中一共展示了Countries::getShortCountryName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
// Check for request forgeries
JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$post = JRequest::get('post');
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$post['id'] = (int) $cid[0];
// decription must be fetched without striping away html code
$post['notes'] = JRequest::getVar('notes', 'none', 'post', 'STRING', JREQUEST_ALLOWHTML);
$model = $this->getModel('playground');
if (!empty($post['address'])) {
$address_parts[] = $post['address'];
}
if (!empty($post['state'])) {
$address_parts[] = $post['state'];
}
if (!empty($post['location'])) {
if (!empty($post['zipcode'])) {
$address_parts[] = $post['zipcode'] . ' ' . $post['location'];
} else {
$address_parts[] = $post['location'];
}
}
if (!empty($post['country'])) {
$address_parts[] = Countries::getShortCountryName($post['country']);
}
$address = implode(', ', $address_parts);
$coords = $model->resolveLocation($address);
//$mainframe->enqueueMessage(JText::_('coords -> '.'<pre>'.print_r($coords,true).'</pre>' ),'');
foreach ($coords as $key => $value) {
$post['extended'][$key] = $value;
}
$post['latitude'] = $coords['latitude'];
$post['longitude'] = $coords['longitude'];
if ($model->store($post)) {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_VENUE_CTRL_SAVED');
} else {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_VENUE_CTRL_ERROR_SAVE') . $model->getError();
}
// Check the table in so it can be edited.... we are done with it anyway
$model->checkin();
if ($this->getTask() == 'save') {
$link = 'index.php?option=com_joomleague&view=playgrounds';
} else {
$link = 'index.php?option=com_joomleague&task=playground.edit&cid[]=' . $post['id'];
}
$this->setRedirect($link, $msg);
}
示例2: getAddressString
/**
* AddressString
*/
function getAddressString()
{
$club = $this->getClub();
if (!isset($club)) {
return null;
}
$address_parts = array();
if (!empty($club->address)) {
$address_parts[] = $club->address;
}
if (!empty($club->state)) {
$address_parts[] = $club->state;
}
if (!empty($club->location)) {
if (!empty($club->zipcode)) {
$address_parts[] = $club->zipcode . ' ' . $club->location;
} else {
$address_parts[] = $club->location;
}
}
if (!empty($club->country)) {
$address_parts[] = Countries::getShortCountryName($club->country);
}
$address = implode(', ', $address_parts);
return $address;
}
示例3: save
function save()
{
// Check for request forgeries
JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$post = JRequest::get('post');
$pid = JRequest::getInt('cid');
$post['id'] = $pid;
//map cid to table pk: id
//$mainframe->enqueueMessage(JText::_('post -> '.'<pre>'.print_r($post,true).'</pre>' ),'');
// decription must be fetched without striping away html code
$post['notes'] = JRequest::getVar('notes', 'none', 'post', 'STRING', JREQUEST_ALLOWHTML);
$model = $this->getModel('person');
if (!empty($post['address'])) {
$address_parts[] = $post['address'];
}
if (!empty($post['state'])) {
$address_parts[] = $post['state'];
}
if (!empty($post['location'])) {
if (!empty($post['zipcode'])) {
$address_parts[] = $post['zipcode'] . ' ' . $post['location'];
} else {
$address_parts[] = $post['location'];
}
}
if (!empty($post['country'])) {
$address_parts[] = Countries::getShortCountryName($post['country']);
}
$address = implode(', ', $address_parts);
$coords = $model->resolveLocation($address);
//$mainframe->enqueueMessage(JText::_('coords -> '.'<pre>'.print_r($coords,true).'</pre>' ),'');
if (count($post['extended']['COM_JOOMLEAGUE_EXT_PERSON_PARENT_POSITIONS']) > 0) {
$post['extended']['COM_JOOMLEAGUE_EXT_PERSON_PARENT_POSITIONS'] = implode(",", $post['extended']['COM_JOOMLEAGUE_EXT_PERSON_PARENT_POSITIONS']);
}
foreach ($coords as $key => $value) {
$post['extended'][$key] = $value;
}
$post['latitude'] = $coords['latitude'];
$post['longitude'] = $coords['longitude'];
if ($model->store($post)) {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_PERSON_CTRL_SAVED');
if (JRequest::getVar('assignperson')) {
// diddipoeler
// wenn man im nächsten model mit einem array arbeitet
// sollte man auch ein array übergeben
$pid = array();
$pid[0] = $model->getDbo()->insertid();
$project_team_id = JRequest::getVar('team_id', 0, 'post', 'int');
$model = $this->getModel('teamplayers');
if ($model->storeassigned($pid, $project_team_id)) {
$msg .= ' - ' . JText::_('COM_JOOMLEAGUE_ADMIN_PERSON_CTRL_PERSON_ASSIGNED');
} else {
$msg .= ' - ' . JText::_('COM_JOOMLEAGUE_ADMIN_PERSON_CTRL_ERROR_PERSON_ASSIGNED') . $model->getError();
}
$model = $this->getModel('person');
}
} else {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_PERSON_CTRL_ERROR_SAVE') . $model->getError();
}
// Check the table in so it can be edited.... we are done with it anyway
$model->checkin();
if ($this->getTask() == 'save') {
$link = 'index.php?option=com_joomleague&view=persons';
} else {
$link = 'index.php?option=com_joomleague&task=person.edit&cid=' . $pid;
}
#echo $msg;
//-------extra fields-----------//
if (isset($post['extraf']) && count($post['extraf'])) {
for ($p = 0; $p < count($post['extraf']); $p++) {
$tbl = JTable::getInstance("jlextuserextrafieldvalue", "Table");
// extra feld ist schon vorhanden
if ($post['extra_value_id'][$p]) {
$result = $post['extra_value_id'][$p];
$tbl->load($result);
$tbl->field_id = $post['extra_id'][$p];
$tbl->jl_id = $post['id'];
$tbl->fieldvalue = $post['extraf'][$p];
} else {
$tbl->field_id = $post['extra_id'][$p];
$tbl->jl_id = $post['id'];
$tbl->fieldvalue = $post['extraf'][$p];
}
if (!$tbl->store()) {
}
}
}
$this->setRedirect($link, $msg);
}
示例4: save
function save()
{
$mainframe = JFactory::getApplication();
// Check for request forgeries
JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$msg = '';
$address_parts = array();
$post = JRequest::get('post');
//$mainframe->enqueueMessage(JText::_('post -> '.'<pre>'.print_r($post,true).'</pre>' ),'');
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$post['id'] = (int) $cid[0];
$model = $this->getModel('club');
if (!empty($post['address'])) {
$address_parts[] = $post['address'];
}
if (!empty($post['state'])) {
$address_parts[] = $post['state'];
}
if (!empty($post['location'])) {
if (!empty($post['zipcode'])) {
$address_parts[] = $post['zipcode'] . ' ' . $post['location'];
} else {
$address_parts[] = $post['location'];
}
}
if (!empty($post['country'])) {
$address_parts[] = Countries::getShortCountryName($post['country']);
}
$address = implode(', ', $address_parts);
$coords = $model->resolveLocation($address);
//$mainframe->enqueueMessage(JText::_('coords -> '.'<pre>'.print_r($coords,true).'</pre>' ),'');
foreach ($coords as $key => $value) {
$post['extended'][$key] = $value;
}
$post['latitude'] = $coords['latitude'];
$post['longitude'] = $coords['longitude'];
if (isset($post['merge_teams'])) {
if (count($post['merge_teams']) > 0) {
$temp = implode(",", $post['merge_teams']);
} else {
$temp = '';
}
$post['merge_teams'] = $temp;
} else {
$post['merge_teams'] = '';
}
//$mainframe->enqueueMessage(JText::_('post -> '.'<pre>'.print_r($post,true).'</pre>' ),'');
if ($model->store($post)) {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_CLUB_CTRL_SAVED');
$createTeam = JRequest::getVar('createTeam');
if ($createTeam) {
$team_name = JRequest::getVar('name');
$team_short_name = strtoupper(substr(ereg_replace("[^a-zA-Z]", "", $team_name), 0, 3));
$teammodel = $this->getModel('team');
$tpost['id'] = "0";
$tpost['name'] = $team_name;
$tpost['short_name'] = $team_short_name;
$tpost['club_id'] = $teammodel->getDbo()->insertid();
$teammodel->store($tpost);
}
$type = 'message';
} else {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_CLUB_CTRL_ERROR_SAVE') . $model->getError();
$type = 'error';
}
// Check the table in so it can be edited.... we are done with it anyway
$model->checkin();
/*
if ($this->getTask()=='save')
{
$link='index.php?option=com_joomleague&view=editclub';
}
else
{
$link='index.php?option=com_joomleague&view=editclub&cid='.$post['id'];
}
*/
//$link = JoomleagueHelperRoute::getClubInfoRoute( $project_id, $post['id'] );
//$this->setRedirect($link,$msg);
$this->setRedirect('index.php?option=com_joomleague&close=' . JRequest::getString('close', 0) . '&tmpl=component&view=editclub&cid=' . $post['id'], $msg, $type);
}
示例5: display
//.........这里部分代码省略.........
$opp_arr = array();
$opp_arr[] = JHTML::_('select.option', "0", JText::_('COM_JOOMLEAGUE_RANKING_FULL_RANKING'));
$opp_arr[] = JHTML::_('select.option', "1", JText::_('COM_JOOMLEAGUE_RANKING_HOME_RANKING'));
$opp_arr[] = JHTML::_('select.option', "2", JText::_('COM_JOOMLEAGUE_RANKING_AWAY_RANKING'));
$lists['type'] = $opp_arr;
$this->assignRef('lists', $lists);
if (!isset($config['colors'])) {
$config['colors'] = "";
}
$this->assignRef('colors', $model->getColors($config['colors']));
//$this->assignRef('result', $model->getTeamInfo());
// $this->assignRef( 'pageNav', $model->pagenav( "ranking", count( $rounds ), $sr->to ) );
// $this->assignRef( 'pageNav2', $model->pagenav2( "ranking", count( $rounds ), $sr->to ) );
// diddipoeler
$mdlTeams = JModel::getInstance("Teams", "JoomleagueModel");
$this->assignRef('allteams', $mdlTeams->getTeams());
if ($this->config['show_ranking_maps'] == 1) {
$this->geo = new simpleGMapGeocoder();
$this->geo->genkml3($project->id, $this->allteams);
// $this->map = new simpleGMapAPI();
// $this->geo = new simpleGMapGeocoder();
// $this->map->setWidth($this->mapconfig['width']);
// $this->map->setHeight($this->mapconfig['height']);
// $this->map->setZoomLevel($this->mapconfig['map_zoom']);
// $this->map->setMapType($this->mapconfig['default_map_type']);
// $this->map->setBackgroundColor('#d0d0d0');
// $this->map->setMapDraggable(true);
// $this->map->setDoubleclickZoom(false);
// $this->map->setScrollwheelZoom(true);
// $this->map->showDefaultUI(false);
// $this->map->showMapTypeControl(true, 'DROPDOWN_MENU');
// $this->map->showNavigationControl(true, 'DEFAULT');
// $this->map->showScaleControl(true);
// $this->map->showStreetViewControl(true);
// $this->map->setInfoWindowBehaviour('SINGLE_CLOSE_ON_MAPCLICK');
// $this->map->setInfoWindowTrigger('CLICK');
//echo 'allteams <br><pre>'.print_r($this->allteams,true).'</pre><br>';
foreach ($this->allteams as $row) {
$address_parts = array();
if (!empty($row->club_address)) {
$address_parts[] = $row->club_address;
}
if (!empty($row->club_state)) {
$address_parts[] = $row->club_state;
}
if (!empty($row->club_location)) {
if (!empty($row->club_zipcode)) {
$address_parts[] = $row->club_zipcode . ' ' . $row->club_location;
} else {
$address_parts[] = $row->club_location;
}
}
if (!empty($row->club_country)) {
$address_parts[] = Countries::getShortCountryName($row->club_country);
}
$row->address_string = implode(', ', $address_parts);
// $this->map->addMarkerByAddress($row->address_string, $row->team_name, '"<a href="'.$row->club_www.'" target="_blank">'.$row->club_www.'</a>"', "http://maps.google.com/mapfiles/kml/pal2/icon49.png");
/*
$paramsdata = $row->club_extended;
$paramsdefs = JLG_PATH_ADMIN . DS . 'assets' . DS . 'extended' . DS . 'club.xml';
$extended = new JLGExtraParams( $paramsdata, $paramsdefs );
foreach ( $extended->getGroups() as $key => $groups )
{
$lat = $extended->get('JL_ADMINISTRATIVE_AREA_LEVEL_1_LATITUDE');
$lng = $extended->get('JL_ADMINISTRATIVE_AREA_LEVEL_1_LONGITUDE');
}
if ( $lat && $lng )
{
$adressecountry_flag = Countries::getCountryFlag($row->club_country);
//echo JURI::root().'<br>';
if ( $row->logo_big )
{
$path = JURI::root().$row->logo_big;
}
else
{
$path = JURI::root().'media/com_joomleague/placeholders/'.'placeholder_150.png';
}
//echo $path.'<br>';
$this->map->addMarker($lat, $lng, $row->club_name, $adressecountry_flag.' '.$row->address_string.'<br>',$path);
}
*/
}
// $document->addScript($this->map->JLprintGMapsJS());
// $document->addScriptDeclaration($this->map->JLshowMap(false));
}
$this->assign('show_debug_info', JComponentHelper::getParams('com_joomleague')->get('show_debug_info', 0));
// Set page title
$pageTitle = JText::_('COM_JOOMLEAGUE_RANKING_PAGE_TITLE');
if (isset($this->project->name)) {
$pageTitle .= ': ' . $this->project->name;
}
$document->setTitle($pageTitle);
parent::display($tpl);
}
示例6: genkml3
function genkml3($project_id, $allteams)
{
$type = 'ranking';
/*
echo 'genkml3 project_id<br><pre>';
print_r($project_id);
echo '</pre><br>';
echo 'genkml3 allteams<br><pre>';
print_r($allteams);
echo '</pre><br>';
*/
foreach ($allteams as $row) {
$address_parts = array();
if (!empty($row->club_address)) {
$address_parts[] = $row->club_address;
}
if (!empty($row->club_state)) {
$address_parts[] = $row->club_state;
}
if (!empty($row->club_location)) {
if (!empty($row->club_zipcode)) {
$address_parts[] = $row->club_zipcode . ' ' . $row->club_location;
} else {
$address_parts[] = $row->club_location;
}
}
if (!empty($row->club_country)) {
$address_parts[] = Countries::getShortCountryName($row->club_country);
}
$row->address_string = implode(', ', $address_parts);
$row->type = 'bar';
$coords = $this->JLgetGeoCoords($row->address_string);
if ($coords["status"] == 'OK') {
$row->lat = $coords["results"][0]["geometry"]["location"]["lat"];
$row->lng = $coords["results"][0]["geometry"]["location"]["lng"];
} else {
$osm = $this->getOSMGeoCoords($row->address_string);
if ($osm) {
$row->lat = $osm['lat'];
$row->lng = $osm['lng'];
} else {
$row->lat = '';
$row->lng = '';
}
}
/*
echo 'genkml3 allteams<br><pre>';
print_r($coords);
echo '</pre><br>';
*/
}
/*
echo 'genkml3 allteams<br><pre>';
print_r($allteams);
echo '</pre><br>';
*/
$this->writekml3($allteams, $project_id, $type);
}
示例7: save
function save()
{
$mainframe = JFactory::getApplication();
// Check for request forgeries
JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
$msg = '';
$address_parts = array();
$post = JRequest::get('post');
// wurden jahre mitgegeben ?
$founded_year = date('Y', strtotime($post['founded']));
$dissolved_year = date('Y', strtotime($post['dissolved']));
if ($founded_year != '0000') {
$post['founded_year'] = $founded_year;
}
if ($dissolved_year != '0000') {
$post['dissolved_year'] = $dissolved_year;
}
//$mainframe->enqueueMessage(JText::_('post -> '.'<pre>'.print_r($post,true).'</pre>' ),'');
$cid = JRequest::getVar('cid', array(0), 'post', 'array');
$post['id'] = (int) $cid[0];
$model = $this->getModel('club');
if (!empty($post['address'])) {
$address_parts[] = $post['address'];
}
if (!empty($post['state'])) {
$address_parts[] = $post['state'];
}
if (!empty($post['location'])) {
if (!empty($post['zipcode'])) {
$address_parts[] = $post['zipcode'] . ' ' . $post['location'];
} else {
$address_parts[] = $post['location'];
}
}
if (!empty($post['country'])) {
$address_parts[] = Countries::getShortCountryName($post['country']);
}
$address = implode(', ', $address_parts);
$coords = $model->resolveLocation($address);
//$mainframe->enqueueMessage(JText::_('coords -> '.'<pre>'.print_r($coords,true).'</pre>' ),'');
foreach ($coords as $key => $value) {
$post['extended'][$key] = $value;
}
$post['latitude'] = $coords['latitude'];
$post['longitude'] = $coords['longitude'];
if (isset($post['merge_teams'])) {
if (count($post['merge_teams']) > 0) {
$temp = implode(",", $post['merge_teams']);
} else {
$temp = '';
}
$post['merge_teams'] = $temp;
} else {
$post['merge_teams'] = '';
}
//$mainframe->enqueueMessage(JText::_('post -> '.'<pre>'.print_r($post,true).'</pre>' ),'');
if ($model->store($post)) {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_CLUB_CTRL_SAVED');
$createTeam = JRequest::getVar('createTeam');
if ($createTeam) {
$team_name = JRequest::getVar('name');
$team_short_name = strtoupper(substr(ereg_replace("[^a-zA-Z]", "", $team_name), 0, 3));
$teammodel = $this->getModel('team');
$tpost['id'] = "0";
$tpost['name'] = $team_name;
$tpost['short_name'] = $team_short_name;
$tpost['club_id'] = $teammodel->getDbo()->insertid();
$teammodel->store($tpost);
}
} else {
$msg = JText::_('COM_JOOMLEAGUE_ADMIN_CLUB_CTRL_ERROR_SAVE') . $model->getError();
}
// Check the table in so it can be edited.... we are done with it anyway
$model->checkin();
if ($this->getTask() == 'save') {
$link = 'index.php?option=com_joomleague&view=clubs&club.display';
} else {
$link = 'index.php?option=com_joomleague&task=club.edit&cid[]=' . $post['id'];
}
//-------extra fields-----------//
if (isset($post['extraf']) && count($post['extraf'])) {
for ($p = 0; $p < count($post['extraf']); $p++) {
$tbl = JTable::getInstance("jlextuserextrafieldvalue", "Table");
// extra feld ist schon vorhanden
if ($post['extra_value_id'][$p]) {
$result = $post['extra_value_id'][$p];
$tbl->load($result);
$tbl->field_id = $post['extra_id'][$p];
$tbl->jl_id = $post['id'];
$tbl->fieldvalue = $post['extraf'][$p];
} else {
$tbl->field_id = $post['extra_id'][$p];
$tbl->jl_id = $post['id'];
$tbl->fieldvalue = $post['extraf'][$p];
}
if (!$tbl->store()) {
}
}
}
$this->setRedirect($link, $msg);
//.........这里部分代码省略.........