public function getBackendApplicationId() { $model = new BackendApplication(); $rowset = $model->fetchAll($model->select()->from($model)->where('application_code = ?', $this->getBackendApplicationCode())->limit(1)); $arr = $rowset->toArray(); return $arr[0]['id']; }
/** * Get DEF Adapter by Backend Application * @param $idBackendApplication */ private function getDefAdapter($idBackendApplication) { $backendApp = new BackendApplication(); $backendAppRow = $backendApp->getBackendApplication(intval($idBackendApplication)); if (is_null($backendAppRow)) { throw new Logic_Exception('Nie znaleziono backend Application o podanym id'); } return Base_Def_Factory::getInstance($backendAppRow->application_code); }
/** * @return void */ public function baseInit() { $backendApplications = array(0 => 'default'); $model = new BackendApplication(); foreach ($model->fetchAll() as $val) { $backendApplications[$val->id] = $val->application_name; } $this->addElement('select', 'id_backend_application', array('label' => 'Backend Application name:', 'multioptions' => $backendApplications)); $this->submit(false, 'submit', 'Pokaż'); }
/** * Ustawia id backend_application * * @param mixed $backendApplicationId * @return Base_Dictionary_Extended */ public function setBackendApplicationId($backendApplicationId) { if (is_int($backendApplicationId)) { $this->_backendApplicationId = $backendApplicationId; } elseif (is_string($backendApplicationId)) { $model = new BackendApplication(); $backendApplication = $model->getBackendApplication($backendApplicationId); if ($backendApplication !== null) { $this->_backendApplicationId = $backendApplication->id; } } return $this; }
/** * @return void */ public function baseInit() { $this->addElement('text', 'dictionary_name', array('required' => true, 'label' => 'Dictionary name:')); $this->addElement('text', 'code', array('required' => true, 'label' => 'Dictionary code:', 'validators' => array(array('Regex', true, array('/[a-z0-9_]{1,50}/'))))); $backendApplications = array(0 => ''); $model = new BackendApplication(); foreach ($model->fetchAll($model->select()->where('ghost = false')->order('application_name ASC')) as $val) { $backendApplications[$val->id] = $val->application_name; } $this->addElement('select', 'id_backend_application', array('label' => 'Backend Application name:', 'multioptions' => $backendApplications)); $this->submit(); $this->cancel(); }
/** * Ustawia na obiekcie zmapowane rezultaty wyszukiwania * @param array $searchResults - rezultaty wyszukiwania */ public function setSearchResults($searchResults) { foreach ($searchResults as $result) { // Mapowanie typu dokumentu if ($result['identity_document_type']) { $dict = new Base_Dictionary($result['id_backend_application']); $docTypeDict = $dict->setSource('identity_type')->getDictionary()->toArray(); $result['identity_document_type'] = $docTypeDict[$result['identity_document_type']]; } // Mapowanie nazwy zewnetrznej aplikacji if ($result['id_backend_application']) { $backendApplication = new BackendApplication(); $baRow = $backendApplication->findOne($result['id_backend_application']); $result['id_backend_application'] = $baRow->application_name; } // Mapowanie kluczy wynikowych $result = $this->getKeyResultsDictMapping($result); $return[] = $result; } $this->searchResults = $return; }
/** * * @param type $searchResults */ public function getSearchResults($searchResults) { foreach ($searchResults as $result) { // Mapowanie typu dokumentu if ($result['identity_document_type']) { $dict = new Base_Dictionary($result['id_backend_application']); $docTypeDict = $dict->setSource('identity_type')->getDictionary()->toArray(); $result['identity_document_type'] = $docTypeDict[$result['identity_document_type']]; } // Mapowanie nazwy zewnetrznej aplikacji if ($result['id_backend_application']) { $backendApplication = new BackendApplication(); $baRow = $backendApplication->findOne($result['id_backend_application']); $result['id_backend_application'] = $baRow->application_name; } // Mapowanie kluczy wynikowych if (is_array($result)) { foreach ($result as $key => $value) { if ($this->resultsDictMap[$key]) { $result[$this->resultsDictMap[$key]] = $value; } unset($result[$key]); } } $return[] = $result; } return $this->getJson($return); }
public function getUserDefLogin() { $config = Zend_Registry::get('config'); $idUser = Zend_Auth::getInstance()->getIdentity()->id; $id_backend_application = $config['backendApplication']['getin']['id']; $modelUserBackendApplication = new UserBackendApplication(); $userDefLogin = $modelUserBackendApplication->getUserBackendAppLogin($idUser, $id_backend_application); if ($userDefLogin) { $userDefLogin = $userDefLogin->login; } else { $model = new BackendApplication(); $defaultBranch = $model->getDefaultBranch($id_backend_application); $userDefLogin = $defaultBranch->default_login; } return $userDefLogin; }
/** * Funkcja do synchronizacji słowników ze słownikami z systemów zewnętrzych. * W przpadku gdy słownik nie istenieje zostanie on stworzony */ public function synchronizedWithBackendAplications() { $dictList = array('country' => array('code' => 'DIC_COUNTRIES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'province' => array('code' => 'DIC_PROVINCES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'material_status' => array('code' => null, 'function' => 'getMartialStatuses', 'out' => array('data' => null, 'entry' => 'DESCRIPTION', 'id_entry' => 'ID')), 'education' => array('code' => 'DIC_EDUCATIONS', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'identity_type' => array('code' => 'DIC_IDENTITY_TYPE', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'ocupation' => array('code' => 'DIC_OCCUPATIONS', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'cust2bank_role' => array('code' => 'DIC_CUST2BANK_ROLES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'cust_class' => array('code' => 'DIC_CUST_CLASSES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'currency' => array('code' => 'DIC_CURRENCIES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'cust_group' => array('code' => 'DIC_CUST_GROUPS', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'line' => array('code' => 'DIC_LINES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'ekd' => array('code' => 'DIC_EKD', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'org_form' => array('code' => 'DIC_ORG_FORMS', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'industry_sector' => array('code' => 'DIC_INDUSTRY_SECTORS', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'firm_legal_status' => array('code' => 'DIC_FIRM_LEGAL_STATUSES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'firm_size' => array('code' => 'DIC_FIRM_SIZES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'comm_category' => array('code' => 'DIC_COMM_CATEGORIES', 'function' => null, 'out' => array('data' => 'dictionary_column', 'entry' => 'description', 'id_entry' => 'id')), 'comm_category_poss' => array('code' => null, 'function' => 'getCommCategoryPos', 'out' => array('data' => null, 'entry' => 'DESCRIPTION', 'id_entry' => 'ID_COMM_CATEGORY_POS', 'id_parent_entry' => 'ID_COMM_CATEGORY')), 'pkd_code' => array('code' => null, 'function' => 'getPKD', 'out' => array('data' => 'dic_pkd2007', 'entry' => 'description', 'id_entry' => 'pkd_code'))); $backendapplicationObj = new BackendApplication(); $backendapplicationsData = $backendapplicationObj->fetchAll($backendapplicationObj->getBackendApplicationsListSelect()); foreach ($backendapplicationsData as $appicationData) { $clasname = $appicationData->main_adapter_class; // debug($clasname); if (@class_exists($clasname)) { $objAdapter = new $clasname(); if ($objAdapter instanceof Logic_Frontend_Adapter_Interface) { foreach ($dictList as $key => $dict) { set_time_limit(30); $dictData = $objAdapter->getDictionary($dict); if (sizeof($dictData) > 0) { $this->_synchronizedDictionary($appicationData->id, $key, $dict['code'] ? $dict['code'] : $dict['function'], $dictData); } } } } } }
<?php require '../apps/backend/BackendApplication.class.php'; $app = new BackendApplication(); $app->run();
protected function _setSecurityLevels(Base_Form_Abstract $form, $profileId, $idUser) { $modelBa = new BackendApplication(); $modelProfileSecLevel = new ProfileSecLevel(); $modelUser = new User(); $user = $modelUser->FindOne($idUser); $setSecurityLevelsEvent = new Logger_Event_Logic('editUser', 'Edycja poziomów zabezpieczeń użytkownika ' . $user['login']); foreach ($modelProfileSecLevel->getLevelsForProfile($profileId) as $val) { $val->ghost = true; $params[0]['field_name'] = 'Poziom zabezpieczeń'; $params[0]['value'] = $val->security_level; $setSecurityLevelsEvent->addItem('Usunięcie poprzedniego poziomu', null, $params); $val->save(); } foreach ($modelBa->getBackendApplicationsList('application_name', 'asc') as $val) { $element = $form->getElement('seclvl' . $val->application_code); if ($element) { $secLevel = $modelProfileSecLevel->createRow(array('id_profile' => $profileId, 'id_backend_application' => $val->id, 'security_level' => $element->getValue(), 'created_by' => Zend_Auth::getInstance()->getIdentity()->id)); $params = $secLevel->getUpdatedFieldsOnlyNew(); $setSecurityLevelsEvent->addItem('Dodanie poziomu zabezpieczeń', null, $params); $secLevel->save(); } } $this->logEvent($setSecurityLevelsEvent); // $logger = Zend_Registry::get('logger'); // $logger['messages']['User'][$id] = 'Hasło zostało zmienione.'; // Zend_Registry::set('logger',$logger); return null; }