本文整理汇总了PHP中Isotope\Isotope::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Isotope::setConfig方法的具体用法?PHP Isotope::setConfig怎么用?PHP Isotope::setConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Isotope\Isotope
的用法示例。
在下文中一共展示了Isotope::setConfig方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* Generate the module
*/
protected function compile()
{
// Also check owner (see #126)
if (($objOrder = Order::findOneBy('uniqid', (string) \Input::get('uid'))) === null || FE_USER_LOGGED_IN === true && $objOrder->member > 0 && \FrontendUser::getInstance()->id != $objOrder->member) {
$this->Template = new \Isotope\Template('mod_message');
$this->Template->type = 'error';
$this->Template->message = $GLOBALS['TL_LANG']['ERR']['orderNotFound'];
return;
}
// Order belongs to a member but not logged in
if (TL_MODE == 'FE' && $this->iso_loginRequired && $objOrder->member > 0 && FE_USER_LOGGED_IN !== true) {
global $objPage;
$objHandler = new $GLOBALS['TL_PTY']['error_403']();
$objHandler->generate($objPage->id);
exit;
}
Isotope::setConfig($objOrder->getRelated('config_id'));
$objTemplate = new \Isotope\Template($this->iso_collectionTpl);
$objTemplate->linkProducts = true;
$objOrder->addToTemplate($objTemplate, array('gallery' => $this->iso_gallery, 'sorting' => $objOrder->getItemsSortingCallable($this->iso_orderCollectionBy)));
$this->Template->collection = $objOrder;
$this->Template->products = $objTemplate->parse();
$this->Template->info = deserialize($objOrder->checkout_info, true);
$this->Template->date = Format::date($objOrder->locked);
$this->Template->time = Format::time($objOrder->locked);
$this->Template->datim = Format::datim($objOrder->locked);
$this->Template->orderDetailsHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['orderDetailsHeadline'], $objOrder->document_number, $this->Template->datim);
$this->Template->orderStatus = sprintf($GLOBALS['TL_LANG']['MSC']['orderStatusHeadline'], $objOrder->getStatusLabel());
$this->Template->orderStatusKey = $objOrder->getStatusAlias();
}
示例2: compile
/**
* Generate the module
* @return void
*/
protected function compile()
{
$arrOrders = array();
$objOrders = Order::findBy(array('order_status>0', 'member=?', 'config_id IN (?)'), array(\FrontendUser::getInstance()->id, implode("','", $this->iso_config_ids)), array('order' => 'locked DESC'));
// No orders found, just display an "empty" message
if (null === $objOrders) {
$this->Template = new \Isotope\Template('mod_message');
$this->Template->type = 'empty';
$this->Template->message = $GLOBALS['TL_LANG']['ERR']['emptyOrderHistory'];
return;
}
while ($objOrders->next()) {
Isotope::setConfig($objOrders->current()->getRelated('config_id'));
$arrOrders[] = array('collection' => $objOrders->current(), 'raw' => $objOrders->current()->row(), 'date' => Format::date($objOrders->current()->locked), 'time' => Format::time($objOrders->current()->locked), 'datime' => Format::datim($objOrders->current()->locked), 'grandTotal' => Isotope::formatPriceWithCurrency($objOrders->current()->getTotal()), 'status' => $objOrders->current()->getStatusLabel(), 'link' => $this->jumpTo ? \Haste\Util\Url::addQueryString('uid=' . $objOrders->current()->uniqid, $this->jumpTo) : '', 'class' => $objOrders->current()->getStatusAlias());
}
RowClass::withKey('class')->addFirstLast()->addEvenOdd()->applyTo($arrOrders);
$this->Template->orders = $arrOrders;
}
示例3: getOrderLabel
/**
* Generate the order label and return it as string
*
* @param array $row
* @param string $label
* @param \DataContainer $dc
* @param array $args
*
* @return string
*/
public function getOrderLabel($row, $label, \DataContainer $dc, $args)
{
/** @var Order $objOrder */
$objOrder = Order::findByPk($row['id']);
if (null === $objOrder) {
return $args;
}
// Override system to correctly format currencies etc
Isotope::setConfig($objOrder->getRelated('config_id'));
$objAddress = $objOrder->getBillingAddress();
if (null !== $objAddress) {
$arrTokens = $objAddress->getTokens(Isotope::getConfig()->getBillingFieldsConfig());
$args[2] = $arrTokens['hcard_fn'];
}
$args[3] = Isotope::formatPriceWithCurrency($row['total']);
/** @var \Isotope\Model\OrderStatus $objStatus */
if (($objStatus = $objOrder->getRelated('order_status')) !== null) {
$args[4] = '<span style="' . $objStatus->getColorStyles() . '">' . $objOrder->getStatusLabel() . '</span>';
} else {
$args[4] = '<span>' . $objOrder->getStatusLabel() . '</span>';
}
return $args;
}
示例4: formatValues
protected function formatValues($arrData, $arrCurrencies)
{
// Format row totals
foreach ($arrData['rows'] as $dateGroup => $arrRow) {
if (is_array($arrRow['columns'][4]['value'])) {
foreach ($arrRow['columns'][4]['value'] as $currency => $varValue) {
Isotope::setConfig(Config::findByPk($arrCurrencies[$currency]));
$arrData['rows'][$dateGroup]['columns'][4]['value'][$currency] = Isotope::formatPriceWithCurrency($varValue);
}
}
}
// Format footer totals
foreach ($arrData['footer'][4]['value'] as $currency => $varValue) {
Isotope::setConfig(Config::findByPk($arrCurrencies[$currency]));
$arrData['footer'][4]['value'][$currency] = Isotope::formatPriceWithCurrency($varValue);
}
if (empty($arrData['footer'][4]['value'])) {
$arrData['footer'][4]['value'] = 0;
}
return $arrData;
}
示例5: loadOrderEnvironment
/**
* Initialize environment (language, objPage) for a given order
*
* @param Order $objOrder
* @param string $strLanguage
*/
public static function loadOrderEnvironment(Order $objOrder, $strLanguage = null)
{
global $objPage;
$strLanguage = $strLanguage ?: $objOrder->language;
// Load page configuration
if ($objOrder->pageId > 0 && (null === $objPage || $objPage->id != $objOrder->pageId)) {
$objPage = \PageModel::findWithDetails($objOrder->pageId);
$objPage = static::loadPageConfig($objPage);
}
// Set the current system to the language when the user placed the order.
// This will result in correct e-mails and payment description.
$GLOBALS['TL_LANGUAGE'] = $strLanguage;
\System::loadLanguageFile('default', $strLanguage, true);
Isotope::setConfig($objOrder->getRelated('config_id'));
if (($objCart = $objOrder->getRelated('source_collection_id')) !== null && $objCart instanceof Cart) {
Isotope::setCart($objCart);
}
}
示例6: listRow
/**
* List all records with formatted currency
* @param array
* @return string
*/
public function listRow($row)
{
$arrRate = deserialize($row['rate']);
if ($row['config'] && !$arrRate['unit']) {
Isotope::setConfig(Config::findByPk($row['config']));
$strRate = Isotope::formatPriceWithCurrency($arrRate['value'], false);
} else {
$strRate = $arrRate['value'] . '%';
}
return sprintf('%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>', $row['name'], $strRate);
}
示例7: printDocument
/**
* Pass an order to the document
* @param DataContainer
*/
public function printDocument(\DataContainer $dc)
{
$strRedirectUrl = str_replace('&key=print_document', '', \Environment::get('request'));
if (\Input::post('FORM_SUBMIT') == 'tl_iso_print_document') {
if (($objOrder = Order::findByPk($dc->id)) === null) {
\Message::addError('Could not find order id.');
\Controller::redirect($strRedirectUrl);
}
if (($objConfig = $objOrder->getRelated('config_id')) === null) {
\Message::addError('Could not find config id.');
\Controller::redirect($strRedirectUrl);
}
// Set current config
Isotope::setConfig($objConfig);
/** @var \Isotope\Interfaces\IsotopeDocument $objDocument */
if (($objDocument = Document::findByPk(\Input::post('document'))) === null) {
\Message::addError('Could not find document id.');
\Controller::redirect($strRedirectUrl);
}
$objDocument->outputToBrowser($objOrder);
}
$arrSelect = array('name' => 'document', 'label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['document_choice'], 'inputType' => 'select', 'foreignKey' => 'tl_iso_document.name', 'eval' => array('mandatory' => true));
$objSelect = new \SelectMenu(\SelectMenu::getAttributesFromDca($arrSelect, $arrSelect['name']));
$strMessages = \Message::generate();
\Message::reset();
// Return form
return '
<div id="tl_buttons">
<a href="' . ampersand($strRedirectUrl) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBT']) . '">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
<h2 class="sub_headline">' . sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['print_document'][1], $dc->id) . '</h2>' . $strMessages . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_iso_product_import" class="tl_form" method="post">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="tl_iso_print_document">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<div class="tl_tbox block">
' . $objSelect->parse() . '
<p class="tl_help">' . $objSelect->description . '</p>
</div>
</div>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
<input type="submit" name="print" id="print" class="tl_submit" alt="" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_iso_product_collection']['print']) . '">
</div>
</div>
</form>';
}
示例8: run
/**
* Run the controller
*/
public function run()
{
$objMethod = null;
try {
$strMod = $this->getModule();
$intId = $this->getModuleId();
if ($strMod == '' || $intId == 0) {
\System::log('Invalid post-sale request (param error): ' . \Environment::get('request'), __METHOD__, TL_ERROR);
$objResponse = new Response('Bad Request', 400);
$objResponse->send();
}
switch (strtolower($strMod)) {
case 'pay':
$objMethod = Payment::findByPk($intId);
break;
case 'ship':
$objMethod = Shipping::findByPk($intId);
break;
}
if (null === $objMethod) {
\System::log('Invalid post-sale request (model not found): ' . \Environment::get('request'), __METHOD__, TL_ERROR);
$objResponse = new Response('Not Found', 404);
$objResponse->send();
}
\System::log('New post-sale request: ' . \Environment::get('request'), __METHOD__, TL_ACCESS);
if (!$objMethod instanceof IsotopePostsale) {
\System::log('Invalid post-sale request (interface not implemented): ' . \Environment::get('request'), __METHOD__, TL_ERROR);
$objResponse = new Response('Not Implemented', 501);
$objResponse->send();
}
$objOrder = $objMethod->getPostsaleOrder();
if (null === $objOrder || !$objOrder instanceof IsotopeProductCollection) {
\System::log(get_class($objMethod) . ' did not return a valid order', __METHOD__, TL_ERROR);
$objResponse = new Response('Failed Dependency', 424);
$objResponse->send();
}
global $objPage;
// Load page configuration
if (!is_object($objPage) && $objOrder->pageId > 0) {
$objPage = \PageModel::findWithDetails($objOrder->pageId);
$objPage = \Isotope\Frontend::loadPageConfig($objPage);
}
// Set the current system to the language when the user placed the order.
// This will result in correct e-mails and payment description.
if ($GLOBALS['TL_LANGUAGE'] != $objOrder->language) {
$GLOBALS['TL_LANGUAGE'] = $objOrder->language;
\System::loadLanguageFile('default', $objOrder->language, true);
}
Isotope::setConfig($objOrder->getRelated('config_id'));
if (($objCart = $objOrder->getRelated('source_collection_id')) !== null && $objCart instanceof Cart) {
Isotope::setCart($objCart);
}
$objMethod->processPostsale($objOrder);
$objResponse = new Response();
$objResponse->send();
} catch (\Exception $e) {
\System::log(sprintf('Exception in post-sale request in file "%s" on line "%s" with message "%s".', $e->getFile(), $e->getLine(), $e->getMessage()), __METHOD__, TL_ERROR);
$objResponse = new Response('Internal Server Error', 500);
$objResponse->send();
}
}