Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php	(revision 396)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php	(revision 401)
@@ -56,5 +56,5 @@
         $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
         $data['total'] = $this->collabolator_model->countCollaborator($data);  
-        $data['collaborators'] = $this->collabolator_model->getCollaborator($data);
+        $data['collaborators'] = $this->collabolator_model->getCollaborators($data);
 
         $data['paging_url'] = base_url() . "/admin/cong_tac_vien/trang/";
@@ -121,26 +121,81 @@
         echo json_encode($result);
     }
-
+    public function viewUser()
+    {
+        $id=$this->uri->segment(4);
+        $this->load->model('collabolator_model');
+        $data=$this->collabolator_model->getCollaborator($id);
+        $this->load->view('collaborator/viewUser',$data);
+    }
+    public function editUser()
+    {
+        $id=$this->uri->segment(4);
+        $this->load->model('collabolator_model');
+        $data=$this->collabolator_model->getCollaborator($id);
+        $this->load->view('collaborator/editUser',$data);
+    }
+    public function updateUser()
+    {
+        $input['activated']=0;
+        $input=  array_merge($input,$this->input->post());
+        $this->load->model('collabolator_model');
+        if (strlen($input['full_name'])==0)
+        {
+            $result['errors'][]="TÃªn cá»ng tÃ¡c viÃªn khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        if (strlen($input['login_name'])==0)
+        {
+            $result['errors'][]="TÃªn ÄÄng nháº­p khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        else
+        {
+            if ($this->collabolator_model->isExist(array('field'=>'login_name','value'=>$input['login_name'],'id'=>$input['id'])))
+            {
+                $result['errors'][]="TÃªn ÄÄng nháº­p ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng";
+            }
+        }
+        if (strlen($input['cellphone'])==0)
+        {
+            $result['errors'][]="Sá» Äiá»n thoáº¡i khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        else
+        {
+            if ($this->collabolator_model->isExist(array('field'=>'cellphone','value'=>$input['cellphone'],'id'=>$input['id'])))
+            {
+                $result['errors'][]="Sá» Äiá»n thoáº¡i ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng";
+            }
+        }
+        if (strlen($input['passwd'])==0)
+        {
+            //$result['errors'][]="Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        if ($input['passwd'] != $input['passwd2'])
+        {
+            $result['errors'][]="Máº­t kháº©u khÃŽng trÃ¹ng nhau";
+        }
+        if (!isset($result['errors']))
+        {
+            unset($input['passwd2']);
+            $input['activated']=1;
+            $input['updated_time']=date("Y-m-d H:i:s");
+            $this->load->model('collabolator_model');
+            $this->collabolator_model->update($input['id'],$input);
+            $result['success'] = 1;
+        }
+        echo json_encode($result);
+    }
     public function test() {
         
-        $this->load->library('doctrine');
+       
         for ($i = 1; $i <= 500; $i++) {
-            $collaborator = new Entities\Tblcollaborator();
-            $collaborator->setActivated(rand(0, 1));
-            $collaborator->setAuthor(1);
-            $collaborator->setCellphone('0' . (1695061706 + $i));
-            $collaborator->setCreatedTime(date("Y-m-d H:i:s"));
-            $collaborator->setFullName("Full Name " . $i);
-            $collaborator->setLoginName("loginname" . $i);
-            $collaborator->setPasswd(md5("12345678"));
-            $collaborator->setUpdatedTime(date("Y-m-d H:i:s"));
-            try {
-                $this->doctrine->em->persist($collaborator);
-                $this->doctrine->em->flush();
-                $result['success'] = 1;
-            } catch (Exception $e) {
-
-                echo $e;
-            }
+            $input['full_name']="Full Name ".$i;
+            $input['login_name']="loginname".$i;
+            $input['passwd']=md5("12345678");
+            $input['cellphone']="01234567".(100+$i);
+            $input['activated']=rand(0,1);
+            $input['created_time']=date("Y-m-d H:i:s");
+            $input['updated_time']=date("Y-m-d H:i:s");
+            $this->load->model('collabolator_model');
+            $this->collabolator_model->insert($input);
         }
     }
