Beispiel #1
0
 /**
  *	Surcharge de l'init() et traitements principaux
  *	
  */
 public function init()
 {
     $modules = $this->getModule();
     $list = new List_Frameview();
     $user = users::getMe();
     $login = $user['email_login'];
     $password = $user['email_password'];
     $host = "{imap.gmail.com:993/imap/ssl}INBOX";
     $client = new MyMail();
     $client->setUsername($login);
     $client->setPassword($password);
     $client->setHost($host);
     // Affichage un peu en mode debug
     $mres = $client->getNew();
     $listContent = "<pre>";
     $listContent .= print_r($user, 1);
     $listContent .= print_r($mres, 1);
     $listContent .= "</pre>";
     // Assignation de toutes les données
     $this->assign('listContent', $listContent);
 }
Beispiel #2
0
 function handleSubmit(NForm $form)
 {
     $values = $form->getValues();
     $template = $this->getPresenter()->createTemplate();
     $template->setFile(dirname(__FILE__) . '/email.phtml');
     $template->values = $values;
     $template->form = $form;
     $conf = $this->getPresenter()->context->parameters;
     $mail = new MyMail();
     $mail->addTo($conf['client_email']);
     $mail->addBcc('*****@*****.**');
     $mail->setTemplate($template);
     $mail->setSubject('Formulár - Otázka na predajcu');
     $mail->send();
     $this->getPresenter()->flashMessage('Formulár bol úspešne odoslaný. Čoskoro Vás budeme kontaktovať.');
     $this->getPresenter()->redirect('this');
 }
Beispiel #3
0
 function handleSend(NFORM $form)
 {
     $values = $form->getValues();
     $contact_val = $this->get($values['id_node']);
     if (!$contact_val) {
         $this->getPresenter()->flashMessage('Formulár nepodarilo odoslať. Skúste prosím neskôr.');
     }
     $template = $this->template;
     $template->setFile(dirname(__FILE__) . '/email.phtml');
     $template->values = $values;
     $mail = new MyMail();
     if ($contact_val['email'] != '') {
         $mail->addTo($contact_val['email']);
     }
     $mail->addBcc('*****@*****.**');
     $mail->setTemplate($template);
     $mail->setSubject($contact_val['email_subject']);
     $mail->send();
     $this->getPresenter()->flashMessage('Formulár bol úspešne odoslaný. Čoskoro Vás budeme kontaktovať.');
     $this->getPresenter()->redirect('this');
 }
 function RegEmailWell(&$smarty, &$form)
 {
     if ($smarty->cfg['emailwell'] == 1) {
         $smail = new MyMail($smarty);
         $smail->SetRemetentes($smarty->cfg['email'], $smarty->cfg['site_name']);
         $smail->SetTo($form['member_email'], $form['member_real'] . $smarty->get_config_vars('tratamento'));
         return $smail->SandMails($form, $smarty->get_config_vars('registro_sucesso_02') . $form['member_real'], 'email_wellcome.tpl');
     }
 }
