Example #1
0
                    </div> 
                 </div>
                <!--Other Info Tab end-->
                <!--Address Info Tab Start-->
                <div id="tab4" class="tab-content hide">
                    <div class="content-box-border">
                        <div class="content-bg-he">Address Info</div>
                        <div class="content-bg-inner">
                            <div class="content-bg-inner-one">
                                <table width="100%" cellpadding="0" cellspacing="0">
				<tr>
                                    <td class="table-cell-title" colspan="2" style="border-right:2px solid #FFAD12;text-align:center;font-size:20px">Local Address</td>
                                    <td class="table-cell-title" colspan="2" style=";text-align:center;font-size:20px">International Address</td>
                                </tr>
                                  <tr>
			<?php $address = EmployeeAddress::model()->findByPk($empInfo->employee_transaction_emp_address_id);?>
                                    <td class="table-cell-title" width="23%">Street 1</td>
                                    <td class="table-cell-content" width="23%"><?php echo (!empty($address->employee_address_c_line1) ? $address->employee_address_c_line1 :"Not Set"); ?></td>
                                    <td class="table-cell-title" width="23%">Street 1</td>
                                    <td class="table-cell-content" width="23%"><?php echo (!empty($address->employee_address_p_line1) ? $address->employee_address_p_line1 : "Not Set");?></td>
                                  </tr>
                                  <tr>
                                    <td class="table-cell-title">Street 2</td>
                                    <td class="table-cell-content"><?php echo (!empty($address->employee_address_c_line2) ? $address->employee_address_c_line2 : "Not Set"); ?></td>
                                    <td class="table-cell-title">Street 2</td>
                                    <td class="table-cell-content"><?php echo (!empty($address->employee_address_p_line2) ? $address->employee_address_p_line2 :"Not Set");?></td>
                                  </tr>
                                  <tr>
                                    <td class="table-cell-title">Country</td>
                                    <td class="table-cell-content">
				<?php if($address->employee_address_c_country!=0)
		$department = "<b>not set</b>";
	
	if($trans->employee_transaction_designation_id !=0)
		$designation = "<b>".EmployeeDesignation::model()->findByPk($trans->employee_transaction_designation_id)->employee_designation_name."</b>";
	else 
		$designation = "<b>not set</b>";
	
	$lin1 = "<b>not set</b>";
	$lin2 = "<b>not set</b>";
	$ct = "<b>not set</b>";
	$stat = "<b>not set</b>";
	$pc = "<b>not set</b>";

	if($trans->employee_transaction_emp_address_id !=0)
	{
		$address = EmployeeAddress::model()->findByPk($trans->employee_transaction_emp_address_id);
		$lin1 = "<b>".$address->employee_address_c_line1."</b>";
		$lin2 = "<b>".$address->employee_address_c_line2."</b>";
		$pc = "<b>".$address->employee_address_c_pincode."</b>";
		if($address->employee_address_c_city != 0)
		   $ct = "<b>".City::model()->findByPk($address->employee_address_c_city)->city_name."</b>";		
		if($address->employee_address_c_state != 0)
		   $stat = "<b>".State::model()->findByPk($address->employee_address_c_state)->state_name."</b>";	
	}


	$cdate = "<b>".date('d/m/Y')."</b>";
	$content = Certificate::model()->findByPk($certificate_type)->certificate_content;
	
	$content = str_replace('{title}',$titl,$content);
	$content = str_replace('{name}',$name,$content);
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $this->loadModel($id)->delete();
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         if (!Yii::app()->request->isPostRequest) {
             $emp_tran = EmployeeAddress::model()->findAll(array('condition' => 'employee_address_c_state=' . $id));
             $stud_tran = StudentAddress::model()->findAll(array('condition' => 'student_address_c_state=' . $id));
             $organization = Organization::model()->findAll(array('condition' => 'state=' . $id));
             $city = City::model()->findAll(array('condition' => 'state_id=' . $id));
             if (!empty($emp_tran) || !empty($stud_tran) || !empty($city) || !empty($organization)) {
                 throw new CHttpException(400, 'You can not delete this record because it is used in another table.');
             } else {
                 $this->loadModel($id)->delete();
                 $this->redirect(array('admin'));
             }
         } else {
             throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
         }
     }
 }
					else
					{
						$add_co = '';
					}
				echo "<td style='text-align:center; width:400px;'>".EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_line1."<br>".EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_line2."<br>".$add_c."<br>".$add_s."<br>".$add_co."</td>";
				}
				else  {
				echo "<td>&nbsp;</td>";
				  }
				
			}
			else if($s=='city')
			{
				if($sd['employee_transaction_emp_address_id'] !=0)
				{
					$add = EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id']);
					if($add->employee_address_c_city != null)
					echo "<td>".City::model()->findByPk($add->employee_address_c_city)->city_name."</td>";			
					else
					echo "<td>&nbsp;</td>";
				}
				else
				echo "<td>&nbsp;</td>";
			}
			else if($s=='employee_refer_designation')
				echo "<td>".EmployeeDesignation::model()->findByPk($sd['employee_transaction_designation_id'])->employee_designation_name."</td>";
			else if($s=='employee_type'){
				$ty = ($sd[$s]==1) ? "Teaching" : "Non-teaching";
				echo "<td>".$ty."</td>";	
			}
			else	
		if($key == "employee_first_name") {
		  $mname = substr($emp['employee_middle_name'], 0, 1);
	          $mname = $mname.".";
		  echo '<div class="name">'.$emp['employee_first_name']." ".$mname." ".$emp['employee_last_name'].'</div>';
		}
	?>

  	<?php
	if($key=='department_name')
		$field_value = Department::model()->findByPk($emp['employee_transaction_department_id'])->department_name;
	else if($key=='employee_designation')
		$field_value = EmployeeDesignation::model()->findByPk($emp['employee_transaction_designation_id'])->employee_designation_name;
	else if($key=='employee_address_c_line1')
	{
	  if(!empty($emp['employee_transaction_emp_address_id'])) {
		$curr_data = EmployeeAddress::model()->findByPk($emp['employee_transaction_emp_address_id']);
		$line1 = $curr_data->employee_address_c_line1;
		$line2 = $curr_data->employee_address_c_line2;

		if(!empty($curr_data->employee_address_c_city)) 
		$city = City::model()->findByPk($curr_data->employee_address_c_city)->city_name;

		$pin = $curr_data->employee_address_c_pincode;

		if(!empty($curr_data->employee_address_c_state))
		$state = State::model()->findByPk($curr_data->employee_address_c_state)->state_name;

		$label = $value;

		$field_value = $line1.", ".$line2." ".$city."-".$pin.",".$state;
		}
	/**
	 * Deletes a particular model.
	 * If deletion is successful, the browser will be redirected to the 'admin' page.
	 * @param integer $id the ID of the model to be deleted
	 */
	public function actionDelete($id)
	{
		$model = $this->loadModel($id);
		$employee_info = EmployeeInfo::model()->findByPk($model->employee_transaction_employee_id);
		if($model->employee_transaction_emp_address_id != null)
		$address = EmployeeAddress::model()->findByPk($model->employee_transaction_emp_address_id);
		$emp_photo = EmployeePhotos::model()->findByPk($model->employee_transaction_emp_photos_id);	
		if($model->employee_transaction_languages_known_id != null)	
		$lang_known = LanguagesKnown::model()->findByPk($model->employee_transaction_languages_known_id);
	
		$dir1 = Yii::getPathOfAlias('webroot').'/college_data/emp_images/';
		if($dh = opendir($dir1))
		{
			if($emp_photo->employee_photos_path == "no-images")
			{

			}
			else
			{
				if(file_exists($dir1.$emp_photo->employee_photos_path))
				{
					chmod($dir1.$emp_photo->employee_photos_path, 777);
					unlink($dir1.$emp_photo->employee_photos_path);				
				}
			}
		}
		closedir($dh);
		if($this->loadModel($id)->delete()){
		$use_model = User::model()->findByPk($model->employee_transaction_user_id)->delete();
		$emp_photo->delete();
		$employee_info->delete();
		if($model->employee_transaction_emp_address_id != null)
		$address->delete();
		if($model->employee_transaction_languages_known_id != null)	
		$lang_known->delete();
		}
		
		if(!isset($_GET['ajax']))
			$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
	}
 public function actionDelete($id)
 {
     if (Yii::app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $model = $this->loadModel($id);
         $employee_info = EmployeeInfo::model()->findByPk($model->employee_transaction_employee_id);
         if ($model->employee_transaction_emp_address_id != null) {
             $address = EmployeeAddress::model()->findByPk($model->employee_transaction_emp_address_id);
         }
         $emp_photo = EmployeePhotos::model()->findByPk($model->employee_transaction_emp_photos_id);
         if ($model->employee_transaction_languages_known_id != null) {
             $lang_known = LanguagesKnown::model()->findByPk($model->employee_transaction_languages_known_id);
         }
         $dir1 = Yii::getPathOfAlias('webroot') . '/emp_images/';
         if ($dh = opendir($dir1)) {
             if ($emp_photo->employee_photos_path == "no-images") {
             } else {
                 if (file_exists($dir1 . $emp_photo->employee_photos_path)) {
                     chmod($dir1 . $emp_photo->employee_photos_path, 777);
                     unlink($dir1 . $emp_photo->employee_photos_path);
                 }
             }
         }
         closedir($dh);
         if ($this->loadModel($id)->delete()) {
             $use_model = User::model()->findByPk($model->employee_transaction_user_id)->delete();
             $emp_photo->delete();
             $employee_info->delete();
             if ($model->employee_transaction_emp_address_id != null) {
                 $address->delete();
             }
             if ($model->employee_transaction_languages_known_id != null) {
                 $lang_known->delete();
             }
         }
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
         }
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
Example #8
0
						$add_s = State::model()->findByPk(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_state)->state_name.", ";	
					}
					else
					{
						$add_s = '';
					}

					if(!empty(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_country))
					{
						$add_co = Country::model()->findByPk(EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_country)->name;	
					}
					else
					{
						$add_co = '';
					}
				echo "<td style='text-align:center; width:400px;'>".EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_line1." ".EmployeeAddress::model()->findByPk($sd['employee_transaction_emp_address_id'])->employee_address_p_line2." ".$add_c." ".$add_s." ".$add_co."</td>";
				}
				else  {
				echo "<td>&nbsp;</td>";
				  }
				
			}
			else  {	
				if($s=='employee_private_email')
					echo "<td style='text-align:center;width:250px;'>";
				else
					echo "<td style='text-align:center;'>";
				echo $sd[$s]."</td>";
			}

		}
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = EmployeeAddress::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }