コード例 #1
0
 /**
  * 删除校区AJAX方法
  * @param   string  $tc_id_str  形如1,3,4样式的ID列表字符串
  */
 public function removeTCFunc($tc_id_str)
 {
     $resp = new AjaxResponse();
     if (!$this->check_power_new('traininginstitution_removetc', false)) {
         $resp->alert('您没有权限执行该功能');
         return $resp;
     }
     try {
         TrainingInstitutionModel::removeTrainingCampus($tc_id_str);
         admin_log('delete', 'trainingcampus', "tc_id: {$tc_id_str}");
         $resp->call('location.reload');
     } catch (Exception $e) {
         $resp->alert($e->getMessage());
     }
     return $resp;
 }
コード例 #2
0
 /**
  * 重新生成报告
  * @param   mixed   $rule_id_str
  * @return  AjaxResponse
  */
 public function regenerateReportFunc($rule_id_str)
 {
     $resp = new AjaxResponse();
     $rule_ids = explode(',', $rule_id_str);
     if (!$rule_ids) {
         $resp->alert('请指定需要重新生成报告的评估规则。');
         return $resp;
     }
     try {
         $flag = true;
         foreach ($rule_ids as $rule_id) {
             $param = array('rule_id' => $rule_id, 'html_status' => 0, 'status' => 0, 'is_success' => 0, 'num' => 0);
             $flag = ReportCommandModel::setConvert2pdfStatus($param);
         }
         if ($flag) {
             $resp->alert('重新生成报告已加入计划任务中,请耐心等待或执行相关php命令。');
             $resp->call('fnCloseDialog', 'id_regeneratereport_dlg');
         } else {
             $resp->alert('操作失败,请重试。');
         }
     } catch (Exception $e) {
         $resp->alert($e->getMessage());
     }
     return $resp;
 }
コード例 #3
0
ファイル: course.php プロジェクト: Vincent-Shen/origin
 /**
  * 新增/编辑授课教师来源AJAX方法
  * @param   int     $ctf_id     旧ID,若为0表新增,否则表编辑
  * @param   array   $param      map<string,varaint>类型的新属性
  *                  int     ctf_id      新ID
  *                  string  ctf_name    新名称  
  */
 public function setCTFFunc($ctf_id, $param)
 {
     $resp = new AjaxResponse();
     $param = Func::param_copy($param, 'ctf_id', 'ctf_name');
     if ($ctf_id) {
         if (!$this->check_power_new('course_setctfinfo', false)) {
             $resp->alert('您没有权限执行该功能');
             return $resp;
         }
     } else {
         if (!$this->check_power_new('course_addctfinfo', false)) {
             $resp->alert('您没有权限执行该功能');
             return $resp;
         }
     }
     if (!Validate::isInt($param['ctf_id'])) {
         $resp->alert('培训课程授课教师来源ID必须为整数');
         return $resp;
     }
     if ($param['ctf_name'] == '') {
         $resp->alert('培训课程授课教师来源名称不可为空');
         return $resp;
     }
     try {
         if ($ctf_id) {
             CourseModel::setCourseTeachfrom($ctf_id, $param);
             admin_log('edit', '', "授课教师来源 ctf_id: " . $param['ctf_id']);
         } else {
             CourseModel::addCourseTeachfrom($param);
             admin_log('add', '', "授课教师来源 ctf_id: " . $param['ctf_id']);
         }
         $resp->call('location.reload');
     } catch (Exception $e) {
         $resp->alert($e->getMessage());
     }
     return $resp;
 }
コード例 #4
0
ファイル: student.php プロジェクト: Vincent-Shen/origin
    public function baseFetchCTeacherListFunc($param)
    {
        $resp = new AjaxResponse();
        $param = Func::param_copy($param, 'grade_id', 'cteacher_name', 'cors_id');
        $grade_id = $param['grade_id'];
        unset($param['grade_id']);
        if (empty($param['cors_id'])) {
            $resp->alert('请选择培训课程');
            return $resp;
        }
        if (empty($param['cteacher_name'])) {
            unset($param['cteacher_name']);
        }
        try {
            $cors_id = $param['cors_id'];
            $sql = <<<EOT
SELECT ct_id, ct_name FROM v_course_campus_teacher WHERE cct_ccid IN (
    SELECT cc_id FROM t_course_campus WHERE cc_corsid = {$cors_id}
)
EOT;
            $ct_map = Fn::db()->fetchPairs($sql);
            if (!empty($ct_map)) {
                $ct_id_list = array_keys($ct_map);
                $ct_id_str = implode(',', $ct_id_list);
                $sql = <<<EOT
SELECT DISTINCT ctg_ctid FROM t_cteacher_gradeid 
WHERE ctg_ctid IN ({$ct_id_str}) AND (ctg_gradeid = 0 OR ctg_gradeid = {$grade_id})
EOT;
                $ct_id2 = Fn::db()->fetchCol($sql);
                $ct_list = array();
                foreach ($ct_map as $k => $v) {
                    if (in_array($k, $ct_id2)) {
                        $ct_list[] = array('ct_id' => $k, 'ct_name' => $v);
                    }
                }
                $resp->call('fnSetCTeacherListDiv', $ct_list);
            } else {
                $resp->call('fnSetCTeacherListDiv', array());
            }
        } catch (Exception $e) {
            $resp->alert($e->getMessage());
        }
        return $resp;
    }
コード例 #5
0
ファイル: school.php プロジェクト: Vincent-Shen/origin
 /**
  * 删除授课教师AJAX方法
  * @param   string      $ct_id_str  形如1,2,3的ID列表字符串
  */
 public function removeSchoolTeacherFunc($ct_id_str)
 {
     $resp = new AjaxResponse();
     if (!$this->check_power_new('school_deleteteacher', false)) {
         $resp->alert('您没有权限执行该功能');
         return $resp;
     }
     try {
         SchoolModel::removeSchoolTeacher($ct_id_str);
         admin_log('delete', 'school_teacher', "ct_id: {$ct_id_str}");
         $resp->call('location.reload');
     } catch (Exception $e) {
         $resp->alert($e->getMessage());
     }
     return $resp;
 }