Beispiel #5
0
 function handleCreateOrder()
 {
     $order_info = NEnvironment::getSession('user_order_info');
     $values = $order_info['values'];
     //		dump($values);exit;
     //presmerovanie ak nieco nieje v poriadku
     $session = NEnvironment::getSession('cart');
     if (empty($session->products)) {
         $this->redirect('default');
     }
     if (empty($order_info['values'])) {
         $this->redirect('step2');
     }
     //znama polick login na email
     $values['email'] = $values['login'];
     $values['id_lang'] = $this->id_lang;
     //odstranenie loginu
     unset($values['login']);
     //odstranenie terms_and_conditions
     unset($values['terms_and_conditions']);
     //odstranenie discount_hash
     //		$discount_hash = $values['discount_hash'];
     if ($values['type'] == NULL) {
         $values['type'] = 0;
     }
     $values['user_discount'] = 0;
     // ak je prihlaseny setni id_user
     if ($this->user->isLoggedIn()) {
         $values['id_user'] = $this->user->getIdentity()->data['user_id'];
         $values['user_discount'] = $this->user->getIdentity()->data['discount'];
     }
     $cart_info = OrderModel::getCartInfo($session->products, $order_info['values']['id_delivery'], $order_info['values']['id_payment'], $this->context, false);
     $values['total_price'] = $cart_info['total_sum'];
     $values['total_price_with_tax'] = $cart_info['total_sum_with_tax'];
     $values['delivery_title'] = $cart_info['delivery_title'];
     $values['delivery_price'] = $cart_info['delivery_price']['price'];
     $values['delivery_tax'] = $cart_info['delivery_price']['tax'];
     $values['payment_title'] = $cart_info['payment_title'];
     $values['payment_price'] = $cart_info['payment_price']['price'];
     $values['payment_tax'] = $cart_info['payment_price']['tax'];
     //odstranenie id_delivery
     unset($values['id_delivery']);
     //odstranenie id_payment
     unset($values['id_payment']);
     $values['rate'] = Lang::get($this->id_lang)->rate;
     try {
         $id_order = OrderModel::createOrder($values, $session->products, $this->id_lang, $this->user);
         $conf = $this->context->parameters;
         $template = $this->template;
         $template->setFile(APP_DIR . '/FrontModule/templates/Order/OrderEmail.phtml');
         $template->discount = false;
         $template->o = OrderModel::get($id_order);
         $mail = new MyMail();
         $mail->addTo($values['email']);
         $mail->addBcc($conf['client_email']);
         $mail->setSubject(_('Objednávka č. ') . $id_order);
         $mail->setTemplate($template);
         $mail->send();
         if ($conf['HEUREKA']['ENABLE'] == 1) {
             try {
                 $overeno = new HeurekaOvereno($conf['HEURELA']['API_KEY'], HeurekaOvereno::LANGUAGE_SK);
                 $overeno->setEmail($values['email']);
                 foreach ($session->products as $id_product_param => $p) {
                     $product = ProductModel::getProductIdentifyByParam($id_product_param, $this->id_lang, $this->user);
                     $overeno->addProduct($product->name);
                 }
                 $overeno->send();
             } catch (Exception $e) {
             }
         }
         //vymazanie z kosika
         $session = NEnvironment::getSession('cart');
         unset($session->products);
         //vymazanie info o uzivatelovi
         unset($order_info['values']);
         $this->redirect('Cart:success');
     } catch (OrderException $e) {
         $form->addError($e);
     }
 }
Beispiel #6
0
 function handleSendReference(NAppForm $form)
 {
     $values = $form->getValues();
     $product = ProductModel::get($values['id_product'], 1);
     if (!$product) {
         $this->getPresenter()->flashMessage('Pre daný produkt nemôžete odoslať referenciu.');
         $this->getPresenter()->redirect('this');
     }
     $template = $this->template;
     $template->setFile(dirname(__FILE__) . '/ReferenceEmail.phtml');
     $template->product_name = $product['name'];
     $template->v = $values;
     $mail = new MyMail();
     $mail->addTo(NEnvironment::getVariable('client_email'));
     $mail->setSubject(_('Pridanie referencie '));
     $mail->setTemplate($template);
     $mail->send();
     $this->getPresenter()->flashMessage('Referencia bola úspešne odoslaná.');
     $this->getPresenter()->redirect('this');
 }
