Skip to content

Commit

Permalink
Make it impossible to create a category in one course as the child of…
Browse files Browse the repository at this point in the history
… a category in another course, fixing bug 2940
  • Loading branch information
gustav_delius committed May 6, 2005
1 parent e303a82 commit ab4f562
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions mod/quiz/category.php
Expand Up @@ -725,14 +725,19 @@ function publish_category($publish, $categoryid) {
/** /**
* Creates a new category with given params * Creates a new category with given params
* *
* @param int newparent * @param int $newparent id of the parent category
* @param string newcategory the name * @param string $newcategory the name for the new category
* @param string newinfo * @param string $newinfo the info field for the new category
* @param int newpublish * @param int $newpublish whether to publish the category
* @param int newcourse the id of the associated course * @param int $newcourse the id of the associated course
*/ */
function add_category($newparent, $newcategory, $newinfo, $newpublish, $newcourse) { function add_category($newparent, $newcategory, $newinfo, $newpublish, $newcourse) {


// first check that the parent category is in the correct course
if(!(get_field('quiz_categories', 'course', 'id', $newparent) == $newcourse)) {
return false;
}

$cat = NULL; $cat = NULL;
$cat->parent = $newparent; $cat->parent = $newparent;
$cat->name = $newcategory; $cat->name = $newcategory;
Expand Down

0 comments on commit ab4f562

Please sign in to comment.