|
|
|
@ -1,4 +1,5 @@ |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
|
|
// Name of the language file that needs to be included |
|
|
|
// Name of the language file that needs to be included |
|
|
|
$language_file = 'group'; |
|
|
|
$language_file = 'group'; |
|
|
|
@ -10,6 +11,10 @@ $current_course_tool = TOOL_GROUP; |
|
|
|
// Notice for unauthorized people. |
|
|
|
// Notice for unauthorized people. |
|
|
|
api_protect_course_script(true); |
|
|
|
api_protect_course_script(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!api_is_allowed_to_edit(false, true)) { |
|
|
|
|
|
|
|
api_not_allowed(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$nameTools = get_lang('Import'); |
|
|
|
$nameTools = get_lang('Import'); |
|
|
|
|
|
|
|
|
|
|
|
/* Libraries */ |
|
|
|
/* Libraries */ |
|
|
|
@ -29,13 +34,11 @@ $form->addElement('button', 'submit', get_lang('Import')); |
|
|
|
if ($form->validate()) { |
|
|
|
if ($form->validate()) { |
|
|
|
$groupData = Import::csv_reader($_FILES['file']['tmp_name']); |
|
|
|
$groupData = Import::csv_reader($_FILES['file']['tmp_name']); |
|
|
|
$result = GroupManager::importCategoriesAndGroupsFromArray($groupData); |
|
|
|
$result = GroupManager::importCategoriesAndGroupsFromArray($groupData); |
|
|
|
//var_dump($result); |
|
|
|
|
|
|
|
if (!empty($result)) { |
|
|
|
if (!empty($result)) { |
|
|
|
$html = null; |
|
|
|
$html = null; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($result as $status => $data) { |
|
|
|
foreach ($result as $status => $data) { |
|
|
|
$html .= " <h3>".get_lang(ucfirst($status)).' </h3>'; |
|
|
|
$html .= " <h3>".get_lang(ucfirst($status)).' </h3>'; |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($data['category'])) { |
|
|
|
if (!empty($data['category'])) { |
|
|
|
$html .= "<h4> ".get_lang('Categories').':</h4>'; |
|
|
|
$html .= "<h4> ".get_lang('Categories').':</h4>'; |
|
|
|
foreach ($data['category'] as $category) { |
|
|
|
foreach ($data['category'] as $category) { |
|
|
|
|