当前位置: 首页>>代码示例>>PHP>>正文


PHP Localization::getActiveTranslateJsonURL方法代码示例

本文整理汇总了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'));
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:79,代码来源:form.php


注:本文中的Localization::getActiveTranslateJsonURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。