public function deleteTeacher($teacherId) { $instId = session('instId'); if (!$instId) { return; } $model = new \Home\Model\TeacherModel(); $operator = new \Home\Model\OperatorModel(); try { $model->startTrans(); $result = $model->deleteTeacher($instId, $teacherId); $operator->deleteOperatorByTeacherId($instId, $teacherId); $model->commit(); $data = "true"; } catch (Exception $e) { $model->rollback(); $data = "false"; } $this->ajaxReturn($data); }
public function showEditSA() { $instId = session('instId'); $isSuperAdmin = session('isSuperAdmin'); if ($isSuperAdmin != 1) { echo TO_HACKERS; } $operator = new \Home\Model\OperatorModel(); $result = $operator->showSuperAdmin($instId); $this->assign('superAdmin', $result[0]); $teacher = new \Home\Model\TeacherModel(); $teacherList = $teacher->showTeachers($instId, 0, 50); $this->assign("teacherList", $teacherList); $tnum = 0; $this->assign("tnum", $tnum); layout(true); $this->display(); }
public function showClassesDaily($teacherId = 0, $teacherName, $ymd, $nextday) { if ($teacherId == 0) { $teacherId = session('teacherId'); } if ($ymd == null) { $ymd = date('Y-m-d'); } if ($nextday != null && $nextday != '') { if ($nextday == 'bw') { $ymd = date('Y-m-d', strtotime("{$ymd} - 1 day")); } if ($nextday == 'fw') { $ymd = date('Y-m-d', strtotime("{$ymd} + 1 day")); } } $tId = session('instId'); $teacher = new \Home\Model\TeacherModel(); $teacherList = $teacher->showTeachers($tId, 0, 50); if (session('isSuperAdmin') == 1) { $this->assign("teacherList", $teacherList); } if ($teacherName == null || $teacherName == '') { for ($i = 0; $i < count($teacherList); $i++) { if ($teacherList[$i]['teacher_id'] == $teacherId) { $teacherName = $teacherList[$i]['name']; break; } } } $class = new \Home\Model\ClassModel(); $result = $class->showDailyClassesByTeacher($tId, $ymd, $teacherId); $this->assign("dailyClasses", $result); $this->assign('isSuperAdmin', session('isSuperAdmin')); $this->assign('teacherId', $teacherId); $this->assign('teacherName', $teacherName); $this->assign("ymd", $ymd); $this->assign('week', date('w', strtotime($ymd))); layout(true); $this->display(); }