public function actiongettransferempdata()
 {
     $des = array();
     $dep = array();
     $shf = array();
     $org_id = $_REQUEST['EmployeeTransaction']['employee_transaction_organization_id'];
     $data1 = EmployeeDesignation::model()->findAll(array('condition' => 'employee_designation_organization_id=' . (int) $org_id));
     $data2 = Department::model()->findAll(array('condition' => 'department_organization_id=' . (int) $org_id));
     $data3 = Shift::model()->findAll(array('condition' => 'shift_organization_id=' . (int) $org_id));
     $data1 = CHtml::listData($data1, 'employee_designation_id', 'employee_designation_name');
     $data2 = CHtml::listData($data2, 'department_id', 'department_name');
     $data3 = CHtml::listData($data3, 'shift_id', 'shift_type');
     foreach ($data1 as $value1 => $name1) {
         $des .= CHtml::tag('option', array('value' => $value1), CHtml::encode($name1), true);
     }
     foreach ($data2 as $value2 => $name2) {
         $dep .= CHtml::tag('option', array('value' => $value2), CHtml::encode($name2), true);
     }
     foreach ($data3 as $value3 => $name3) {
         $shf .= CHtml::tag('option', array('value' => $value3), CHtml::encode($name3), true);
     }
     echo CJSON::encode(array('des' => $des, 'dep' => $dep, 'shf' => $shf));
 }
 /**
  * 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 = Shift::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
<?php

$EmployeeInfo = EmployeeInfo::model()->findByPk($employee_transaction[0]->employee_transaction_employee_id);
if ($employee_transaction[0]->employee_transaction_category_id != null) {
    $Category = Category::model()->findByPk($employee_transaction[0]->employee_transaction_category_id);
} else {
    $Category = new Category();
}
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();
}
?>
/*
$this->breadcrumbs=array(
	'Employee Transactions'=>array('admin'),
	'Manage',
);*/
$this->menu = array();
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('employee-transaction-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Reset Employee Password</h1>


<?php 
//echo CHtml::link('Advanced Search','#',array('class'=>'search-button'));
$dataProvider = $model->search();
if (Yii::app()->user->getState("pageSize", @$_GET["pageSize"])) {
    $pageSize = Yii::app()->user->getState("pageSize", @$_GET["pageSize"]);
} else {
    $pageSize = Yii::app()->params['pageSize'];
}
$dataProvider->getPagination()->setPageSize($pageSize);
?>

<div class="block-error">
		<?php 
echo Yii::app()->user->getFlash('resetemppassword');
?>
	</div>
<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'employee-transaction-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'columns' => array(array('header' => 'SI No', 'class' => 'IndexColumn'), array('name' => 'employee_no', 'value' => '$data->Rel_Emp_Info->employee_no'), array('name' => 'employee_attendance_card_id', 'value' => '$data->Rel_Emp_Info->employee_attendance_card_id'), array('name' => 'employee_first_name', 'value' => '$data->Rel_Emp_Info->employee_first_name'), array('name' => 'category_name', 'value' => '($data->category_name == 0)? "Not Set" :$data->Rel_Category->category_name'), array('name' => 'employee_transaction_department_id', 'value' => 'Department::model()->findByPk($data->employee_transaction_department_id)->department_name', 'filter' => CHtml::listData(Department::model()->findAll(array('condition' => '	department_organization_id=' . Yii::app()->user->getState('org_id'))), 'department_id', 'department_name')), array('name' => 'employee_transaction_shift_id', 'value' => 'Shift::model()->findByPk($data->employee_transaction_shift_id)->shift_type', 'filter' => CHtml::listData(Shift::model()->findAll(array('condition' => '	shift_organization_id=' . Yii::app()->user->getState('org_id'))), 'shift_id', 'shift_type')), array('name' => 'user_organization_email_id', 'value' => '$data->Rel_user1->user_organization_email_id'), array('class' => 'CButtonColumn', 'template' => '{Reset Password}', 'buttons' => array('Reset Password' => array('label' => 'Reset Password', 'url' => 'Yii::app()->createUrl("user/update_emp_password", array("id"=>$data->employee_transaction_user_id))', 'imageUrl' => Yii::app()->baseUrl . '/images/Reset Password.png')))), 'pager' => array('class' => 'AjaxList', 'maxButtonCount' => $model->count(), 'header' => '')));
	foreach($resign_emp_data as $list)
	{
		$emp_info = EmployeeInfo::model()->resetScope()->findByAttributes(array('employee_info_transaction_id'=>$list['employee_transaction_id']));
		$emp_level_max = Yii::app()->db->createCommand()
				->select('MAX(reporting_priority),employee_exit_reporting_employee_id')
				->from('employee_exit_reporting')
				->group('employee_exit_employee_id')
				->where('employee_exit_employee_id ='.$list['employee_transaction_id'])
				->queryRow();
		
		$max_priority = $emp_level_max['MAX(reporting_priority)'];
		$reporting_emp_id = EmployeeExitReporting::model()->findByAttributes(array('employee_exit_employee_id'=>$list['employee_transaction_id'],'reporting_priority'=>$max_priority));
		$report_emp = $reporting_emp_id['employee_exit_reporting_employee_id'];
		$exit_details = EmployeeExitDetails::model()->findByAttributes(array('employee_exit_details_employee_id'=>$list['employee_transaction_id'],'reporting_employee_id'=>$report_emp,'reporting_employee_review_status'=>2));
		$app_date = $exit_details['employee_resign_application_date'];
?>
	<tr>
		<td><?php echo $emp_info['employee_first_name']?></td>
		<td><?php echo $emp_info['employee_last_name']?></td>
		<td><?php echo $emp_info['employee_attendance_card_id']?></td>
		<td><?php echo EmployeeDesignation::model()->findByPk($list['employee_transaction_designation_id'])->employee_designation_name;?></td>
		<td><?php echo Department::model()->findByPk($list['employee_transaction_department_id'])->department_name;?></td>
		<td><?php echo Shift::model()->findByPk($list['employee_transaction_shift_id'])->shift_type;?></td>
		<td><?php echo $emp_info['employee_left_transfer_date'];?></td>
		<td><?php echo $app_date;?></td>
	</tr>
		<?php
	}
?>
	</table>
</div>

<div class = "row_all_v">
	<div class="rowv">
		<?php 
echo '<lable><b>Shift :</b></lable>';
?>
		<div class="rown">
			<?php 
//echo $model->Rel_Shift->shift_type .'<br>';
?>
			<?php 
$shiftid = StudentTransaction::model()->findByPk($model->student_archive_stud_tran_id)->student_transaction_shift_id;
?>
			<?php 
echo Shift::model()->findByPk($shiftid)->shift_type;
?>
		
		</div>
	</div>

	<div class="rowv">
		<?php 
echo '<lable><b>Division :</b></lable>';
?>
		<div class="rown">
			<?php 
//if(isset($model->Rel_Division->division_name)) echo $model->Rel_Division->division_name .'<br>';
//else echo "N/A";
?>
				<?php 
				
		<td>
		      <?php 
            echo EmployeeDesignation::model()->findByPk($v['employee_transaction_designation_id'])->employee_designation_name;
            ?>
		
		</td>
		<td>
		      <?php 
            echo Department::model()->findByPk($v['employee_transaction_department_id'])->department_name;
            ?>
		
		</td>
		<td>
		      <?php 
            echo Shift::model()->findByPk($v['employee_transaction_shift_id'])->shift_type;
            ?>
		
		</td>
		<td>
		      <?php 
            echo Organization::model()->findByPk($v['employee_transaction_organization_id'])->organization_name;
            ?>
		
		</td>
 	   </tr> 
       <?php 
        }
        // end if
    }
    // end for loop
    $Nationality = Nationality::model()->findByPk($student_transaction[0]->student_transaction_nationality_id);
} else {
    $Nationality = new Nationality();
}
if ($student_transaction[0]->student_transaction_quota_id != null) {
    $Quota = Quota::model()->findByPk($student_transaction[0]->student_transaction_quota_id);
} else {
    $Quota = new Quota();
}
if ($student_transaction[0]->student_transaction_religion_id != null) {
    $Religion = Religion::model()->findByPk($student_transaction[0]->student_transaction_religion_id);
} else {
    $Religion = new Religion();
}
$Branch = Branch::model()->findByPk($student_transaction[0]->student_transaction_branch_id);
$Shift = Shift::model()->findByPk($student_transaction[0]->student_transaction_shift_id);
$Division = Division::model()->findByPk($student_transaction[0]->student_transaction_division_id);
$Batch = Batch::model()->findByPk($student_transaction[0]->student_transaction_batch_id);
$Organization = Organization::model()->findByPk($student_transaction[0]->student_transaction_organization_id);
if ($student_transaction[0]->student_transaction_languages_known_id != null) {
    $LanguagesKnown = LanguagesKnown::model()->findByPk($student_transaction[0]->student_transaction_languages_known_id);
} else {
    $LanguagesKnown = new $LanguagesKnown();
}
if ($student_transaction[0]->student_transaction_languages_known_id != null) {
    $StudentAddress = StudentAddress::model()->findByPk($student_transaction[0]->student_transaction_student_address_id);
} else {
    $StudentAddress = new $StudentAddress();
}
?>
<h3>Student Detail</h3>
Example #9
0
		'filter' =>CHtml::listData(EmployeeDesignation::model()->findAll(),
	'employee_designation_id','employee_designation_name'),

		),
		array(
			'header' => 'Department',		
			'name'=>'employee_transaction_department_id',
			'value'=>'Department::model()->findByPk($data->employee_transaction_department_id)->department_name',
				'filter' =>CHtml::listData(Department::model()->findAll(),'department_id','department_name'),

		), 
		array(  
			'header' => 'Shift',
			'name'=>'employee_transaction_shift_id',
			'value'=>'Shift::model()->findByPk($data->employee_transaction_shift_id)->shift_type',
			'filter' =>CHtml::listData(Shift::model()->findAll(),'shift_id','shift_type'),

		), 
		
		array('header'=>'Resign Application Date',
			'value'=>'date_format(new DateTime(EmployeeExitDetails::model()->findByAttributes(array("employee_exit_details_employee_id"=>$data->employee_transaction_id,"reporting_employee_review_status"=>2))->employee_resign_approve_date),"d-m-Y")',
			'filter' =>false,
		),
		array('header'=>'Resign Approve Date',
			'value'=>'date_format(new DateTime($data->Rel_Emp_Info->employee_left_transfer_date),"d-m-Y")',
			'filter' =>false,
		),
		
	
	),
