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


PHP Section::getByID方法代码示例

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


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

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

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

示例3: create_new

 public function create_new()
 {
     $pr = new PageEditResponse();
     $ms = Section::getByID($this->request->request->get('section'));
     // we get the related parent id
     if ($this->page->isPageDraft()) {
         $cParentID = $this->page->getPageDraftTargetParentPageID();
     } else {
         $cParentID = $this->page->getCollectionParentID();
     }
     $cParent = \Page::getByID($cParentID);
     $cParentRelatedID = $ms->getTranslatedPageID($cParent);
     if ($cParentRelatedID > 0) {
         // we copy the page underneath it and store it
         $ct = \PageType::getByID($this->page->getPageTypeID());
         if ($this->page->isPageDraft()) {
             $ptp = new \Permissions($ct);
             if (!$ptp->canAddPageType()) {
                 throw new \Exception(t('You do not have permission to add a page of this type.'));
             }
         }
         $newParent = \Page::getByID($cParentRelatedID);
         $cp = new \Permissions($newParent);
         if ($cp->canAddSubCollection($ct)) {
             if ($this->page->isPageDraft()) {
                 $targetParent = \Page::getByPath(\Config::get('concrete.paths.drafts'));
             } else {
                 $targetParent = $newParent;
             }
             $newPage = $this->page->duplicate($targetParent);
             if (is_object($newPage)) {
                 if ($this->page->isPageDraft()) {
                     $newPage->setPageDraftTargetParentPageID($newParent->getCollectionID());
                     Section::relatePage($this->page, $newPage, $ms->getLocale());
                     $pr->setMessage(t('New draft created.'));
                 } else {
                     // grab the approved version and unapprove it
                     $v = Version::get($newPage, 'ACTIVE');
                     if (is_object($v)) {
                         $v->deny();
                     }
                     $pr->setMessage(t('Unapproved page created. You must publish this page before it is live.'));
                 }
                 $ih = Core::make('multilingual/interface/flag');
                 $icon = (string) $ih->getSectionFlagIcon($ms);
                 $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName());
                 $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink());
                 $pr->setAdditionalDataAttribute('icon', $icon);
             }
         } else {
             throw new \Exception(t('You do not have permission to add this page to this section of the tree.'));
         }
     }
     $pr->outputJSON();
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:55,代码来源:multilingual.php

