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


PHP Teacher::or_where方法代码示例

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


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

示例1: 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);
     }
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:56,代码来源:rooms.php


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