在Moodle活动模块中过滤和搜索选项

时间:2015-10-28 17:33:21

标签: php mysql moodle

activity中非常简单的新module Moodle中,我需要为用户添加filtersearch table选项包含用户数据的列。

我们有两个标签UserlistAdd。 在第一个标签中,我们有表格,其中显示username timepickedup timereturn cartype city status。并列出这些列的用户数据。 代码如下:

$rows = carhiring_users($cm->id);

foreach ($rows as $carpicker) {
    $data = array();
    $user = carhiring_get_user($carpicker->userid);
    $data[] = $carpicker->cartype;
    $data[] = date('d.m.Y H:i', strtotime($carpicker->datepick));
    $data[] = date('d.m.Y H:i', strtotime($carpicker->datereturn));
    $data[] = $user->firstname . " " . $user->lastname;
    $data[] = $carpicker->city;
    $datetime1 = strtotime($carpicker->datepick);
    $datetime2 = strtotime($carpicker->datereturn);
    $interval = $datetime2 - $datetime1;
    $data[] = max(1, floor($interval/(60*60*24))) . get_string('carhiring_days', 'carhiring');
    switch ($carpicker->carhiring_status) {
            case 1:
                $carhiring_status = get_string('booked', 'carhiring');
                break;
            case 2:
                $carhiring_status = get_string('bookedbutdamaged', 'carhiring');
                break;
            case 3:
                $carhiring_status = get_string('returned', 'carhiring');
                break;
    }
    $data[] = $carhiring_status;
    $table->add_data($data);
}

我们通过第二个标签Add添加用户,我们可以从Moodle网站中的用户中选择用户,并manually add选择余下的custom data。< / p>

我在search中找不到任何filterforms Moodle的开发者。为了在form中工作,如何构建Moodle这样的结构?如果可能,我需要把它放在桌子上面,而不是单独的标签。

0 个答案:

没有答案
相关问题