Skip to content

Commit

Permalink
Add $addCourseTool flag, so a course plugin will add an icon in the c…
Browse files Browse the repository at this point in the history
…ourse home or not.

See BT#11080
  • Loading branch information
jmontoyaa committed Dec 15, 2016
1 parent 9461483 commit f8fb36d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main/inc/lib/course_home.lib.php
Expand Up @@ -505,7 +505,7 @@ public static function get_tools_category($course_tool_category, $courseId = 0,
//Other queries recover id, name, link, image, visibility, admin, address, added_tool, target, category and session_id
// but plugins are not present in the tool table, only globally and inside the course_settings table once configured
$sql = "SELECT * FROM $course_tool_table t
WHERE category = 'plugin' AND c_id = $course_id $condition_session
WHERE category = 'plugin' AND name <> 'courseblock' AND c_id = $course_id $condition_session
ORDER BY id";
$result = Database::query($sql);
break;
Expand Down
6 changes: 6 additions & 0 deletions main/inc/lib/plugin.class.php
Expand Up @@ -26,6 +26,8 @@ class Plugin
public $isCoursePlugin = false;
public $isAdminPlugin = false;
public $isMailPlugin = false;
// Adds icon in the course home
public $addCourseTool = true;

/**
* When creating a new course, these settings are added to the course, in
Expand Down Expand Up @@ -461,6 +463,10 @@ public function install_course_fields($courseId, $add_tool_link = true)
return true;
}

if ($this->addCourseTool == false) {
return true;
}

//Add an icon in the table tool list
$table = Database::get_course_table(TABLE_TOOL_LIST);
$sql = "SELECT name FROM $table
Expand Down
1 change: 1 addition & 0 deletions plugin/courseblock/CourseBlockPlugin.php
Expand Up @@ -7,6 +7,7 @@
class CourseBlockPlugin extends Plugin
{
public $isCoursePlugin = true;
public $addCourseTool = false;

// When creating a new course this settings are added to the course
public $course_settings = array(
Expand Down

0 comments on commit f8fb36d

Please sign in to comment.