本文整理汇总了PHP中Cx\Core\Html\Sigma::setVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP Sigma::setVariable方法的具体用法?PHP Sigma::setVariable怎么用?PHP Sigma::setVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Html\Sigma
的用法示例。
在下文中一共展示了Sigma::setVariable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parsePage
/**
* Use this to parse your backend page
*
* You will get the template located in /View/Template/{CMD}.html
* You can access Cx class using $this->cx
* To show messages, use \Message class
*
* @param \Cx\Core\Html\Sigma $template Template for current CMD
* @param array $cmd CMD separated by slashes
*/
public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd)
{
$uploader = new Uploader();
$uploader->setFinishedCallback('\\Cx\\Core_Modules\\Uploader\\Model\\DefaultUploadCallback');
$uploader->setCallback('gallery.uploader');
$template->setVariable('UPLOADER_CODE', $uploader->getXHtml('Open Uploader 1'));
$uploader2 = new Uploader();
$uploader2->setUploadLimit(1);
$uploader2->setFinishedCallback('\\Cx\\Core_Modules\\Uploader\\Model\\DefaultUploadCallback');
$uploader2->setCallback('gallery.uploader2');
$uploader2->setType(Uploader::UPLOADER_TYPE_INLINE);
$template->setVariable('UPLOADER_CODE2', $uploader2->getXHtml('Open Uploader 2'));
$configurations = array(array(), array('startview' => 'sitestructure', 'views' => 'sitestructure'), array('views' => 'uploader'), array('views' => 'sitestructure'), array('views' => 'filebrowser'), array('startmediatype' => 'gallery'), array('mediatypes' => 'gallery, files'), array('multipleselect' => true), array('data-cx-Mb-Cb-Js-modalopened' => 'testfunction'));
foreach ($configurations as $configuration) {
$mediaBrowser = new MediaBrowser();
$mediaBrowser->setOptions($configuration);
$mediaBrowser->setCallback('gallery.fancyCallback');
$template->setVariable('MEDIABROWSER_CODE', $mediaBrowser->getXHtml('MediaBrowser'));
$template->setVariable('MEDIABROWSER_OPTIONS', var_export($configuration, true));
$template->setVariable('MEDIABROWSER_CODE_RAW', htmlspecialchars($mediaBrowser->getXHtml('MediaBrowser')));
$template->parse('mediabrowser_demo');
}
$template->setVariable('MEDIABROWSER_FOLDER_WIDGET', new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($this->cx->getWebsiteImagesContentPath()));
$template->setVariable('MEDIABROWSER_FOLDER_WIDGET_VIEW_MODE', new \Cx\Core_Modules\MediaBrowser\Model\Entity\FolderWidget($this->cx->getWebsiteImagesContentPath(), true));
}
示例2: renderOptionField
/**
* Render the option field in the backend.
*
* @param Sigma $template
*/
public function renderOptionField($template)
{
$subTemplate = new Sigma();
$subTemplate->loadTemplateFile($this->cx->getCodeBaseCoreModulePath() . '/TemplateEditor/View/Template/Backend/AreaOption.html');
$subTemplate->setVariable('TEMPLATEEDITOR_OPTION_VALUE', $this->active ? 'checked' : '');
$subTemplate->setVariable('TEMPLATEEDITOR_OPTION_NAME', $this->name);
$subTemplate->setVariable('TEMPLATEEDITOR_OPTION_HUMAN_NAME', $this->humanName);
$template->setVariable('TEMPLATEEDITOR_OPTION', $subTemplate->get());
$template->setVariable('TEMPLATEEDITOR_OPTION_TYPE', 'area');
$template->parse('option');
}
示例3: showPrices
public function showPrices()
{
global $_ARRAYLANG;
$prices = $this->priceRepository->findAll();
if (empty($prices)) {
$prices = new \Cx\Modules\Pim\Model\Entity\Price();
}
$view = new \Cx\Core\Html\Controller\ViewGenerator($prices, array('header' => $_ARRAYLANG['TXT_MODULE_PIM_ACT_PRICE'], 'validate' => function ($formGenerator) {
// this validation checks whether already a price for the currency and product exists
$data = $formGenerator->getData()->toArray();
$currency = $data['currency'];
$product = $data['product'];
$priceRepository = \Env::get('cx')->getDb()->getEntityManager()->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Price');
$prices = $priceRepository->createQueryBuilder('p')->where('p.currency = ?1')->setParameter(1, $currency)->andWhere('p.product = ?2')->setParameter(2, $product);
$prices = $prices->getQuery()->getResult();
if (!empty($data['editid']) && count($prices) > 1) {
return false;
}
if (empty($data['editid']) && count($prices) > 0) {
return false;
}
return true;
}, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)));
$this->template->setVariable('PRICES_CONTENT', $view->render());
}
示例4: showEcard
function showEcard()
{
global $objDatabase, $_ARRAYLANG;
$this->_objTpl->setTemplate($this->pageContent);
// Initialize variables
$code = contrexx_addslashes($_GET['code']);
// Get data from DB
$query = "\n SELECT *\n FROM " . DBPREFIX . "module_ecard_ecards\n WHERE code='{$code}'";
$objResult = $objDatabase->Execute($query);
// If entered code does match a record in db
if (!$objResult->EOF) {
$message = nl2br(htmlentities($objResult->fields['message'], ENT_QUOTES, CONTREXX_CHARSET));
$senderName = htmlentities($objResult->fields['senderName'], ENT_QUOTES, CONTREXX_CHARSET);
$senderEmail = $objResult->fields['senderEmail'];
$recipientName = htmlentities($objResult->fields['recipientName'], ENT_QUOTES, CONTREXX_CHARSET);
$recipientEmail = $objResult->fields['recipientEmail'];
$recipientsalutation = htmlentities($objResult->fields['salutation'], ENT_QUOTES, CONTREXX_CHARSET);
// Get right file extension
$globArray = glob(ASCMS_ECARD_SEND_ECARDS_PATH . '/' . $code . ".*");
$fileextension = substr($globArray[0], -4);
$selectedMotive = $code . $fileextension;
// Initialize DATA placeholder
$this->_objTpl->setVariable(array('ECARD_DATA' => '<strong>' . $senderName . '</strong> (<a href="mailto:' . $senderEmail . '">' . $senderEmail . '</a>) ' . $_ARRAYLANG['TXT_ECARD_HAS_SENT_YOU_AN_ECARD'], 'ECARD_MOTIVE' => '<img src="' . ASCMS_ECARD_SEND_ECARDS_WEB_PATH . '/' . $selectedMotive . '" alt="' . $selectedMotive . '" title="' . $selectedMotive . '" />', 'ECARD_FROM' => $_ARRAYLANG['TXT_ECARD_FROM'] . ' ' . $senderName, 'ECARD_MESSAGE' => $message, 'ECARD_SENDER_NAME' => $senderName, 'ECARD_SENDER_EMAIL' => $senderEmail, 'ECARD_RECIPIENT_SALUTATION' => $recipientsalutation, 'ECARD_RECIPIENT_NAME' => $recipientName, 'ECARD_RECIPIENT_EMAIL' => $recipientEmail));
} else {
// display error message
$this->_objTpl->setVariable(array('ECARD_MESSAGE' => $_ARRAYLANG['TXT_ECARD_WRONG_CODE'], 'ECARD_FROM' => $_ARRAYLANG['TXT_ECARD_CAN_NOT_BE_DISPLAYED']));
}
}
示例5: showDiscountInfo
/**
* Set up the full set of discount information placeholders
* @param integer $groupCustomerId The customer group ID of the current customer
* @param integer $groupArticleId The article group ID of the current article
* @param integer $groupCountId The count discount group ID of the current article
* @param integer $count The number of articles to be used for the count discount
* @static
* @author Reto Kohli <reto.kohli@comvation.com>
*/
static function showDiscountInfo($groupCustomerId, $groupArticleId, $groupCountId, $count)
{
// Pick the unit for this product (count, meter, kilo, ...)
$unit = Discount::getUnit($groupCountId);
if (!empty($unit)) {
self::$objTemplate->setVariable('SHOP_PRODUCT_UNIT', $unit);
}
if ($groupCustomerId > 0) {
$rateCustomer = Discount::getDiscountRateCustomer($groupCustomerId, $groupArticleId);
if ($rateCustomer > 0) {
self::$objTemplate->setVariable(array('SHOP_DISCOUNT_RATE_CUSTOMER' => $rateCustomer));
}
}
if ($groupCountId > 0) {
$rateCount = Discount::getDiscountRateCount($groupCountId, $count);
$listCount = self::getDiscountCountString($groupCountId);
if ($rateCount > 0) {
// Show discount rate if applicable
self::$objTemplate->setVariable('SHOP_DISCOUNT_RATE_COUNT', $rateCount);
}
if (!empty($listCount)) {
// Show discount rate string if applicable
self::$objTemplate->setVariable('SHOP_DISCOUNT_RATE_COUNT_LIST', $listCount);
}
}
}
示例6:
/**
* placeholder
* @global object $objDatabase
* @global array $_ARRAYLANG
*/
function _placeholder()
{
global $_ARRAYLANG;
$this->_pageTitle = $_ARRAYLANG['TXT_PLACEHOLDER'];
$this->objTemplate->loadTemplateFile('placeholder.html');
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_DOWNLOADS' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADS'], 'TXT_DOWNLOADS_ICONS' => $_ARRAYLANG['TXT_DOWNLOADS_ICONS'], 'TXT_DOWNLOADS_CATEGORIES' => $_ARRAYLANG['TXT_DOWNLOADS_CATEGORIES'], 'TXT_PLACEHOLDER_FILE_ID' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_ID'], 'TXT_PLACEHOLDER_FILE_NAME' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_NAME'], 'TXT_PLACEHOLDER_FILE_DESC' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_DESC'], 'TXT_PLACEHOLDER_FILE_TYPE' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_TYPE'], 'TXT_PLACEHOLDER_FILE_SIZE' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_SIZE'], 'TXT_PLACEHOLDER_FILE_IMG' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_IMG'], 'TXT_PLACEHOLDER_FILE_AUTHOR' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_AUTHOR'], 'TXT_PLACEHOLDER_FILE_CREATED' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_CREATED'], 'TXT_PLACEHOLDER_FILE_LICENSE' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_LICENSE'], 'TXT_PLACEHOLDER_FILE_VERSION' => $_ARRAYLANG['TXT_PLACEHOLDER_FILE_VERSION'], 'TXT_PLACEHOLDER_CATEGORY_ID' => $_ARRAYLANG['TXT_PLACEHOLDER_CATEGORY_ID'], 'TXT_PLACEHOLDER_CATEGORY_NAME' => $_ARRAYLANG['TXT_PLACEHOLDER_CATEGORY_NAME'], 'TXT_PLACEHOLDER_CATEGORY_DESC' => $_ARRAYLANG['TXT_PLACEHOLDER_CATEGORY_DESC'], 'TXT_PLACEHOLDER_ICON_DISPLAY' => $_ARRAYLANG['TXT_PLACEHOLDER_ICON_DISPLAY'], 'TXT_PLACEHOLDER_ICON_FILTERS' => $_ARRAYLANG['TXT_PLACEHOLDER_ICON_FILTERS'], 'TXT_PLACEHOLDER_ICON_CATEGORY' => $_ARRAYLANG['TXT_PLACEHOLDER_ICON_CATEGORY'], 'TXT_PLACEHOLDER_ICON_FILE' => $_ARRAYLANG['TXT_PLACEHOLDER_ICON_FILE'], 'TXT_PLACEHOLDER_ICON_DOWNLOAD' => $_ARRAYLANG['TXT_PLACEHOLDER_ICON_DOWNLOAD'], 'TXT_PLACEHOLDER_ICON_INFO' => $_ARRAYLANG['TXT_PLACEHOLDER_ICON_INFO']));
}
示例7: parseNewsletterLists
/**
* Parse a user's newsletter-list subscription interface
* @param User User object of whoem the newsletter-list subscriptions shall be parsed
*/
protected function parseNewsletterLists($objUser)
{
global $_CONFIG, $objDatabase, $objInit;
if (!$this->_objTpl->blockExists('access_newsletter')) {
return;
}
if (\Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase)->isInLegalComponents('Newsletter')) {
$arrSubscribedNewsletterListIDs = $objUser->getSubscribedNewsletterListIDs();
$arrNewsletterLists = \Cx\Modules\Newsletter\Controller\NewsletterLib::getLists();
if (!count($arrNewsletterLists)) {
$this->_objTpl->hideBlock('access_newsletter_list');
return;
}
$row = 0;
foreach ($arrNewsletterLists as $listId => $arrList) {
if ($objInit->mode != 'backend' && !$arrList['status'] && !in_array($listId, $arrSubscribedNewsletterListIDs)) {
continue;
}
$this->_objTpl->setVariable(array($this->modulePrefix . 'NEWSLETTER_ID' => $listId, $this->modulePrefix . 'NEWSLETTER_NAME' => contrexx_raw2xhtml($arrList['name']), $this->modulePrefix . 'NEWSLETTER_SELECTED' => in_array($listId, $arrSubscribedNewsletterListIDs) ? 'checked="checked"' : '', $this->modulePrefix . 'NEWSLETTER_ROW_CLASS' => $row++ % 2 + 1));
$this->_objTpl->parse('access_newsletter_list');
}
$this->_objTpl->touchBlock('access_newsletter');
if ($this->_objTpl->blockExists('access_newsletter_tab')) {
$this->_objTpl->touchBlock('access_newsletter_tab');
}
} else {
$this->_objTpl->hideBlock('access_newsletter');
if ($this->_objTpl->blockExists('access_newsletter_tab')) {
$this->_objTpl->hideBlock('access_newsletter_tab');
}
}
}
示例8: count
/**
* Show the customer and article group discounts for editing.
*
* Handles storing of the discounts as well.
* @return boolean True on success, false otherwise
* @author Reto Kohli <reto.kohli@comvation.com>
*/
function view_customer_discounts()
{
if (!empty($_POST['store'])) {
$this->store_discount_customer();
}
self::$objTemplate->loadTemplateFile("module_shop_discount_customer.html");
// Discounts overview
$arrCustomerGroups = Discount::getCustomerGroupArray();
$arrArticleGroups = Discount::getArticleGroupArray();
$arrRate = null;
$arrRate = Discount::getDiscountRateCustomerArray();
$i = 0;
// Set up the customer groups header
self::$objTemplate->setVariable(array('SHOP_CUSTOMER_GROUP_COUNT' => count($arrCustomerGroups), 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1)));
foreach ($arrCustomerGroups as $id => $arrCustomerGroup) {
self::$objTemplate->setVariable(array('SHOP_CUSTOMER_GROUP_ID' => $id, 'SHOP_CUSTOMER_GROUP_NAME' => $arrCustomerGroup['name']));
self::$objTemplate->parse('customer_group_header_column');
self::$objTemplate->touchBlock('article_group_header_column');
self::$objTemplate->parse('article_group_header_column');
}
foreach ($arrArticleGroups as $groupArticleId => $arrArticleGroup) {
//DBG::log("Article group ID $groupArticleId");
foreach ($arrCustomerGroups as $groupCustomerId => $arrCustomerGroup) {
$rate = isset($arrRate[$groupCustomerId][$groupArticleId]) ? $arrRate[$groupCustomerId][$groupArticleId] : 0;
self::$objTemplate->setVariable(array('SHOP_CUSTOMER_GROUP_ID' => $groupCustomerId, 'SHOP_DISCOUNT_RATE' => sprintf('%2.2f', $rate)));
self::$objTemplate->parse('discount_column');
}
self::$objTemplate->setVariable(array('SHOP_ARTICLE_GROUP_ID' => $groupArticleId, 'SHOP_ARTICLE_GROUP_NAME' => $arrArticleGroup['name'], 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1)));
self::$objTemplate->parse('article_group_row');
}
self::$objTemplate->setGlobalVariable('SHOP_DISCOUNT_ROW_STYLE', 'row' . (++$i % 2 + 1));
// self::$objTemplate->touchBlock('article_group_header_row');
// self::$objTemplate->parse('article_group_header_row');
return true;
}
示例9: shadowbox
/**
* Show the shadowbox
*/
function shadowbox()
{
global $objDatabase, $_ARRAYLANG, $objInit;
$id = intval($_GET['id']);
$lang = intval($_GET['lang']);
$entries = $this->createEntryArray();
$entry = $entries[$id];
$settings = $this->createSettingsArray();
$title = $entry['translation'][$lang]['subject'];
$content = $entry['translation'][$lang]['content'];
$picture = !empty($entry['translation'][$lang]['image']) ? $entry['translation'][$lang]['image'] : "none";
$this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_THEMES_PATH);
\Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
$this->_objTpl->setCurrentBlock("shadowbox");
$objResult = $objDatabase->SelectLimit("\n SELECT foldername\n FROM " . DBPREFIX . "skins\n WHERE id='{$objInit->currentThemesId}'", 1);
if ($objResult !== false) {
$themesPath = $objResult->fields['foldername'];
}
$template = preg_replace('/\\[\\[([A-Z_]+)\\]\\]/', '{$1}', $settings['data_template_shadowbox']);
$this->_objTpl->setTemplate($template);
if ($entry['translation'][$lang]['attachment']) {
$this->_objTpl->setVariable(array("HREF" => $entry['translation'][$lang]['attachment'], "TXT_DOWNLOAD" => empty($entry['translation'][$lang]['attachment_desc']) ? $_ARRAYLANG['TXT_DATA_DOWNLOAD_ATTACHMENT'] : $entry['translation'][$lang]['attachment_desc']));
$this->_objTpl->parse("attachment");
}
$this->_objTpl->setVariable(array("TITLE" => $title, "CONTENT" => $content, "PICTURE" => $picture, "THEMES_PATH" => $themesPath));
if ($picture != "none") {
$this->_objTpl->parse("image");
} else {
$this->_objTpl->hideBlock("image");
}
$this->_objTpl->parse("shadowbox");
$this->_objTpl->show();
die;
}
示例10: showCatEdit
function showCatEdit()
{
global $objDatabase, $_ARRAYLANG;
// check
if (!isset($_GET['set'])) {
if (!isset($_GET['id']) or $_GET['id'] == '') {
$this->goToReplace('&act=category');
die;
}
}
//set
if (isset($_GET['set']) and $_GET['set'] == 1) {
if ($_POST['form_id'] != '' and $_POST['form_name'] != '' and $_POST['form_status'] != '' and $_POST['form_lang'] != '') {
$id = intval($_POST['form_id']);
$name = CONTREXX_ESCAPE_GPC ? strip_tags($_POST['form_name']) : addslashes(strip_tags($_POST['form_name']));
$status = intval($_POST['form_status']);
$time = time();
$lang = intval($_POST['form_lang']);
$this->showCatEditSet($id, $name, $status, $time, $lang);
$_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_FEED_MESSAGE_SUCCESSFUL_EDIT_CAT'];
$this->goToReplace('&act=category');
die;
} else {
$_SESSION['strErrMessage'] = $_ARRAYLANG['TXT_FEED_MESSAGE_ERROR_FILL_IN_ALL'];
$this->goToReplace('&act=catedit&id=' . $_POST['form_id']);
die;
}
}
$query = "SELECT id,\n name,\n status,\n lang\n FROM " . DBPREFIX . "module_feed_category\n WHERE id = '" . intval($_GET['id']) . "'";
$objResult = $objDatabase->Execute($query);
$id = $objResult->fields['id'];
$name = $objResult->fields['name'];
$status = $objResult->fields['status'];
$lang = $objResult->fields['lang'];
if ($status == 0) {
$status0 = ' selected';
$status1 = '';
} else {
$status0 = '';
$status1 = ' selected';
}
$this->_objTpl->setVariable(array('FEED_ID' => $id, 'FEED_NAME' => $name, 'FEED_STATUS0' => $status0, 'FEED_STATUS1' => $status1));
//lang
$query = "SELECT id,\n name\n FROM " . DBPREFIX . "languages\n WHERE id<>0\n ORDER BY id";
$objResult = $objDatabase->Execute($query);
while (!$objResult->EOF) {
$selected = '';
if ($lang == $objResult->fields['id']) {
$selected = ' selected';
}
$this->_objTpl->setVariable(array('FEED_LANG_ID' => $objResult->fields['id'], 'FEED_LANG_SELECTED' => $selected, 'FEED_LANG_NAME' => $objResult->fields['name']));
$this->_objTpl->parse('feed_lang');
$objResult->MoveNext();
}
//parse $_ARRAYLANG
$this->_objTpl->setVariable(array('TXT_FEED_EDIT_CAT' => $_ARRAYLANG['TXT_FEED_EDIT_CAT'], 'TXT_FEED_NAME' => $_ARRAYLANG['TXT_FEED_NAME'], 'TXT_FEED_LANGUAGE' => $_ARRAYLANG['TXT_FEED_LANGUAGE'], 'TXT_FEED_STATUS' => $_ARRAYLANG['TXT_FEED_STATUS'], 'TXT_FEED_INACTIVE' => $_ARRAYLANG['TXT_FEED_INACTIVE'], 'TXT_FEED_ACTIVE' => $_ARRAYLANG['TXT_FEED_ACTIVE'], 'TXT_FEED_RESET' => $_ARRAYLANG['TXT_FEED_RESET'], 'TXT_FEED_SAVE' => $_ARRAYLANG['TXT_FEED_SAVE'], 'TXT_FEED_FORMCHECK_NAME' => $_ARRAYLANG['TXT_FEED_FORMCHECK_NAME'], 'TXT_FEED_FORMCHECK_LANGUAGE' => $_ARRAYLANG['TXT_FEED_FORMCHECK_LANGUAGE'], 'TXT_FEED_FORMCHECK_STATUS' => $_ARRAYLANG['TXT_FEED_FORMCHECK_STATUS']));
}
示例11: 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('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log', $this->getAllViewGeneratorOptions());
$template->setVariable('ENTITY_VIEW', $viewGenerator);
}
示例12: getSearchResults
/**
* Gets the search results.
*
* @return mixed Parsed content.
*/
public function getSearchResults()
{
global $_ARRAYLANG;
$this->template->addBlockfile('ADMIN_CONTENT', 'search', 'Default.html');
if (!empty($this->term)) {
$pages = $this->getSearchedPages();
$countPages = $this->countSearchedPages();
usort($pages, array($this, 'sortPages'));
if ($countPages > 0) {
$parameter = '&cmd=Search' . (empty($this->term) ? '' : '&term=' . contrexx_raw2encodedUrl($this->term));
$paging = \Paging::get($parameter, '', $countPages, 0, true, null, 'pos');
$this->template->setVariable(array('TXT_SEARCH_RESULTS_COMMENT' => sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_COMMENT'], $this->term, $countPages), 'TXT_SEARCH_TITLE' => $_ARRAYLANG['TXT_NAVIGATION_TITLE'], 'TXT_SEARCH_CONTENT_TITLE' => $_ARRAYLANG['TXT_PAGETITLE'], 'TXT_SEARCH_SLUG' => $_ARRAYLANG['TXT_CORE_CM_SLUG'], 'TXT_SEARCH_LANG' => $_ARRAYLANG['TXT_LANGUAGE'], 'SEARCH_PAGING' => $paging));
foreach ($pages as $page) {
// used for alias pages, because they have no language
if ($page->getLang() == "") {
$languages = "";
foreach (\FWLanguage::getIdArray('frontend') as $langId) {
$languages[] = \FWLanguage::getLanguageCodeById($langId);
}
} else {
$languages = array(\FWLanguage::getLanguageCodeById($page->getLang()));
}
$aliasLanguages = implode(', ', $languages);
$originalPage = $page;
$link = 'index.php?cmd=ContentManager&page=' . $page->getId();
if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_ALIAS) {
$pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
if ($originalPage->isTargetInternal()) {
// is internal target, get target page
$originalPage = $pageRepo->getTargetPage($page);
} else {
// is an external target, set the link to the external targets url
$originalPage = new \Cx\Core\ContentManager\Model\Entity\Page();
$originalPage->setTitle($page->getTarget());
$link = $page->getTarget();
}
}
$this->template->setVariable(array('SEARCH_RESULT_BACKEND_LINK' => $link, 'SEARCH_RESULT_TITLE' => $originalPage->getTitle(), 'SEARCH_RESULT_CONTENT_TITLE' => $originalPage->getContentTitle(), 'SEARCH_RESULT_SLUG' => substr($page->getPath(), 1), 'SEARCH_RESULT_LANG' => $aliasLanguages, 'SEARCH_RESULT_FRONTEND_LINK' => \Cx\Core\Routing\Url::fromPage($page)));
$this->template->parse('search_result_row');
}
} else {
$this->template->setVariable(array('TXT_SEARCH_NO_RESULTS' => sprintf($_ARRAYLANG['TXT_SEARCH_NO_RESULTS'], $this->term)));
}
} else {
$this->template->setVariable(array('TXT_SEARCH_NO_TERM' => $_ARRAYLANG['TXT_SEARCH_NO_TERM']));
}
}
示例13: manageLocations
/**
* Add or edit the jobs Locations
* @global object $objDatabase
* @global array $_ARRAYLANG
* @param string $pageContent
*/
function manageLocations()
{
global $objDatabase, $_ARRAYLANG;
$this->pageTitle = $_ARRAYLANG['TXT_LOCATION_MANAGER'];
$this->_objTpl->loadTemplateFile('module_jobs_location.html', true, true);
$this->_objTpl->setVariable(array('TXT_ADD_NEW_LOCATION' => $_ARRAYLANG['TXT_ADD_NEW_LOCATION'], 'TXT_NAME' => $_ARRAYLANG['TXT_NAME'], 'TXT_ADD' => $_ARRAYLANG['TXT_ADD'], 'TXT_SELECT_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_REMOVE_SELECTION' => $_ARRAYLANG['TXT_REMOVE_SELECTION'], 'TXT_LOCATION_LIST' => $_ARRAYLANG['TXT_LOCATION_LIST'], 'TXT_ID' => $_ARRAYLANG['TXT_ID'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_ACCEPT_CHANGES' => $_ARRAYLANG['TXT_ACCEPT_CHANGES'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CONFIRM_DELETE_DATA'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_ATTENTION_SYSTEM_FUNCTIONALITY_AT_RISK' => $_ARRAYLANG['TXT_ATTENTION_SYSTEM_FUNCTIONALITY_AT_RISK'], 'TXT_JOBS_SORTING' => $_ARRAYLANG['TXT_JOBS_SORTING'], 'TXT_JOBS_SORTTYPE' => $_ARRAYLANG['TXT_JOBS_SORTTYPE']));
$this->_objTpl->setGlobalVariable(array('TXT_DELETE' => $_ARRAYLANG['TXT_DELETE']));
// Add a new category
if (isset($_POST['addLoc']) and $_POST['addLoc'] == true) {
$locName = get_magic_quotes_gpc() ? strip_tags($_POST['newLocName']) : addslashes(strip_tags($_POST['newLocName']));
if ($objDatabase->Execute("INSERT INTO " . DBPREFIX . "module_jobs_location (name)\n VALUES ('{$locName}')")) {
$this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_ADDED_SUCCESSFUL'];
} else {
$this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
}
}
// Modify a new category
if (isset($_POST['modLoc']) and $_POST['modLoc'] == true) {
foreach ($_POST['locName'] as $id => $name) {
$name = get_magic_quotes_gpc() ? strip_tags($name) : addslashes(strip_tags($name));
$id = intval($id);
// Unused
// $sorting = !empty($_REQUEST['sortStyle'][$id]) ? contrexx_addslashes($_REQUEST['sortStyle'][$id]) : 'alpha';
if ($objDatabase->Execute("UPDATE " . DBPREFIX . "module_jobs_location\n SET name='{$name}'\n WHERE id={$id}")) {
$this->strOkMessage = $_ARRAYLANG['TXT_DATA_RECORD_UPDATED_SUCCESSFUL'];
} else {
$this->strErrMessage = $_ARRAYLANG['TXT_DATABASE_QUERY_ERROR'];
}
}
}
$query = "SELECT `id`,\n `name`\n FROM `" . DBPREFIX . "module_jobs_location`\n ORDER BY `id` asc";
$objResult = $objDatabase->Execute($query);
$this->_objTpl->setCurrentBlock('row');
$i = 0;
while ($objResult !== false && !$objResult->EOF) {
$class = $i % 2 == 0 ? "row1" : "row2";
// Unused
// $sorting = $objResult->fields['sort_style'];
$this->_objTpl->setVariable(array('JOBS_ROWCLASS' => $class, 'JOBS_LOC_ID' => $objResult->fields['id'], 'JOBS_LOC_NAME' => stripslashes($objResult->fields['name'])));
$this->_objTpl->parseCurrentBlock('row');
$i++;
$objResult->MoveNext();
}
}
示例14: 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);
}
示例15: chooseReservationProduct
function chooseReservationProduct()
{
global $objDatabase, $_ARRAYLANG;
$this->objTemplate->loadTemplateFile('module_gov_choose_product.html');
$this->_pageTitle = $_ARRAYLANG['TXT_EGOV_PRODUCT_FOR_RESERVATION'];
$this->objTemplate->setVariable(array('TXT_PRODUCT' => $_ARRAYLANG['TXT_PRODUCT'], 'TXT_EGOV_CHOOSE_PRODUCT_FOR_RESERVATION' => $_ARRAYLANG['TXT_EGOV_CHOOSE_PRODUCT_FOR_RESERVATION']));
$query = "\n SELECT *\n FROM " . DBPREFIX . "module_egov_products\n ORDER BY product_orderby, product_name\n ";
$objResult = $objDatabase->Execute($query);
$i = 0;
while (!$objResult->EOF) {
$StatusImg = '<img src="../core/Core/View/Media/icons/status_green.gif" width="10" height="10" border="0" alt="" />';
if ($objResult->fields["product_status"] != 1) {
$StatusImg = '<img src="../core/Core/View/Media/icons/status_red.gif" width="10" height="10" border="0" alt="" />';
}
$this->objTemplate->setVariable(array('ROWCLASS' => ++$i % 2 ? 'row2' : 'row1', 'PRODUCT_ID' => $objResult->fields['product_id'], 'PRODUCT_NAME' => $objResult->fields['product_name'], 'PRODUCT_STATUS' => $StatusImg));
$this->objTemplate->parse('products_list');
$objResult->MoveNext();
}
if ($i == 0) {
$this->objTemplate->hideBlock('products_list');
}
}