コード例 #1
0
 public function index()
 {
     $form = new SimpleForm\Form(array('name' => 'forgotpassword', 'action' => '', 'method' => 'post'));
     $form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_EMAIL')), new SimpleForm\Rules\Email(_('ERR_WRONG_EMAIL'))))));
     if ($form->Validate()) {
         $formData = $form->getSubmitValues();
         $result = App::getModel('forgotpassword')->authProccess($formData['email']);
         if ($result > 0) {
             $hash = App::getModel('forgotpassword')->generateLink($formData['email']);
             $link = $this->registry->router->generate('frontend.forgotpassword', true, array('action' => 'confirm', 'param' => $hash));
             $this->registry->template->assign('link', $link);
             App::getModel('mailer')->sendEmail(array('template' => 'forgotPassword', 'email' => array($formData['email']), 'bcc' => false, 'subject' => _('TXT_PASSWORD_FORGOT'), 'viewid' => Helper::getViewId()));
             Session::setVolatileSendPassword(1, false);
             Session::setVolatileForgotPasswordError();
         } elseif ($result < 0) {
             Session::setVolatileForgotPasswordError(2, false);
         } else {
             Session::setVolatileSendPassword();
             Session::setVolatileForgotPasswordError(1, false);
         }
     }
     $error = Session::getVolatileForgotPasswordError();
     if ($error[0] == 1) {
         $this->registry->template->assign('emailerror', _('ERR_EMAIL_NO_EXIST'));
     } elseif ($error[0] == 2) {
         $this->registry->template->assign('emailerror', _('TXT_BLOKED_USER'));
     }
     $sendPasswd = Session::getVolatileSendPassword();
     if ($sendPasswd[0] == 1) {
         $this->registry->template->assign('sendPasswd', _('TXT_CHECK_PRIVATE_MAIL_WITH_NEW_PASSWD'));
     }
     $this->registry->template->assign('form', $form->getForm());
     return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
 }
