/**
  * get the standard form for user field modification
  */
 function getPlayField($id_user, $god_mode = false)
 {
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     $field_man = new FieldList();
     if ($god_mode) {
         return $field_man->playFieldsForUser($id_user, false, false, true);
     }
     return $field_man->playFieldsForUser($id_user, false, false, true, array('readonly'));
 }
Example #2
0
function waitinguser()
{
    checkPerm('moderate', false, 'course');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    $id_course = importVar('id_course', true, 0);
    $man_course = new Man_Course();
    $course_info = $man_course->getCourseInfo($id_course);
    $edition_id = getCourseEditionId();
    $ed_url_param = getEditionUrlParameter($edition_id);
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $levels = CourseLevel::getLevels();
    $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
    $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
    $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'));
    $page_title = array('index.php?modname=course&op=course_list' => $lang->def('_COURSE', 'course', 'lms'), $course_info['name'], $lang->def('_USERWAITING', 'course', 'lms'));
    $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?modname=subscribe&amp;op=approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
    $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
    $type_h = array('', '', '', '', '', 'image', 'image', 'image');
    $content_h = array($lang->def('_USERNAME'), $lang->def('_FULLNAME'), $lang->def('_LEVEL'), $lang->def('_SUBSCRIBED_BY'), $lang->def('_STATUS'), $lang->def('_APPROVE'), $lang->def('_DENY'), $lang->def('_WAIT'));
    $tb->addHead($content_h, $type_h);
    if (is_array($waiting_users['users_info'])) {
        reset($waiting_users['users_info']);
        while (list($id_user, $info) = each($waiting_users['users_info'])) {
            $id_sub_by = $info['subscribed_by'];
            $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
            $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?modname=subscribe&amp;op=waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=subscribe&amp;op=waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
            $content = array($more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]), $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME], $levels[$info['level']], $subscribed . ' [' . $users_name[$id_user][ACL_INFO_EMAIL] . ']');
            $content[] = $arr_status[$info['status']];
            $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
            $tb->addBody($content);
            if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                $field = new FieldList();
                $info = $field->playFieldsForUser($id_user, false, true);
                $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
            }
        }
    }
    $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Example #3
