/**
  * 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 = EmployeeLeaveTypes::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemple #2
0
echo $form->hiddenField($model, 'employee_id', array('value' => $emp_id));
?>
		<?php 
echo $form->error($model, 'employee_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'employee_leave_type_id');
?>
		<?php 
//echo $form->textField($model,'employee_leave_type_id');
?>
        <?php 
echo $form->dropDownList($model, 'employee_leave_type_id', CHtml::listData(EmployeeLeaveTypes::model()->findAll(), 'id', 'name'), array('empty' => 'select Type'));
?>
		<?php 
echo $form->error($model, 'employee_leave_type_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'reason');
?>
		<?php 
echo $form->textField($model, 'reason', array('size' => 30, 'maxlength' => 255));
?>
		<?php 
echo $form->error($model, 'reason');
Exemple #3
0
?>
</table>
</div>
<br />
<h3><?php 
echo Yii::t('employees', 'Inactive Leave types');
?>
</h3>
<div class="tableinnerlist">
<table width="100%" cellpadding="0" cellspacing="0">
<tr class="pdtab-h">
	<td style="text-align:left;">Leave Type</td>
    <td>Edit</td>
    <td>Delete</td>
</tr>

<?php 
$inactive = EmployeeLeaveTypes::model()->findAll("status=:x", array(':x' => 2));
foreach ($inactive as $inactive_1) {
    echo '<tr><td style="padding-left:10px; text-align:left;">' . $inactive_1->name . '</td>';
    echo '<td>' . CHtml::link(Yii::t('employees', 'Edit'), array('update', 'id' => $inactive_1->id)) . '</td>';
    echo '<td>' . CHtml::link(Yii::t('employees', 'Delete'), array('delete', 'id' => $inactive_1->id), array('confirm' => Yii::t('employees', 'Are you Sure?'))) . '</td></tr>';
}
?>
</table>
</div>

</div>
    </td>
  </tr>
</table>
 public function actionEditLeave()
 {
     $model = EmployeeAttendances::model()->findByAttributes(array('id' => $_REQUEST['id']));
     // Ajax Validation enabled
     //$this->performAjaxValidation($model);
     // Flag to know if we will render the form or try to add
     // new jon.
     $flag = true;
     if (isset($_POST['EmployeeAttendances'])) {
         $old_model = $model->attributes;
         $flag = false;
         $model->attributes = $_POST['EmployeeAttendances'];
         if ($model->save()) {
             $employee = Employees::model()->findByAttributes(array('id' => $model->employee_id));
             $settings = UserSettings::model()->findByAttributes(array('user_id' => 1));
             if ($settings != NULL) {
                 $date = date($settings->displaydate, strtotime($model->attendance_date));
             }
             // Saving to activity feed
             $results = array_diff_assoc($_POST['EmployeeAttendances'], $old_model);
             // To get the fields that are modified.
             //print_r($old_model);echo '<br/><br/>';print_r($_POST['Students']);echo '<br/><br/>';print_r($results);echo '<br/><br/>'.count($results);echo '<br/><br/>';
             foreach ($results as $key => $value) {
                 if ($key != 'attendance_date') {
                     if ($key == 'employee_leave_type_id') {
                         $leave = EmployeeLeaveTypes::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($leave->name);
                     }
                     //Adding activity to feed via saveFeed($initiator_id,$activity_type,$goal_id,$goal_name,$field_name,$initial_field_value,$new_field_value)
                     ActivityFeed::model()->saveFeed(Yii::app()->user->Id, '27', $model->employee_id, ucfirst($employee->first_name) . ' ' . ucfirst($employee->middle_name) . ' ' . ucfirst($employee->last_name), $model->getAttributeLabel($key), $date, $value);
                 }
             }
             //END saving to activity feed
         }
     }
     if ($flag) {
         Yii::app()->clientScript->scriptMap['jquery.js'] = false;
         $this->renderPartial('update', array('model' => $model, 'day' => $_GET['day'], 'month' => $_GET['month'], 'year' => $_GET['year'], 'emp_id' => $_GET['emp_id']), false, true);
     }
 }
	window.location= 'index.php?r=report/default/employeeattendance&dep='+dep_id+'&mode='+mode_id+'&month='+month_value;
	
}

</script>

<?php 
$this->breadcrumbs = array('Report' => array('/report'), 'Employee Attendance Report');
?>

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'student-form', 'enableAjaxValidation' => false));
?>

<?php 
$leave_types = EmployeeLeaveTypes::model()->findAll();
$leave_hash = array();
foreach ($leave_types as $leave) {
    $leave_hash[$leave->id] = $leave->name;
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td width="247" valign="top">
        	<?php 
$this->renderPartial('left_side');
?>
        </td>
        <td valign="top"> 
            <div class="cont_right">
                <h1><?php