コード例 #2
0
ファイル: forgotlogin.php プロジェクト: krisldz/Gekosale2
 public function index()
 {
     if (Session::getActiveUserid() != null) {
         App::redirect(__ADMINPANE__ . '/mainside');
     }
     $form = new FormEngine\Elements\Form(array('name' => 'forgotlogin', 'action' => '', 'method' => 'post', 'class' => 'login-form'));
     $form->AddChild(new FormEngine\Elements\TextField(array('name' => 'login', 'label' => _('TXT_EMAIL_FORM_LOGIN'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_LOGIN_FORM_LOGIN'))))));
     $form->AddChild(new FormEngine\Elements\Submit(array('name' => 'log_in', 'label' => _('TXT_FORGOT_PASSWORD'))));
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         $loginValues = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
         $result = App::getModel('login')->checkUsers($loginValues['login']);
         if ($result == 0) {
             Session::setVolatileLoginError(1, false);
         } else {
             $password = Core::passwordGenerate();
             App::getModel('login')->changeUsersPassword($result, $password);
             $this->registry->template->assign('password', $password);
             App::getModel('mailer')->sendEmail(array('template' => 'forgotUsers', 'email' => array($_POST['login']), 'bcc' => false, 'subject' => _('TXT_FORGOT_PASSWORD'), 'viewid' => Helper::getViewId()));
             Session::setVolatileMessage("Nowe hasło zostało wysłane na podany adres e-mail.");
             App::redirect('login');
         }
     }
     $error = Session::getVolatileLoginError();
     if ($error[0] == 1) {
         $this->registry->template->assign('error', _('ERR_BAD_EMAIL'));
     }
     $languages = App::getModel('language')->getLanguages();
     $this->registry->xajax->processRequest();
     $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
     $this->registry->template->assign('form', $form->Render());
     $this->registry->template->assign('languages', json_encode($languages));
     $this->registry->template->display($this->loadTemplate('index.tpl'));
 }
コード例 #3
0
ファイル: paymentmethod.php プロジェクト: krisldz/Gekosale2
 public function add()
 {
     $populateData = array('required_data' => array('controller' => 0), 'view_data' => array('view' => Helper::getViewIdsDefault()));
     $form = $this->formModel->initForm(1);
     $form->Populate($populateData);
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         $id = $this->model->addNewPaymentmethod($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT));
         if (FormEngine\FE::IsAction('next')) {
             App::redirect(__ADMINPANE__ . '/paymentmethod/add');
         } else {
             if (Helper::getViewId() > 0) {
                 Session::setVolatileMessage("Moduł płatności został dodany. Skonfiguruj go teraz w zakładce Konfiguracja.");
                 App::redirect(__ADMINPANE__ . '/paymentmethod/edit/' . $id);
             } else {
                 App::redirect(__ADMINPANE__ . '/paymentmethod');
             }
         }
     }
     $this->registry->template->assign('form', $form->Render());
     $this->registry->xajax->processRequest();
     $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
     $this->registry->template->display($this->loadTemplate('add.tpl'));
 }
コード例 #4
0
ファイル: Memcache.php プロジェクト: krisldz/Gekosale2
 protected function getId($name)
 {
     if (strncmp('session_', $name, 8) === 0) {
         return $this->prefix . '_' . strtolower($name);
     }
     $cacheid = \Gekosale\Helper::getViewId() . '_' . \Gekosale\Helper::getLanguageId();
     return $this->prefix . '_' . strtolower($name) . '_' . $cacheid;
 }
コード例 #5
0
ファイル: paypal.php プロジェクト: krisldz/Gekosale2
 public function saveSettings($request)
 {
     if ($request['model'] != $this->getName()) {
         return false;
     }
     $Settings = array('business' => $request['data']['business'], 'apipassword' => $request['data']['apipassword'], 'apiusername' => $request['data']['apiusername'], 'apisignature' => $request['data']['apisignature'], 'sandbox' => $request['data']['sandbox'], 'positiveorderstatusid' => $request['data']['positiveorderstatusid'], 'negativeorderstatusid' => $request['data']['negativeorderstatusid']);
     $this->registry->core->saveModuleSettings('paypal', $Settings, Helper::getViewId());
 }
コード例 #6
0
ファイル: transferuj.php プロジェクト: krisldz/Gekosale2
 public function getPaymentData($order)
 {
     $settings = $this->registry->core->loadModuleSettings('transferuj', Helper::getViewId());
     if (isset($order['orderData']['priceWithDispatchMethodPromo'])) {
         $kwota = $order['orderData']['priceWithDispatchMethodPromo'];
     } else {
         $kwota = $order['orderData']['priceWithDispatchMethod'];
     }
     if ($settings) {
         $Data = array('idsprzedawcy' => $settings['idsprzedawcy'], 'kodsprzedawcy' => $settings['kodsprzedawcy'], 'crc' => base64_encode(session_id() . '-' . $order['orderId']), 'amount' => $kwota, 'md5sum' => md5($settings['idsprzedawcy'] . $kwota . base64_encode(session_id() . '-' . $order['orderId']) . $settings['kodsprzedawcy']));
     }
     return $Data;
 }
コード例 #7
0
ファイル: contactbox.php プロジェクト: krisldz/Gekosale2
 public function index()
 {
     $contacts = App::getModel('Contact')->getContactToSelect();
     $contactList = App::getModel('Contact')->getContactList();
     $form = new SimpleForm\Form(array('name' => 'contactform', 'action' => '', 'method' => 'post'));
     $form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_EMAIL')), new SimpleForm\Rules\Email(_('ERR_WRONG_EMAIL'))))));
     $form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'))));
     if ((int) $this->registry->core->getParam() == 0) {
         $form->AddChild(new SimpleForm\Elements\TextField(array('name' => 'topic', 'label' => _('TXT_TOPIC'), 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_TOPIC'))))));
     }
     $form->AddChild(new SimpleForm\Elements\TextArea(array('name' => 'content', 'label' => _('TXT_CONTENT'), 'rows' => 10, 'cols' => 100, 'rules' => array(new SimpleForm\Rules\Required(_('ERR_EMPTY_CONTACT_CONTENT'))))));
     $client = App::getModel('client')->getClient();
     if (!empty($client)) {
         $form->Populate(array('firstname' => $client['firstname'], 'surname' => $client['surname'], 'phone' => $client['phone'], 'email' => $client['email']));
     }
     if ($form->Validate()) {
         $formData = $form->getSubmitValues();
         $emails = array($formData['email']);
         if (isset($formData['contactsubject'])) {
             $emails[] = App::getModel('Contact')->getDepartmentMail($formData['contactsubject']);
         }
         $content = $formData['content'];
         if ((int) $this->registry->core->getParam() > 0) {
             $subject = _('TXT_PRODUCT_QUOTE') . ' ' . $this->product['productname'];
             $this->registry->template->assign('productLink', $this->registry->router->generate('frontend.productcart', true, array('param' => $this->product['seo'])));
         } else {
             $subject = $formData['topic'];
         }
         $this->registry->template->assign('CONTACT_CONTENT', $formData['content']);
         $this->registry->template->assign('firstname', $formData['firstname']);
         $this->registry->template->assign('surname', $formData['surname']);
         $this->registry->template->assign('email', $formData['email']);
         $this->registry->template->assign('phone', $formData['phone']);
         App::getModel('mailer')->sendEmail(array('template' => 'contact', 'email' => $emails, 'bcc' => true, 'subject' => $subject, 'viewid' => Helper::getViewId()));
         Session::setVolatileSendContact(1, false);
         App::redirectUrl($this->registry->router->generate('frontend.contact', true));
     }
     $sendContact = Session::getVolatileSendContact();
     if ($sendContact[0] == 1) {
         $this->registry->template->assign('sendContact', _('TXT_CONTACT_SENT'));
     }
     $this->registry->template->assign('form', $form->getForm());
     if ((int) $this->registry->core->getParam() > 0) {
         $this->registry->template->assign('productid', $this->getParam());
     }
     $this->registry->template->assign('content', App::getModel('staticcontent')->getContentByRoute('frontend.contact'));
     $this->registry->template->assign('contactList', $contactList);
     return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
 }
コード例 #8
0
ファイル: przelewy24.php プロジェクト: krisldz/Gekosale2
 public function getPaymentData($order)
 {
     $settings = $this->registry->core->loadModuleSettings('przelewy24', Helper::getViewId());
     $Data = array();
     if (isset($order['orderData']['priceWithDispatchMethodPromo'])) {
         $kwota = $this->formatPrice($order['orderData']['priceWithDispatchMethodPromo']);
     } else {
         $kwota = $this->formatPrice($order['orderData']['priceWithDispatchMethod']);
     }
     $sessionId = base64_encode(session_id() . '-' . $order['orderId']);
     if ($settings) {
         $Data = array('idsprzedawcy' => $settings['idsprzedawcy'], 'kwota' => $kwota, 'sessionid' => $sessionId, 'crc' => md5($sessionId . '|' . $settings['idsprzedawcy'] . '|' . $kwota . '|' . $settings['crc']));
     }
     return $Data;
 }
コード例 #9
0
ファイル: dotpay.php プロジェクト: krisldz/Gekosale2
 public function getPaymentData($order)
 {
     $settings = $this->registry->core->loadModuleSettings('dotpay', Helper::getViewId());
     $Data = array();
     if (isset($order['orderData']['priceWithDispatchMethodPromo'])) {
         $kwota = $order['orderData']['priceWithDispatchMethodPromo'];
     } else {
         $kwota = $order['orderData']['priceWithDispatchMethod'];
     }
     if ($settings) {
         $crc = base64_encode(session_id() . '-' . $order['orderId']);
         $Data = array('idsprzedawcy' => $settings['idsprzedawcy'], 'pin' => $settings['pin'], 'crc' => $crc, 'amount' => number_format($kwota, 2, '.', ''));
     }
     return $Data;
 }
コード例 #10
0
ファイル: autosuggest.php プロジェクト: krisldz/Gekosale2
 public function __construct($registry)
 {
     parent::__construct($registry);
     $this->queryColumns = array();
     $this->queryColumnsOptions = array();
     $this->queryTable = '';
     $this->queryFrom = '';
     $this->queryWhere = '';
     $this->queryAdditionalWhere = '';
     $this->queryGroupBy = '';
     $this->encryptionKey = Session::getActiveEncryptionKeyValue();
     $this->languageId = Helper::getLanguageId();
     $this->sqlParams = array();
     $this->viewId = !is_null(Helper::getViewId()) ? Helper::getViewId() : 0;
     $this->viewIds = Helper::getViewIds();
 }
コード例 #11
0
ファイル: FileUploader.php プロジェクト: krisldz/Gekosale2
    protected final function insertFile($name)
    {
        $sql = 'INSERT INTO file(name, filetypeid, fileextensionid, viewid)
				VALUES (:name, :filetypeid, :fileextensionid, :viewid)';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('name', Core::clearUTF($name));
        $stmt->bindValue('filetypeid', current($this->fileType));
        $stmt->bindValue('viewid', Helper::getViewId());
        $stmt->bindValue('fileextensionid', $this->allowedExtensions[strtolower($this->tmpExtension)]);
        try {
            $stmt->execute();
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
        $idFile = Db::getInstance()->lastInsertId();
        $this->insertedFileFullName = $idFile . '.' . $this->tmpExtension;
        $this->registry->cache->delete('files');
        $this->setFiles();
        return $idFile;
    }
コード例 #12
0
ファイル: ceneo.php プロジェクト: krisldz/Gekosale2
 public function addTransJs($order)
 {
     $settings = $this->registry->core->loadModuleSettings('ceneo', Helper::getViewId());
     if (!empty($settings) && isset($settings['ceneoguid'])) {
         $account = $settings['ceneoguid'];
         $code = '';
         if (strlen($account) > 0) {
             $code .= "<script type=\"text/javascript\">";
             $code .= "ceneo_client_email = '{$order['orderData']['contactData']['email']}';";
             $code .= "ceneo_order_id = '{$order['orderId']}';";
             $code .= "</script>";
             $code .= "<script type=\"text/javascript\" src=\"https://ssl.ceneo.pl/transactions/track/v2/script.js?accountGuid={$account}\"></script>";
         }
         return $code;
     }
 }
コード例 #13
0
ファイル: product.php プロジェクト: volfen/Gekosale2
 public function getAlsoProduct($id)
 {
     $sql = "SELECT OP.orderid\n\t\t\t\tFROM orderproduct OP\n\t\t\t\tLEFT JOIN `order` O ON O.idorder = OP.orderid\n\t\t\t\tWHERE OP.productid= :id and O.viewid= :viewid";
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('id', $id);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->execute();
     $Data = array();
     while ($rs = $stmt->fetch()) {
         $Data[] = $rs['orderid'];
     }
     return $Data;
 }
コード例 #14
0
ファイル: layoutbox.php プロジェクト: krisldz/Gekosale2
 public function edit()
 {
     $this->registry->xajax->registerFunction(array('DeleteLayoutBox', $this->model, 'deleteLayoutbox'));
     $layoutboxes = $this->model->getLayoutBoxTree();
     $pagescheme_id = $this->id;
     // selected by user
     if (Helper::getViewId() > 0 && $pagescheme_id != $this->registry->core->getParam(0)) {
         // if it is not current view pagescheme change it
         App::redirect(__ADMINPANE__ . '/layoutbox/edit/' . $pagescheme_id . ',' . $this->model->getFirstLayoutBox($pagescheme_id));
     }
     $layoutbox_id = $this->registry->core->getParam(1);
     // id from URL
     if ((int) $layoutbox_id == 0 || empty($layoutboxes[$pagescheme_id . ',' . $layoutbox_id])) {
         // change pagescheme if subpage is not inside active
         $pagescheme_id = App::getModel('view')->getViewPagescheme(Helper::getViewId());
         App::redirect(__ADMINPANE__ . '/layoutbox/edit/' . $pagescheme_id . ',' . $this->model->getFirstLayoutBox($pagescheme_id));
     }
     $layoutBox = $this->model->getLayoutBoxToEdit($layoutbox_id);
     $behaviourBoxArray = $this->model->getLayoutBoxJSValuesToEdit($layoutbox_id);
     $ctValues = $this->model->getLayoutBoxContentTypeSpecificValues($layoutbox_id);
     if (isset($ctValues['categoryId']) && $ctValues['categoryId'] > 0) {
         $this->categoryActive = $ctValues['categoryId'];
         $this->categories = App::getModel('category')->getChildCategories(0, array($this->categoryActive));
     }
     $tree = new FormEngine\Elements\Form(array('name' => 'scheme_tree', 'action' => '', 'method' => 'post'));
     $tree->AddChild(new FormEngine\Elements\Tree(array('name' => 'pagescheme', 'sortable' => false, 'retractable' => false, 'selectable' => false, 'clickable' => true, 'deletable' => true, 'addable' => false, 'items' => $layoutboxes, 'onClick' => 'openLayoutBoxEditor', 'active' => $pagescheme_id . ',' . $layoutbox_id)));
     $form = new FormEngine\Elements\Form(array('name' => 'layoutbox', 'action' => '', 'method' => 'post'));
     $contentTypes = $this->model->getLayoutBoxContentTypeOptions();
     $boxEdit = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'box', 'label' => _('TXT_BOX_SETTINGS'))));
     $boxEdit->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'comment' => 'Wewnętrzna nazwa boksu, niewidoczna dla Klientów', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME'))))));
     $title = $boxEdit->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data')));
     $title->AddChild(new FormEngine\Elements\TextField(array('name' => 'title', 'label' => _('TXT_BOX_TITLE'), 'comment' => 'Tytuł boksu, który zobaczą Klienci', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_BOX_TITLE'))))));
     $boxContent = $boxEdit->AddChild(new FormEngine\Elements\Select(array('name' => 'box_content', 'label' => _('TXT_BOX_CONTENT'), 'options' => FormEngine\Option::Make($this->model->getLayoutBoxContentTypeOptionsAllToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_BOX_CONTENT'))))));
     $this->_addContentTypeSpecificFields($form, $boxContent, $contentTypes);
     $boxBehaviourEdit = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'behaviour', 'label' => _('TXT_BOX_BEHAVOIUR'))));
     $boxBehaviourEdit->AddChild(new FormEngine\Elements\Select(array('name' => 'bNoHeader', 'label' => 'Wyświetlaj nagłówek', 'options' => array(new FormEngine\Option('0', 'Tak'), new FormEngine\Option('1', 'Nie')))));
     $boxBehaviourEdit->AddChild(new FormEngine\Elements\TextField(array('name' => 'iDefaultSpan', 'label' => 'Domyślne rozciągnięcie', 'comment' => 'Wpisz liczbę kolumn', 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^(([0-9]{1,2})|(\\0)?)$/')))));
     $boxBehaviourEdit->AddChild(new FormEngine\Elements\Select(array('name' => 'iEnableBox', 'label' => 'Wyświetlanie boksu', 'options' => array(new FormEngine\Option('0', 'Dla wszystkich'), new FormEngine\Option('1', 'Dla zalogowanych'), new FormEngine\Option('2', 'Dla niezalogowanych'), new FormEngine\Option('3', 'Nie wyświetlaj')))));
     $populate = array('box' => array('name' => $layoutBox['name'], 'language_data' => array('title' => $layoutBox['title']), 'box_content' => $layoutBox['controller']), 'behaviour' => array('bNoHeader' => 0, 'iDefaultSpan' => '1', 'iEnableBox' => 0));
     if (isset($behaviourBoxArray) && count($behaviourBoxArray) > 0) {
         foreach ($behaviourBoxArray as $js => $value) {
             $populate['behaviour'][$js] = $value;
         }
     }
     $populate = $this->_populateContentTypeFields($contentTypes, $populate, $ctValues, $layoutBox['controller']);
     $form->Populate($populate);
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         $this->model->editLayoutBox($this->_performArtificialMechanics($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT)), $layoutbox_id);
         if (FormEngine\FE::IsAction('continue')) {
             App::redirect(__ADMINPANE__ . '/layoutbox/edit/' . $pagescheme_id . ',' . $layoutbox_id);
         } else {
             App::redirect(__ADMINPANE__ . '/layoutbox');
         }
     }
     $this->renderLayout(array('tree' => $tree->Render(), 'id' => $layoutbox_id, 'form' => $form->Render()));
 }
コード例 #15
0
ファイル: delivery.php プロジェクト: krisldz/Gekosale2
 public function getDispatchmethodPriceForProduct($globalprice, $globalweight)
 {
     $Data = array();
     $sql = "SELECT \n\t\t\t\t\tDP.dispatchmethodid,\n\t\t\t\t\tDP.`from`, \n\t\t\t\t\tDP.`to`, \n\t\t\t\t\tV.value, \n\t\t\t\t\tDP.iddispatchmethodprice,\n\t\t\t\t\tIF(DP.vat IS NOT NULL, ROUND(DP.dispatchmethodcost + (DP.dispatchmethodcost * (V.`value`/100)), 4), DP.dispatchmethodcost) * CR.exchangerate as dispatchmethodcost,\n\t\t\t\t\tCASE\n  \t\t\t\t\t\tWHEN (`from` <> 0 AND `from` < :globalprice AND `to`= 0 AND DP.dispatchmethodcost = 0) THEN DMT.name\n \t\t\t\t\t \tWHEN (:globalprice BETWEEN `from` AND `to`) THEN DMT.name\n  \t\t\t\t\t\tWHEN (`to` = 0 AND `from` < :globalprice AND DP.dispatchmethodcost <> 0) THEN DMT.name\n  \t\t\t\t\t\tWHEN (`from` = 0 AND `to`=0 AND DP.dispatchmethodcost =0) THEN DMT.name\n\t\t\t\t\tEND as name\n\t\t\t\tFROM dispatchmethodprice DP\n\t\t\t\tLEFT JOIN dispatchmethod D ON D.iddispatchmethod = dispatchmethodid\n        LEFT JOIN dispatchmethodtranslation DMT ON DMT.dispatchmethodid = D.iddispatchmethod AND DMT.languageid = :languageid\n\t\t\t\tLEFT JOIN vat V ON V.idvat = DP.vat\n\t\t\t\tLEFT JOIN dispatchmethodview DV ON DV.dispatchmethodid = D.iddispatchmethod\n\t\t\t\tLEFT JOIN currencyrates CR ON CR.currencyfrom = D.currencyid AND CR.currencyto = :currencyto\n\t\t\t\tWHERE DV.viewid= :viewid AND IF(D.maximumweight IS NOT NULL, D.maximumweight >= :globalweight, 1) AND D.type = 1\n\t\t\t\tORDER BY D.hierarchy ASC";
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('languageid', Helper::getLanguageId());
     $stmt->bindValue('globalprice', $globalprice);
     $stmt->bindValue('globalweight', $globalweight);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->bindValue('currencyto', Session::getActiveCurrencyId());
     $stmt->execute();
     while ($rs = $stmt->fetch()) {
         $dispatchmethodid = $rs['dispatchmethodid'];
         if ($rs['name'] != NULL) {
             $dispatchmethodcost = $rs['dispatchmethodcost'];
             $Data[] = array('dispatchmethodid' => $dispatchmethodid, 'name' => _($rs['name']), 'from' => $rs['from'], 'to' => $rs['to'], 'vatvalue' => $rs['value'], 'dispatchmethodcost' => $this->priceFormatParser($dispatchmethodcost));
         }
     }
     $sql = "SELECT\n\t\t\t\t\tDW.dispatchmethodid, \n\t\t\t\t\tDW.`from`, \n\t\t\t\t\tDW.`to`, \n\t\t\t\t\tV.value, \n\t\t\t\t\tDW.iddispatchmethodweight,\n\t\t\t\t\tIF(DW.vat IS NOT NULL, ROUND(DW.cost+(DW.cost*(V.`value`/100)),4), DW.cost) * CR.exchangerate as dispatchmethodcost, \n\t\t\t\t\tD.freedelivery,\n\t\t\t\t\tCASE\n  \t\t\t\t\t\tWHEN (`from`<>0 AND `from`<:globalweight AND `to`=0 AND DW.cost =0) THEN DMT.name\n \t\t\t\t\t \tWHEN (:globalweight BETWEEN `from` AND `to`) THEN DMT.name\n  \t\t\t\t\t\tWHEN (`to` = 0 AND `from`<:globalweight AND DW.cost <> 0) THEN DMT.name\n  \t\t\t\t\t\tWHEN (`from`=0 AND `to`=0 AND DW.cost = 0) THEN DMT.name\n\t\t\t\t\tEND as name\n\t\t\t\tFROM dispatchmethodweight DW\n\t\t\t\tLEFT JOIN vat V ON V.idvat = DW.vat\n\t\t\t\tLEFT JOIN dispatchmethod D ON D.iddispatchmethod = DW.dispatchmethodid\n        LEFT JOIN dispatchmethodtranslation DMT ON DMT.dispatchmethodid = D.iddispatchmethod AND DMT.languageid = :languageid\n\t\t\t\tLEFT JOIN dispatchmethodview DV ON DV.dispatchmethodid = D.iddispatchmethod\n\t\t\t\tLEFT JOIN currencyrates CR ON CR.currencyfrom = D.currencyid AND CR.currencyto = :currencyto\n\t\t\t\tWHERE DV.viewid= :viewid AND D.type = 2\n\t\t\t\tORDER BY D.hierarchy ASC";
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('languageid', Helper::getLanguageId());
     $stmt->bindValue('globalprice', $globalprice);
     $stmt->bindValue('globalweight', $globalweight);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->bindValue('currencyto', Session::getActiveCurrencyId());
     $stmt->execute();
     while ($rs = $stmt->fetch()) {
         $dispatchmethodid = $rs['dispatchmethodid'];
         if ($rs['name'] != NULL) {
             if ($rs['freedelivery'] > 0 && $rs['freedelivery'] <= $globalprice) {
                 $dispatchmethodcost = 0.0;
             } else {
                 $dispatchmethodcost = $rs['dispatchmethodcost'];
             }
             $Data[] = array('dispatchmethodid' => $dispatchmethodid, 'name' => _($rs['name']), 'from' => $rs['from'], 'to' => $rs['to'], 'vatvalue' => $rs['value'], 'dispatchmethodcost' => $this->priceFormatParser($dispatchmethodcost));
         }
     }
     return $Data;
 }
コード例 #16
0
ファイル: Router.php プロジェクト: krisldz/Gekosale2
 public function controllerLoader()
 {
     $namespaces = $this->registry->loader->getNamespaces();
     $mode = $this->getModeName();
     if ($this->route['mode'] == 'admin' && Session::getActiveUserid() > 0 && $this->baseController == 'login') {
         App::redirect(__ADMINPANE__ . '/mainside');
     }
     if ($this->route['mode'] == 'admin' && NULL == Session::getActiveUserid() && $this->baseController != 'login') {
         App::redirect(__ADMINPANE__);
     }
     if ($this->route['mode'] != 'admin' && $this->registry->loader->getParam('forcelogin') == 1 && NULL == Session::getActiveClientid() && !in_array($this->baseController, array('clientlogin', 'forgotpassword', 'registration'))) {
         App::redirectUrl($this->generate('frontend.clientlogin', true));
     }
     if ($this->getAdministrativeMode() && !in_array($this->baseController, array('logout', 'permissionerror')) && in_array($this->action, array_flip($this->registry->right->getRights()))) {
         try {
             $this->registry->right->checkPermission($this->baseController, $this->action, App::getModel('users')->getLayerIdByViewId(Helper::getViewId()));
         } catch (Exception $e) {
             App::redirect(__ADMINPANE__ . '/permissionerror');
         }
     }
     $lastNs = '';
     foreach ($namespaces as $namespace) {
         $ns = $namespace . DS . $mode . DS . strtolower($this->baseController . DS . 'controller' . DS . $this->baseController);
         if (isset($this->classesMap[$ns])) {
             require_once $this->classesMap[$ns];
             $lastNs = $namespace;
         }
     }
     if (!empty($lastNs)) {
         $controllerFullName = $lastNs . '\\' . $this->baseController . 'Controller';
         $controllerObject = new $controllerFullName($this->registry);
         $controllerObject->setDesignPath(strtolower($this->baseController . DS . $this->action . DS));
     }
     if (isset($controllerObject) && is_object($controllerObject) && is_callable(array($controllerObject, $this->action))) {
         // force offline
         if (!$controllerObject instanceof \Gekosale\ErrorController && !$controllerObject instanceof \Gekosale\InstanceReportController && $this->route['mode'] != 'admin' && $this->registry->loader->isOffline() && !(Session::getActiveUserid() > 0)) {
             require_once ROOTPATH . 'plugin' . DS . 'Gekosale' . DS . 'Frontend' . DS . 'offline' . DS . 'controller' . DS . 'offline.php';
             $controllerObject = new OfflineController($this->registry);
             $controllerObject->setDesignPath(strtolower('offline' . DS . 'index' . DS));
             $this->action = 'index';
         }
         $content = call_user_func(array($controllerObject, $this->action));
         $response = new Response($content);
         $response->send();
     } else {
         $exception = new \Gekosale\Router\InvalidUrlException('Niepoprawny adres: ' . App::getUrl());
         if ($this->route['mode'] == 'admin') {
             App::redirectUrl($this->generate('admin', true, array('controller' => 'error', 'param' => '404')));
         }
     }
 }
コード例 #17
0
ファイル: order.php プロジェクト: krisldz/Gekosale2
 public function edit()
 {
     Event::dispatch($this, 'admin.order.checkPaymentStatus', array('id' => (int) $this->registry->core->getParam()));
     $rawOrderData = $this->model->getOrderById($this->registry->core->getParam());
     if (isset($rawOrderData['currencyid']) && !empty($rawOrderData['currencyid'])) {
         $currencyid = $rawOrderData['currencyid'];
     } else {
         $currencyid = Session::getActiveShopCurrencyId();
     }
     try {
         $order = $this->model->getOrderById((int) $this->registry->core->getParam());
         $order['id'] = (int) $this->registry->core->getParam();
         $orderNotes = $this->model->getOrderNotes($order['id']);
         $clientOrderHistory = $this->model->getclientOrderHistory($order['clientid']);
     } catch (Exception $e) {
         throw new CoreException($e->getMessage());
     }
     $addNotes = new FormEngine\Elements\Form(array('name' => 'add_notes', 'class' => 'statusChange', 'action' => '', 'method' => 'post'));
     $addNotes->AddChild(new FormEngine\Elements\Textarea(array('name' => 'contents', 'label' => _('TXT_CONTENT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CONTENT'))))));
     $addNotes->AddChild(new FormEngine\Elements\Submit(array('name' => 'add', 'label' => _('TXT_ADD'), 'icon' => '_images_panel/icons/buttons/add.png')));
     $form = new FormEngine\Elements\Form(array('name' => 'order', 'action' => '', 'class' => 'editOrder', 'method' => 'post'));
     $productsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'products_data', 'label' => _('TXT_EDIT_ORDER_ORDERED_PRODUCTS'))));
     $products = $productsData->AddChild(new FormEngine\Elements\OrderEditor(array('name' => 'products', 'label' => _('TXT_EDIT_ORDER_ORDERED_PRODUCTS'), 'advanced_editor' => true, 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE, 'clientgroupid' => (int) $rawOrderData['clientgroupid'], 'currencyid' => (int) $rawOrderData['currencyid'], 'viewid' => $rawOrderData['viewid'], 'on_change' => 'OnProductListChanged')));
     $addressData = $form->AddChild(new FormEngine\Elements\Columns(array('name' => 'address_data')));
     $billingData = $addressData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'billing_data', 'label' => _('TXT_EDIT_ORDER_BILLING_DATA'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'place', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE'))))));
     $billingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => 0, 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone2', 'label' => _('TXT_ADDITIONAL_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL'))))));
     $shippingData = $addressData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'shipping_data', 'label' => _('TXT_EDIT_ORDER_SHIPPING_DATA'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'place', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE'))))));
     $shippingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => 0, 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PHONE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone2', 'label' => _('TXT_ADDITIONAL_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL'))))));
     $additionalData = $form->AddChild(new FormEngine\Elements\Columns(array('name' => 'additional_data')));
     $paymentData = $additionalData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'payment_data', 'label' => _('TXT_EDIT_ORDER_PAYMENT_METHOD'))));
     $paymentData->AddChild(new FormEngine\Elements\Select(array('name' => 'payment_method', 'label' => _('TXT_EDIT_ORDER_PAYMENT_METHOD'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + $this->model->getPaymentmethodAllToSelect($this->registry->core->getParam())))));
     $weight = 0;
     foreach ($order['products'] as $product) {
         $weight += $product['weight'];
     }
     $paymentData->AddChild(new FormEngine\Elements\Select(array('name' => 'delivery_method', 'label' => _('TXT_EDIT_ORDER_DELIVERY_METHOD'), 'options' => FormEngine\Option::Make($this->model->getDispatchmethodAllToSelect($order['total'], $this->registry->core->getParam(), $weight)))));
     $paymentData->AddChild(new FormEngine\Elements\Select(array('name' => 'rules_cart', 'label' => _('TXT_RULES_CART'), 'options' => FormEngine\Option::Make($this->model->getAllRulesForOrder($this->registry->core->getParam())))));
     $paymentData->AddChild(new FormEngine\Elements\Constant(array('name' => 'currency', 'label' => _('TXT_KIND_OF_CURRENCY'))));
     $summaryData = $additionalData->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'summary_data', 'label' => _('TXT_VIEW_ORDER_SUMMARY'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_net_total', 'label' => _('TXT_NETTO_AMOUNT'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_vat_value', 'label' => _('TXT_VIEW_ORDER_TAX'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_delivery', 'label' => _('TXT_DELIVERERPRICE'))));
     $summaryData->AddChild(new FormEngine\Elements\Constant(array('name' => 'total_total', 'label' => _('TXT_VIEW_ORDER_TOTAL'))));
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     $orderData = array('address_data' => array('billing_data' => array('firstname' => $rawOrderData['billing_address']['firstname'], 'surname' => $rawOrderData['billing_address']['surname'], 'street' => $rawOrderData['billing_address']['street'], 'streetno' => $rawOrderData['billing_address']['streetno'], 'placeno' => $rawOrderData['billing_address']['placeno'], 'place' => $rawOrderData['billing_address']['city'], 'postcode' => $rawOrderData['billing_address']['postcode'], 'countryid' => $rawOrderData['billing_address']['countryid'], 'companyname' => $rawOrderData['billing_address']['companyname'], 'nip' => $rawOrderData['billing_address']['nip'], 'phone' => $rawOrderData['billing_address']['phone'], 'phone2' => $rawOrderData['billing_address']['phone2'], 'email' => $rawOrderData['billing_address']['email']), 'shipping_data' => array('firstname' => $rawOrderData['delivery_address']['firstname'], 'surname' => $rawOrderData['delivery_address']['surname'], 'street' => $rawOrderData['delivery_address']['street'], 'streetno' => $rawOrderData['delivery_address']['streetno'], 'placeno' => $rawOrderData['delivery_address']['placeno'], 'place' => $rawOrderData['delivery_address']['city'], 'postcode' => $rawOrderData['delivery_address']['postcode'], 'countryid' => $rawOrderData['delivery_address']['countryid'], 'companyname' => $rawOrderData['delivery_address']['companyname'], 'nip' => $rawOrderData['delivery_address']['nip'], 'phone' => $rawOrderData['delivery_address']['phone'], 'phone2' => $rawOrderData['billing_address']['phone2'], 'email' => $rawOrderData['delivery_address']['email'])), 'additional_data' => array('payment_data' => array('delivery_method' => $rawOrderData['delivery_method']['dispatchmethodid'], 'payment_method' => $rawOrderData['payment_method']['paymentmethodid'], 'rules_cart' => $rawOrderData['rulescartid'], 'currency' => $rawOrderData['currencysymbol']), 'summary_data' => array('total_net_total' => 132)), 'products_data' => array('products' => $this->model->getProductsDataGrid((int) $this->registry->core->getParam())));
     $form->Populate($orderData);
     $statusChange = new FormEngine\Elements\Form(array('name' => 'add_status_change', 'class' => 'statusChange', 'action' => '', 'method' => 'post'));
     $idstatus = $statusChange->AddChild(new FormEngine\Elements\Select(array('name' => 'status', 'label' => _('TXT_VIEW_ORDER_CHANGE_STATUS'), 'options' => FormEngine\Option::Make(App::getModel('orderstatus')->getOrderStatusToSelect()))));
     $statusChange->AddChild(new FormEngine\Elements\Textarea(array('name' => 'comment', 'label' => _('TXT_VIEW_ORDER_CHANGE_COMMENT'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SUGGEST, $idstatus, array(App::getModel('orderstatus'), 'getDefaultComment'))))));
     $statusChange->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'inform', 'label' => _('TXT_VIEW_ORDER_CHANGE_INFORM_CLIENT'))));
     $statusChange->AddChild(new FormEngine\Elements\Submit(array('name' => 'update', 'label' => _('TXT_VIEW_ORDER_CHANGE_UPDATE'), 'icon' => '_images_panel/icons/buttons/flag-green.png')));
     $statusChange->Populate(array('status' => $order['current_status_id']));
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\Secure());
     if ($addNotes->Validate(FormEngine\FE::SubmittedData())) {
         try {
             $notes = $addNotes->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
             $this->model->addOrderNotes($addNotes->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $order['id']);
             Session::setVolatileMessage("Dodano notatkę do zamówienia {$this->id}");
             App::redirect(__ADMINPANE__ . '/order/edit/' . (int) $this->registry->core->getParam());
         } catch (Exception $e) {
             $this->registry->template->assign('error', $e->getMessage());
         }
     }
     if ($statusChange->Validate(FormEngine\FE::SubmittedData())) {
         $this->model->addOrderHistory($statusChange->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam());
         try {
             $email = $statusChange->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
             if ($email['inform'] == 1) {
                 $this->model->notifyUser($order, $email['status']);
             }
             Session::setVolatileMessage("Zaktualizowano status zamówienia {$this->id}");
             $this->model->updateOrderStatus($_POST, $this->registry->core->getParam());
             App::redirect(__ADMINPANE__ . '/order/edit/' . (int) $this->registry->core->getParam());
         } catch (Exception $e) {
             $this->registry->template->assign('error', $e->getMessage());
         }
     }
     if ($form->Validate(FormEngine\FE::SubmittedData())) {
         try {
             $this->model->updateOrderById($_POST, $this->registry->core->getParam());
             App::redirect(__ADMINPANE__ . '/order/');
         } catch (Exception $e) {
             $this->registry->template->assign('error', $e->getMessage());
         }
     }
     $this->registry->template->assign('viewid', Helper::getViewId());
     $this->registry->xajaxInterface->registerFunction(array('CalculateDeliveryCost', $this->model, 'calculateDeliveryCostEdit'));
     $this->registry->xajaxInterface->registerFunction(array('GetDispatchMethodForPrice', $this->model, 'getDispatchMethodForPriceForAjaxEdit'));
     $this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
     $this->registry->xajax->processRequest();
     $this->registry->template->assign('statusChange', $statusChange->Render());
     $this->registry->template->assign('addNotes', $addNotes->Render());
     $this->registry->template->assign('orderNotes', $orderNotes);
     $this->registry->template->assign('clientOrderHistory', $clientOrderHistory);
     $this->registry->template->assign('order', $order);
     $this->registry->template->assign('currencyid', Session::getActiveCurrencyId());
     $this->registry->template->assign('currencysymbol', Session::getActiveCurrencySymbol());
     $this->registry->template->assign('form', $form->Render());
     $this->registry->template->display($this->loadTemplate('edit.tpl'));
 }