0
 function org_waitingUser()
 {
     checkPerm('approve_waiting_user', false, 'directory', 'framework');
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.usermanager.php';
     if (isset($_POST['ok_waiting'])) {
         $user_man = new UserManager();
         // Remove refused users
         $refused = array();
         $aopproved = array();
         if (isset($_POST['waiting_user_refuse'])) {
             while (list($idst) = each($_POST['waiting_user_refuse'])) {
                 $this->aclManager->deleteTempUser($idst, false, false, true);
             }
             $refused[] = $idst;
         }
         // Subscribed accepted users
         if (isset($_POST['waiting_user_accept'])) {
             $idst_usergroup = $this->aclManager->getGroup(false, ADMIN_GROUP_USER);
             $idst_usergroup = $idst_usergroup[ACL_INFO_IDST];
             $idst_oc = $this->aclManager->getGroup(false, '/oc_0');
             $idst_oc = $idst_oc[ACL_INFO_IDST];
             $idst_ocd = $this->aclManager->getGroup(false, '/ocd_0');
             $idst_ocd = $idst_ocd[ACL_INFO_IDST];
             $request = $this->aclManager->getTempUsers(false, true);
             while (list($idst) = each($_POST['waiting_user_accept'])) {
                 if ($this->aclManager->registerUser(addslashes($request[$idst]['userid']), addslashes($request[$idst]['firstname']), addslashes($request[$idst]['lastname']), $request[$idst]['pass'], addslashes($request[$idst]['email']), '', '', true, $idst)) {
                     $approved[] = $idst;
                     $this->aclManager->addToGroup($idst_usergroup, $idst);
                     $this->aclManager->addToGroup($idst_oc, $idst);
                     $this->aclManager->addToGroup($idst_ocd, $idst);
                     if ($request[$idst]['create_by_admin'] != 0) {
                         $pref = new UserPreferences($request[$idst]['create_by_admin']);
                         if ($pref->getAdminPreference('admin_rules.limit_user_insert') == 'on') {
                             $max_insert = $pref->getAdminPreference('admin_rules.max_user_insert');
                             $pref->setPreference('admin_rules.max_user_insert', $max_insert - 1);
                         }
                     }
                     $this->aclManager->deleteTempUser($idst, false, false, false);
                 }
             }
         }
         require_once _base_ . '/lib/lib.platform.php';
         require_once _base_ . '/lib/lib.eventmanager.php';
         // send the alert
         /*
         			if(!empty($refused)) {
         
         				$array_subst = array('[url]' => Get::sett('url'));
         
         				$msg_composer = new EventMessageComposer('admin_directory', 'framework');
         
         				$msg_composer->setSubjectLangText('email', '_REFUSED_USER_SBJ', false);
         				$msg_composer->setBodyLangText('email', '_REFUSED_USER_TEXT', $array_subst);
         
         				$msg_composer->setBodyLangText('sms', '_REFUSED_USER_TEXT_SMS', $array_subst);
         
         				createNewAlert(	'UserApproved', 'directory', 'edit', '1', 'Users refused',
         							$refused, $msg_composer );
         			}*/
         if (!empty($approved)) {
             $pl_man =& PlatformManager::createInstance();
             $array_subst = array('[url]' => Get::sett('url', ''));
             $msg_composer2 = new EventMessageComposer('admin_directory', 'framework');
             $msg_composer2->setSubjectLangText('email', '_APPROVED_USER_SBJ', false);
             $msg_composer2->setBodyLangText('email', '_APPROVED_USER_TEXT', $array_subst);
             $msg_composer2->setBodyLangText('sms', '_APPROVED_USER_TEXT_SMS', $array_subst);
             createNewAlert('UserApproved', 'directory', 'edit', '1', 'Users approved', $approved, $msg_composer2, true);
         }
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } elseif (isset($_POST['cancel_waiting'])) {
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } else {
         $tb = new Table(0, $this->lang->def('_WAITING_USERS'), $this->lang->def('_WAITING_USER_SUMMARY'));
         $type_h = array('', '', '', 'image', 'image');
         $cont_h = array($this->lang->def('_USERNAME'), $this->lang->def('_DIRECTORY_FULLNAME'), $this->lang->def('_BY'), '<img src="' . getPathImage('framework') . 'directory/wuser_accept.gif" alt="' . $this->lang->def('_ACCEPT') . '" ' . 'title="' . $this->lang->def('_ACCEPT_USER') . '" />', '<img src="' . getPathImage('framework') . 'directory/wuser_refuse.gif" alt="' . $this->lang->def('_REFUSE_USER') . '" ' . 'title="' . $this->lang->def('_REFUSE_USER_TITLE') . '" />');
         $tb->setColsStyle($type_h);
         $tb->addHead($cont_h);
         $temp_users = $this->aclManager->getTempUsers(false, true);
         if ($temp_users !== false) {
             $idst_admins = array();
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $idst_admins[] = $info['create_by_admin'];
                 }
             }
             $admins = $this->aclManager->getUsers($idst_admins);
             reset($temp_users);
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $creator = $admins[$info['create_by_admin']][ACL_INFO_LASTNAME] . ' ' . $admins[$info['create_by_admin']][ACL_INFO_FIRSTNAME];
                     if ($creator == '') {
                         $creator = $this->aclManager->relativeId($admins[$info['create_by_admin']][ACL_INFO_USERID]);
                     }
                 } else {
                     $creator = $this->lang->def('_DIRECOTRY_SELFREGISTERED');
                 }
                 $more = isset($_GET['id_user']) && $_GET['id_user'] == $idst ? '<a href="index.php?modname=directory&amp;op=org_waitinguser"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=directory&amp;op=org_waitinguser&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
                 $cont = array($more . $this->aclManager->relativeId($info['userid']), $info['lastname'] . ' ' . $info['firstname'], $creator, Form::getInputCheckbox('waiting_user_accept_' . $idst, 'waiting_user_accept[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_accept_' . $idst, $this->lang->def('_ACCEPT'), 'access-only'), Form::getInputCheckbox('waiting_user_refuse_' . $idst, 'waiting_user_refuse[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_refuse_' . $idst, $this->lang->def('_REFUSE_USER'), 'access-only'));
                 $tb->addBody($cont);
                 if (isset($_GET['id_user']) && $idst == $_GET['id_user']) {
                     $field = new FieldList();
                     $tb->addBodyExpanded($field->playFieldsForUser($idst, false, true), 'user_specific_info');
                 }
             }
         }
         $GLOBALS['page']->add(getTitleArea($this->lang->def('_WAITING_USERS'), 'directory') . '<div class="std_block">' . Form::openForm('waiting_user', 'index.php?modname=directory&amp;op=org_waitinguser') . $tb->getTable() . Form::openButtonSpace() . Form::getButton('ok_waiting', 'ok_waiting', $this->lang->def('_SAVE')) . Form::getButton('cancel_waiting', 'cancel_waiting', $this->lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
     }
 }
