Ignore:
Timestamp:
Nov 5, 2014 9:30:07 AM (11 years ago)
Author:
quyenla
Message:

smsm template

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/modules/admin/controllers/smstemplate.php

    r405 r409  
    122122        echo json_encode($result);
    123123    }
    124     public function viewUser()
     124    public function viewSms()
    125125    {
    126126        $id=$this->uri->segment(4);
    127127        $this->load->model('Smstemplate_model');
    128128        $data=$this->Smstemplate_model->getSmstemplate($id);
    129         $this->load->view('smstemplate/viewUser',$data);
    130     }
    131     public function editUser()
     129        $this->load->view('smstemplate/viewSms',$data);
     130    }
     131    public function editSms()
    132132    {
    133133        $id=$this->uri->segment(4);
    134134        $this->load->model('Smstemplate_model');
    135135        $data=$this->Smstemplate_model->getSmstemplate($id);
    136         $this->load->view('smstemplate/editUser',$data);
    137     }
    138     public function dodeleteUser()
     136        $this->load->view('smstemplate/editSms',$data);
     137    }
     138    public function dodeleteSms()
    139139    {
    140140        $input=$this->input->post();
    141         $id=$input['id'];
     141        $id=$input['sms_id'];
    142142        $this->load->model('Smstemplate_model');
    143143        $data=$this->Smstemplate_model->delete($id);
     
    145145        echo json_encode($result);
    146146    }
    147     public function deleteUser()
     147    public function deleteSms()
    148148    {
    149149        $id=$this->uri->segment(4);
    150150        $this->load->model('Smstemplate_model');
    151151        $data=$this->Smstemplate_model->getSmstemplate($id);
    152         $this->load->view('smstemplate/deleteUser',$data);
    153     }
    154     public function updateUser()
    155     {
    156         $input['activated']=0;
    157         $input=  array_merge($input,$this->input->post());
    158         $this->load->model('Smstemplate_model');
    159         if (strlen($input['full_name'])==0)
    160         {
    161             $result['errors'][]="Tên cộng tác viên khÃŽng được để trống";
    162         }
    163         if (strlen($input['login_name'])==0)
    164         {
    165             $result['errors'][]="Tên đăng nhập khÃŽng được để trống";
    166         }
    167         else
    168         {
     152        $this->load->view('smstemplate/deleteSms',$data);
     153    }
     154    public function updateSms()
     155    {
     156       
     157        $input=  $this->input->post();
     158        $this->load->model('Smstemplate_model');
     159        if (strlen($input['sms_content'])==0)
     160        {
     161            $result['errors'][]="Nội dung tin nhắn khÃŽng được để trống";
     162        }
     163        if (strlen($input['sms_reply'])==0)
     164        {
     165            $result['errors'][]="Tin nhắn trả về khÃŽng được để trống";
     166        }
     167        else
     168        {
     169            /*
    169170            if ($this->Smstemplate_model->isExist(array('field'=>'login_name','value'=>$input['login_name'],'id'=>$input['id'])))
    170171            {
    171172                $result['errors'][]="Tên đăng nhập đã được sá»­ dụng";
    172173            }
    173         }
    174         if (strlen($input['cellphone'])==0)
    175         {
    176             $result['errors'][]="Số điện thoại khÃŽng được để trống";
    177         }
    178         else
    179         {
     174             *
     175             */
     176        }
     177        if (strlen($input['service_id'])==0)
     178        {
     179            $result['errors'][]="Mã dịch vụ khÃŽng được để trống";
     180        }
     181        else
     182        {
     183            /*
    180184            if ($this->Smstemplate_model->isExist(array('field'=>'cellphone','value'=>$input['cellphone'],'id'=>$input['id'])))
    181185            {
    182186                $result['errors'][]="Số điện thoại đã được sá»­ dụng";
    183187            }
    184         }
    185         if (strlen($input['passwd'])==0)
    186         {
    187             //$result['errors'][]="Mật khẩu khÃŽng được để trống";
    188         }
    189         if ($input['passwd'] != $input['passwd2'])
    190         {
    191             $result['errors'][]="Mật khẩu khÃŽng trùng nhau";
    192         }
     188             *
     189             */
     190        }
     191       
    193192        if (!isset($result['errors']))
    194         {
    195             unset($input['passwd2']);
    196             $input['passwd']=md5($input['activated']);
    197             $input['updated_time']=date("Y-m-d H:i:s");
     193        {
    198194            $this->load->model('Smstemplate_model');
    199             $this->Smstemplate_model->update($input['id'],$input);
     195            $this->Smstemplate_model->update($input['sms_id'],$input);
    200196            $result['success'] = 1;
    201197        }
Note: See TracChangeset for help on using the changeset viewer.