public static function createDraft($ct) { $parent = Page::getByPath(COMPOSER_DRAFTS_PAGE_PATH); $data['cvIsApproved'] = 0; $p = $parent->add($ct, $data); $p->deactivate(); $db = Loader::db(); $targetPageID = 0; if ($ct->getCollectionTypeComposerPublishMethod() == 'PARENT') { $targetPageID = $ct->getCollectionTypeComposerPublishPageParentID(); } $db->Execute('insert into ComposerDrafts (cID, cpPublishParentID) values (?, ?)', array($p->getCollectionID(), $targetPageID)); $entry = ComposerPage::getByID($p->getCollectionID()); if (is_object($entry)) { // duplicate all composer blocks onto the new page and make them into new blocks $blocks = $entry->getComposerBlocks(); foreach ($blocks as $b) { $b2 = Block::getByID($b->getBlockID(), $p, $b->getAreaHandle()); $nb = $b2->duplicate($p); $b2->deleteBlock(); $b2 = $nb; } return $entry; } }
public function run() { $sp = Page::getByPath('/dashboard/users/group_sets'); if (is_object($sp) && !$sp->isError()) { $sp->setAttribute('exclude_nav', 0); } }
public function run() { if (!ENABLE_USER_PROFILES) { $membersPage = Page::getByPath('/members'); if ($membersPage instanceof Page && !$membersPage->isError()) { $membersPage->delete(); } } // Update robots.txt $delete_rules = array('Disallow: /blocks', 'Disallow: /concrete', 'Disallow: /css', 'Disallow: /js', 'Disallow: /themes', 'Disallow: /packages', 'Disallow: /updates'); $add_rules = array('Disallow: /blocks/*.php$', 'Disallow: /blocks/*.xml$', 'Disallow: /concrete/*.php$', 'Disallow: /concrete/*.xml$', 'Disallow: /packages/*.php$', 'Disallow: /packages/*.xml$', 'Disallow: /updates/*.php$', 'Disallow: /updates/*.xml$'); $robotspath = DIR_BASE . '/robots.txt'; $fh = Loader::helper('file'); if (file_exists($robotspath) && is_writable($robotspath)) { $rules = array(); $robotstxt = @file($robotspath, FILE_IGNORE_NEW_LINES); foreach ($robotstxt as $line) { $line = trim($line); if (!in_array($line, $delete_rules)) { $rules[] = $line; } } $new_rules = array_merge($rules, $add_rules); $new_robotstxt = implode("\n", $new_rules); $fh->clear($robotspath); $fh->append($robotspath, $new_robotstxt); } }
public function view() { $c = Page::getByPath('/dashboard/home'); $v = View::getInstance(); $v->disableEditing(); $v->render($c); }
public function run() { $db = Loader::db(); $cnt = $db->GetOne('select count(*) from TaskPermissions where tpHandle = ?', array('delete_user')); if ($cnt < 1) { $g3 = Group::getByID(ADMIN_GROUP_ID); $tip = TaskPermission::addTask('delete_user', t('Delete Users'), false); if (is_object($g3)) { $tip->addAccess($g3); } } Loader::model('single_page'); $sp = Page::getByPath('/dashboard/settings/multilingual'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/settings/multilingual'); $d1a->update(array('cName' => t('Multilingual Setup'))); } $sp = Page::getByPath('/dashboard/composer'); if ($sp->isError()) { $d2 = SinglePage::add('/dashboard/composer'); $d2->update(array('cName' => t('Composer Beta'), 'cDescription' => t('Write for your site.'))); } $sp = Page::getByPath('/dashboard/composer/write'); if ($sp->isError()) { $d3 = SinglePage::add('/dashboard/composer/write'); } $sp = Page::getByPath('/dashboard/composer/drafts'); if ($sp->isError()) { $d4 = SinglePage::add('/dashboard/composer/drafts'); } $sp = Page::getByPath('/dashboard/pages/types/composer'); if ($sp->isError()) { $d5 = SinglePage::add('/dashboard/pages/types/composer'); } }
public function run() { $sp = Page::getByPath('/dashboard/system/seo/excluded'); if (!is_object($sp) || $sp->isError()) { $sp = SinglePage::add('/dashboard/system/seo/excluded'); $sp->update(array('cName' => t('Excluded URL Word List'))); $sp->setAttribute('meta_keywords', 'pretty, slug'); } $bt = BlockType::getByHandle('next_previous'); if (is_object($bt)) { $bt->refresh(); } $db = Loader::db(); $columns = $db->MetaColumns('Pages'); if (isset($columns['PTID'])) { $db->Execute('alter table Pages drop column ptID'); } if (isset($columns['CTID'])) { $db->Execute('alter table Pages drop column ctID'); } $bt = BlockType::getByHandle('search'); if (is_object($bt)) { $bt->refresh(); } }
public function view($message = null, $error = null) { Loader::model('single_page'); $this->set('generated', SinglePage::getList()); if ($message && !$error) { $this->set('message', $message); } else { if ($message) { $this->error->add($message); } } if ($this->isPost()) { if ($this->token->validate('add_single_page')) { $pathToNode = SinglePage::getPathToNode($this->post('pageURL'), false); $path = SinglePage::sanitizePath($this->post('pageURL')); if (strlen($pathToNode) > 0) { // now we check to see if this is already added $pc = Page::getByPath('/' . $path, 'RECENT'); if ($pc->getError() == COLLECTION_NOT_FOUND) { SinglePage::add($this->post('pageURL')); $this->redirect('/dashboard/pages/single', t('Page Successfully Added.')); } else { $this->redirect('/dashboard/pages/single', t("That page has already been added."), 1); } } else { $this->redirect('/dashboard/pages/single', t('That specified path doesn\'t appear to be a valid static page.'), 1); } } $this->redirect('/dashboard/pages/single', $this->token->getErrorMessage(), 1); } }
public function update_profiles() { /** @var Token $token */ $token = \Core::make('token'); if (!$token->validate("update_profile")) { $this->error->add('Invalid Token.'); return; } if ($this->isPost()) { $config = $this->getSite()->getConfigRepository(); $config->save('user.profiles_enabled', $this->post('public_profiles') ? true : false); $config->save('user.gravatar.enabled', $this->post('gravatar_fallback') ? true : false); $config->save('user.gravatar.max_level', Loader::helper('security')->sanitizeString($this->post('gravatar_max_level'))); $config->save('user.gravatar.image_set', Loader::helper('security')->sanitizeString($this->post('gravatar_image_set'))); // $message = ($this->post('public_profiles')?t('Public profiles have been enabled'):t('Public profiles have been disabled.')); if ($this->post('public_profiles')) { Single::add('/members'); $c = Single::add('/members/profile'); Single::add('/members/directory'); $c->update(['cName' => 'View Profile']); $this->redirect('/dashboard/system/registration/profiles/profiles_enabled'); } else { foreach ($this->app->make('site')->getList() as $site) { foreach (['/members/directory', '/members/profile', '/members'] as $path) { $c = \Page::getByPath($path, 'RECENT', $site); $c->delete(); } } $this->redirect('/dashboard/system/registration/profiles/profiles_disabled'); } } }
protected function installSinglePages($pkg) { foreach ($this->singlePages as $path) { if (Page::getByPath($path)->getCollectionID() <= 0) { SinglePage::add($path, $pkg); } $pp = Page::getByPath($path); if (in_array($path, $this->singlePagesToExclude)) { if (is_object($pp) && !$pp->isError()) { $pp->setAttribute('exclude_nav', true); $pp->setAttribute('exclude_search_index', true); } } $title = $this->getSinglePageTitle($path); if (isset($title)) { $pp->update(array('cName' => $title)); } } $batches = \Page::getByPath('/!import_batches'); if (!is_object($batches) || $batches->isError()) { $c = SinglePage::add('/!import_batches', $pkg); $c->update(array('cName' => 'Import Batches')); $c->setOverrideTemplatePermissions(1); $c->setAttribute('icon_dashboard', 'fa fa-cubes'); $c->moveToRoot(); } }
public function __construct(Page $currentPage) { $dashboard = \Page::getByPath('/account'); $this->setTitle(t('My Account')); $this->setWrapperClass('ccm-nav-wrapper'); parent::__construct($dashboard, $currentPage); }
protected static function createPage($name, $parent = false, $type = false, $template = false) { if ($parent === false) { $parent = Page::getByID(HOME_CID); } else { if (is_string($parent)) { $parent = Page::getByPath($parent); } } if ($type === false) { $type = 1; } if (is_string($type)) { $pt = PageType::getByHandle($type); } else { $pt = PageType::getByID($type); } if ($template === false) { $template = 1; } if (is_string($template)) { $template = PageTemplate::getByHandle($template); } else { $template = PageTemplate::getByID($template); } $page = $parent->add($pt, array('cName' => $name, 'pTemplateID' => $template->getPageTemplateID())); return $page; }
public function on_start() { $c = Page::getByPath('/dashboard/blocks/stacks'); $cp = new Permissions($c); if ($cp->canViewPage()) { $c = Page::getCurrentPage(); $pcp = new Permissions($c); if (!$pcp->canViewPageVersions() || $_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare') { $cID = $c->getCollectionID(); $this->redirect('/dashboard/blocks/stacks', 'view_details', $cID); } else { $this->theme = 'dashboard'; } } else { global $c; // ugh $v = View::getInstance(); $c = new Page(); $c->loadError(COLLECTION_NOT_FOUND); $v->setCollectionObject($c); $this->c = $c; $cont = Loader::controller("/page_not_found"); $v->setController($cont); $v->render('/page_not_found'); } }
public static function addStack($stackName, $type = self::ST_TYPE_USER_ADDED) { $ct = new CollectionType(); $data = array(); $parent = Page::getByPath(STACKS_PAGE_PATH); $data = array(); $data['name'] = $stackName; if (!$stackName) { $data['name'] = t('No Name'); } $pagetype = CollectionType::getByHandle(STACKS_PAGE_TYPE); $page = $parent->add($pagetype, $data); // we have to do this because we need the area to exist before we try and add something to it. $a = Area::getOrCreate($page, STACKS_AREA_NAME); // finally we add the row to the stacks table $db = Loader::db(); $stackCID = $page->getCollectionID(); $v = array($stackName, $stackCID, $type); $db->Execute('insert into Stacks (stName, cID, stType) values (?, ?, ?)', $v); //Return the new stack return self::getByID($stackCID); }
public function run() { // Since 5.1.0 we've moved around a number of pages in the dashboard Loader::model('single_page'); // Rename Forms to Reports $p = Page::getByPath('/dashboard/form_results'); // We can only run these once so we do a check to see if that's the case. if ($p->isError()) { return false; } $p->update(array('cName' => t('Reports'), 'cDescription' => t('Get data from forms and logs.'), 'cHandle' => 'reports')); $p->rescanCollectionPath(); $p = SinglePage::getByID($p->getCollectionID()); $p->refresh(); $d3a = SinglePage::add('/dashboard/reports/forms'); $d3b = SinglePage::add('/dashboard/reports/logs'); $d3c = SinglePage::add('/dashboard/reports/database'); $d4 = Page::getByPath('/dashboard/users'); $d4a = SinglePage::add('/dashboard/users/search'); $d4b = SinglePage::add('/dashboard/users/add'); $d4c = SinglePage::add('/dashboard/users/groups'); $d4d = Page::getByPath("/dashboard/users/attributes"); $db = Loader::db(); $db->query("update Pages set cDisplayOrder = 0 where cID = ?", array($d4a->getCollectionID())); $db->query("update Pages set cDisplayOrder = 1 where cID = ?", array($d4b->getCollectionID())); $db->query("update Pages set cDisplayOrder = 2 where cID = ?", array($d4c->getCollectionID())); $db->query("update Pages set cDisplayOrder = 3 where cID = ?", array($d4d->getCollectionID())); $p = Page::getByPath('/dashboard/groups'); $p->delete(); $p = Page::getByPath('/dashboard/collection_types'); $p->update(array('cHandle' => 'pages')); $p->rescanCollectionPath(); $p = SinglePage::getByID($p->getCollectionID()); $p->refresh(); $p = Page::getByPath('/dashboard/pages/attributes'); $p->delete(); $d7a = SinglePage::add('/dashboard/pages/themes'); $d7b = SinglePage::add('/dashboard/pages/themes/add'); $d7c = SinglePage::add('/dashboard/pages/themes/inspect'); $d7d = SinglePage::add('/dashboard/pages/themes/customize'); $d7e = SinglePage::add('/dashboard/pages/themes/marketplace'); $d7f = SinglePage::add('/dashboard/pages/types'); $d7g = SinglePage::add('/dashboard/pages/types/attributes'); $d7h = SinglePage::add('/dashboard/pages/single'); $p = Page::getByPath('/dashboard/themes'); $p->delete(); $d3a->update(array('cName' => t('Form Results'), 'cDescription' => t('Get submission data.'))); $d4->update(array('cName' => t('Users and Groups'), 'cDescription' => t('Add and manage people.'))); $d4a->update(array('cName' => t('Find Users'))); $d4b->update(array('cName' => t('Add User'))); $d4c->update(array('cName' => t('Groups'))); $d4d->update(array('cName' => t('User Attributes'))); $d7 = Page::getByPath('/dashboard/pages'); $d7->update(array('cName' => t('Pages and Themes'), 'cDescription' => t('Reskin your site.'))); $d7f->update(array('cName' => t('Page Types'), 'cDescription' => t('What goes in your site.'))); $d7h->update(array('cName' => t('Single Pages'))); $p = Page::getByPath('/dashboard/logs'); $p->delete(); }
public function execute(Batch $batch) { // Has the batch already been created? If so, we move to trash. $orphaned = \Page::getByPath('/!import_batches/' . $batch->getID()); if (is_object($orphaned) && !$orphaned->isError()) { $orphaned->moveToTrash(); } }
public function __construct() { $c = Page::getByPath(STACKS_PAGE_PATH); $this->ignoreAliases = true; $this->ignorePermissions = true; $this->addToQuery('inner join Stacks on Stacks.cID = p1.cID'); $this->filterByParentID($c->getCollectionID()); $this->sortBy('p1.cDisplayOrder', 'asc'); }
public function uninstall() { $db = Loader::db(); $dashPage = Page::getByPath("/dashboard/wordpress_import"); $dashPage->delete(); $db->Execute('drop table WordpressItems'); parent::uninstall(); }
public static function replacePagePlaceHolderOnImport($match) { $cPath = $match[1]; if ($cPath) { $pc = Page::getByPath($cPath); return '{CCM:CID_' . $pc->getCollectionID() . '}'; } else { return '{CCM:CID_1}'; } }
public function execute(Batch $batch) { $this->batch = $batch; // First, create the top level page for the batch. $batches = \Page::getByPath('/!import_batches'); $type = Type::getByHandle('import_batch'); $batchParent = $batches->add($type, array('cName' => $batch->getID(), 'cHandle' => $batch->getID(), 'pkgID' => \Package::getByHandle('migration_tool')->getPackageID())); $pages = $this->getPagesOrderedForImport($batch); if (!$pages) { return; } // Now loop through all pages, and build them foreach ($pages as $page) { $data = array(); $ui = $this->getTargetItem('user', $page->getUser()); if ($ui != '') { $data['uID'] = $ui->getUserID(); } else { $data['uID'] = USER_SUPER_ID; } $cDatePublic = $page->getPublicDate(); if ($cDatePublic) { $data['cDatePublic'] = $cDatePublic; } $type = $this->getTargetItem('page_type', $page->getType()); if ($type) { $data['ptID'] = $type->getPageTypeID(); } $template = $this->getTargetItem('page_template', $page->getTemplate()); if (is_object($template)) { $data['pTemplateID'] = $template->getPageTemplateID(); } if ($page->getPackage()) { $pkg = \Package::getByHandle($page->getPackage()); if (is_object($pkg)) { $data['pkgID'] = $pkg->getPackageID(); } } // TODO exception if parent not found if ($page->getBatchPath() != '') { $lastSlash = strrpos($page->getBatchPath(), '/'); $parentPath = substr($page->getBatchPath(), 0, $lastSlash); $data['cHandle'] = substr($page->getBatchPath(), $lastSlash + 1); if (!$parentPath) { $parent = $batchParent; } else { $parent = \Page::getByPath('/!import_batches/' . $this->batch->getID() . $parentPath); } } else { $parent = $batchParent; } $data['name'] = $page->getName(); $data['cDescription'] = $page->getDescription(); $parent->add($type, $data); } }
public function precache() { $c = Page::getByPath('/dashboard/home'); $blocks = $c->getBlocks(); foreach ($blocks as $b) { $bi = $b->getInstance(); $bi->setupAndRun('view'); } Loader::helper('concrete/interface')->cacheInterfaceItems(); }
public function add($name, Folder $folder = null) { $site = \Core::make('site')->getActiveSiteForEditing(); $type = Type::getByHandle(STACK_CATEGORY_PAGE_TYPE); $parent = $folder ? $folder->getPage() : \Page::getByPath(STACKS_PAGE_PATH, 'RECENT', $site); $data = array(); $data['name'] = $name; $page = $parent->add($type, $data); return $this->application->make('Concrete\\Core\\Page\\Stack\\Folder\\Folder', array($page)); }
/** * @dataProvider commonAttributeHandles */ public function testUnsetCommonAttributes($handle) { $page = Page::getByPath('/about'); $ak = CollectionAttributeKey::getByHandle($handle); $page->clearAttribute($ak); $cav = $page->getAttributeValueObject($ak); if (is_object($cav)) { $this->fail(t("Page::clearAttribute did not delete '%s'.", $handle)); } }
public function run() { $db = Loader::db(); Loader::model('collection_attributes'); Loader::model('single_page'); Loader::model('file_version'); // Add in stuff that may have gotten missed before $p = Page::getByPath('/profile'); if ($p->isError()) { $d1 = SinglePage::add('/profile'); $d2 = SinglePage::add('/profile/edit'); $d3 = SinglePage::add('/profile/avatar'); } $p2 = Page::getByPath('/dashboard/users/registration'); if ($p2->isError()) { $d4 = SinglePage::add('/dashboard/users/registration'); } // Move any global blocks to new scrapbook page. $sc = Page::getByPath("/dashboard/scrapbook/global"); $scn = Page::getByPath('/dashboard/scrapbook'); $scu = Page::getByPath('/dashboard/scrapbook/user'); if (!$sc->isError()) { $blocks = $sc->getBlocks("Global Scrapbook"); if (count($blocks) > 0) { // we create the new shared scrapbook 1 $a = Area::getOrCreate($scn, t('Shared Scrapbook 1')); foreach($blocks as $_b) { // we move them into the area on the new page. $_b->move($scn, $a); $_b->refreshCacheAll(); } } $sc->delete(); } if (!$scu->isError()) { $scu->delete(); } //add the new collection attribute keys $cak=CollectionAttributeKey::getByHandle('header_extra_content'); if(!is_object($cak)) { CollectionAttributeKey::add('header_extra_content', t('Header Extra Content'), true, null, 'TEXT'); } $cak=CollectionAttributeKey::getByHandle('exclude_search_index'); if (!is_object($cak)) { CollectionAttributeKey::add('exclude_search_index', t('Exclude From Search Index'), true, null, 'BOOLEAN'); } //convert file tags to new format, cleaned up with leading and trailing line breaks $fileVersionsData=$db->GetAll('SELECT fID, fvID, fvTags FROM FileVersions'); foreach($fileVersionsData as $fvData){ $vals=array( FileVersion::cleanTags($fvData['fvTags']) , $fvData['fID'] , $fvData['fvID'] ); $db->query('UPDATE FileVersions SET fvTags=? WHERE fID=? AND fvID=?', $vals ); } }
/** * @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; }
public function getJSON() { $c = \Page::getByPath('/dashboard/express/entities'); $cp = new \Permissions($c); if (!$cp->canViewPage()) { throw new \Exception(t('Access Denied.')); } $entries = $this->getRequestEntries(); $data = array(); $data['entries'] = $entries; return new JsonResponse($data); }
public function configurePageTypePublishTargetFromImport($txml) { $configuration = new ParentPageConfiguration($this); $path = (string) $txml['path']; if (!$path) { $c = Page::getByID(HOME_CID); } else { $c = Page::getByPath($path); } $configuration->setParentPageID($c->getCollectionID()); return $configuration; }
/** * Gallery package is installed. Can we : * a. Override gallery/view.php in blocks/gallery.php, properly, as well as maintaining autoloaded items? * b. Override gallery/view.php in blocks/gallery/view.php. Add new autoload items to /blocks/gallery/ and ensure they are loaded * c. Setup a custom template in gallery/templates/custom_gallery_template.php, and maintain autoloaded items? * d. Setup a custom template directory at gallery/templates/custom_gallery_template/view.php, and load NEW autoloaded items? */ public function testOverridePackageViewTemplate() { //assumes /gallery exists $p = Page::getByPath('/gallery'); self::$_this = ''; self::$_this->path = DIR_REL . '\\/packages\\/gallery/i'; // a. touch(DIR_BASE . '/blocks/gallery.php'); $blocks = $p->getBlocks('Main'); $b = $blocks[0]; $bv = new BlockViewTemplate($b); $this->assertEqual($bv->getTemplate(), DIR_BASE . '/blocks/gallery.php', 'Gallery Template Test - Block view override with gallery.php'); phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php/gallery', array('BlockOverrideTests', '_testGalleryHeaderItems')); $this->assertEqual(3, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Gallery Header Test - Block view override with gallery.php'); unlink(DIR_BASE . '/blocks/gallery.php'); // b self::$_this = ''; self::$_this->path = DIR_REL . '\\/blocks\\/gallery/i'; mkdir(DIR_BASE . '/blocks/gallery'); touch(DIR_BASE . '/blocks/gallery/view.php'); touch(DIR_BASE . '/blocks/gallery/view.css'); touch(DIR_BASE . '/blocks/gallery/view.js'); $blocks = $p->getBlocks('Main'); $b = $blocks[0]; $bv = new BlockViewTemplate($b); $this->assertEqual($bv->getTemplate(), DIR_BASE . '/blocks/gallery/view.php', 'Gallery Template Test - Block view override with gallery/view.php'); phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php/gallery', array('BlockOverrideTests', '_testGalleryHeaderItems')); $this->assertEqual(2, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Gallery Header Test - Block view override with gallery/view.php and local view.css, view.js'); unlink(DIR_BASE . '/blocks/gallery/view.css'); unlink(DIR_BASE . '/blocks/gallery/view.js'); unlink(DIR_BASE . '/blocks/gallery/view.php'); rmdir(DIR_BASE . '/blocks/gallery'); // c self::$_this = ''; self::$_this->path = DIR_REL . '\\/packages\\/gallery/i'; mkdir(DIR_BASE . '/blocks/gallery'); mkdir(DIR_BASE . '/blocks/gallery/templates'); touch(DIR_BASE . '/blocks/gallery/templates/custom_gallery_template.php'); $blocks = $p->getBlocks('Main'); $b = $blocks[0]; $b->setCustomTemplate('custom_gallery_template.php'); $p = Page::getByPath('/gallery'); $blocks = $p->getBlocks('Main'); $b = $blocks[0]; $bv = new BlockViewTemplate($b); $this->assertEqual($bv->getTemplate(), DIR_BASE . '/blocks/gallery/templates/custom_gallery_template.php', 'Gallery Template Test - Custom Template view override with gallery/templates/custom_gallery_template.php'); phpQuery::browserGet(BASE_URL . DIR_REL . '/index.php/gallery', array('BlockOverrideTests', '_testGalleryHeaderItems')); $this->assertEqual(3, self::$_this->headerItem1Count + self::$_this->headerItem2Count, 'Gallery Header Test - Custom Template view override with gallery/templates/custom_gallery_template.php'); unlink(DIR_BASE . '/blocks/gallery/templates/custom_gallery_template.php'); rmdir(DIR_BASE . '/blocks/gallery/templates'); rmdir(DIR_BASE . '/blocks/gallery'); $b->setCustomTemplate(false); }
private function _upgrade(&$pkg) { Loader::model('single_page'); $oldDashboardPage = Page::getByPath('/dashboard/pages/designer_content'); if ($oldDashboardPage && is_object($oldDashboardPage) && $oldDashboardPage->getCollectionID()) { $oldDashboardPage->delete(); } $newDashboardPage = Page::getByPath('/dashboard/blocks/designer_content'); if (!$newDashboardPage || !is_object($newDashboardPage) || !$newDashboardPage->getCollectionID()) { $newDashboardPage = SinglePage::add('/dashboard/blocks/designer_content', $pkg); } $this->_setupDashboardIcon($newDashboardPage, 'icon-gift'); }
/** * Given either a path or a Page object, this is a shortcut to * 1. Grab the controller of that page. * 2. Grab the view of that controller * 3. Render that view. * 4. Exit – so we immediately stop all other output in the controller that * called render(). * @param @string|\Concrete\Core\Page\Page $var */ public function render($var) { if (!$var instanceof \Concrete\Core\Page\Page) { $var = \Page::getByPath($var); } $controller = $var->getPageController(); $controller->on_start(); $controller->runAction('view'); $controller->on_before_render(); $view = $controller->getViewObject(); print $view->render(); exit; }
public function check_for_page() { Loader::model('page'); $parent = Page::getByID($this->location); $ct = CollectionType::getByID($this->ctID); $this->path = $parent->getCollectionPath() . '/' . $this->post->page_title . '/'; $page = Page::getByPath($path); if ($page->cID > 0) { return 1; } else { return 0; } }