$creatorediting = false;
}
- $mform = new sub_category_add_form();
- if (has_capability('moodle/category:create', $context)) {
- if ($form = $mform->get_data()) {
- $subcategory = new stdClass;
- $subcategory->name = $form->addcategory;
- $subcategory->description = $form->description;
- $subcategory->sortorder = 999;
- $subcategory->parent = $id;
- if (!insert_record('course_categories', $subcategory )) {
- notify( "Could not insert the new subcategory '$addsubcategory' " );
- }
- }
- }
-
if (has_capability('moodle/category:update', $context)) {
/// Rename the category if requested
if (!empty($rename) and confirm_sesskey()) {
}
}
-/// print option to add a subcategory
+ // Print button for creating new categories
if (has_capability('moodle/category:create', $context) && $creatorediting) {
- $cat->id = $id;
- $mform->set_data($cat);
- $mform->display();
+ unset($options);
+ $options['categoryadd'] = 1;
+ $options['id'] = $id;
+ echo '<div class="buttons">';
+ print_single_button('editcategory.php', $options, get_string('addsubcategory'), 'get');
+ echo '<br /></div>';
}
/// Print out all the courses
$straction = get_string('action');
-/// If data for a new category was submitted, then add it
- $mform = new category_add_form();
- if ($form = $mform->get_data() and has_capability('moodle/category:create', $context)) {
- if (!empty($form->addcategory)) {
- unset($newcategory);
- $newcategory->name = stripslashes_safe($form->addcategory);
- $newcategory->description = $form->description;
- $newcategory->sortorder = 999;
- if (!$newcategory->id = insert_record('course_categories', $newcategory)) {
- notify("Could not insert the new category '" . format_string($newcategory->name) . "'");
- } else {
- $newcategory->context = get_context_instance(CONTEXT_COURSECAT, $newcategory->id);
- mark_context_dirty($newcategory->context->path);
- notify(get_string('categoryadded', '', format_string($newcategory->name)));
- }
- }
- }
-
/// Unless it's an editing admin, just print the regular listing of courses/categories
if (!$adminediting) {
/// Should be a no-op 99% of the cases
fix_course_sortorder();
-/// Print form for creating new categories
-
- if (has_capability('moodle/category:create', get_context_instance(CONTEXT_SYSTEM))) {
- $mform->display();
- }
-
/// Print out the categories with all the knobs
$strcategories = get_string('categories');
echo '</table>';
echo '<div class="buttons">';
- /// Print link to create a new course
+
+ // Print link to create a new course
if (has_capability('moodle/course:create', $context)) {
unset($options);
if (!empty($category->id)) {
}
}
+ // Print button for creating new categories
+ if (has_capability('moodle/category:create', $context)) {
+ unset($options);
+ if (!empty($category->id)) {
+ $options['id'] = $category->id;
+ } else {
+ $options['id'] = 0;
+ }
+ $options['categoryadd'] = 1;
+ print_single_button('editcategory.php', $options, get_string('addnewcategory'), 'get');
+ }
+
if (has_capability('moodle/site:approvecourse', $sysctx) and !empty($CFG->enablecourserequests)) {
print_single_button('pending.php',NULL, get_string('coursespending'), 'get');
}
static $str = '';
if (empty($str)) {
+ $str->edit = get_string('edit');
$str->delete = get_string('delete');
$str->moveup = get_string('moveup');
$str->movedown = get_string('movedown');
echo '<td class="icons">'; /// Print little icons
+ if (has_capability('moodle/category:update', $category->context)) {
+ echo '<a title="'.$str->edit.'" href="editcategory.php?id='.$category->id.'&sesskey='.sesskey().'"><img'.
+ ' src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.$str->edit.'" /></a> ';
+ }
+
if (has_capability('moodle/category:delete', $category->context)) {
echo '<a title="'.$str->delete.'" href="index.php?delete='.$category->id.'&sesskey='.sesskey().'"><img'.
' src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.$str->delete.'" /></a> ';
$string['categorydeleted'] = 'The category \'$a\' was deleted';
$string['categoryduplicate'] = 'A category named \'$a\' already exists!';
$string['categoryname'] = 'Category name';
+$string['categoryupdated'] = 'The category \'$a\' was updated';
$string['changedpassword'] = 'Changed password';
$string['changepassword'] = 'Change password';
$string['changessaved'] = 'Changes saved';
$string['edhelpfontlist'] = 'Define the fonts used on editors dropdown menu.';
$string['edhelpfontsize'] = 'The default font-size sets the size of a font. <br />Valid values are for example: medium, large, smaller, larger, 10pt, 11px.';
$string['edit'] = 'Edit $a';
+$string['editcategorysettings'] = 'Edit category settings';
$string['editcoursesettings'] = 'Edit course settings';
$string['editfiles'] = 'Edit files';
$string['editgroupprofile'] = 'Edit group profile';
$string['outlinereport'] = 'Outline report';
$string['page'] = 'Page';
$string['pageheaderconfigablock'] = 'Configuring a block in %%fullname%%';
+$string['parentcategory'] = 'Parent category';
$string['parentcoursenotfound'] = 'Parent course not found!';
$string['parentcoursenotmetacourse'] = 'Parent course not metacourse!';
$string['parentfolder'] = 'Parent folder';
$string['authenticationplugins'] = 'Authentication Plugins';
$string['chooseauthmethod'] = 'Choose authentication plugin';
-?>
\ No newline at end of file
+?>