_formDataFields) { $preparedData = array(); foreach ($this->_formDataFields as $groupName => $fields) { foreach ($fields as $field) { $dataField = $groupName . ucfirst($field); if (isset($data[$dataField])) { $preparedData[$groupName][$field] = $data[$dataField]; } } } $data = $preparedData; } return $this; } public function setFormDataFields(Qs_Form $form) { $dataFields = array(); $subforms = $form->getSubForms(); foreach ($subforms as $subform) { /** @var Qs_Form_SubForm $subform */ foreach ($subform->getElements() as $element) { /** @var Zend_Form_Element $element */ $dataFields[$subform->getName()][] = $element->getName(); } } $this->_formDataFields = $dataFields; return $this; } public function isValidTab($restAlias) { $restParams = explode('/', $restAlias); return $this->isValidPage((int) $restParams[1]); } public function isValidPage($transactionId = null) { if ($transactionId === null) { $transactionId = $this->getPrimaryKey(); } $cartId = $this->_getTable('Cart')->searchBy(array('transactionId' => $transactionId), 'id'); if ($cartId) { $cartObj = new App_ECommerce_Order_Admin_Product_Obj(); $cartObj->setPrimaryKey($cartId); return (bool) $cartObj->getItemsCount(); } return false; } public function getUsers4Autocomplete($term) { $select = $this->_db->select(); $columns = array('value' => 'id', 'title' => 'CONCAT_WS(" ", `firstName`, `lastName`)'); $select->from( $this->_getPair('User'), $columns); $select->where('CONCAT_WS(" ", `firstName`, `lastName`) LIKE (?)', '%' . $term . '%') ->where('`User`.`bought` = "y"'); return $this->_db->fetchAll($select); } }