public function __construct($attributes)
 {
     parent::__construct($attributes);
     if (!isset($this->attributes['allow_generate'])) {
         $this->attributes['allow_generate'] = 1;
     }
     $this->attributes['category_field'] = $this->attributes['category']->getName();
     $this->attributes['price_field'] = $this->attributes['price']->getName();
     $this->attributes['vat_field_name'] = $this->attributes['vat_field']->getName();
     $this->attributes['vat_values'] = App::getModel('vat/vat')->getVATValuesAll();
     $this->attributes['suffixes'] = App::getModel('suffix/suffix')->getSuffixTypes();
     $this->_jsGetAttributeSetsForCategories = 'GetAttributeSetsForCategories_' . $this->_id;
     $this->_jsGetAttributesForSet = 'GetAttributesForSet_' . $this->_id;
     $this->_jsgetValuesForAttribute = 'getValuesForAttribute_' . $this->_id;
     $this->_jsGetCartesian = 'GetCartesian_' . $this->_id;
     $this->_jsAddAttribute = 'AddAttribute_' . $this->_id;
     $this->_jsAddValue = 'AddValue_' . $this->_id;
     $this->attributes['get_sets_for_categories'] = 'xajax_' . $this->_jsGetAttributeSetsForCategories;
     $this->attributes['getattributes_for_set'] = 'xajax_' . $this->_jsGetAttributesForSet;
     $this->attributes['get_values_for_attribute'] = 'xajax_' . $this->_jsgetValuesForAttribute;
     $this->attributes['get_cartesian'] = 'xajax_' . $this->_jsGetCartesian;
     $this->attributes['add_attribute'] = 'xajax_' . $this->_jsAddAttribute;
     $this->attributes['add_value'] = 'xajax_' . $this->_jsAddValue;
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetAttributeSetsForCategories, $this, 'getAttributeSetsForCategories'));
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetAttributesForSet, $this, 'getAttributesForSet'));
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsgetValuesForAttribute, $this, 'getValuesForAttribute'));
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetCartesian, $this, 'getCartesian'));
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsAddAttribute, $this, 'addAttribute'));
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsAddValue, $this, 'addValue'));
 }
Exemple #2
0
 public static function setStoreId($id)
 {
     if (App::getRegistry()->router->getMode() == 0) {
         return Session::setActiveMainsideStoreId($id);
     } else {
         return Session::setActiveStoreId($id);
     }
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->_jsGetSelectedInfo = 'GetSelectedInfo_' . $this->_id;
     if (isset($this->_attributes['load_selected_info']) && is_callable($this->_attributes['load_selected_info'])) {
         $this->_attributes['get_selected_info'] = 'xajax_' . $this->_jsGetSelectedInfo;
         App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsGetSelectedInfo, $this, 'getSelectedInfo'));
     }
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->_jsFunction = 'LoadProducts_' . $this->_id;
     $this->attributes['jsfunction'] = 'xajax_' . $this->_jsFunction;
     App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadProducts'));
     $this->attributes['load_categorychildren'] = App::getRegistry()->xajaxInterface->registerFunction(array('LoadCategoryChildren_' . $this->_id, $this, 'loadCategoryChildren'));
     $this->attributes['datagrid_filter'] = $this->getDatagridfilterData();
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->_jsFunction = 'LoadClients_' . $this->_id;
     $this->_jsFunctionDetails = 'LoadClientData_' . $this->_id;
     $this->attributes['jsfunction'] = 'xajax_' . $this->_jsFunction;
     $this->attributes['jsfunctiondetails'] = 'xajax_' . $this->_jsFunctionDetails;
     App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadClients'));
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsFunctionDetails, $this, 'loadClientDetails'));
 }
 public function __construct($attributes)
 {
     $attributes['attributes'] = App::getModel('technicaldata')->getTechnicalDataFull();
     parent::__construct($attributes);
     App::getRegistry()->xajaxInterface->registerFunction(array('deleteAttribute', $this, 'deleteAttribute'));
     App::getRegistry()->xajaxInterface->registerFunction(array('renameAttribute', $this, 'renameAttribute'));
     App::getRegistry()->xajaxInterface->registerFunction(array('renameValue', $this, 'renameValue'));
     $this->attributes['deleteAttributeFunction'] = 'xajax_deleteAttribute';
     $this->attributes['renameAttributeFunction'] = 'xajax_renameAttribute';
     $this->attributes['renameValueFunction'] = 'xajax_renameValue';
 }
