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']; }
/** * @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ż'); }
/** * @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(); }
/** * 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); } } } } } }