Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php	(revision 906)
@@ -136,13 +136,11 @@
 	
 	public function test(){
-		$aryMatch = array();
-		$phoneNumber = '987133325';
-		$regex = '/^[1,9][0-9]{8,9}$/';
-		if (preg_match('/^[1,9]([0-9]{8,9})$/', $phoneNumber, $aryMatch)){
-			$phoneNumber = "0".$phoneNumber;
-			echo $phoneNumber;
-		}else{
-			echo "Not match";
-		}
+		$this->load->model('collaborator/collaborator_model');
+		$province = ' Hà nội';
+		//$str = trim(ucwords($str));
+		$district = 'Quận Hai bà trưng';
+		$str = $this->collaborator_model->getProvinceAndDistict($province, $district);
+		var_dump($str);
+		//echo "Result: ".$str;
 	}
 }
Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/lecture.php	(revision 906)
@@ -53,5 +53,5 @@
             }
 			
-			if ($u['province'] == '' && $u['p_id'] != ''){
+			if ((!$u['province'] || !$u['district']) && $u['p_id'] != ''){
 				$update_user_info=1;
 			}
Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 906)
@@ -286,4 +286,7 @@
 				if (strlen($input['province']) == 0) {
                     $result['errors'][] = array("content"=>lang('_SBG_PROVINCE_REQUIRED_MSG'),"field"=>"province");
+                }
+				if (strlen($input['district']) == 0) {
+                    $result['errors'][] = array("content"=>lang('_SBG_DISTRICT_REQUIRED_MSG'),"field"=>"district");
                 }
                 $input['password'] = '';
Index: pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php	(revision 906)
@@ -100,11 +100,12 @@
 				$this->db->insert ( 'tbluser', $user );
 				//write_file('./log/test.log', date("H:i:s m-d-Y").": ". var_export($user, TRUE)."\n" , FOPEN_WRITE_CREATE);
-				$aryPatterns = array ('/:trialdays:/', '/:username:/', '/:password:/');
+				//$aryPatterns = array ('/:trialdays:/', '/:username:/', '/:password:/');
+				$aryPatterns = array ('/:username:/', '/:password:/');
 				$trialdays = $this->config->item('trial_period');
 				$trialdays = strlen($trialdays) < 2 ? '0'. $trialdays : $trialdays;
 				if ($this->isViettel($username)){
-					$sms = preg_replace($aryPatterns, array($trialdays. ' ngay', $username, $password), lang('_SBG_MO_USER_VIETTEL_REGISTER_SUCCESS_MSG'));
+					$sms = preg_replace($aryPatterns, array($username, $password), lang('_SBG_MO_USER_VIETTEL_REGISTER_SUCCESS_MSG'));
 				}else{
-					$aryPatterns = array ('/:username:/', '/:password:/');
+					//$aryPatterns = array ('/:username:/', '/:password:/');
 					$sms = preg_replace($aryPatterns, array($username, $password), lang('_SBG_MO_USER_NOT_VIETTEL_REGISTER_SUCCESS_MSG'));
 				}
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php	(revision 906)
@@ -93,8 +93,12 @@
 						</div>
 						<div class="form-group">
-							<label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáº­n / Huyá»n</label>
+							<label for="form-field-district" class="col-sm-4 control-label no-padding-right">Quáº­n / Huyá»n</label>
 							<div class="col-sm-8">
 								<select name="district" id="form-field-district" class="input-large"></select>
+								<label class="block clearfix has-error">
+									<div id="district" class="help-block error"></div>
+                                </label> 
 							</div>
+							
 						</div>
 
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php	(revision 906)
@@ -26,5 +26,6 @@
             <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Tá»nh / ThÃ nh phá»</label>
             <div class="col-sm-8">
