/**
  * 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)
 {
     $languae_known = LanguagesKnown::model()->findAll(array('condition' => 'languages_known1=' . $id . ' OR  languages_known2=' . $id . ' OR languages_known3=' . $id . ' OR languages_known4=' . $id));
     if (!empty($languae_known)) {
         throw new CHttpException(400, 'You can not delete this record because it is used in another table.');
     } else {
         $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'));
     }
 }
	
	
	
</style>
<?php
$StudentInfo = StudentInfo::model()->findByPk($student_transaction[0]->student_transaction_student_id);
$AcademicTermPeriod = AcademicTermPeriod::model()->findByPk($student_transaction[0]->academic_term_period_id);
$AcademicTerm = AcademicTerm::model()->findByPk($student_transaction[0]->academic_term_id);
if($student_transaction[0]->student_transaction_nationality_id != null)
$Nationality = Nationality::model()->findByPk($student_transaction[0]->student_transaction_nationality_id);
else
$Nationality = new Nationality;
$Batch = Batch::model()->findByPk($student_transaction[0]->student_transaction_batch_id);
$Course = Course::model()->findByPk($student_transaction[0]->course_id);
if($student_transaction[0]->student_transaction_languages_known_id != null)
$LanguagesKnown = LanguagesKnown::model()->findByPk($student_transaction[0]->student_transaction_languages_known_id);
if($student_transaction[0]->student_transaction_student_address_id != null)
$StudentAddress = StudentAddress::model()->findByPk($student_transaction[0]->student_transaction_student_address_id);
else
$StudentAddress = new StudentAddress;
if($student_transaction[0]->student_transaction_parent_id != null || $student_transaction[0]->student_transaction_parent_id != 0)
$parent = ParentLogin::model()->findByPk($student_transaction[0]->student_transaction_parent_id);
else
$parent = new ParentLogin;
?>
<h3 class="title">Student Detail</h3>

<table class="no_border">

	<tr>
 /**
  * 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 = LanguagesKnown::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * 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) {
             $languages_known1 = LanguagesKnown::model()->findAll(array('condition' => 'languages_known1=' . $id));
             $languages_known2 = LanguagesKnown::model()->findAll(array('condition' => 'languages_known2=' . $id));
             if (!empty($languages_known1) || !empty($languages_known2)) {
                 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.');
         }
     }
 }
 /**
  * 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
         $model = $this->loadModel($id);
         $student_info = StudentInfo::model()->findByPk($model->student_transaction_student_id);
         if ($model->student_transaction_student_address_id != null) {
             $address = StudentAddress::model()->findByPk($model->student_transaction_student_address_id);
         }
         $stud_photo = StudentPhotos::model()->findByPk($model->student_transaction_student_photos_id);
         if ($model->student_transaction_languages_known_id != null) {
             $lang_known = LanguagesKnown::model()->findByPk($model->student_transaction_languages_known_id);
         }
         $dir1 = Yii::getPathOfAlias('webroot') . '/college_data/stud_images/';
         if ($dh = opendir($dir1)) {
             if ($stud_photo->student_photos_path == "no-images") {
             } else {
                 if (file_exists($dir1 . $stud_photo->student_photos_path)) {
                     //chmod($dir1.$stud_photo->student_photos_path, 777);
                     unlink($dir1 . $stud_photo->student_photos_path);
                 }
             }
         }
         closedir($dh);
         if ($this->loadModel($id)->delete()) {
             $use_model = User::model()->findByPk($model->student_transaction_user_id)->delete();
             $stud_photo->delete();
             $student_info->delete();
             if ($model->student_transaction_student_address_id != null) {
                 $address->delete();
             }
             if ($model->student_transaction_languages_known_id != null) {
                 $lang_known->delete();
             }
             StudentPaidFeesDetails::model()->deleteAll("student_paid_student_id = :studId", array(':studId' => $id));
             StudentAcademicRecordTrans::model()->deleteAll("student_academic_record_trans_stud_id = :studId", array(':studId' => $id));
             StudentDocsTrans::model()->deleteAll("student_docs_trans_user_id = :studId", array(':studId' => $id));
         }
         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.');
     }
 }
}
if ($employee_transaction[0]->employee_transaction_religion_id != null) {
    $Religion = Religion::model()->findByPk($employee_transaction[0]->employee_transaction_religion_id);
} else {
    $Religion = new Religion();
}
$Shift = Shift::model()->findByPk($employee_transaction[0]->employee_transaction_shift_id);
$EmployeeDesignation = EmployeeDesignation::model()->findByPk($employee_transaction[0]->employee_transaction_designation_id);
if ($employee_transaction[0]->employee_transaction_nationality_id != null) {
    $Nationality = Nationality::model()->findByPk($employee_transaction[0]->employee_transaction_nationality_id);
} else {
    $Nationality = new Nationality();
}
$Department = Department::model()->findByPk($employee_transaction[0]->employee_transaction_department_id);
if ($employee_transaction[0]->employee_transaction_languages_known_id != null) {
    $LanguagesKnown = LanguagesKnown::model()->findByPk($employee_transaction[0]->employee_transaction_languages_known_id);
}
$Organization = Organization::model()->findByPk($employee_transaction[0]->employee_transaction_organization_id);
if ($employee_transaction[0]->employee_transaction_emp_address_id != null) {
    $EmployeeAddress = EmployeeAddress::model()->findByPk($employee_transaction[0]->employee_transaction_emp_address_id);
} else {
    $EmployeeAddress = new EmployeeAddress();
}
?>
<h3>Employee Detail</h3>
<h4>Personal Info</h4>
<table border="1" width="200px">
<tr>
	<td>
	<label> Employee ID   </label>
	</td>
	public function actionStudentperformance()
	{
	   $id = Yii::app()->user->getState('stud_id');
	   $model=StudentTransaction::model()->findByPk($id);
	   $info = StudentInfo::model()->findByPk($model->student_transaction_student_id);
	   $address = StudentAddress::model()->findByPk($model->student_transaction_student_address_id);
	   $photo = StudentPhotos::model()->findByPk($model->student_transaction_student_photos_id);
	   $lang = LanguagesKnown::model()->findByPk($model->student_transaction_languages_known_id);
	   $stud_qua = new StudentAcademicRecordTrans;
	   $stud_feed = new FeedbackDetailsTable;
	   $studentcertificate=new StudentCertificateDetailsTable;
	   $studentdocstrans=new StudentDocsTrans;
	   $stud_qua=new StudentAcademicRecordTrans;
	   $stud_feed=new FeedbackDetailsTable('mysearch');
	   $parent = new ParentLogin;
		
	   $stud_feed->unsetAttributes();  // clear any default values
		if(isset($_GET['FeedbackDetailsTable']))
			$stud_feed->attributes=$_GET['FeedbackDetailsTable'];

		$this->render('update',array(
			'model'=>$model,'info'=>$info,'photo'=>$photo,'address'=>$address,'lang'=>$lang,'studentdocstrans'=>$studentdocstrans, 'stud_qua'=>$stud_qua,'stud_feed'=>$stud_feed,'flag'=>0,'studentcertificate'=>$studentcertificate,'parent'=>$parent
		));
	}
		
		    	),
			'htmlOptions'=>array(
			'size'=>13,
		    	),
			));

		?><span class="status">&nbsp;</span>
		<?php echo $form->error($info,'visa_exp_date'); ?>
		</div>
		<div class="row-right">
<table style="width:auto">
<tr>
<td style='max-width: 144px;'>
		<?php
		$data=LanguagesKnown::model()->findAll(array('condition'=>'languages_known_id='.$model->student_transaction_languages_known_id));

		foreach($data as $d=>$row)
		{
			 $langss=$row['languages_known1'];
		}

		$langArr = array();
		$as=explode(',',$langss);

		foreach($as as $ai)
		{
		  $langArr[$ai] =  array('selected'=>true);
		}

		echo $form->labelEx($lang,'Languages Known',array('style'=>'width:143px')); 
if (LanguagesKnown::model()->findByPk($langknownid)->languages_known3 != 0) {
    echo Languages::model()->findByPk(LanguagesKnown::model()->findByPk($langknownid)->languages_known3)->languages_name;
    echo "</br>";
} else {
    echo "N/A.</br>";
}
?>
 
			</div>	
		</div>		
		<div class="rowv">
				<?php 
echo '<lable><b>Language 4 :</b></lable>';
?>
			<div class="rown"> 
				
				<?php 
if (LanguagesKnown::model()->findByPk($langknownid)->languages_known4 != 0) {
    echo Languages::model()->findByPk(LanguagesKnown::model()->findByPk($langknownid)->languages_known4)->languages_name;
    echo "</br>";
} else {
    echo "N/A.</br>";
}
?>

			</div>
		</div>
	</div>	


	/**
	 * 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'));
	}
	/**
	 * 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);
		$student_info = StudentInfo::model()->findByPk($model->student_transaction_student_id);
		if($model->student_transaction_student_address_id != null)
		$address = StudentAddress::model()->findByPk($model->student_transaction_student_address_id);
		$stud_photo = StudentPhotos::model()->findByPk($model->student_transaction_student_photos_id);
		if($model->student_transaction_languages_known_id != null)		
		$lang_known = LanguagesKnown::model()->findByPk($model->student_transaction_languages_known_id);
		$yearModel=new Year;
		//$assign_comp_model = assignCompanyUserTable::model()->findByPk($ass_comp->id);
		$dir1 = Yii::getPathOfAlias('webroot').'/college_data/stud_images/';
		if($dh = opendir($dir1))
		{
			if($stud_photo->student_photos_path == "no-images")
			{

			}
			else
			{
				if(file_exists($dir1.$stud_photo->student_photos_path))
				{
					//chmod($dir1.$stud_photo->student_photos_path, 777);
					unlink($dir1.$stud_photo->student_photos_path);				
				}
			}
		}
		closedir($dh);
		if($model->delete()){
		$use_model = User::model()->findByPk($model->student_transaction_user_id)->delete();
		$stud_photo->delete();
		$student_info->delete();
		if($model->student_transaction_student_address_id != null)
		$address->delete();
		if($model->student_transaction_languages_known_id != null)
		$lang_known->delete();
		}
		//echo $model->student_transaction_student_id; exit;

		// 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'));
	}
 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.');
     }
 }