public function send() { $conf = NEnvironment::getContext()->parameters['common.mailer']; $this->setFrom($conf['from']); //nastavení nSMTPMaileru (z config.ini) $mailer = new SmtpMailer($conf['host'], $conf['port'], $conf['transport'], $conf['username'], $conf['password'], NULL, NULL, NULL); $this->setMailer($mailer); //důležité!!! // $undelivered = array(); // foreach ($recipients as $email) { // try { // //tady můžeme prohnat zadané adresy nějakým úžasným regexem // if (!preg_match('/^\s*$/', $email)) { // //můžeme použít i addCC a addBcc // $mail->addTo($email); // } else { // $undelivered[] = $email; // } // } catch (InvalidArgumentException $e) { // $undelivered[] = $email; // } // } if (isset($this->template)) { $this->setHtmlBody((string) $this->template); } try { parent::send(); } catch (InvalidStateException $e) { $this->result = FALSE; } }
/** * @param array */ public function __construct(array $items = NULL) { $cache = NEnvironment::getContext()->getService('cacheStorage'); $params = NEnvironment::getContext()->parameters; // dump($params);exit; $this->items = array('--temp' => array('callback' => callback($this, 'clearDir'), 'name' => "Invalidate Temp", 'args' => array($params['tempDir'])), '--log' => array('callback' => callback($this, 'clearDir'), 'name' => "Clear Logs", 'args' => array($params['logDir'])), '--sessions' => array('callback' => callback($this, 'clearDir'), 'name' => "Clear Sessions", 'args' => array(ini_get('session.save_path'))), '--webtemp' => array('callback' => callback($this, 'clearDir'), 'name' => "Webtemp", 'args' => array($params['webloaderTempPath'])), '--tempImages' => array('callback' => callback($this, 'clearDir'), 'name' => "TempImages", 'args' => array($params['file']['dir_abs'] . '/temp'))); if ($items) { $this->items = array_merge($this->items, $items); } $this->processRequest(); }
static function getTotalPrice($products, $payment_method, $id_lang, $user) { $param = array('price' => 0, 'price_with_tax' => 0, 'weight' => 0, 'payment_price' => 0, 'delivery_price' => 0); foreach ($products as $id_product_param => $count) { $product = ProductModel::getProductIdentifyByParam($id_product_param, $id_lang, $user); $param['price'] += $product['price_array']['price'] * $count; $param['price_with_tax'] += $product['price_array']['price_with_tax'] * $count; $param['weight'] += $product['weight'] * $count; } ///$payment_method $param['payment_price'] = self::getPaymentPrice($payment_method, $param['price']); // $delivery_price = ProductWeightModel::getPrice($weight); $param['delivery_price'] = ProductWeightModel::getPrice($param['weight']); $conf = NEnvironment::getContext()->parameters; if ($conf['DELIVERY_IS_WITH_TAX'] == 1) { $param['price'] += $param['delivery_price'] / (1 + $conf['DELIVERY_TAX'] / 100); $param['price_with_tax'] += $param['delivery_price']; } else { $param['price'] += $param['delivery_price']; $param['price_with_tax'] += $param['delivery_price'] * (1 + $conf['DELIVERY_TAX'] / 100); } return $param; }
public static function init() { return new self(dibi::getConnection(), \NEnvironment::getCache(get_class()), \NEnvironment::getContext()); }
function showModul() { $list = dibi::fetchAll("SELECT * FROM node LEFT JOIN type_modul USING(id_type_modul) WHERE id_menu_item=%i", $_GET['id_menu_item'], " ORDER BY sequence DESC"); try { if (!$list) { return false; } } catch (NodeException $e) { echo '<div style="border: 2px solid red; padding: 5px;"> ' . $e->getMessage() . ' </div>'; } if (isset($_GET['id_type_modul']) and isset($_GET['id_modul'])) { $this->activeModul->showForm(); } else { $array_list = array(); foreach ($list as $l) { $l['title'] = $this->nodeFactory($l['id_type_modul'], $l['dir'])->showTitle($l['id_node'], $l['id_type_modul']); $array_list[] = $l; } MT::addTemplate(APP_DIR . '/templates/admin/showNode.phtml', 'showNode'); // print_r($array_list); MT::addVar('showNode', 'array_list', $array_list); // print_r(NEnvironment::getConfig('variable')); MT::addVar('showNode', 'var', NEnvironment::getContext()->parameters); } }
static function createCacheStorage() { $context = new NContext(); $context->addService('Nette\\Caching\\ICacheJournal', NEnvironment::getContext()); $dir = NEnvironment::getVariable('tempDir') . '/cache'; umask(00); @mkdir($dir, 0777); return new NFileStorage($dir, $context); }
static function getTaxCoefForProduct($id_product) { //ak nie je spustene upravovanie cien, vrati koefiecient 1 $show_price_with_tax = NEnvironment::getContext()->parameters['SHOW_PRICE_WITH_TAX']; if (!$show_price_with_tax) { return 1; } $key = 'getTaxCoefForProduct(' . $id_product . ')'; $tax_coef = self::loadCache($key); if ($tax_coef) { return $tax_coef; } else { $tax = dibi::fetchSingle("SELECT vat.value FROM\n\t\t\t[product] \t\t\t\n\t\t\tJOIN [vat] USING(id_vat)\n\t\t\tWHERE id_product = %i", $id_product); $tax_coef = 1 + $tax / 100; } return self::saveCache($key, $tax_coef); }