示例#1
0
文件: edit.php 项目: anilch/Personel
            $msg = new object();
            $msg->exam_name = $param->examtype . '-' . $param->lecturetype;
            $msg->course_name = $param->coursename;
            $msg->sem_name = $param->semestername;
        }
        $msg->classname = $class_name;
        // Update
        $ures = $exams->scheduleexam_update_instance($data);
        if ($ures == 1) {
            $message = get_string('updatesuccess', 'local_scheduleexam', $msg);
            $options = array('style' => 'notifysuccess');
            $hierarchy->set_confirmation($message, $returnurl, $options);
        }
    } else {

        $cres = $exams->scheduleexam_add_instance($data); //exit;
        $co_id = $DB->get_field("local_clclasses", 'cobaltcourseid', array('id' => $data->classid));
        $class_name = $DB->get_field("local_clclasses", 'fullname', array('id' => $data->classid));
        $sql_msg = "SELECT extyp.examtype,ltyp.lecturetype,s.fullname as semestername,co.fullname as coursename FROM {local_scheduledexams} e,{local_examtypes} extyp,{local_lecturetype} ltyp,{local_semester} s,{local_cobaltcourses} co where e.id={$cres} and e.examtype=extyp.id and e.lecturetype=ltyp.id and e.semesterid=s.id and co.id={$co_id}";
        $params = $DB->get_records_sql($sql_msg);

        foreach ($params as $param) {
            $msg = new object();
            $msg->exam_name = $param->examtype . '-' . $param->lecturetype;
            $msg->course_name = $param->coursename;

            $msg->sem_name = $param->semestername;
        }
        $msg->classname = $class_name;
        // Create new
        if ($cres) {