drne47241 2015-10-28 17:33
浏览 53

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

In my very simple new activity module in Moodle I need to add filter and search options for the table with users and the columns with user data.

We have two tabs Userlist and Add. In the first tab we have table, which shows username timepickedup timereturn cartype city status. And lists the userdata bellow these columns. The code is as follows:

$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);
}

We add users trough the second tab Add, where we can choose the user from the users in the Moodle site and manually add the rest of custom data.

I didn't find any search or filter forms for developers in Moodle. How should such form be structured in order to work in Moodle? If it is possible, I need to put it above the table, not in separate tab.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度