示例4: action_set_current_language

 public function action_set_current_language()
 {
     if ($this->post('language')) {
         $section = Section::getByID($this->post('language'));
         if (is_object($section)) {
             Session::set('multilingual_default_locale', $section->getLocale());
             if ($this->post('remember')) {
                 Cookie::set('multilingual_default_locale', $section->getLocale(), time() + 60 * 60 * 24 * 365);
             } else {
                 Cookie::clear('multilingual_default_locale');
             }
         }
     }
     $this->action_switch_language($this->post('rcID'), $this->post('language'));
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:15,代码来源:controller.php

示例5: create_new

 public function create_new()
 {
     $pr = new PageEditResponse();
     $ms = Section::getByID($this->request->request->get('section'));
     // we get the related parent id
     $cParentID = $this->page->getCollectionParentID();
     $cParent = \Page::getByID($cParentID);
     $cParentRelatedID = $ms->getTranslatedPageID($cParent);
     if ($cParentRelatedID > 0) {
         // we copy the page underneath it and store it
         $newParent = \Page::getByID($cParentRelatedID);
         $ct = \PageType::getByID($this->page->getPageTypeID());
         $cp = new \Permissions($newParent);
         if ($cp->canAddSubCollection($ct) && $this->page->canMoveCopyTo($newParent)) {
             $newPage = $this->page->duplicate($newParent);
             if (is_object($newPage)) {
                 // grab the approved version and unapprove it
                 $v = Version::get($newPage, 'ACTIVE');
                 if (is_object($v)) {
                     $v->deny();
                     $pkr = new ApprovePageRequest();
                     $pkr->setRequestedPage($newPage);
                     $u = new \User();
                     $pkr->setRequestedVersionID($v->getVersionID());
                     $pkr->setRequesterUserID($u->getUserID());
                     $response = $pkr->trigger();
                     if (!$response instanceof Response) {
                         // we are deferred
                         $pr->setMessage(t('<strong>Request Saved.</strong> You must complete the workflow before this change is active.'));
                     } else {
                         $ih = Core::make('multilingual/interface/flag');
                         $icon = $ih->getSectionFlagIcon($ms);
                         $pr->setAdditionalDataAttribute('name', $newPage->getCollectionName());
                         $pr->setAdditionalDataAttribute('link', $newPage->getCollectionLink());
                         $pr->setAdditionalDataAttribute('icon', $icon);
                         $pr->setMessage(t('Page created.'));
                     }
                 }
             }
         } else {
             throw new \Exception(t('You do not have permission to add this page to this section of the tree.'));
         }
     }
     $pr->outputJSON();
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:45,代码来源:multilingual.php

示例6: getSelectedLanguage

 protected function getSelectedLanguage()
 {
     $defaultLanguage = false;
     $defaultLocale = Config::get('concrete.multilingual.default_locale');
     if (!$defaultLocale) {
         throw new \Exception(t('You must specify a default language tree in your multilingual settings.'));
     }
     foreach ($this->multilingualSections as $section) {
         if ($section->getLocale() == $defaultLocale) {
             $defaultLanguage = $section;
         }
     }
     $session = Core::make('session');
     if ($session->has('stacksDefaultLanguageID')) {
         $section = Section::getByID($session->get('stacksDefaultLanguageID'));
         if (is_object($section)) {
             $defaultLanguage = $section;
         }
     }
     return $defaultLanguage;
 }
开发者ID:a3020,项目名称:concrete5,代码行数:21,代码来源:stacks.php

示例7: view

 public function view()
 {
     $this->requireAsset('core/sitemap');
     $list = MultilingualSection::getList();
     $sections = array();
     usort($list, function ($item) {
         if ($item->getLocale() == \Config::get('concrete.multilingual.default_locale')) {
             return -1;
         } else {
             return 1;
         }
     });
     foreach ($list as $pc) {
         $sections[$pc->getCollectionID()] = $pc->getLanguageText() . " (" . $pc->getLocale() . ")";
     }
     $this->set('sections', $sections);
     $this->set('sectionList', $list);
     if (!isset($_REQUEST['sectionID']) && count($sections) > 0) {
         foreach ($sections as $key => $value) {
             $sectionID = $key;
             break;
         }
     } else {
         $sectionID = $_REQUEST['sectionID'];
     }
     if (!isset($_REQUEST['targets']) && count($sections) > 1) {
         $i = 0;
         foreach ($sections as $key => $value) {
             if ($key != $sectionID) {
                 $targets[$key] = $key;
                 break;
             }
             $i++;
         }
     } else {
         $targets = $_REQUEST['targets'];
     }
     if (!isset($targets) || !is_array($targets)) {
         $targets = array();
     }
     $targetList = array();
     foreach ($targets as $key => $value) {
         $targetList[] = MultilingualSection::getByID($key);
     }
     $this->set('targets', $targets);
     $this->set('targetList', $targetList);
     $this->set('sectionID', $sectionID);
     $this->set('fh', \Core::make('multilingual/interface/flag'));
     if (isset($sectionID) && $sectionID > 0) {
         $pl = new MultilingualPageList();
         $pc = \Page::getByID($sectionID);
         $path = $pc->getCollectionPath();
         if (strlen($path) > 1) {
             $pl->filterByPath($path);
         }
         if ($_REQUEST['keywords']) {
             $pl->filterByName($_REQUEST['keywords']);
         }
         $pl->setItemsPerPage(25);
         if (!$_REQUEST['showAllPages']) {
             $pl->filterByMissingTargets($targetList);
         }
         $pagination = $pl->getPagination();
         $this->set('pagination', $pagination);
         $this->set('pages', $pagination->getCurrentPageResults());
         $this->set('section', MultilingualSection::getByID($sectionID));
         $this->set('pl', $pl);
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:69,代码来源:page_report.php

示例8: foreach

 foreach ($messages as $key => $p) {
     // delete the page here
     $page = unserialize($p->body);
     $oc = Page::getByID($page['cID']);
     // this is the page we're going to copy.
     // now we check to see if the parent ID of the current record has already been duplicated somewhere.
     $newCID = $db->GetOne('select cID from QueuePageDuplicationRelations where originalCID = ? and queue_name = ?', array($page['cParentID'], 'copy_page'));
     if ($newCID > 0) {
         $dc = Page::getByID($newCID);
     } else {
         $dc = Page::getByID($page['destination']);
     }
     if ($_POST['multilingual']) {
         // Find multilingual section of the destination
         if (Section::isMultilingualSection($dc)) {
             $ms = Section::getByID($dc->getCollectionID());
         } else {
             $ms = Section::getBySectionOfSite($dc);
         }
         // Is page already copied?
         $existingCID = Section::getRelatedCollectionIDForLocale($page['cID'], $ms->getLocale());
         if ($existingCID) {
             $nc = Page::getById($existingCID);
             if ($dc->getCollectionID() != $nc->getCollectionParentID()) {
                 $nc->move($dc);
             }
         } else {
             $nc = $oc->duplicate($dc);
         }
     } else {
         $nc = $oc->duplicate($dc);
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:31,代码来源:sitemap_copy_all.php

示例9: getMultilingualSection

 public function getMultilingualSection()
 {
     $db = Database::connection();
     $cID = $db->GetOne('select stMultilingualSection from Stacks where cID = ?', array($this->getCollectionID()));
     if ($cID) {
         return Section::getByID($cID);
     }
 }
开发者ID:Remo,项目名称:concrete5-1,代码行数:8,代码来源:Stack.php

示例10: t

<?php 
if (count($pages)) {
    ?>

    <fieldset>
        <legend><?php 
    echo t('Copy Locale Tree');
    ?>
</legend>
    <?php 
    $u = new User();
    $copyLocales = array();
    $includesHome = false;
    foreach ($pages as $pc) {
        $pcl = MultilingualSection::getByID($pc->getCollectionID());
        if ($pc->getCollectionID() == HOME_CID) {
            $includesHome = true;
        }
        $copyLocales[$pc->getCollectionID()] = tc('PageWithLocale', '%1$s (%2$s, %3$s)', $pc->getCollectionName(), $pcl->getLanguageText(), $pcl->getLocale());
    }
    if ($u->isSuperUser() && !$includesHome) {
        ?>
    <form method="post" id="ccm-internationalization-copy-tree" action="#">
        <?php 
        if (count($pages) > 1) {
            $copyLocaleSelect1 = $form->select('copyTreeFrom', $copyLocales);
            $copyLocaleSelect2 = $form->select('copyTreeTo', $copyLocales);
            ?>
            <p><?php 
            echo t('Copy all pages from a locale to another section. This will only copy pages that have not been associated. It will not replace or remove any pages from the destination section.');
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:30,代码来源:copy.php

示例11: count

    if (count($sections) > 0) {
        $width = 100 / count($sections);
    } else {
        $width = '100';
    }
    ?>

    <div class="table-responsive">
        <table class="ccm-search-results-table">
            <thead>
            <tr>
                <th style="width: <?php 
    echo $width;
    ?>
%"><span><?php 
    $sourceMS = \Concrete\Core\Multilingual\Page\Section\Section::getByID($sectionID);
    print t('%s (%s)', $sourceMS->getLanguageText(), $sourceMS->getLocale());
    ?>
                </span></th>
                <?php 
    foreach ($targetList as $sc) {
        ?>
                    <?php 
        if ($section->getCollectionID() != $sc->getCollectionID()) {
            ?>
                        <th style="width:<?php 
            echo $width;
            ?>
%"><span><?php 
            print $fh->getSectionFlagIcon($sc);
            print '&nbsp;';
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:31,代码来源:page_report.php

示例12: t

        ?>
</span></th>
                        <th colspan="2"><span><?php 
        echo t('Completion');
        ?>
</span></th>
                        <th><span><?php 
        echo t('Last Updated');
        ?>
</span></th>
                        <th></th>
                    </tr>
                    </thead>
                    <tbody><?php 
        foreach ($pages as $pc) {
            $pcl = \Concrete\Core\Multilingual\Page\Section\Section::getByID($pc->getCollectionID());
            ?>
<tr>
                                <td><?php 
            echo $ch->getSectionFlagIcon($pc);
            ?>
</td>
                                <td><a href="<?php 
            echo $nav->getLinkToCollection($pc);
            ?>
"><?php 
            echo $pc->getCollectionName();
            ?>
</a></td>
                                <td style="white-space: nowrap">
                                    <?php 
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:31,代码来源:translate_interface.php

示例13: translate_po

 public function translate_po($mtSectionID = false)
 {
     $this->view();
     $mtSectionID = intval($mtSectionID);
     $section = Section::getByID(intval($mtSectionID));
     if ($section) {
         $translations = $section->getSectionInterfaceTranslations();
         $this->requireAsset('core/translator');
         $this->set('section', $section);
         $jsonTranslations = array();
         $numPlurals = $section->getNumberOfPluralForms();
         foreach ($translations as $translation) {
             /* @var $translation \Concrete\Core\Multilingual\Page\Section\Translation */
             $jsonTranslation = array();
             $jsonTranslation['id'] = $translation->getRecordID();
             if ($translation->hasContext()) {
                 $jsonTranslation['context'] = $translation->getContext();
             }
             $jsonTranslation['original'] = $translation->getOriginal();
             if ($translation->hasPlural()) {
                 $jsonTranslation['originalPlural'] = $translation->getPlural();
             }
             if ($translation->hasTranslation()) {
                 $t = array($translation->getTranslation());
                 if ($numPlurals > 1 && $translation->hasPlural()) {
                     $t = array_merge($t, $translation->getPluralTranslation());
                 }
                 $jsonTranslation['translations'] = $t;
             }
             $extractedComments = '';
             if ($translation->hasExtractedComments()) {
                 $extractedComments = trim(implode("\n", $translation->getExtractedComments()));
             }
             if ($extractedComments !== '') {
                 $jsonTranslation['comments'] = $extractedComments;
             }
             if ($translation->hasReferences()) {
                 $jsonTranslation['references'] = $translation->getReferences();
             }
             $jsonTranslations[] = $jsonTranslation;
         }
         $this->set('translations', $jsonTranslations);
     } else {
         $this->redirect('/dashboard/system/multilingual/translate_interface');
     }
 }
开发者ID:digideskio,项目名称:concrete5,代码行数:46,代码来源:translate_interface.php

示例14: add_content_section

 public function add_content_section()
 {
     if (Loader::helper('validation/token')->validate('add_content_section')) {
         if (!Loader::helper('validation/numbers')->integer($this->post('pageID')) || $this->post('pageID') < 1) {
             $this->error->add(t('You must specify a page for this multilingual content section.'));
         } else {
             $pc = Page::getByID($this->post('pageID'));
         }
         if (!$this->error->has()) {
             $lc = Section::getByID($this->post('pageID'));
             if (is_object($lc)) {
                 $this->error->add(t('A multilingual section page at this location already exists.'));
             }
         }
         if (!$this->error->has()) {
             if ($this->post('msLanguage')) {
                 $combination = $this->post('msLanguage') . '_' . $this->post('msCountry');
                 $locale = Section::getByLocale($combination);
                 if (is_object($locale)) {
                     $this->error->add(t('This language/region combination already exists.'));
                 }
             }
         }
         if (!$this->error->has()) {
             Section::assign($pc, $this->post('msLanguage'), $this->post('msCountry'));
             $this->redirect('/dashboard/system/multilingual/setup', 'multilingual_content_updated');
         }
     } else {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     $this->view();
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:32,代码来源:setup.php

示例15: getMultilingualSection

 /**
  * Returns the multilingual section associated to this stack (or null if it's the language-neutral version).
  *
  * @return Section|null
  */
 public function getMultilingualSection()
 {
     $result = null;
     $msID = $this->getMultilingualSectionID();
     if ($msID !== 0) {
         $s = Section::getByID($msID);
         if ($s) {
             $result = $s;
         }
     }
     return $result;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:17,代码来源:Stack.php


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