コード例 #1
0
/**
 * Funtions to initialise all course profiles, action, ...
 */
function create_required_profile()
{
    require_once get_conf('includePath') . '/lib/right/profileToolRight.class.php';
    /**
     * Initialise anonymous profile
     */
    $profile = new RightProfile();
    $profile->setName('Anonymous');
    $profile->setLabel(ANONYMOUS_PROFILE);
    $profile->setDescription('Course visitor (the user has no account on the platform)');
    $profile->setType(PROFILE_TYPE_COURSE);
    $profile->setIsRequired(true);
    $profile->save();
    /**
     * Initialise guest profile
     */
    $profile = new RightProfile();
    $profile->setName('Guest');
    $profile->setLabel(GUEST_PROFILE);
    $profile->setDescription('Course visitor (the user has an account on the platform, but is not enrolled in the course)');
    $profile->setType(PROFILE_TYPE_COURSE);
    $profile->setIsRequired(true);
    $profile->save();
    /**
     * Initialise user profile
     */
    $profile = new RightProfile();
    $profile->setName('User');
    $profile->setLabel(USER_PROFILE);
    $profile->setDescription('Course member (the user is actually enrolled in the course)');
    $profile->setType(PROFILE_TYPE_COURSE);
    $profile->setIsRequired(true);
    $profile->save();
    /**
     * Initialise manager profile
     */
    $profile = new RightProfile();
    $profile->setName('Manager');
    $profile->setLabel(MANAGER_PROFILE);
    $profile->setDescription('Course Administrator');
    $profile->setType(PROFILE_TYPE_COURSE);
    $profile->setIsLocked(true);
    $profile->setIsRequired(true);
    $profile->setIsCourseManager(true);
    $profile->save();
    return true;
}
コード例 #2
0
ファイル: profile_list.php プロジェクト: rhertzog/lcs
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
$profile_id = isset($_REQUEST['profile_id']) ? (int) $_REQUEST['profile_id'] : null;
$dialogBox = new DialogBox();
if ($cmd) {
    $profile = new RightProfile();
    if (!empty($profile_id)) {
        // load profile
        if (!$profile->load($profile_id)) {
            $cmd = '';
            $profile_id = null;
            $display = DISPLAY_LIST;
        }
    }
    if ($cmd == 'exSave') {
        if ($profile->validateForm()) {
            $profile->save();
        } else {
            // get error message
            $message = '';
            if (!empty($profile_id)) {
                $cmd = 'rqEdit';
            } else {
                $cmd = 'rqAdd';
            }
        }
    }
    if ($cmd == 'rqEdit' || $cmd == 'rqAdd') {
        // create or edit a profile
        $form = $profile->displayProfileForm();
        $display = DISPLAY_FORM;
    }