Пример #1
0
function publicAdminManager_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $lang =& DoceboLanguage::createInstance('public_admin_manager', 'framework');
    $aclManager = new DoceboACLManager();
    // get users to show --------------------------------------------------
    $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_PUBLICADMIN);
    $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst);
    $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst));
    $pm =& PlatformManager::createInstance();
    $lms_is_active = $pm->isLoaded("lms");
    /*$cms_is_active = $pm->isLoaded("cms");*/
    // print table --------------------------------------------------------
    $table = new Table(Get::sett('visuItem'), $lang->def('_PUBLIC_ADMIN_USER'), $lang->def('_PUBLIC_ADMIN_USER'));
    $table->initNavBar('ini', 'link');
    $table->setLink('index.php?modname=public_admin_manager&op=view&ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />');
    $typeH = array('', 'image', 'image', 'image');
    if ($lms_is_active) {
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />';
        $typeH[] = 'image';
    }
    $table->setColsStyle($typeH);
    $table->addHead($contentH);
    $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem');
    for ($index = $ini; $index < $maxItem; $index++) {
        $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1);
        $rowContent = array($admin_userid);
        // Edit preferences
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_preferences&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit menu
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_menu&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit user
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=assign_tree&amp;adminidst=' . $arr_admin_idst[$index] . '"
		 					title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit course
        if ($lms_is_active) {
            $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;load=1"
								 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        }
        $table->addBody($rowContent);
    }
    $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Пример #2
0
function adminManager_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $aclManager = new DoceboACLManager();
    // get users to show --------------------------------------------------
    $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_ADMIN);
    $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst);
    $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst));
    $usres_info =& $aclManager->getUsers($arr_admin_idst);
    $pm =& PlatformManager::createInstance();
    $lms_is_active = $pm->isLoaded("lms");
    $cms_is_active = $pm->isLoaded("cms");
    // print table --------------------------------------------------------
    $table = new Table(Get::sett('visuItem'), $lang->def('_ADMIN_USER'), $lang->def('_ADMIN_USER'));
    $table->initNavBar('ini', 'link');
    $table->setLink('index.php?modname=admin_manager&amp;op=view&amp;ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), $lang->def('_EMAIL'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ADMIN_MENU_TITLE') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />', '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />');
    $typeH = array('', '', 'image', 'image', 'image', 'image');
    if ($lms_is_active) {
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />';
        $typeH[] = 'image';
    }
    if ($cms_is_active) {
        // Cms Pages
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/pagetree.png" alt="' . $lang->def('_ASSIGN_CMS_PAGES') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_PAGES') . '" />';
        $typeH[] = 'image';
        // Cms News
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/newstree.png" alt="' . $lang->def('_NEWS') . '" ' . 'title="' . $lang->def('_NEWS') . '" />';
        $typeH[] = 'image';
        // Cms Documents
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/docstree.png" alt="' . $lang->def('_ASSIGN_CMS_DOCS') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_DOCS') . '" />';
        $typeH[] = 'image';
        // Cms Media
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/mediatree.png" alt="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" />';
        $typeH[] = 'image';
        // Cms Contents
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/contenttree.png" alt="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" />';
        $typeH[] = 'image';
    }
    $table->setColsStyle($typeH);
    $table->addHead($contentH);
    $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem');
    for ($index = $ini; $index < $maxItem; $index++) {
        $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1);
        $rowContent = array($admin_userid, $usres_info[$arr_admin_idst[$index]][ACL_INFO_EMAIL]);
        // Edit preferences
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_preferences&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '" /></a>';
        // Edit menu
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_menu&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '" /></a>';
        // Edit user
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=assign_tree&amp;adminidst=' . $arr_admin_idst[$index] . '"
		 					title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        // Edit lang
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_lang&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 	title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        // Edit course
        if ($lms_is_active) {
            $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;load=1"
								 title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        }
        // Assign cms trees permissions
        if ($cms_is_active) {
            // Cms Pages
            $img = "<img src=\"" . getPathImage() . "admin_manager/pagetree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmspag&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms News
            $img = "<img src=\"" . getPathImage() . "admin_manager/newstree.png\" alt=\"" . $lang->def("_NEWS") . "\" ";
            $img .= "title=\"" . $lang->def("_NEWS") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsnews&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Documents
            $img = "<img src=\"" . getPathImage() . "admin_manager/docstree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsdocs&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Media
            $img = "<img src=\"" . getPathImage() . "admin_manager/mediatree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsmedia&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Contents
            $img = "<img src=\"" . getPathImage() . "admin_manager/contenttree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmscontent&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
        }
        $table->addBody($rowContent);
    }
    $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Пример #3