-                <select name="province" id="form-field-province" class="form-field-province col-xs-12 col-sm-10">
+                <select name="province" id="form-field-province" class="form-field-province-user col-xs-12 col-sm-10">
+					<option></option>
                     <?php foreach ($provinces as $key => $pro): ?>
                         <option value="<?php echo $key; ?>" <?php if ($user['province'] == $key) echo "selected"; ?>><?php echo $pro; ?></option>
@@ -38,5 +39,5 @@
 			<label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáº­n / Huyá»n</label>
 			<div class="col-sm-8">
-				<select name="district" id="form-field-district" class="form-field-district col-xs-12 col-sm-10">
+				<select name="district" id="form-field-district" class="form-field-district-user col-xs-12 col-sm-10">
 
 				</select>
@@ -60,11 +61,54 @@
 var district_id = "<?php echo $user['district']; ?>";
 var province_id = "<?php echo $user['province']; ?>";
+
 $(document).ready(function(){
-	$(".form-field-province").change(function(){
+	$(".form-field-province-user").change(function(){
 		changeEventProvince(province_id);
 	});
-	if ($(".form-field-province").val() !== 'undefined'){
+	if ($(".form-field-province-user").val() !== 'undefined'){
 		checkSelectedDistrict(province_id);
 	}
 });
+
+function changeEventProvince(provinceId){
+	$(".form-field-district-user").html("");
+	$.ajax({
+        url: '/frontend/user/getDistrict/' + provinceId,
+        type: 'POST',
+        success: function (data, textStatus, jqXHR)
+        {
+            result = jQuery.parseJSON(data);
+			content = "<option></option>";
+			if (result != null){
+				for (var i in result){			
+					content = content + '<option value="' + result[i].district_id + '">'+ result[i].type + " "  + result[i].district_name + '</option>'
+				}
+			}
+			$(".form-field-district-user").html(content);
+        }
+    });
+}
+
+function checkSelectedDistrict(provinceId){
+	$.ajax({
+        url: '/frontend/user/getDistrict/' + provinceId,
+        type: 'POST',
+        success: function (data, textStatus, jqXHR)
+        {
+            result = jQuery.parseJSON(data);	
+			content = "<option></option>";
+			if (result != null){
+				for (var i in result){
+					if (result[i].district_id === district_id){
+						content = content + '<option value="' + result[i].district_id + '" selected >' + result[i].type + " " + result[i].district_name + '</option>';
+					}else{
+						content = content + '<option value="' + result[i].district_id + '">' + result[i].type + " "  + result[i].district_name + '</option>';
+					}
+				}
+				
+			}
+			$(".form-field-district-user").html(content);
+        }
+    });
+}
 </script>
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php	(revision 906)
@@ -302,5 +302,5 @@
                                         <div class="alert alert-block alert-success">						
                                             <p>
-                                                QuÃœ vá» cÅ©ng cÃ³ thá» sá»­ dá»¥ng sá» Äiá»n thoáº¡i&nbsp;<strong><?php echo $username;?></strong> vÃ  soáº¡n tin theo cÃº phÃ¡p: <strong>SBG VIP 1</strong> (hay VIP 3, VIP 6, VIP 12) <strong>gá»­i tá»i 8062</strong> (Há» thá»ng sáºœ trá»« tiá»n trÃªn tÃ i khoáº£n chÃ­nh cá»§a sá» Äiá»n thoáº¡i&nbsp;<strong><?php echo $username;?></strong>)
+                                                QuÃœ vá» cÅ©ng cÃ³ thá» sá»­ dá»¥ng sá» Äiá»n thoáº¡i&nbsp;<strong><?php echo $username;?></strong> vÃ  soáº¡n tin theo cÃº phÃ¡p: <strong>SBG VIP 1</strong> (hay VIP 3) <strong>gá»­i tá»i 8062</strong> (Há» thá»ng sáºœ trá»« tiá»n trÃªn tÃ i khoáº£n chÃ­nh cá»§a sá» Äiá»n thoáº¡i&nbsp;<strong><?php echo $username;?></strong>)
                                         </p>
                                         </div>
