當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Section\Section類代碼示例

本文整理匯總了PHP中Concrete\Core\Multilingual\Page\Section\Section的典型用法代碼示例。如果您正苦於以下問題:PHP Section類的具體用法?PHP Section怎麽用?PHP Section使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Section類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createFromMultilingualSection

 /**
  * @param Section $section
  * @return StackCategory
  */
 public static function createFromMultilingualSection(Section $section)
 {
     $parent = \Page::getByPath(STACKS_PAGE_PATH);
     $data = array();
     $data['name'] = $section->getLocale();
     $data['cHandle'] = $section->getLocale();
     $type = Type::getByHandle(STACK_CATEGORY_PAGE_TYPE);
     $page = $parent->add($type, $data);
     $sc = new StackCategory($page);
     return $sc;
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:15,代碼來源:StackCategory.php

示例2: 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

示例3: 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

示例4: 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

示例5: getDashboardSitemapIconSRC

 public function getDashboardSitemapIconSRC($page)
 {
     $ids = Section::getIDList();
     if (in_array($page->getCollectionID(), $ids)) {
         return self::getSectionFlagIcon($page, true);
     }
 }
開發者ID:ngreimel,項目名稱:kovent,代碼行數:7,代碼來源:Flag.php

示例6: 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

示例7: __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

示例8: 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

示例9: rescan_locale

 public function rescan_locale()
 {
     if ($this->token->validate('rescan_locale')) {
         $u = new \User();
         if ($u->isSuperUser()) {
             \Core::make('cache/request')->disable();
             $section = Section::getByID($_REQUEST['locale']);
             $target = new MultilingualProcessorTarget($section);
             $processor = new Processor($target);
             if ($_POST['process']) {
                 foreach ($processor->receive() as $task) {
                     $processor->execute($task);
                 }
                 $obj = new \stdClass();
                 $obj->totalItems = $processor->getTotalTasks();
                 echo json_encode($obj);
                 exit;
             } else {
                 $processor->process();
             }
             $totalItems = $processor->getTotalTasks();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d task", "%d tasks", $totalItems)));
             exit;
         }
     }
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:26,代碼來源:copy.php

示例10: rescan_locale

 public function rescan_locale()
 {
     if ($this->token->validate('rescan_locale')) {
         $u = new \User();
         if ($u->isSuperUser()) {
             \Core::make('cache/request')->disable();
             $section = Section::getByID($_REQUEST['locale']);
             $target = new MultilingualProcessorTarget($section);
             $processor = new Processor($target);
             if ($_POST['process']) {
                 foreach ($processor->receive() as $task) {
                     $processor->execute($task);
                 }
                 $obj = new \stdClass();
                 $obj->totalItems = $processor->getTotalTasks();
                 print json_encode($obj);
                 exit;
             } else {
                 $processor->process();
             }
             $totalItems = $processor->getTotalTasks();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d task", "%d tasks", $totalItems)));
             /*
             $q = Queue::get('rescan_multilingual_section');
             if ($_POST['process']) {
                 $obj = new \stdClass;
                 $messages = $q->receive(\Config::get('concrete.limits.copy_pages'));
                 foreach($messages as $key => $p) {
                     // delete the page here
                     $page = unserialize($p->body);
                     $oc = \Page::getByID($page['cID']);
             
             
                     $q->deleteMessage($p);
                 }
             
                 $obj->totalItems = $q->count();
                 print json_encode($obj);
                 if ($q->count() == 0) {
                     $q->deleteQueue('rescan_multilingual_section');
                 }
                 exit;
             
             } else if ($q->count() == 0) {
                 $oc = Section::getByID($_REQUEST['locale']);
                 if (is_object($oc) && !$oc->isError()) {
                     $oc->queueForDeletionRequest($q, false);
                 }
             }
             $totalItems = $q->count();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d page", "%d pages", $totalItems)));
             */
             exit;
         }
     }
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:56,代碼來源:copy.php

示例11: getNewsPage

 public static function getNewsPage()
 {
     $currentSection = Section::getCurrentSection();
     if ($currentSection) {
         $localeID = $currentSection->getCollectionID();
     } else {
         return false;
     }
     return self::getChildPage($localeID, "news");
 }
開發者ID:Bloodb0ne,項目名稱:Concrete5_DevRepo,代碼行數:10,代碼來源:GeneralHelper.php

示例12: canAccess

 protected function canAccess()
 {
     $app = \Core::make("app");
     $dashboard = $app->make('helper/concrete/dashboard');
     if ($app->make('multilingual/detector')->isEnabled() && is_object(Section::getCurrentSection()) && !$dashboard->inDashboard($this->page) && $this->permissions->canEditPageMultilingualSettings()) {
         return true;
     }
     if (!$dashboard->inDashboard($this->page) && count($this->page->getPageRelations()) > 0) {
         return true;
     }
     return false;
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:12,代碼來源:page_relations.php

示例13: getDashboardSitemapIconSRC

 public static function getDashboardSitemapIconSRC($page)
 {
     if ($page->getPageTypeHandle() == STACK_CATEGORY_PAGE_TYPE) {
         $section = Section::getByLocale($page->getCollectionName());
         if (is_object($section)) {
             return self::getSectionFlagIcon($section, true);
         }
     }
     $ids = Section::getIDList();
     if (in_array($page->getCollectionID(), $ids)) {
         return self::getSectionFlagIcon($page, true);
     }
 }
開發者ID:krsreenatha,項目名稱:concrete5-1,代碼行數:13,代碼來源:Flag.php

示例14: finalizeQuery

 public function finalizeQuery(QueryBuilder $query)
 {
     $query = parent::finalizeQuery($query);
     $mslist = Section::getList();
     $relation = Database::get()->createQueryBuilder();
     $relation->select('mpRelationID')->from('MultilingualPageRelations', 'mppr')->where('cID = p.cID')->setMaxResults(1);
     $query->addSelect('(' . $relation . ') as mpr');
     foreach ($mslist as $ms) {
         $section = Database::get()->createQueryBuilder();
         $section->select('count(mpRelationID)')->from('MultilingualPageRelations', 'mppr')->where('mpRelationID = mpr')->andWhere($section->expr()->comparison('mpLocale', '=', $query->createNamedParameter($ms->getLocale())));
         $query->addSelect('(' . $section . ') as relationCount' . $ms->getCollectionID());
     }
     return $query;
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:14,代碼來源:PageList.php

示例15: finalizeQuery

 public function finalizeQuery(QueryBuilder $query)
 {
     $db = Database::connection();
     $query = parent::finalizeQuery($query);
     $mainRelation = $db->createQueryBuilder();
     $mainRelation->select('mpr0.cID')->addSelect('MIN(mpr0.mpRelationID) as mpr')->from('MultilingualPageRelations', 'mpr0')->groupBy('mpr0.cID');
     $query->addSelect('mppr.mpr')->leftJoin('p', '(' . $mainRelation . ')', 'mppr', 'p.cID = mppr.cID');
     $mslist = Section::getList();
     foreach ($mslist as $ms) {
         $cID = (int) $ms->getCollectionID();
         $cLocale = (string) $ms->getLocale();
         $query->addSelect("count(mppr{$cID}.mpRelationID) as relationCount{$cID}")->leftJoin('mppr', 'MultilingualPageRelations', "mppr{$cID}", "mppr.mpr = mppr{$cID}.mpRelationID AND " . $db->quote($cLocale) . " = mppr{$cID}.mpLocale");
     }
     $query->addGroupBy(['p.cID', 'mppr.mpr']);
     return $query;
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:16,代碼來源:PageList.php


注:本文中的Concrete\Core\Multilingual\Page\Section\Section類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。