Permalink
Browse files

Draft beginning of new messaging system that Martin and Shane are wor…

…king on.
  • Loading branch information...
1 parent ffce79c commit 172186b8c489a6434f5067873c33e4c44ed34851 moodler committed Dec 16, 2004
Showing with 129 additions and 0 deletions.
  1. +33 −0 message/index.php
  2. +54 −0 message/lib.php
  3. +42 −0 message/search.html
View
@@ -0,0 +1,33 @@
+<?php
+/// main interface window for messaging
+
+require('../config.php');
+require('lib.php');
+
+$tab = optional_param('tab', 'contacts');
+$ftab = 'message_print_'.$tab;
+
+
+
+
+
+print_header(get_string('messaging').' - '.$SITE->fullname);
+
+?>
+
+<table cellspacing="2" cellpadding="2" border="0" bgcolor="#ffffff" align="center" width="80%">
+<tr>
+ <th class="message_tab_selected"><a href="<?php echo $ME ?>?tab=contacts">contacts</a></th>
+ <th class="message_tab"><a href="<?php echo $ME ?>?tab=search">search</a></th>
+ <th class="message_tab"><a href="<?php echo $ME ?>?tab=settings">settings</a></th>
+</tr>
+<tr>
+ <td colspan="3">
+ <?php if (function_exists($ftab)) $ftab(); ?>
+ </td>
+</tr>
+</table>
+
+
+</body>
+</html>
View
@@ -0,0 +1,54 @@
+<?php
+/// library functions for messaging
+
+/// todo: add some functions
+
+
+function message_print_contacts() {
+ global $USER;
+ $contacts = get_records('message_contacts', 'userid', $USER->id, '', 'id, contactid');
+ echo 'contacts';
+}
+
+function message_print_search() {
+ global $USER;
+
+ if ($frm = data_submitted()) {
+
+ message_print_search_results($frm);
+
+ } else {
+ /// todo make the following queries more efficient
+ if ($teachers = get_records('user_teachers', 'userid', $USER->id, '', 'id, course')) {
+
+ $courses = get_courses('all', 'c.sortorder ASC', 'c.id, c.shortname');
+ $cs = '<select name="courseselect">';
+ foreach ($teachers as $tcourse) {
+ $cs .= "<option value=\"$tcourse->course\">".$courses[$tcourse->course]->shortname."</option>\n";
+ }
+ $cs .= '</select>';
+ }
+
+ include('search.html');
+ }
+}
+
+function message_print_settings() {
+ if ($frm = data_submitted()) {
+ echo 'settings submitted - quick do something';
+ } else {
+ echo 'settings form';
+ }
+}
+
+function message_print_search_results($frm) {
+ if (!empty($frm->personsubmit)) {
+ echo 'searched for person';
+ } else if (!empty($frm->keywordssubmit)) {
+ echo 'searched for keywords';
+ }
+
+ print_single_button($ME, array( 'tab' => 'search'), get_string('newsearch') );
+}
+
+?>
View
@@ -0,0 +1,42 @@
+<form name="personsearch" action="<?php echo $ME ?>" method="post">
+<input type="hidden" name="tab" value="search" />
+
+<table cellpadding="5" align="center">
+
+
+ <tr>
+ <td colspan="3"><strong><?php print_string('searchforperson') ?></strong></td>
+ </tr>
+ <tr>
+ <td align="right"><?php print_string('name') ?>:</td>
+ <td><input type="text" name="name" size="20" alt="<?php print_string('name')?>" /></td>
+ <td><input type="submit" name="personsubmit" value="<?php print_string('search') ?>" /></td>
+ </tr>
+ <tr>
+ <td colspan="3"><input type="checkbox" name="mycourses" alt="<?php print_string('onlyinmycourses') ?>" /><?php print_string('onlyinmycourses') ?></td>
+ </tr>
+
+ <tr><td colspan="3"><hr /></td></tr>
+
+ <tr>
+ <td colspan="3"><strong><?php print_string('searchformessage') ?></strong></td>
+ </tr>
+ <tr>
+ <td align="right"><?php print_string('keywords') ?>:</td>
+ <td><input type="text" name="name" size="20" alt="<?php print_string('keywords')?>" /></td>
+ <td><input type="submit" name="keywordssubmit" value="<?php print_string('search') ?>" /></td>
+ </tr>
+ <tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('onlytome') ?>" /><?php print_string('onlytome') ?></td></tr>
+ <tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('onlyfromme') ?>" /><?php print_string('onlyfromme') ?></td></tr>
+ <tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('allmine') ?>" /><?php print_string('allmine') ?></td></tr>
+
+ <?php if (isadmin()) { ?>
+ <tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('allusers') ?>" /><?php print_string('allusers') ?></td></tr>
+ <?php } ?>
+
+ <tr><td colspan="3"><input type="radio" name="keywordsoption" alt="<?php print_string('allstudents') ?>" /><?php print_string('allstudents'); ?><?php echo $cs; ?></td></tr>
+
+
+</table>
+
+</form>

0 comments on commit 172186b

Please sign in to comment.