コード例 #18
0
ファイル: gallery.php プロジェクト: krisldz/Gekosale2
 protected function setImageCatalogPath(&$p)
 {
     if ($p['staticpath'] != '') {
         $p['designpath'] = $this->designPath . $p['staticpath'] . '/';
         $p['rootpath'] = $this->galleryPath . $p['staticpath'] . '/';
         $p['cdnpath'] = $this->staticFilePath . $p['staticpath'] . '/';
     } else {
         if (Helper::getViewId() > 0) {
             $viewStr = '_' . Helper::getViewId();
         } else {
             $viewStr = '';
         }
         if (!is_dir($this->galleryPath . '_' . $p['width'] . '_' . $p['height'] . $viewStr . '/')) {
             mkdir($this->galleryPath . '_' . $p['width'] . '_' . $p['height'] . $viewStr . '/', 0755);
         }
         $p['designpath'] = $this->designPath . '_' . $p['width'] . '_' . $p['height'] . $viewStr . '/';
         $p['rootpath'] = $this->galleryPath . '_' . $p['width'] . '_' . $p['height'] . $viewStr . '/';
         $p['cdnpath'] = $this->staticFilePath . '_' . $p['width'] . '_' . $p['height'] . $viewStr . '/';
     }
 }
コード例 #19
0
ファイル: banktransfer.php プロジェクト: krisldz/Gekosale2
 public function getPaymentData($order)
 {
     return $this->registry->core->loadModuleSettings('banktransfer', Helper::getViewId());
 }
