172186b8 |
1 | <?php |
2 | /// library functions for messaging |
3 | |
4 | /// todo: add some functions |
5 | |
6 | |
7 | function message_print_contacts() { |
8 | global $USER; |
9 | $contacts = get_records('message_contacts', 'userid', $USER->id, '', 'id, contactid'); |
10 | echo 'contacts'; |
11 | } |
12 | |
13 | function message_print_search() { |
14 | global $USER; |
15 | |
16 | if ($frm = data_submitted()) { |
17 | |
18 | message_print_search_results($frm); |
19 | |
20 | } else { |
21 | /// todo make the following queries more efficient |
22 | if ($teachers = get_records('user_teachers', 'userid', $USER->id, '', 'id, course')) { |
23 | |
24 | $courses = get_courses('all', 'c.sortorder ASC', 'c.id, c.shortname'); |
25 | $cs = '<select name="courseselect">'; |
26 | foreach ($teachers as $tcourse) { |
27 | $cs .= "<option value=\"$tcourse->course\">".$courses[$tcourse->course]->shortname."</option>\n"; |
28 | } |
29 | $cs .= '</select>'; |
30 | } |
31 | |
32 | include('search.html'); |
33 | } |
34 | } |
35 | |
36 | function message_print_settings() { |
37 | if ($frm = data_submitted()) { |
38 | echo 'settings submitted - quick do something'; |
39 | } else { |
40 | echo 'settings form'; |
41 | } |
42 | } |
43 | |
44 | function message_print_search_results($frm) { |
45 | if (!empty($frm->personsubmit)) { |
46 | echo 'searched for person'; |
47 | } else if (!empty($frm->keywordssubmit)) { |
48 | echo 'searched for keywords'; |
49 | } |
50 | |
51 | print_single_button($ME, array( 'tab' => 'search'), get_string('newsearch') ); |
52 | } |
53 | |
54 | ?> |