App/Lib/Action/Admin/TeacherAction.class.php

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
class TeacherAction extends CommonAction {
	public function index() {
		if ($this->isAjax ()) {
			$Form = M ( 'Teacher' );
			import ( "ORG.Util.Page" );
			if (! empty ( $_REQUEST ['query'] ))
				$where = $_REQUEST ['qtype'] . " LIKE '%" . $_REQUEST ['query'] . "%'";
			$count = $Form->where ( $where )->count ();
			$Page = new Page ( $count, $_REQUEST ['rp'] );
			$Page->firstRow = $_REQUEST ['rp'] * ($_REQUEST ['page'] - 1);
			$list = $Form->where ( $where )->order ( 'id DESC' )->limit ( $Page->firstRow . ',' . $Page->listRows )->select ();
			$json = array (
					'page' => $_REQUEST ['page'],
					'total' => $count,
					'rows' => array () 
			);
			foreach ( $list as $key => $value )
				$json ['rows'] [] = array (
						'id' => $list [$key] ['id'],
						'cell' => array (
								'id'      => $list [$key] ['id'],
								'k'       => $key + 1, // 序号
								'name'   => $list [$key] ['name'],
								'postion' => $list [$key] ['postion']
						) 
				);
				// echo $Form->_sql();
			echo json_encode ( $json );
		} else {
			$this->toTemplate ( 'Teacher:index', '教师管理  > 所有教师 >' );
		}
	}
	public function insert() {
		if ($this->isPost ()) {
			$Form = D ( 'Teacher' );
			$Form->startTrans ();
			if ($vo = $Form->create ()) {
				$Form->password = md5($_POST['id']);
				$list = $Form->add ();
				if ($list) {
					$Form->commit ();
					$this->success ();
				} else {
					$Form->rollback ();
					$this->error ( '数据写入错误!' );
				}
			} else
				$this->error ( $Form->getError () );
		} else {
			$this->toTemplate ( 'Teacher:add', '教师管理  > 添加教师 >' );
		}
	}
	public function update() {
		if ($this->isPost ()) {
			$Form = D ( 'Teacher' );
			$Form->startTrans ();
			if ($vo = $Form->create ()) {
				$list = $Form->save ();
				if ($list) {
后面还有 105 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。