当前位置: 首页>>代码示例>>PHP>>正文


PHP AjaxResponse::redirect方法代码示例

本文整理汇总了PHP中AjaxResponse::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP AjaxResponse::redirect方法的具体用法?PHP AjaxResponse::redirect怎么用?PHP AjaxResponse::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AjaxResponse的用法示例。


在下文中一共展示了AjaxResponse::redirect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setTCFunc

 /**
  * 新增/编辑校区AJAX方法
  * @param   array   $param  map<string,variant>类型参数
  *                  int     tc_id   ID,若为0表新增
  *                  int     tc_tiid 所属培训机构ID
  *                  string  tc_name 名称
  *                  int     tc_flag 状态,-1已删 0禁用 1启用 大于1待审
  *                  int     tc_environ  环境指数
  *                  int     tc_provid   地址省
  *                  int     tc_cityid   地址市
  *                  int     tc_areaid   地址区县
  *                  string  tc_ctcaddr  联系地址
  *                  string  tc_ctcperson    联系人
  *                  string  tc_ctcphone     联系电话
  */
 public function setTCFunc($param)
 {
     $resp = new AjaxResponse();
     $param = Func::param_copy($param, 'tc_id', 'tc_name', 'tc_tiid', 'tc_flag', 'tc_environ', 'tc_provid', 'tc_cityid', 'tc_areaid', 'tc_ctcaddr', 'tc_ctcperson', 'tc_ctcphone');
     if ($param['tc_name'] == '') {
         $resp->alert('培训校区名称不可为空');
         return $resp;
     }
     if (!Validate::isInt($param['tc_provid']) || $param['tc_provid'] < 1) {
         $resp->alert('请选择校区所在省');
         return $resp;
     }
     if ($param['tc_ctcaddr'] == '') {
         $resp->alert('请填写联系地址');
         return $resp;
     }
     if ($param['tc_ctcperson'] == '') {
         $param['tc_ctcperson'] = NULL;
     }
     if ($param['tc_ctcphone'] == '') {
         $resp->alert('请填写联系电话');
         return $resp;
     }
     if (!Validate::isInt($param['tc_environ'])) {
         $reps->alert('请填写环境指数');
         return $resp;
     }
     try {
         if ($param['tc_id']) {
             unset($param['tc_tiid']);
             TrainingInstitutionModel::setTrainingCampus($param);
             admin_log('edit', 'trainingcampus', "tc_id: " . $param['tc_id']);
         } else {
             $param['tc_id'] = TrainingInstitutionModel::addTrainingCampus($param);
             admin_log('add', 'trainingcampus', "tc_id: " . $param['tc_id']);
         }
         $resp->redirect('/admin/traininginstitution/tcinfo/' . $param['tc_id']);
     } catch (Exception $e) {
         $resp->alert($e->getMessage());
     }
     return $resp;
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:57,代码来源:traininginstitution.php

示例2: setCorsFunc


//.........这里部分代码省略.........
                 if (!Validate::isDate($param['cc_list'][$i]['cc_begindate'])) {
                     $err = $err_pre . '请填写正确的课程周期开课日期';
                     break;
                 }
                 if ($param['cc_list'][$i]['cc_enddate'] == '') {
                     $err = $err_pre . '请填写课程周期结束日期';
                     break;
                 }
                 if (!Validate::isDate($param['cc_list'][$i]['cc_enddate'])) {
                     $err = $err_pre . '请填写正确的课程周期结束日期';
                     break;
                 }
                 if (strcmp($param['cc_list'][$i]['cc_enddate'], $param['cc_list'][$i]['cc_begindate']) < 0) {
                     $err = $err_pre . '课程结束日期应大于开始日期';
                     break;
                 }
             }
             if (!Validate::isInt($param['cc_list'][$i]['cc_hours'])) {
                 $err = $err_pre . '请填写课时';
                 break;
             }
             if (!is_numeric($param['cc_list'][$i]['cc_price'])) {
                 $err = $err_pre . '请填写课程收费';
                 break;
             }
             if ($param['cc_list'][$i]['cc_provid'] == '0') {
                 $err = $err_pre . '请选择上课地址所在省市区';
                 break;
             }
             if ($param['cc_list'][$i]['cc_addr'] == '') {
                 $err = $err_pre . '请填写上课地址';
                 break;
             }
         }
         if ($err) {
             $resp->alert($err);
             return $resp;
         }
         if (count($tcid_arr) > 0) {
             if (count($tcid_arr) != count(array_unique($tcid_arr))) {
                 $resp->alert('校区列表中有相同的机构校区,请检查');
                 return $resp;
             }
         }
     }
     try {
         if ($cors_id) {
             $db = Fn::db();
             $cc_id_arr = array();
             $rows = CourseModel::courseCampusList("cc_id", array('cc_corsid' => $cors_id));
             if ($rows) {
                 foreach ($rows as $row) {
                     $cc_id_arr[] = intval($row['cc_id']);
                 }
             }
             $bOk = false;
             if (!$db->beginTransaction()) {
                 throw new Exception('启动存储过程失败');
             }
             $set_cc_id_arr = array();
             try {
                 CourseModel::setCourse($param, false);
                 foreach ($param['cc_list'] as $row) {
                     $row['cc_id'] = intval($row['cc_id']);
                     if ($row['cc_id']) {
                         CourseModel::setCourseCampus($row, false);
                         $set_cc_id_arr[] = $row['cc_id'];
                     } else {
                         CourseModel::addCourseCampus($row, false);
                     }
                 }
                 $remove_cc_id_arr = array_diff($cc_id_arr, $set_cc_id_arr);
                 if ($remove_cc_id_arr) {
                     CourseModel::removeCourseCampus(implode(',', $remove_cc_id_arr), false);
                 }
                 $bOk = $db->commit();
                 if (!$bOk) {
                     $db->rollBack();
                 }
             } catch (Exception $e) {
                 $db->rollBack();
                 throw $e;
             }
             if ($bOk) {
                 admin_log('edit', 'course', "cors_id: {$cors_id}");
                 $resp->redirect(site_url('admin/course/corsinfo/' . $cors_id));
             } else {
                 $resp->alert('执行存储过程失败');
             }
         } else {
             // 新增
             $cors_id = CourseModel::addCourse($param);
             admin_log('add', 'course', "cors_id: {$cors_id}");
             $resp->redirect(site_url('admin/course/setcorsinfo/' . $cors_id));
         }
     } catch (Exception $e2) {
         $resp->alert($e2->getMessage());
     }
     return $resp;
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:101,代码来源:course.php