Exemple #7
0
 public function __construct($message, $code = 0, $messageToLogFile = NULL)
 {
     parent::__construct($message, $code, $messageToLogFile);
     if (__ENABLE_DEBUG__ == 0) {
         App::redirect('admin/mainside');
     }
     $this->errorDesignPath = 'error/index/index.tpl';
     App::getModel('template')->assign('SHOP_NAME', App::getRegistry()->session->getActiveShopName());
     App::getModel('template')->assign('error', preg_replace('/(\\n|\\r)+/', '\\n', nl2br(addslashes($this->errorText))));
     App::getModel('template')->display($this->errorDesignPath);
     die;
 }
 public function __construct($message, $code = 0, $messageToLogFile = NULL)
 {
     parent::__construct($message, $code, $messageToLogFile);
     if (__ENABLE_DEBUG__ == 0) {
         App::redirectSeo(App::getURLAdress());
     }
     App::getModel('template')->assign('SHOP_NAME', App::getRegistry()->session->getActiveShopName());
     App::getModel('template')->assign('error', $this->errorText);
     App::getModel('template')->assign('BASE_URL', App::getURLAdress());
     App::getModel('template')->display('error/index/layout.tpl');
     die;
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     if (!isset($this->attributes['products_source_field']) || !$this->attributes['products_source_field'] instanceof ProductSelect) {
         throw new Exception("Source field (attribute: products_source_field) not set for field '{$this->attributes['name']}'.");
     }
     $this->attributes['products_source_field_name'] = $this->attributes['products_source_field']->getName();
     $this->attributes['vat_values'] = App::getModel('vat/vat')->getVATAll();
     $this->attributes['prefixes'] = array(Translation::get('TXT_PRICE_NET'), Translation::get('TXT_PRICE_GROSS'));
     $this->_jsFunction = 'LoadProductDataForAggregation_' . $this->_id;
     $this->attributes['jsfunction'] = 'xajax_' . $this->_jsFunction;
     App::getRegistry()->xajaxInterface->registerFunction(array($this->_jsFunction, $this, 'loadProductData'));
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->_jsFunction = 'LoadProducts_' . $this->_id;
     $this->attributes['jsfunction'] = 'xajax_' . $this->_jsFunction;
     App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadProducts_' . $this->_id));
     $this->attributes['load_categorychildren'] = App::getRegistry()->xajaxInterface->registerFunction(array('LoadCategoryChildren_' . $this->_id, $this, 'loadCategoryChildren'));
     if (isset($this->attributes['exclude_from'])) {
         $this->attributes['exclude_from_field'] = $this->attributes['exclude_from']->getName();
     }
     if (!isset($this->attributes['exclude'])) {
         $this->attributes['exclude'] = array(0);
     }
     $this->attributes['datagrid_filter'] = $this->getDatagridfilterData();
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     if (!isset($this->attributes['key'])) {
         throw new Exception("Datagrid key (attribute: key) not set for field '{$this->attributes['name']}'.");
     }
     if (!isset($this->attributes['columns'])) {
         throw new Exception("Datagrid columns (attribute: columns) not set for field '{$this->attributes['name']}'.");
     }
     if (!isset($this->attributes['datagrid_init_function']) || !is_callable($this->attributes['datagrid_init_function'])) {
         throw new Exception("Datagrid initialization function not set (attribute: datagrid_init_function) for field '{$this->attributes['name']}'. Hint: check whether the method you have specified is public.");
     }
     $this->_jsFunction = 'LoadRecords_' . $this->_id;
     $this->attributes['jsfunction'] = 'xajax_' . $this->_jsFunction;
     App::getRegistry()->xajax->registerFunction(array($this->_jsFunction, $this, 'loadRecords_' . $this->_id));
 }
 public function __construct($attributes)
 {
     parent::__construct($attributes);
     $this->attributes['session_name'] = session_name();
     $this->attributes['session_id'] = session_id();
     $this->attributes['file_types'] = array('jpg', 'png', 'gif', 'swf');
     if (!isset($this->attributes['file_source'])) {
         $this->attributes['file_source'] = 'upload/';
     }
     $this->attributes['file_types_description'] = \WellCommerce\Translation::get('TXT_FILE_TYPES_IMAGE');
     $this->attributes['upload_url'] = App::getURLAdressWithAdminPane() . 'files/add/' . base64_encode($this->attributes['file_source']);
     $this->attributes['load_handler'] = 'xajax_LoadFiles_' . $this->_id;
     App::getRegistry()->xajaxInterface->registerFunction(array('LoadFiles_' . $this->_id, $this, 'LoadFiles'));
     $this->attributes['delete_handler'] = 'xajax_DeleteFile_' . $this->_id;
     App::getRegistry()->xajaxInterface->registerFunction(array('deleteFile_' . $this->_id, $this, 'deleteFile'));
     $this->attributes['type_icons'] = array('cdup' => DESIGNPATH . '_images_panel/icons/filetypes/cdup.png', 'unknown' => DESIGNPATH . '_images_panel/icons/filetypes/unknown.png', 'directory' => DESIGNPATH . '_images_panel/icons/filetypes/directory.png', 'gif' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'png' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'jpg' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'bmp' => DESIGNPATH . '_images_panel/icons/filetypes/image.png', 'txt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'doc' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'rtf' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'odt' => DESIGNPATH . '_images_panel/icons/filetypes/text.png', 'htm' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'html' => DESIGNPATH . '_images_panel/icons/filetypes/document.png', 'php' => DESIGNPATH . '_images_panel/icons/filetypes/document.png');
 }
Exemple #13
0
    public static function loadTranslations()
    {
        if ((self::$translations = App::getRegistry()->cache->load('translations')) === FALSE) {
            $sql = 'SELECT 
						T.name,
						TD.translation 
					FROM translation T
					LEFT JOIN translationdata TD ON T.idtranslation = TD.translationid
					WHERE TD.languageid = :languageid';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('languageid', Helper::getLanguageId());
            $stmt->execute();
            while ($rs = $stmt->fetch()) {
                self::$translations[$rs['name']] = htmlspecialchars($rs['translation'], ENT_QUOTES);
            }
            App::getRegistry()->cache->save('translations', self::$translations);
        }
    }
Exemple #14
0
    public static function load()
    {
        if ((self::$seocontrollers = App::getRegistry()->cache->load('seocontrollers')) === FALSE) {
            $sql = 'SELECT 
						C.name as name, 
						IF(CS.name IS NOT NULL, CS.name, C.name) as alias 
					FROM controller C
					LEFT JOIN controllerseo CS ON CS.controllerid = C.idcontroller
					WHERE CS.languageid = :languageid';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('languageid', Helper::getLanguageId());
            $stmt->execute();
            while ($rs = $stmt->fetch()) {
                self::$seocontrollers[$rs['alias']] = $rs['name'];
            }
            App::getRegistry()->cache->save('seocontrollers', self::$seocontrollers);
        }
    }
Exemple #15
0
 public static function autoload($class)
 {
     $reg = App::getRegistry();
     if ($reg != null && preg_match("/" . preg_quote('Model') . '$/', $class)) {
         $modelName = end(explode('\\', strtolower(str_replace('Model', '', $class))));
         $reg->router->modelLoader($modelName, true);
     } else {
         if (substr($class, 0, 4) == 'Twig') {
             if (is_file($file = ROOTPATH . 'lib' . DS . 'Twig' . '/../' . str_replace(array('_', ""), array('/', ''), $class) . '.php')) {
                 require $file;
             }
         } else {
             $directories = array(__IMAGE_CLASS__, __DISPATCHER_CLASS__);
             $fileNameFormats = array('%s.class.php', '%s.php');
             $path = $class;
             if (@(include_once $path . '.php')) {
                 return;
             }
             $rootPathLen = strlen(ROOTPATH);
             foreach ($directories as $directory) {
                 foreach ($fileNameFormats as $fileNameFormat) {
                     $path = substr($directory, $rootPathLen) . sprintf($fileNameFormat, $class);
                     if (is_file(ROOTPATH . strtolower($path))) {
                         include_once ROOTPATH . strtolower($path);
                         return;
                     } else {
                         if (is_file(ROOTPATH . $path)) {
                             include_once ROOTPATH . $path;
                             return;
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #16
0
 public function setLayerVariables()
 {
     if (App::getRegistry()->router == null) {
         // CLI compatibility
         return;
     }
     if (App::getRegistry()->router->getMode() == 0) {
         Session::setActiveMainsideViewId($this->registry->loader->getParam('idview'));
     } else {
         if (Session::getActiveViewId() !== NULL) {
             $viewid = Session::getActiveViewId();
         } else {
             $viewid = 0;
         }
         Session::setActiveViewId($viewid);
     }
 }
Exemple #17
0
    public function doAJAXChangeOrderStatusNotify($id, $datagrid, $status)
    {
        $ids = is_array($id) ? $id : (array) $id;
        $sql = 'UPDATE `order` SET orderstatusid = :status
				WHERE idorder IN (' . implode(',', $ids) . ')';
        $stmt = Db::getInstance()->prepare($sql);
        if ($status > 0) {
            $stmt->bindValue('status', $status);
        } else {
            $stmt->bindValue('status', NULL);
        }
        $stmt->execute();
        $Data['inform'] = 1;
        $Data['status'] = $status;
        $Data['comment'] = '';
        foreach ($ids as $orderid) {
            $this->addOrderHistory($Data, $orderid);
            $orderData = $this->getOrderById($orderid);
            $orderhistory = $this->getLastOrderHistory((int) $orderData['order_id'], $status);
            App::getRegistry()->template->assign('orderhistory', $orderhistory);
            App::getModel('mailer')->sendEmail(array('template' => 'orderhistory', 'email' => array($orderhistory['email']), 'bcc' => false, 'subject' => _('TXT_CHANGE_ORDER_STATUS_NR') . $orderhistory['ids'], 'viewid' => $orderData['viewid']));
        }
        return $this->getDatagrid()->refresh($datagrid);
    }
Exemple #18
0
 /**
  * 构造函数
  */
 function __construct()
 {
     $this->json = App::getRegistry('json');
 }
Exemple #19
0
    public function setDefaultView($result)
    {
        $sql = 'SELECT globaluser FROM user WHERE iduser = :userid';
        $stmt = Db::getInstance()->prepare($sql);
        $stmt->bindValue('userid', $result);
        $stmt->execute();
        $rs = $stmt->fetch();
        if ($rs) {
            $globaluser = $rs['globaluser'];
        }
        if ($globaluser == 0) {
            $sql = 'SELECT
						UGV.viewid,
						V.storeid,
						V.name as viewname,
						UGV.groupid,
						S.idstore as storeid,
						S.shortcompanyname as storename
						FROM usergroupview UGV 
						lEFT JOIN view V ON UGV.viewid = V.idview
						lEFT JOIN store S ON V.storeid = S.idstore
						WHERE UGV.userid = :userid
						LIMIT 1';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->bindValue('userid', Session::getActiveUserid());
            $stmt->execute();
            $rs = $stmt->fetch();
            if ($rs) {
                App::getRegistry()->session->setActiveStoreId($rs['storeid']);
                App::getRegistry()->session->setActiveViewId($rs['viewid']);
                return true;
            }
        } else {
            $sql = 'SELECT
						idview,
						storeid
					FROM view
					LIMIT 1';
            $stmt = Db::getInstance()->prepare($sql);
            $stmt->execute();
            $rs = $stmt->fetch();
            if ($rs) {
                App::getRegistry()->session->setActiveStoreId($rs['storeid']);
                App::getRegistry()->session->setActiveViewId($rs['idview']);
            }
        }
    }
Exemple #20
0
 public function doAJAXDeleteClient($id, $datagrid)
 {
     return $this->getDatagrid()->deleteRow($id, $datagrid, array($this, 'deleteClient'), App::getRegistry()->router->getCurrentController());
 }