Пример #1
0
function adminManager_edit_preferences()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.preference.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $aclManager =& Docebo::user()->getAclManager();
    $adminidst = importVar('adminidst', true, 0);
    $user_pref = new UserPreferences($adminidst);
    if (isset($_POST['save_pref'])) {
        $user_pref->savePreferences($_POST);
        Util::jump_to('index.php?modname=admin_manager&op=view');
    }
    $admin_info = $aclManager->getUser($adminidst, false);
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">' . Form::getFormHeader($lang->def('_ADMIN_SPECIAL_SETTING') . ' ' . substr($admin_info[ACL_INFO_USERID], 1)) . Form::openForm('admin_preferences', 'index.php?modname=admin_manager&amp;op=edit_preferences') . Form::openElementSpace() . Form::getHidden('adminidst', 'adminidst', $adminidst) . $user_pref->getModifyMask('admin_rules') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_pref', 'save_pref', $lang->def('_SAVE')) . Form::getButton('undo_pref', 'undo_pref', $lang->def('_UNDO')) . Form::closeElementSpace() . '</div>', 'content');
}
Пример #2
0
 function editPerson($userid = FALSE, $arr_idst_groups = FALSE, $form_url = FALSE)
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once _adm_ . '/lib/lib.adminmanager.php';
     if ($userid === FALSE) {
         $userid = importVar('userid', FALSE, '');
         $userLabel = importVar('userid', FALSE, $this->lang->def('_NEW_USER'));
     } else {
         $userLabel = $userid;
     }
     $firstname = importVar('firstname', FALSE, '');
     $lastname = importVar('lastname', FALSE, '');
     $email = importVar('email', FALSE, '');
     $pass = importVar('pass', FALSE, '');
     $idst = '';
     // get all levels
     $arr_levels_id = $this->aclManager->getAdminLevels();
     $arr_levels_idst = array_values($arr_levels_id);
     $arr_levels_id = array_flip($arr_levels_id);
     $arr_levels_translation = array();
     foreach ($arr_levels_id as $lev_idst => $lev_id) {
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             if ($lev_id == ADMIN_GROUP_USER) {
                 $arr_levels_translation[$lev_idst] = $this->lang->def('_DIRECTORY_' . $lev_id);
             }
         } else {
             $arr_levels_translation[$lev_idst] = $this->lang->def('_DIRECTORY_' . $lev_id);
         }
     }
     // set default level
     $userlevel = array_search(ADMIN_GROUP_USER, $arr_levels_id);
     if ($userid != '') {
         $arrUser = $this->aclManager->getUser(FALSE, $userid);
         if ($arrUser !== FALSE) {
             $idst = $arrUser[0];
             $firstname = $arrUser[2];
             $lastname = $arrUser[3];
             $email = $arrUser[5];
             // compute user level
             $arr_groups = $this->aclManager->getGroupsContainer($idst);
             $arr_user_level = array_intersect($arr_levels_idst, $arr_groups);
             $arr_user_level = array_values($arr_user_level);
             if (count($arr_user_level) > 0) {
                 $userlevel = $arr_user_level[0];
             } else {
                 $userlevel = $arr_levels_idst[0];
             }
         } else {
             // the user don't exist
             $firstname = $_POST['firstname'];
             $lastname = $_POST['lastname'];
             $email = $_POST['email'];
             // get arr_folders to know collect custom fields
             if ($arr_idst_groups === FALSE && isset($_POST['arr_idst_groups'])) {
                 $arr_idst_groups = unserialize(urldecode($_POST['arr_idst_groups']));
             }
         }
     } else {
         if ($arr_idst_groups === FALSE && isset($_POST['arr_idst_groups'])) {
             $arr_idst_groups = unserialize(urldecode($_POST['arr_idst_groups']));
         }
         if (!$arr_idst_groups) {
             $arr_idst_groups = array();
             $oc = $this->aclManager->getGroup(false, '/oc_0');
             $ocd = $this->aclManager->getGroup(false, '/ocd_0');
             $arr_idst_groups['/oc_0'] = $oc[ACL_INFO_IDST];
             $arr_idst_groups['/ocd_0'] = $ocd[ACL_INFO_IDST];
         }
     }
     /*
     		$GLOBALS['page']->add( getTitleArea($this->lang->def( '_USERS' )
     								.': '.$userLabel, 'directory_people' ), 'content' );
     */
     //$GLOBALS['page']->add( '<div class="std_block">', 'content');
     if ($form_url === FALSE) {
         $form_url = 'index.php?modname=directory&amp;op=org_chart';
     }
     $GLOBALS['page']->add(Form::getFormHeader($this->lang->def('_MOD')), 'content');
     $GLOBALS['page']->add(Form::openForm('directoryeditperson', $form_url, FALSE, 'post', 'multipart/form-data'), 'content');
     $GLOBALS['page']->add(Form::openElementSpace(), 'content');
     $GLOBALS['page']->add(Form::getOpenFieldset($this->lang->def('_MOD') . ' - ' . $userLabel), 'content');
     $GLOBALS['page']->add(Form::getTextfield($this->lang->def('_USERNAME'), "userid", "userid", 50, $userid), 'content');
     $GLOBALS['page']->add(Form::getTextfield($this->lang->def('_FIRSTNAME'), "firstname", "firstname", 50, $firstname), 'content');
     $GLOBALS['page']->add(Form::getTextfield($this->lang->def('_LASTNAME'), "lastname", "lastname", 50, $lastname), 'content');
     $GLOBALS['page']->add(Form::getTextfield($this->lang->def('_EMAIL'), "email", "email", 50, $email), 'content');
     $GLOBALS['page']->add(Form::getPassword($this->lang->def('_PASSWORD'), "pass", "pass", 50), 'content');
     $GLOBALS['page']->add(Form::getDropdown($this->lang->def('_LEVEL'), "userlevel", "userlevel", $arr_levels_translation, $userlevel), 'content');
     $GLOBALS['page']->add(Form::getHidden('olduserlevel', 'olduserlevel', $userlevel), 'content');
     $GLOBALS['page']->add(Form::getHidden('idst', 'idst', $idst), 'content');
     $GLOBALS['page']->add(Form::getHidden('arr_idst_groups', 'arr_idst_groups', urlencode(serialize($arr_idst_groups))), 'content');
     $preference = new UserPreferences(0);
     $GLOBALS['page']->add($preference->getModifyMask('ui.'));
     $GLOBALS['page']->add(Form::getCloseFieldset(), 'content');
     /*
     $GLOBALS['page']->add( Form::closeElementSpace(), 'content' );
     $GLOBALS['page']->add( Form::openButtonSpace(), 'content' );
     $GLOBALS['page']->add( Form::getButton("editpersonsave","editpersonsave",$this->lang->def( '_SAVE' )), 'content' );
     $GLOBALS['page']->add( Form::getButton("editpersoncancel","editpersoncancel",$this->lang->def( '_CANCEL' )), 'content' );
     $GLOBALS['page']->add( Form::closeButtonSpace(), 'content' );
     $GLOBALS['page']->add( Form::openElementSpace(), 'content' );
     */
     //-extra field-----------------------------------------------
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     $fields = new FieldList();
     if ($arr_idst_groups != FALSE) {
         $acl =& Docebo::user()->getACL();
         $arr_idst_all = $acl->getArrSTGroupsST(array_values($arr_idst_groups));
     } else {
         $arr_idst_all = FALSE;
     }
     if ($fields->playFieldsForUser($userid !== false ? $idst : -1, $arr_idst_all)) {
         $GLOBALS['page']->add(Form::getOpenFieldset($this->lang->def('_ASSIGNED_EXTRAFIELD')), 'content');
         $GLOBALS['page']->add($fields->playFieldsForUser($userid !== false ? $idst : -1, $arr_idst_all), 'content');
         $GLOBALS['page']->add(Form::getCloseFieldset(), 'content');
     }
     //-----------------------------------------------------------
     $GLOBALS['page']->add(Form::closeElementSpace(), 'content');
     $GLOBALS['page']->add(Form::openButtonSpace(), 'content');
     $GLOBALS['page']->add(Form::getButton("editpersonsave_2", "editpersonsave", $this->lang->def('_SAVE')), 'content');
     $GLOBALS['page']->add(Form::getButton("editpersoncancel_2", "editpersoncancel", $this->lang->def('_CANCEL')), 'content');
     $GLOBALS['page']->add(Form::closeButtonSpace(), 'content');
     $GLOBALS['page']->add(Form::closeForm(), 'content');
     //$GLOBALS['page']->add( '</div>', 'content');
 }