コード例 #20
0
ファイル: App.php プロジェクト: krisldz/Gekosale2
 public function getOfflineMessage()
 {
     $sql = 'SELECT offlinetext FROM view WHERE idview = :viewid';
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->execute();
     $rs = $stmt->fetch();
     if ($rs) {
         return $rs['offlinetext'];
     }
 }
コード例 #21
0
ファイル: seo.php プロジェクト: krisldz/Gekosale2
 public function getMetadataForPage()
 {
     $controller = $this->registry->router->getCurrentController();
     $Data = array();
     $sql = "SELECT\n\t\t\t\t\tVT.keyword_title,\n\t\t\t\t\tC.description,\n\t\t\t\t\tVT.keyword,\n\t\t\t\t\tVT.keyword_description\n\t\t\t\tFROM controller C\n\t\t\t\tLEFT JOIN viewtranslation VT ON VT.viewid = :viewid\n\t\t\t\tWHERE C.name = :controller AND C.mode = 0";
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('controller', $controller);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->execute();
     $rs = $stmt->fetch();
     if ($rs) {
         if ($rs['keyword_title'] == NULL || $rs['keyword_title'] == '') {
             $keyword_title = $controller == 'mainside' ? Session::getActiveShopName() : _($rs['description']);
         } else {
             $keyword_title = $rs['keyword_title'];
         }
         $title = $controller == 'mainside' ? $keyword_title : _($rs['description']);
         $Data = array('keyword_title' => $title, 'keyword' => $rs['keyword'], 'keyword_description' => $rs['keyword_description']);
     }
     return $Data;
 }
