]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10181, user management improvements fixes
authortoyomoyo <toyomoyo>
Fri, 13 Jul 2007 08:26:47 +0000 (08:26 +0000)
committertoyomoyo <toyomoyo>
Fri, 13 Jul 2007 08:26:47 +0000 (08:26 +0000)
12 files changed:
lang/en_utf8/help/notes.php [new file with mode: 0755]
lang/en_utf8/help/notes/status.html [new file with mode: 0755]
notes/add.php
notes/delete.php
notes/edit.php
notes/edit_form.php
notes/index.php
notes/lib.php
notes/version.php
theme/standard/styles_layout.css
user/addnote.php
user/groupaddnote.php

diff --git a/lang/en_utf8/help/notes.php b/lang/en_utf8/help/notes.php
new file mode 100755 (executable)
index 0000000..7840ca6
--- /dev/null
@@ -0,0 +1,30 @@
+<?php // $Id$\r
+      // note.php \r
+\r
+$string['note'] = 'Note';\r
+$string['notes'] = 'Notes';\r
+$string['sitenotes'] = 'Site notes';\r
+$string['coursenotes'] = 'Course notes';\r
+$string['personalnotes'] = 'Personal notes';\r
+$string['created'] = 'created';\r
+$string['nonotes'] = 'There are no notes.';\r
+$string['notesnotvisible'] = 'You are not allowed to view the notes.';\r
+$string['addnewnote'] = 'Add a new note';\r
+$string['editnote'] = 'Edit note';\r
+$string['groupaddnewnote'] = 'Add a new note for all';\r
+$string['deleteconfirm'] = 'Delete this note?';\r
+$string['content'] = 'Content';\r
+$string['nocontent'] = 'Note content can not be empty';\r
+$string['nouser'] = 'You must select a user';\r
+$string['rating'] = 'Rating';\r
+$string['low'] = 'low';\r
+$string['belownormal'] = 'below normal';\r
+$string['normal'] = 'normal';\r
+$string['abovenormal'] = 'above normal';\r
+$string['high'] = 'high';\r
+$string['unknown'] = 'unknown';\r
+$string['bynameondate'] = 'by $a->name - $a->date';\r
+$string['publishstate'] = 'Status';\r
+$string['personal'] = 'personal';\r
+$string['course'] = 'course';\r
+$string['site'] = 'site';
\ No newline at end of file
diff --git a/lang/en_utf8/help/notes/status.html b/lang/en_utf8/help/notes/status.html
new file mode 100755 (executable)
index 0000000..1034e93
--- /dev/null
@@ -0,0 +1,8 @@
+<h1>Status</h1>\r
+\r
+<p>There are 3 possible settings here</p>\r
+<ul>\r
+<li><strong>Personal</strong> - The note will be visible only to you</li>\r
+<li><strong>Course</strong> - The note will be visible to teachers in this course</li>\r
+<li><strong>Site</strong> - The note will be visible to teachers in all courses</li>\r
+</ul>
\ No newline at end of file
index 60fbb91d3c6f35c58ec4e94c1d930cd25f2b4aaf..5dfebf3f8cfee55d5f69d6c62d285e78e0d75961 100644 (file)
@@ -11,6 +11,8 @@ $userid        = optional_param('user', 0, PARAM_INT);
 if (!($course = get_record('course', 'id', $courseid))) {\r
     error('Incorrect course id found');\r
 }\r
+// require login to access notes\r
+require_login($course->id);\r
 \r
 // locate context information\r
 $context = get_context_instance(CONTEXT_COURSE, $course->id);\r
