public function getOptions($form, $clientid) { $options = array(); //Get categories $categoriesDb = new Application_Model_DbTable_Category(); $categoriesObject = $categoriesDb->fetchAll($categoriesDb->select()->where('type = ?', 'contact')->where('clientid = ?', $clientid)->order('ordering')); $categories = array(); foreach ($categoriesObject as $category) { if (!$category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } foreach ($categoriesObject as $category) { if ($category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } $options['categories'] = $categories; //Get countries $countryDb = new Application_Model_DbTable_Country(); $countriesObject = $countryDb->fetchAll($countryDb->select()->where('clientid = ?', $clientid)); $countries = array(); foreach ($countriesObject as $country) { $countries[$country->code] = $country->name; } asort($countries); $options['countries'] = $countries; //Set form options if (isset($form->catid)) { $form->catid->addMultiOptions($this->getMenuStructure($categories)); } if (isset($form->country)) { $form->country->addMultiOptions($countries); } return $options; }
public function getCategories($form = null, $clientid, $type, $parentid = null) { //Get categories $categoriesDb = new Application_Model_DbTable_Category(); if ($parentid !== null) { $categoriesObject = $categoriesDb->fetchAll($categoriesDb->select()->where('type = ?', $type)->where('parentid = ?', $parentid)->where('clientid = ?', $clientid)->order('ordering')); } else { $categoriesObject = $categoriesDb->fetchAll($categoriesDb->select()->where('type = ?', $type)->where('clientid = ?', $clientid)->order('ordering')); } $categories = array(); foreach ($categoriesObject as $category) { if (!$category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parentid'] = $category->parentid; $categories[$category->id]['ordering'] = $category->ordering; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } foreach ($categoriesObject as $category) { if ($category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parentid'] = $category->parentid; $categories[$category->id]['ordering'] = $category->ordering; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } //Set form options if (isset($form->parentid)) { $form->parentid->addMultiOptions($this->getMenuStructure($categories)); } return $categories; }
public function getOptions($form, $clientid) { $options = array(); //Get categories $categoriesDb = new Application_Model_DbTable_Category(); $categoriesObject = $categoriesDb->fetchAll($categoriesDb->select()->where('type = ?', 'contact')->where('clientid = ?', $clientid)->order('ordering')); $categories = array(); foreach ($categoriesObject as $category) { if (!$category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } foreach ($categoriesObject as $category) { if ($category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } $options['categories'] = $categories; //Get countries $countryDb = new Application_Model_DbTable_Country(); $countriesObject = $countryDb->fetchAll($countryDb->select()->where('clientid = ?', $clientid)); $countries = array(); foreach ($countriesObject as $country) { $countries[$country->code] = $country->name; } asort($countries); $options['countries'] = $countries; //Get states $options['states'] = array('100' => 'STATES_CREATED', '101' => 'STATES_IN_PROCESS', '102' => 'STATES_PLEASE_CHECK', '103' => 'STATES_PLEASE_DELETE', '104' => 'STATES_RELEASED', '105' => 'STATES_COMPLETED', '106' => 'STATES_CANCELLED'); //Get date ranges $options['daterange'] = array('0' => 'TOOLBAR_ALL', 'today' => 'TOOLBAR_TODAY', 'yesterday' => 'TOOLBAR_YESTERDAY', 'last7days' => 'TOOLBAR_LAST_7_DAYS', 'last14days' => 'TOOLBAR_LAST_14_DAYS', 'last30days' => 'TOOLBAR_LAST_30_DAYS', 'thisMonth' => 'TOOLBAR_THIS_MONTH', 'lastMonth' => 'TOOLBAR_LAST_MONTH', 'thisYear' => 'TOOLBAR_THIS_YEAR', 'lastYear' => 'TOOLBAR_LAST_YEAR', 'custom' => 'TOOLBAR_CUSTOM'); //Get payment status $options['paymentstatus'] = array('waitingForPayment' => 'PROCESSES_WAITING_FOR_PAYMENT', 'prepaymentReceived' => 'PROCESSES_PREPAYMENT_RECEIVED', 'paymentCompleted' => 'PROCESSES_PAYMENT_COMPLETED'); //Get payment methods $paymentmethodDb = new Application_Model_DbTable_Paymentmethod(); $paymentmethodObject = $paymentmethodDb->fetchAll($paymentmethodDb->select()->where('clientid = ?', $clientid)); $paymentmethods = array(); foreach ($paymentmethodObject as $paymentmethod) { $paymentmethods[$paymentmethod->title] = $paymentmethod->title; } $options['paymentmethods'] = $paymentmethods; //Get shipping methods $shippingmethodDb = new Application_Model_DbTable_Shippingmethod(); $shippingmethodObject = $shippingmethodDb->fetchAll($shippingmethodDb->select()->where('clientid = ?', $clientid)); $shippingmethods = array(); foreach ($shippingmethodObject as $shippingmethod) { $shippingmethods[$shippingmethod->title] = $shippingmethod->title; } $options['shippingmethods'] = $shippingmethods; //Set form options if (isset($form->catid)) { $form->catid->addMultiOptions($this->getMenuStructure($categories)); } if (isset($form->country)) { $form->country->addMultiOptions($countries); } if (isset($form->paymentmethod)) { $form->paymentmethod->addMultiOptions($paymentmethods); } if (isset($form->shippingmethod)) { $form->shippingmethod->addMultiOptions($shippingmethods); } return $options; }
public function getOptions($form, $clientid) { $options = array(); //Get categories $categoriesDb = new Application_Model_DbTable_Category(); $categoriesObject = $categoriesDb->fetchAll($categoriesDb->select()->where('type = ?', 'item')->where('clientid = ?', $clientid)->order('ordering')); $categories = array(); foreach ($categoriesObject as $category) { if (!$category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } foreach ($categoriesObject as $category) { if ($category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } $options['categories'] = $categories; //Get manufacturers $manufacturerDb = new Application_Model_DbTable_Manufacturer(); $manufacturersObject = $manufacturerDb->fetchAll(); $manufacturers = array(); foreach ($manufacturersObject as $manufacturer) { $manufacturers[$manufacturer->id] = $manufacturer->name; } $options['manufacturers'] = $manufacturers; //Get uoms $uomDb = new Application_Model_DbTable_Uom(); $uomsObject = $uomDb->fetchAll(); $uoms = array(); foreach ($uomsObject as $uom) { $uoms[$uom->id] = $uom->title; } $options['uoms'] = $uoms; //Get tax rates $taxrateDb = new Application_Model_DbTable_Taxrate(); $taxratesObject = $taxrateDb->fetchAll(); $taxrates = array(); $locale = Zend_Registry::get('Zend_Locale'); foreach ($taxratesObject as $taxrate) { $taxrates[$taxrate->id] = Zend_Locale_Format::toNumber($taxrate->rate, array('precision' => 1, 'locale' => $locale)) . ' %'; } $options['taxrates'] = $uoms; //Set form options $form->catid->addMultiOptions($this->getMenuStructure($categories)); $form->manufacturerid->addMultiOptions($manufacturers); if (isset($form->uomid)) { $form->uomid->addMultiOptions($uoms); } if (isset($form->taxid)) { $form->taxid->addMultiOptions($taxrates); } return $options; }
public function getOptions($form, $clientid) { $options = array(); //Get categories $categoriesDb = new Application_Model_DbTable_Category(); $categoriesObject = $categoriesDb->fetchAll($categoriesDb->select()->where('type = ?', 'contact')->where('clientid = ?', $clientid)->order('ordering')); $categories = array(); foreach ($categoriesObject as $category) { if (!$category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } foreach ($categoriesObject as $category) { if ($category->parentid) { $categories[$category->id]['id'] = $category->id; $categories[$category->id]['title'] = $category->title; $categories[$category->id]['parent'] = $category->parentid; if ($category->parentid) { if (!isset($categories[$category->parentid])) { $categories[$category->parentid] = array(); } if (!isset($categories[$category->parentid]['childs'])) { $categories[$category->parentid]['childs'] = array(); } array_push($categories[$category->parentid]['childs'], $category->id); } } } $options['categories'] = $categories; //Get states $options['states'] = array('100' => 'STATES_CREATED', '101' => 'STATES_IN_PROCESS', '102' => 'STATES_PLEASE_CHECK', '103' => 'STATES_PLEASE_DELETE', '104' => 'STATES_RELEASED', '105' => 'STATES_COMPLETED', '106' => 'STATES_CANCELLED'); //Get payment methods $paymentmethodDb = new Application_Model_DbTable_Paymentmethod(); $paymentmethodObject = $paymentmethodDb->fetchAll($paymentmethodDb->select()->where('clientid = ?', $clientid)); $paymentmethods = array(); foreach ($paymentmethodObject as $paymentmethod) { $paymentmethods[$paymentmethod->title] = $paymentmethod->title; } $options['paymentmethods'] = $paymentmethods; //Get shipping methods $shippingmethodDb = new Application_Model_DbTable_Shippingmethod(); $shippingmethodObject = $shippingmethodDb->fetchAll($shippingmethodDb->select()->where('clientid = ?', $clientid)); $shippingmethods = array(); foreach ($shippingmethodObject as $shippingmethod) { $shippingmethods[$shippingmethod->title] = $shippingmethod->title; } $options['shippingmethods'] = $shippingmethods; //Get templates $templateDb = new Application_Model_DbTable_Template(); $templateObject = $templateDb->fetchAll($templateDb->select()->where('clientid = ?', $clientid)); $templates = array(); foreach ($templateObject as $template) { $templates[$template->id] = $template->description; } $options['templates'] = $templates; //Get languages $languages = array('de_DE' => 'LANGUAGES_DE_DE', 'en_US' => 'LANGUAGES_EN_US'); $options['languages'] = $languages; //Set form options if (isset($form->catid)) { $form->catid->addMultiOptions($this->getMenuStructure($categories)); } //if(isset($form->country))$form->country->addMultiOptions($countries); //if(isset($form->paymentmethod)) $form->paymentmethod->addMultiOptions($paymentmethods); //if(isset($form->shippingmethod)) $form->shippingmethod->addMultiOptions($shippingmethods); //if(isset($form->templateid)) $form->templateid->addMultiOptions($templates); if (isset($form->language)) { $form->language->addMultiOptions($languages); } return $options; }
public function deleteAction() { $id = $this->_request->getParam('id'); $mdlCate = new Application_Model_DbTable_Category(); $mdlCate->deleteCate($id); $cache = Zend_Registry::get('cache'); $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('artcatebox')); $this->_forward('index'); }