<?php 
}
if (Yii::app()->user->hasFlash('success')) {
    ?>
	<div class="flash-success">
		<?php 
    echo Yii::app()->user->getFlash('success');
    ?>
	</div>
<?php 
}
?>

</div>



<?php 
$dataProvider = $model->search();
if (Yii::app()->user->getState("pageSize", @$_GET["pageSize"])) {
    $pageSize = Yii::app()->user->getState("pageSize", @$_GET["pageSize"]);
} else {
    $pageSize = Yii::app()->params['pageSize'];
}
$dataProvider->getPagination()->setPageSize($pageSize);
?>


<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'employee-transaction-grid', 'dataProvider' => $dataProvider, 'filter' => $model, 'ajaxUpdate' => false, 'columns' => array(array('header' => 'SI No', 'class' => 'IndexColumn'), array('header' => 'Employee No', 'name' => 'employee_no', 'value' => '$data->Rel_Emp_Info->employee_no'), array('header' => 'Attendence Card No', 'name' => 'employee_attendance_card_id', 'value' => '$data->Rel_Emp_Info->employee_attendance_card_id'), array('header' => 'Name', 'name' => 'employee_first_name', 'value' => '$data->Rel_Emp_Info->employee_first_name'), array('header' => 'Surname', 'name' => 'employee_last_name', 'value' => '$data->Rel_Emp_Info->employee_last_name'), array('header' => 'Designation', 'name' => 'employee_transaction_designation_id', 'value' => 'EmployeeDesignation::model()->findByPk($data->employee_transaction_designation_id)->employee_designation_name', 'filter' => CHtml::listData(EmployeeDesignation::model()->findAll(array('condition' => 'employee_designation_organization_id=' . Yii::app()->user->getState('org_id'))), 'employee_designation_id', 'employee_designation_name')), array('header' => 'Department', 'name' => 'employee_transaction_department_id', 'value' => 'Department::model()->findByPk($data->employee_transaction_department_id)->department_name', 'filter' => CHtml::listData(Department::model()->findAll(array('condition' => '	department_organization_id=' . Yii::app()->user->getState('org_id'))), 'department_id', 'department_name')), array('header' => 'Shift', 'name' => 'employee_transaction_shift_id', 'value' => 'Shift::model()->findByPk($data->employee_transaction_shift_id)->shift_type', 'filter' => CHtml::listData(Shift::model()->findAll(array('condition' => '	shift_organization_id=' . Yii::app()->user->getState('org_id'))), 'shift_id', 'shift_type')), array('type' => 'raw', 'value' => 'CHtml::image("../emp_images/" . $data->Rel_Photo->employee_photos_path, "No Image",array("width"=>"20px","height"=>"20px"))'), array('class' => 'MyCButtonColumn', 'template' => '{update} {delete}')), 'pager' => array('class' => 'AjaxList', 'maxButtonCount' => $model->count(), 'header' => '')));