本文整理汇总了PHP中Concrete\Core\Multilingual\Page\Section\Section类的典型用法代码示例。如果您正苦于以下问题:PHP Section类的具体用法?PHP Section怎么用?PHP Section使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Section类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: view
public function view()
{
$this->requireAsset('core/sitemap');
$mlist = Section::getList();
$ml = array();
$currentSection = Section::getCurrentSection();
foreach ($mlist as $m) {
if ($m->getCollectionID() != $currentSection->getCollectionID()) {
$ml[] = $m;
}
}
$this->set('list', $ml);
$this->set('currentSection', $currentSection);
$this->set('ih', Core::make('multilingual/interface/flag'));
$multilingualController = Core::make('\\Concrete\\Controller\\Backend\\Page\\Multilingual');
$multilingualController->setPageObject($this->page);
$this->set('multilingualController', $multilingualController);
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:18,代码来源:multilingual.php
示例18: 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
示例19: 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
示例20: load
protected function load()
{
parent::load();
$this->set('stIDNeutral', null);
$stack = Stack::getByID($this->stID);
if ($stack && $stack->isNeutralStack()) {
$detector = isset($this->app) ? $this->app->make('multilingual/detector') : \Core::make('multilingual/detector');
/* @var \Concrete\Core\Multilingual\Service\Detector $detector */
if ($detector->isEnabled()) {
$section = Section::getCurrentSection();
if ($section) {
$localized = $stack->getLocalizedStack($section);
if ($localized) {
$this->stIDNeutral = $this->stID;
$this->stID = $localized->getCollectionID();
$this->set('stIDNeutral', $this->stIDNeutral);
$this->set('stID', $this->stID);
}
}
}
}
}
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:22,代码来源:controller.php
注:本文中的Concrete\Core\Multilingual\Page\Section\Section类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论