コード例 #22
0
ファイル: Template.php プロジェクト: krisldz/Gekosale2
 public function setStaticTemplateVariables()
 {
     if ($this->registry->router->getAdministrativeMode() == 0) {
         $link = $this->_adminPane = '';
     } else {
         $link = $this->_adminPane = __ADMINPANE__ . '/';
     }
     $languageModel = App::getModel('language');
     $languages = $languageModel->getLanguages();
     $this->layer = $this->registry->loader->getCurrentLayer();
     if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
         $this->assign('SSLNAME', 'https://');
     } else {
         $this->assign('SSLNAME', 'http://');
     }
     $theme = App::getRegistry()->loader->getParam('theme');
     $this->assign('URL', App::getURLAdress() . $link);
     $this->assign('CURRENT_URL', App::getCurrentURLAdress());
     $this->assign('DESIGNPATH', DESIGNPATH);
     $this->assign('ASSETSPATH', App::getURLForAssetDirectory() . $theme . '/assets/');
     $this->assign('THEMESPATH', App::getURLForAssetDirectory());
     $this->assign('CURRENT_CONTROLLER', $this->registry->router->getCurrentController());
     $this->assign('CURRENT_ACTION', $this->registry->router->getAction());
     $this->assign('CURRENT_PARAM', $this->registry->core->getParam());
     $this->assign('SHOP_NAME', Session::getActiveShopName());
     $templateData = array();
     if ($this->registry->router->getAdministrativeMode() == 0) {
         $cartModel = App::getModel('cart');
         $client = App::getModel('client')->getClient();
         $productCart = $cartModel->getShortCartList();
         $productCart = $cartModel->getProductCartPhotos($productCart);
         $this->assign('SHOP_LOGO', $this->layer['photoid']);
         $this->assign('FAVICON', $this->layer['favicon']);
         $this->assign('enableregistration', $this->layer['enableregistration']);
         $this->assign('client', $client);
         $this->assign('clientdata', $client);
         $this->assign('showtax', $this->layer['showtax']);
         $this->assign('currencySymbol', Session::getActiveCurrencySymbol());
         $this->assign('count', $cartModel->getProductAllCount());
         $this->assign('globalPrice', $cartModel->getGlobalPrice());
         $this->assign('productCart', $productCart);
         $this->assign('language', Session::getActiveLanguageId());
         $this->assign('languageCode', Session::getActiveLanguage());
         $this->assign('languageFlag', $languageModel->getLanguages());
         $this->assign('currencies', $languageModel->getAllCurrenciesForView());
         $this->assign('breadcrumb', App::getModel('breadcrumb')->getPageLinks());
         $this->assign('contentcategory', App::getModel('staticcontent')->getContentCategoriesTree());
         $this->assign('defaultcontact', App::getModel('contact')->getContactById($this->layer['contactid']));
         $this->assign('newsletterButton', App::getModel('newsletter')->isNewsletterButton());
         $this->assign('cartpreview', $cartModel->getCartPreviewTemplate());
         if ($this->layer['cartredirect'] != '') {
             $this->assign('cartredirect', App::getURLAdress() . Seo::getSeo($this->layer['cartredirect']));
         } else {
             $this->assign('cartredirect', '');
         }
         $this->assign('modulesettings', $this->registry->core->getModuleSettingsForView());
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $this->assign('message', $message[0]);
         }
         $this->assign('categories', App::getModel('CategoriesBox')->getCategoriesTree(2));
         $methods = $this->getXajaxMethodsForFrontend();
         foreach ($methods as $xajaxMethodName => $xajaxMethodParams) {
             $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method']));
         }
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $this->assign('message', $message[0]);
         }
         $this->assign('view', Helper::getViewId());
         $this->assign('viewid', Helper::getViewId());
     } else {
         $this->registry->core->setAdminStoreConfig();
         $templateData = array('user_name' => App::getModel('users')->getUserFullName(), 'user_id' => App::getModel('users')->getActiveUserid(), 'language' => Session::getActiveLanguageId(), 'languages' => json_encode($languages), 'globalsettings' => Session::getActiveGlobalSettings(), 'views' => App::getModel('view')->getViews(), 'vatvalues' => json_encode(App::getModel('vat/vat')->getVATValuesAll()), 'FRONTEND_URL' => Session::getActiveShopUrl() != '' ? 'http://' . Session::getActiveShopUrl() : App::getURLAdress(), 'appversion' => Session::getActiveAppVersion(), 'view' => Helper::getViewId(), 'viewid' => Helper::getViewId());
         $message = Session::getVolatileMessage();
         if (isset($message) && !empty($message)) {
             $templateData['message'] = $message[0];
         }
         $methods = $this->getXajaxMethodsForAdmin();
         foreach ($methods as $xajaxMethodName => $xajaxMethodParams) {
             $this->registry->xajax->registerFunction(array($xajaxMethodName, App::getModel($xajaxMethodParams['model']), $xajaxMethodParams['method']));
         }
         $Data = Event::dispatch($this, 'template.setStaticTemplateVariables', array('data' => $templateData));
         foreach ($Data as $param => $value) {
             $this->assign($param, $value);
         }
         $this->assign('view', Helper::getViewId());
         $this->assign('viewid', Helper::getViewId());
     }
 }
