本文整理汇总了PHP中Cx\Core\Core\Controller\Cx::getContentTemplateOfPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Cx::getContentTemplateOfPage方法的具体用法?PHP Cx::getContentTemplateOfPage怎么用?PHP Cx::getContentTemplateOfPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Core\Controller\Cx
的用法示例。
在下文中一共展示了Cx::getContentTemplateOfPage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showEntry
function showEntry()
{
global $_ARRAYLANG, $_CORELANG;
$this->_objTpl->setTemplate($this->pageContent, true, true);
//get ids
$intCategoryId = isset($_GET['cid']) ? intval($_GET['cid']) : 0;
$intLevelId = isset($_GET['lid']) ? intval($_GET['lid']) : 0;
$intEntryId = isset($_GET['eid']) ? intval($_GET['eid']) : 0;
// load source code if cmd value is integer
if ($this->_objTpl->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('MediaDir');
$page->setCmd('detail');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$this->_objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
//get navtree
if ($this->_objTpl->blockExists($this->moduleNameLC . 'Navtree') && ($intCategoryId != 0 || $intLevelId != 0)) {
$this->getNavtree($intCategoryId, $intLevelId);
}
if ($intEntryId != 0 && $this->_objTpl->blockExists($this->moduleNameLC . 'EntryList')) {
$objEntry = new MediaDirectoryEntry($this->moduleName);
$objEntry->getEntries($intEntryId, $intLevelId, $intCategoryId, null, null, null, 1, null, 1);
$objEntry->listEntries($this->_objTpl, 2);
$objEntry->updateHits($intEntryId);
//set meta title
$this->metaTitle .= " - " . $objEntry->arrEntries[$intEntryId]['entryFields'][0];
$this->pageTitle = $objEntry->arrEntries[$intEntryId]['entryFields'][0];
if (empty($objEntry->arrEntries)) {
$this->_objTpl->hideBlock($this->moduleNameLC . 'EntryList');
$this->_objTpl->clearVariables();
header("Location: index.php?section=" . $this->moduleName);
exit;
}
} else {
header("Location: index.php?section=" . $this->moduleName);
exit;
}
}
示例2: showCategoryView
/**
* set the placeholders for the category view
*
* @return null
*/
function showCategoryView()
{
global $_ARRAYLANG, $_CORELANG;
$this->_objTpl->setTemplate($this->pageContent, true, true);
// load source code if cmd value is integer
if ($this->_objTpl->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('Calendar');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$this->_objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
$objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
$objCategoryManager->getCategoryList();
$this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_SEARCH_TERM' => $_ARRAYLANG['TXT_CALENDAR_KEYWORD'], 'TXT_' . $this->moduleLangVar . '_FROM' => $_ARRAYLANG['TXT_CALENDAR_FROM'], 'TXT_' . $this->moduleLangVar . '_TILL' => $_ARRAYLANG['TXT_CALENDAR_TILL'], 'TXT_' . $this->moduleLangVar . '_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CAT'], 'TXT_' . $this->moduleLangVar . '_SEARCH' => $_ARRAYLANG['TXT_CALENDAR_SEARCH'], 'TXT_' . $this->moduleLangVar . '_OCLOCK' => $_ARRAYLANG['TXT_CALENDAR_OCLOCK'], $this->moduleLangVar . '_SEARCH_TERM' => isset($_GET['term']) ? contrexx_input2xhtml($_GET['term']) : '', $this->moduleLangVar . '_SEARCH_FROM' => isset($_GET['from']) ? contrexx_input2xhtml($_GET['from']) : '', $this->moduleLangVar . '_SEARCH_TILL' => isset($_GET['till']) ? contrexx_input2xhtml($_GET['till']) : '', $this->moduleLangVar . '_SEARCH_CATEGORIES' => $objCategoryManager->getCategoryDropdown(isset($_GET['catid']) ? intval($_GET['catid']) : 0, 1)));
if (isset($this->categoryId)) {
$objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory($this->categoryId);
$this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_CATEGORY_NAME' => $objCategory->name));
$this->objEventManager->showEventList($this->_objTpl);
$this->_objTpl->parse('categoryList');
} else {
foreach ($objCategoryManager->categoryList as $key => $objCategory) {
$objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($this->startDate, $this->endDate, $objCategory->id, $this->searchTerm, true, $this->needAuth, true, $this->startPos, $this->numEvents);
$objEventManager->getEventList();
$objEventManager->showEventList($this->_objTpl);
$this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_CATEGORY_NAME' => $objCategory->name));
$this->_objTpl->parse('categoryList');
}
}
}
示例3: getPage
/**
* Get page
*
* Get the livecam page
*
* @access public
* @return string
*/
function getPage()
{
$this->_objTpl->setTemplate($this->pageContent);
// load source code if cmd value is integer
if ($this->_objTpl->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('Livecam');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$this->_objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
$this->_objTpl->setVariable(array("CMD" => $this->cam));
$this->_objTpl->setGlobalVariable('LIVECAM_DATE', $this->date);
switch ($this->_action) {
case 'today':
$this->_objTpl->hideBlock('livecamPicture');
$this->_showArchive($this->date);
break;
case 'archive':
$this->_objTpl->hideBlock('livecamPicture');
$this->_showArchive($this->date);
break;
default:
$this->_objTpl->hideBlock('livecamArchive');
$this->_showPicture();
break;
}
if (isset($this->statusMessage)) {
$this->_objTpl->setVariable('LIVECAM_STATUS_MESSAGE', $this->statusMessage);
}
return $this->_objTpl->get();
}
示例4: getHeadlines
/**
* Gets the list with the headlines
*
* @global array
* @global ADONewConnection
* @global array
* @return string parsed content
*/
private function getHeadlines()
{
global $_CONFIG, $objDatabase, $_ARRAYLANG, $_LANGID;
// load source code if cmd value is integer
if ($this->_objTpl->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('News');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$this->_objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
$validToShowList = true;
$newsCategories = array();
$menuCategories = array();
$parameters = array();
$selectedCat = '';
$selectedType = '';
$selectedPublisher = '';
$selectedAuthor = '';
$newsfilter = '';
$paging = '';
$pos = 0;
$i = 0;
if (isset($_GET['pos'])) {
$pos = intval($_GET['pos']);
}
$catFromCmd = !empty($_REQUEST['cmd']) ? explode(',', $_REQUEST['cmd']) : array();
$catFromReq = !empty($_REQUEST['category']) ? explode(',', $_REQUEST['category']) : array();
if (!empty($catFromCmd)) {
$menuCategories = $this->getCatIdsFromNestedSetArray($this->getNestedSetCategories($catFromCmd));
if ($this->_objTpl->placeholderExists('NEWS_CMD')) {
$this->_objTpl->setVariable('NEWS_CMD', $_REQUEST['cmd']);
}
}
$newsCategories = $categories = !empty($catFromReq) ? $catFromReq : (!empty($catFromCmd) ? $catFromCmd : array());
if (count($newsCategories) == 1 && $this->categoryExists($newsCategories[0])) {
$selectedCat = intval($newsCategories[0]);
}
if (empty($newsCategories)) {
$newsCategories[] = $this->nestedSetRootId;
}
$newsCategories = $this->getCatIdsFromNestedSetArray($this->getNestedSetCategories($newsCategories));
if (!empty($newsCategories)) {
$newsfilter .= ' AND (`nc`.`category_id` IN (' . implode(',', $newsCategories) . '))';
}
if ($this->_objTpl->placeholderExists('NEWS_CAT_DROPDOWNMENU')) {
$catMenu = '<select onchange="this.form.submit()" name="category">' . "\n";
$catMenu .= '<option value="">' . $_ARRAYLANG['TXT_CATEGORY'] . '</option>' . "\n";
$catMenu .= $this->getCategoryMenu(!empty($menuCategories) ? $menuCategories : array(), array($selectedCat)) . "\n";
$catMenu .= '</select>' . "\n";
$this->_objTpl->setVariable('NEWS_CAT_DROPDOWNMENU', $catMenu);
}
//Filter by types
if ($this->arrSettings['news_use_types'] == 1) {
if (!empty($_REQUEST['type'])) {
$arrTypes = explode(',', $_REQUEST['type']);
if (!empty($arrTypes)) {
$newsfilter .= ' AND (`n`.`typeid` IN (' . implode(', ', contrexx_input2int($arrTypes)) . '))';
}
$selectedType = current($arrTypes);
}
if ($this->_objTpl->placeholderExists('NEWS_TYPE_DROPDOWNMENU')) {
$typeMenu = '<select onchange="this.form.submit()" name="type">' . "\n";
$typeMenu .= '<option value="" selected="selected">' . $_ARRAYLANG['TXT_TYPE'] . '</option>' . "\n";
$typeMenu .= $this->getTypeMenu($selectedType) . "\n";
$typeMenu .= '</select>' . "\n";
$this->_objTpl->setVariable('NEWS_TYPE_DROPDOWNMENU', $typeMenu);
}
}
//Filter by publisher
if (!empty($_REQUEST['publisher'])) {
$parameters['filterPublisher'] = $publisher = contrexx_input2raw($_REQUEST['publisher']);
$arrPublishers = explode(',', $publisher);
if (!empty($arrPublishers)) {
$newsfilter .= ' AND (`n`.`publisher_id` IN (' . implode(', ', contrexx_input2int($arrPublishers)) . '))';
}
$selectedPublisher = current($arrPublishers);
}
if ($this->_objTpl->placeholderExists('NEWS_PUBLISHER_DROPDOWNMENU')) {
$publisherMenu = '<select onchange="window.location=\'' . \Cx\Core\Routing\Url::fromModuleAndCmd('News', intval($_REQUEST['cmd'])) . '&publisher=\'+this.value" name="publisher">' . "\n";
$publisherMenu .= '<option value="" selected="selected">' . $_ARRAYLANG['TXT_NEWS_PUBLISHER'] . '</option>' . "\n";
$publisherMenu .= $this->getPublisherMenu($selectedPublisher, $selectedCat) . "\n";
$publisherMenu .= '</select>' . "\n";
$this->_objTpl->setVariable('NEWS_PUBLISHER_DROPDOWNMENU', $publisherMenu);
}
//Filter by Author
if (!empty($_REQUEST['author'])) {
$parameters['filterAuthor'] = $author = contrexx_input2raw($_REQUEST['author']);
$arrAuthors = explode(',', $author);
//.........这里部分代码省略.........
示例5: overview
private function overview()
{
global $_LANGID;
// load source code if cmd value is integer
if ($this->objTemplate->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('Downloads');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$this->objTemplate->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
$objDownload = new Download();
$objCategory = Category::getCategory($this->categoryId);
if ($objCategory->getId()) {
// check access permissions to selected category
if (!\Permission::checkAccess(143, 'static', true) && $objCategory->getReadAccessId() && !\Permission::checkAccess($objCategory->getReadAccessId(), 'dynamic', true) && $objCategory->getOwnerId() != $this->userId) {
// TODO: might we have to add a soft noAccess handler in case the output is meant for a regular page (not section=Downloads)
\Permission::noAccess(base64_encode(CONTREXX_SCRIPT_PATH . $this->moduleParamsJs . '&category=' . $objCategory->getId()));
}
// parse crumbtrail
$this->parseCrumbtrail($objCategory);
if ($objDownload->load(!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0) && (!$objDownload->getExpirationDate() || $objDownload->getExpirationDate() > time()) && $objDownload->getActiveStatus()) {
/* DOWNLOAD DETAIL PAGE */
$this->pageTitle = contrexx_raw2xhtml($objDownload->getName(FRONTEND_LANG_ID));
$metakeys = $objDownload->getMetakeys(FRONTEND_LANG_ID);
if ($this->arrConfig['use_attr_metakeys'] && !empty($metakeys)) {
\Env::get('cx')->getPage()->setMetakeys($metakeys);
}
$this->parseRelatedCategories($objDownload);
$this->parseRelatedDownloads($objDownload, $objCategory->getId());
$this->parseDownload($objDownload, $objCategory->getId());
// hide unwanted blocks on the detail page
if ($this->objTemplate->blockExists('downloads_category')) {
$this->objTemplate->hideBlock('downloads_category');
}
if ($this->objTemplate->blockExists('downloads_subcategory_list')) {
$this->objTemplate->hideBlock('downloads_subcategory_list');
}
if ($this->objTemplate->blockExists('downloads_file_list')) {
$this->objTemplate->hideBlock('downloads_file_list');
}
if ($this->objTemplate->blockExists('downloads_simple_file_upload')) {
$this->objTemplate->hideBlock('downloads_simple_file_upload');
}
if ($this->objTemplate->blockExists('downloads_advanced_file_upload')) {
$this->objTemplate->hideBlock('downloads_advanced_file_upload');
}
} else {
/* CATEGORY DETAIL PAGE */
$this->pageTitle = htmlentities($objCategory->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET);
// process create directory
$this->processCreateDirectory($objCategory);
// parse selected category
$this->parseCategory($objCategory);
// parse subcategories
$this->parseCategories($objCategory, array('downloads_subcategory_list', 'downloads_subcategory'), null, 'SUB');
// parse downloads of selected category
$this->parseDownloads($objCategory);
// parse upload form
$this->parseUploadForm($objCategory);
// parse create directory form
$this->parseCreateCategoryForm($objCategory);
// hide unwanted blocks on the category page
if ($this->objTemplate->blockExists('downloads_download')) {
$this->objTemplate->hideBlock('downloads_download');
}
if ($this->objTemplate->blockExists('downloads_file_detail')) {
$this->objTemplate->hideBlock('downloads_file_detail');
}
}
// hide unwanted blocks on the category/detail page
if ($this->objTemplate->blockExists('downloads_overview')) {
$this->objTemplate->hideBlock('downloads_overview');
}
if ($this->objTemplate->blockExists('downloads_most_viewed_file_list')) {
$this->objTemplate->hideBlock('downloads_most_viewed_file_list');
}
if ($this->objTemplate->blockExists('downloads_most_downloaded_file_list')) {
$this->objTemplate->hideBlock('downloads_most_downloaded_file_list');
}
if ($this->objTemplate->blockExists('downloads_most_popular_file_list')) {
$this->objTemplate->hideBlock('downloads_most_popular_file_list');
}
if ($this->objTemplate->blockExists('downloads_newest_file_list')) {
$this->objTemplate->hideBlock('downloads_newest_file_list');
}
if ($this->objTemplate->blockExists('downloads_updated_file_list')) {
$this->objTemplate->hideBlock('downloads_updated_file_list');
}
} else {
/* CATEGORY OVERVIEW PAGE */
$this->parseCategories($objCategory, array('downloads_overview', 'downloads_overview_category'), null, null, 'downloads_overview_row', array('downloads_overview_subcategory_list', 'downloads_overview_subcategory'), $this->arrConfig['overview_max_subcats']);
if (!empty($this->searchKeyword)) {
$this->parseDownloads($objCategory);
} else {
if ($this->objTemplate->blockExists('downloads_file_list')) {
$this->objTemplate->hideBlock('downloads_file_list');
//.........这里部分代码省略.........
示例6: showCategoryOverview
/**
* Shows the Overview of categories
*
* @global ADONewConnection
* @global array
* @global array
* @param var $intParentId
*/
function showCategoryOverview($intParentId = 0)
{
global $objDatabase, $_ARRAYLANG, $_CONFIG, $_CORELANG;
$intParentId = intval($intParentId);
$this->_objTpl->setTemplate($this->pageContent, true, true);
// load source code if cmd value is integer
if ($this->_objTpl->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('Gallery');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$this->_objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
$categoryProtected = $this->categoryIsProtected($intParentId);
if ($categoryProtected > 0) {
if (!\Permission::checkAccess($categoryProtected, 'dynamic', true)) {
$link = base64_encode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']);
\Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Login&cmd=noaccess&redirect=" . $link);
exit;
}
}
// hide image detail block
// $this->_objTpl->hideBlock('galleryImage');
if ($this->arrSettings['header_type'] == 'hierarchy') {
$this->_objTpl->setVariable(array('GALLERY_CATEGORY_TREE' => $this->getCategoryTree(), 'TXT_GALLERY_CATEGORY_HINT' => $_ARRAYLANG['TXT_GALLERY_CATEGORY_HINT_HIERARCHY']));
} else {
$this->_objTpl->setVariable(array('GALLERY_CATEGORY_TREE' => $this->getSiblingList(), 'TXT_GALLERY_CATEGORY_HINT' => $_ARRAYLANG['TXT_GALLERY_CATEGORY_HINT_FLAT']));
}
$objResult = $objDatabase->Execute("SELECT id, catid, path FROM " . DBPREFIX . "module_gallery_pictures " . "ORDER BY catimg ASC, sorting ASC, id ASC");
$showImageSizeOverview = $this->arrSettings['show_image_size'] == 'on';
while (!$objResult->EOF) {
$arrImageSizes[$objResult->fields['catid']][$objResult->fields['id']] = $showImageSizeOverview ? round(filesize($this->strImagePath . $objResult->fields['path']) / 1024, 2) : '';
$arrstrImagePaths[$objResult->fields['catid']][$objResult->fields['id']] = $this->strThumbnailWebPath . $objResult->fields['path'];
$objResult->MoveNext();
}
if (isset($arrImageSizes) && isset($arrstrImagePaths)) {
foreach ($arrImageSizes as $keyCat => $valueCat) {
$arrCategorySizes[$keyCat] = 0;
foreach ($valueCat as $valueImageSize) {
$arrCategorySizes[$keyCat] = $arrCategorySizes[$keyCat] + $valueImageSize;
}
}
foreach ($arrstrImagePaths as $keyCat => $valueCat) {
$arrCategoryImages[$keyCat] = 0;
$arrCategoryImageCounter[$keyCat] = 0;
foreach ($valueCat as $valuestrImagePath) {
$arrCategoryImages[$keyCat] = $valuestrImagePath;
$arrCategoryImageCounter[$keyCat] = $arrCategoryImageCounter[$keyCat] + 1;
}
}
}
//$arrCategorySizes -> Sizes of all Categories
//$arrCategoryImages -> The First Picture of each category
//$arrCategoryImageCounter -> Counts all images in one group
//begin category-paging
$intPos = isset($_GET['pos']) ? intval($_GET['pos']) : 0;
$objResult = $objDatabase->Execute('SELECT count(id) AS countValue
FROM ' . DBPREFIX . 'module_gallery_categories
WHERE pid=' . $intParentId . ' AND
status="1"
');
$this->_objTpl->setVariable(array('GALLERY_CATEGORY_PAGING' => getPaging($objResult->fields['countValue'], $intPos, '§ion=Gallery&cid=' . $intParentId . $this->strCmd, '<b>' . $_ARRAYLANG['TXT_GALLERY'] . '</b>', false, intval($_CONFIG['corePagingLimit']))));
//end category-paging
$objResult = $objDatabase->SelectLimit('SELECT *
FROM ' . DBPREFIX . 'module_gallery_categories
WHERE pid=' . $intParentId . ' AND
status="1"
ORDER BY sorting ASC', intval($_CONFIG['corePagingLimit']), $intPos);
if ($objResult->RecordCount() == 0) {
// no categories in the database, hide the output
//$this->_objTpl->hideBlock('galleryCategoryList');
} else {
$i = 1;
while (!$objResult->EOF) {
$objSubResult = $objDatabase->Execute("SELECT name, value FROM " . DBPREFIX . "module_gallery_language " . "WHERE gallery_id=" . $objResult->fields['id'] . " AND " . "lang_id=" . intval($this->langId) . " ORDER BY name ASC");
unset($arrCategoryLang);
while (!$objSubResult->EOF) {
$arrCategoryLang[$objSubResult->fields['name']] = $objSubResult->fields['value'];
$objSubResult->MoveNext();
}
if (empty($arrCategoryImages[$objResult->fields['id']])) {
// no pictures in this gallery, show the empty-image
$strName = $arrCategoryLang['name'];
$strDesc = $arrCategoryLang['desc'];
$strImage = '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=Gallery&cid=' . $objResult->fields['id'] . $this->strCmd . '" target="_self">';
$strImage .= '<img border="0" alt="' . $arrCategoryLang['name'] . '" src="modules/Gallery/View/Media/no_images.gif" /></a>';
$strInfo = $_ARRAYLANG['TXT_IMAGE_COUNT'] . ': 0';
$strInfo .= $showImageSizeOverview ? '<br />' . $_CORELANG['TXT_SIZE'] . ': 0kB' : '';
} else {
//.........这里部分代码省略.........
示例7: getPage
public function getPage($pos, $page_content)
{
global $_CONFIG, $_ARRAYLANG;
$objTpl = new \Cx\Core\Html\Sigma('.');
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTpl);
$objTpl->setErrorHandling(PEAR_ERROR_DIE);
$objTpl->setTemplate($page_content);
$objTpl->setGlobalVariable($_ARRAYLANG);
// Load main template even if we have a cmd set
if ($objTpl->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('Search');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
$term = isset($_REQUEST['term']) ? trim(contrexx_input2raw($_REQUEST['term'])) : '';
if (strlen($term) >= 3) {
$term = trim(contrexx_input2raw($_REQUEST['term']));
$this->setTerm($term);
$eventHandlerInstance = \Env::get('cx')->getEvents();
$eventHandlerInstance->triggerEvent('SearchFindContent', array($this));
if ($this->result->size() == 1) {
$arraySearchResults[] = $this->result->toArray();
} else {
$arraySearchResults = $this->result->toArray();
}
usort($arraySearchResults, function ($a, $b) {
if ($a['Score'] == $b['Score']) {
if (isset($a['Date'])) {
if ($a['Date'] == $b['Date']) {
return 0;
}
if ($a['Date'] > $b['Date']) {
return -1;
}
return 1;
}
return 0;
}
if ($a['Score'] > $b['Score']) {
return -1;
}
return 1;
});
$countResults = sizeof($arraySearchResults);
if (!is_numeric($pos)) {
$pos = 0;
}
$paging = getPaging($countResults, $pos, '&section=Search&term=' . contrexx_raw2encodedUrl($term), '<b>' . $_ARRAYLANG['TXT_SEARCH_RESULTS'] . '</b>', true);
$objTpl->setVariable('SEARCH_PAGING', $paging);
$objTpl->setVariable('SEARCH_TERM', contrexx_raw2xhtml($term));
if ($countResults > 0) {
$searchComment = sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_ORDER_BY_RELEVANCE'], contrexx_raw2xhtml($term), $countResults);
$objTpl->setVariable('SEARCH_TITLE', $searchComment);
$arraySearchOut = array_slice($arraySearchResults, $pos, $_CONFIG['corePagingLimit']);
foreach ($arraySearchOut as $details) {
// append search term to result link
$link = $details['Link'];
if (strpos($link, '?') === false) {
$link .= '?';
} else {
$link .= '&';
}
$link .= 'searchTerm=' . urlencode($term);
// parse result into template
$objTpl->setVariable(array('COUNT_MATCH' => $_ARRAYLANG['TXT_RELEVANCE'] . ' ' . $details['Score'] . '%', 'LINK' => '<b><a href="' . $link . '" title="' . contrexx_raw2xhtml($details['Title']) . '">' . contrexx_raw2xhtml($details['Title']) . '</a></b>', 'SHORT_CONTENT' => contrexx_raw2xhtml($details['Content'])));
$objTpl->parse('search_result');
}
return $objTpl->get();
}
}
$noresult = $term != '' ? sprintf($_ARRAYLANG['TXT_NO_SEARCH_RESULTS'], $term) : $_ARRAYLANG['TXT_PLEASE_ENTER_SEARCHTERM'];
$objTpl->setVariable('SEARCH_TITLE', $noresult);
return $objTpl->get();
}
示例8: showEntry
function showEntry()
{
global $_ARRAYLANG, $_CORELANG;
$this->_objTpl->setTemplate($this->pageContent, true, true);
//get ids
$intCategoryId = isset($_GET['cid']) ? intval($_GET['cid']) : 0;
$intLevelId = isset($_GET['lid']) ? intval($_GET['lid']) : 0;
$intEntryId = isset($_GET['eid']) ? intval($_GET['eid']) : 0;
// load source code if cmd value is integer
if ($this->_objTpl->placeholderExists('APPLICATION_DATA')) {
$page = new \Cx\Core\ContentManager\Model\Entity\Page();
$page->setVirtual(true);
$page->setType(\Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$page->setModule('MediaDir');
$page->setCmd('detail');
// load source code
$applicationTemplate = \Cx\Core\Core\Controller\Cx::getContentTemplateOfPage($page);
\LinkGenerator::parseTemplate($applicationTemplate);
$this->_objTpl->addBlock('APPLICATION_DATA', 'application_data', $applicationTemplate);
}
//get navtree
if ($this->_objTpl->blockExists($this->moduleNameLC . 'Navtree') && ($intCategoryId != 0 || $intLevelId != 0)) {
$this->getNavtree($intCategoryId, $intLevelId);
}
if ($intEntryId != 0 && $this->_objTpl->blockExists($this->moduleNameLC . 'EntryList')) {
$objEntry = new MediaDirectoryEntry($this->moduleName);
$objEntry->getEntries($intEntryId, $intLevelId, $intCategoryId, null, null, null, 1, null, 1);
$objEntry->listEntries($this->_objTpl, 2);
$objEntry->updateHits($intEntryId);
//set meta attributes
$entries = new MediaDirectoryEntry($this->moduleName);
$entries->getEntries($intEntryId, $intLevelId, $intCategoryId, null, null, null, 1, null, 1);
$entry = $entries->arrEntries[$intEntryId];
$objInputfields = new MediaDirectoryInputfield($entry['entryFormId'], false, $entry['entryTranslationStatus'], $this->moduleName);
$inputFields = $objInputfields->getInputfields();
$titleChanged = false;
$contentChanged = false;
foreach ($inputFields as $arrInputfield) {
$contextType = isset($arrInputfield['context_type']) ? $arrInputfield['context_type'] : '';
if (!in_array($contextType, array('title', 'content', 'image'))) {
continue;
}
$strType = isset($arrInputfield['type_name']) ? $arrInputfield['type_name'] : '';
$strInputfieldClass = "\\Cx\\Modules\\MediaDir\\Model\\Entity\\MediaDirectoryInputfield" . ucfirst($strType);
try {
$objInputfield = safeNew($strInputfieldClass, $this->moduleName);
$arrTranslationStatus = contrexx_input2int($arrInputfield['type_multi_lang']) == 1 ? $entry['entryTranslationStatus'] : null;
$arrInputfieldContent = $objInputfield->getContent($entry['entryId'], $arrInputfield, $arrTranslationStatus);
switch ($contextType) {
case 'title':
$inputfieldValue = $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'];
if ($inputfieldValue) {
$this->metaTitle .= ' - ' . $inputfieldValue;
$this->pageTitle = $inputfieldValue;
}
$titleChanged = true;
break;
case 'content':
$inputfieldValue = $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE'];
if ($inputfieldValue) {
$this->metaDescription = $inputfieldValue;
}
$contentChanged = true;
break;
case 'image':
$inputfieldValue = $arrInputfieldContent[$this->moduleLangVar . '_INPUTFIELD_VALUE_SRC'];
if ($inputfieldValue) {
$this->metaImage = $inputfieldValue;
}
break;
default:
break;
}
} catch (\Exception $e) {
\DBG::log($e->getMessage());
continue;
}
}
$firstInputfieldValue = $entries->arrEntries[$intEntryId]['entryFields'][0];
if (!$titleChanged && $firstInputfieldValue) {
$this->pageTitle = $firstInputfieldValue;
$this->metaTitle = $firstInputfieldValue;
}
if (!$contentChanged && $firstInputfieldValue) {
$this->metaDescription = $firstInputfieldValue;
}
if (empty($objEntry->arrEntries)) {
$this->_objTpl->hideBlock($this->moduleNameLC . 'EntryList');
$this->_objTpl->clearVariables();
header("Location: index.php?section=" . $this->moduleName);
exit;
}
} else {
header("Location: index.php?section=" . $this->moduleName);
exit;
}
}