public static function edit($id, $data) { $info = Department::findFirst($id); if (!$info) { return false; } foreach ($data as $field => $value) { $info->{$field} = $value; } return $info->update(); }
public function indexAction() { $auth = $this->session->get('auth'); $user = Users::findFirst($auth['id']); if ($user == false) { $this->forward('index/index'); } if ($auth['did'] != '' && $auth['did'] != 0) { $department = Department::findFirst($auth['did']); } else { $department->name = '北京银泰财富中心'; } $this->view->setVar("department", $department); }
public function departmentAction() { $departmentid = $this->request->get('departmentid'); $department = Department::findFirst(array('conditions' => 'id=?1', 'bind' => array(1 => $departmentid))); $hospital = $department->Hospital; $this->tag->appendTitle($hospital->name . $department->name); $doctors = array(); $k = 0; foreach ($department->Doctor as $item) { $k++; $doctors[$k] = $item; } $city = $hospital->City; $this->view->setVars(array('city' => $city, 'hospital' => $hospital, 'department' => $department, 'doctors' => $doctors)); }