コード例 #23
0
ファイル: productsearch.php プロジェクト: krisldz/Gekosale2
    public function addPhraseAboutMostSearch($name, $counter = 0)
    {
        $sql = 'INSERT INTO mostsearch (name, viewid)
				VALUES (:name, :viewid)';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('name', $name);
        $stmt->bindValue('viewid', Helper::getViewId());
        try {
            $stmt->execute();
        } catch (Exception $e) {
            throw new FrontendException($e->getMessage());
        }
        return Db::getInstance()->lastInsertId();
    }
コード例 #24
0
ファイル: paybynet.php プロジェクト: krisldz/Gekosale2
    public function checkPaymentStatus($event, $request)
    {
        $sql = "SELECT idpaymentmethod FROM paymentmethod WHERE controller = 'paybynet' AND active=1";
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->execute();
        $rs = $stmt->fetch();
        if (!$rs) {
            return;
        }
        $settings = $this->registry->core->loadModuleSettings('paybynet', Helper::getViewId());
        if (empty($settings)) {
            return;
        }
        $id = $request['id'];
        $sql = "SELECT\n\t\t\t\tidorder\n\t\t\tFROM\n\t\t\t\t`order`\n\t\t\tWHERE\n\t\t\t\tidorder = :id\n\t\t\tAND\n\t\t\t\tpaymentmethodid = :paymentmethodid\n\t\t\tAND\n\t\t\t\torderstatusid = :positiveorderstatusid";
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('id', $id);
        $stmt->bindValue('idpaymentmethod', $rs['idpaymentmethod']);
        $stmt->bindValue('positiveorderstatusid', $settings['positiveorderstatusid']);
        $stmt->execute();
        if ($stmt->fetch()) {
            return;
        }
        try {
            $soap = new \SoapClient(self::WSDL);
            $statusCode = $soap->getStatusByPaymentID($id, $settings['id_client']);
        } catch (\SoapFault $e) {
            throw new CoreException('Nie można połączyć się z pbn.paybynet.com.pl');
        }
        $status = 0;
        if ($statusCode >= 1000 && $statusCode <= 1012) {
            $status = $settings['verificationrejectedorderstatusid'];
            $comment = 'Weryfikacja odrzucona';
        } else {
            if ($statusCode == 2303) {
                $status = $settings['positiveorderstatusid'];
                $comment = 'Płatność zakończona sukcesem';
            } else {
                if ($statusCode == 2301 || $statusCode == 2302) {
                    $status = $settings['negativeorderstatusid'];
                    $comment = 'Płatność zakończona niepowodzeniem';
                }
            }
        }
        if ($status == 0) {
            return;
        }
        $sql = "UPDATE `order` SET orderstatusid = :status WHERE idorder = :idorder";
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('status', $status);
        $stmt->bindValue('idorder', $id);
        $stmt->execute();
        $sql = 'INSERT INTO orderhistory SET
					content = :content,
					orderstatusid = :status,
					orderid = :idorder,
					inform = 0';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('content', $comment);
        $stmt->bindValue('idorder', $id);
        $stmt->bindValue('status', $status);
        $stmt->execute();
    }