@@ -46,7 +48,6 @@ if ($formdata = $noteform->get_data()) {
     $note->courseid = $formdata->course;\r
     $note->content = $formdata->content;\r
     $note->format = FORMAT_PLAIN;\r
-    $note->rating = $formdata->rating;\r
     $note->userid = $formdata->user;\r
     $note->publishstate = $formdata->publishstate;\r
     if (note_save($note)) {\r
@@ -65,12 +66,13 @@ if($noteform->is_submitted()) {
     $note->id = 0;\r
     $note->course = $courseid;\r
     $note->user = $userid;\r
-    \r
+    $note->publishstate = optional_param('state', NOTES_STATE_PUBLIC, PARAM_ALPHA);\r
 }\r
 $noteform->set_data($note);\r
-$strnotes = get_string('notes', 'notes');\r
+$strnotes = get_string('addnewnote', 'notes');\r
 \r
 // output HTML\r
-print_header($course->shortname . ': ' . $strnotes, $course->fullname);\r
+$crumbs = array(array('name' => $strnotes, 'link' => '', 'type' => 'activity'));\r
+print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($crumbs));\r
 $noteform->display();\r
 print_footer();\r
index e7de35cda97340dfe82c1993aad801926230e8ec..574d7d270cbf6218062c3f73a454a8c0150e63f1 100644 (file)
@@ -15,6 +15,8 @@ if (!$note = note_load($noteid)) {
 if (!$course = get_record('course', 'id', $note->courseid)) {\r
     error('Incorrect course id found');\r
 }\r
+// require login to access notes\r
+require_login($course->id);\r
 \r
 // locate context information\r
 $context = get_context_instance(CONTEXT_COURSE, $course->id);\r
@@ -38,9 +40,12 @@ if (data_submitted() && confirm_sesskey()) {
     $strnotes = get_string('notes', 'notes');\r
     $optionsyes = array('note'=>$noteid, 'sesskey'=>sesskey());\r
     $optionsno = array('course'=>$course->id, 'user'=>$note->userid);\r
-    print_header($course->shortname . ': ' . $strnotes, $course->fullname);\r
+\r
+// output HTML\r
+    $crumbs = array(array('name' => $strnotes, 'link' => '', 'type' => 'activity'));\r
+    print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($crumbs));\r
     notice_yesno(get_string('deleteconfirm', 'notes'), 'delete.php', 'index.php', $optionsyes, $optionsno, 'post', 'get');\r
     echo '<br />';\r
     note_print($note, NOTES_SHOW_BODY | NOTES_SHOW_HEAD);\r
     print_footer();\r
-}\r
+}
\ No newline at end of file
index 48c04d4291c1f7fffd41adeda89ed78809e76c5b..e16b867e415561898c4ed743296deb7d56d80b0c 100644 (file)
@@ -15,6 +15,8 @@ if (!$note = note_load($noteid)) {
 if (!$course = get_record('course', 'id', $note->courseid)) {\r
     error('Incorrect course id found');\r
 }\r
+// require login to access notes\r
+require_login($course->id);\r
 \r
 // locate context information\r
 $context = get_context_instance(CONTEXT_COURSE, $course->id);\r
@@ -54,7 +56,6 @@ if ($formdata = $noteform->get_data()){
     $note->userid = $formdata->user;\r
     $note->content = $formdata->content;\r
     $note->format = FORMAT_PLAIN;\r
-    $note->rating = $formdata->rating;\r
     $note->publishstate = $formdata->publishstate;\r
     if (note_save($note)) {\r
         add_to_log($note->courseid, 'notes', 'update', 'index.php?course='.$note->courseid.'&amp;user='.$note->userid . '#note-' . $note->id, 'update note');\r
@@ -74,9 +75,10 @@ if($noteform->is_submitted()) {
     $note->note = $note->id;\r
 }\r
 $noteform->set_data($note);\r
-$strnotes = get_string('notes', 'notes');\r
+$strnotes = get_string('editnote', 'notes');\r
 \r
 // output HTML\r
-print_header($course->shortname . ': ' . $strnotes, $course->fullname);\r
+$crumbs = array(array('name' => $strnotes, 'link' => '', 'type' => 'activity'));\r
+print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_navigation($crumbs));\r
 $noteform->display();\r
 print_footer();\r
index 0816f1c661fddbdd61a71e6c63cb199d4fa3ccd6..30638a92233b9935617d5b718ee0c6e974dfd55d 100644 (file)
@@ -6,23 +6,22 @@ class note_edit_form extends moodleform {
 \r
     function definition() {\r
         $mform    =& $this->_form;\r
-\r
-        $mform->addElement('header', 'general', get_string('general', 'form'));\r
+        $strcontent = get_string('content', 'notes');\r
+        $strpublishstate = get_string('publishstate', 'notes');\r
+        $mform->addElement('header', 'general', get_string('note', 'notes'));\r
 \r
         $mform->addElement('select', 'user', get_string('user'), $this->_customdata['userlist']);\r
         $mform->addRule('user', get_string('nouser', 'notes'), 'required', null, 'client');\r
 \r
-        $mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows'=>15, 'cols'=>40));\r
+        $mform->addElement('textarea', 'content', $strcontent, array('rows'=>15, 'cols'=>40));\r
         $mform->setType('content', PARAM_RAW);\r
         $mform->addRule('content', get_string('nocontent', 'notes'), 'required', null, 'client');\r
-        $mform->setHelpButton('content', array('writing', 'richtext'), false, 'editorhelpbutton');\r
-\r
-        $mform->addElement('select', 'rating', get_string('rating', 'notes'), note_get_rating_names());\r
-        $mform->setDefault('rating', 3);\r
+        $mform->setHelpButton('content', 'writing');\r
 \r
-        $mform->addElement('select', 'publishstate', get_string('publishstate', 'notes'), note_get_state_names());\r
+        $mform->addElement('select', 'publishstate', $strpublishstate, note_get_state_names());\r
         $mform->setDefault('publishstate', NOTES_STATE_PUBLIC);\r
         $mform->setType('publishstate', PARAM_ALPHA);\r
+        $mform->setHelpButton('publishstate', array('status', $strpublishstate, 'notes'));\r
 \r
         $this->add_action_buttons();\r
 \r
index 1720558742f0de1621039e9f5fc3e34d12a95ca5..021be395dbbf1fafe8ad0944c896c8ff854a47ca 100644 (file)
@@ -51,27 +51,38 @@ print_header($course->shortname . ': ' . $strnotes, $course->fullname, build_nav
 \r
 require_once($CFG->dirroot .'/user/tabs.php');\r
 \r
+$strsitenotes = get_string('sitenotes', 'notes');\r
+$strcoursenotes = get_string('coursenotes', 'notes');\r
+$strpersonalnotes = get_string('personalnotes', 'notes');\r
+$straddnewnote = get_string('addnewnote', 'notes');\r
+\r
 if($courseid != SITEID) {\r
+    echo '<a href="#sitenotes">' . $strsitenotes . '</a> | <a href="#coursenotes">' . $strcoursenotes . '</a> | <a href="#personalnotes">' . $strpersonalnotes . '</a>';\r
     $context = get_context_instance(CONTEXT_COURSE, $courseid);\r
-    if (has_capability('moodle/notes:manage', $context)) {\r
-        $addlink = $CFG->wwwroot .'/notes/add.php?course=' . $courseid . '&amp;user=' . $userid;\r
-        echo '<p><a href="'. $addlink . '">' . get_string('addnewnote', 'notes') . '</a></p>';\r
-    }\r
-    note_print_notes(get_string('sitenotes', 'notes'), $context, 0, $userid, NOTES_STATE_SITE, 0);\r
-    note_print_notes(get_string('coursenotes', 'notes'), $context, $courseid, $userid, NOTES_STATE_PUBLIC, 0);\r
-    note_print_notes(get_string('personalnotes', 'notes'), $context, $courseid, $userid, NOTES_STATE_DRAFT, $USER->id);\r
+    $addid = has_capability('moodle/notes:manage', $context) ? $courseid : 0;\r
+    $view = has_capability('moodle/notes:view', $context);\r
+    note_print_notes('<a name="sitenotes"></a>' . $strsitenotes, $addid, $view, 0, $userid, NOTES_STATE_SITE, 0);\r
+    note_print_notes('<a name="coursenotes"></a>' . $strcoursenotes, $addid, $view, $courseid, $userid, NOTES_STATE_PUBLIC, 0);\r
+    note_print_notes('<a name="personalnotes"></a>' . $strpersonalnotes, $addid, $view, $courseid, $userid, NOTES_STATE_DRAFT, $USER->id);\r
 } else {\r
-    $context = get_context_instance(CONTEXT_SYSTEM);\r
-    note_print_notes(get_string('sitenotes', 'notes'), $context, 0, $userid, NOTES_STATE_SITE, 0);\r
+    echo '<a href="#sitenotes">' . $strsitenotes . '</a> | <a href="#coursenotes">' . $strcoursenotes . '</a>';\r
+    $view = has_capability('moodle/notes:view', get_context_instance(CONTEXT_SYSTEM));\r
+    note_print_notes('<a name="sitenotes"></a>' . $strsitenotes, 0, $view, 0, $userid, NOTES_STATE_SITE, 0);\r
+    echo '<a name="coursenotes"></a>';\r
     if($userid) {\r
         $courses = get_my_courses($userid);\r
         foreach($courses as $c) {\r
             $header = '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $c->id . '">' . $c->fullname . '</a>';\r
-            note_print_notes($header, $context, $c->id, $userid, NOTES_STATE_PUBLIC, 0);\r
+            if (has_capability('moodle/notes:manage', get_context_instance(CONTEXT_COURSE, $c->id))) {\r
+                $addid = $c->id;\r
+            }else {\r
+                $addid = 0;\r
+            }\r
+            note_print_notes($header, $addid, $view, $c->id, $userid, NOTES_STATE_PUBLIC, 0);\r
         }\r
     }\r
 }    \r
 \r
 add_to_log($courseid, 'notes', 'view', 'index.php?course='.$courseid.'&amp;user='.$userid, 'view notes');\r
 \r
-print_footer($course);\r
+print_footer($course);
\ No newline at end of file
index b097580ceb26fa23d603993418a845cc49d6897b..7dfd6ffdd8362dbff97ef63cd2d3da008ea0036e 100644 (file)
@@ -4,15 +4,6 @@
  * Library of functions and constants for notes\r
  */\r
 \r
-/**\r
- * Constants for ratings.\r
- */\r
-define('NOTES_RATING_LOW', '1');\r
-define('NOTES_RATING_BELOWNORMAL', '2');\r
-define('NOTES_RATING_NORMAL', '3');\r
-define('NOTES_RATING_ABOVENORMAL', '4');\r
-define('NOTES_RATING_HIGH', '5');\r
-\r
 /**\r
  * Constants for states.\r
  */\r
@@ -57,7 +48,7 @@ function note_list($courseid=0, $userid=0, $state = '', $author = 0, $order='las
     }\r
     $selects[] = 'module="notes"';\r
     $select = implode(' AND ', $selects);\r
-    $fields = 'id,courseid,userid,content,format,rating,created,lastmodified,usermodified,publishstate';\r
+    $fields = 'id,courseid,userid,content,format,created,lastmodified,usermodified,publishstate';\r
     // retrieve data\r
     $rs =& get_recordset_select('post', $select, $order, $fields, $limitfrom, $limitnum);\r
     return recordset_to_array($rs);\r
@@ -70,7 +61,7 @@ function note_list($courseid=0, $userid=0, $state = '', $author = 0, $order='las
  * @return note object\r
  */\r
 function note_load($note_id) {\r
-    $fields = 'id,courseid,userid,content,format,rating,created,lastmodified,usermodified,publishstate';\r
+    $fields = 'id,courseid,userid,content,format,created,lastmodified,usermodified,publishstate';\r
     return get_record_select('post', 'id=' . $note_id . ' AND module="notes"', $fields);\r
 }\r
 \r
@@ -87,9 +78,6 @@ function note_save(&$note) {
     $note->module = 'notes';\r
     $note->lastmodified = time();\r
     $note->usermodified = $USER->id;\r
-    if(empty($note->rating)) {\r
-        $note->rating = NOTES_RATING_NORMAL;\r
-    }\r
     if(empty($note->format)) {\r
         $note->format = FORMAT_PLAIN;\r
     }\r
@@ -124,36 +112,6 @@ function note_delete($noteid) {
     return delete_records_select('post', 'id=' . $noteid . ' AND module="notes"');\r
 }\r
 \r
-/**\r
- * Converts a rating value to its corespondent name\r
- *\r
- * @param int    $rating rating value to convert\r
- * @return string corespondent rating name\r
- */\r
-function note_get_rating_name($rating) {\r
-    // cache rating names\r
-    static $ratings;\r
-    if (empty($ratings)) {\r
-        $ratings =& note_get_rating_names();\r
-    }\r
-    return @$ratings[$rating];\r
-}\r
-\r
-/**\r
- * Returns an array of mappings from rating values to rating names\r
- *\r
- * @return array of mappings\r
- */\r
-function note_get_rating_names() {\r
-    return array(\r
-        1 => get_string('low', 'notes'),\r
-        2 => get_string('belownormal', 'notes'),\r
-        3 => get_string('normal', 'notes'),\r
-        4 => get_string('abovenormal', 'notes'),\r
-        5 => get_string('high', 'notes'),\r
-    );\r
-}\r
-\r
 /**\r
  * Converts a state value to its corespondent name\r
  *\r
@@ -200,13 +158,12 @@ function note_print($note, $detail = NOTES_SHOW_FULL) {
         ($note->usermodified == $USER->id ? ' ownnotepost' : '')  .\r
         '" id="note-'. $note->id .'">';\r
 \r
-    // print note head (e.g. author, user refering to, rating, etc)\r
+    // print note head (e.g. author, user refering to, etc)\r
     if($detail & NOTES_SHOW_HEAD) {\r
         echo '<div class="header">';\r
         echo '<div class="user">';\r
         print_user_picture($user->id, $note->courseid, $user->picture);\r
         echo fullname($user) . '</div>';\r
-        echo '<div class="rating rating' . $note->rating . '">' . get_string('rating', 'notes') . ': ' . note_get_rating_name($note->rating) . '</div>';\r
         echo '<div class="info">' . \r
             get_string('bynameondate', 'notes', $authoring) . \r
             ' (' . get_string('created', 'notes') . ': ' . userdate($note->created) . ')</div>';\r
@@ -224,10 +181,10 @@ function note_print($note, $detail = NOTES_SHOW_FULL) {
     if($detail & NOTES_SHOW_FOOT) {\r
         if (has_capability('moodle/notes:manage', $sitecontext) && $note->publishstate == NOTES_STATE_SITE || \r
             has_capability('moodle/notes:manage', $context) && ($note->publishstate == NOTES_STATE_PUBLIC || $note->usermodified == $USER->id)) {\r
-            echo '<div class="footer">';\r
-            echo '<a href="'.$CFG->wwwroot.'/notes/edit.php?note='.$note->id. '">'. get_string('edit') .'</a>';\r
+            echo '<div class="footer"><p>';\r
+            echo '<a href="'.$CFG->wwwroot.'/notes/edit.php?note='.$note->id. '">'. get_string('edit') .'</a> | ';\r
             echo '<a href="'.$CFG->wwwroot.'/notes/delete.php?note='.$note->id. '">'. get_string('delete') .'</a>';\r
-            echo '</div>';\r
+            echo '</p></div>';\r
         }\r
     }\r
     echo '</div>';\r
@@ -253,19 +210,23 @@ function note_print_list($notes, $detail = NOTES_SHOW_FULL) {
  * Retrieves and prints a list of note objects with specific atributes.\r
  *\r
  * @param string  $header HTML to print above the list\r
- * @param object  $context context in which the notes will be displayed (used to check capabilities)\r
+ * @param int     $addcourseid id of the course for the add notes link (0 hide link)\r
+ * @param boolean $viewnotes true if the notes should be printed; false otherwise (print notesnotvisible string)\r
  * @param int     $courseid id of the course in which the notes were posted (0 means any)\r
  * @param int     $userid id of the user to which the notes refer (0 means any)\r
  * @param string  $state state of the notes (i.e. draft, public, site) ('' means any)\r
  * @param int     $author id of the user who modified the note last time (0 means any)\r
  */\r
-function note_print_notes($header, $context, $courseid = 0, $userid = 0, $state = '', $author = 0)\r
+function note_print_notes($header, $addcourseid = 0, $viewnotes = true, $courseid = 0, $userid = 0, $state = '', $author = 0)\r
 {\r
     global $CFG;\r
     if ($header) {\r
         echo '<h3 id="notestitle">' . $header . '</h3>';\r
     }\r
-    if (has_capability('moodle/notes:view', $context)) {\r
+    if ($addcourseid) {\r
+        echo '<p><a href="'. $CFG->wwwroot .'/notes/add.php?course=' . $addcourseid . '&amp;user=' . $userid . '&amp;state=' . $state . '">' . get_string('addnewnote', 'notes') . '</a></p>';\r
+    }\r
+    if ($viewnotes) {\r
         $notes =& note_list($courseid, $userid, $state, $author);\r
         if($notes) {\r
             note_print_list($notes);\r
@@ -275,4 +236,4 @@ function note_print_notes($header, $context, $courseid = 0, $userid = 0, $state
     } else {\r
         echo '<p>' . get_string('notesnotvisible', 'notes') . '</p>';\r
     }\r
-}\r
+}
\ No newline at end of file
index fe471b86d92d1e81a98edce6e966de4fafa32e87..1b804de7b197d8ed1a945fccb40a9c3ca5c35076 100644 (file)
@@ -5,5 +5,5 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php\r
 /////////////////////////////////////////////////////////////////////////////////\r
 \r
-$note_version  = 2007070300;  // The current version of note module (Date: YYYYMMDDXX)\r
+$note_version  = 2007070700;  // The current version of note module (Date: YYYYMMDDXX)\r
 $module->cron     = 1800;           // Period for cron to check this module (secs)\r
index cee5b695e7a62e6886ef2fa3ac741518b90aa8b9..d9573842d2fde1b5afff6f1e84124b13e4812abd 100644 (file)
@@ -2377,10 +2377,9 @@ body#message-messages {
  ***/
 .notepost {
     margin-bottom: 1em;
-    background-color: #F0F0F0;
+    background-color: #EEE;
 }
 .sitenotepost {
-    background-color: #FFFFF0;
 }
 .coursenotepost {
 }
@@ -2393,6 +2392,8 @@ body#message-messages {
 }
 
 .notepost .header {
+    background: #DDD;
+    padding: 5px;
 }
 
 .notepost .user {
@@ -2401,22 +2402,19 @@ body#message-messages {
 
 .notepost .userpicture {
     float: left;
-    margin: 5px;
+    margin-right: 5px;
 }
-.notepost .rating5 {
-    color: red;
-}
-.notepost .rating1 {
-    color: orange;
-}
-.notepost .info, .notepost .rating {
+
+.notepost .info {
     font-size: smaller;
 }
 
 .notepost .content {
+    clear: both;
 }
 
 .notepost .footer {
+    clear: both;
 }
 
 /***
index 731e283bf145bdacf0018cd574b8ca26d7b9d643..07adf8127d8a1663adf95463d3b06db1ff60f55a 100644 (file)
@@ -5,7 +5,6 @@ require_once($CFG->dirroot .'/notes/lib.php');
 $id    = required_param('id', PARAM_INT);              // course id\r
 $users = optional_param('userid', array(), PARAM_INT); // array of user id\r
 $contents = optional_param('contents', array(), PARAM_RAW); // array of user notes\r
-$ratings = optional_param('ratings', array(), PARAM_INT); // array of notes ratings\r
 $states = optional_param('states', array(), PARAM_ALPHA); // array of notes states\r
 if (! $course = get_record('course', 'id', $id)) {\r
     error("Course ID is incorrect");\r
@@ -18,7 +17,7 @@ require_login($course->id);
 require_capability('moodle/notes:manage', $context);\r
 \r
 if (!empty($users) && confirm_sesskey()) {\r
-    if (count($users) != count($contents) || count($users) != count($ratings) || count($users) != count($states)) {\r
+    if (count($users) != count($contents) || count($users) != count($states)) {\r
         error('Parameters malformation', $CFG->wwwroot.'/user/index.php?id='.$id);\r
     }\r
 \r
@@ -31,7 +30,6 @@ if (!empty($users) && confirm_sesskey()) {
         }\r
         $note->id = 0;\r
         $note->content = $contents[$k];\r
-        $note->rating = $ratings[$k];\r
         $note->publishstate = $states[$k];\r
         $note->userid = $v;\r
         if (note_save($note)) {\r
@@ -59,9 +57,11 @@ print_heading($straddnote);
 echo '<form method="post" action="addnote.php">';\r
 echo '<input type="hidden" name="id" value="'.$course->id.'" />';\r
 echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';\r
-$table->head  = array (get_string('fullname'), get_string('content', 'notes'), get_string('rating', 'notes'), get_string('publishstate', 'notes'), );\r
-$table->align = array ('left', 'center', 'center', 'center');\r
-$rating_names = note_get_rating_names();\r
+$table->head  = array (get_string('fullname'), \r
+    get_string('content', 'notes') . helpbutton('writing', get_string('helpwriting'), 'moodle', true, false, '', true), \r
+    get_string('publishstate', 'notes') . helpbutton('status', get_string('publishstate', 'notes'), 'notes', true, false, '', true), \r
+    );\r
+$table->align = array ('left', 'center', 'center');\r
 $state_names = note_get_state_names();\r
 \r
 // the first time list hack\r
@@ -77,13 +77,11 @@ foreach ($users as $k => $v) {
     if(!$user = get_record('user', 'id', $v)) {\r
         continue;\r
     }\r
-    $checkbox = choose_from_menu($rating_names, 'ratings[' . $k . ']', empty($ratings[$k]) ? NOTES_RATING_NORMAL : $ratings[$k], '', '', '0', true);\r
-    $checkbox2 = choose_from_menu($state_names, 'states[' . $k . ']', empty($states[$k]) ? NOTES_STATE_PUBLIC : $states[$k], '', '', '0', true);\r
+    $checkbox = choose_from_menu($state_names, 'states[' . $k . ']', empty($states[$k]) ? NOTES_STATE_PUBLIC : $states[$k], '', '', '0', true);\r
     $table->data[] = array(\r
         '<input type="hidden" name="userid['.$k.']" value="'.$v.'" />'. fullname($user, true),\r
-        '<textarea name="contents['. $k . ']" rows="2" cols="30">' . strip_tags(@$contents[$k]) . '</textarea>',\r
-        $checkbox,\r
-        $checkbox2,\r
+        '<textarea name="contents['. $k . ']" rows="2" cols="40">' . strip_tags(@$contents[$k]) . '</textarea>',\r
+        $checkbox\r
     );\r
 }\r
 print_table($table);\r
index c0fa9562c0407247e76e3a34a96004816a97e311..4b88a9d1c583951e4fd642d0591d85e51d85ecf6 100644 (file)
@@ -5,7 +5,6 @@ require_once($CFG->dirroot .'/notes/lib.php');
 $id    = required_param('id', PARAM_INT);              // course id\r
 $users = optional_param('userid', array(), PARAM_INT); // array of user id\r
 $content = optional_param('content', '', PARAM_RAW); // note content\r
-$rating = optional_param('rating', 0, PARAM_INT); // note rating\r
 $state = optional_param('state', '', PARAM_ALPHA); // note publish state\r
 \r
 if (! $course = get_record('course', 'id', $id)) {\r
@@ -23,7 +22,6 @@ if (!empty($users) && !empty($content) && confirm_sesskey()) {
     $note->courseid = $id;\r
     $note->format = FORMAT_PLAIN;\r
     $note->content = $content;\r
-    $note->rating = $rating;\r
     $note->publishstate = $state;\r
     foreach ($users as $k => $v) {\r
         if(!$user = get_record('user', 'id', $v)) {\r
@@ -58,7 +56,6 @@ echo '<form method="post" action="groupaddnote.php" >';
 echo '<div style="width:100%;text-align:center;">';\r
 echo '<input type="hidden" name="id" value="'.$course->id.'" />';\r
 echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';\r
-$rating_names = note_get_rating_names();\r
 $state_names = note_get_state_names();\r
 \r
 // the first time list hack\r
@@ -70,6 +67,8 @@ if (empty($users)) {
     }\r
 }\r
 \r
+$strpublishstate = get_string('publishstate', 'notes');\r
+\r
 $userlist = array();\r
 foreach ($users as $k => $v) {\r
     if(!$user = get_record('user', 'id', $v)) {\r
@@ -82,9 +81,14 @@ echo '<p>';
 echo get_string('users'). ': ' . implode(', ', $userlist) . '.';\r
 echo '</p>';\r
 \r
-echo '<p>' . get_string('content', 'notes') . '<br /><textarea name="content" rows="5" cols="50">' . strip_tags(@$content) . '</textarea></p>';\r
-echo '<p>' . get_string('rating', 'notes') . ' ' . choose_from_menu($rating_names, 'rating', empty($rating) ? NOTES_RATING_NORMAL : $rating, '', '', '0', true) . '</p>';\r
-echo '<p>' . get_string('publishstate', 'notes') . ' ' . choose_from_menu($state_names, 'state', empty($state) ? NOTES_STATE_PUBLIC : $state, '', '', '0', true) . '</p>';\r
+echo '<p>' . get_string('content', 'notes');\r
+helpbutton('writing', get_string('helpwriting'));\r
+echo '<br /><textarea name="content" rows="5" cols="50">' . strip_tags(@$content) . '</textarea></p>';\r
+\r
+echo '<p>' . $strpublishstate;\r
+helpbutton('status', $strpublishstate, 'notes');\r
+choose_from_menu($state_names, 'state', empty($state) ? NOTES_STATE_PUBLIC : $state, '');\r
+echo '</p>';\r
 \r
 echo '<input type="submit" value="' . get_string('savechanges'). '" /></div></form>';\r
 print_footer($course);\r