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


PHP Card::update方法代码示例

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


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

示例1: edit

 public function edit($id, $id_campaign = null)
 {
     //$this->output->enable_profiler(true);
     $id = (int) $id;
     $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) {
         $card = Card::find($id);
         $data = array('id' => $id, 'num' => $card->get_num(), 'word_english' => str_replace('<br />', "\n", $card->get_card_content()->get_word_english()), 'word_french' => str_replace('<br />', "\n", $card->get_card_content()->get_word_french()), 'is_active_english' => $card->get_card_content()->get_is_active_english(), 'is_active_french' => $card->get_card_content()->get_is_active_french(), 'id_campaign' => $id_campaign);
         $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 {
         $data = array('num' => (int) $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'));
         $result = Card::update($id, $data, $id_campaign);
         if ($result === true) {
             if ($id_campaign === null) {
                 $this->layout->view('others/form_success');
             } else {
                 $this->load->model('Campaign');
                 $campaign = Campaign::find($id_campaign);
                 $campaign->with_next_id_card();
                 if ($campaign->next_id_card === null) {
                     $this->layout->view('controllers/Campaign/actions/completed');
                 } else {
                     redirect('/Card/edit/' . $campaign->next_id_card . '/' . $id_campaign);
                 }
             }
         } elseif ($result instanceof Standard_error) {
             $this->layout->views('others/form_failure', array('message' => $result->message));
             $data = array('id' => $id, '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'), 'id_campaign' => $id_campaign);
             $create_edit = $this->layout->views('controllers/Card/actions/create_edit', $data, array('css', 'js'), true);
             $this->layout->action_view(array('create_edit' => $create_edit));
         }
     }
 }
开发者ID:vmoulin77,项目名称:DVB,代码行数:38,代码来源:Card_controller.php


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