Exemplo n.º 1
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Piraux Sebastien <*****@*****.**>
 * @author      Lederer Guillaume <*****@*****.**>
 * @package     CLLNP
 * @since       1.8
 */
function lp_display_scorm($TABLELEARNPATHMODULE)
{
    $out = '';
    // change raw if value is a number between 0 and 100
    if (isset($_POST['newRaw']) && is_num($_POST['newRaw']) && $_POST['newRaw'] <= 100 && $_POST['newRaw'] >= 0) {
        $sql = "UPDATE `" . $TABLELEARNPATHMODULE . "`\n                SET `raw_to_pass` = " . (int) $_POST['newRaw'] . "\n                WHERE `module_id` = " . (int) $_SESSION['module_id'] . "\n                AND `learnPath_id` = " . (int) $_SESSION['path_id'];
        claro_sql_query($sql);
        $dialogBoxContent = get_lang('Minimum raw to pass has been changed');
    }
    $out .= '<hr noshade="noshade" size="1" />';
    //####################################################################################\\
    //############################### DIALOG BOX SECTION #################################\\
    //####################################################################################\\
    if (!empty($dialogBoxContent)) {
        $dialogBox = new DialogBox();
        $dialogBox->success($dialogBoxContent);
        $out .= $dialogBox->render();
    }
    // form to change raw needed to pass the exercise
    $sql = "SELECT `lock`, `raw_to_pass`\n            FROM `" . $TABLELEARNPATHMODULE . "` AS LPM\n           WHERE LPM.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND LPM.`learnPath_id` = " . (int) $_SESSION['path_id'];
    $learningPath_module = claro_sql_query_fetch_all($sql);
    if (isset($learningPath_module[0]['lock']) && $learningPath_module[0]['lock'] == 'CLOSE' && isset($learningPath_module[0]['raw_to_pass'])) {
        $out .= "\n\n" . '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . '<label for="newRaw">' . get_lang('Change minimum raw mark to pass this module (percentage) : ') . '</label>' . "\n" . '<input type="text" value="' . claro_htmlspecialchars($learningPath_module[0]['raw_to_pass']) . '" name="newRaw" id="newRaw" size="3" maxlength="3" /> % ' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '</form>' . "\n\n";
    }
    return $out;
}
Exemplo n.º 2
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Piraux Sebastien <*****@*****.**>
 * @author      Lederer Guillaume <*****@*****.**>
 * @package     CLLNP
 * @since       1.8
 */
