function connect() { require_once _adm_ . '/lib/lib.field.php'; require_once _base_ . '/lib/lib.eventmanager.php'; // Load language for fields names $lang_dir =& DoceboLanguage::createInstance('admin_directory', 'framework'); $acl =& Docebo::user()->getACL(); $acl_manager = Docebo::user()->getAclManager(); $this->fl = new FieldList(); $this->idst_group = $acl_manager->getGroupST('oc_' . (int) $this->tree); $this->idst_desc = $acl_manager->getGroupST('ocd_' . (int) $this->tree); $this->arr_fields = $this->fl->getAllFields(); $this->cols_descriptor = NULL; if ($this->dbconn === NULL) { $this->last_error = Lang::t('_ORG_IMPORT_ERR_DBCONNISNULL'); return FALSE; } $query = "SHOW FIELDS FROM " . $GLOBALS['prefix_fw'] . "_user"; $rs = sql_query($query, $this->dbconn); if ($rs === FALSE) { $this->last_error = Lang::t('_ORG_IMPORT_ERR_ERRORONQUERY') . $query . ' [' . mysql_error($this->dbconn) . ']'; return FALSE; } $this->cols_descriptor = array(); while ($field_info = mysql_fetch_array($rs)) { if (!in_array($field_info['Field'], $this->ignore_cols)) { $mandatory = in_array($field_info['Field'], $this->mandatory_cols); if (isset($this->default_cols[$field_info['Field']])) { $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $lang_dir->def('_DIRECTORY_FILTER_' . $field_info['Field']), DOCEBOIMPORT_COLID => $field_info['Field'], DOCEBOIMPORT_COLMANDATORY => $mandatory, DOCEBOIMPORT_DATATYPE => $field_info['Type'], DOCEBOIMPORT_DEFAULT => $this->default_cols[$field_info['Field']]); } else { $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $lang_dir->def('_DIRECTORY_FILTER_' . $field_info['Field']), DOCEBOIMPORT_COLID => $field_info['Field'], DOCEBOIMPORT_COLMANDATORY => $mandatory, DOCEBOIMPORT_DATATYPE => $field_info['Type']); } } } $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => Lang::t('_FOLDER_NAME', 'standard'), DOCEBOIMPORT_COLID => 'tree_name', DOCEBOIMPORT_COLMANDATORY => false, DOCEBOIMPORT_DATATYPE => 'text'); mysql_free_result($rs); foreach ($this->arr_fields as $field_id => $field_info) { if (in_array($field_info[FIELD_INFO_TYPE], $this->valid_filed_type)) { $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $field_info[FIELD_INFO_TRANSLATION], DOCEBOIMPORT_COLID => $field_id, DOCEBOIMPORT_COLMANDATORY => FALSE, DOCEBOIMPORT_DATATYPE => 'text', DOCEBOIMPORT_DEFAULT => false); } } $this->userlevel = $acl_manager->getGroupST(ADMIN_GROUP_USER); $idst_oc = $acl_manager->getGroup(false, '/oc_0'); $this->idst_oc = $idst_oc[ACL_INFO_IDST]; $idst_ocd = $acl_manager->getGroup(false, '/ocd_0'); $this->idst_ocd = $idst_ocd[ACL_INFO_IDST]; // cache orgchart $um = new UsermanagementAdm(); $this->orgchart = $um->getAllFolders('both', $this->tree != 0 ? $this->tree : false); return TRUE; }