public function on_start() { $method = $_SERVER['REQUEST_METHOD']; $request = split("/", substr(@$_SERVER['PATH_INFO'], 1)); $this->city = new City($this->c); // TODO: This is a pseudo-router. On 5.7 upgrade, replace with symfony switch ($method) { case 'POST': // Publish // Publish case 'PUT': // Save break; case 'GET': // Retrieve the page's json if ($_GET['format'] === 'json') { echo $this->getJson(); exit; } break; case 'DELETE': // 'unpublish' the event (true deletes done through dashboard controller, not city) $c = Page::getCurrentPage(); $c->setAttribute('exclude_page_list', true); break; } }
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 function view() { $c = \Page::getCurrentPage(); if ($this->entryMode == 'A') { $ak = CollectionKey::getByHandle($this->exEntryAttributeKeyHandle); if (is_object($ak)) { $settings = $ak->getAttributeKeySettings(); $value = $c->getAttribute($ak); if (is_object($settings)) { $this->set('entity', $settings->getEntity()); } if (is_object($value)) { $this->set('entry', $value->getSelectedEntries()[0]); } } } else { $entity = $this->entityManager->find('Concrete\\Core\\Entity\\Express\\Entity', $this->exEntityID); if (is_object($entity)) { $this->set('entity', $entity); if ($this->entryMode == 'S' && $this->exSpecificEntryID) { $this->set('entry', Express::getEntry($this->exSpecificEntryID)); } } } $form = $this->entityManager->find('Concrete\\Core\\Entity\\Express\\Form', $this->exFormID); $renderer = $this->app->make('Concrete\\Core\\Express\\Form\\StandardViewRenderer', ['form' => $form]); $this->set('renderer', $renderer); }
function __construct($obj = NULL) { parent::__construct($obj); $c = Page::getCurrentPage(); if (is_object($c)) { $this->cID = $c->getCollectionID(); } if ($this->bID) { $db = Loader::db(); $v = array($this->bID); $q = "select optionID, optionName, displayOrder from btSurveyOptions where bID = ? order by displayOrder asc"; $r = $db->query($q, $v); $this->options = array(); if ($r) { while ($row = $r->fetchRow()) { $opt = new BlockPollOption(); $opt->optionID = $row['optionID']; $opt->cID = $this->cID; $opt->optionName = $row['optionName']; $opt->displayOrder = $row['displayOrder']; $this->options[] = $opt; } } } }
public function setPermissionObject(Block $b) { $this->permissionObject = $b; // if the area overrides the collection permissions explicitly (with a one on the override column) we check if ($b->overrideAreaPermissions()) { $this->permissionObjectToCheck = $b; } else { $a = $b->getBlockAreaObject(); if (is_object($a)) { if ($a->overrideCollectionPermissions()) { $this->permissionObjectToCheck = $a; } elseif ($a->getAreaCollectionInheritID()) { $mcID = $a->getAreaCollectionInheritID(); $mc = Page::getByID($mcID, 'RECENT'); $ma = Area::get($mc, $a->getAreaHandle()); if ($ma->overrideCollectionPermissions()) { $this->permissionObjectToCheck = $ma; } else { $this->permissionObjectToCheck = $ma->getAreaCollectionObject(); } } else { $this->permissionObjectToCheck = $a->getAreaCollectionObject(); } } else { $this->permissionObjectToCheck = Page::getCurrentPage(); } } }
function view() { $nextPage = $this->getNextCollection(); $previousPage = $this->getPreviousCollection(); $parentPage = Page::getByID(Page::getCurrentPage()->getCollectionParentID()); if ($this->linkStyle == 'page_name') { $nextLinkText = !$nextPage ? '' : $nextPage->getCollectionName(); $previousLinkText = !$previousPage ? '' : $previousPage->getCollectionName(); $parentLinkText = !$parentPage ? '' : $parentPage->getCollectionName(); } else { $nextLinkText = $this->nextLabel; $previousLinkText = $this->previousLabel; $parentLinkText = $this->parentLabel; } if ($this->showArrows) { $nextLinkText = $nextLinkText . ' »'; $previousLinkText = '« ' . $previousLinkText; } $this->set('nextCollection', $nextPage); $this->set('previousCollection', $previousPage); $this->set('parentCollection', $parentPage); $this->set('nextLinkText', $nextLinkText); $this->set('previousLinkText', $previousLinkText); $this->set('parentLinkText', $parentLinkText); }
public function action($action) { $a = func_get_args(); $c = \Page::getCurrentPage(); array_unshift($a, $c); return call_user_func_array(array('\\URL', 'to'), $a); }
public function view() { $uh = Loader::helper('concrete/urls'); $bt = BlockType::getByHandle('switch_language'); Loader::model('section', 'multilingual'); $ml = MultilingualSection::getList(); $c = Page::getCurrentPage(); $al = MultilingualSection::getBySectionOfSite($c); $languages = array(); $locale = ACTIVE_LOCALE; if (is_object($al)) { $locale = $al->getLanguage(); } foreach ($ml as $m) { $languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : ''); } $this->set('languages', $languages); $this->set('languageSections', $ml); $this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch'); if (is_object($al)) { $this->set('activeLanguage', $al->getCollectionID()); } $pkg = Package::getByHandle('multilingual'); $mdl = Loader::helper('default_language', 'multilingual'); $this->set('defaultLanguage', $mdl->getSessionDefaultLocale()); $this->set('cID', $c->getCollectionID()); }
/** * @return mixed AttributeValue */ public function getContent() { $c = \Page::getCurrentPage(); $content = ""; switch ($this->attributeHandle) { case "rpv_pageName": $content = $c->getCollectionName(); break; case "rpv_pageDescription": $content = $c->getCollectionDescription(); break; case "rpv_pageDateCreated": $content = $c->getCollectionDateAdded(); break; case "rpv_pageDateLastModified": $content = $c->getCollectionDateLastModified(); break; case "rpv_pageDatePublic": $content = $c->getCollectionDatePublic(); break; default: $content = $c->getAttribute($this->attributeHandle); if (is_object($content) && get_class($content) === 'File') { $im = Loader::helper('image'); $thumb = $im->getThumbnail($content, $this->thumbnailWidth, $this->thumbnailHeight); //<-- set these 2 numbers to max width and height of thumbnails $content = "<img src=\"{$thumb->src}\" width=\"{$thumb->width}\" height=\"{$thumb->height}\" alt=\"\" />"; } break; } if (!strlen($content) && $c->isMasterCollection()) { $content = $this->getPlaceHolderText($this->attributeHandle); } return $content; }
function view(){ $c = Page::getCurrentPage(); $this->set('title', $this->title); $this->set('buttonText', $this->buttonText); $this->set('baseSearchPath', $this->baseSearchPath); //auto target is the form action that is used if none is explicity set by the user $autoTarget= $c->getCollectionPath(); /* * This code is weird. I don't know why it's here or what it does if( is_array($_REQUEST['search_paths']) ){ foreach($_REQUEST['search_paths'] as $search_path){ $autoTarget=str_replace('search_paths[]='.$search_path,'',$autoTarget); $autoTarget=str_replace('search_paths%5B%5D='.$search_path,'',$autoTarget); } } $autoTarget=str_replace('page='.$_REQUEST['page'],'',$autoTarget); $autoTarget=str_replace('submit='.$_REQUEST['submit'],'',$autoTarget); $autoTarget=str_replace(array('&&&&','&&&','&&'),'',$autoTarget); */ $resultTargetURL = ($this->resultsURL != '') ? $this->resultsURL : $autoTarget; $this->set('resultTargetURL', $resultTargetURL); //run query if display results elsewhere not set, or the cID of this page is set if( !empty($_REQUEST['query']) || isset($_REQUEST['akID'])) { $this->do_search(); } }
public function view() { $ak = $this->loadAttribute(); if ($this->displayMode == "cloud") { $type = $ak->getAttributeType(); $controller = $type->getController(); $controller->setAttributeKey($ak); $items = $controller->getOptions(); $options = new SelectAttributeTypeOptionList(); if ($this->cloudCount > 0 && $items instanceof SelectAttributeTypeOptionList && $items->count()) { $i = 1; foreach ($items as $item) { $options->add($item); if ($i >= $this->cloudCount) { break; } $i++; } } else { $options = $items; } } else { $c = Page::getCurrentPage(); $av = $c->getAttributeValueObject($ak); $controller = $ak->getController(); $options = $c->getAttribute($ak->getAttributeKeyHandle()); } if ($this->targetCID > 0) { $target = Page::getByID($this->targetCID); $this->set('target', $target); } $this->set('options', $options); $this->set('akc', $controller); $this->set('ak', $ak); }
public function action_post() { // happens through ajax $pagetype = PageType::getByID($this->ptID); if (is_object($pagetype) && $this->enablePostingFromGathering) { $ccp = new Permissions($pagetype); if ($ccp->canEditPageTypeInComposer()) { $ct = PageType::getByID($this->post('ptComposerPageTypeID')); $availablePageTypes = $pagetype->getComposerPageTypeObjects(); if (!is_object($ct) && count($availablePageTypes) == 1) { $ct = $availablePageTypes[0]; } $c = Page::getCurrentPage(); $e = $pagetype->validatePublishRequest($ct, $c); $r = new PageTypePublishResponse($e); if (!$e->has()) { $d = $pagetype->createDraft($ct); $d->setPageDraftTargetParentPageID($c->getCollectionID()); $d->saveForm(); $d->publish(); $nc = Page::getByID($d->getCollectionID(), 'RECENT'); $link = Core::make('helper/navigation')->getLinkToCollection($nc, true); $r->setRedirectURL($link); } $r->outputJSON(); } } exit; }
/** * @param \File $f * @param null $usePictureTag */ public function __construct(\File $f = null, $usePictureTag = null) { if (!is_object($f)) { return false; } if (isset($usePictureTag)) { $this->usePictureTag = $usePictureTag; } else { $this->loadPictureSettingsFromTheme(); } if ($this->usePictureTag) { if (!isset($this->theme)) { $c = \Page::getCurrentPage(); $this->theme = $c->getCollectionThemeObject(); } $sources = array(); $fallbackSrc = $f->getRelativePath(); foreach ($this->theme->getThemeResponsiveImageMap() as $thumbnail => $width) { $type = \Concrete\Core\File\Image\Thumbnail\Type\Type::getByHandle($thumbnail); if ($type != NULL) { $src = $f->getThumbnailURL($type->getBaseVersion()); $sources[] = array('src' => $src, 'width' => $width); if ($width == 0) { $fallbackSrc = $src; } } } $this->tag = \Concrete\Core\Html\Object\Picture::create($sources, $fallbackSrc); } else { // Return a simple image tag. $this->tag = \HtmlObject\Image::create($f->getRelativePath()); $this->tag->width($f->getAttribute('width')); $this->tag->height($f->getAttribute('height')); } }
public function on_page_view() { $html = Loader::helper('html'); $c = Page::getCurrentPage(); if (!$c->isEditMode()) { $this->addFooterItem('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>'); $this->addFooterItem('<script type="text/javascript"> function googleMapInit' . $this->bID . '() { try{ var latlng = new google.maps.LatLng(' . $this->latitude . ', ' . $this->longitude . '); var mapOptions = { zoom: ' . $this->zoom . ', center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false, mapTypeControl: false }; var map = new google.maps.Map(document.getElementById(\'googleMapCanvas' . $this->bID . '\'), mapOptions); var marker = new google.maps.Marker({ position: latlng, map: map }); }catch(e){alert(e.message)} } $(function() { googleMapInit' . $this->bID . '(); }); </script>'); } }
public function getServiceLink(Page $c = null) { if (!is_object($c)) { $c = \Page::getCurrentPage(); } if (is_object($c) && !$c->isError()) { $url = urlencode($c->getCollectionLink(true)); switch ($this->getHandle()) { case 'facebook': return "https://www.facebook.com/sharer/sharer.php?u={$url}"; case 'twitter': return "https://www.twitter.com/intent/tweet?url={$url}"; case 'linkedin': $title = urlencode($c->getCollectionName()); return "https://www.linkedin.com/shareArticle?mini-true&url={$url}&title={$title}"; case 'pinterest': return "https://www.pinterest.com/pin/create/button?url={$url}"; case 'google_plus': return "https://plus.google.com/share?url={$url}"; case 'reddit': return "https://www.reddit.com/submit?url={$url}"; case 'print': return "javascript:window.print();"; case 'email': $body = rawurlencode(t("Check out this article on %s:\n\n%s\n%s", Config::get('concrete.site'), $c->getCollectionName(), urldecode($url))); $subject = rawurlencode(t('Thought you\'d enjoy this article.')); return "mailto:?body={$body}&subject={$subject}"; } } }
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()); }
public function __construct() { $page = \Page::getCurrentPage(); $app = \Core::make('app'); $controller = $app->make('Concrete\\Core\\Page\\Relation\\Menu\\Item\\RelationListController', array($page)); $this->setController($controller); $this->setPosition('right'); }
public function edit() { $c = Page::getCurrentPage(); if ($c->getCollectionID() != $this->cParentID && !$this->cThis && $this->cParentID != 0) { $isOtherPage = true; $this->set('isOtherPage', true); } }
function getContentAndGenerate($align = false, $style = false, $id = null) { $c = Page::getCurrentPage(); $bID = $this->bID; $f = $this->getFileObject(); $fullPath = $f->getPath(); $relPath = $f->getRelativePath(); $size = @getimagesize($fullPath); if (empty($size)) { echo t( 'Image Not Found. '); return ''; } if ($this->maxWidth == $size[0] && $this->maxHeight == $size[1]) { $sizeStr = $size[3]; } else if (!$this->forceImageToMatchDimensions && ($this->maxWidth > 0 || $this->maxHeight > 0)) { $mw = $this->maxWidth > 0 ? $this->maxWidth : $size[0]; $mh = $this->maxHeight > 0 ? $this->maxHeight : $size[1]; $ih = Loader::helper('image'); $thumb = $ih->getThumbnail($f, $mw, $mh); $sizeStr = ' width="' . $thumb->width . '" height="' . $thumb->height . '"'; $relPath = $thumb->src; } else { $sizeStr = $size[3]; } $img = "<img border=\"0\" class=\"ccm-image-block\" alt=\"{$this->altText}\" src=\"{$relPath}\" {$sizeStr} "; $img .= ($align) ? "align=\"{$align}\" " : ''; $img .= ($style) ? "style=\"{$style}\" " : ''; if($this->fOnstateID != 0) { $fos = $this->getFileOnstateObject(); $fullPathOnstate = $f->getPath(); $sizehover = @getimagesize($fullPathOnstate); if ($this->maxWidth == $sizehover[0] && $this->maxHeight == $sizehover[1]) { $relPathHover = $fos->getRelativePath(); } else if (!$this->forceImageToMatchDimensions && ($this->maxWidth > 0 || $this->maxHeight > 0)) { $thumbHover = $ih->getThumbnail($fos, $mw, $mh); $relPathHover = $thumbHover->src; } else { $relPathHover = $fos->getRelativePath(); } $img .= " onmouseover=\"this.src = '{$relPathHover}'\" "; $img .= " onmouseout=\"this.src = '{$relPath}'\" "; } $img .= ($id) ? "id=\"{$id}\" " : ""; $img .= "/>"; $linkURL = $this->getLinkURL(); if (!empty($linkURL)) { $img = "<a href=\"{$linkURL}\">" . $img ."</a>"; } return $img; }
public function check($content, $type, $additionalArgs = array()) { if ($this->controller) { $args['ip_address'] = Loader::helper('validation/ip')->getRequestIP(); $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $args['content'] = $content; foreach ($additionalArgs as $key => $value) { $args[$key] = $value; } if (isset($args['user']) && is_object($args['user'])) { $u = $args['user']; } else { $u = new User(); } if (!isset($args['email']) && $u->isRegistered()) { $ui = UserInfo::getByID($u->getUserID()); $args['email'] = $ui->getUserEmail(); } $r = $this->controller->check($args); if ($r) { return true; } else { $c = Page::getCurrentPage(); if (is_object($c)) { $logText .= t('URL: %s', Loader::helper('navigation')->getLinkToCollection($c, true)); $logText .= "\n"; } if ($u->isRegistered()) { $logText .= t('User: %s (ID %s)', $u->getUserName(), $u->getUserID()); $logText .= "\n"; } $logText .= t('Type: %s', Loader::helper('text')->unhandle($type)); $logText .= "\n"; foreach ($args as $key => $value) { $logText .= Loader::helper('text')->unhandle($key) . ': ' . $value . "\n"; } if (Config::get('ANTISPAM_LOG_SPAM')) { Log::addEntry($logText, t('spam')); } if (Config::get('ANTISPAM_NOTIFY_EMAIL') != '') { $mh = Loader::helper('mail'); $mh->to(Config::get('ANTISPAM_NOTIFY_EMAIL')); $mh->addParameter('content', $logText); $mh->load('spam_detected'); $mh->sendMail(); } return false; } } else { return true; // return true if it passes the test } }
public function onAfterDispatch($context, &$storage) { $cms = \Core::make('app'); $statistics = $cms['zray/statistics']; $c = \Page::getCurrentPage(); $storage['general'][] = array('Version' => array('Core Version' => \Config::get('concrete.version'), 'Version Installed' => \Config::get('concrete.version_installed'), 'Database Version' => \Config::get('concrete.version_db')), 'Caching' => array('Block Cache' => \Config::get('concrete.cache.blocks') ? 'On' : 'Off', 'Asset Cache' => \Config::get('concrete.cache.assets') ? 'On' : 'Off', 'Theme CSS Cache' => \Config::get('concrete.cache.theme_css') ? 'On' : 'Off', 'Theme CSS Compressed' => \Config::get('concrete.theme.compress_preprocessor_output') ? 'On' : 'Off', 'Overrides Cache' => \Config::get('concrete.cache.overrides') ? 'On' : 'Off', 'Full Page Caching' => \Config::get('concrete.cache.pages') ? 'On' : 'Off')); foreach ($statistics->getRequestedPages() as $page) { $storage['pageRequests'][] = array('ID' => $page->getCollectionID(), 'Path' => $page->getCollectionPath(), 'Name' => $page->getCollectionName(), 'Total' => $page->getCount()); } foreach ($statistics->getRequestedConfigs() as $config) { $storage['configRequests'][] = array('Key' => $config->getKey(), 'Value' => $config->getValue(), 'Total' => $config->getCount()); } $u = new \User(); foreach ($u->getUserAccessEntityObjects() as $entity) { $storage['yourAccessEntities'][] = array('ID' => $entity->getAccessEntityID(), 'Type' => $entity->getAccessEntityTypeHandle(), 'Detail' => $entity->getAccessEntityLabel()); } $cms = \Core::make('app'); $statistics = $cms['zray/statistics']; $allBlocks = $statistics->getBlocksRetrievedForPage(); // all blocks, not just those rendered $renderedBlocks = array(); foreach ($statistics->getBlocks() as $block) { $usedCache = 'Unknown'; if (version_compare(\Config::get('concrete.version'), '5.7.5a1', '>=')) { $usedCache = $block->getUsedCache(); } $renderedBlocks[] = $block->getID(); $storage['blockRender'][] = array('bID' => $block->getID(), 'type' => $block->getType(), 'area' => $block->getAreaHandle(), 'cache' => $usedCache, 'content' => $block->getContent(), 'time' => $block->getDisplayRenderTime(), 'rendered' => true); } foreach ($allBlocks as $row) { if (!in_array($row['bID'], $renderedBlocks)) { $b = \Block::getByID($row['bID'], $c, $row['arHandle']); if (is_object($b)) { $storage['blockRender'][] = array('bID' => $b->getBlockID(), 'type' => $b->getBlockTypeHandle(), 'area' => $b->getAreaHandle(), 'rendered' => false); } } } if (version_compare(\Config::get('concrete.version'), '5.7.5a1', '>=')) { if (is_object($c)) { $cp = new \Permissions($c); $assignments = $cp->getAllAssignmentsForPage(); foreach ($assignments as $assignment) { $pk = $assignment->getPermissionKeyObject(); $obj = $pk->getPermissionObject(); if ($obj && (!isset($lastobj) || $lastobj != $obj)) { $storage['customPagePermissions'][] = array('Type' => $obj->getPermissionObjectKeyCategoryHandle(), 'Object' => $obj->getPermissionObjectIdentifier()); } $lastobj = $obj; } } } }
public function getDateLink($dateArray = null) { if ($this->cTargetID) { $c = \Page::getByID($this->cTargetID); } else { $c = \Page::getCurrentPage(); } if ($dateArray) { return \URL::page($c, $dateArray['year'], $dateArray['month']); } else { return \URL::page($c); } }
public function view() { $categories = array(); $c = Page::getCurrentPage(); $children = $c->getCollectionChildrenArray(true); foreach($children as $cID) { $nc = Page::getByID($cID, 'ACTIVE'); $ncp = new Permissions($nc); if ($ncp->canRead() && (!$nc->getAttribute('exclude_nav'))) { $categories[] = $nc; } } $this->set('categories', $categories); }
public function getLocales($sans) { $db = Loader::db(); $page = Page::getCurrentPage(); $query = $db->query('SELECT mpLocale FROM MultilingualPageRelations'); $locales = array(); while ($row = $query->FetchRow()) { if ($row['mpLocale'] != $sans) { $locales[] = $row['mpLocale']; } } return $locales; }
public function getTopicLink(\Concrete\Core\Tree\Node\Node $topic = null) { if ($this->cParentID) { $c = \Page::getByID($this->cParentID); } else { $c = \Page::getCurrentPage(); } if ($topic) { return \URL::page($c, 'topic', strtolower($topic->getTreeNodeDisplayName())); } else { return \URL::page($c); } }
public function action_submit_form() { $error = $this->validate_form($this->post()); if ($error->has()) { //Fail -- re-display the form (C5 form helpers will repopulate user's entered data for us) $this->set('errors', $error->getList()); } else { //Success -- send notification email and reload/redirect page to avoid browser warnings about re-posting content if user reloads page $this->send_notification_email($this->post()); $redirect_to_path = Page::getCurrentPage()->getCollectionPath() . '?thanks=1'; $this->redirect($redirect_to_path); } }
public function save($data) { //parent::save($data); $db = Loader::db(); $page = Page::getCurrentPage(); $cID = $page->getCollectionID(); $page = Page::getByID($cID); $page->update(array('cName' => $_REQUEST['collectionName'])); $collectionAttributes = CollectionAttributeKey::getList(); foreach ($collectionAttributes as $collectionAttribute) { if (array_key_exists($collectionAttribute->akID, $_REQUEST['akID'])) { $collectionAttribute->setAttribute($page, false); } } }
public function view() { $this->enableNativeMobile(); $categories = array(); $c = Page::getCurrentPage(); $children = $c->getCollectionChildrenArray(true); foreach ($children as $cID) { $nc = Page::getByID($cID, 'ACTIVE'); $ncp = new Permissions($nc); if ($ncp->canRead()) { $categories[] = $nc; } } $this->set('categories', $categories); }
public function view() { parent::view(); $dh = Loader::helper('concrete/dashboard'); $im = Loader::helper('image'); $c = Page::getCurrentPage(); $ui = UserInfo::getByID($c->getCollectionUserID()); if ($imAtt = $c->getAttribute('main_image')) { $this->set('headImage', $im->getThumbnail($imAtt, 800, 800)); } $this->set('isLoggedIn', $dh->canRead()); $this->set('canEdit', is_object(ComposerPage::getByID($c->getCollectionID()))); $this->set('authorName', ($first_name = $ui->getAttribute('first_name')) ? "{$first_name} {$ui->getAttribute('last_name')}" : $ui->getUserObject()->getUserName()); $this->set('publishDate', $c->getCollectionDatePublic(DATE_APP_GENERIC_MDY_FULL)); $this->set('pageType', 'blog'); }
public function on_page_view() { $html = Loader::helper('html'); $bv = new BlockView(); $bv->setBlockObject($this->getBlockObject()); $blockURL = $bv->getBlockURL(); if (Page::getCurrentPage()->isEditMode() && version_compare(APP_VERSION, '5.4.2', '<')) { $this->addHeaderItem($html->javascript("{$blockURL}/ie9fix.js")); //Fix IE9 drag-n-drop for older version of jQuery UI (C5 5.4.2 and above include updated jQuery UI that fixes IE9 problem, so we only need to do this for C5 versions up to 5.4.1.1) } if ($this->enableLightbox) { $this->addHeaderItem($html->css("{$blockURL}/fancybox/jquery.fancybox-1.3.4.css", null, array('handle' => 'jquery.fancybox', 'version' => '1.3.4'))); $this->addHeaderItem($this->generateIETransparencyCSS($blockURL)); $this->addHeaderItem($html->javascript("{$blockURL}/fancybox/jquery.fancybox-1.3.4.pack.js", null, array('handle' => 'jquery.fancybox', 'version' => '1.3.4'))); } }