示例#1
0
 /**
  * (non-PHPdoc)
  * @see CRUDPageAbstract::_getEndJs()
  */
 protected function _getEndJs()
 {
     $manufactureArray = $supplierArray = $statuses = $productCategoryArray = array();
     foreach (Manufacturer::getAll() as $os) {
         $manufactureArray[] = $os->getJson();
     }
     foreach (Supplier::getAll() as $os) {
         $supplierArray[] = $os->getJson();
     }
     foreach (ProductStatus::getAll() as $os) {
         $statuses[] = $os->getJson();
     }
     foreach (ProductCategory::getAll() as $os) {
         $productCategoryArray[] = $os->getJson();
     }
     $js = parent::_getEndJs();
     if (($product = Product::get($this->Request['id'])) instanceof Product) {
         $js .= "\$('searchPanel').hide();";
         $js .= "pageJs._singleProduct = true;";
     }
     $js .= 'pageJs._loadManufactures(' . json_encode($manufactureArray) . ')';
     $js .= '._loadSuppliers(' . json_encode($supplierArray) . ')';
     $js .= '._loadCategories(' . json_encode($productCategoryArray) . ')';
     $js .= '._loadProductStatuses(' . json_encode($statuses) . ')';
     $js .= "._loadChosen()";
     $js .= "._bindSearchKey()";
     $js .= ".setCallbackId('priceMatching', '" . $this->priceMatchingBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('toggleActive', '" . $this->toggleActiveBtn->getUniqueID() . "')";
     $js .= ".getResults(true, " . $this->pageSize . ");";
     return $js;
 }
示例#2
0
 /**
  * (non-PHPdoc)
  * @see CRUDPageAbstract::_getEndJs()
  */
 protected function _getEndJs()
 {
     $manufactureArray = $supplierArray = $statuses = $productCategoryArray = array();
     foreach (Manufacturer::getAll() as $os) {
         $manufactureArray[] = $os->getJson();
     }
     foreach (Supplier::getAll() as $os) {
         $supplierArray[] = $os->getJson();
     }
     foreach (ProductStatus::getAll() as $os) {
         $statuses[] = $os->getJson();
     }
     foreach (ProductCategory::getAll() as $os) {
         $productCategoryArray[] = $os->getJson();
     }
     $js = parent::_getEndJs();
     if (($product = Product::get($this->Request['id'])) instanceof Product) {
         $js .= "\$('searchPanel').hide();";
         $js .= "pageJs._singleProduct = true;";
     }
     $js .= 'pageJs.totalValueId = "total-found-value";';
     $js .= 'pageJs.totalQtyId = "total-found-qty";';
     $js .= 'pageJs._loadManufactures(' . json_encode($manufactureArray) . ')';
     $js .= '._loadSuppliers(' . json_encode($supplierArray) . ')';
     $js .= '._loadCategories(' . json_encode($productCategoryArray) . ')';
     $js .= '._loadProductStatuses(' . json_encode($statuses) . ')';
     $js .= "._loadChosen()";
     $js .= "._bindSearchKey()";
     $js .= "._bindNewRuleBtn()";
     $js .= ".setCallbackId('priceMatching', '" . $this->priceMatchingBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('toggleActive', '" . $this->toggleActiveBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('toggleSellOnWeb', '" . $this->toggleSellOnWebBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('updatePrice', '" . $this->updatePriceBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('updateStockLevel', '" . $this->updateStockLevelBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('toggleIsKit', '" . $this->toggleIsKitBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('toggleManualFeed', '" . $this->toggleManualFeedBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('newRule', '" . $this->newRuleBtn->getUniqueID() . "')";
     $js .= ".getResults(true, " . $this->pageSize . ");";
     return $js;
 }
示例#3
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $btnIdnewPO = isset($_REQUEST['btnidnewpo']) && trim($_REQUEST['btnidnewpo']) !== '' ? trim($_REQUEST['btnidnewpo']) : null;
     $manufacturers = array_map(create_function('$a', 'return $a->getJson();'), Manufacturer::getAll());
     $suppliers = array_map(create_function('$a', 'return $a->getJson();'), Supplier::getAll());
     $statuses = array_map(create_function('$a', 'return $a->getJson();'), ProductStatus::getAll());
     $priceTypes = array_map(create_function('$a', 'return $a->getJson();'), ProductPriceType::getAll());
     $codeTypes = array_map(create_function('$a', 'return $a->getJson();'), ProductCodeType::getAll());
     $locationTypes = array_map(create_function('$a', 'return $a->getJson();'), PreferredLocationType::getAll());
     $accountingCodes = array_map(create_function('$a', 'return array("id"=> $a->getId(), "code"=> $a->getCode(), "description"=> $a->getDescription(), "type"=> $a->getTypeId());'), AccountingCode::getAll());
     $js = parent::_getEndJs();
     $js .= "pageJs.setPreData(" . json_encode($manufacturers) . ", " . json_encode($suppliers) . ", " . json_encode($statuses) . ", " . json_encode($priceTypes) . ", " . json_encode($codeTypes) . ", " . json_encode($locationTypes) . ", " . json_encode($btnIdnewPO) . ", " . json_encode($accountingCodes) . ")";
     $js .= ".setCallbackId('getCategories', '" . $this->getCategoriesBtn->getUniqueID() . "')";
     $js .= ".setCallbackId('validateSKU', '" . $this->validateSKUBtn->getUniqueID() . "')";
     $js .= ".load()";
     $js .= ".bindAllEventNObjects()";
     $js .= "._loadChosen();";
     if (!AccessControl::canEditProduct(Core::getRole())) {
         $js .= "pageJs.readOnlyMode();";
     }
     return $js;
 }