Example #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');
 }
Example #5
0
 function _first_of_all($options, $platform)
 {
     $social = new Social();
     $lang =& DoceboLanguage::createInstance('register', $platform);
     $out = '';
     if ($options['use_advanced_form'] == 'off') {
         $out .= Form::getHidden('next_step', 'next_step', 'opt_in');
     } else {
         $out .= Form::getHidden('next_step', 'next_step', 'special_field');
     }
     $mand_sym = '<span class="mandatory">*</span>';
     $out .= '<div class="reg_note">' . $lang->def('_REG_NOTE') . '</div>' . '<ul class="reg_instruction">' . '<li>' . str_replace('[mandatory]', $mand_sym, $lang->def('_REG_MANDATORY')) . '</li>';
     if ($options['pass_min_char']) {
         $out .= '<li>' . str_replace('[min_char]', $options['pass_min_char'], $lang->def('_REG_PASS_MIN_CHAR')) . '</li>';
     }
     if ($options['pass_alfanumeric'] == 'on') {
         $out .= '<li>' . $lang->def('_REG_PASS_MUST_BE_ALPNUM') . '</li>';
     }
     //$out .= '<li>'.str_replace('[hour]', $options['hour_request_limit'], $lang->def('_REG_HOUR_REQUEST_LIMIT')).'</li>';
     if ($options['privacy_policy'] == 'on') {
         $out .= '<li>' . $lang->def('_REG_REMEMBER_PRIVACY') . '</li>';
     }
     $extra = '';
     // facebook register:
     if ($social->isActive('facebook')) {
         require_once _lms_ . "/modules/login/facebook.php";
         if (isset($_SESSION['fb_info']) && is_array($_SESSION['fb_info']) && !isset($_POST['register'])) {
             setFbRegData($_SESSION['fb_info']);
             $out .= '<li>' . $lang->def('_ACCOUNT_WILL_BE_CONNECTED_FB', 'login', 'cms') . '</li>';
         } else {
             $extra = getFbRegisterBox();
         }
     }
     // ----
     $out .= '</ul>' . $extra . Form::openElementSpace('reg_form');
     $out .= Form::getTextfield($lang->def('_USERNAME') . ' ' . $mand_sym, 'register_userid', 'register[userid]', 255, isset($_POST['register']['userid']) ? stripslashes($_POST['register']['userid']) : '') . Form::getTextfield($lang->def('_EMAIL') . ' ' . $mand_sym, 'register_email', 'register[email]', 255, isset($_POST['register']['email']) ? stripslashes($_POST['register']['email']) : '') . Form::getTextfield($lang->def('_FIRSTNAME') . ($options['lastfirst_mandatory'] == 'on' ? ' ' . $mand_sym : ''), 'register_firstname', 'register[firstname]', 255, isset($_POST['register']['firstname']) ? stripslashes($_POST['register']['firstname']) : '') . Form::getTextfield($lang->def('_LASTNAME') . ($options['lastfirst_mandatory'] == 'on' ? ' ' . $mand_sym : ''), 'register_lastname', 'register[lastname]', 255, isset($_POST['register']['lastname']) ? stripslashes($_POST['register']['lastname']) : '');
     if ($options['use_advanced_form'] == 'off') {
         $extra_field = new FieldList();
         $out .= $extra_field->playFieldsForUser(0, false, false);
     }
     $lang_sel = getLanguage();
     $full_langs = array();
     $langs = Docebo::langManager()->getAllLangCode();
     $full_langs = array();
     foreach ($langs as $v) {
         $full_langs[$v] = $v;
     }
     $out .= Form::getHidden('sop', 'sop', 'changelang');
     $out .= Form::getDropdown($lang->def('_LANGUAGE'), 'new_lang', 'new_lang', $full_langs, $lang_sel, '', '', ' onchange="submit();"');
     $out .= Form::getPassword($lang->def('_PASSWORD') . ' ' . $mand_sym, 'register_pwd', 'register[pwd]', 255, $lang->def('_PASSWORD')) . Form::getPassword($lang->def('_RETYPE_PASSWORD') . ' ' . $mand_sym, 'register_pwd_retype', 'register[pwd_retype]', 255, $lang->def('_RETYPE_PASSWORD'));
     $registration_code_type = Get::sett('registration_code_type', '0');
     $code_is_mandatory = Get::sett('mandatory_code', 'off');
     switch ($registration_code_type) {
         case "0":
             //nothin to do
             break;
         case "tree_course":
         case "code_module":
         case "tree_man":
             // we must ask the user to insert a manual code
             $out .= Form::getTextfield($lang->def('_CODE') . ($code_is_mandatory ? ' ' . $mand_sym : ''), 'reg_code', 'reg_code', 24, Get::req('reg_code', DOTY_MIXED, ''));
             break;
         case "tree_drop":
             // we must show to the user a selection of code
             $uma = new UsermanagementAdm();
             $tree_names = $uma->getAllFolderNames(true);
             $out .= Form::getDropdown($lang->def('_CODE') . ($code_is_mandatory ? ' ' . $mand_sym : ''), 'reg_code', 'reg_code', $tree_names, Get::req('reg_code', DOTY_MIXED, ''));
             break;
     }
     $out .= '<div class="reg_title_privacy">' . $lang->def('_REG_PRIVACY_POLICY_TILTE') . '</div>' . '<div class="privacy_box">' . $lang->def('_REG_PRIVACY_POLICY') . '</div>';
     if ($options['privacy_policy'] == 'on') {
         $out .= Form::getCheckbox($lang->def('_REG_PRIVACY_ACCEPT'), 'register_privacy', 'register[privacy]', 'ok', isset($_POST['register']['privacy']));
     }
     if ($options['use_advanced_form'] == 'on') {
         $acl_man =& Docebo::user()->getAclManager();
         $groups =& $acl_man->getAllGroupsId(array('free', 'moderate'));
         if (!empty($groups)) {
             $tb = new Table(0, $lang->def('_SELECT_GROUP'), $lang->def('_SELECT_GROUP_SUMMARY'));
             $type_h = array('image', 'nowrap', '');
             $cont_h = array('<span class="access-only">' . $lang->def('_SUBSCRIBE') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
             $tb->setColsStyle($type_h);
             $tb->addHead($cont_h);
             while (list($id, $info) = each($groups)) {
                 $cont = array(Form::getInputCheckbox('group_sel_' . $id, 'group_sel[]', $id, isset($_POST['group_sel'][$id]), ''), '<label for="group_sel_' . $id . '">' . $info['type_ico'] . ' ' . $info['groupid'] . '</label>', $info['description']);
                 $tb->addBody($cont);
             }
             $out .= $tb->getTable();
         }
     }
     $out .= Form::closeElementSpace() . Form::openButtonSpace('reg_form_button') . Form::getButton('reg_button', 'reg_button', $lang->def('_REGISTER')) . Form::closeButtonSpace();
     return $out;
 }
 function waitinguser()
 {
     if (!$this->permissions['moderate']) {
         die("You can't access");
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _adm_ . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.user_profile.php';
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $man_course = new Man_Course();
     $course_info = $man_course->getCourseInfo($id_course);
     $is_classroom = $course_info['course_type'] == 'classroom';
     $edition_id = Get::req('id_edition', DOTY_INT, 0);
     $ed_url_param = '&id_edition=' . $edition_id;
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
     $acl_man =& Docebo::user()->getAclManager();
     $levels = CourseLevel::getLevels();
     $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
     $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
     $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'));
     $page_title = array('index.php?r=' . $this->link_course . '/show' => Lang::t('_COURSES', 'course'), Lang::t('_USERWAITING', 'course') . ': ' . $course_info['name']);
     $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?r=' . $this->link . '/approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
     $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
     $type_h = array();
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = '';
     if ($is_classroom) {
         $type_h[] = '';
     }
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $content_h = array();
     $content_h[] = $lang->def('_USERNAME');
     $content_h[] = $lang->def('_FULLNAME');
     $content_h[] = $lang->def('_LEVEL');
     if ($is_classroom) {
         $content_h[] = $lang->def('_CLASSROOM');
     }
     $content_h[] = $lang->def('_SUBSCRIBED_BY');
     $content_h[] = $lang->def('_STATUS');
     $content_h[] = $lang->def('_APPROVE');
     $content_h[] = $lang->def('_DENY');
     $content_h[] = $lang->def('_WAIT');
     $tb->addHead($content_h, $type_h);
     if (is_array($waiting_users['users_info'])) {
         reset($waiting_users['users_info']);
         while (list($id_user, $info) = each($waiting_users['users_info'])) {
             $id_sub_by = $info['subscribed_by'];
             $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
             $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/menu_open.png"></a> ' : '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/menu_closed.png"></a> ';
             $is_overbooking = FALSE;
             if ($is_classroom) {
                 $is_overbooking = $info['overbooking'];
             } else {
                 $is_overbooking = FALSE;
                 //$info['status'] == _CUS_OVERBOOKING
             }
             $content = array();
             $content[] = $more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]);
             $content[] = $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME];
             $content[] = $levels[$info['level']];
             if ($is_classroom) {
                 $content[] = ($info['code'] != '' ? '[' . $info['code'] . '] ' : '') . $info['name'];
             }
             $content[] = $subscribed . ' [' . $users_name[$id_sub_by][ACL_INFO_EMAIL] . ']';
             $content[] = $is_overbooking ? $lang->def('_OVERBOOKING') : $arr_status[$info['status']];
             if ($is_overbooking) {
                 $content[] = '';
                 $content[] = '';
                 $content[] = '';
             } else {
                 $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
             }
             $tb->addBody($content);
             if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                 $field = new FieldList();
                 $info = $field->playFieldsForUser($id_user, false, true);
                 $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
             }
         }
     }
     $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
     $GLOBALS['page']->add('</div>', 'content');
 }
 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));
 }
