本文整理汇总了PHP中Teacher::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Teacher::get方法的具体用法?PHP Teacher::get怎么用?PHP Teacher::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Teacher
的用法示例。
在下文中一共展示了Teacher::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate_teacher_login
/**
* Performs teacher account authentification and returns boolean information about success.
* @param string $eamil teacher account e-mail address.
* @param string $password teacher account password in plain text form.
* @return boolean TRUE, if teacher authentification is successful, FALSE otherwise (i.e. bad e-mail of password).
*/
public function authenticate_teacher_login($email, $password)
{
$teacher = new Teacher();
$teacher->where('email', $email);
$teacher->where('password', sha1($password));
$teacher->get();
if ($teacher->exists()) {
$userdata = $teacher->to_array();
unset($userdata['password']);
unset($userdata['created']);
unset($userdata['updated']);
$this->CI->session->set_userdata(SESSION_AUTH_LOGIN_TEACHER, $userdata);
$this->validate_teacher_login_verification(TRUE);
return TRUE;
} else {
$this->validate_teacher_login_verification(FALSE);
$this->add_login_failed_record($email, self::ACCOUNT_TYPE_TEACHER);
return FALSE;
}
}
示例2: update
public function update($group_id)
{
$this->load->library('form_validation');
$this->form_validation->set_rules('room[name]', 'lang:admin_rooms_form_field_name', 'required');
$this->form_validation->set_rules('room[time_begin]', 'lang:admin_rooms_form_field_time_begin', 'required|callback__is_time');
$this->form_validation->set_rules('room[time_end]', 'lang:admin_rooms_form_field_time_end', 'required|callback__is_time|callback__is_later_time');
$this->form_validation->set_rules('room[time_day]', 'lang:admin_rooms_form_field_time_day', 'required|callback__is_day');
$this->form_validation->set_rules('room[capacity]', 'lang:admin_rooms_form_field_capacity', 'required|integer|greater_than[0]');
$this->form_validation->set_rules('room_id', 'room_id', 'required');
$this->form_validation->set_message('_is_time', $this->lang->line('admin_rooms_form_error_message_is_time'));
$this->form_validation->set_message('_is_day', $this->lang->line('admin_rooms_form_error_message_is_day'));
$this->form_validation->set_message('_is_later_time', $this->lang->line('admin_rooms_form_error_message_is_later_time'));
if ($this->form_validation->run()) {
$room_id = intval($this->input->post('room_id'));
$room = new Room();
$room->get_by_id($room_id);
if ($room->exists()) {
$room_data = $this->input->post('room');
$room->from_array($room_data, array('name', 'time_day'));
$room->time_begin = $this->time_to_int($room_data['time_begin']);
$room->time_end = $this->time_to_int($room_data['time_end']);
$room->capacity = intval($room_data['capacity']);
$this->_transaction_isolation();
$this->db->trans_begin();
if (trim($room_data['teachers_plain']) != '') {
$room->teachers_plain = trim($room_data['teachers_plain']);
} else {
$room->teachers_plain = NULL;
}
$current_teachers = $room->teacher->get();
$room->delete($current_teachers->all);
$teachers = new Teacher();
if (is_array($room_data['teachers']) && count($room_data['teachers'])) {
foreach ($room_data['teachers'] as $teacher_id) {
$teachers->or_where('id', $teacher_id);
}
$teachers->get();
}
if ($room->save(array($teachers->all)) && $this->db->trans_status()) {
$this->db->trans_commit();
$this->messages->add_message('lang:admin_rooms_flash_message_save_successful', Messages::MESSAGE_TYPE_SUCCESS);
$this->_action_success();
$room->group->get();
$this->output->set_internal_value('course_id', $room->group->course_id);
} else {
$this->db->trans_rollback();
$this->messages->add_message('lang:admin_rooms_flash_message_save_failed', Messages::MESSAGE_TYPE_ERROR);
}
} else {
$this->messages->add_message('lang:admin_rooms_error_room_not_found', Messages::MESSAGE_TYPE_ERROR);
}
redirect(create_internal_url('admin_rooms/index/' . $group_id));
} else {
$this->edit($group_id);
}
}
示例3: _validate_old_password
public function _validate_old_password($str, $teacher_id)
{
$teacher = new Teacher();
$teacher->where('password', sha1($str));
$teacher->where('id', intval($teacher_id));
$teacher->get();
return $teacher->exists();
}