0
function manprjadmin()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.userselector.php';
    require_once _base_ . '/lib/lib.form.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('project', "lms");
    $from = new Form();
    if (!isset($_GET["id"]) || $_GET["id"] < 1) {
        return 0;
    }
    $id = $_GET["id"];
    $myprj = user_projects(Docebo::user()->getIdSt());
    $view_perm = checkPerm('view', true);
    if ($view_perm && in_array($id, $myprj) && is_owner(Docebo::user()->getIdSt(), $id)) {
        $aclManager = new DoceboACLManager();
        $user_select = new UserSelector();
        $user_select->show_user_selector = TRUE;
        $user_select->show_group_selector = FALSE;
        $user_select->show_orgchart_selector = FALSE;
        $user_select->show_fncrole_selector = FALSE;
        $user_select->learning_filter = 'course';
        if (isset($_POST['recipients'])) {
            $recipients = unserialize(urldecode($_POST['recipients']));
        } else {
            $recipients = getAdminList($id);
        }
        $user_select->resetSelection($recipients);
        $back_url = "index.php?modname=project&amp;op=project";
        if (isset($_POST["cancelselector"])) {
            Util::jump_to(str_replace("&amp;", "&", $back_url));
        } else {
            if (isset($_POST["okselector"])) {
                $arr_selection = $user_select->getSelection($_POST);
                //$arr_unselected=$user_select->getUnselected();
                foreach ($arr_unselected as $userid) {
                    $qtxt = "DELETE FROM " . $GLOBALS["prefix_lms"] . "_prj_users ";
                    $qtxt .= "WHERE pid='" . $id . "' AND flag='1' AND userid='" . $userid . "'";
                    $q = sql_query($qtxt);
                }
                foreach ($arr_selection as $userid) {
                    $qtxt = "INSERT INTO " . $GLOBALS["prefix_lms"] . "_prj_users ";
                    $qtxt .= "(pid,userid,flag) VALUES('" . $id . "','{$userid}','1')";
                    $q = sql_query($qtxt);
                }
                Util::jump_to(str_replace("&amp;", "&", $back_url));
            } else {
                //$user_select->setGroupFilter('path', '/lms/course/'.$_SESSION['idCourse'].'/group');
                $group_all = $aclManager->getGroupST('/lms/course/' . (int) $_SESSION['idCourse'] . '/group/alluser');
                $query = "\r\n\t\t\tSELECT pgroup\r\n\t\t\tFROM " . $GLOBALS["prefix_lms"] . "_prj\r\n\t\t\tWHERE cid='" . $_SESSION["idCourse"] . "'\r\n\t\t\t\tAND id = '" . $id . "'";
                list($group) = mysql_fetch_array(sql_query($query));
                if ($group == $group_all) {
                    $arr_idstGroup = $aclManager->getGroupsIdstFromBasePath('/lms/course/' . (int) $_SESSION['idCourse'] . '/subscribed/');
                    $user_select->setUserFilter('group', $arr_idstGroup);
                } else {
                    $user_select->setUserFilter('group', array($group));
                }
                $user_select->setPageTitle(getTitleArea(array($back_url => $lang->def('_PROJECT_MANAGER'), $lang->def('_PADMINS')), 'project', $lang->def('_PROJECT_MANAGER')));
                $user_select->loadSelector('index.php?modname=project&amp;op=manprjadmin&amp;id=' . $id, false, "", true);
            }
        }
    } else {
        die("You can't access");
    }
}