Пример #3
0
 /**
  * gui for user info management
  */
 function getUserInfoModUi()
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.preference.php';
     $this->loadUserData($this->_user_profile->getIdUser());
     $preference = new UserPreferences($this->_user_profile->getIdUser());
     $html = '<div class="up_user_info">' . '<div class="up_name">' . $this->resolveUsername(false, $this->_user_profile->getIdUser()) . '</div>';
     // user standard info -----------------------------------------------------------------
     $html .= Form::openForm('mod_up', $this->_url_man->getUrl($this->_varname_action . '=saveinfo'), false, false, 'multipart/form-data');
     if ($this->_user_profile->godMode()) {
         $html .= Form::getTextfield($this->_lang->def('_USERNAME'), 'up_userid', 'up_userid', '255', Get::req('up_userid', DOTY_MIXED, $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]), true));
     } else {
         $html .= Form::getLineBox($this->_lang->def('_USERNAME'), $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]));
     }
     $html .= Form::getTextfield($this->_lang->def('_LASTNAME'), 'up_lastname', 'up_lastname', '255', Get::req('up_lastname', DOTY_MIXED, $this->user_info[ACL_INFO_LASTNAME], true)) . Form::getTextfield($this->_lang->def('_FIRSTNAME'), 'up_firstname', 'up_firstname', '255', Get::req('up_firstname', DOTY_MIXED, $this->user_info[ACL_INFO_FIRSTNAME], true)) . Form::getTextfield($this->_lang->def('_EMAIL'), 'up_email', 'up_email', '255', Get::req('up_email', DOTY_MIXED, $this->user_info[ACL_INFO_EMAIL], true));
     // user extra field ------------------------------------------------------------------
     $html .= $this->getPlayField();
     $html .= $preference->getModifyMask('ui.');
     if ($this->_user_profile->godMode()) {
         $acl_man =& Docebo::user()->getAclManager();
         $html .= Form::getPassword(Lang::t('_NEW_PASSWORD', 'register'), 'up_new_pwd', 'up_new_pwd', '255');
         $html .= Form::getPassword(Lang::t('_RETYPE_PASSWORD', 'register'), 'up_repeat_pwd', 'up_repeat_pwd', '255');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN && Get::cur_plat() === 'framework') {
             $html .= Form::getCheckBox(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'force_changepwd', 'force_changepwd', 1, $this->user_info[ACL_INFO_FORCE_CHANGE]);
         }
         $lv_lang =& DoceboLanguage::createInstance('admin_directory', 'framework');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN) {
             $level_list = array(ADMIN_GROUP_GODADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_GODADMIN), ADMIN_GROUP_ADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_ADMIN), ADMIN_GROUP_PUBLICADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_PUBLICADMIN), ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         } else {
             $level_list = array(ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         }
         $html .= Form::getDropdown($this->_lang->def('_LEVEL'), 'up_level', 'up_level', $level_list, $acl_man->getUserLevelId($this->_user_profile->getIdUser()));
     }
     // Social ------------------------------------------------------------------
     /* $html.=Form::getTextfield(	$this->_lang->def('_FACEBOOK_ID'),
     										'facebook_id',
     										'facebook_id',
     										'255',
     										Get::req('facebook_id', DOTY_MIXED, $this->user_info[ACL_INFO_FACEBOOK_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_TWITTER_ID'),
     										'twitter_id',
     										'twitter_id',
     										'255',
     										Get::req('twitter_id', DOTY_MIXED, $this->user_info[ACL_INFO_TWITTER_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_LINKEDIN_ID'),
     										'linkedin_id',
     										'linkedin_id',
     										'255',
     										Get::req('linkedin_id', DOTY_MIXED, $this->user_info[ACL_INFO_LINKEDIN_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_GOOGLE_ID'),
     										'google_id',
     										'google_id',
     										'255',
     										Get::req('google_id', DOTY_MIXED, $this->user_info[ACL_INFO_GOOGLE_ID], true ) ); */
     //signature --------------------------------------------------------------------------
     $html .= Form::getTextarea($this->_lang->def('_SIGNATURE'), 'up_signature', 'up_signature', Get::req('up_signature', DOTY_MIXED, $this->user_info[ACL_INFO_SIGNATURE], true));
     if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
         $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo_profile', 'undo_profile', $this->_lang->def('_UNDO')) . Form::closeButtonSpace();
         $html .= Form::closeForm() . '</div>';
     } else {
         $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo', 'undo', $this->_lang->def('_UNDO')) . Form::closeButtonSpace();
         $html .= Form::closeForm() . '</div>';
     }
     return $html;
 }
 public function multimodTask()
 {
     if (!$this->permissions['mod_user']) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     $title = Lang::t('_MOD', 'admin_directory');
     $users_count = Get::req('users_count', DOTY_INT, 0);
     if ($users_count <= 0) {
         $output = array('success' => true, 'header' => $title, 'body' => Lang::t('_EMPTY_SELECTION', 'admin_directory'));
         echo $this->json->encode($output);
         return;
     }
     $acl_man = Docebo::user()->getAclManager();
     $level = ADMIN_GROUP_USER;
     $arr_levels = $acl_man->getAdminLevels();
     //index = idst; value = groupid;
     $levels = array();
     foreach ($arr_levels as $groupid_level => $idst_level) {
         $levels[$groupid_level] = Lang::t('_DIRECTORY_' . $groupid_level, 'admin_directory');
     }
     $info = array('firstname' => '', 'lastname' => '', 'email' => '', 'level' => '', 'facebook_id' => '', 'twitter_id' => '', 'linkedin_id' => '', 'google_id' => '');
     $language = getDefaultLanguage();
     $languages = Docebo::langManager()->getAllLanguages();
     require_once _base_ . '/lib/lib.platform.php';
     $pman =& PlatformManager::createInstance();
     // = new PlatformManager();
     $platforms = $pman->getPlatformList();
     require_once _adm_ . '/lib/lib.field.php';
     $fman = new FieldList();
     $field_list = $fman->getFlatAllFields(array_keys($platforms));
     $fields_to_exclude = $fman->getFieldsByType('upload');
     $preference = new UserPreferences(0);
     $modify_mask = $preference->getModifyMask('ui.', true, true);
     $fields_mask = $fman->playFieldsForUser(-1, false, false, true, false, true);
     //build edit mask
     $this->render('multimod', array('users_count' => $users_count, 'title' => $title, 'levels' => $levels, 'modify_mask' => $modify_mask, 'fields_mask' => $fields_mask, 'fields_to_exclude' => is_array($fields_to_exclude) ? $fields_to_exclude : array(), 'info' => $info, 'json' => $this->json));
 }