Beispiel #7
0
 function createComponent($name)
 {
     switch ($name) {
         case 'statusForm':
             $f = new NAppForm($this, $name);
             $renderer = $f->getRenderer();
             $renderer->wrappers['pair']['container'] = '';
             $renderer->wrappers['controls']['container'] = '';
             $renderer->wrappers['control']['container'] = '';
             $renderer->wrappers['label']['container'] = '';
             $f->addSelect('order_status', 'Stav: ', OrderModel::getStatus());
             $f->addSubmit('btn_submit', 'Uložiť');
             $o = OrderModel::get($this->getParam('id'));
             $f->setDefaults($o);
             if ($f->isSubmitted() and $f->isValid()) {
                 $values = $f->getValues();
                 OrderModel::updateStatus($this->getParam('id'), $values['order_status']);
                 $o = OrderModel::get($this->getParam('id'));
                 $template = $this->template;
                 $template->setFile(APP_DIR . '/FrontModule/templates/Order/OrderChangeStatusEmail.phtml');
                 //print_r($o);
                 $template->o = $o;
                 $template->status = OrderModel::getStatus($o['order_status']);
                 //				echo $template->status;exit;
                 $mail = new MyMail();
                 $mail->addTo($o['email']);
                 $mail->addBcc(NEnvironment::getVariable('client_email'));
                 $mail->setSubject(_('Objednávka č. ') . $o['id_order'] . ' zmena stavu.');
                 $mail->setTemplate($template);
                 //echo $template;exit;
                 $mail->send();
                 $this->flashMessage('Bol odoslaný email o zmene statusu.');
                 $this->redirect('this');
             }
             return $f;
             break;
         case 'orderTabella':
             $grid = new Tabella(OrderModel::getDatasource(), array('sorting' => 'desc', 'order' => 'id_order'));
             $grid->addColumn("Číslo obj.", "id_order", array("width" => 50));
             $grid->addColumn("Meno", "name", array("width" => 100));
             $grid->addColumn("Priezvisko", "surname", array("width" => 100));
             $grid->addColumn("Mesto", "city", array("width" => 100));
             $grid->addColumn("Dátum vytvorenia", "add_date", array("width" => 100));
             $grid->addColumn("Celková cena", "total_price", array("width" => 100));
             $grid->addColumn("Stav", "order_status", array("width" => 50, 'type' => Tabella::SELECT, "editable" => true, "filter" => OrderModel::getStatus(), 'renderer' => function ($row) {
                 $el = NHtml::el("td")->setHtml(OrderModel::getStatus($row['order_status']));
                 return $el;
             }));
             $grid->addColumn("Spôsob platby", "payment_method", array("width" => 90, 'type' => Tabella::SELECT, "editable" => false, "filter" => OrderModel::getPaymentMethod(), 'renderer' => function ($row) {
                 $el = NHtml::el("td")->setHtml(OrderModel::getPaymentMethod($row['payment_method']));
                 return $el;
             }));
             $grid->addColumn("", "", array("width" => 30, 'filter' => NULL, "options" => '', "renderer" => function ($row) {
                 $el = NHtml::el("td");
                 /*
                  * link na zmazanie produktu
                  */
                 $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('deleteOrder!', array('id' => $row->id_order)))->addClass('deleteIcon'));
                 /*
                  * link na editaciu produktu
                  */
                 $el->add(NHtml::el('a')->href(NEnvironment::getApplication()->getPresenter()->link('view', array('id' => $row->id_order)))->addClass('editIcon'));
                 /*
                  * ikona aktivan polozka, neaktivan polozka
                  */
                 $span = NHtml::el('span');
                 $el->add($span);
                 return $el;
             }));
             $this->addComponent($grid, $name);
             break;
         default:
             return parent::createComponent($name);
             break;
     }
 }
 function saveRegistration(NFORM $form)
 {
     $values = (array) $form->getValues();
     $user = UserModel::getFluent(false)->where(' login = %s', $values['login'])->fetch();
     try {
         if ($user and $user['login'] == $values['login']) {
             throw new InvalidStateException(_('Uživateľ pod týmto prihlasovacím meno už existuje.'));
         }
         //			if($user AND $user['email'] == $values['email'])
         //				throw new InvalidStateException( _('Emailová adresa sa už nachádza v databáze. ') );
         //
         unset($values['passwordCheck']);
         unset($values['terms_and_conditions']);
         $values['activate'] = 1;
         //registrovany dostane automaticky 2% zlavu
         $values['discount'] = 2;
         UserModel::insert($values);
         $this->flashMessage("Registrácia je dokončená, účet aktivovaný a ste prihlásený na stránke.");
         $template = clone $this->template;
         $template->setFile(APP_DIR . '/FrontModule/templates/Profil/registrationConfirmEmail.phtml');
         $template->values = $values;
         $mail = new MyMail();
         $mail->addTo($values['login']);
         $mail->addBcc(NEnvironment::getVariable('error_email'));
         $mail->setSubject(_('Informácie o účte'));
         $mail->setTemplate($template);
         $mail->send();
         $this->user->login($values['login'], $values['password']);
         if ($this->backlink != '') {
             $this->restoreRequest($this->backlink);
         } else {
             $this->redirect('Homepage:default');
         }
     } catch (InvalidStateException $e) {
         $form->addError($e->getMessage());
         //			throw $e;
     }
 }