示例3: setSchoolTeacherFunc

 /**
  * 编辑授课教师AJAX方法
  * @param   array   $param  map<stirng,variant>类型的参数
  *                  int     scht_schid  学校id
  *                  int     ct_id   教师ID,若为0表新增
  *                  string  ct_name 名称
  *                  string  subject_id_str  形如1,3,4样式的学科ID列表
  *                  string  grade_id_str    形如1,3,4样式的年级ID列表
  *                  int     ct_flag     状态,-1已删,0禁用,1启用,大于1待审
  */
 public function setSchoolTeacherFunc($param)
 {
     $resp = new AjaxResponse();
     if (!$this->check_power_new('school_editteacher', false)) {
         $resp->alert('您没有权限执行该功能');
         return $resp;
     }
     $param = Func::param_copy($param, 'scht_schid', 'ct_id', 'ct_name', 'ct_contact', 'subject_id_str', 'grade_id_str', 'ct_flag', 'cct_ccid_str', 'ct_memo');
     if (!Validate::isInt($param['scht_schid']) || $param['scht_schid'] <= 0) {
         $resp->alert('教师所属学校不正确');
         return $resp;
     }
     if (!Validate::isInt($param['ct_id']) || $param['ct_id'] < 0) {
         $resp->alert('教师ID不正确');
         return $resp;
     }
     if ($param['ct_name'] == '') {
         $resp->alert('教师名称不正确');
         return $resp;
     }
     if (!Validate::isJoinedIntStr($param['grade_id_str'])) {
         $resp->alert('所选年级不正确');
         return $resp;
     }
     if (!Validate::isJoinedIntStr($param['subject_id_str'])) {
         $resp->alert('所选学科不正确');
         return $resp;
     }
     $param['subjectid_list'] = array_unique(explode(',', $param['subject_id_str']));
     $param['gradeid_list'] = array_unique(explode(',', $param['grade_id_str']));
     if (count($param['gradeid_list']) == count(C('grades'))) {
         $param['gradeid_list'] = array(0);
     }
     try {
         if ($param['ct_id']) {
             SchoolModel::setSchoolTeacher($param);
             admin_log('edit', 'school_teacher', "ct_id: " . $param['ct_id']);
         } else {
             $param['ct_id'] = SchoolModel::addSchoolTeacher($param);
             admin_log('add', 'school_teacher', "ct_id: " . $param['ct_id']);
         }
         $resp->redirect('/admin/school/teacherlist/' . $param['scht_schid']);
     } catch (Exception $e) {
         $resp->alert($e->getMessage());
     }
     return $resp;
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:57,代码来源:school.php

示例4: studentAjaxLogout

 public static function studentAjaxLogout($url = NULL)
 {
     $resp = new AjaxResponse();
     Fn::sess()->set_userdata(array('uid' => '', 'uinfo' => array('fullname' => '[游客]', 'uid' => '', 'avatar_url' => __IMG_ROOT_URL__ . 'zeming/exam/head.gif')));
     if ($url) {
         $resp->redirect($url);
     } else {
         $resp->refresh();
     }
     return $resp;
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:11,代码来源:Student.php

示例5: setCTFunc

 /**
  * 编辑授课教师AJAX方法
  * @param   array   $param  map<stirng,variant>类型的参数
  *                  int     ct_id   教师ID,若为0表新增
  *                  string  ct_name 名称
  *                  string  ctc_contact 联系方式
  *                  string  subject_id_str  形如1,3,4样式的学科ID列表
  *                  string  grade_id_str    形如1,3,4样式的年级ID列表
  *                  int     ct_flag     状态,-1已删,0禁用,1启用,大于1待审
  */
 public function setCTFunc($param)
 {
     $resp = new AjaxResponse();
     $param = Func::param_copy($param, 'ct_id', 'ct_name', 'ct_contact', 'subject_id_str', 'grade_id_str', 'ct_flag', 'cct_ccid_str', 'ct_memo');
     if (!Validate::isInt($param['ct_id']) || $param['ct_id'] < 0) {
         $reps->alert('教师ID不正确');
         return $resp;
     }
     if ($param['ct_name'] == '') {
         $resp->alert('教师名称不正确');
         return $resp;
     }
     if ($param['ct_contact'] == '') {
         $param['ct_contact'] = NULL;
     }
     if (!Validate::isJoinedIntStr($param['grade_id_str'])) {
         $resp->alert('所选年级不正确');
         return $resp;
     }
     if (!Validate::isJoinedIntStr($param['subject_id_str'])) {
         $resp->alert('所选学科不正确');
         return $resp;
     }
     if ($param['cct_ccid_str'] == '') {
         $param['cct_ccid_list'] = array();
     } else {
         if (!Validate::isJoinedIntStr($param['cct_ccid_str'])) {
             $resp->alert('所选课程不正确');
             return $resp;
         } else {
             $param['cct_ccid_list'] = explode(',', $param['cct_ccid_str']);
         }
     }
     $param['subjectid_list'] = array_unique(explode(',', $param['subject_id_str']));
     $param['gradeid_list'] = array_unique(explode(',', $param['grade_id_str']));
     if (count($param['gradeid_list']) == count(C('grades'))) {
         $param['gradeid_list'] = array(0);
     }
     try {
         if ($param['ct_id']) {
             CTeacherModel::setCTeacher($param);
             admin_log('edit', 'cteacher', "ct_id: " . $param['ct_id']);
         } else {
             $param['ct_id'] = CTeacherModel::addCTeacher($param);
             admin_log('add', 'cteacher', "ct_id: " . $param['ct_id']);
         }
         $resp->redirect('/admin/cteacher/ctinfo/' . $param['ct_id']);
     } catch (Exception $e) {
         $resp->alert($e->getMessage());
     }
     return $resp;
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:62,代码来源:cteacher.php

示例6: baseFetchCTeacherListFunc

    public function baseFetchCTeacherListFunc($param)
    {
        $resp = new AjaxResponse();
        if (!$this->_uinfo['uid']) {
            $resp->redirect(site_url('student/index/login'));
            return $resp;
        }
        $param = Func::param_copy($param, 'cteacher_name', 'cors_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);
                $uid = $this->_uinfo['uid'];
                if ($uid) {
                    $student = StudentModel::get_student($uid);
                } else {
                    $student = $this->session->userdata('student');
                }
                $grade_id = $student['grade_id'];
                $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;
    }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:53,代码来源:profile.php


注:本文中的AjaxResponse::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。