本文整理汇总了PHP中Cx\Core\Routing\Url类的典型用法代码示例。如果您正苦于以下问题:PHP Url类的具体用法?PHP Url怎么用?PHP Url使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Url类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHomeTopNews
function getHomeTopNews($catId = 0)
{
global $_CORELANG, $objDatabase;
$catId = intval($catId);
$i = 0;
$this->_objTemplate->setTemplate($this->_pageContent, true, true);
if ($this->_objTemplate->blockExists('newsrow')) {
$this->_objTemplate->setCurrentBlock('newsrow');
} else {
return null;
}
$newsLimit = intval($this->arrSettings['news_top_limit']);
if ($newsLimit > 50) {
//limit to a maximum of 50 news
$newsLimit = 50;
}
if ($newsLimit < 1) {
//do not get any news if 0 was specified as the limit.
$objResult = false;
} else {
//fetch news
$objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . FRONTEND_LANG_ID . "\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY\n (SELECT COUNT(*) FROM " . DBPREFIX . "module_news_stats_view WHERE news_id=tblN.id AND time>'" . date_format(date_sub(date_create('now'), date_interval_create_from_date_string(intval($this->arrSettings['news_top_days']) . ' day')), 'Y-m-d H:i:s') . "') DESC", $newsLimit);
}
if ($objResult !== false && $objResult->RecordCount()) {
while (!$objResult->EOF) {
$newsid = $objResult->fields['id'];
$newstitle = $objResult->fields['title'];
$author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']);
$publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']);
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsUrl = empty($objResult->fields['redirect']) ? \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher)));
if (!empty($image)) {
$this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage));
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->parse('news_image');
}
} else {
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail');
$this->_objTemplate->parseCurrentBlock();
$i++;
$objResult->MoveNext();
}
} else {
$this->_objTemplate->hideBlock('newsrow');
}
$this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']);
return $this->_objTemplate->get();
}
示例2: getHomeHeadlines
function getHomeHeadlines($catId = 0)
{
global $_CORELANG, $objDatabase, $_LANGID;
$i = 0;
$catId = intval($catId);
$this->_objTemplate->setTemplate($this->_pageContent, true, true);
$newsLimit = intval($this->arrSettings['news_headlines_limit']);
if ($newsLimit > 50) {
//limit to a maximum of 50 news
$newsLimit = 50;
}
if ($newsLimit < 1) {
//do not get any news if 0 was specified as the limit.
$objResult = false;
} else {
//fetch news
$objResult = $objDatabase->SelectLimit("\n SELECT DISTINCT(tblN.id) AS id,\n tblN.`date`, \n tblN.teaser_image_path,\n tblN.teaser_image_thumbnail_path,\n tblN.redirect,\n tblN.publisher,\n tblN.publisher_id,\n tblN.author,\n tblN.author_id,\n tblL.text NOT REGEXP '^(<br type=\"_moz\" />)?\$' AS newscontent,\n tblL.title AS title, \n tblL.teaser_text\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id=tblN.id\n INNER JOIN " . DBPREFIX . "module_news_rel_categories AS tblC ON tblC.news_id=tblL.news_id\n WHERE tblN.status=1" . ($catId > 0 ? " AND tblC.category_id={$catId}" : '') . "\n AND tblN.teaser_only='0'\n AND tblL.lang_id=" . $_LANGID . "\n AND tblL.is_active=1\n AND (startdate<='" . date('Y-m-d H:i:s') . "' OR startdate='0000-00-00 00:00:00')\n AND (enddate>='" . date('Y-m-d H:i:s') . "' OR enddate='0000-00-00 00:00:00')" . ($this->arrSettings['news_message_protection'] == '1' && !\Permission::hasAllAccess() ? ($objFWUser = \FWUser::getFWUserObject()) && $objFWUser->objUser->login() ? " AND (frontend_access_id IN (" . implode(',', array_merge(array(0), $objFWUser->objUser->getDynamicPermissionIds())) . ") OR userid=" . $objFWUser->objUser->getId() . ") " : " AND frontend_access_id=0 " : '') . "ORDER BY date DESC", $newsLimit);
}
if ($objResult !== false && $objResult->RecordCount() >= 0) {
while (!$objResult->EOF) {
$newsid = $objResult->fields['id'];
$newstitle = $objResult->fields['title'];
$newsCategories = $this->getCategoriesByNewsId($newsid);
$newsUrl = empty($objResult->fields['redirect']) ? empty($objResult->fields['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('News', $this->findCmdById('details', self::sortCategoryIdByPriorityId(array_keys($newsCategories), array($catId))), FRONTEND_LANG_ID, array('newsid' => $newsid)) : $objResult->fields['redirect'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle), 'headlineLink');
$htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
// in case that the message is a stub, we shall just display the news title instead of a html-a-tag with no href target
if (empty($htmlLinkTitle)) {
$htmlLinkTitle = contrexx_raw2xhtml($newstitle);
}
list($image, $htmlLinkImage, $imageSource) = self::parseImageThumbnail($objResult->fields['teaser_image_path'], $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$author = \FWUser::getParsedUserTitle($objResult->fields['author_id'], $objResult->fields['author']);
$publisher = \FWUser::getParsedUserTitle($objResult->fields['publisher_id'], $objResult->fields['publisher']);
$this->_objTemplate->setVariable(array('NEWS_ID' => $newsid, 'NEWS_CSS' => 'row' . ($i % 2 + 1), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $objResult->fields['date']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_TEASER' => nl2br($objResult->fields['teaser_text']), 'NEWS_LINK_TITLE' => $htmlLinkTitle, 'NEWS_LINK' => $htmlLink, 'NEWS_LINK_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'HEADLINE_ID' => $newsid, 'HEADLINE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objResult->fields['date']), 'HEADLINE_TEXT' => nl2br($objResult->fields['teaser_text']), 'HEADLINE_LINK' => $htmlLinkTitle, 'HEADLINE_AUTHOR' => contrexx_raw2xhtml($author)));
if (!empty($image)) {
$this->_objTemplate->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage, 'HEADLINE_IMAGE_PATH' => contrexx_raw2xhtml($objResult->fields['teaser_image_path']), 'HEADLINE_THUMBNAIL_PATH' => contrexx_raw2xhtml($imageSource)));
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->parse('news_image');
}
} else {
if ($this->_objTemplate->blockExists('news_image')) {
$this->_objTemplate->hideBlock('news_image');
}
}
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl, 'image_thumbnail');
self::parseImageBlock($this->_objTemplate, $objResult->fields['teaser_image_path'], $newstitle, $newsUrl, 'image_detail');
$this->_objTemplate->parse('headlines_row');
$i++;
$objResult->MoveNext();
}
} else {
$this->_objTemplate->hideBlock('headlines_row');
}
$this->_objTemplate->setVariable("TXT_MORE_NEWS", $_CORELANG['TXT_MORE_NEWS']);
return $this->_objTemplate->get();
}
示例3: testFileUrls
public function testFileUrls()
{
$testResult = 'file://' . getcwd();
$url = Url::fromRequest();
$this->assertEquals($testResult, $url->toString());
$this->assertEquals(getcwd(), (string) $url);
$url = Url::fromMagic($testResult);
$this->assertEquals($testResult, $url->toString());
$this->assertEquals(getcwd(), (string) $url);
}
示例4: getForm
/**
* Returns the PayPal form for initializing the payment process
* @param string $account_email The PayPal account e-mail address
* @param string $order_id The Order ID
* @param string $currency_code The Currency code
* @param string $amount The amount
* @param string $item_name The description used for the payment
* @return string The HTML code for the PayPal form
*/
static function getForm($account_email, $order_id, $currency_code, $amount, $item_name)
{
global $_ARRAYLANG;
//DBG::log("getForm($account_email, $order_id, $currency_code, $amount, $item_name): Entered");
$return = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'success', FRONTEND_LANG_ID, array('handler' => 'paypal', 'result' => '1', 'order_id' => $order_id))->toString();
$cancel_return = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'success', FRONTEND_LANG_ID, array('handler' => 'paypal', 'result' => '2', 'order_id' => $order_id))->toString();
$notify_url = \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'success', FRONTEND_LANG_ID, array('handler' => 'paypal', 'result' => '-1', 'order_id' => $order_id))->toString();
$retval = (\Cx\Core\Setting\Controller\Setting::getValue('paypal_active', 'Shop') ? '<script type="text/javascript">
// <![CDATA[
function go() { document.paypal.submit(); }
window.setTimeout("go()", 3000);
// ]]>
</script>
<form name="paypal" method="post"
action="https://www.paypal.com/ch/cgi-bin/webscr">
' : '<form name="paypal" method="post"
action="https://www.sandbox.paypal.com/ch/cgi-bin/webscr">
') . Html::getHidden('cmd', '_xclick') . Html::getHidden('business', $account_email) . Html::getHidden('item_name', $item_name) . Html::getHidden('currency_code', $currency_code) . Html::getHidden('amount', $amount) . Html::getHidden('custom', $order_id) . Html::getHidden('notify_url', $notify_url) . Html::getHidden('return', $return) . Html::getHidden('cancel_return', $cancel_return) . $_ARRAYLANG['TXT_PAYPAL_SUBMIT'] . '<br /><br />' . '<input type="submit" name="submitbutton" value="' . $_ARRAYLANG['TXT_PAYPAL_SUBMIT_BUTTON'] . "\" />\n</form>\n";
return $retval;
}
示例5: parsePage
/**
* Parses a rudimentary system log backend page
* @param \Cx\Core\Html\Sigma $template Backend template for this page
* @param array $cmd Supplied CMD
*/
public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd)
{
$em = $this->cx->getDb()->getEntityManager();
$logRepo = $em->getRepository('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log');
// @todo: parse message if no entries (template block exists already)
$parseObject = $this->getNamespace() . '\\Model\\Entity\\Log';
// set default sorting
if (!isset($_GET['order'])) {
$_GET['order'] = 'timestamp/DESC';
}
// configure view
$viewGenerator = new \Cx\Core\Html\Controller\ViewGenerator($parseObject, array('functions' => array('delete' => 'true', 'paging' => true, 'sorting' => true, 'edit' => true), 'fields' => array('id' => array('showOverview' => false), 'timestamp' => array('readonly' => true), 'severity' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
return '<span class="' . contrexx_raw2xhtml(strtolower($data)) . '_background">' . contrexx_raw2xhtml($data) . '</span>';
})), 'message' => array('readonly' => true, 'table' => array('parse' => function ($data, $rows) {
$url = clone \Cx\Core\Routing\Url::fromRequest();
$url->setMode('backend');
$url->setParam('editid', $rows['id']);
return '<a href="' . $url . '">' . contrexx_raw2xhtml($data) . '</a>';
})), 'data' => array('readonly' => true, 'showOverview' => false, 'type' => 'text'), 'logger' => array('readonly' => true))));
$template->setVariable('ENTITY_VIEW', $viewGenerator);
}
示例6: SearchFindContent
/**
* Global search event listener
* Appends the News search results to the search object
*
* @param array $eventArgs
*/
private function SearchFindContent(array $eventArgs)
{
$search = current($eventArgs);
$term_db = contrexx_raw2db($search->getTerm());
$query = "SELECT id, text AS content, title, date, redirect,\n MATCH (text,title,teaser_text) AGAINST ('%{$term_db}%') AS score\n FROM " . DBPREFIX . "module_news AS tblN\n INNER JOIN " . DBPREFIX . "module_news_locale AS tblL ON tblL.news_id = tblN.id\n WHERE ( text LIKE ('%{$term_db}%')\n OR title LIKE ('%{$term_db}%')\n OR teaser_text LIKE ('%{$term_db}%'))\n AND lang_id=" . FRONTEND_LANG_ID . "\n AND status=1\n AND is_active=1\n AND (startdate<='" . date('Y-m-d') . "' OR startdate='0000-00-00')\n AND (enddate>='" . date('Y-m-d') . "' OR enddate='0000-00-00')";
$pageUrl = function ($pageUri, $searchData) {
static $objNewsLib = null;
if (!$objNewsLib) {
$objNewsLib = new \Cx\Core_Modules\News\Controller\NewsLibrary();
}
if (empty($searchData['redirect'])) {
$newsId = $searchData['id'];
$newsCategories = $objNewsLib->getCategoriesByNewsId($newsId);
$objUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('News', $objNewsLib->findCmdById('details', array_keys($newsCategories)), FRONTEND_LANG_ID, array('newsid' => $newsId));
$pageUrlResult = $objUrl->toString();
} else {
$pageUrlResult = $searchData['redirect'];
}
return $pageUrlResult;
};
$result = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($search->getResultArray($query, 'News', '', $pageUrl, $search->getTerm()));
$search->appendResult($result);
}
示例7: _getDetailLink
/**
* Returns the Event detail page link
*
* @param object $objEvent Event object
*
* @return string link for the detail page
*/
function _getDetailLink($objEvent)
{
$url = \Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName, 'detail');
$url->setParams(array('id' => $objEvent->id, 'date' => intval($objEvent->startDate)));
if ($objEvent->external) {
$url->setParam('external', 1);
}
return (string) $url;
}
示例8: getDetail
/**
* Get a single entry view
* @param int $id
* @return string
*/
function getDetail($id)
{
global $_LANGID;
if ($this->entryArray === false) {
$this->entryArray = $this->createEntryArray();
}
$entry = $this->entryArray[$id];
$title = $entry['translation'][$_LANGID]['subject'];
$content = $this->getIntroductionText($entry['translation'][$_LANGID]['content']);
$this->_objTpl->setTemplate($this->adjustTemplatePlaceholders($this->_arrSettings['data_template_entry']));
$translation = $entry['translation'][$_LANGID];
$image = $this->getThumbnailImage($id, $translation['image'], $translation['thumbnail'], $translation['thumbnail_type']);
$lang = $_LANGID;
$width = $this->_arrSettings['data_shadowbox_width'];
$height = $this->_arrSettings['data_shadowbox_height'];
if ($entry['mode'] == "normal") {
if ($this->_arrSettings['data_entry_action'] == "content") {
$cmd = $this->_arrSettings['data_target_cmd'];
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Data', $cmd, '', array('id' => $id));
} else {
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Data', '', '', array('height' => $height, 'width' => $width, 'id' => $id, 'lang' => $lang));
}
} else {
$url = $entry['translation'][$_LANGID]['forward_url'] . '&id=' . $id;
}
$templateVars = array("TITLE" => $title, "IMAGE" => $image, "CONTENT" => $content, "HREF" => $url, "CLASS" => $this->_arrSettings['data_entry_action'] == "overlaybox" && $entry['mode'] == "normal" ? "rel=\"shadowbox;width=" . $width . ";height=" . $height . "\"" : "", "TXT_MORE" => $this->langVars['TXT_DATA_MORE']);
$this->_objTpl->setVariable($templateVars);
$this->_objTpl->parse("datalist_entry");
return $this->_objTpl->get();
}
示例9: _getNewsPreviewPage
function _getNewsPreviewPage()
{
global $objDatabase, $_ARRAYLANG;
\JS::activate('cx');
$mailTemplate = isset($_POST['newsletter_mail_template']) ? intval($_POST['newsletter_mail_template']) : '1';
$importTemplate = isset($_POST['newsletter_import_template']) ? intval($_POST['newsletter_mail_template']) : '2';
if (isset($_GET['view']) && $_GET['view'] == 'iframe') {
$selectedNews = isset($_POST['selected']) ? contrexx_input2db($_POST['selected']) : '';
$mailTemplate = isset($_POST['emailtemplate']) ? intval($_POST['emailtemplate']) : '1';
$importTemplate = isset($_POST['importtemplate']) ? intval($_POST['importtemplate']) : '2';
$HTML_TemplateSource_Import = $this->_getBodyContent($this->_prepareNewsPreview($this->GetTemplateSource($importTemplate, 'html')));
$_REQUEST['standalone'] = true;
$this->_objTpl = new \Cx\Core\Html\Sigma();
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
$this->_objTpl->setTemplate($HTML_TemplateSource_Import);
$query = ' SELECT n.id AS newsid,
n.userid AS newsuid,
n.date AS newsdate,
n.teaser_image_path,
n.teaser_image_thumbnail_path,
n.redirect,
n.publisher,
n.publisher_id,
n.author,
n.author_id,
n.catid,
nl.title AS newstitle,
nl.text AS newscontent,
nl.teaser_text,
nc.name AS name
FROM ' . DBPREFIX . 'module_news AS n
INNER JOIN ' . DBPREFIX . 'module_news_locale AS nl ON nl.news_id = n.id
INNER JOIN ' . DBPREFIX . 'module_news_categories_locale AS nc ON nc.category_id=n.catid
WHERE status = 1
AND nl.is_active=1
AND nl.lang_id=' . FRONTEND_LANG_ID . '
AND nc.lang_id=' . FRONTEND_LANG_ID . '
AND n.id IN (' . $selectedNews . ')
ORDER BY nc.name ASC, n.date DESC';
$objNews = $objDatabase->Execute($query);
$objFWUser = \FWUser::getFWUserObject();
$current_category = '';
if ($this->_objTpl->blockExists('news_list')) {
if ($objNews !== false) {
while (!$objNews->EOF) {
$this->_objTpl->setVariable(array('NEWS_CATEGORY_NAME' => $objNews->fields['name']));
if ($current_category == $objNews->fields['catid']) {
$this->_objTpl->hideBlock("news_category");
}
$current_category = $objNews->fields['catid'];
$newsid = $objNews->fields['newsid'];
$newstitle = $objNews->fields['newstitle'];
$newsUrl = empty($objNews->fields['redirect']) ? empty($objNews->fields['newscontent']) ? '' : 'index.php?section=News&cmd=details&newsid=' . $newsid : $objNews->fields['redirect'];
$newstext = ltrim(strip_tags($objNews->fields['newscontent']));
$newsteasertext = ltrim(strip_tags($objNews->fields['teaser_text']));
$newslink = \Cx\Core\Routing\Url::fromModuleAndCmd('News', 'details', '', array('newsid' => $objNews->fields['newsid']));
if ($objNews->fields['newsuid'] && ($objUser = $objFWUser->objUser->getUser($objNews->fields['newsuid']))) {
$author = htmlentities($objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET);
} else {
$author = $_ARRAYLANG['TXT_ANONYMOUS'];
}
list($image, $htmlLinkImage, $imageSource) = \Cx\Core_Modules\News\Controller\NewsLibrary::parseImageThumbnail($objNews->fields['teaser_image_path'], $objNews->fields['teaser_image_thumbnail_path'], $newstitle, $newsUrl);
$this->_objTpl->setVariable(array('NEWS_CATEGORY_NAME' => $objNews->fields['name'], 'NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $objNews->fields['newsdate']), 'NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT_DATETIME, $objNews->fields['newsdate']), 'NEWS_TITLE' => contrexx_raw2xhtml($newstitle), 'NEWS_URL' => $newslink, 'NEWS_TEASER_TEXT' => $newsteasertext, 'NEWS_TEXT' => $newstext, 'NEWS_AUTHOR' => $author));
$imageTemplateBlock = "news_image";
if (!empty($image)) {
$this->_objTpl->setVariable(array('NEWS_IMAGE' => $image, 'NEWS_IMAGE_SRC' => contrexx_raw2xhtml($imageSource), 'NEWS_IMAGE_ALT' => contrexx_raw2xhtml($newstitle), 'NEWS_IMAGE_LINK' => $htmlLinkImage));
if ($this->_objTpl->blockExists($imageTemplateBlock)) {
$this->_objTpl->parse($imageTemplateBlock);
}
} else {
if ($this->_objTpl->blockExists($imageTemplateBlock)) {
$this->_objTpl->hideBlock($imageTemplateBlock);
}
}
$this->_objTpl->parse("news_list");
$objNews->MoveNext();
}
}
$parsedNewsList = $this->_objTpl->get();
} else {
if ($objNews !== false) {
$parsedNewsList = '';
while (!$objNews->EOF) {
$content = $this->_getBodyContent($this->GetTemplateSource($importTemplate, 'html'));
$newstext = ltrim(strip_tags($objNews->fields['newscontent']));
$newsteasertext = substr(ltrim(strip_tags($objNews->fields['teaser_text'])), 0, 100);
$newslink = \Cx\Core\Routing\Url::fromModuleAndCmd('News', 'detals', '', array('newsid' => $objNews->fields['newsid']));
if ($objNews->fields['newsuid'] && ($objUser = $objFWUser->objUser->getUser($objNews->fields['newsuid']))) {
$author = htmlentities($objUser->getUsername(), ENT_QUOTES, CONTREXX_CHARSET);
} else {
$author = $_ARRAYLANG['TXT_ANONYMOUS'];
}
$search = array('[[NEWS_DATE]]', '[[NEWS_LONG_DATE]]', '[[NEWS_TITLE]]', '[[NEWS_URL]]', '[[NEWS_IMAGE_PATH]]', '[[NEWS_TEASER_TEXT]]', '[[NEWS_TEXT]]', '[[NEWS_AUTHOR]]', '[[NEWS_TYPE_NAME]]', '[[NEWS_CATEGORY_NAME]]');
$replace = array(date(ASCMS_DATE_FORMAT_DATE, $objNews->fields['newsdate']), date(ASCMS_DATE_FORMAT_DATETIME, $objNews->fields['newsdate']), $objNews->fields['newstitle'], $newslink, htmlentities($objNews->fields['teaser_image_thumbnail_path'], ENT_QUOTES, CONTREXX_CHARSET), $newsteasertext, $newstext, $author, $objNews->fields['typename'], $objNews->fields['name']);
$content = str_replace($search, $replace, $content);
if ($parsedNewsList != '') {
$parsedNewsList .= "<br/>" . $content;
} else {
$parsedNewsList = $content;
}
//.........这里部分代码省略.........
示例10: showCams
/**
* Show the cameras
*
* @access private
* @global array
* @global array
* @global array
*/
function showCams()
{
global $_ARRAYLANG, $_CONFIG, $_CORELANG;
$this->_pageTitle = $_ARRAYLANG['TXT_SETTINGS'];
$this->_objTpl->loadTemplateFile('module_livecam_cams.html');
$amount = $this->arrSettings['amount_of_cams'];
$cams = $this->getCamSettings();
$this->_objTpl->setGlobalVariable(array('TXT_SETTINGS' => $_ARRAYLANG['TXT_SETTINGS'], 'TXT_CURRENT_IMAGE_URL' => $_ARRAYLANG['TXT_CURRENT_IMAGE_URL'], 'TXT_ARCHIVE_PATH' => $_ARRAYLANG['TXT_ARCHIVE_PATH'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_THUMBNAIL_PATH' => $_ARRAYLANG['TXT_THUMBNAIL_PATH'], 'TXT_SHADOWBOX_ACTIVE' => $_CORELANG['TXT_ACTIVATED'], 'TXT_SHADOWBOX_INACTIVE' => $_CORELANG['TXT_DEACTIVATED'], 'TXT_ACTIVATE_SHADOWBOX' => $_ARRAYLANG['TXT_ACTIVATE_SHADOWBOX'], 'TXT_ACTIVATE_SHADOWBOX_INFO' => $_ARRAYLANG['TXT_ACTIVATE_SHADOWBOX_INFO'], 'TXT_MAKE_A_FRONTEND_PAGE' => $_ARRAYLANG['TXT_MAKE_A_FRONTEND_PAGE'], 'TXT_CURRENT_IMAGE_MAX_SIZE' => $_ARRAYLANG['TXT_CURRENT_IMAGE_MAX_SIZE'], 'TXT_THUMBNAIL_MAX_SIZE' => $_ARRAYLANG['TXT_THUMBNAIL_MAX_SIZE'], 'TXT_CAM' => $_ARRAYLANG['TXT_CAM'], 'TXT_SUCCESS' => $_CORELANG['TXT_SETTINGS_UPDATED'], 'TXT_TO_MODULE' => $_ARRAYLANG['TXT_LIVECAM_TO_MODULE'], 'TXT_SHOWFROM' => $_ARRAYLANG['TXT_LIVECAM_SHOWFROM'], 'TXT_SHOWTILL' => $_ARRAYLANG['TXT_LIVECAM_SHOWTILL'], 'TXT_OCLOCK' => $_ARRAYLANG['TXT_LIVECAM_OCLOCK']));
for ($i = 1; $i <= $amount; $i++) {
if ($cams[$i]['shadowboxActivate'] == 1) {
$shadowboxActive = 'checked="checked"';
$shadowboxInctive = '';
} else {
$shadowboxActive = '';
$shadowboxInctive = 'checked="checked"';
}
try {
// fetch CMD specific livecam page
$camUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Livecam', $i, FRONTEND_LANG_ID, array(), '', false);
} catch (\Cx\Core\Routing\UrlException $e) {
// fetch generic livecam page
$camUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Livecam');
}
$this->_objTpl->setVariable(array('CAM_NUMBER' => $i, 'LIVECAM_CAM_URL' => $camUrl, 'CURRENT_IMAGE_URL' => $cams[$i]['currentImagePath'], 'ARCHIVE_PATH' => $cams[$i]['archivePath'], 'THUMBNAIL_PATH' => $cams[$i]['thumbnailPath'], 'SHADOWBOX_ACTIVE' => $shadowboxActive, 'SHADOWBOX_INACTIVE' => $shadowboxInctive, 'CURRENT_IMAGE_MAX_SIZE' => $cams[$i]['maxImageWidth'], 'THUMBNAIL_MAX_SIZE' => $cams[$i]['thumbMaxSize'], 'HOUR_FROM' => $this->getHourOptions($cams[$i]['showFrom']), 'MINUTE_FROM' => $this->getMinuteOptions($cams[$i]['showFrom']), 'HOUR_TILL' => $this->getHourOptions(!empty($cams[$i]['showTill']) ? $cams[$i]['showTill'] : mktime(23)), 'MINUTE_TILL' => $this->getMinuteOptions(!empty($cams[$i]['showTill']) ? $cams[$i]['showTill'] : mktime(0, 59))));
if (preg_match("/^https{0,1}:\\/\\//", $cams[$i]['currentImagePath'])) {
$filepath = $cams[$i]['currentImagePath'];
$this->_objTpl->setVariable("PATH", $filepath);
$this->_objTpl->parse("current_image");
} else {
$filepath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsitePath() . $cams[$i]['currentImagePath'];
if (\Cx\Lib\FileSystem\FileSystem::exists($filepath) && is_file($filepath)) {
$this->_objTpl->setVariable("PATH", $cams[$i]['currentImagePath']);
$this->_objTpl->parse("current_image");
} else {
$this->_objTpl->hideBlock("current_image");
}
}
$this->_objTpl->parse("cam");
/*
$this->_objTpl->setVariable('BLOCK_USE_BLOCK_SYSTEM', $_CONFIG['blockStatus'] == '1' ? 'checked="checked"' : '');
*/
}
}
示例11: testTargetPathAndParams
public function testTargetPathAndParams()
{
return false;
$this->insertFixtures();
$lang = 1;
$url = new Url('http://example.com/testpage1/testpage1_child/?foo=test');
$resolver = new Resolver($url, $lang, self::$em, '', $this->mockFallbackLanguages);
$resolver->resolve();
$this->assertEquals('testpage1/testpage1_child/', $url->getTargetPath());
$this->assertEquals('?foo=test', $url->getParams());
$this->assertEquals(true, $url->isRouted());
}
示例12: fetch
/**
* Uses the given Entity Manager to retrieve all links for the placeholders
* @param EntityManager $em
*/
public function fetch($em)
{
if ($this->placeholders === null) {
throw new LinkGeneratorException('Seems like scan() was never called before calling fetch().');
}
$qb = $em->createQueryBuilder();
$qb->add('select', new Doctrine\ORM\Query\Expr\Select(array('p')));
$qb->add('from', new Doctrine\ORM\Query\Expr\From('Cx\\Core\\ContentManager\\Model\\Entity\\Page', 'p'));
//build a big or with all the node ids and pages
$arrExprs = null;
$fetchedPages = array();
$pIdx = 0;
foreach ($this->placeholders as $placeholder => $data) {
if ($data['type'] == 'id') {
# page is referenced by NODE-ID (i.e.: [[NODE_1]])
if (isset($fetchedPages[$data['nodeid']][$data['lang']])) {
continue;
}
$arrExprs[] = $qb->expr()->andx($qb->expr()->eq('p.node', $data['nodeid']), $qb->expr()->eq('p.lang', $data['lang']));
$fetchedPages[$data['nodeid']][$data['lang']] = true;
} else {
# page is referenced by module (i.e.: [[NODE_SHOP_CART]])
if (isset($fetchedPages[$data['module']][$data['cmd']][$data['lang']])) {
continue;
}
$arrExprs[] = $qb->expr()->andx($qb->expr()->eq('p.type', ':type'), $qb->expr()->eq('p.module', ':module_' . $pIdx), $qb->expr()->eq('p.cmd', ':cmd_' . $pIdx), $qb->expr()->eq('p.lang', $data['lang']));
$qb->setParameter('module_' . $pIdx, $data['module']);
$qb->setParameter('cmd_' . $pIdx, empty($data['cmd']) ? null : $data['cmd']);
$qb->setParameter('type', \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION);
$fetchedPages[$data['module']][$data['cmd']][$data['lang']] = true;
$pIdx++;
}
}
//fetch the nodes if there are any in the query
if ($arrExprs) {
foreach ($arrExprs as $expr) {
$qb->orWhere($expr);
}
$pages = $qb->getQuery()->getResult();
foreach ($pages as $page) {
// build placeholder's value -> URL
$url = \Cx\Core\Routing\Url::fromPage($page);
$placeholderByApp = '';
$placeholderById = \Cx\Core\ContentManager\Model\Entity\Page::PLACEHOLDER_PREFIX . $page->getNode()->getId();
$this->placeholders[$placeholderById . '_' . $page->getLang()] = $url;
if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION) {
$module = $page->getModule();
$cmd = $page->getCmd();
$placeholderByApp = \Cx\Core\ContentManager\Model\Entity\Page::PLACEHOLDER_PREFIX;
$placeholderByApp .= strtoupper($module . (empty($cmd) ? '' : '_' . $cmd));
$this->placeholders[$placeholderByApp . '_' . $page->getLang()] = $url;
}
if ($page->getLang() == FRONTEND_LANG_ID) {
$this->placeholders[$placeholderById] = $url;
if (!empty($placeholderByApp)) {
$this->placeholders[$placeholderByApp] = $url;
}
}
}
}
// there might be some placeholders we were unable to resolve.
// try to resolve them by using the fallback-language-reverse-lookup
// methode provided by \Cx\Core\Routing\Url::fromModuleAndCmd().
foreach ($this->placeholders as $placeholder => $data) {
if (!$data instanceof \Cx\Core\Routing\Url) {
if (!empty($data['module'])) {
try {
$url = \Cx\Core\Routing\Url::fromModuleAndCmd($data['module'], $data['cmd'], $data['lang'], array(), '', false);
if ($this->absoluteUris && $this->domain) {
$url->setDomain($this->domain);
}
$this->placeholders[$placeholder] = $url->toString($this->absoluteUris);
} catch (\Cx\Core\Routing\UrlException $e) {
if ($data['lang'] && $data['cmd']) {
$url = \Cx\Core\Routing\Url::fromModuleAndCmd($data['module'], $data['cmd'] . '_' . $data['lang'], FRONTEND_LANG_ID);
if ($this->absoluteUris && $this->domain) {
$url->setDomain($this->domain);
}
$this->placeholders[$placeholder] = $url->toString($this->absoluteUris);
} else {
if ($data['lang'] && empty($data['cmd'])) {
$url = \Cx\Core\Routing\Url::fromModuleAndCmd($data['module'], $data['lang'], FRONTEND_LANG_ID);
if ($this->absoluteUris && $this->domain) {
$url->setDomain($this->domain);
}
$this->placeholders[$placeholder] = $url->toString($this->absoluteUris);
} else {
$url = \Cx\Core\Routing\Url::fromModuleAndCmd('Error', '', $data['lang']);
if ($this->absoluteUris && $this->domain) {
$url->setDomain($this->domain);
}
$this->placeholders[$placeholder] = $url->toString($this->absoluteUris);
}
}
}
} else {
//.........这里部分代码省略.........
示例13: appendVgParam
/**
* Appends a VG-style parameter to an Url object
*
* VG-style means:
* {<vgIncrementNumber>,(<key>=)<value>}(,...)
* @param \Cx\Core\Routing\Url $url Url object to apply params to
* @param int $vgId ID of the VG for the parameter
* @param string $name Parameter name
* @param string $value Parameter value
*/
protected static function appendVgParam($url, $vgId, $name, $value)
{
$params = $url->getParamArray();
$pre = '';
if (isset($params[$name])) {
$pre = $params[$name];
}
if (!empty($pre)) {
$pre .= ',';
}
$url->setParam($name, $pre . '{' . $vgId . ',' . $value . '}');
}
示例14: getSubstitutionArray
/**
* Returns an array of values to be substituted
*
* Contains the following keys and values:
* 'SHOP_COMPANY' => The company name (from the settings)
* 'SHOP_HOMEPAGE' => The shop starting page URL
* Used primarily for all MailTemplates.
* Indexed by placeholder names.
* @return array The substitution array
*/
static function getSubstitutionArray()
{
return array('SHOP_COMPANY' => \Cx\Core\Setting\Controller\Setting::getValue('company', 'Shop'), 'SHOP_HOMEPAGE' => \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', '', FRONTEND_LANG_ID)->toString());
}
示例15: showThreeBoxes
/**
* Performs the box view
*
* @return null
*/
function showThreeBoxes()
{
global $_ARRAYLANG;
$objEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager($this->startDate, $this->endDate, $this->categoryId, $this->searchTerm, true, $this->needAuth, true, 0, 'n', $this->sortDirection, true, $this->author);
$objEventManager->getEventList();
$this->_objTpl->setTemplate($this->pageContent);
if ($_REQUEST['cmd'] == 'boxes') {
$objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString() . "?act=list";
$objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', 'boxes')->toString();
} else {
$objEventManager->calendarBoxUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString() . "?act=list";
$objEventManager->calendarBoxMonthNavUrl = \Cx\Core\Routing\Url::fromModuleAndCmd('Calendar', '')->toString();
}
if (empty($_GET['catid'])) {
$catid = 0;
} else {
$catid = $_GET['catid'];
}
if (isset($_GET['yearID']) && isset($_GET['monthID']) && isset($_GET['dayID'])) {
$day = $_GET['dayID'];
$month = $_GET['monthID'];
$year = $_GET['yearID'];
} elseif (isset($_GET['yearID']) && isset($_GET['monthID']) && !isset($_GET['dayID'])) {
$day = 0;
$month = $_GET['monthID'];
$year = $_GET['yearID'];
} elseif (isset($_GET['yearID']) && !isset($_GET['monthID']) && !isset($_GET['dayID'])) {
$day = 0;
$month = 0;
$year = $_GET['yearID'];
} else {
$day = date("d");
$month = date("m");
$year = date("Y");
}
$calendarbox = $objEventManager->getBoxes($this->boxCount, $year, $month, $day, $catid);
$objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
$objCategoryManager->getCategoryList();
$this->_objTpl->setVariable(array("TXT_{$this->moduleLangVar}_ALL_CAT" => $_ARRAYLANG['TXT_CALENDAR_ALL_CAT'], "{$this->moduleLangVar}_BOX" => $calendarbox, "{$this->moduleLangVar}_JAVA_SCRIPT" => $objEventManager->getCalendarBoxJS(), "{$this->moduleLangVar}_CATEGORIES" => $objCategoryManager->getCategoryDropdown($catid, 1)));
}