コード例 #25
0
ファイル: client.php プロジェクト: krisldz/Gekosale2
 public function initForm()
 {
     $form = new FormEngine\Elements\Form(array('name' => 'client', 'action' => '', 'method' => 'post'));
     $personalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'personal_data', 'label' => _('TXT_PERSONAL_DATA'))));
     $personalData->AddChild(new FormEngine\Elements\Select(array('name' => 'viewid', 'label' => _('TXT_SHOP'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SHOP'))), 'options' => FormEngine\Option::Make(App::getModel('view')->getViewAllSelect()), 'default' => Helper::getViewId())));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     if ($this->getParam() > 0) {
         $personalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Uwaga zmieniając adres Email zmieni sie również login do sklepu</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     } else {
         $personalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Dla klienta zostanie wygenerowane hasło które umożliwi mu dostęp do panelu sklepu. Hasło zostanie wysłane na podany adres e-mail.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     }
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'email', 'label' => _('TXT_EMAIL'), 'comment' => _('TXT_EMAIL_FORM'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_EMAIL')), new FormEngine\Rules\Email(_('ERR_WRONG_EMAIL')), new FormEngine\Rules\Unique(_('ERR_EMAIL_ALREADY_EXISTS'), 'clientdata', 'email', null, array('column' => 'email', 'values' => (int) $this->registry->core->getParam()))))));
     $personalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'newsletter', 'label' => _('TXT_NEWSLETTER'), 'default' => '1')));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone', 'label' => _('TXT_PHONE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PHONE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $personalData->AddChild(new FormEngine\Elements\TextField(array('name' => 'phone2', 'label' => _('TXT_ADDITIONAL_PHONE'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), '/^[0-9 -+]+$/')))));
     $personalData->AddChild(new FormEngine\Elements\Select(array('name' => 'clientgroupid', 'label' => _('TXT_GROUPS'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_GROUPS'))), 'addable' => true, 'onAdd' => 'xajax_AddClientGroup', 'add_item_prompt' => 'Podaj nazwę grupy', 'options' => FormEngine\Option::Make(App::getModel('clientgroup/clientgroup')->getClientGroupAllToSelect()))));
     $personalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Klient będzie awansowany/degradowany zgodnie z ustawieniami automatycznego awansu w <a href="' . $this->registry->router->generate('admin', true, array('controller' => 'view')) . '" target="_blank">Konfiguracja &raquo; Sklepy</a></p>')));
     $personalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'autoassign', 'label' => _('TXT_AUTO_ASSIGN'), 'default' => '1')));
     $additionalData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'additional_data', 'label' => _('TXT_ADDITIONAL_DATA'))));
     $additionalData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'))));
     $additionalData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Blokada konta uniemożliwia zalogowanie klienta w sklepie oraz ponowną rejestrację za pomocą tego samego adresu e-mail.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
     $additionalData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'disable', 'label' => _('TXT_DISABLE_CLIENT'))));
     $billingData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'billing_data', 'label' => _('TXT_EDIT_ORDER_BILLING_DATA'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placename', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), "/[0-9]{2}\\-[0-9]{3}/")))));
     $billingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => $this->registry->loader->getParam('countryid'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $billingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'), 'rules' => array(new FormEngine\Rules\Custom(_('ERR_WRONG_NIP'), array(App::getModel('vat'), 'checkVAT'))))));
     $shippingData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'shipping_data', 'label' => _('TXT_EDIT_ORDER_SHIPPING_DATA'))));
     $copy = $shippingData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<a href="#" id="copy">' . _('TXT_JS_ADDRESS_COPY_FROM') . '</a>')));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'firstname', 'label' => _('TXT_FIRSTNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_FIRSTNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'surname', 'label' => _('TXT_SURNAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SURNAME'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'street', 'label' => _('TXT_STREET'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREET'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'streetno', 'label' => _('TXT_STREETNO'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_STREETNO'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placeno', 'label' => _('TXT_PLACENO'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'placename', 'label' => _('TXT_PLACE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_PLACE'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'postcode', 'label' => _('TXT_POSTCODE'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_POSTCODE')), new FormEngine\Rules\Format(_('ERR_WRONG_FORMAT'), "/[0-9]{2}\\-[0-9]{3}/")))));
     $shippingData->AddChild(new FormEngine\Elements\Select(array('name' => 'countryid', 'label' => _('TXT_NAME_OF_COUNTRY'), 'options' => FormEngine\Option::Make(App::getModel('countrieslist')->getCountryForSelect()), 'default' => $this->registry->loader->getParam('countryid'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME_OF_COUNTRY'))))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'companyname', 'label' => _('TXT_COMPANYNAME'))));
     $shippingData->AddChild(new FormEngine\Elements\TextField(array('name' => 'nip', 'label' => _('TXT_NIP'), 'rules' => array(new FormEngine\Rules\Custom(_('ERR_WRONG_NIP'), array(App::getModel('vat'), 'checkVAT'))))));
     if ((int) $this->registry->core->getParam() > 0) {
         $clientsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'orders', 'label' => _('TXT_CLIENT_ORDERS'))));
         $history = App::getModel('order')->getclientOrderHistory((int) $this->registry->core->getParam());
         if (count($history) > 0) {
             $html = '<div class="view-order"><ul class="changes-detailed">';
             foreach ($history as $order) {
                 $url = App::getURLAdressWithAdminPane() . 'order/edit/' . $order['idorder'];
                 $html .= "<li>";
                 $html .= "<h4><span>{$order['adddate']}</span></h4>";
                 $html .= "<p>Nr. zamówienia:  <strong><a href=\"{$url}\" target=\"_blank\">#{$order['idorder']}</a></strong></p>";
                 $html .= "<p class=\"author\">" . _('TXT_ALL_ORDERS_PRICE') . ": <strong>{$order['globalprice']}</strong></p>";
                 $html .= "<p class=\"author\">" . _('TXT_ORDER_STATUS') . ": <strong>{$order['status']}</strong></p>";
                 $html .= "</li>";
             }
             $html .= '</div>';
         } else {
             $html = '<p>' . _('TXT_ORDER_HISTORY_EMPTY') . '</p>';
         }
         $clientsData->AddChild(new FormEngine\Elements\StaticText(array('text' => $html)));
     }
     $Data = Event::dispatch($this, 'admin.client.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
     if (!empty($Data)) {
         $form->Populate($Data);
     }
     $form->AddFilter(new FormEngine\Filters\Trim());
     $form->AddFilter(new FormEngine\Filters\NoCode());
     $form->AddFilter(new FormEngine\Filters\Secure());
     return $form;
 }
コード例 #26
0
ファイル: payment.php プロジェクト: krisldz/Gekosale2
 public function checkEraty($idpaymentmethod)
 {
     $price = Session::getActiveglobalPriceWithDispatchmethod();
     if ($price > 0) {
         if ($price < 100) {
             return 0;
         }
     } else {
         $order = Session::getActiveClientOrder();
         if (!isset($order['priceWithDispatchMethod']) || $order['priceWithDispatchMethod'] < 100) {
             return 0;
         }
     }
     $sql = "SELECT ES.wariantsklepu, ES.numersklepu, ES.`char`\n\t\t\t\t\tFROM eratysettings ES\n\t\t\t\t\t\tLEFT JOIN paymentmethodview PV ON  ES.paymentmethodid  = PV.paymentmethodid\n\t\t\t\t\tWHERE PV.viewid = :viewid\n\t\t\t\t\tAND ES.paymentmethodid = :idpaymentmethod";
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->bindValue('idpaymentmethod', $idpaymentmethod);
     $stmt->execute();
     $rs = $stmt->fetch();
     if ($rs) {
         $Data = array('wariantsklepu' => $rs['wariantsklepu'], 'numersklepu' => $rs['numersklepu'], 'char' => $rs['char']);
         return $Data;
     }
     return 0;
 }
コード例 #27
0
ファイル: cart.php プロジェクト: krisldz/Gekosale2
    public function getMinimumOrderValue()
    {
        $sql = 'SELECT
					ROUND((V.minimumordervalue * CR.exchangerate) - :globalprice, 2) AS required
				FROM view V
				LEFT JOIN currencyrates CR ON CR.currencyfrom = V.currencyid AND CR.currencyto = :currencyto
				WHERE V.idview = :viewid';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('globalprice', $this->getGlobalPrice());
        $stmt->bindValue('currencyto', Session::getActiveCurrencyId());
        $stmt->bindValue('viewid', Helper::getViewId());
        $stmt->execute();
        $rs = $stmt->fetch();
        if ($rs) {
            return $rs['required'];
        }
        return 0;
    }
コード例 #28
0
ファイル: newsletter.php プロジェクト: krisldz/Gekosale2
 public function deleteClientAboutNewsletter($email, $viewId = 0)
 {
     $viewId = $viewId !== 0 ? $viewId : Helper::getViewId();
     $sql = 'DELETE FROM clientnewsletter WHERE email = :email AND viewid=:viewid';
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('email', $email);
     $stmt->bindValue('viewid', $viewId);
     try {
         $stmt->execute();
     } catch (Exception $fe) {
         throw new FrontendException($fe->getMessage());
     }
 }
コード例 #29
0
ファイル: templateeditor.php プロジェクト: krisldz/Gekosale2
 public function checkDefault($id)
 {
     $sql = 'SELECT pageschemeid FROM view WHERE idview = :viewid';
     $stmt = Db::getInstance()->prepare($sql);
     $stmt->bindValue('viewid', Helper::getViewId());
     $stmt->execute();
     $rs = $stmt->fetch();
     if ($rs) {
         return $rs['pageschemeid'] == $id ? 1 : 0;
     }
     return 0;
 }
コード例 #30
0
ファイル: registrationbox.php プロジェクト: krisldz/Gekosale2
 public function index()
 {
     // support for enable/disable registration
     if (isset($this->layer['enableregistration']) && $this->layer['enableregistration'] == 1) {
         if (strlen($this->registry->core->getParam()) > 10) {
             $checkClient = $this->model->checkClientLink($this->registry->core->getParam());
             if (count($checkClient > 0)) {
                 $result = App::getModel('clientlogin')->authProccessConfirmation($checkClient['email'], $checkClient['password']);
                 if ($result != 0) {
                     Session::setActiveClientid($result);
                     App::getModel('clientlogin')->checkClientGroup();
                     $this->model->saveClientData();
                 }
                 if (($this->Cart = Session::getActiveCart()) != NULL) {
                     App::redirectUrl($this->registry->router->generate('frontend.cart', true));
                 } else {
                     App::redirectUrl($this->registry->router->generate('frontend.home', true));
                 }
             }
         }
         $form = App::getFormModel('registration')->initForm();
         if ($form->Validate()) {
             $formData = $form->getSubmitValues();
             $recurMail = $this->model->checkClientNewMail($formData);
             if ($recurMail == 0) {
                 $clientId = $this->model->addNewClient($formData);
                 if (isset($this->layer['confirmregistration']) && $this->layer['confirmregistration'] == 1) {
                     $link = $this->model->updateClientDisable($clientId, 1, sha1($formData['email'] . time()));
                     $this->registry->template->assign('activelink', $link);
                 }
                 $this->registry->template->assign('address', $formData);
                 App::getModel('mailer')->sendEmail(array('template' => 'addClient', 'email' => array($formData['email']), 'bcc' => false, 'subject' => _('TXT_REGISTRATION_NEW'), 'viewid' => Helper::getViewId()));
                 if (isset($this->layer['confirmregistration']) && $this->layer['confirmregistration'] == 1) {
                     Session::setVolatileActivationRequired(1, false);
                 } else {
                     Session::setVolatileRegistrationOk(1, false);
                     $result = App::getModel('clientlogin')->authProccess($formData['email'], $formData['password']);
                     if ($result > 0) {
                         Session::setActiveClientid($result);
                         App::getModel('clientlogin')->checkClientGroup();
                         $this->model->saveClientData();
                     }
                     if ($result < 0) {
                         Session::setVolatileActivationRequired(1, false);
                     } else {
                         Session::setVolatileRegistrationOk(1, false);
                         App::redirectUrl($this->registry->router->generate('frontend.clientsettings', true));
                     }
                 }
             } else {
                 $result = App::getModel('clientlogin')->authProccess($formData['email'], $formData['password']);
                 if ($result != 0) {
                     Session::setActiveClientid($result);
                     App::getModel('clientlogin')->checkClientGroup();
                     $this->model->saveClientData();
                     Session::setVolatileRegistrationOk(1, false);
                     App::redirectUrl($this->registry->router->generate('frontend.clientsettings', true));
                 } elseif ($result < 0) {
                     Session::setVolatileActivationRequired(1, false);
                 } else {
                     Session::setVolatileRecureMail(1, false);
                 }
             }
         }
         $this->registry->template->assign('form', $form->getForm());
         $activationrequired = Session::getVolatileActivationRequired();
         if ($activationrequired[0] == 1) {
             $this->registry->template->assign('error', _('TXT_ACTIVATION_REQUIRED'));
             $this->registry->template->assign('error_msg', _('TXT_ACTIVATION_REQUIRED_MSG'));
         }
         $recureMailError = Session::getVolatileRecureMail();
         if ($recureMailError[0] == 1) {
             $this->registry->template->assign('error', _('ERR_DUPLICATE_EMAIL'));
             $this->registry->template->assign('error', _('ERR_DUPLICATE_EMAIL_MSG'));
         }
         $forbiddenCode = Session::getVolatileForbiddenCode();
         if ($forbiddenCode[0] == 1) {
             $this->registry->template->assign('error', _('TXT_ERROR_FORBIDDEN_CODE'));
             $this->registry->template->assign('error', _('TXT_ERROR_FORBIDDEN_CODE_MSG'));
         }
         $passwdGenError = Session::getVolatilePasswordGenerateError();
         if ($passwdGenError[0] == 1) {
             $this->registry->template->assign('error', _('ERROR_PASSWORD_GENERATE'));
             $this->registry->template->assign('error', _('ERROR_PASSWORD_GENERATE_MSG'));
         }
         return $this->registry->template->fetch($this->loadTemplate('index.tpl'));
     } else {
         $this->registry->template->assign('error', _('TXT_REGISTRATION_DISABLED_HELP'));
     }
 }