getVendorModel()->getQuestions(); } public function getNaicsCategories() { return $this; } public function getNaicsCodes($category = null, $query = null) { $select = $this->_db->select(); $select->from($this->_getPair('Naics'), ['code' => 'id', 'title']); if ($category) { $select->where('id LIKE ' . Qs_Db::quoteLike($category, '{term}%')); } if ($query) { Qs_Db_Filter::where($select, ['id', 'title'], $query); } $select->order(NaicsModel::getOrderByCodeExpr()); return $this->_db->fetchAll($select); } public function getNaicsChosenCodes(array $codes) { if (empty($codes)) { return []; } $select = $this->_db->select(); $select->from($this->_getPair('Naics'), ['code' => 'id', 'title']); $select->where('`id` IN (?)', $codes, Qs_Db::INT_TYPE); $select->order(NaicsModel::getOrderByCodeExpr()); return $this->_db->fetchAll($select); } public function getModel(array $options = []) { if (!empty($options)) { return new Model(array_merge(['db' => $this->_db], $options)); } if (null === $this->model) { $this->model = new Model(['db' => $this->_db]); } return $this->model; } public function getVendorModel(array $options = []) { if (!empty($options)) { return new VendorModel(array_merge(['db' => $this->_db], $options)); } if (null === $this->vendorModel) { $this->vendorModel = new VendorModel(['db' => $this->_db]); } return $this->vendorModel; } public function getPaymentSummary($isPreferredVendor = false) { $price = $isPreferredVendor ? SettingsObj::get('naicsCodesPreferredPrice') : SettingsObj::get('naicsCodesRegularPrice'); $adminFee = SettingsObj::get('adminFee'); $registrationFee = Zend_Locale_Math::Add($price, $adminFee, 0); $backgroundScreeningFee = SettingsObj::get('backgroundScreeningFee'); $total = Zend_Locale_Math::Add($registrationFee, $backgroundScreeningFee, 0); return compact('price', 'adminFee', 'registrationFee', 'backgroundScreeningFee', 'total'); } protected function _addDependenciesFromDb(array &$data) { $data['naicsCodes'] = $this->getModel()->getLicenseNaics($data['id']); $data['tribes'] = $this->getModel()->getLicenseTribes($data['id'], true); $this->_prepareTribesSurcharge4Form($data); return $this; } protected function _prepareTribesSurcharge4Form(&$data) { foreach($data['tribes'] as $tribe) { $data['surcharge_'. $tribe['tribeId']] = $tribe['surcharge']; } return $this; } }