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


PHP Cases::submit方法代码示例

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


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

示例1: submit

 function submit($submit, $id, $button_id = NULL)
 {
     parent::submit($submit, $id, $button_id);
     $this->load->model('client_model', 'client');
     $this->load->model('staff_model', 'staff');
     try {
         if ($submit == 'query') {
             $client = $this->input->sessionPost('client');
             $this->query->labels[] = '咨询';
             $this->load->library('form_validation');
             if (!$client['id']) {
                 if (!$client['name']) {
                     $this->output->message('请填写咨询人', 'warning');
                     throw new Exception();
                 }
                 $client_profiles = $this->input->sessionPost('client_profiles');
                 if (!$client['gender']) {
                     $this->output->message('请选择性别', 'warning');
                     throw new Exception();
                 }
                 if (!$client_profiles['电话'] && !$client_profiles['电子邮件']) {
                     $this->output->message('至少输入一种联系方式', 'warning');
                     throw new Exception();
                 }
                 foreach ($client_profiles as $name => $content) {
                     if ($name == '电话') {
                         if ($this->client->isMobileNumber($content)) {
                             $client_profiles += array('手机' => $content);
                             unset($client_profiles['电话']);
                         }
                     } elseif ($name == '电子邮件' && $content) {
                         if (!$this->form_validation->valid_email($content)) {
                             $this->output->message('请填写正确的Email地址', 'warning');
                             throw new Exception();
                         }
                     }
                 }
                 if (empty($client['staff'])) {
                     $client['staff'] = $this->staff->check($client['staff_name']);
                 }
                 $client['id'] = $this->client->add($client + array('profiles' => $client_profiles, 'labels' => array('类型' => '潜在客户'), 'display' => true));
                 $this->query->addPeople($this->query->id, $client['id'], 'client');
             }
             if (empty($this->query->labels['咨询方式'])) {
                 $this->output->message('请选择咨询方式', 'warning');
                 throw new Exception();
             }
             if (empty($this->query->labels['领域'])) {
                 $this->output->message('请选择业务领域', 'warning');
                 throw new Exception();
             }
             $related_staff_name = $this->input->sessionPost('related_staff_name');
             if (!$related_staff_name['接洽律师']) {
                 $this->output->message('请填写接洽律师(跟进人员中间一项)');
                 throw new Exception();
             }
             $related_staff = array();
             foreach ($related_staff_name as $role => $staff_name) {
                 if ($staff_name) {
                     $related_staff[$role] = $this->staff->check($staff_name);
                 }
             }
             if (!$this->query->data['summary']) {
                 $this->output->message('请填写咨询概况', 'warning');
                 throw new Exception();
             }
             if (!$this->query->data['display']) {
                 $this->query->data['display'] = true;
                 $this->output->status = 'redirect';
                 $this->output->data = 'query/' . $this->query->id;
             }
             $this->query->data['name'] = $client['name'] . ' 咨询';
             $this->query->update($this->query->id, $this->query->data);
             $roles_people = $this->query->getRolesPeople($this->query->id);
             $roles = array();
             foreach ($roles_people as $role => $people_role) {
                 $roles[$role] = $people_role[0]['people'];
             }
             post('staffs', $roles);
             foreach ($related_staff as $role => $staff) {
                 if (!in_array($staff, post('staffs'))) {
                     $this->query->addPeople($this->query->id, $staff, '律师', $role);
                     post('staffs', post('staffs') + array($staff));
                 }
             }
             $this->output->message($this->output->title . '已保存');
         } elseif ($submit == 'new_case') {
             $this->query->removeLabel($this->query->id, '已归档');
             $this->query->addLabel($this->query->id, '等待立案审核');
             $this->query->update($this->query->id, array('type' => 'cases', 'num' => NULL, 'time_contract' => $this->date->today, 'end' => date('Y-m-d', $this->date->now + 100 * 86400)));
             $this->output->message('已立案,请立即获得案号');
             $this->output->status = 'redirect';
             $this->output->data = 'cases/' . $this->query->id;
         } elseif ($submit == 'file') {
             $this->query->addLabel($this->query->id, '已归档');
             $this->query->update($this->query->id, array('active' => false));
             $this->output->message('咨询案件已归档');
         }
         if (is_null($this->output->status)) {
             $this->output->status = 'success';
//.........这里部分代码省略.........
开发者ID:flyingfish2013,项目名称:Syssh,代码行数:101,代码来源:query.php


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