Exemplo n.º 1
0
<tr><td align="right">Teacher:</td>
    <td><input name="teacher" value="<?php 
echo $request_info['teacher'];
?>
"></td>
</tr>
<tr><td align="right">Subject:</td>
    <td><?php 
subjects_select(array($request_info['subject']), true);
?>
</td>
</tr>
<tr>
    <td valign="top" align="right">Tutor categories requested:</td>
    <td valign="top"><?php 
tutor_category_select(get_request_categories($request_info['id']), 'multiple');
?>
 </td>
</tr>
<tr><td align="right">Times per week:</td>
    <td><input name="times_per_week" value="<?php 
echo $request_info['times_per_week'];
?>
"></td>
</tr>
<tr>
    <td align='right'>Notes:</td>
    <td><textarea name="notes" rows=4 cols=80><?php 
echo $request_info['notes'];
?>
</textarea></td>
Exemplo n.º 2
0
function find_match($request_id)
{
    $DB = new DB();
    // get request details
    $result = $DB->query("select * from tutor_request where id={$request_id}");
    $row = mysql_fetch_array($result);
    $student_id = $row["student_id"];
    $subject_id = $row["subject"];
    $times_per_week = $row["times_per_week"];
    $requested_categories = get_request_categories($request_id);
    // select all tutors which have subject
    $result = $DB->query("select tutor.* from tutor left join tutor2subject on tutor2subject.tutor_id =tutor.id where tutor2subject.subject_id={$subject_id}");
    // for each tutor returned
    $matches_prefered_cat = array();
    $matches_other = array();
    while ($row = mysql_fetch_array($result)) {
        $tutor_id = $row[id];
        // figure out if has time left
        if (time_left($tutor_id) < 1) {
            continue;
            // if not, skip
        }
        // get tutor category
        $tutor_category = tutor_category($row["id"]);
        $category_matches = in_array($tutor_category, $requested_categories);
        // get list of common available times between tutor and student
        $common_times = get_common_times($tutor_id, $student_id);
        $common_times_number = count($common_times);
        // put data into datastructure
        if ($category_matches) {
            array_push($matches_prefered_cat, array($tutor_id, $tutor_category, $common_times, $category_matches, $common_times_number));
        } else {
            array_push($matches_other, array($tutor_id, $tutor_category, $common_times, $category_matches, $common_times_number));
        }
    }
    // sort matches on common hours
    $matches_prefered_cat = msort($matches_prefered_cat, 5);
    $matches_other = msort($matches_other, 5);
    $matches = array_merge($matches_prefered_cat, $matches_other);
    // return array
    return $matches;
}
Exemplo n.º 3
0
echo $student_info['grade'];
?>
</td>
</tr>
<tr>
    <td align='right'>Number of times per week student wants tutoring:</td>
    <td><?php 
echo $request_info['times_per_week'];
?>
</td>
</tr>
<tr>
    <td align='right' valign="top">Requested Tutor Categories:</td>
    <td>
        <?php 
$requested_categories = get_request_categories($request_info['id']);
foreach ($requested_categories as $category_id) {
    echo category_name($category_id) . "<br/>";
}
?>
    </td>
</tr>
</table>
</td>

<td valign="top">
<table>
<tr>
    <td align='right'>Address:</td>
    <td><?php 
echo $student_info['address'];