function lp_display_exercise($cmd, $TABLELEARNPATHMODULE, $TABLEMODULE, $TABLEASSET, $tbl_quiz_exercise)
{
    $out = '';
    if (isset($cmd) && ($cmd = "raw")) {
        // change raw if value is a number between 0 and 100
        if (isset($_POST['newRaw']) && is_num($_POST['newRaw']) && $_POST['newRaw'] <= 100 && $_POST['newRaw'] >= 0) {
            $sql = "UPDATE `" . $TABLELEARNPATHMODULE . "`\n                    SET `raw_to_pass` = " . (int) $_POST['newRaw'] . "\n                    WHERE `module_id` = " . (int) $_SESSION['module_id'] . "\n                    AND `learnPath_id` = " . (int) $_SESSION['path_id'];
            claro_sql_query($sql);
            $dialogBoxContent = get_lang('Minimum raw to pass has been changed');
        }
    }
    $out .= '<hr noshade="noshade" size="1" />';
    //####################################################################################\\
    //############################### DIALOG BOX SECTION #################################\\
    //####################################################################################\\
    if (!empty($dialogBoxContent)) {
        $dialogBox = new DialogBox();
        $dialogBox->success($dialogBoxContent);
        $out .= $dialogBox->render();
    }
    // form to change raw needed to pass the exercise
    $sql = "SELECT `lock`, `raw_to_pass`\n            FROM `" . $TABLELEARNPATHMODULE . "` AS LPM\n           WHERE LPM.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND LPM.`learnPath_id` = " . (int) $_SESSION['path_id'];
    $learningPath_module = claro_sql_query_get_single_row($sql);
    // if this module blocks the user if he doesn't complete
    if (isset($learningPath_module['lock']) && $learningPath_module['lock'] == 'CLOSE' && isset($learningPath_module['raw_to_pass'])) {
        $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . claro_form_relay_context() . '<label for="newRaw">' . get_lang('Change minimum raw mark to pass this module (percentage) :') . ' </label>' . "\n" . '<input type="text" value="' . claro_htmlspecialchars($learningPath_module['raw_to_pass']) . '" name="newRaw" id="newRaw" size="3" maxlength="3" /> % ' . "\n" . '<input type="hidden" name="cmd" value="raw" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '</form>' . "\n\n";
    }
    // display current exercise info and change comment link
    $sql = "SELECT `E`.`id` AS `exerciseId`, `M`.`name`\n            FROM `" . $TABLEMODULE . "` AS `M`,\n                 `" . $TABLEASSET . "`  AS `A`,\n                 `" . $tbl_quiz_exercise . "` AS `E`\n           WHERE `A`.`module_id` = M.`module_id`\n             AND `M`.`module_id` = " . (int) $_SESSION['module_id'] . "\n             AND `E`.`id` = `A`.`path`";
    $module = claro_sql_query_get_single_row($sql);
    if ($module) {
        $out .= "\n\n" . '<h4>' . get_lang('Exercise in module') . ' :</h4>' . "\n" . '<p>' . "\n" . claro_htmlspecialchars($module['name']) . '<a href="../exercise/admin/edit_exercise.php?exId=' . $module['exerciseId'] . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" />' . '</a>' . "\n" . '</p>' . "\n";
    }
    // else sql error, do nothing except in debug mode, where claro_sql_query_fetch_all will show the error
    return $out;
}
Exemplo n.º 3
0
         if ($_REQUEST['vis'] == 'v') {
             $eventNotifier->notifyCourseEvent('work_visible', claro_get_current_course_id(), claro_get_current_tool_id(), $assigId, claro_get_current_group_id(), '0');
         } else {
             $eventNotifier->notifyCourseEvent('work_invisible', claro_get_current_course_id(), claro_get_current_tool_id(), $assigId, claro_get_current_group_id(), '0');
         }
     }
 }
 /*--------------------------------------------------------------------
                         DELETE AN ASSIGNMENT
   --------------------------------------------------------------------*/
 // delete/remove an assignment
 if ($cmd == 'exRmAssig') {
     $assignment->delete();
     //notify eventmanager
     $eventNotifier->notifyCourseEvent('work_deleted', claro_get_current_course_id(), claro_get_current_tool_id(), $assigId, claro_get_current_group_id(), '0');
     $dialogBox->success(get_lang('Assignment deleted'));
 }
 /*--------------------------------------------------------------------
                         MODIFY AN ASSIGNMENT
   --------------------------------------------------------------------*/
 /*-----------------------------------
       STEP 2 : check & query
   -------------------------------------*/
 // edit an assignment / form has been sent
 if ($cmd == 'exEditAssig') {
     // check validity of the data
     if (!is_null($assigId) && $assignment->validate()) {
         $assignment->save();
         $eventNotifier->notifyCourseEvent('work_updated', claro_get_current_course_id(), claro_get_current_tool_id(), $assigId, claro_get_current_group_id(), '0');
         $dialogBox->success(get_lang('Assignment modified'));
     } else {
Exemplo n.º 4
0
switch ($cmd) {
    case 'sub':
        //execute subscription command...
        $done = user_add_to_course($user_id, $cidToEdit, false, false, null);
        // Set status requested
        if ($_REQUEST['isCourseManager']) {
            $properties['isCourseManager'] = 1;
            $properties['tutor'] = 1;
        } else {
            $properties['isCourseManager'] = 0;
            $properties['tutor'] = 0;
        }
        user_set_course_properties($user_id, $cidToEdit, $properties);
        //set dialogbox message
        if ($done) {
            $dialogBox->success(get_lang('The user has been enroled to the course'));
        }
        break;
}
//build and call DB to get info about current course (for title) if needed :
$courseData = claro_get_course_data($cidToEdit);
if (!$courseData) {
    unset($_REQUEST['cidToEdit']);
    claro_die('ERROR : COURSE NOT FOUND!!!');
}
//----------------------------------
// Build query and find info in db
//----------------------------------
$sql = "\nSELECT\n    U.nom, U.prenom, U.`user_id` AS ID,\n    CU.*,\n    CU.`user_id` AS Register\nFROM  `" . $tbl_user . "` AS U";
$toAdd = "\nLEFT JOIN `" . $tbl_course_user . "` AS CU\n    ON             CU.`user_id`=U.`user_id`\n            AND CU.`code_cours` = '" . claro_sql_escape($cidToEdit) . "'\n        ";
$sql .= $toAdd;
Exemplo n.º 5
0
    $copyError = false;
    //we could simply copy the requested module progression...
    //but since we can navigate between modules while completing a module,
    //we have to copy the whole learning path progression.
    if (!copyLearnPathProgression((int) $_SESSION['returnToTrackingUserId'], (int) claro_get_current_user_id(), (int) $_SESSION['path_id'])) {
        $copyError = true;
    }
    $dialogBox = new DialogBox();
    if ($copyError) {
        $dialogBox->error(get_lang('An error occured while accessing student module'));
        $claroline->display->body->appendContent($dialogBox->render());
        echo $claroline->display->render();
        exit;
    } else {
        $user_data = user_get_properties((int) $_SESSION['returnToTrackingUserId']);
        $dialogBox->success(get_lang('Currently viewing module of ') . $user_data['firstname'] . ' ' . $user_data['lastname']);
        unset($user_data);
    }
    unset($copyError);
} else {
    unset($_SESSION['returnToTrackingUserId']);
}
// main page
// FIRST WE SEE IF USER MUST SKIP THE PRESENTATION PAGE OR NOT
// triggers are : if there is no introdution text or no user module progression statistics yet and user is not admin,
// then there is nothing to show and we must enter in the module without displaying this page.
/*
 *  GET INFOS ABOUT MODULE and LEARNPATH_MODULE
 */
// check in the DB if there is a comment set for this module in general
$sql = "SELECT `comment`, `startAsset_id`, `contentType`\n        FROM `" . $TABLEMODULE . "`\n        WHERE `module_id` = " . (int) $_SESSION['module_id'];
Exemplo n.º 6
0
            $properties['profileId'] = $_REQUEST['profileId'];
        }
        if (isset($_REQUEST['isTutor'])) {
            $properties['tutor'] = (int) $_REQUEST['isTutor'];
        } else {
            $properties['tutor'] = 0;
        }
        if (isset($_REQUEST['role'])) {
            $properties['role'] = trim($_REQUEST['role']);
        }
        $done = user_set_course_properties($uidToEdit, $cidToEdit, $properties);
        if (!$done) {
            $dialogBox->warning(get_lang('No change applied'));
        } elseif (!empty($properties['profileId'])) {
            if (claro_get_profile_label($properties['profileId']) == 'manager') {
                $dialogBox->success(get_lang('User is now course manager'));
            } else {
                $dialogBox->success(get_lang('User is now student for this course'));
            }
        }
        break;
}
//------------------------------------
// FIND GLOBAL INFO SECTION
//------------------------------------
if (isset($uidToEdit)) {
    // get course user info
    $courseUserProperties = course_user_get_properties($uidToEdit, $cidToEdit);
}
//------------------------------------
// PREPARE DISPLAY
Exemplo n.º 7
0
$toolRepository = get_path('clarolineRepositoryWeb');
claro_set_display_mode_available(true);
// Manage portlets
if (claro_is_course_manager() && !empty($portletClass)) {
    // Require the right class
    $portletPath = get_module_path($portletLabel) . '/connector/coursehomepage.cnr.php';
    if (file_exists($portletPath)) {
        require_once $portletPath;
    } else {
        throw new Exception(get_lang('Cannot find this portlet'));
    }
    if ($portletCmd == 'exAdd') {
        $portlet = new $portletClass();
        $portlet->handleForm();
        if ($portlet->save()) {
            $dialogBox->success(get_lang('Portlet created'));
        } else {
            $dialogBox->error(get_lang('Can\'t create this portlet (%portlet)', array('%portlet' => $portlet->getLabel())));
        }
    } elseif ($portletCmd == 'delete' && !empty($portletId) && class_exists($portletClass)) {
        $portlet = new $portletClass();
        $portlet->load($portletId);
        if ($portlet->delete()) {
            $dialogBox->success(get_lang('Portlet deleted'));
        }
    } elseif ($portletCmd == 'makeVisible' && !empty($portletId) && class_exists($portletClass)) {
        $portlet = new $portletClass();
        if ($portlet->load($portletId)) {
            $portlet->makeVisible();
            if ($portlet->save()) {
                $dialogBox->success(get_lang('Portlet visibility modified'));
Exemplo n.º 8
0
 if (isset($_REQUEST['uncompress']) && $_REQUEST['uncompress'] == 1 && $is_allowedToUnzip && preg_match('/.zip$/i', $_FILES['userFile']['name'])) {
     $unzip = 'unzip';
 } else {
     $unzip = '';
 }
 if (isset($_REQUEST['comment']) && trim($_REQUEST['comment']) != '') {
     $comment = trim($_REQUEST['comment']);
 } else {
     $comment = '';
 }
 $cwd = secure_file_path($cwd);
 $uploadedFileName = treat_uploaded_file($_FILES['userFile'], $baseWorkDir, $cwd, $maxFilledSpace, $unzip);
 $uploadedFileNameList = array();
 if ($uploadedFileName !== false) {
     if (isset($_REQUEST['uncompress']) && $_REQUEST['uncompress'] == 1 && $unzip == 'unzip') {
         $dialogBox->success(get_lang('Zip file uploaded and uncompressed'));
         foreach ($uploadedFileName as $uploadedFile) {
             $uploadedFileNameList[] = $cwd . '/' . $uploadedFile['stored_filename'];
         }
     } else {
         $dialogBox->success(get_lang('The upload is finished'));
         $uploadedFileNameList[] = $cwd . '/' . $uploadedFileName;
     }
     if (!empty($comment)) {
         $cur_dir = $cwd;
         // add comment to each file
         foreach ($uploadedFileNameList as $fileName) {
             $fileName = secure_file_path($fileName);
             if (dirname($fileName) != $cwd) {
                 // put a comment on the folder
                 update_db_info('update', dirname($fileName), array('comment' => $comment));
Exemplo n.º 9
0
 if ($cmd == 'exEdit') {
     if (isset($_REQUEST['descTitle'])) {
         $description->setTitle($_REQUEST['descTitle']);
     }
     if (isset($_REQUEST['descContent'])) {
         $description->setContent($_REQUEST['descContent']);
     }
     if (isset($_REQUEST['descCategory'])) {
         $description->setCategory($_REQUEST['descCategory']);
     }
     if ($description->validate()) {
         // Update description
         if ($description->save()) {
             if ($descId) {
                 $eventNotifier->notifyCourseEvent('course_description_modified', claro_get_current_course_id(), claro_get_current_tool_id(), $descId, claro_get_current_group_id(), '0');
                 $dialogBox->success(get_lang('Description updated'));
             } else {
                 $eventNotifier->notifyCourseEvent('course_description_added', claro_get_current_course_id(), claro_get_current_tool_id(), $descId, claro_get_current_group_id(), '0');
                 $dialogBox->success(get_lang('Description added'));
             }
         } else {
             $dialogBox->error(get_lang('Unable to update'));
         }
     } else {
         $cmd = 'rqEdit';
     }
 }
 /*-------------------------------------------------------------------------
       REQUEST DESCRIPTION ITEM EDITION
   -------------------------------------------------------------------------*/
 if ($cmd == 'rqEdit') {
Exemplo n.º 10
0
 } elseif ($cmd == 'rqEd') {
     ResourceLinker::setCurrentLocator($currentLocator);
     $toolIntro = new ToolIntro($id);
     if ($toolIntro->load()) {
         $toolIntroForm = $toolIntro->renderForm();
     }
 } elseif ($cmd == 'exAdd') {
     $toolIntro = new ToolIntro();
     $toolIntro->handleForm();
     //TODO inputs validation
     // Manage ressources
     if ($toolIntro->save()) {
         $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $toolIntro->getId()));
         $resourceList = isset($_REQUEST['resourceList']) ? $_REQUEST['resourceList'] : array();
         ResourceLinker::updateLinkList($currentLocator, $resourceList);
         $dialogBox->success(get_lang('Introduction added'));
         // Notify that the introsection has been created
         $claroline->notifier->notifyCourseEvent('introsection_created', claro_get_current_course_id(), claro_get_current_tool_id(), $toolIntro->getId(), claro_get_current_group_id(), '0');
     }
 } elseif ($cmd == 'exEd') {
     $toolIntro = new ToolIntro($id);
     $toolIntro->handleForm();
     //TODO inputs validation
     if ($toolIntro->save()) {
         $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $toolIntro->getId()));
         $resourceList = isset($_REQUEST['resourceList']) ? $_REQUEST['resourceList'] : array();
         ResourceLinker::updateLinkList($currentLocator, $resourceList);
         $dialogBox->success(get_lang('Introduction modified'));
         // Notify that the introsection has been modified
         $claroline->notifier->notifyCourseEvent('introsection_modified', claro_get_current_course_id(), claro_get_current_tool_id(), $toolIntro->getId(), claro_get_current_group_id(), '0');
     }
Exemplo n.º 11
0
 */
$display_form = false;
if ($is_allowedToEdit) {
    $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
    $title = isset($_REQUEST['title']) ? trim($_REQUEST['title']) : '';
    $content = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : '';
    $lasting = isset($_REQUEST['lasting']) ? trim($_REQUEST['lasting']) : '';
    $speakers = isset($_REQUEST['speakers']) ? trim($_REQUEST['speakers']) : '';
    $location = isset($_REQUEST['location']) ? trim($_REQUEST['location']) : '';
    $autoExportRefresh = false;
    if ('exAdd' == $cmd) {
        $date_selection = $_REQUEST['fyear'] . '-' . $_REQUEST['fmonth'] . '-' . $_REQUEST['fday'];
        $hour = $_REQUEST['fhour'] . ':' . $_REQUEST['fminute'] . ':00';
        $entryId = agenda_add_item($title, $content, $date_selection, $hour, $lasting, $speakers, $location);
        if ($entryId != false) {
            $dialogBox->success(get_lang('Event added to the agenda'));
            $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $entryId));
            $resourceList = isset($_REQUEST['resourceList']) ? $_REQUEST['resourceList'] : array();
            ResourceLinker::updateLinkList($currentLocator, $resourceList);
            if (CONFVAL_LOG_CALENDAR_INSERT) {
                $claroline->log('CALENDAR', array('ADD_ENTRY' => $entryId));
            }
            // notify that a new agenda event has been posted
            $eventNotifier->notifyCourseEvent('agenda_event_added', claro_get_current_course_id(), claro_get_current_tool_id(), $entryId, claro_get_current_group_id(), '0');
            $autoExportRefresh = true;
        } else {
            $dialogBox->error(get_lang('Unable to add the event to the agenda'));
        }
    }
    /*------------------------------------------------------------------------
      EDIT EVENT COMMAND
Exemplo n.º 12
0
$notAutoActivateInCourses = array_key_exists('notAutoActivateInCourses', $_REQUEST) && $_REQUEST['notAutoActivateInCourses'] == 'on' ? true : false;
$activableOnlyByPlatformAdmin = array_key_exists('activableOnlyByPlatformAdmin', $_REQUEST) && $_REQUEST['activableOnlyByPlatformAdmin'] == 'on' ? true : false;
$activateOnInstall = array_key_exists('activateOnInstall', $_REQUEST) && $_REQUEST['activateOnInstall'] == 'on' ? true : false;
$visibleOnInstall = array_key_exists('visibleOnInstall', $_REQUEST) && $_REQUEST['visibleOnInstall'] == 'on' ? true : false;
$deleteModuleDatabase = array_key_exists('deleteModuleDatabase', $_REQUEST) && $_REQUEST['deleteModuleDatabase'] == 'on' ? true : false;
//----------------------------------
// EXECUTE COMMAND
//----------------------------------
// TODO improve status message and backlog display
switch ($cmd) {
    case 'activ':
        list($backlog, $success) = activate_module($module_id);
        $details = $backlog->output();
        if ($success) {
            $summary = get_lang('Module activation succeeded');
            $dialogBox->success(Backlog_Reporter::report($summary, $details));
        } else {
            $summary = get_lang('Module activation failed');
            $dialogBox->error(Backlog_Reporter::report($summary, $details));
        }
        break;
    case 'desactiv':
        list($backlog, $success) = deactivate_module($module_id);
        $details = $backlog->output();
        if ($success) {
            $summary = get_lang('Module desactivation succeeded');
            $dialogBox->success(Backlog_Reporter::report($summary, $details));
        } else {
            $summary = get_lang('Module desactivation failed');
            $dialogBox->error(Backlog_Reporter::report($summary, $details));
        }
Exemplo n.º 13
0
     if (!$userInfo['isPlatformAdmin'] && !$userInfo['isCourseCreator']) {
         $userInfo['password'] = mk_password(8);
         if (user_set_properties($user['id'], array('password' => $userInfo['password']))) {
             if ($sendEmail && user_send_registration_mail($user['id'], $userInfo)) {
                 $mailSent = TRUE;
             }
         } else {
             $failedList[] = $userInfo;
         }
     }
     if ($sendEmail && !$mailSent) {
         $failedMailList[] = $userInfo;
     }
 }
 if (empty($failedList)) {
     $dialogBox->success(get_lang('Password changed successfully for all concerned users'));
 } else {
     $failedStudents = '';
     foreach ($failedList as $failed) {
         $failedStudents .= '<br />' . $failed['firstname'] . ' ' . $failed['lastname'];
     }
     $dialogBox->error(get_lang('Cannot change password for the following users:') . $failedStudents);
 }
 if ($sendEmail) {
     if (empty($failedMailList)) {
         $dialogBox->success(get_lang('Email sent successfully to all users'));
     } else {
         $failedStudents = '';
         foreach ($failedMailList as $failed) {
             $failedStudents .= '<br />' . $failed['firstname'] . ' ' . $failed['lastname'];
         }
Exemplo n.º 14
0
     $exercise->setEndDate(mktime($_REQUEST['endHour'], $_REQUEST['endMinute'], 0, $_REQUEST['endMonth'], $_REQUEST['endDay'], $_REQUEST['endYear']));
 } else {
     $exercise->setEndDate(null);
 }
 if (isset($_REQUEST['useTimeLimit']) && $_REQUEST['useTimeLimit']) {
     $exercise->setTimeLimit($_REQUEST['timeLimitMin'] * 60 + $_REQUEST['timeLimitSec']);
 } else {
     $exercise->setTimeLimit(0);
 }
 $exercise->setAttempts($_REQUEST['attempts']);
 $exercise->setAnonymousAttempts($_REQUEST['anonymousAttempts']);
 $exercise->setQuizEndMessage($_REQUEST['quizEndMessage']);
 if ($exercise->validate()) {
     if ($insertedId = $exercise->save()) {
         if (is_null($exId)) {
             $dialogBox->success(get_lang('Exercise added'));
             $eventNotifier->notifyCourseEvent("exercise_added", claro_get_current_course_id(), claro_get_current_tool_id(), $insertedId, claro_get_current_group_id(), "0");
             $exId = $insertedId;
         } else {
             $dialogBox->success(get_lang('Exercise modified'));
             $eventNotifier->notifyCourseEvent("exercise_updated", claro_get_current_course_id(), claro_get_current_tool_id(), $insertedId, claro_get_current_group_id(), "0");
         }
         $displaySettings = true;
     } else {
         // sql error in save() ?
         $cmd = 'rqEdit';
     }
 } else {
     if (claro_failure::get_last_failure() == 'exercise_no_title') {
         $dialogBox->error(get_lang('Field \'%name\' is required', array('%name' => get_lang('Title'))));
     } elseif (claro_failure::get_last_failure() == 'exercise_incorrect_dates') {
Exemplo n.º 15
0
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
$nameTools = get_lang('User settings');
$dialogBox = new DialogBox();
// BC
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$user_id = $_REQUEST['uidToEdit'];
//------------------------------------
// Execute COMMAND section
//------------------------------------
if (isset($_REQUEST['cmd']) && claro_is_platform_admin()) {
    if ($_REQUEST['cmd'] == 'UnReg') {
        if (user_remove_from_course($user_id, $_REQUEST['cidToEdit'], true, false)) {
            $dialogBox->success(get_lang('The user has been successfully unregistered'));
        } else {
            switch (claro_failure::get_last_failure()) {
                case 'cannot_unsubscribe_the_last_course_manager':
                    $dialogBox->error(get_lang('You cannot unsubscribe the last course manager of the course'));
                    break;
                case 'course_manager_cannot_unsubscribe_himself':
                    $dialogBox->error(get_lang('Course manager cannot unsubscribe himself'));
                    break;
                default:
            }
        }
    }
}
/**
 * PREPARE DISPLAY
Exemplo n.º 16
0
         $wiki = $wikiStore->loadWiki($wikiId);
         $wikiTitle = $wiki->getTitle();
         $message = get_lang("WARNING : you are going to delete this wiki and all its pages. Are you sure to want to continue ?");
         $dialogBox->question($message);
     }
     break;
     // execute delete
 // execute delete
 case 'exDelete':
     if ($wikiStore->wikiIdExists($wikiId)) {
         $wiki = $wikiStore->deleteWiki($wikiId);
         if ($wiki) {
             $message = get_lang("Wiki deletion succeed");
             //notify that the wiki was deleted
             $eventNotifier->notifyCourseEvent('wiki_deleted', claro_get_current_course_id(), claro_get_current_tool_id(), $wikiId, $groupId, '0');
             $dialogBox->success($message);
         } else {
             $message = get_lang("Wiki deletion failed");
             $dialogBox->error($message);
         }
     } else {
         $message = get_lang("Invalid Wiki Id");
         $dialogBox->error($message);
         $action = 'error';
     }
     $action = 'list';
     break;
     // request edit
 // request edit
 case 'rqEdit':
     if ($wikiId == 0) {
Exemplo n.º 17
0
         // Courses pool's limit reached ?
         if ($i == $coursesPool) {
             $_SESSION['inProgress'] = true;
             $_SESSION['lastTreatedCourseId'] = $course['id'];
             $_SESSION['progressingStats'] = $stats;
             if (empty($_SESSION['viewAs'])) {
                 $_SESSION['viewAs'] = isset($_REQUEST['viewAs']) && in_array($_REQUEST['viewAs'], array('html', 'csv')) ? $_REQUEST['viewAs'] : 'html';
             }
             $htmlHeadXtra[] = '<meta http-equiv="refresh" content="1" />' . "\n";
             break;
         }
     }
 }
 // All courses treated ?
 if ($i < $coursesPool && !$sql->valid()) {
     $dialogBox->success(get_lang('All courses treated !'));
     $viewAs = $_SESSION['viewAs'];
     unset($_SESSION['lastTreatedCourseId']);
     unset($_SESSION['progressingStats']);
     unset($_SESSION['inProgress']);
     unset($_SESSION['viewAs']);
     ksort($stats);
 }
 if (!isset($_SESSION['inProgress'])) {
     if (!empty($extensions)) {
         $dialogBox->info(get_lang('You\'ve chosen to isolate the following extensions: %types.  If you wish to modify these extensions, check the advanced platform settings', array('%types' => implode(', ', $extensions))));
     } else {
         $dialogBox->info(get_lang('You don\'t have chosen any extension to isolate.  If you wish to isolate extensions in your statistics, check the advanced platform settings'));
     }
     if ($viewAs == 'html') {
         $template = new CoreTemplate('admin_files_stats.tpl.php');
Exemplo n.º 18
0
            }
            </script>';
        $claroline->display->header->addHtmlHeader($javascriptDelete);
        $dialogBox = new DialogBox();
        $dialogBox->setBoxType('question');
        $dialogBox->question(get_lang('Are you sure to delete all messages older than %date?', array('%date' => $date)));
        $dialogBox->warning(get_lang('There is no way to restore deleted messages.'));
        $dialogBox->info('<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '?cmd=exOlderThan&amp;date=' . urlencode($_REQUEST['date']) . '">' . get_lang('Yes') . '</a> | <a href="admin.php">' . get_lang('No') . '</a>');
        $content .= '<br />' . $dialogBox->render();
    }
}
if ($displayRemoveOlderThanValidated) {
    $date = claro_htmlspecialchars($_REQUEST['date']);
    $dialogBox = new DialogBox();
    $dialogBoxMsg = get_lang('All messages older than %date% have been deleted', array('%date%' => $date)) . '<br /><br />' . '<a href="admin.php">' . get_lang('Back') . '</a>';
    $dialogBox->success($dialogBoxMsg);
    $content .= '<br />' . $dialogBox->render();
}
// --------------- end older than
// ------------ platform message
if ($displayRemovePlatformMessageConfirmation) {
    $dialogBox = new DialogBox();
    $dialogBox->setBoxType('question');
    $dialogBox->question(get_lang('Are you sure to delete all platform messages?'));
    $dialogBox->warning(get_lang('There is no way to restore deleted messages.'));
    $dialogBox->info('<br /><br /><a href="' . $_SERVER['PHP_SELF'] . '?cmd=exPlatformMessage">' . get_lang('Yes') . '</a> | <a href="admin.php">' . get_lang('No') . '</a>');
    $content .= '<br />' . $dialogBox->render();
}
if ($displayRemovePlatformMessageValidated) {
    $dialogBoxMsg = get_lang('All platform messages have been deleted') . '<br /><br />' . '<a href="admin.php">' . get_lang('Back') . '</a>';
    $dialogBox = new DialogBox();
Exemplo n.º 19
0
            default:
                break;
        }
    } elseif ($ex instanceof Claro_Input_Exception) {
        $dialogBox->error(get_lang('Unset input variable'));
        $cmd = 'show';
    } else {
        $dialogBox->error(get_lang('Unexpected error'));
        $cmd = 'show';
    }
}
//handle admin commands
if ($is_allowedToEdit) {
    if ('exMkCat' == $cmd) {
        if (create_category($catName)) {
            $dialogBox->success(get_lang('The new category has been created.'));
        } else {
            $dialogBox->error(get_lang('Unable to create category'));
            $cmd = 'rqMkCat';
        }
    }
    if ('rqMkCat' == $cmd) {
        try {
            $form = new ModuleTemplate('CLFRM', 'forum_editcat.tpl.php');
            $form->assign('header', get_lang('Add a category'));
            $form->assign('catName', '');
            $form->assign('nextCommand', 'exMkCat');
            $form->assign('catId', 0);
            $dialogBox->form($form->render());
        } catch (Exception $ex) {
            if (claro_debug_mode()) {
Exemplo n.º 20
0
                break;
            default:
                $dialogBox->error(get_lang('Course not found'));
        }
    }
} elseif ('rqDelete' == $cmd) {
    if (!is_null($courseToDelete)) {
        $dialogBox->question(get_lang('Are you sure to delete course %name', array('%name' => $courseToDelete->title)) . '<br/><br/>' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exDelete&amp;delCode=' . $courseCode . '&amp;offsetC=' . $offsetC . $addToURL . '">' . get_lang('Yes') . '</a>' . ' | ' . '<a href="' . $_SERVER['PHP_SELF'] . '">' . get_lang('No') . '</a>' . "\n");
    } else {
        $dialogBox->error(get_lang('Course not found'));
    }
}
// EXECUTE
if ('delete' == $do) {
    if ($courseToDelete->delete()) {
        $dialogBox->success(get_lang('The course has been successfully deleted'));
        $noQUERY_STRING = true;
    }
}
/**
 * PREPARE DISPLAY
 *
 * Display contains 2 parts:
 *
 * 1/ Filter/search panel
 * 2/ List of datas
 */
$sqlCourseList = prepare_get_filtred_course_list();
$myPager = new claro_sql_pager($sqlCourseList, $offsetC, get_conf('coursePerPage', 20));
$sortKey = isset($_GET['sort']) ? $_GET['sort'] : 'officialCode, intitule';
$sortDir = isset($_GET['dir']) ? $_GET['dir'] : SORT_ASC;
Exemplo n.º 21
0
 */
$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$cmd = isset($_REQUEST['cmd']) ? $cmd = $_REQUEST['cmd'] : '';
if ($is_allowedToEdit) {
    if (isset($_REQUEST['cmd']) && ($_REQUEST['cmd'] == 'rqCreate' || $_REQUEST['cmd'] == 'rqEdit')) {
        if ('rqEdit' == $_REQUEST['cmd']) {
            $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $_REQUEST['id']));
            ResourceLinker::setCurrentLocator($currentLocator);
        }
    }
    $autoExportRefresh = false;
    if (!empty($cmd)) {
        // Move announcements up or down
        if ('exMvDown' == $cmd) {
            if (move_entry($id, 'DOWN')) {
                $dialogBox->success(get_lang('Item has been moved down'));
            } else {
                $dialogBox->error(get_lang('Item can\'t be moved down'));
            }
        }
        if ('exMvUp' == $cmd) {
            if (move_entry($id, 'UP')) {
                $dialogBox->success(get_lang('Item has been moved up'));
            } else {
                $dialogBox->error(get_lang('Item can\'t be moved up'));
            }
        }
        // Delete announcement
        if ('exDelete' == $cmd) {
            if (announcement_delete_item($id)) {
                $dialogBox->success(get_lang('Announcement has been deleted'));
Exemplo n.º 22
0
 }
 if (isset($_POST['language'])) {
     $user_data['language'] = trim($_POST['language']);
 }
 if (isset($_POST['isCourseCreator'])) {
     $user_data['isCourseCreator'] = (int) $_POST['isCourseCreator'];
 }
 if (isset($_POST['is_admin'])) {
     $user_data['is_admin'] = (bool) $_POST['is_admin'];
 }
 if (isset($_POST['delPicture']) && $_POST['delPicture'] == 'true') {
     $picturePath = user_get_picture_path($user_data);
     if ($picturePath) {
         claro_delete_file($picturePath);
         $user_data['picture'] = '';
         $dialogBox->success(get_lang("User picture deleted"));
     } else {
         $dialogBox->error(get_lang("Cannot delete user picture"));
     }
 }
 // Handle user picture
 if (isset($_FILES['picture']['name']) && $_FILES['picture']['size'] > 0) {
     $fileName = $_FILES['picture']['name'];
     $fileTmpName = $_FILES['picture']['tmp_name'];
     if (is_uploaded_file($fileTmpName)) {
         if (is_image($fileName)) {
             list($width, $height, $type, $attr) = getimagesize($fileTmpName);
             if ($width > 0 && $width <= get_conf('maxUserPictureWidth', 150) && $height > 0 && $height <= get_conf('maxUserPictureHeight', 200) && $_FILES['picture']['size'] <= get_conf('maxUserPictureSize', 100 * 1024)) {
                 $uploadDir = user_get_private_folder_path($user_data['user_id']);
                 if (!file_exists($uploadDir)) {
                     claro_mkdir($uploadDir, CLARO_FILE_PERMISSIONS, true);
Exemplo n.º 23
0
//----------------------------------
// EXECUTE COMMAND
//----------------------------------
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
$module_id = isset($_REQUEST['module_id']) ? $_REQUEST['module_id'] : null;
if (!empty($dock)) {
    switch ($cmd) {
        case 'up':
            move_module_in_dock($module_id, $dock, 'up');
            break;
        case 'down':
            move_module_in_dock($module_id, $dock, 'down');
            break;
        case 'remove':
            remove_module_dock($module_id, $dock);
            $dialogBox->success(get_lang('The module has been removed from this dock'));
            break;
    }
    //----------------------------------
    // FIND INFORMATION
    //----------------------------------
    $sql = "SELECT M.`id`              AS `id`,\n                   M.`label`           AS `label`,\n                   M.`name`            AS `name`,\n                   M.`activation`      AS `activation`,\n                   M.`type`            AS `type`,\n                   D.`rank`            AS `rank`\n            FROM `" . $tbl_module . "` AS M, `" . $tbl_dock . "` AS D\n            WHERE D.`module_id`= M.`id`\n              AND D.`name` = '" . $dock . "'\n            ORDER BY `rank`\n            ";
    //pager creation
    $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
    $myPager = new claro_sql_pager($sql, $offset, $modulePerPage);
    //$pagerSortDir = isset($_REQUEST['dir' ]) ? $_REQUEST['dir' ] : SORT_ASC;
    $moduleList = $myPager->get_result_list();
}
//----------------------------------
// DISPLAY
//----------------------------------
Exemplo n.º 24
0
include claro_get_conf_repository() . 'user_profile.conf.php';
// find this file to modify values.
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$nameTools = get_lang('User settings');
//------------------------------------
// Execute COMMAND section
//------------------------------------
$cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : null;
$req['uidToEdit'] = isset($_REQUEST['uidToEdit']) && ctype_digit($_REQUEST['uidToEdit']) ? (int) $_REQUEST['uidToEdit'] : false;
$cmdList[] = '<a class="claroCmd" href="index.php" >' . get_lang('Back to administration page') . '</a>';
$cmdList[] = '<a class="claroCmd" href="admin_users.php" >' . get_lang('Back to user list') . '</a>';
$dialogBox = new DialogBox();
if ($cmd == 'exDelete' && $req['uidToEdit']) {
    $claroline->log('DELETE_USER', array('USER' => $req['uidToEdit']));
    if (false !== ($deletionResult = user_delete($req['uidToEdit']))) {
        $dialogBox->success(get_lang('Deletion of the user was done sucessfully'));
    } else {
        switch (claro_failure::get_last_failure()) {
            case 'user_cannot_remove_himself':
                $dialogBox->error(get_lang('You can not change your own settings!'));
                break;
            default:
                $dialogBox->error(get_lang('Unable to delete'));
        }
    }
} elseif ($cmd == 'rqDelete' && $req['uidToEdit']) {
    $user_properties = user_get_properties($req['uidToEdit']);
    if (is_array($user_properties)) {
        $dialogBox->question(get_lang('Are you sure to delete user %firstname %lastname', array('%firstname' => $user_properties['firstname'], '%lastname' => $user_properties['lastname'])) . '<br/><br/>' . "\n" . '<a href="adminuserdeleted.php?cmd=exDelete&amp;uidToEdit=' . $req['uidToEdit'] . '">' . get_lang('Yes') . '</a>' . ' | ' . '<a href="admin_profile.php?uidToEdit=' . $req['uidToEdit'] . '">' . get_lang('No') . '</a>' . "\n");
    }
} else {
Exemplo n.º 25
0
    $anonymityStatus = 'forbidden';
}
//check access rights
$is_postAllowed = !claro_is_current_user_enrolment_pending() && claro_is_course_member() && $forumSettingList['forum_access'] != 0 && (!$topicId || !$topicSettingList['topic_status']) || claro_is_allowed_to_edit() ? true : false;
$is_viewAllowed = !is_null($forumSettingList['idGroup']) && !($forumSettingList['idGroup'] == claro_get_current_group_id() || claro_is_in_a_group() || claro_is_group_allowed()) && !claro_is_allowed_to_edit() ? false : true;
// NOTE : $forumSettingList['idGroup'] != claro_get_current_group_id() is necessary to prevent any hacking
// attempt like rewriting the request without $cidReq. If we are in group
// forum and the group of the concerned forum isn't the same as the session
// one, something weird is happening, indeed ...
if (!isset($_REQUEST['submit']) && !$is_postAllowed && 'show' != $cmd || !$is_viewAllowed) {
    $dialogBox->error(get_lang('Not allowed'));
} else {
    //handle user commands
    if ('exDelete' == $cmd) {
        if (delete_post($postId, $topicSettingList['topic_id'], $forumSettingList['forum_id'])) {
            $dialogBox->success('Post successfully deleted');
        } else {
            $dialogBox->error('Error while deleting post');
        }
        $cmd = 'show';
    } elseif ('exSavePost' == $cmd) {
        $error = false;
        //this test should be handled by a "html not empty" validator
        if (trim(strip_tags($message, '<img><audio><video><embed><object><canvas><iframe>')) == '') {
            $dialogBox->error(get_lang('You cannot post an empty message'));
            $error = true;
        } else {
            // USER
            $userLastname = $is_post_anonymous ? 'anonymous' : claro_get_current_user_data('lastName');
            $userFirstname = $is_post_anonymous ? '' : claro_get_current_user_data('firstName');
            $poster_ip = $_SERVER['REMOTE_ADDR'];
Exemplo n.º 26
0
         }
     }
     if ($passwordFound) {
         /*
          * Prepare the email message wich has to be send to the user
          */
         // mail subject
         $emailSubject = get_lang('Login request') . ' ' . get_conf('siteName');
         $blockLoginInfo = '';
         foreach ($userAccountList as $userAccount) {
             $blockLoginInfo .= get_block('blockLoginInfo', array('%firstname' => $userAccount['firstname'], '%lastname' => $userAccount['lastname'], '%username' => $userAccount['username'], '%password' => $userAccount['password']));
         }
         $emailBody = get_block('blockLoginRequest', array('%siteName' => get_conf('siteName'), '%rootWeb' => get_path('rootWeb'), '%loginInfo' => $blockLoginInfo));
         // send message
         if (claro_mail_user($userList[0]['uid'], $emailBody, $emailSubject)) {
             $dialogBox->success(get_lang('Your password has been emailed to') . ' : ' . $emailTo);
         } else {
             $dialogBox->error(get_lang('The system is unable to send you an e-mail.') . '<br />' . get_lang('Please contact') . ' : ' . '<a href="mailto:' . get_conf('administrator_email') . '?BODY=' . $emailTo . '">' . get_lang('Platform administrator') . '</a>');
         }
     }
 } else {
     $dialogBox->error(get_lang('There is no user account with this email address.'));
 }
 if ($extAuthPasswordCount > 0) {
     if ($extAuthPasswordCount == count($userList)) {
         $dialogBox->warning(get_lang('Your password(s) is (are) recorded in an external authentication system outside the platform.'));
     } else {
         $dialogBox->warning(get_lang('Passwords of some of your user account(s) are recorded an in external authentication system outside the platform.'));
     }
     $dialogBox->info(get_lang('For more information take contact with the platform administrator.'));
 }
Exemplo n.º 27
0
            //RECHECK if subscribe is aivailable
            if (claro_is_course_member() && !claro_is_group_member() && $is_allowedToSelfRegInGroup) {
                $sql = "INSERT INTO `" . $tbl_group_rel_team_user . "`\n                SET `user` = " . (int) claro_get_current_user_id() . ",\n                    `team` = " . (int) claro_get_current_group_id();
                if (claro_sql_query($sql)) {
                    // REFRESH THE SCRIPT TO COMPUTE NEW PERMISSIONS ON THE BASSIS OF THIS CHANGE
                    claro_redirect($_SERVER['PHP_SELF'] . '?gidReset=1&gidReq=' . claro_get_current_group_id() . '&regDone=1');
                    exit;
                }
            }
        } else {
            $dialogBox->form(get_lang('Confirm your subscription to the group &quot;<b>%group_name</b>&quot;', array('%group_name' => claro_get_current_group_data('name'))) . "\n" . '<form action="' . claro_htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="registration" value="1" />' . "\n" . '<input type="hidden" name="doReg" value="1" />' . "\n" . '<br />' . "\n" . '<input type="submit" value="' . get_lang("Ok") . '" />' . "\n" . claro_html_button(claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'])), get_lang("Cancel")) . "\n" . '</form>' . "\n");
        }
    }
}
if (isset($_REQUEST['regDone'])) {
    $dialogBox->success(get_lang("You are now a member of this group."));
}
if (isset($_REQUEST['unregistration'])) {
    //RECHECK if subscribe is aivailable
    if (claro_is_course_member() && claro_is_group_member() && $is_allowedToSelfUnregInGroup) {
        if (isset($_REQUEST['doUnreg'])) {
            //RECHECK if subscribe is aivailable
            if (claro_is_course_member() && claro_is_group_member() && $is_allowedToSelfUnregInGroup) {
                $sql = "DELETE FROM `" . $tbl_group_rel_team_user . "`\n                WHERE `user` = " . (int) claro_get_current_user_id() . "\n                AND    `team` = " . (int) claro_get_current_group_id();
                if (claro_sql_query($sql)) {
                    // REFRESH THE SCRIPT TO COMPUTE NEW PERMISSIONS ON THE BASSIS OF THIS CHANGE
                    claro_redirect(dirname($_SERVER['PHP_SELF']) . '/group.php?gidReset=1&unregDone=1');
                    exit;
                }
            }
        } else {
Exemplo n.º 28
0
 // new config object
 $config = new ConfigHtml($config_code, 'config_list.php');
 // load configuration
 if ($config->load()) {
     $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : null;
     // display section menu
     $form .= $config->display_section_menu($section);
     // init config name
     $config_name = $config->get_conf_name();
     if (isset($_REQUEST['cmd']) && !empty($newPropertyList)) {
         if ('save' == $_REQUEST['cmd']) {
             // validate config
             if ($config->validate($newPropertyList)) {
                 // save config file
                 if ($config->save()) {
                     $dialogBox->success(get_lang('Properties for %config_name, (%config_code) are now effective on server.', array('%config_name' => get_lang($config_name), '%config_code' => $config_code)));
                 } else {
                     $error = true;
                     $dialogBox->error($config->backlog->output());
                 }
             } else {
                 // not valid
                 $error = true;
                 $dialogBox->error($config->backlog->output());
             }
         }
         // display form
         $form .= $config->display_form($newPropertyList, $section);
     } else {
         // display form
         $form .= $config->display_form(null, $section);
Exemplo n.º 29
0
$acceptedCmdList = array('exCCstatus', 'exRevoquation', 'reqCCstatus', 'reqRevoquation', 'editExtraInfo', 'exMoreInfo');
if (isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $acceptedCmdList)) {
    $cmd = $_REQUEST['cmd'];
} else {
    $cmd = '';
}
if (isset($_REQUEST['applyChange'])) {
    // Get params form the form
    $userData = user_initialise();
    if (get_conf('allow_profile_picture', true)) {
        // Handle user picture
        $pictureUpdated = user_handle_profile_picture($userData);
        if ($pictureUpdated['success']) {
            $userData['picture'] = $pictureUpdated['pictureName'];
            foreach ($pictureUpdated['messages'] as $success) {
                $dialogBox->success($success);
            }
        } else {
            foreach ($pictureUpdated['messages'] as $error) {
                $dialogBox->error($error);
            }
        }
    }
    // Manage password
    if (empty($userData['password']) && empty($userData['password_conf'])) {
        unset($userData['password']);
        unset($userData['password_conf']);
    }
    if (empty($userData['authSource'])) {
        unset($userData['authSource']);
    }
Exemplo n.º 30
0
    $user_extra_data = user_get_extra_data($userId);
}
if (!empty($user_extra_data) && count($user_extra_data) > 0) {
    $dgExtra = new claro_datagrid(user_get_extra_data($userId));
} else {
    $dgExtra = null;
}
if (isset($_REQUEST['applyChange'])) {
    // Get input from the form
    $userData = user_initialise();
    // Handle user picture
    $pictureUpdated = user_handle_profile_picture($userData);
    if ($pictureUpdated['success']) {
        $userData['picture'] = $pictureUpdated['pictureName'];
        foreach ($pictureUpdated['messages'] as $success) {
            $dialogBox->success($success);
        }
    } else {
        foreach ($pictureUpdated['messages'] as $error) {
            $dialogBox->error($error);
        }
    }
    // Validate form input
    $messageList = user_validate_form_admin_user_profile($userData, $userId);
    if (count($messageList) == 0) {
        if (empty($userData['password'])) {
            unset($userData['password']);
        }
        // Save informations
        user_set_properties($userId, $userData);
        set_user_property($userId, 'skype', $userData['skype']);