本文整理汇总了PHP中Localization::getActiveTranslateJsonURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Localization::getActiveTranslateJsonURL方法的具体用法?PHP Localization::getActiveTranslateJsonURL怎么用?PHP Localization::getActiveTranslateJsonURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Localization
的用法示例。
在下文中一共展示了Localization::getActiveTranslateJsonURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
parent::view();
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
$nh = Loader::helper('navigation');
$av = Loader::helper('concrete/avatar');
$valt = Loader::helper('validation/token');
$imgHelper = Loader::helper('image');
/* If no page is passed to edit, create a new page.
*/
$load = $_REQUEST['load'];
if (empty($load)) {
// Find the parent page this should go under
$cityPage = ($parentCID = $_REQUEST['parentCID']) ? Page::getByID($parentCID) : ($ui->getAttribute('home_city') ?: Page::getByPath('/canada/toronto'));
$c = $this->getUnstartedWalk($u, $cityPage);
} else {
$c = Page::getByPath($load);
$cityPage = Page::getByID($c->getCollectionParentID());
}
$walk_ward = trim((string) $c->getAttribute('walk_wards'));
$city_wards = $cityPage->getAttribute('city_wards');
if ($city_wards) {
$wards = array_map(function ($ward) use($walk_ward) {
if ($ward->value == $walk_ward) {
$ward->selected = true;
}
return $ward;
}, $city_wards->getOptions());
} else {
$wards = null;
}
// Set the language based on a trail to the city
/* Set the city language to the first one matched, recursing from where we are */
$crumbs = $nh->getTrailToCollection($c);
$crumbs[] = $c;
// Must check the current page first
foreach ($crumbs as $crumb) {
if ($lang = (string) $crumb->getAttribute('lang')) {
Localization::changeLocale($lang);
break;
}
}
// Load our city
$latlng = explode(',', $cityPage->getAttribute('latlng'));
// If you don't have a lat and a lng, final resort is Toronto. It's at least better than being 400km off the coast of Nigeria.
if (count((array) $latlng) !== 2) {
$latlng = [43.653226, -79.3831843];
}
// Instantiate as models, for JSON serialization
$city = new City($cityPage);
$walk = new Walk($c);
// Build data needed by frontend
$this->addToJanesWalk(['city' => $city, 'form' => ['valt' => $valt->generate('upload')], 'walk' => ['name' => (string) $walk, 'data' => $walk, 'url' => $nh->getCollectionURL($c)], 'locale' => ['name' => Localization::activeLocale(), 'translation' => Localization::getActiveTranslateJsonURL()]]);
// Set the view name
$this->bodyData['pageViewName'] = 'CreateWalkView';
$this->set('u', $u);
$this->set('ui', $ui);
$this->set('owner', UserInfo::getByID($c->getCollectionUserID()));
$this->set('nh', $nh);
$this->set('av', $av);
$this->set('load', $load);
$this->set('c', $c);
$this->set('city', $city);
$this->set('country', $city->country);
$this->set('ui_cityorganizer', $city->city_organizer);
$this->set('imgHelper', $imgHelper);
$this->set('wards', $wards);
$this->set('is_nyc', $is_nyc);
$this->set('lat', $latlng[0]);
$this->set('lng', $latlng[1]);
$this->set('bodyData', $this->bodyData);
// Load JS we need in the form
$html = Loader::helper('html');
// Set default stylesheets for libs
$this->addHeaderItem($html->css('jquery.ui.css'));
// Set libs we'll need on the page
$this->addFooterItem(Loader::helper('html')->javascript('jquery.ui.js'));
}