2
if (!empty($_GET['askDelete'])) {
$content .='
';
} elseif (isset($_GET['delete']) && $_GET['delete']) {
/*
* Process hiding a tools from available tools.
*/
//where $id is set?
$id = intval($id);
Database::query("DELETE FROM $tool_table WHERE c_id = $course_id AND id='$id' AND added_tool=1");
}
}
// Course legal
$enabled = api_get_plugin_setting('courselegal', 'tool_enable');
$pluginExtra = null;
if ($enabled === 'true') {
require_once api_get_path(SYS_PLUGIN_PATH).'courselegal/config.php';
$plugin = CourseLegalPlugin::create();
$pluginExtra = $plugin->getTeacherLink();
}
// COURSE ADMIN ONLY VIEW
// Start of tools for CourseAdmins (teachers/tutors)
if ($session_id === 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) {
$content .= '
';
$content .= '
';
$content .= get_lang('PleaseStandBy');
$content .= '
';
$content .= $pluginExtra;
if (api_get_setting('show_session_data') == 'true' && $session_id > 0) {
$content .= '
'.get_lang('SessionData').'
'.
CourseHome::show_session_data($session_id).'
';
}
$my_list = CourseHome::get_tools_category(TOOL_AUTHORING);
$items = CourseHome::show_tools_category($my_list);
$content .= return_block(get_lang('Authoring'), $items, 'course-tools-author');
$my_list = CourseHome::get_tools_category(TOOL_INTERACTION);
$list2 = CourseHome::get_tools_category(TOOL_COURSE_PLUGIN);
$my_list = array_merge($my_list,$list2);
$items = CourseHome::show_tools_category($my_list);
$content .= return_block(get_lang('Interaction'), $items, 'course-tools-interaction');
$my_list = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
$items = CourseHome::show_tools_category($my_list);
$content .= return_block(get_lang('Administration'), $items , 'course-tools-administration');
} elseif (api_is_coach()) {
$content .= $pluginExtra;
if (api_get_setting('show_session_data') === 'true' && $session_id > 0) {
$content .= '
'.get_lang('SessionData').'
';
$content .= CourseHome::show_session_data($session_id);
$content .= '
';
}
$content .= '';
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
$content .= CourseHome::show_tools_category($my_list);
$content .= '
';
$sessionsCopy = api_get_setting('session.allow_session_course_copy_for_teachers');
if ($sessionsCopy === 'true') {
// Adding only maintenance for coaches.
$myList = CourseHome::get_tools_category(TOOL_ADMIN_PLATFORM);
$onlyMaintenanceList = array();
foreach ($myList as $item) {
if ($item['name'] === 'course_maintenance') {
$item['link'] = 'course_info/maintenance_coach.php';
$onlyMaintenanceList[] = $item;
}
}
$items = CourseHome::show_tools_category($onlyMaintenanceList);
$content .= return_block(get_lang('Administration'), $items);
}
} else {
$tools = CourseHome::get_tools_category(TOOL_STUDENT_VIEW);
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
api_get_user_id(),
api_get_course_info()
);
// Force user icon for DRH
if ($isDrhOfCourse) {
$addUserTool = true;
foreach ($tools as $tool) {
if ($tool['name'] === 'user') {
$addUserTool = false;
break;
}
}
if ($addUserTool) {
$tools[] = array(
'c_id' => api_get_course_int_id(),
'name' => 'user',
'link' => 'user/user.php',
'image' => 'members.gif',
'visibility' => '1',
'admin' => '0',
'address' => 'squaregrey.gif',
'added_tool' => '0',
'target' => '_self',
'category' => 'interaction',
'session_id' => api_get_session_id()
);
}
}
if (count($tools) > 0) {
$content .= '';
$content .= CourseHome::show_tools_category($tools);
$content .= '
';
}
if ($isDrhOfCourse) {
$drhTool = CourseHome::get_tools_category(TOOL_DRH);
$content .= '';
$content .= CourseHome::show_tools_category($drhTool);
$content .= '
';
}
}
/**
* @param string $title
* @param string $content
* @param string $class
*
* @return string
*/
function return_block($title, $content, $class = null)
{
$html = '
'.$content.'
';
return $html;
}