protected function organizationExists(&$text, $fieldName) { $ortganizationModel = new Admin_Model_Organization(); $result = $ortganizationModel->fetchRow(K_Db_Select::create()->where(array('organization_id' => $text))); if (count($result)) { return true; } $this->errors[$fieldName] = 'Такой организации не существует'; return false; }
public static function balanceRemove($count) { self::init(); //снимаем деньги со счёта $organizationModel = new Admin_Model_Organization(); $organizationModel->update(array('organization_pay_balance' => K_Db_Quote::quote(K_Auth::getUserInfo('org_balance') - $count)), 'organization_id=' . K_Auth::getUserInfo('organization')); $journalData['p_org'] = K_Auth::getUserInfo('organization'); $journalData['p_client'] = K_Auth::getUserInfo('id'); $journalData['p_balance'] = K_Auth::getUserInfo('org_balance'); $journalData['p_count'] = $count; $journalData['p_admins'] = 0; $journalData['p_users'] = 1; $journalData['p_acost'] = self::$_adminCost; $journal = new Admin_Model_PayJournal(); $journal->save($journalData); K_Auth::setUserKey('org_balance', K_Auth::getUserInfo('org_balance') - $count); }
public function init() { $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate'); $this->setName('frmRegistration'); $model = new Admin_Model_Organization(); //$model = new Base_Security_Privilege(); //$arrGroup= $model->getGroupArray(); $arrGroup = $model->getOrganizationArray(); //print_r($arrGroup);die(); /* $this->addElement('select', 'groupId',array( 'label' => 'Group:', 'id' => 'groupId', 'required' => true, 'validators' => array( array('NotEmpty', true, array('messages'=>array('isEmpty'=>'Please select user group.'))) ), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions'=>$arrGroup, 'onchange' => 'getSubGroups()' )); */ $this->addElement('select', 'orgName', array('label' => 'Organization:', 'id' => 'orgName', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrGroup, 'onchange' => 'getSubGroups(this.value)')); // Add an text Organization Name element $this->addElement('text', 'organizationName', array('label' => 'Organization Name:', 'id' => '_organizationName', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); // Add an first name element $this->addElement('text', 'firstName', array('label' => 'First Name:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'lastName', array('label' => 'Last Name:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter last name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'address1', array('label' => 'Address1:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter address')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'address2', array('label' => 'Address2:', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); $this->addElement('text', 'city', array('label' => 'City:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter city')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'state', array('label' => 'State:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter state')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'zip', array('label' => 'Zip:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter zip')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'phone', array('label' => 'Phone:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter phone')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'fax', array('label' => 'Fax:', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter fax')))), 'filters' => array('StringTrim'))); $this->addElement('text', 'email', array('label' => 'Email Address:', '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')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'))); /* $arrSubgroup = array(""=>"Sub Group"); $this->addElement('select', 'subGroupId',array( 'label' => 'Sub Group:', 'id' => 'subGroupId', 'required' => true, 'validators' => array( array('NotEmpty', true, array('messages'=>array('isEmpty'=>'Please select Subgroup.'))) ), 'decorators' => $this->elementDecorators, 'onchange' => 'getRoles()', 'filters' => array('StringTrim'), 'MultiOptions'=>$arrSubgroup )); $arrUserRole = array(""=>'Roles'); $this->addElement('select', 'roleId',array( 'label' => 'User Role:', 'id' => 'roleId', 'required' => true, 'validators' => array( array('NotEmpty', true, array('messages'=>array('isEmpty'=>'Please select user Role.'))) ), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions'=>$arrUserRole )); $user = new Security_Model_User(); $arrSupervisor = $user->getAllUsers(); $this->addElement('select', 'supervisorId',array( 'label' => 'Supervisor:', 'id' => 'supervisorId', 'required' => true, 'validators' => array( array('NotEmpty', true, array('messages'=>array('isEmpty'=>'Please select user Supervisor.'))) ), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions'=>$arrSupervisor )); */ $this->addElement('submit', 'submit', array('required' => false, 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators)); }
public function ajaxGetSubGroupAction() { $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); $group_id = $this->_getParam('group_id'); $objPrivilege = new Admin_Model_Organization(); $subgroups = $objPrivilege->getOrgamizationArray($group_id); //print_r ($subgroups); //$objPrivilege = new Base_Security_Privilege(); //$subgroups=$objPrivilege->getSubGroupArray($group_id); echo Zend_Json::encode($subgroups); }
public function getids() { $obj = new Admin_Model_Organization(); $entries = $obj->fetchAll(); $arrUser = array(); foreach ($entries as $entry) { $arrUser[$entry->getId()] = $entry->getUsername(); } return $arrUser; }