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


PHP Section::getBySectionOfSite方法代码示例

本文整理汇总了PHP中Concrete\Core\Multilingual\Page\Section\Section::getBySectionOfSite方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::getBySectionOfSite方法的具体用法?PHP Section::getBySectionOfSite怎么用?PHP Section::getBySectionOfSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Concrete\Core\Multilingual\Page\Section\Section的用法示例。


在下文中一共展示了Section::getBySectionOfSite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMembers

 public function getMembers()
 {
     // get locale
     $locale = \Localization::activeLocale();
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $al = Section::getBySectionOfSite($c);
         if (is_object($al)) {
             $locale = $al->getLocale();
         }
     }
     // fix for sorting
     if ($locale == 'en_US') {
         $locale = 'en';
     }
     $params = array('limit' => 100, 'member_of' => $this->parentId, 'sort' => '1058', 'l' => $locale);
     // build URL with params
     $uh = \Core::make('helper/url');
     $url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/org/members';
     $url = $uh->buildQuery($url, $params);
     // fetch JSON
     $data = \Core::make("helper/file")->getContents($url);
     $data = json_decode($data, true);
     return $data;
 }
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:25,代码来源:controller.php

示例2: view

 public function view()
 {
     $this->requireAsset('javascript', 'jquery');
     $ml = Section::getList();
     $c = \Page::getCurrentPage();
     $al = Section::getBySectionOfSite($c);
     $languages = [];
     $locale = null;
     if ($al !== null) {
         $locale = $al->getLanguage();
     }
     if (!$locale) {
         $locale = \Localization::activeLocale();
         $al = Section::getByLocale($locale);
     }
     foreach ($ml as $m) {
         $languages[$m->getCollectionID()] = $m->getLanguageText($m->getLocale());
     }
     $this->set('languages', $languages);
     $this->set('languageSections', $ml);
     $this->set('activeLanguage', $al ? $al->getCollectionID() : null);
     $dl = $this->app->make('multilingual/detector');
     $this->set('defaultLocale', $dl->getPreferredSection());
     $this->set('locale', $locale);
     $this->set('cID', $c->getCollectionID());
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:26,代码来源:controller.php

示例3: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     if (!$c) {
         $c = Page::getCurrentPage();
     }
     $app = Facade::getFacadeApplication();
     // don't translate dashboard pages
     $dh = $app->make('helper/concrete/dashboard');
     if ($dh->inDashboard($c)) {
         return;
     }
     $ms = Section::getBySectionOfSite($c);
     if (!is_object($ms)) {
         $ms = static::getPreferredSection();
     }
     if (!$ms) {
         return;
     }
     $locale = $ms->getLocale();
     if ($locale) {
         $app->make('session')->set('multilingual_default_locale', $locale);
         $loc = Localization::getInstance();
         $loc->setContextLocale('site', $locale);
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:25,代码来源:Detector.php

示例4: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     if (\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale')) {
         return;
     }
     if (!$c) {
         $c = Page::getCurrentPage();
     }
     // don't translate dashboard pages
     $dh = \Core::make('helper/concrete/dashboard');
     if ($dh->inDashboard($c)) {
         return;
     }
     $ms = Section::getBySectionOfSite($c);
     if (!is_object($ms)) {
         $ms = static::getPreferredSection();
     }
     if (!$ms) {
         return;
     }
     $locale = $ms->getLocale();
     if (strlen($locale)) {
         \Localization::changeLocale($locale);
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:Detector.php

示例5: assign

 public function assign()
 {
     $pr = new PageEditResponse();
     if ($this->request->request->get('destID') == $this->page->getCollectionID()) {
         throw new \Exception(t("You cannot assign this page to itself."));
     }
     $destPage = \Page::getByID($_POST['destID']);
     if (Section::isMultilingualSection($destPage)) {
         $ms = Section::getByID($destPage->getCollectionID());
     } else {
         $ms = Section::getBySectionOfSite($destPage);
     }
     if (is_object($ms)) {
         // we need to assign/relate the source ID too, if it doesn't exist
         if (!Section::isAssigned($this->page)) {
             Section::registerPage($this->page);
         }
         Section::relatePage($this->page, $destPage, $ms->getLocale());
         $ih = Core::make('multilingual/interface/flag');
         $icon = (string) $ih->getSectionFlagIcon($ms);
         $pr->setAdditionalDataAttribute('name', $destPage->getCollectionName());
         $pr->setAdditionalDataAttribute('link', $destPage->getCollectionLink());
         $pr->setAdditionalDataAttribute('icon', $icon);
         $pr->setMessage(t('Page assigned.'));
         $pr->outputJSON();
     } else {
         throw new \Exception(t("The destination page doesn't appear to be in a valid multilingual section."));
     }
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:29,代码来源:multilingual.php

示例6: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     $loc = \Localization::getInstance();
     if (!(\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale'))) {
         if (!$c) {
             $c = Page::getCurrentPage();
         }
         // don't translate dashboard pages
         $dh = \Core::make('helper/concrete/dashboard');
         if ($dh->inDashboard($c)) {
             return;
         }
         $locale = null;
         $ms = Section::getBySectionOfSite($c);
         if ($ms) {
             $locale = $ms->getLocale();
         }
         if (!$locale) {
             if (Config::get('concrete.multilingual.use_previous_locale') && Session::has('previous_locale')) {
                 $locale = Session::get('previous_locale');
             }
             if (!$locale) {
                 $ms = static::getPreferredSection();
                 if ($ms) {
                     $locale = $ms->getLocale();
                 }
             }
         }
         if ($locale) {
             $loc->setLocale($locale);
         }
     }
     Session::set('previous_locale', $loc->getLocale());
 }
开发者ID:WillemAnchor,项目名称:concrete5,代码行数:34,代码来源:Detector.php

示例7: getSectionFlagIcon

 public static function getSectionFlagIcon($page, $filePathOnly = false)
 {
     $db = Database::get();
     $section = Section::getBySectionOfSite($page);
     $icon = $section->getCountry();
     return self::getFlagIcon($icon, $filePathOnly);
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:7,代码来源:Flag.php

示例8: __construct

 public function __construct(Page $page, Dashboard $dashboard, Flag $flagService)
 {
     $this->page = $page;
     $this->dashboard = $dashboard;
     $this->flagService = $flagService;
     $this->multilingualSection = \Concrete\Core\Multilingual\Page\Section\Section::getBySectionOfSite($page);
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:7,代码来源:RelationListController.php

示例9: getByName

 /**
  * @param string $stackName
  * @param string $cvID
  *
  * @return Page
  */
 public static function getByName($stackName, $cvID = 'RECENT')
 {
     $c = Page::getCurrentPage();
     if (is_object($c) && !$c->isError()) {
         $identifier = sprintf('/stack/name/%s/%s', $stackName, $c->getCollectionID());
         $cache = Core::make('cache/request');
         $item = $cache->getItem($identifier);
         if (!$item->isMiss()) {
             $cID = $item->get();
         } else {
             $item->lock();
             $db = Database::connection();
             $ms = false;
             $detector = Core::make('multilingual/detector');
             if ($detector->isEnabled()) {
                 $ms = Section::getBySectionOfSite($c);
                 if (!is_object($ms)) {
                     $ms = $detector->getPreferredSection();
                 }
             }
             if (is_object($ms)) {
                 $cID = $db->GetOne('select cID from Stacks where stName = ? and stMultilingualSection = ?', array($stackName, $ms->getCollectionID()));
             } else {
                 $cID = $db->GetOne('select cID from Stacks where stName = ?', array($stackName));
             }
             $item->set($cID);
         }
     } else {
         $cID = Database::connection()->GetOne('select cID from Stacks where stName = ?', array($stackName));
     }
     return $cID ? static::getByID($cID, $cvID) : false;
 }
开发者ID:jkoudys,项目名称:concrete5,代码行数:38,代码来源:Stack.php

示例10: filterByPageLanguage

 public function filterByPageLanguage(\Concrete\Core\Page\Page $page)
 {
     $ms = Section::getBySectionOfSite($page);
     if (!is_object($ms)) {
         $ms = static::getPreferredSection();
     }
     if (is_object($ms)) {
         $this->filterByLanguageSection($ms);
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:10,代码来源:StackList.php

示例11: filterByPageLanguage

 public function filterByPageLanguage(\Concrete\Core\Page\Page $page)
 {
     $ms = Section::getBySectionOfSite($page);
     if (!is_object($ms)) {
         $ms = static::getPreferredSection();
     }
     if (is_object($ms)) {
         $this->filter('stMultilingualSection', $ms->getCollectionID());
     }
 }
开发者ID:jkoudys,项目名称:concrete5,代码行数:10,代码来源:StackList.php

示例12: getMember

 public function getMember()
 {
     // get locale
     $locale = \Localization::activeLocale();
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $al = Section::getBySectionOfSite($c);
         if (is_object($al)) {
             $locale = $al->getLocale();
         }
     }
     // build URL with params
     $uh = \Core::make('helper/url');
     $url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/org/members/' . $this->memberId;
     $url = $uh->buildQuery($url, array('l' => $locale));
     // fetch JSON
     $data = \Core::make("helper/file")->getContents($url);
     $data = json_decode($data, true);
     return $data;
 }
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:20,代码来源:controller.php

示例13: getSkills

 public function getSkills($sort = 'name_asc')
 {
     // get locale
     $locale = \Localization::activeLocale();
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $al = Section::getBySectionOfSite($c);
         if (is_object($al)) {
             $locale = $al->getLocale();
         }
     }
     // fix for sorting
     if ($locale == 'en_US') {
         $locale = 'en';
     }
     // defaults
     $params = array('limit' => 100, 'sort' => $sort, 'l' => $locale);
     // build URL with params
     $url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/events/' . $this->eventId . '/skills';
     $url .= '?';
     $url .= http_build_query($params);
     // block settings
     if ($this->sectorId) {
         $url .= '&';
         $url .= http_build_query(array('sector' => $this->sectorId));
     }
     if ($this->types) {
         $skillTypes = explode(',', $this->types);
         foreach ($skillTypes as $skillType) {
             $url .= '&';
             $url .= http_build_query(array('type' => $skillType));
         }
     }
     // fetch JSON
     $data = \Core::make("helper/file")->getContents($url);
     $data = json_decode($data, true);
     return $data;
 }
开发者ID:worldskills,项目名称:concrete5-worldskills,代码行数:38,代码来源:controller.php

示例14: getSiteNameForPage

 /**
  * Get the site name localized for a specific page.
  *
  * @param \Concrete\Core\Page\Page $page
  *
  * @return string
  */
 public function getSiteNameForPage(\Concrete\Core\Page\Page $page)
 {
     static $multilingual;
     static $defaultLocale;
     if (!isset($multilingual)) {
         $multilingual = $this->app->make('multilingual/detector')->isEnabled();
     }
     if ($multilingual) {
         if (!isset($defaultLocale)) {
             $defaultLocale = $this->app->make('config')->get('concrete.locale') ?: 'en_US';
         }
         $section = Section::getBySectionOfSite($page);
         if ($section) {
             $locale = $section->getLocale();
         } else {
             $locale = $defaultLocale;
         }
         $siteName = $this->getSiteNameForLocale($locale);
     } else {
         $siteName = $this->app->make('config')->get('concrete.site');
     }
     return $siteName;
 }
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:30,代码来源:bulk.php

示例15: die

<?php

use Concrete\Core\Multilingual\Page\Section\Section as MultilingualSection;
defined('C5_EXECUTE') or die("Access Denied.");
if (Core::make('helper/validation/token')->validate('get_url_slug', $_REQUEST['token'])) {
    $lang = Localization::activeLanguage();
    if (isset($_REQUEST['parentID']) && Core::make('multilingual/detector')->isEnabled()) {
        $ms = MultilingualSection::getBySectionOfSite(Page::getByID($_REQUEST['parentID']));
        if (is_object($ms)) {
            $lang = $ms->getLanguage();
        }
    }
    $text = Core::make('helper/text');
    $name = $text->urlify($_REQUEST['name'], Config::get('concrete.seo.segment_max_length'), $lang);
    echo $name;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:16,代码来源:url_slug.php


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