Example #8
0
 function loadRenameFolder()
 {
     $tdb =& $this->tdb;
     $folder = $tdb->getFolderById($this->getSelectedFolderId());
     $folder_idst = $tdb->getGroupST($this->getSelectedFolderId());
     $acl =& Docebo::user()->getACL();
     $aclManager =& $acl->getACLManager();
     //$idst_field_group = $aclManager->getGroupST(ORG_CHART_FOLDER_FIELD_GROUP);
     require_once _base_ . '/lib/lib.form.php';
     $form = new Form();
     $tree .= $form->openElementSpace();
     $tree .= $this->printState();
     $array_lang = Docebo::langManager()->getAllLangCode();
     $mand_lang = getLanguage();
     $array_translations = $tdb->getFolderTranslations($this->getSelectedFolderId());
     if ($this->getSelectedFolderId() == '0') {
         // is root
         $tree .= $form->getTextfield($this->lang->def('_ROOT_RENAME'), 'rename_folder_root', $this->id . '[rename_folder][root]', 255, Get::sett('title_organigram_chart'), Get::sett('title_organigram_chart') . ' ' . $this->lang->def('MOD'));
     } else {
         foreach ($array_lang as $k => $lang_code) {
             $tree .= $form->getTextfield(($mand_lang == $lang_code ? '<span class="mandatory">*</span>' : '') . $lang_code, 'rename_folder_' . $lang_code, $this->id . '[rename_folder][' . $lang_code . ']', 255, $array_translations[$lang_code], $lang_code . ' ' . $this->lang->def('_MOD'));
         }
     }
     $tree .= $form->closeElementSpace();
     // -- begin -- custom fields for folder
     $tree .= $form->getOpenFieldset($this->lang->def('_ASSIGNED_EXTRAFIELD'));
     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);
     $tree .= $fields->playFieldsForUser($folder_id, $ancestor, FALSE, FALSE);
     $tree .= $form->getCloseFieldset();
     // -- end -- custom fields for folder
     $tree .= $form->openButtonSpace() . $form->getButton('save_renamefolder' . $this->id, $this->id . '[save_renamefolder]', $this->lang->def('_SAVE')) . $form->getButton($this->_getCancelId(), $this->_getCancelId(), $this->lang->def('_UNDO')) . $form->closeButtonSpace();
     return $tree;
 }