parent
ebe1413535
commit
6a0f3524da
@ -0,0 +1,23 @@ |
|||||||
|
Feature: Subscribe users to the course |
||||||
|
|
||||||
|
Background: |
||||||
|
Given I am a platform administrator |
||||||
|
|
||||||
|
Scenario: Subscribe "amann" as student to the course "TEMP" |
||||||
|
Given I am on "/main/user/subscribe_user.php?keyword=amann&type=5&cidReq=TEMP" |
||||||
|
Then I should see "Aimee" |
||||||
|
Then I follow "Register" |
||||||
|
Then I should see "Aimee Mann has been registered to your course" |
||||||
|
|
||||||
|
Scenario: Unsubscribe user "amann" the course "TEMP" |
||||||
|
Given I am on "/main/user/user.php?cidReq=TEMP" |
||||||
|
Then I should see "Aimee" |
||||||
|
Then I follow "Unsubscribe" |
||||||
|
And I confirm the popup |
||||||
|
Then I should see "User is now unsubscribed" |
||||||
|
|
||||||
|
Scenario: Subscribe "acostea" as student to the course "TEMP" (leave it subscribed for further tests) |
||||||
|
Given I am on "/main/user/subscribe_user.php?keyword=acostea&type=5&cidReq=TEMP" |
||||||
|
Then I should see "Andrea" |
||||||
|
Then I follow "Register" |
||||||
|
Then I should see "Andrea Costea has been registered to your course" |
@ -0,0 +1,11 @@ |
|||||||
|
@administration |
||||||
|
Feature: Users creation via CSV |
||||||
|
|
||||||
|
Scenario: Import user via CSV |
||||||
|
Given I am a platform administrator |
||||||
|
And I am on "/main/admin/user_import.php" |
||||||
|
Then I attach the file "/main/admin/example.csv" to "import_file" |
||||||
|
Then I press "Import" |
||||||
|
Then I should see "File imported" |
||||||
|
Then I am on "main/admin/user_list.php?keyword=drbrown@example.net" |
||||||
|
Then I should see "emmert" |
@ -0,0 +1,53 @@ |
|||||||
|
Feature: Document tool |
||||||
|
In order to use the document tool |
||||||
|
The teachers should be able to create and upload files |
||||||
|
|
||||||
|
Background: |
||||||
|
Given I am a platform administrator |
||||||
|
|
||||||
|
Scenario: Create a folder |
||||||
|
Given I am on "/main/document/document.php?cidReq=TEMP&createdir=1" |
||||||
|
Then I should see "Create folder" |
||||||
|
And I fill in the following: |
||||||
|
| dirname | My new directory | |
||||||
|
And I press "Create the folder" |
||||||
|
Then I should see "Folder created" |
||||||
|
|
||||||
|
Scenario: Create a folder that already exists |
||||||
|
Given I am on "/main/document/document.php?cidReq=TEMP&createdir=1" |
||||||
|
Then I should see "Create folder" |
||||||
|
And I fill in the following: |
||||||
|
| dirname | My new directory | |
||||||
|
And I press "Create the folder" |
||||||
|
Then I should see "Unable to create the folder" |
||||||
|
|
||||||
|
Scenario: Create a HTML document |
||||||
|
Given I am on "/main/document/create_document.php?cidReq=TEMP" |
||||||
|
Then I should see "Create a rich media page / activity" |
||||||
|
Then I fill in the following: |
||||||
|
| create_document_title | My first document | |
||||||
|
And I fill in ckeditor field "content" with "This is my first document!!!" |
||||||
|
And I press "Create a rich media page / activity" |
||||||
|
Then I should see "Item added" |
||||||
|
And I should see "My first document" |
||||||
|
Then I follow "My first document" |
||||||
|
And wait for the page to be loaded |
||||||
|
Then I should see "My first document" |
||||||
|
|
||||||
|
Scenario: Upload a document |
||||||
|
Given I am on "/main/document/upload.php?cidReq=TEMP" |
||||||
|
Then I should see "Upload documents" |
||||||
|
Then I follow "Upload (Simple)" |
||||||
|
Then I attach the file "web/css/base.css" to "file" |
||||||
|
When I press "Upload file" |
||||||
|
And wait for the page to be loaded |
||||||
|
Then I should see "File upload succeeded" |
||||||
|
|
||||||
|
# Scenario: Create cloud link |
||||||
|
# Given I am on "/main/document/add_link.php?cidReq=TEMP" |
||||||
|
# Then I should see "Add a link" |
||||||
|
# And I fill in the following: |
||||||
|
# | name | My dropbox link | |
||||||
|
# | url | http://dropbox.com/sh/loremipsum/loremipsum?dl=0 | |
||||||
|
# And I press "Add link to Cloud file" |
||||||
|
# Then I should see "Cloud link added" |
@ -0,0 +1,15 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* Use this script (uncommenting the die(); line) to generate a file in |
||||||
|
* /tmp/data_users.php to replace the data_users.php file here with a much |
||||||
|
* larger number of (less realistic) users for testing purposes |
||||||
|
*/ |
||||||
|
die(); |
||||||
|
$string = "\$users[] = array('username' => 'aaaX', 'pass' => 'aaaX', 'firstname' => 'AAAX', 'lastname' => 'BBBX', 'status' => 5, 'auth_source' => 'platform', 'email' => 'aaaX@example.com', 'creator_id' => 1, 'active' => 1);\n"; |
||||||
|
$output = ''; |
||||||
|
$outputFile = '/tmp/data_users.php'; |
||||||
|
$fh = fopen($outputFile, 'a+'); |
||||||
|
for ($i=1; $i < 5000; $i++) { |
||||||
|
fwrite($fh, str_replace('X', $i, $string)); |
||||||
|
} |
||||||
|
fclose($fh); |
@ -0,0 +1,205 @@ |
|||||||
|
<?php |
||||||
|
/** |
||||||
|
* This script fixes use of id instead of iid for the learning path |
||||||
|
*/ |
||||||
|
|
||||||
|
exit; |
||||||
|
|
||||||
|
require_once '../../main/inc/global.inc.php'; |
||||||
|
|
||||||
|
/** @var The course id $courseId */ |
||||||
|
$onlyCourseId = 0; |
||||||
|
/** @var The LP id $lpId */ |
||||||
|
$lpId = 0; |
||||||
|
|
||||||
|
$courses = Database::select('id, title, code', Database::get_main_table(TABLE_MAIN_COURSE)); |
||||||
|
$tblCLp = Database::get_course_table(TABLE_LP_MAIN); |
||||||
|
$tblCLpItem = Database::get_course_table(TABLE_LP_ITEM); |
||||||
|
$toolTable = Database::get_course_table(TABLE_TOOL_LIST); |
||||||
|
|
||||||
|
$sessions = Database::select('id', Database::get_main_table(TABLE_MAIN_SESSION)); |
||||||
|
if (!empty($sessions)) { |
||||||
|
$sessions = array_column($sessions, 'id'); |
||||||
|
} else { |
||||||
|
$sessions = [0]; |
||||||
|
} |
||||||
|
|
||||||
|
foreach ($courses as $course) { |
||||||
|
if (!empty($onlyCourseId)) { |
||||||
|
if ($onlyCourseId != $course['id']) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
} |
||||||
|
$courseId = $course['id']; |
||||||
|
$sql = "SELECT * FROM $tblCLp WHERE c_id = $courseId AND iid <> id ORDER by iid"; |
||||||
|
echo 'Select all lps'; |
||||||
|
var_dump($sql); |
||||||
|
$result = Database::query($sql); |
||||||
|
|
||||||
|
$myOnlyLpList = []; |
||||||
|
if (Database::num_rows($result)) { |
||||||
|
while ($lpInfo = Database::fetch_array($result, 'ASSOC')) { |
||||||
|
$lpIid = $lpInfo['iid']; |
||||||
|
$oldId = $lpInfo['id']; |
||||||
|
$sql = "SELECT * FROM $tblCLpItem |
||||||
|
WHERE c_id = $courseId AND lp_id = $oldId ORDER by iid"; |
||||||
|
echo "<h3>$sql</h3>"; |
||||||
|
echo "New lp.iid $lpIid / old lp.id $oldId"; |
||||||
|
$items = Database::store_result(Database::query($sql),'ASSOC'); |
||||||
|
$lpInfo['lp_list'] = $items; |
||||||
|
$myOnlyLpList[] = $lpInfo; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!empty($myOnlyLpList)) { |
||||||
|
foreach ($myOnlyLpList as $lpInfo) { |
||||||
|
$lpIid = $lpInfo['iid']; |
||||||
|
$oldId = $lpInfo['id']; |
||||||
|
|
||||||
|
if (!empty($lpId)) { |
||||||
|
if ($lpId != $oldId) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (empty($lpInfo['lp_list'])) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
$items = $lpInfo['lp_list']; |
||||||
|
$itemList = []; |
||||||
|
foreach ($items as $subItem) { |
||||||
|
$itemList[$subItem['id']] = $subItem['iid']; |
||||||
|
} |
||||||
|
|
||||||
|
$variablesToFix = [ |
||||||
|
'parent_item_id', |
||||||
|
'next_item_id', |
||||||
|
'prerequisite', |
||||||
|
'previous_item_id' |
||||||
|
]; |
||||||
|
|
||||||
|
foreach ($sessions as $sessionId) { |
||||||
|
$correctLink = "lp/lp_controller.php?action=view&lp_id=$lpIid&id_session=$sessionId"; |
||||||
|
$link = "newscorm/lp_controller.php?action=view&lp_id=$oldId&id_session=$sessionId"; |
||||||
|
$secondLink = "lp/lp_controller.php?action=view&lp_id=$oldId&id_session=$sessionId"; |
||||||
|
$sql = "UPDATE $toolTable |
||||||
|
SET link = '$correctLink' |
||||||
|
WHERE c_id = $courseId AND (link = '$link' OR link ='$secondLink')"; |
||||||
|
Database::query($sql); |
||||||
|
} |
||||||
|
|
||||||
|
foreach ($items as $item) { |
||||||
|
$itemIid = $item['iid']; |
||||||
|
$itemId = $item['id']; |
||||||
|
|
||||||
|
foreach ($variablesToFix as $variable) { |
||||||
|
if (!empty($item[$variable]) && isset($itemList[$item[$variable]])) { |
||||||
|
$newId = $itemList[$item[$variable]]; |
||||||
|
$sql = "UPDATE $tblCLpItem SET $variable = $newId |
||||||
|
WHERE iid = $itemIid AND c_id = $courseId AND lp_id = $oldId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if ($item['item_type'] == 'document' && !empty($item['path'])) { |
||||||
|
$oldDocumentId = $item['path']; |
||||||
|
$sql = "SELECT * FROM c_document WHERE c_id = $courseId AND id = $oldDocumentId"; |
||||||
|
$resultDocument = Database::query($sql); |
||||||
|
if (Database::num_rows($resultDocument)) { |
||||||
|
$document = Database::fetch_array($resultDocument, 'ASSOC'); |
||||||
|
$newDocumentId = $document['iid']; |
||||||
|
if (!empty($newDocumentId)) { |
||||||
|
$sql = "UPDATE $tblCLpItem SET path = $newDocumentId |
||||||
|
WHERE iid = $itemIid AND c_id = $courseId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// c_lp_view |
||||||
|
$sql = "UPDATE c_lp_view SET last_item = $itemIid |
||||||
|
WHERE c_id = $courseId AND last_item = $itemId AND lp_id = $oldId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
// c_lp_item_view |
||||||
|
$sql = "UPDATE c_lp_item_view SET lp_item_id = $itemIid |
||||||
|
WHERE c_id = $courseId AND lp_item_id = $itemId "; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
// Update track_exercises |
||||||
|
$sql = "UPDATE track_e_exercises SET orig_lp_item_id = $itemIid |
||||||
|
WHERE c_id = $courseId AND orig_lp_id = $oldId AND orig_lp_item_id = $itemId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
// c_forum_thread |
||||||
|
$sql = "UPDATE c_forum_thread SET lp_item_id = $itemIid |
||||||
|
WHERE c_id = $courseId AND lp_item_id = $itemId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
// orig_lp_item_view_id |
||||||
|
$sql = "SELECT * FROM c_lp_view |
||||||
|
WHERE c_id = $courseId AND lp_id = $oldId"; |
||||||
|
$itemViewList = Database::store_result(Database::query($sql),'ASSOC'); |
||||||
|
if ($itemViewList) { |
||||||
|
foreach ($itemViewList as $itemView) { |
||||||
|
$userId = $itemView['user_id']; |
||||||
|
$oldItemViewId = $itemView['id']; |
||||||
|
$newItemView = $itemView['iid']; |
||||||
|
if (empty($oldItemViewId)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
$sql = "UPDATE track_e_exercises |
||||||
|
SET orig_lp_item_view_id = $newItemView |
||||||
|
WHERE |
||||||
|
c_id = $courseId AND |
||||||
|
orig_lp_id = $oldId AND |
||||||
|
orig_lp_item_id = $itemIid AND |
||||||
|
orig_lp_item_view_id = $oldItemViewId AND |
||||||
|
exe_user_id = $userId |
||||||
|
"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
$sql = "UPDATE $tblCLpItem SET lp_id = $lpIid |
||||||
|
WHERE c_id = $courseId AND lp_id = $oldId AND id = $itemId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
$sql = "UPDATE $tblCLpItem SET id = iid |
||||||
|
WHERE c_id = $courseId AND lp_id = $oldId AND id = $itemId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
} |
||||||
|
|
||||||
|
$sql = "UPDATE c_lp_view SET lp_id = $lpIid WHERE c_id = $courseId AND lp_id = $oldId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
$sql = "UPDATE c_forum_forum SET lp_id = $lpIid WHERE c_id = $courseId AND lp_id = $oldId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
// Update track_exercises |
||||||
|
$sql = "UPDATE track_e_exercises SET orig_lp_id = $lpIid |
||||||
|
WHERE c_id = $courseId AND orig_lp_id = $oldId"; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
|
||||||
|
$sql = "UPDATE $tblCLp SET id = iid WHERE c_id = $courseId AND id = $oldId "; |
||||||
|
Database::query($sql); |
||||||
|
var_dump($sql); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
echo 'finished'; |
Loading…
Reference in new issue