/** * 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(); }
/** * 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; }
public function __construct($value, $label = '', array $additional = array()) { $additional = array_merge(array('date' => Format::date($value), 'datim' => Format::datim($value), 'time' => Format::time($value)), $additional); parent::__construct($value, $label, $additional); }