douxiyi2418 2014-02-20 04:25
浏览 43
已采纳

获取具有给定用户ID的给定课程的用户注册日和注册时段

I working on send email when user manually enrolled to course.,by now i can send a email when user enroll to the system what i want to know is send enrollment expire date with the email,so if i can get from database that will work for me..,(any other method which can get this insie enroll unction also fine)

this is where i try to pass this parameters

 public function enrol_user(stdClass $instance, $userid, $roleid = NULL, $timestart = 0, $timeend = 0, $status = NULL, $recovergrades = NULL) {
    global $DB;

    $alreadyenroled = $DB->record_exists('user_enrolments', array('enrolid' => $instance->id, 'userid' => $userid));
    parent::enrol_user($instance, $userid, $roleid, $timestart, $timeend, $status, $recovergrades);
    if (!$alreadyenroled && $instance->customint4) {
        // Don't email immediately - give the admin a chance to remove users
        // who were added by mistake
        $this->queue_welcome_message($instance->id, $userid,$timestart,$timeend);
    }
}

 protected function queue_welcome_message($instanceid, $userid,$timestart,$timeend) {
    global $DB;

    if ($DB->record_exists('enrol_manual_email', array('instanceid' => $instanceid,
                                                       'userid' => $userid,'ts' => $timestart,'te' => $timeend))) {
        return;
    }

    $ins = new stdClass();
    $ins->instanceid = $instanceid;
    $ins->userid = $userid;
    ////edit lasitha
    $ins->ts = $timestart;
    $ins->te = $timeend;
    $DB->insert_record('enrol_manual_email', $ins);
}
  • 写回答

2条回答 默认 最新

  • dongzhi6927 2014-04-01 04:54
    关注

    This code helps me to get what i want to get

    $user_enroll_data = $DB->get_record('user_enrolments', array('enrolid'=>$instance->id, 'userid'=>$user->id));
    
    $normal_st_date=date('Y-m-d', $user_enroll_data->timestart);//course start date
    $normal_end_date=date('Y-m-d',$user_enroll_data->timeend);//course end date
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Excel发现不可读取的内容
  • ¥15 UE5#if WITH_EDITOR导致打包的功能不可用
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面
  • ¥15 算法题:数的划分,用记忆化DFS做WA求调
  • ¥15 chatglm-6b应用到django项目中,模型加载失败
  • ¥15 CreateBitmapFromWicBitmap内存释放问题。