本文整理汇总了PHP中Cx\Core\Html\Sigma类的典型用法代码示例。如果您正苦于以下问题:PHP Sigma类的具体用法?PHP Sigma怎么用?PHP Sigma使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sigma类的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: renderTheme
/**
* Render the option in the frontend.
*
* @param Sigma $template
*/
public function renderTheme($template)
{
$blockName = strtolower('TEMPLATE_EDITOR_' . $this->name);
if ($template->blockExists($blockName) && $this->active) {
$template->touchBlock($blockName);
}
}
示例3: 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);
}
示例4: 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;
}
示例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: 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->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'));
$mediaBrowser = new MediaBrowser();
$mediaBrowser->setCallback('gallery.fancyCallback');
$template->setVariable('MEDIABROWSER_CODE1', $mediaBrowser->getXHtml('MediaBrowser'));
$template->setVariable('MEDIABROWSER_CODE1_RAW', htmlspecialchars($mediaBrowser->getXHtml('MediaBrowser')));
$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));
}
示例7: 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)
{
global $_ARRAYLANG, $objInit;
$objTpl = new \Cx\Core\Html\Sigma($this->getDirectory(true) . '/View/Template/Backend');
//merge language
$langData = $objInit->loadLanguageData('Pdf');
$_ARRAYLANG = array_merge($_ARRAYLANG, $langData);
$objTpl->setGlobalVariable($_ARRAYLANG);
$objTpl->loadTemplatefile('Default.html');
// Not an entity, parse overview or settings
switch (current($cmd)) {
default:
// Parse entity view generation pages
$entityClassName = $this->getNamespace() . '\\Model\\Entity\\PdfTemplate';
$this->parseEntityClassPage($objTpl, $entityClassName, 'PdfTemplate');
if ($objTpl->blockExists('overview')) {
$objTpl->touchBlock('overview');
}
break;
}
\JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/Backend.css', 1));
$template->setVariable(array('CONTENT_TITLE' => $_ARRAYLANG['TXT_CORE_MODULE_PDF'], 'ADMIN_CONTENT' => $objTpl->get()));
}
示例8: preFinalize
/**
* Do something before main template gets parsed
*
* @param \Cx\Core\Html\Sigma $template The main template
*/
public function preFinalize(\Cx\Core\Html\Sigma $template)
{
if ($this->cx->getMode() != \Cx\Core\Core\Controller\Cx::MODE_FRONTEND) {
return;
}
// make all language data of Access component globally available
$template->setVariable(\Env::get('init')->getComponentSpecificLanguageData($this->getName()));
}
示例9: parseSettingsDropDown
/**
* parse the settings dropdown
*
* @param object $objTemplate template object
* @param array $settingValues array of setting values
* @param string $selected selected dropdown value
* @param string $blockName block name for template parsing
*
* @return null
*/
public function parseSettingsDropDown(\Cx\Core\Html\Sigma $objTemplate, $settingValues, $selected, $blockName)
{
global $_ARRAYLANG;
if (empty($settingValues)) {
return;
}
foreach (array_keys($settingValues) as $key) {
$selectedOption = $selected == $key ? 'selected="selected"' : '';
$objTemplate->setVariable(array('DOWNLOADS_SETTINGS_DROPDOWN_OPTION_VALUE' => $key, 'DOWNLOADS_SETTINGS_DROPDOWN_OPTION_NAME' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_' . strtoupper($key) . '_LABEL'], 'DOWNLOADS_SETTINGS_DROPDOWN_SELECTED_OPTION' => $selectedOption));
$objTemplate->parse('downloads_settings_sorting_dropdown_' . $blockName);
}
}
示例10: preRender
protected function preRender($lang)
{
if ($this->template->placeholderExists('LEVELS_FULL') || $this->template->placeholderExists('levels_full')) {
$this->rootNode = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node')->getRoot();
}
$this->realPreRender($lang);
}
示例11: 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());
}
示例12: 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);
}
}
}
示例13: 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']));
}
}
示例14:
/**
* 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']));
}
示例15: 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');
}
}
}