public static function money($context, $amount) { $data = null; if (isset($context['data']) && $context['data'] instanceof Kwf_Component_Data) { $data = $context['data']; } else { if (isset($context['item']) && $context['item'] instanceof Kwf_Component_Data) { $data = $context['item']; } } if ($data) { $format = $data->getBaseProperty('money.format'); $decimals = $data->getBaseProperty('money.decimals'); $decimalSeparator = $data->getBaseProperty('money.decimalSeparator'); $thousandSeparator = $data->getBaseProperty('money.thousandSeparator'); if (is_null($decimalSeparator)) { $decimalSeparator = $data->trlcKwf('decimal separator', "."); } if (is_null($thousandSeparator)) { $thousandSeparator = $data->trlcKwf('thousands separator', ","); } } else { $format = Kwf_Config::getValue('money.format'); $decimals = Kwf_Config::getValue('money.decimals'); $decimalSeparator = trlcKwf('decimal separator', "."); $thousandSeparator = trlcKwf('thousands separator', ","); } $number = number_format($amount, $decimals, $decimalSeparator, $thousandSeparator); return str_replace('{0}', $number, $format); }
public function alterBackendOrderForm(Kwf_Form $form) { $fs = $form->add(new Kwf_Form_Container_FieldSet(trlKwf('Discount'))); $fs->add(new Kwf_Form_Field_TextField('discount_text', trlKwf('Text'))); $fs->add(new Kwf_Form_Field_NumberField('discount_amount', trlcKwf('Amount of Money', 'Amount')))->setComment('€')->setWidth(50); $fs->add(new Kwf_Form_Field_TextField('discount_comment', trlKwf('Comment'))); }
public function money($amount) { $component = null; if (isset($this->_view) && $this->_view && $this->_view->data && $this->_view->data instanceof Kwf_Component_Data) { $component = $this->_view->data; } if ($component) { $format = $component->getBaseProperty('money.format'); $decimals = $component->getBaseProperty('money.decimals'); $decimalSeparator = $component->getBaseProperty('money.decimalSeparator'); $thousandSeparator = $component->getBaseProperty('money.thousandSeparator'); if (is_null($decimalSeparator)) { $decimalSeparator = $component->trlcKwf('decimal separator', "."); } if (is_null($thousandSeparator)) { $thousandSeparator = $component->trlcKwf('thousands separator', ","); } } else { $format = Kwf_Config::getValue('money.format'); $decimals = Kwf_Config::getValue('money.decimals'); $decimalSeparator = trlcKwf('decimal separator', "."); $thousandSeparator = trlcKwf('thousands separator', ","); } $number = number_format($amount, $decimals, $decimalSeparator, $thousandSeparator); return str_replace('{0}', $number, $format); }
protected function _initColumns() { $this->_model = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting(Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'))->parent->componentClass, 'childModel'))->getReferencedModel('Order'); $cc = Kwc_Abstract::getChildComponentClasses($this->_getParam('class'), 'payment'); $paymentsFilterData = array(); $payments = array(); foreach ($cc as $k => $c) { $payments[$k] = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($c, 'componentName')); $paymentsFilterData[] = array($k, $payments[$k]); } $this->_filters['text'] = true; if (count($payments) > 1) { $this->_filters['payment'] = array('type' => 'ComboBox', 'text' => trlKwf('Payment'), 'data' => $paymentsFilterData, 'width' => 100); } $this->_filters['canceled'] = array('type' => 'Button', 'skipWhere' => true, 'cls' => 'x2-btn-text-icon', 'icon' => '/assets/silkicons/stop.png', 'text' => trlKwf('canceled'), 'tooltip' => trlKwf('Show canceled orders')); $this->_filters['shipped'] = array('type' => 'Button', 'skipWhere' => true, 'cls' => 'x2-btn-text-icon', 'icon' => '/assets/silkicons/package.png', 'text' => trlKwf('shipped'), 'tooltip' => trlKwf('Show shipped orders')); $this->_columns->add(new Kwf_Grid_Column('order_number', trlKwf('Order Nr'), 50)); $this->_columns->add(new Kwf_Grid_Column('invoice_number', trlKwf('Invoice Nr'), 50))->setHidden(true); $this->_columns->add(new Kwf_Grid_Column_Datetime('date', trlKwf('Date'))); $this->_columns->add(new Kwf_Grid_Column('firstname', trlKwf('Firstname'), 90)); $this->_columns->add(new Kwf_Grid_Column('lastname', trlKwf('Lastname'), 90)); $this->_columns->add(new Kwf_Grid_Column('country', trlKwf('Country'), 15)); // TODO: Pfusch $this->_columns->add(new Kwf_Grid_Column('sum_amount', trlKwf('Amt'), 30))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_SumAmount())->setSortable(false); $this->_columns->add(new Kwf_Grid_Column('sum_price', trlKwf('Sum'), 50))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_SumPrice())->setSortable(false)->setRenderer('euroMoney'); if (count($payments) > 1) { $this->_columns->add(new Kwf_Grid_Column('payment', trlKwf('Payment'), 80))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_Payment($payments))->setSortable(false); } $this->_columns->add(new Kwf_Grid_Column_Date('payed', trlKwf('Payed'))); if (Kwc_Abstract::getSetting($this->_getParam('class'), 'generateInvoices')) { $this->_columns->add(new Kwf_Grid_Column_Button('invoice', trlcKwf('Invoice', 'IN'))); } $this->_columns->add(new Kwf_Grid_Column_Button('shipped', trlcKwf('Shipped', 'SH')))->setButtonIcon('/assets/silkicons/package_go.png'); $this->_columns->add(new Kwf_Grid_Column('shipped')); }
protected function _initFields() { parent::_initFields(); $this->_form->add(new Kwf_Form_Field_ShowField('code', trlKwf('Code'))); $this->_form->add(new Kwf_Form_Field_NumberField('amount', trlcKwf('Amount of Money', 'Amount')))->setWidth(50)->setComment('€'); $this->_form->add(new Kwf_Form_Field_DateField('date', trlKwf('Date')))->setDefaultValue(date('Y-m-d')); $this->_form->add(new Kwf_Form_Field_TextArea('comment', trlKwf('Comment')))->setWidth(250)->setHeight(70); }
protected function _initColumns() { parent::_initColumns(); $this->_columns->add(new Kwf_Grid_Column_Date('date', trlKwf('Date')))->setEditor(new Kwf_Form_Field_DateField()); $this->_columns->add(new Kwf_Grid_Column('amount', trlcKwf('Amount of Money', 'Amount'), 50))->setRenderer('euroMoney')->setEditor(new Kwf_Form_Field_NumberField()); $ed = new Kwf_Form_Field_TextArea(); $ed->setWidth(300)->setHeight(70); $this->_columns->add(new Kwf_Grid_Column('comment', trlKwf('Comment'), 300))->setRenderer('nl2br')->setEditor($ed); }
protected function _initColumns() { parent::_initColumns(); $this->_columns->add(new Kwf_Grid_Column_Date('date', trlKwf('Date'))); $this->_columns->add(new Kwf_Grid_Column('code', trlKwf('Code'))); $this->_columns->add(new Kwf_Grid_Column('amount', trlcKwf('Amount of Money', 'Amount'), 50))->setRenderer('euroMoney'); $this->_columns->add(new Kwf_Grid_Column('used_amount', trlcKwf('Amount of Money', 'Used Amount'), 50))->setType('float')->setRenderer('euroMoney'); $this->_columns->add(new Kwf_Grid_Column('comment', trlKwf('Comment')))->setRenderer('nl2br'); }
public function timestamp($date) { if (!$date) { return '-'; } $timeHelper = new Kwf_View_Helper_Time(); $time = $timeHelper->time($date); $dateHelper = new Kwf_View_Helper_Date(); $date = $dateHelper->date($date); return trlcKwf('time', 'On') . ' ' . $date . ' ' . trlcKwf('time', 'at') . ' ' . $time; }
protected function _initFields() { parent::_initFields(); $fs = $this->_form->add(new Kwf_Form_Container_FieldSet(trlKwf('Contact person')))->setName('contactpersonfieldset'); $fs->add(new Kwf_Form_Field_Select('gender', trlKwf('Gender')))->setWidth(250)->setValues(array('male' => trlKwf('Mr.'), 'female' => trlKwf('Ms.'))); $fs->add(new Kwf_Form_Field_TextField('title', trlKwf('Title')))->setWidth(250); $fs->add(new Kwf_Form_Field_TextField('firstname', trlKwf('Firstname')))->setWidth(250); $fs->add(new Kwf_Form_Field_TextField('lastname', trlKwf('Lastname')))->setWidth(250); $fs->add(new Kwf_Form_Field_DateField('birthdate', trlKwf('Date of birth')))->setAllowBlank(true); $fs->add(new Kwf_Form_Field_TextField('phone', trlKwf('Phone')))->setWidth(250); $fs->add(new Kwf_Form_Field_TextField('mobile', trlKwf('Mobile')))->setWidth(250); $fs->add(new Kwf_Form_Field_TextField('email', trlKwf('E-Mail')))->setWidth(250); $fs->add(new Kwf_Form_Field_TextField('capacity', trlcKwf('career', 'Capacity')))->setWidth(250); $fs->add(new Kwf_Form_Field_TextArea('annotation', trlKwf('Annotation')))->setWidth(250)->setHeight(70); }
public function getBaseProperty($propertyName) { if ($propertyName == 'language') { return Kwf_Trl::getInstance()->getWebCodeLanguage(); } else { if ($propertyName == 'domain') { return Kwf_Config::getValue('server.domain'); } else { if ($propertyName == 'money.decimalSeparator') { return trlcKwf('decimal separator', "."); } else { if ($propertyName == 'money.thousandSeparator') { return trlcKwf('thousands separator', ","); } else { return Kwf_Config::getValue($propertyName); } } } } }