public function fieldsTask()
 {
     $level = Docebo::user()->getUserLevelId();
     if (Get::sett('request_mandatory_fields_compilation', 'off') == 'on' && $level != ADMIN_GROUP_GODADMIN) {
         require_once _adm_ . '/lib/lib.field.php';
         $fl = new FieldList();
         $idst_user = Docebo::user()->getIdSt();
         $res = $fl->storeFieldsForUser($idst_user);
     }
     Util::jump_to('index.php?r=elearning/show');
 }
 /**
  * Set the new fields and policy acceptance, than jump to the proper page
  */
 public function set()
 {
     $id_user = Docebo::user()->getIdst();
     require_once _adm_ . '/lib/lib.field.php';
     $fl = new FieldList();
     $fl->storeFieldsForUser($id_user);
     $accept_policy = Get::req('accept_policy', DOTY_INT, 0) > 0;
     $this->model->setAcceptingPolicy($id_user, $accept_policy);
     $policy_checked = $this->model->getAcceptingPolicy($id_user);
     $fields_checked = $fl->checkUserMandatoryFields($id_user);
     if ($fields_checked && $policy_checked) {
         //send alert
         Util::jump_to($this->jump_url);
     } else {
         //send alert
         Util::jump_to('index.php?r=precompile/show&res=err');
     }
 }
예제 #3
0
 /**
  * save the data sended by a user profile modification
  */
 function saveUserData($id_user, $data, $also_preference, $also_extra_field)
 {
     if (!$this->acl_man->updateUser($id_user, isset($data['userid']) ? $data['userid'] : false, $data['firstname'], $data['lastname'], isset($data['new_pwd']) && $data['new_pwd'] != '' && $data['new_pwd'] == $data['repeat_pwd'] ? $data['new_pwd'] : false, $data['email'], FALSE, $data['signature'], FALSE, FALSE, isset($data['force_change']) ? $data['force_change'] : '', $data['facebook_id'], $data['twitter_id'], $data['linkedin_id'], $data['google_id'])) {
         return false;
     }
     if (isset($data['level'])) {
         $acl_man =& Docebo::user()->getAclManager();
         $current_level = $acl_man->getUserLevelId($id_user);
         if ($data['level'] != $current_level) {
             $arr_levels = $acl_man->getAdminLevels();
             $acl_man->addToGroup($arr_levels[$data['level']], $id_user);
             $acl_man->removeFromGroup($arr_levels[$current_level], $id_user);
         }
     }
     if ($also_extra_field) {
         require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
         $extra_field = new FieldList();
         if (!$extra_field->storeFieldsForUser($id_user)) {
             return false;
         }
     }
     if ($also_preference) {
         require_once _base_ . '/lib/lib.preference.php';
         $preference = new UserPreferences($id_user);
         if (!$preference->savePreferences($_POST, 'ui.')) {
             return false;
         }
     }
     return true;
 }
