$dialogBox->form($message); $action = 'list'; break; // request delete // request delete case 'rqDelete': if (!$wikiStore->wikiIdExists($wikiId)) { // die( get_lang("Invalid Wiki Id") ); $message = get_lang("Invalid Wiki Id"); $dialogBox->error($message); $action = 'error'; } else { $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);
} $form .= '<input type="submit" value="' . get_lang('Yes') . '" /> ' . "\n" . '<a href=""><input type="button" value="' . get_lang('No') . '" /></a>' . "\n" . '</form>' . "\n\n"; $dialogbox = new DialogBox(); $dialogbox->form($form); $content .= $dialogbox->render(); } if ($cmd == "rqDeleteMessage" && !is_null($messageId)) { $argDelete = makeArgLink($arguments); if ($argDelete == "") { $linkDelete = $_SERVER['PHP_SELF'] . "?"; } else { $linkDelete = $_SERVER['PHP_SELF'] . "?" . $argDelete . "&"; } $deleteConfirmation = get_lang('Are you sure to delete the message?') . '<br /><br />' . '<a href="' . $linkDelete . 'cmd=exDeleteMessage&message_id=' . $messageId . '">' . get_lang('Yes') . '</a>' . ' | <a href="' . $linkDelete . '">' . get_lang('No') . '</a>'; $dialogbox = new DialogBox(); $dialogbox->question($deleteConfirmation); $content .= $dialogbox->render(); } if ($cmd == "exDeleteMessage" && !is_null($messageId)) { $message = SentMessage::fromId($messageId); $message->delete(); } } // ---------- paging if (isset($_REQUEST['page'])) { $page = min(array($_REQUEST['page'], $box->getNumberOfPage())); $page = max(array($page, 1)); $strategy->setPageToDisplay($page); $arguments['page'] = $page; } // ------------- display
$do = 'delete'; } else { $dialogBox->error(get_lang('This course has session courses. You have to delete them before.')); } } else { switch (claro_failure::get_last_failure()) { case 'course_not_found': $dialogBox->error(get_lang('Course not found')); 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&delCode=' . $courseCode . '&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:
$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&uidToEdit=' . $req['uidToEdit'] . '">' . get_lang('Yes') . '</a>' . ' | ' . '<a href="admin_profile.php?uidToEdit=' . $req['uidToEdit'] . '">' . get_lang('No') . '</a>' . "\n"); } } else { $dialogBox->error(get_lang('Unable to delete')); } //------------------------------------ // DISPLAY //------------------------------------ $out = ''; $out .= claro_html_tool_title(get_lang('Delete user')); if (isset($dialogBox)) { $out .= $dialogBox->render(); } $out .= '<p>' . claro_html_menu_horizontal($cmdList) . '</p>'; $claroline->display->body->appendContent($out); echo $claroline->display->render();
$_SESSION['admin_user_dir'] = $_REQUEST['dir'] == 'DESC' ? 'DESC' : 'ASC'; } $addToURL = isset($_REQUEST['addToURL']) ? $_REQUEST['addToURL'] : ''; $dialogBox = new DialogBox(); //TABLES //declare needed tables // Deal with interbreadcrumbs ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $nameTools = get_lang('User list'); $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; //------------------------------------ // Execute COMMAND section //------------------------------------ switch ($cmd) { case 'rqResetAllPasswords': $dialogBox->question(get_lang('Do you really want to reset all the passwords ?') . '<br />' . '<small>' . get_lang('The platform administrators and course creators password will remain unchanged') . '</small>' . '<br />'); $dialogBox->form(' <form method="post" action="' . claro_htmlspecialchars($_SERVER['PHP_SELF']) . '">' . '<input type="hidden" name="cmd" value="exResetAllPasswords" />' . '<input id="sendEmail" type="checkbox" name="sendEmail" value="yes" checked="checked" />' . '<label for="sendEmail">' . get_lang('send new password by email') . '</label>' . '<br />' . '<small>' . get_lang('Only the users with a valid address will receive their password by email') . '</small>' . '<br />' . '<input type="submit" value="' . get_lang('Yes') . '" />' . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</form>'); $dialogBox->warning('<em>' . get_lang('This may take some time, please wait until the end of the process...') . '</em>'); break; case 'exResetAllPasswords': $userList = getAllStudentUserId(); $failedMailList = array(); $failedList = array(); $sendEmail = isset($_REQUEST['sendEmail']) && $_REQUEST['sendEmail'] ? true : false; foreach ($userList as $user) { $mailSent = FALSE; $userInfo = user_get_properties($user['id']); 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)) {
$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(); $dialogBox->info($dialogBoxMsg); $content .= '<br />' . $dialogBox->render(); } // ------------- end platform message // ------------------- render ---------------------------- $claroline->display->banner->breadcrumbs->append(get_lang('Administration'), get_path('rootAdminWeb')); $claroline->display->banner->breadcrumbs->append(get_lang('Internal messaging'), 'admin.php'); $claroline->display->banner->breadcrumbs->append(get_lang('Delete'), 'admin_delete.php?cmd=' . addslashes($_REQUEST['cmd']));
//------------------------------------ switch ($cmd) { case 'exDelete': if (user_delete($userIdReq)) { $dialogBox->success(get_lang('Deletion of the user was done sucessfully')); } else { $dialogBox->error(get_lang('You can not change your own settings!')); } break; case 'rqDelete': if (empty($userIdReq)) { $dialogBox->error(get_lang('User id missing')); } else { $user_properties = user_get_properties($userIdReq); 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="' . $_SERVER['PHP_SELF'] . '?cmd=exDelete&user_id=' . $userIdReq . '&offset=' . $offset . $addToURL . '">' . get_lang('Yes') . '</a>' . ' | ' . '<a href="' . $_SERVER['PHP_SELF'] . '">' . get_lang('No') . '</a>' . "\n"); } } } $searchInfo = prepare_search(); $isSearched = $searchInfo['isSearched']; $addtoAdvanced = $searchInfo['addtoAdvanced']; if (count($searchInfo['isSearched'])) { $isSearched = array_map('strip_tags', $isSearched); $isSearchedHTML = implode('<br />', $isSearched); } else { $isSearchedHTML = ''; } //get the search keyword, if any $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $sql = get_sql_filtered_user_list();
header('Location:./messagebox.php?box=inbox'); } elseif ($_REQUEST['cmd'] == 'rqDelete') { $displayConfirmation = true; } elseif ($_REQUEST['cmd'] == 'markUnread') { $message->markUnread(); if ($message->isDeleted()) { header('Location:./messagebox.php?box=trashbox'); } else { header('Location:./messagebox.php?box=inbox'); } } } // ------------ Prepare display -------------------- $content = ""; if ($displayConfirmation) { $dialogBox->question(get_lang('Are you sure to delete') . '<br/><br/>' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exDelete&messageId=' . $messageId . '&type=' . $type . '&userId=' . $userId . '">' . get_lang('Yes') . '</a>' . ' | ' . '<a href="' . $_SERVER['PHP_SELF'] . '?messageId=' . $messageId . '&type=' . $type . '&userId=' . $userId . '">' . get_lang('No') . '</a>' . "\n"); } $content .= $dialogBox->render(); $action = array(); if ($type == "received") { if (current_user_is_allowed_to_send_message_to_user($message->getSender())) { $action[] = '<a href="sendmessage.php?cmd=rqMessageToUser&messageId=' . $message->getId() . '&userId=' . $message->getSender() . '">' . '<img src="' . get_icon_url('replymessage') . '" alt="" />' . get_lang('Reply') . '</a>'; } if ($message->getRecipient() > 0 || claro_is_platform_admin()) { if ($message->isDeleted()) { if ($message->getRecipient() == $userId || claro_is_platform_admin()) { $action[] = ' <a href="' . $_SERVER['PHP_SELF'] . '?cmd=exRestore&messageId=' . $messageId . '&type=' . $type . '&userId=' . $userId . '">' . get_lang('Restore') . '</a>'; } } else { $javascriptDelete = ' <script type="text/javascript">
$dialogBox->form($form); } if ($cmd == 'chkMerge') { $uidToKeep = $userInput->getMandatory('uidToKeep'); $uidToRemove = $userInput->getMandatory('uidToRemove'); if ($uidToKeep == $uidToRemove) { throw new Exception(get_lang('Cannot merge one user account with itself')); } if (!user_get_properties($uidToKeep)) { throw new Exception(get_lang('User to keep not found')); } if (!user_get_properties($uidToRemove)) { throw new Exception(get_lang('User to remove not found')); } $question = '<p>' . get_lang('Merging users will alter the user data and cannot be undone. Are you sure to want to continue ?') . '</p>' . "\n" . '<form action="' . $_SERVER['PHP_SELF'] . '?cmd=exMerge" method="post">' . "\n" . '<input type="hidden" name="uidToRemove" id="uidToRemove" value="' . $uidToRemove . '" />' . "\n" . '<input type="hidden" name="uidToKeep" id="uidToKeep" value="' . $uidToKeep . '" />' . "\n" . '<input type="submit" name="continue" value="' . get_lang('Yes') . '" />' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '"><input type="button" name="cancel" value="' . get_lang('No') . '" /></a>' . "\n" . '</form>'; $dialogBox->question($question); } if ($cmd == 'exMerge') { $uidToKeep = $userInput->getMandatory('uidToKeep'); $uidToRemove = $userInput->getMandatory('uidToRemove'); if ($uidToKeep == $uidToRemove) { throw new Exception(get_lang('Cannot merge one user account with itself')); } if (!user_get_properties($uidToKeep)) { throw new Exception(get_lang('User to keep not found')); } if (!user_get_properties($uidToRemove)) { throw new Exception(get_lang('User to remove not found')); } $mergeUser = new MergeUser(); $mergeUser->merge($uidToRemove, $uidToKeep);
$confirmationDelete .= '<a href="' . $linkDelete . '">' . get_lang('Yes') . '</a> | <a href="' . $linkBack . '">' . get_lang('No') . '</a>' . "\n"; $dialogbox = new DialogBox(); $dialogbox->question($confirmationDelete); $content .= $dialogbox->render(); } if (isset($displayConfimationEmptyTrashbox) && $displayConfimationEmptyTrashbox) { $arg_emptyTrashBox = makeArgLink($link_arg); $linkEmptyTrashBox = $linkPage . "?" . $arg_emptyTrashBox; $linkBack = $linkEmptyTrashBox; if ($arg_emptyTrashBox != "") { $linkEmptyTrashBox .= "&"; } $linkEmptyTrashBox = $linkEmptyTrashBox . "cmd=exEmptyTrashBox"; $confirmationEmpty = get_lang('Empty your trashbox?') . '<br /><br />' . '<a href="' . $linkEmptyTrashBox . '">' . get_lang('Yes') . '</a> | <a href="' . $linkBack . '">' . get_lang('No') . '</a>'; $dialogbox = new DialogBox(); $dialogbox->question($confirmationEmpty); $content .= $dialogbox->render(); } // -------------------- Search form ---------------- $javascriptSearchBox = ' <script type="text/javascript"> $(document).ready(function(){ $(\'#SelectorReadStatus\').hide(); $(\'#searchStrategyBox\').hide(); $(\'#toSimpleSearch\').hide(); $(\'#toAdvancedSearch\').click(function(){ $(\'#SelectorReadStatus\').show(); $(\'#searchStrategyBox\').show(); $(\'#toAdvancedSearch\').hide();
if (get_conf('enableExerciseExportQTI')) { $dialogBoxContent .= '<li>' . "\n" . '<img src="' . get_icon_url('export') . '" alt="' . get_lang('Export in IMS QTI') . '" /> ' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize('exercise.php?cmd=exExport&exId=' . $exId)) . '">' . get_lang('Export in IMS QTI') . '</a>' . "\n" . '</li>' . "\n"; if ($exercise->getShuffle()) { $dialogBoxContent .= '<li>' . "\n" . '<img src="' . get_icon_url('export') . '" alt="' . get_lang('Export in IMS QTI (Shuffle)') . '" /> ' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize('exercise.php?cmd=exExport&exId=' . $exId . '&shuffle=1')) . '">' . get_lang('Export in IMS QTI (Shuffle)') . '</a>' . "\n" . '</li>' . "\n"; } } $dialogBoxContent .= '<li>' . "\n" . '<img src="' . get_icon_url('mime/pdf') . '" alt="' . get_lang('Export to PDF') . '" /> ' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize('exercise.php?cmd=exExportPDF&exId=' . $exId)) . '">' . get_lang('Export to PDF') . '</a>' . "\n" . '</li>' . "\n"; if ($exercise->getShuffle()) { $dialogBoxContent .= '<li>' . "\n" . '<img src="' . get_icon_url('mime/pdf') . '" alt="' . get_lang('Export to PDF (Shuffle)') . '" /> ' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize('exercise.php?cmd=exExportPDF&exId=' . $exId . '&shuffle=1')) . '">' . get_lang('Export to PDF (Shuffle)') . '</a>' . "\n" . '</li>' . "\n"; } $dialogBoxContent .= '<li>' . "\n" . '<img src="' . get_icon_url('print') . '" alt="' . get_lang('Printable version') . '" /> ' . "\n" . '<a rel="external" href="' . claro_htmlspecialchars(Url::Contextualize('exercise.php?cmd=printPreview&exId=' . $exId)) . '">' . get_lang('Printable version') . '</a>' . "\n" . '</li>' . "\n"; if ($exercise->getShuffle()) { $dialogBoxContent .= '<li>' . "\n" . '<img src="' . get_icon_url('print') . '" alt="' . get_lang('Printable version (Shuffle)') . '" /> ' . "\n" . '<a rel="external" href="' . claro_htmlspecialchars(Url::Contextualize('exercise.php?cmd=printPreview&exId=' . $exId . '&shuffle=1')) . '">' . get_lang('Printable version (Shuffle)') . '</a>' . "\n" . '</li>' . "\n"; } $dialogBoxContent .= '</ul>' . "\n"; $dialogBox->question($dialogBoxContent); } } if ($cmd == 'exExport' && get_conf('enableExerciseExportQTI') && $exId) { include_once './lib/question.class.php'; require_once './export/qti2/qti2_export.php'; require_once get_path('incRepositorySys') . '/lib/fileManage.lib.php'; require_once get_path('incRepositorySys') . '/lib/file.lib.php'; //find exercise informations $exercise = new Exercise(); $exercise->load($exId); if ($exercise->getShuffle() && isset($_REQUEST['shuffle']) && $_REQUEST['shuffle'] == 1) { $questionList = $exercise->getRandomQuestionList(); } else { $questionList = $exercise->getQuestionList(); }