本文整理汇总了PHP中Card::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Card::insert方法的具体用法?PHP Card::insert怎么用?PHP Card::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
$this->output->enable_profiler(true);
$this->load->model('Card');
$this->form_validation->set_rules('num', 'Number', 'required|integer');
$this->form_validation->set_rules('word_english', 'English', 'required');
$this->form_validation->set_rules('word_french', 'French', 'required');
$this->layout->add_basic_assets()->menu();
if ($this->form_validation->run() === false) {
$default_num = Card::get_max_num() + 1;
$data = array('num' => $default_num, 'word_english' => '', 'word_french' => '', 'is_active_english' => true, 'is_active_french' => true);
$create_edit = $this->layout->views('controllers/Card/actions/create_edit', $data, array('css', 'js'), true);
$this->layout->action_view(array('create_edit' => $create_edit));
} else {
$result = Card::insert((int) $this->input->post('num'), $this->input->post('word_english'), $this->input->post('word_french'), $this->input->post('is_active_english'), $this->input->post('is_active_french'));
if ($result === true) {
$this->layout->view('others/form_success');
} elseif ($result instanceof Standard_error) {
$this->layout->views('others/form_failure', array('message' => $result->message));
$data = array('num' => $this->input->post('num'), 'word_english' => $this->input->post('word_english'), 'word_french' => $this->input->post('word_french'), 'is_active_english' => $this->input->post('is_active_english'), 'is_active_french' => $this->input->post('is_active_french'));
$create_edit = $this->layout->views('controllers/Card/actions/create_edit', $data, array('css', 'js'), true);
$this->layout->action_view(array('create_edit' => $create_edit));
}
}
}