예제 #4
0
 function savesel()
 {
     checkPerm('view');
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('register', 'lms');
     $mand_sym = '<span class="mandatory">*</span>';
     $extra_field = new FieldList();
     $GLOBALS['page']->add(getTitleArea($lang->def('_MYGROUP'), 'mygroup') . '<div class="std_block">', 'content');
     $selected = array();
     if (isset($_POST['group_sel'])) {
         $selected = $_POST['group_sel'];
     } elseif (isset($_POST['group_sel_implode'])) {
         $selected = explode(',', $_POST['group_sel_implode']);
     }
     $play_field = $extra_field->playFieldsForUser(getLogUserId(), $selected, false, false, array('readonly'));
     if (isset($_POST['save_field']) || $play_field === false || $play_field == '') {
         $re_filled = $extra_field->isFilledFieldsForUser(getLogUserId(), $selected);
         if (!$re_filled) {
             $GLOBALS['page']->add(getErrorUi($lang->def('_SOME_MANDATORY_EMPTY')), 'content');
         } else {
             $acl =& Docebo::user()->getAcl();
             $acl_man =& Docebo::user()->getAclManager();
             $groups =& $acl_man->getAllGroupsId(array('free', 'moderate'));
             $groups_id = array_keys($groups);
             $user_group = $acl->getSTGroupsST(getLogUserId());
             $add_groups = array_diff($selected, $user_group);
             $del_groups = array_diff($groups_id, $selected);
             $moderate_add = false;
             if (!empty($add_groups)) {
                 while (list(, $idst) = each($add_groups)) {
                     if ($groups[$idst]['type'] == 'free') {
                         $acl_man->addToGroup($idst, getLogUserId());
                     } elseif ($groups[$idst]['type'] == 'moderate') {
                         $acl_man->addToWaitingGroup($idst, getLogUserId());
                         $moderate_add = true;
                     }
                 }
             }
             if ($moderate_add === true) {
                 require_once _base_ . '/lib/lib.eventmanager.php';
                 // message to user that is odified
                 $msg_composer = new EventMessageComposer();
                 $msg_composer->setSubjectLangText('email', '_TO_APPROVE_GROUP_USER_SBJ', false);
                 $msg_composer->setBodyLangText('email', '_TO_APPROVE_GROUP_USER_TEXT', array('[url]' => Get::sett('url')));
                 $msg_composer->setBodyLangText('sms', '_TO_APPROVE_GROUP_USER_TEXT_SMS', array('[url]' => Get::sett('url')));
                 $idst_approve = $acl->getRoleST('/framework/admin/directory/editgroup');
                 $recipients = $acl_man->getAllRoleMembers($idst_approve);
                 createNewAlert('UserGroupModerated', 'directory', 'moderate', '1', 'User group subscription to moderate', $recipients, $msg_composer);
             }
             if (!empty($del_groups)) {
                 while (list(, $idst_group) = each($del_groups)) {
                     $extra_field->removeUserEntry(getLogUserId(), $idst_group);
                     $acl_man->removeFromGroup($idst_group, getLogUserId());
                 }
             }
             // Save fields
             $extra_field->storeFieldsForUser(getLogUserId());
             Util::jump_to('index.php?modname=mygroup&amp;op=group');
         }
     }
     $GLOBALS['page']->add('<div class="reg_note">' . $lang->def('_GROUPS_FIELDS') . '<ul class="reg_instruction">' . '<li>' . str_replace('[mandatory]', $mand_sym, $lang->def('_REG_MANDATORY')) . '</li>' . '</ul>' . '</div>' . Form::openForm('group_subscription', 'index.php?modname=mygroup&amp;op=savesel') . Form::openElementSpace() . Form::getHidden('group_sel_implode', 'group_sel_implode', isset($_POST['group_sel_implode']) ? $_POST['group_sel_implode'] : implode(',', $selected)) . $play_field . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_field', 'save_field', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
예제 #5
0
 function _opt_in($options, $platform, $opt_link)
 {
     $social = new Social();
     $lang =& DoceboLanguage::createInstance('register', $platform);
     // Check for error
     $out = '';
     $error = $this->_checkField($_POST, $options, $platform, true);
     if ($error['error']) {
         $this->error = true;
         return '<div class="reg_err_data">' . $error['msg'] . '</div>';
     }
     // Insert temporary
     $random_code = md5($_POST['register']['userid'] . mt_rand() . mt_rand() . mt_rand());
     // register as temporary user and send mail
     $acl_man =& Docebo::user()->getAclManager();
     $iduser = $acl_man->registerTempUser($_POST['register']['userid'], $_POST['register']['firstname'], $_POST['register']['lastname'], $_POST['register']['pwd'], $_POST['register']['email'], $random_code);
     if ($iduser === false) {
         $out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
         $this->error = true;
         return $out;
     }
     // facebook register:
     if ($social->isActive('facebook')) {
         if (isset($_SESSION['fb_info']) && is_array($_SESSION['fb_info'])) {
             $social = new Social();
             $social->connectAccount('facebook', $_SESSION['fb_info']['id'], $iduser, true);
             unset($_SESSION['fb_info']);
         }
     }
     // ----
     // add base inscription policy
     $enrollrules = new EnrollrulesAlms();
     $enrollrules->newRules('_NEW_USER', array($iduser), Lang::get());
     // subscribe to groups -----------------------------------------
     if (isset($_POST['group_sel_implode'])) {
         $groups = explode(',', $_POST['group_sel_implode']);
         while (list(, $idst) = each($groups)) {
             $acl_man->addToGroup($idst, $iduser);
             // FORMA: added the inscription policy
             $enrollrules = new EnrollrulesAlms();
             $enrollrules->applyRulesMultiLang('_LOG_USERS_TO_GROUP', array((string) $iduser), false, (int) $idst, true);
             // END FORMA
         }
     }
     //if the user had enter a code we must check if there are folder related to it and add the folder's field
     $registration_code_type = Get::sett('registration_code_type', '0');
     $code_is_mandatory = Get::sett('mandatory_code', 'off') == 'on';
     $reg_code = Get::req('reg_code', DOTY_MIXED, '');
     if ($registration_code_type === 'custom') {
         $reg_code = 'change_by_custom_operation';
     }
     $array_folder = false;
     $uma = new UsermanagementAdm();
     $reg_code_res = $this->processRegistrationCode($acl_man, $uma, $iduser, $reg_code, $registration_code_type);
     if ($reg_code_res['success'] == false) {
         $acl_man->deleteTempUser($iduser);
         $this->error = true;
         return '<div class="reg_err_data">' . $reg_code_res['msg'] . '</div>';
     }
     // save language selected
     require_once _base_ . '/lib/lib.preference.php';
     $preference = new UserPreferences($iduser);
     $preference->setPreference('ui.language', Lang::get());
     // Save fields
     $extra_field = new FieldList();
     $extra_field->setFieldEntryTable($GLOBALS['prefix_fw'] . '_field_userentry');
     $extra_field->storeFieldsForUser($iduser);
     // Send mail
     $admin_mail = $options['mail_sender'];
     // FIX BUG 399
     //$link = str_replace('&amp;', '&', $opt_link.( strpos($opt_link, '?') === false ? '?' : '&' ).'random_code='.$random_code);
     $link = Get::sett('url', '') . 'index.php?modname=login&op=register_opt&random_code=' . $random_code;
     // END FIX BUG 399
     $text = $lang->def('_REG_MAIL_TEXT');
     $text = str_replace('[userid]', $_POST['register']['userid'], $text);
     $text = str_replace('[firstname]', $_POST['register']['firstname'], $text);
     $text = str_replace('[lastname]', $_POST['register']['lastname'], $text);
     $text = str_replace('[password]', $_POST['register']['pwd'], $text);
     $text = str_replace('[link]', '' . $link . '', $text);
     $text = str_replace('[hour]', $options['hour_request_limit'], $text);
     $text = stripslashes($text);
     //check register_type != self (include all previous cases except the new one "self without opt-in")
     if (strcmp($options['register_type'], 'self') != 0) {
         require_once _base_ . '/lib/lib.mailer.php';
         $mailer = DoceboMailer::getInstance();
         if (!$mailer->SendMail($admin_mail, $_POST['register']['email'], Lang::t('_MAIL_OBJECT', 'register'), $text, false, array(MAIL_REPLYTO => $admin_mail, MAIL_SENDER_ACLNAME => false))) {
             if ($registration_code_type == 'code_module') {
                 // ok, the registration has failed, let's remove the user association form the code
                 $code_manager = new CodeManager();
                 $code_manager->resetUserAssociation($code, $iduser);
             }
             $acl_man->deleteTempUser($iduser);
             $this->error = true;
             $out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
         } else {
             $out .= '<div class="reg_success">' . $lang->def('_REG_SUCCESS') . '</div>';
         }
     }
     //end
     $_GET['random_code'] = $random_code;
     $_GET['idst'] = $iduser;
     //check register_type = self
     if (strcmp($options['register_type'], 'self') == 0) {
         $text_self = $lang->def('_REG_MAIL_TEXT_SELF');
         $text_self = str_replace('[userid]', $_POST['register']['userid'], $text_self);
         $text_self = str_replace('[firstname]', $_POST['register']['firstname'], $text_self);
         $text_self = str_replace('[lastname]', $_POST['register']['lastname'], $text_self);
         $text_self = str_replace('[password]', $_POST['register']['pwd'], $text_self);
         require_once _base_ . '/lib/lib.mailer.php';
         $mailer = DoceboMailer::getInstance();
         if (!$mailer->SendMail($admin_mail, $_POST['register']['email'], Lang::t('_MAIL_OBJECT_SELF', 'register'), $text_self, false, false)) {
             $out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
         } else {
             $this->confirmRegister($this->_platform, $options);
             $out .= '<div class="reg_success">' . $lang->def('_REG_SUCCESS_SELF') . '</div>';
         }
     }
     //end
     return $out;
 }
예제 #6
0
 function extendedParsing($arrayState, $arrayExpand, $arrayCompress)
 {
     if (isset($arrayState['editpersonsave'])) {
         $idst = $_POST['idst'];
         $userid = $_POST['userid'];
         $firstname = $_POST['firstname'];
         $lastname = $_POST['lastname'];
         $pass = $_POST['pass'];
         $userlevel = $_POST['userlevel'];
         $olduserlevel = $_POST['olduserlevel'];
         if ($pass === '') {
             $pass = FALSE;
         }
         $email = $_POST['email'];
         if ($idst !== '') {
             //-extra field-----------------------------------------------
             require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
             $fields = new FieldList();
             //$re_filled = $fields->isFilledFieldsForUser($idst);
             if ($userid != '') {
                 $info = $this->aclManager->getUser($idst, false);
                 $this->aclManager->updateUser($idst, $userid, $firstname, $lastname, $pass, $email, FALSE, FALSE);
                 //-extra field-----------------------------------------------
                 $fields->storeFieldsForUser($idst);
                 //-----------------------------------------------------------
                 // remove from old group level
                 $this->aclManager->removeFromGroup($olduserlevel, $idst);
                 // add to group level
                 $this->aclManager->addToGroup($userlevel, $idst);
                 if ($this->aclManager->absoluteId($userid) != $info[ACL_INFO_USERID] || $this->aclManager->encrypt($pass) != $info[ACL_INFO_PASS]) {
                     require_once _base_ . '/lib/lib.eventmanager.php';
                     $pl_man = PlatformManager::createInstance();
                     $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                     // message to user that is odified
                     $msg_composer = new EventMessageComposer();
                     $msg_composer->setSubjectLangText('email', '_MODIFIED_USER_SBJ', false);
                     $msg_composer->setBodyLangText('email', '_MODIFIED_USER_TEXT', $array_subst);
                     if ($pass != '') {
                         $msg_composer->setBodyLangText('email', '_PASSWORD_CHANGED', array('[password]' => $pass));
                     }
                     $msg_composer->setBodyLangText('sms', '_MODIFIED_USER_TEXT_SMS', $array_subst);
                     if ($pass != '') {
                         $msg_composer->setBodyLangText('sms', '_PASSWORD_CHANGED_SMS', array('[password]' => $pass));
                     }
                     createNewAlert('UserMod', 'directory', 'edit', '1', 'User ' . $userid . ' was modified', array($userid), $msg_composer);
                 }
                 $GLOBALS['page']->add(getResultUi($this->lang->def('_OPERATION_SUCCESSFUL')));
             } else {
                 $this->op = 'reedit_person';
                 //$GLOBALS['page']->add( getErrorUi( implode(',', $re_filled) ), 'content');
             }
         } else {
             if (isset($_POST['arr_idst_groups'])) {
                 $arr_idst_groups = unserialize(urldecode($_POST['arr_idst_groups']));
                 $acl =& Docebo::user()->getACL();
                 $arr_idst_all = $acl->getArrSTGroupsST($arr_idst_groups);
             } else {
                 $arr_idst_groups = FALSE;
                 $arr_idst_all = FALSE;
             }
             //-verify that userid is not already used
             if ($this->aclManager->getUserST($userid) !== FALSE) {
                 $GLOBALS['page']->add(getErrorUi($this->lang->def('_USERID_DUPLICATE')));
                 $_POST['userid'] = '';
                 $this->op = 'reedit_person';
             } else {
                 //-verify mandatory extra field--------------------------------
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fields = new FieldList();
                 //$re_filled = $fields->isFilledFieldsForUser(0, $arr_idst_all);
                 if ($arr_idst_groups != FALSE && $userid != '') {
                     $idst = false;
                     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
                         $limit_insert = Docebo::user()->preference->getAdminPreference('admin_rules.limit_user_insert');
                         $max_insert = Docebo::user()->preference->getAdminPreference('admin_rules.max_user_insert');
                         $direct_insert = Docebo::user()->preference->getAdminPreference('admin_rules.direct_user_insert');
                         if ($limit_insert == 'off' || $limit_insert == 'on' && $max_insert > 0) {
                             if ($direct_insert == 'on') {
                                 Docebo::user()->preference->setPreference('admin_rules.max_user_insert', $max_insert - 1);
                                 $idst = $this->aclManager->registerUser($userid, $firstname, $lastname, $pass, $email, '', '');
                                 require_once _base_ . '/lib/lib.preference.php';
                                 $preference = new UserPreferences($idst);
                                 $preference->savePreferences($_POST, 'ui.');
                                 require_once _base_ . "/lib/lib.eventmanager.php";
                                 $pl_man =& PlatformManager::createInstance();
                                 $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                                 // message to user that is inserted
                                 $msg_composer = new EventMessageComposer();
                                 $msg_composer->setSubjectLangText('email', '_REGISTERED_USER_SBJ', false);
                                 $msg_composer->setBodyLangText('email', '_REGISTERED_USER_TEXT', $array_subst);
                                 $msg_composer->setBodyLangText('sms', '_REGISTERED_USER_TEXT_SMS', $array_subst);
                                 createNewAlert('UserNew', 'directory', 'edit', '1', 'User ' . $userid . ' created', array($userid), $msg_composer);
                                 $GLOBALS['page']->add(getResultUi($this->lang->def('_INSERTED_NEW_USER')));
                             } else {
                                 $acl = Docebo::user()->getAcl();
                                 $idst = $this->aclManager->registerTempUser($userid, $firstname, $lastname, $pass, $email, 0, getLogUserId());
                                 require_once _base_ . "/lib/lib.eventmanager.php";
                                 $pl_man =& PlatformManager::createInstance();
                                 $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                                 // message to user that is waiting
                                 $msg_composer = new EventMessageComposer();
                                 $msg_composer->setSubjectLangText('email', '_WAITING_USER_SBJ', false);
                                 $msg_composer->setBodyLangText('email', '_WAITING_USER_TEXT', $array_subst);
                                 $msg_composer->setBodyLangText('sms', '_WAITING_USER_TEXT_SMS', $array_subst);
                                 // send message to the user subscribed
                                 createNewAlert('UserNew', 'directory', 'edit', '1', 'User ' . $userid . ' was modified', array($userid), $msg_composer);
                                 // set as recipients all who can approve a waiting user
                                 $msg_c_approve = new EventMessageComposer();
                                 $msg_c_approve->setSubjectLangText('email', '_TO_APPROVE_USER_SBJ', false);
                                 $msg_c_approve->setBodyLangText('email', '_TO_APPROVE_USER_TEXT', array('[url]' => Get::sett('url')));
                                 $msg_c_approve->setBodyLangText('sms', '_TO_APPROVE_USER_TEXT_SMS', array('[url]' => Get::sett('url')));
                                 $idst_approve = $acl->getRoleST('/framework/admin/directory/approve_waiting_user');
                                 $recipients = $this->aclManager->getAllRoleMembers($idst_approve);
                                 createNewAlert('UserNewModerated', 'directory', 'edit', '1', 'User ' . $userid . ' to moderate', $recipients, $msg_c_approve);
                                 $GLOBALS['page']->add(getResultUi($this->lang->def('_INSERTED_WAIT_FOR_ADMIN')));
                             }
                         }
                     } else {
                         $idst = $this->aclManager->registerUser($userid, $firstname, $lastname, $pass, $email, '', '');
                         require_once _base_ . '/lib/lib.preference.php';
                         $preference = new UserPreferences($idst);
                         $preference->savePreferences($_POST, 'ui.');
                         require_once _base_ . "/lib/lib.eventmanager.php";
                         $pl_man =& PlatformManager::createInstance();
                         $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                         // message to user that is inserted
                         $msg_composer = new EventMessageComposer();
                         $msg_composer->setSubjectLangText('email', '_REGISTERED_USER_SBJ', false);
                         $msg_composer->setBodyLangText('email', '_REGISTERED_USER_TEXT', $array_subst);
                         $msg_composer->setBodyLangText('sms', '_REGISTERED_USER_TEXT_SMS', $array_subst);
                         createNewAlert('UserNew', 'directory', 'edit', '1', 'User ' . $userid . ' created', array($idst), $msg_composer);
                     }
                     if ($idst !== false) {
                         foreach ($arr_idst_groups as $idst_group) {
                             $this->aclManager->addToGroup($idst_group, $idst);
                         }
                         // add to group level
                         $this->aclManager->addToGroup($userlevel, $idst);
                         //-save extra field------------------------------------------
                         $fields->storeFieldsForUser($idst, $arr_idst_all);
                         //-----------------------------------------------------------
                     }
                 } else {
                     $this->op = 'reedit_person';
                     //$GLOBALS['page']->add(getErrorUi(implode('<br/>', $re_filled)), 'content');
                 }
             }
         }
     } elseif (isset($arrayState['deleteperson'])) {
         $idst = $_POST['idst'];
         if ($idst !== '') {
             require_once _base_ . "/lib/lib.eventmanager.php";
             $u_info = $this->aclManager->getUser($idst, false);
             $userid = $u_info[ACL_INFO_USERID];
             $pl_man =& PlatformManager::createInstance();
             $acl_man =& Docebo::user()->getAclManager();
             $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $acl_man->relativeId($userid));
             // message to user that is inserted
             $msg_composer = new EventMessageComposer();
             $msg_composer->setSubjectLangText('email', '_DELETED_USER_SBJ', false);
             $msg_composer->setBodyLangText('email', '_DELETED_USER_TEXT', $array_subst);
             $msg_composer->setBodyLangText('sms', '_DELETED_USER_TEXT_SMS', $array_subst);
             /*
             				createNewAlert(	'UserDel', 'directory', 'edit', '1', 'User '.$userid.' deleted',
             							array($idst), $msg_composer );*/
             $event =& DoceboEventManager::newEvent('UserDel', 'directory', 'edit', '1', 'User ' . addslashes($userid) . ' deleted');
             $event->setProperty('recipientid', implode(',', array($idst)));
             $event->setProperty('subject', $msg_composer->getSubject('email', getLanguage()));
             $event->setProperty('body', $msg_composer->getBody('email', getLanguage()));
             $msg_composer->prepare_serialize();
             $event->setProperty('MessageComposer', addslashes(rawurlencode(serialize($msg_composer))));
             $event->setProperty('userdeleted', $idst);
             DoceboEventManager::dispatch($event);
             $this->aclManager->deleteUser($idst);
             $GLOBALS['page']->add(getResultUi($this->lang->def('_OPERATION_SUCCESSFUL')));
         }
     }
     if (!isset($arrayState[$this->id])) {
         return;
     }
     foreach ($arrayState[$this->id] as $key => $action) {
         if ($key == 'save_newfolder') {
             $array_lang = Docebo::langManager()->getAllLangCode();
             $mand_lang = getLanguage();
             if (!isset($action[$mand_lang])) {
                 $this->op = 'newfolder';
             } else {
                 $folderName = array();
                 foreach ($array_lang as $langItem) {
                     $folderName[$langItem] = $arrayState[$this->id]['new_folder'][$langItem];
                 }
                 $this->tdb->addFolderByIdTranslation($this->selectedFolder, $folderName);
                 $this->refresh = TRUE;
             }
         } elseif ($key == 'save_renamefolder') {
             $array_lang = Docebo::langManager()->getAllLangCode();
             if ($this->getSelectedFolderId() == '0') {
                 $mand_lang = 'root';
             } else {
                 $mand_lang = getLanguage();
             }
             if (!isset($action[$mand_lang]) || $action[$mand_lang] == '') {
                 $this->op = 'renamefolder';
             } else {
                 $folder_id = $this->getSelectedFolderId();
                 $acl =& Docebo::user()->getACL();
                 //-extra field check mandatory -----------------------------
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fields = new FieldList();
                 $fields->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
                 $fields->setFieldEntryTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDENTRYTABLE);
                 $folder_id = $this->getSelectedFolderId();
                 $folder =& $this->tdb->getFolderById($folder_id);
                 $ancestor = $this->tdb->getAllParentId($folder, $this->tdb);
                 array_push($ancestor, $folder_id);
                 //$filled = $fields->isFilledFieldsForUser($folder_id, $ancestor, FALSE );
                 //----------------------------------------------------------
                 //if( $filled === true ) {
                 $folderName = array();
                 if ($this->getSelectedFolderId() == '0') {
                     // is root
                     $folderName = $arrayState[$this->id]['rename_folder']['root'];
                     $query_root_name = "\r\n\t\t\t\t\t\t\tUPDATE " . $GLOBALS['prefix_fw'] . "_setting \r\n\t\t\t\t\t\t\tSET param_value = '" . $folderName . "'\r\n\t\t\t\t\t\t\tWHERE param_name = 'title_organigram_chart'";
                     sql_query($query_root_name);
                 } else {
                     foreach ($array_lang as $langItem) {
                         $folderName[$langItem] = $arrayState[$this->id]['rename_folder'][$langItem];
                     }
                     $this->tdb->updateFolderByIdTranslation($this->selectedFolder, $folderName);
                 }
                 //-extra field store --------------------------------------
                 $folder_idst = $this->tdb->getGroupST($folder_id);
                 $fl = new FieldList();
                 $fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
                 $fl->setFieldEntryTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDENTRYTABLE);
                 $arr_groups_filterd = $acl->getSTGroupsST($folder_idst, FILTER_FOLD);
                 $fl->storeFieldsForUser($folder_id, $ancestor, FALSE);
                 //----------------------------------------------------------
                 $this->refresh = TRUE;
                 if ($this->getSelectedFolderId() == '0') {
                     Util::jump_to('index.php?modname=directory&op=org_chart');
                 }
                 /*} else {
                 			
                 			$this->op = 'renamefolder';
                 			$GLOBALS['page']->add( getErrorUi(implode('<br/>', $filled)), 'content' );
                 		}*/
             }
         } elseif ($key == 'next_formfield1') {
             $this->op = 'folder_field2';
         } elseif ($key == 'save_formfield') {
             require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
             if (isset($arrayState[$this->id]['field_set'])) {
                 $arr_fields = $arrayState[$this->id]['field_set'];
             } else {
                 $arr_fields = array();
             }
             if (isset($arrayState[$this->id]['field_mandatory'])) {
                 $arr_fields_mandatory = $arrayState[$this->id]['field_mandatory'];
             } else {
                 $arr_fields_mandatory = array();
             }
             $fl = new FieldList();
             $fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
             $arr_all_fields = $fl->getAllFields();
             $id_folder = $this->getSelectedFolderId();
             // remove all fields
             foreach ($arr_all_fields as $id_field => $field) {
                 $fl->removeFieldFromGroup($id_field, $id_folder);
             }
             // add selected fields
             foreach ($arr_fields as $id_field => $dummy_val) {
                 $fl->addFieldToGroup($id_field, $id_folder, isset($arr_fields_mandatory[$id_field]) ? $arr_fields_mandatory[$id_field] : 'false');
             }
         } elseif ($key == 'next1_assignfield') {
             $this->op = 'assign2_field';
         } elseif ($key == 'next2_assignfield') {
             $this->op = 'assign3_field';
         } elseif ($key == 'save_assignfield') {
             $arr_fields = $arrayState[$this->id]['field_set'];
             $arr_fields_mandatory = isset($arrayState[$this->id]['field_mandatory']) ? $arrayState[$this->id]['field_mandatory'] : array();
             $arr_fields_useraccess = isset($arrayState[$this->id]['field_useraccess']) ? $arrayState[$this->id]['field_useraccess'] : array();
             require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
             $fl = new FieldList();
             foreach ($arr_fields as $id_filed => $status) {
                 switch ($status) {
                     case ORG_CHART_FIELD_NO:
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()));
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()));
                         break;
                     case ORG_CHART_FIELD_NORMAL:
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()));
                         $fl->addFieldToGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()), isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
                         break;
                     case ORG_CHART_FIELD_DESCEND:
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()));
                         $fl->addFieldToGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()), isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
                         break;
                 }
             }
         } elseif ($key == $this->_getOpFolderField()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'folder_field';
         } elseif ($key == $this->_getOpImportUsers()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'import_users';
         } elseif ($key == 'next1_importusers') {
             $this->op = 'import_users2';
         } elseif ($key == 'next2_importusers') {
             $this->op = 'import_users3';
         } elseif ($key == $this->_getOpAssignField()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'assign_field';
         } elseif ($key == $this->_getOpAssignUser()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'addtotree';
         } elseif ($key == $this->_getOpCreateUser()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'create_user';
         } elseif ($key == $this->_getOpWaitingUser()) {
             $this->op = 'waiting_user';
         }
     }
     return;
     $arrayExpand = $arrayExpand;
     $arrayCompress = $arrayCompress;
 }