public function init() { $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate'); $this->setName('incoming_cows'); // $this->addElementPrefixPath('Base_Decorator', // 'Base/Decorator/', // 'decorator'); $model = new Admin_Model_Supplier(); $arrGroup = $model->getAllSuppliers(1); // print_r($arrGroup);die(); $this->addElement('select', 'supplierId', array('label' => 'Select Supplier:', 'id' => 'supplierId', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select Supplier.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrGroup)); //$arrSubgroup = array("0"=>"Sub Group"); $this->addElement('text', 'noCows', array('label' => 'Select Number of Cows:', 'id' => 'noCows', 'class' => 'spinbutton_input', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select number of Cows.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); // Add an first name element $this->addElement('text', 'description', array('label' => 'Antimortum Information:', 'class' => 'text-input medium-input', 'required' => true, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function init() { $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate'); $this->setName('supplier_create'); // $this->addElementPrefixPath('Base_Decorator', // 'Base/Decorator/', // 'decorator'); $this->addElement('text', 'username', array('label' => 'Username:'******'autocomplete' => "off", 'class' => 'required', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter username'))), array('Db_NoRecordExists', true, array('table' => 'supplier', 'field' => 'username', 'messages' => 'username already exists'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('password', 'password', array('label' => 'Password:'******'autocomplete' => "off", 'required' => true, 'class' => 'required', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter password'))), array('validator' => 'StringLength', 'options' => array(6, 20)))))->getElement('password')->addValidator('IdenticalField', false, array('c_password', 'Confirm Password')); // Add an password element $this->addElement('password', 'c_password', array('label' => 'Confirm Password:'******'required' => true, 'class' => 'required', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(6, 20))))); // Add an password element // Add an Organization name element $this->addElement('text', 'orgName', array('label' => 'Organization Name:', 'class' => 'required', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Organization name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); // Add an first name element $this->addElement('text', 'firstName', array('label' => 'First Name:', 'class' => 'required', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); // Add an last name element $this->addElement('text', 'lastName', array('label' => 'Last Name:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); // Add an Address1 element $this->addElement('text', 'address1', array('label' => 'Address1:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); // Add an Address2 element $this->addElement('text', 'address2', array('label' => 'Address2:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); // Add an City element $this->addElement('text', 'city', array('label' => 'City:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); // Add an State element $this->addElement('text', 'state', array('label' => 'State:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); // Add an Zip element $this->addElement('text', 'zip', array('label' => 'Zip:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); // Add an Phone element $this->addElement('text', 'phone', array('label' => 'Phone:', 'class' => 'required number', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); // Add an Fax element $this->addElement('text', 'fax', array('label' => 'Fax:', 'class' => 'required number', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'email', array('label' => 'Email:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter email'))), array('EmailAddress', true, array('messages' => array('emailAddressInvalidFormat' => 'Invalid email address format')))), 'class' => 'required email', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $model = new Admin_Model_Supplier(); //$model = new Base_Security_Privilege(); //$arrGroup= $model->getGroupArray(); $quicksupplier = $model->getquickSupplier(); if ($quicksupplier) { $checked = true; } else { $checked = false; } $this->addElement('checkbox', 'quickSupplier', array('label' => 'Quick Supplier:', 'id' => 'quickSupplier', 'checked' => $checked, 'required' => true, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function changeStatusAction() { $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $id = $this->_getParam('id'); $status = $this->_getParam('status'); if ($status == 0) { $status = 1; } else { $status = 0; } $model = new Admin_Model_Supplier(); $res = $model->changeStatus($id, $status); if (false === $res) { $arrResult = array("result" => 0); } else { $arrResult = array("result" => 1); } echo Zend_Json::encode($arrResult); }
public function getSupplier($id = null) { if ($id) { $where = "id='{$id}'"; } else { $where = "id!='-2147483648'"; } $model = new Admin_Model_Supplier(); $table = $model->getMapper()->getDbTable(); $select = $table->select()->setIntegrityCheck(false)->from(array("s" => 'supplier'))->order("first_name")->where($where); $sql = $select->__toString($select); $rows = $model->fetchAll($select); //print_r($rows); $arr[''] = "Select"; foreach ($rows as $row) { $arr[$row->getId()] = $row->getFirstName() . ' ' . $row->getLastName(); } return $arr; }
public function getids() { $obj = new Admin_Model_Supplier(); $entries = $obj->fetchAll(); $arrUser = array(); foreach ($entries as $entry) { $arrUser[$entry->getId()] = $entry->getUsername(); } return $arrUser; }
public function quickSupplier() { $obj = new Admin_Model_Supplier(); $entries = $obj->fetchAll("quick_supplier = '1'", "username"); //print_r ($entries); return $entries; }