Example #1
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 #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&amp;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 forumsearchmessage()
{
    checkPerm('view');
    $search_arg = $_SESSION['forum']['search_arg'];
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $ini_thread = importVar('ini_thread');
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $acl_man =& Docebo::user()->getAclManager();
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink('index.php?modname=forum&amp;op=searchmessage&amp;idThread=' . $id_thread . '&amp;ini_thread=' . $ini_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t) = sql_fetch_row(sql_query($thread_query));
    $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
    list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
    ++$tot_message;
    //set as readed if needed
    if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
        unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
    }
    if ($ini == 0 && !isset($_GET['result'])) {
        sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
    }
    $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=search&amp;ini=' . $ini_thread => $thread_title, $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg);
    if ($erased_t && !$mod_perm && !$moderate) {
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
        return;
    }
    // Who have semantic evaluation
    $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
    while (list($msg_sema) = sql_fetch_row($re_sema)) {
        $forum_sema[$msg_sema] = 1;
    }
    // Find post
    $messages = array();
    $authors = array();
    $authors_names = array();
    $authors_info = array();
    $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
    while ($record = mysql_fetch_assoc($re_message)) {
        $messages[$record['idMessage']] = $record;
        $authors[$record['author']] = $record['author'];
        if ($record['modified_by'] != 0) {
            $authors[$record['modified_by']] = $record['modified_by'];
        }
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    // Retriving level and number of post of th authors
    $re_num_post = sql_query("\r\n\tSELECT u.idUser, u.level, COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\tGROUP BY u.idUser, u.level");
    while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
        $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
    }
    $type_h = array('forum_sender', 'forum_text');
    $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    // Compose messagges display
    $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
    while (list($id_message, $message_info) = each($messages)) {
        // sender info
        $m_author = $message_info['author'];
        if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') {
            $img_size = @getimagesize($path . $authors_names[$m_author][ACL_INFO_AVATAR]);
        }
        $sender = '<div class="forum_author">' . (isset($authors_names[$m_author]) ? $authors_names[$m_author][ACL_INFO_LASTNAME] . $authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) : $authors_names[$m_author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$m_author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . '</div>' . '<div class="forum_level">' . $lang->def('_LEVEL') . ' : ' . $authors_info[$m_author]['level'] . '</div>' . (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_names[$m_author][ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" />' : '') . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<img src="' . getPathImage() . 'standard/identity.png" alt="&gt;" />&nbsp;' . '<a href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;idThread=' . $id_thread . '">' . $lang->def('_VIEW_PROFILE') . '</a>';
        // msg info
        $msgtext = '';
        $msgtext .= '<div class="forum_post_posted">' . $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>';
        if ($message_info['locked']) {
            $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>';
        } else {
            if ($message_info['attach'] != '') {
                $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&amp;op=download&amp;id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>';
            }
            $textof = str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof']));
            $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $message_info['title']) : $message_info['title']) . '</div>';
            $msgtext .= '<div class="forum_post_text">' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $textof) : $textof) . '</div>';
            if ($message_info['modified_by'] != 0) {
                $modify_by = $message_info['modified_by'];
                $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$modify_by]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>';
            }
            if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') {
                $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>';
            }
        }
        $content = array($sender, $msgtext);
        $tb->addBody($content);
        // some action that you can do with this message
        $action = '';
        if ($moderate || $mod_perm) {
            if ($message_info['locked']) {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> ';
            } else {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> ';
            }
        }
        if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
            $action .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>';
        }
        if ($moderate || $mod_perm || $m_author == getLogUserId()) {
            $action .= '<a href="index.php?modname=forum&amp;op=modmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&amp;op=delmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> ';
        }
        $tb->addBodyExpanded($action, 'forum_action');
    }
    if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
        $tb->addActionAdd('<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_REPLY') . '</a>');
    }
    $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=search&amp;idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $search_arg, $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_top">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_bottom">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
 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');
 }