public function import(\SimpleXMLElement $sx) { if (isset($sx->pagetemplates)) { foreach ($sx->pagetemplates->pagetemplate as $pt) { $pkg = static::getPackageObject($pt['package']); $ptt = Template::getByHandle($pt['handle']); if (!is_object($ptt)) { $ptt = Template::add((string) $pt['handle'], (string) $pt['name'], (string) $pt['icon'], $pkg, (string) $pt['internal']); } } } }
public function execute(Batch $batch) { $types = $batch->getObjectCollection('page_type'); /** * @var \PortlandLabs\Concrete5\MigrationTool\Entity\Import\PageType\PageType */ if (!$types) { return; } foreach ($types->getTypes() as $type) { if (!$type->getPublisherValidator()->skipItem()) { $pkg = null; if ($type->getPackage()) { $pkg = \Package::getByHandle($type->getPackage()); } $defaultTemplate = Template::getByHandle($type->getDefaultTemplate()); $templates = array(); if ($type->getAllowedTemplates() == 'C' || $type->getAllowedTemplates() == 'X') { foreach ($type->getTemplates() as $templateHandle) { $templates[] = Template::getByHandle($templateHandle); } } $data = array('handle' => $type->getHandle(), 'name' => $type->getName(), 'defaultTemplate' => $defaultTemplate, 'allowedtempates' => $type->getAllowedTemplates(), 'internal' => $type->getIsInternal(), 'ptLaunchInComposer' => $type->getLaunchInComposer(), 'ptIsFrequentlyAdded' => $type->getIsFrequentlyAdded(), 'templates' => $templates); $pageType = \Concrete\Core\Page\Type\Type::add($data, $pkg); foreach ($type->getLayoutSets() as $set) { $layoutSet = $pageType->addPageTypeComposerFormLayoutSet($set->getName(), $set->getDescription()); /** * @var \PortlandLabs\Concrete5\MigrationTool\Entity\Import\PageType\ComposerFormLayoutSetControl */ foreach ($set->getControls() as $controlEntity) { $controlType = \Concrete\Core\Page\Type\Composer\Control\Type\Type::getByHandle($controlEntity->getHandle()); $control = $controlType->configureFromImportHandle($controlEntity->getItemIdentifier()); $setControl = $control->addToPageTypeComposerFormLayoutSet($layoutSet, true); $setControl->updateFormLayoutSetControlRequired($controlEntity->getIsRequired()); $setControl->updateFormLayoutSetControlCustomTemplate($controlEntity->getCustomTemplate()); $setControl->updateFormLayoutSetControlCustomTemplate($controlEntity->getCustomLabel()); $setControl->updateFormLayoutSetControlDescription($controlEntity->getDescription()); } } } } }
protected function installDesktops() { $this->output(t('Installing Desktops...')); $template = Template::getByHandle('desktop'); if (!is_object($template)) { Template::add('desktop', t('Desktop'), FILENAME_PAGE_TEMPLATE_DEFAULT_ICON, null, true); } $type = \Concrete\Core\Page\Type\Type::getByHandle('core_desktop'); if (!is_object($type)) { \Concrete\Core\Page\Type\Type::add(array('handle' => 'core_desktop', 'name' => 'Desktop', 'internal' => true)); } $category = Category::getByHandle('collection')->getController(); $attribute = CollectionKey::getByHandle('is_desktop'); if (!is_object($attribute)) { $key = new PageKey(); $key->setAttributeKeyHandle('is_desktop'); $key->setAttributeKeyName('Is Desktop'); $key->setIsAttributeKeyInternal(true); $category->add('boolean', $key); } $attribute = CollectionKey::getByHandle('desktop_priority'); if (!is_object($attribute)) { $key = new PageKey(); $key->setAttributeKeyHandle('desktop_priority'); $key->setAttributeKeyName('Desktop Priority'); $key->setIsAttributeKeyInternal(true); $category->add('number', $key); } $desktop = Page::getByPath('/dashboard/welcome'); if (is_object($desktop) && !$desktop->isError()) { $desktop->moveToTrash(); } $desktop = Page::getByPath('/desktop'); if (is_object($desktop) && !$desktop->isError()) { $desktop->moveToTrash(); } $page = \Page::getByPath("/account/messages"); if (is_object($page) && !$page->isError()) { $page->moveToTrash(); } // Private Messages tweak SinglePage::add('/account/messages'); $ci = new ContentImporter(); $ci->importContentFile(DIR_BASE_CORE . '/config/install/upgrade/desktops.xml'); $desktop = Page::getByPath('/dashboard/welcome'); $desktop->movePageDisplayOrderToTop(); \Config::save('concrete.misc.login_redirect', 'DESKTOP'); }
public function getTargetItemContentObject(TargetItemInterface $targetItem) { return Template::getByHandle($targetItem->getItemID()); }
public function getContentObject() { return Template::getByHandle($this->getReference()); }
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); use Concrete\Core\Page\Template; $tmplt = Template::getByHandle('right_sidebar'); echo '<h3>' . t('Pre Install Checker') . '</h3>'; if ($tmplt && $tmplt->getPageTemplateID()) { echo '<div class="ccm-ui" id="ccm-dashboard-result-message">'; echo ' <div class="alert alert-success alert-dismissible">'; echo '<img src="' . ASSETS_URL_IMAGES . '/icons/success.png" width="16" height="16"/> <strong> ' . t('Excellent! Your theme has a right_sidebar!') . '</strong>'; echo '<br/><br/><p>' . t('Everything looks good! Go ahead and install ProBlog!') . '</p>'; echo ' </div>'; echo '</div>'; } else { echo '<div class="ccm-ui" id="ccm-dashboard-result-message">'; echo ' <div class="alert alert-danger alert-dismissible">'; echo '<img src="' . ASSETS_URL_IMAGES . '/icons/error.png" width="16" height="16"/> <strong> ' . t('No right_sidebar page template found') . '</strong>'; echo '<br/><br/><p>' . t('Danger Will Robinson!!! Your theme must have a right_sidebar page template to install!!!') . '</p>'; echo '<br/><p>' . t('Please <b><u>cancel</u></b> and register a right_sidebar page template to your theme before attempting to install ProBlog!') . '</p>'; echo ' </div>'; echo '</div>'; }
public function skipItem() { $template = Template::getByHandle($this->object->getHandle()); return is_object($template); }
public function import(\SimpleXMLElement $sx) { if (isset($sx->pages)) { $nodes = array(); $i = 0; foreach ($sx->pages->page as $p) { $p->originalPos = $i; $nodes[] = $p; ++$i; } usort($nodes, array('static', 'setupPageNodeOrder')); $siteTree = null; if (isset($this->home)) { $home = $this->home; $siteTree = $this->home->getSiteTreeObject(); } else { $home = Page::getByID(HOME_CID, 'RECENT'); } foreach ($nodes as $px) { $pkg = static::getPackageObject($px['package']); $data = array(); $user = (string) $px['user']; if ($user != '') { $ui = UserInfo::getByUserName($user); if (is_object($ui)) { $data['uID'] = $ui->getUserID(); } else { $data['uID'] = USER_SUPER_ID; } } $cDatePublic = (string) $px['public-date']; if ($cDatePublic) { $data['cDatePublic'] = $cDatePublic; } $data['pkgID'] = 0; if (is_object($pkg)) { $data['pkgID'] = $pkg->getPackageID(); } $args = array(); $ct = Type::getByHandle($px['pagetype']); $template = Template::getByHandle($px['template']); if ($px['path'] != '') { // not home page $page = Page::getByPath($px['path'], 'RECENT', $siteTree); if (!is_object($page) || $page->isError()) { $lastSlash = strrpos((string) $px['path'], '/'); $parentPath = substr((string) $px['path'], 0, $lastSlash); $data['cHandle'] = substr((string) $px['path'], $lastSlash + 1); if (!$parentPath) { $parent = $home; } else { $parent = Page::getByPath($parentPath, 'RECENT', $siteTree); } $page = $parent->add($ct, $data); } } else { $page = $home; } $args['cName'] = $px['name']; $args['cDescription'] = $px['description']; if (is_object($ct)) { $args['ptID'] = $ct->getPageTypeID(); } $args['pTemplateID'] = $template->getPageTemplateID(); $page->update($args); } } }
public function install_pb_settings() { $tmplt = Template::getByHandle('right_sidebar'); $serch = Page::getByPath('/blogsearch'); $args = array('tweet' => 1, 'fb_like' => 1, 'google' => 0, 'addthis' => 1, 'author' => 0, 'comments' => 1, 'trackback' => 1, 'canonical' => 1, 'breakSyntax' => '<hr id="horizontalrule">', 'search_path' => $serch->getCollectionID(), 'icon_color' => 'brown', 'thumb_width' => '110', 'thumb_height' => '120', 'pageTemplate' => $tmplt->getPageTemplateID()); $db = Loader::db(); $db->Execute("DELETE FROM btProBlogSettings"); $db->insert('btProBlogSettings', $args); }