Ejemplo n.º 1
0
?>
</td>
    <td><?php 
echo $form->textField($model, 'name', array('size' => 30, 'maxlength' => 255));
?>
		<?php 
echo $form->error($model, 'name');
?>
</td>
    <td><?php 
echo $form->labelEx($model, 'employee_category_id');
?>
</td>
    <td> 
	<?php 
echo $form->dropDownList($model, 'employee_category_id', CHtml::listData(EmployeeCategories::model()->findAll(), 'id', 'name'), array('empty' => 'Select Category'));
?>
	
		<?php 
echo $form->error($model, 'employee_category_id');
?>
</td>
  </tr>
</table>

	<div class="row">
		<?php 
// echo $form->labelEx($model,'status');
?>
		<?php 
echo $form->hiddenField($model, 'status', array('value' => 1));
Ejemplo n.º 2
0
                         <td>
							<?php 
if ($employee->joining_date) {
    if ($settings != NULL) {
        $employee->joining_date = date($settings->displaydate, strtotime($employee->joining_date));
    }
    echo $employee->joining_date;
}
?>
                        </td>
                        <td><strong><?php 
echo Yii::t('teachersportal', 'Category');
?>
</strong></td>
                        <td><?php 
$cat = EmployeeCategories::model()->findByAttributes(array('id' => $employee->employee_category_id));
if ($cat != NULL) {
    echo $cat->name;
}
?>
						</td>
                        <?php 
/*?><td><strong><?php echo Yii::t('teachersportal','City');?></strong></td>
  <td><?php echo $employee->home_city; ?></td><?php */
?>
                      </tr>
                    
                      <tr>
                        <td ><strong><?php 
echo Yii::t('teachersportal', 'Position');
?>
Ejemplo n.º 3
0
 public function categoryname($data, $row)
 {
     $category = EmployeeCategories::model()->findByAttributes(array('id' => $data->employee_category_id));
     return $category->name;
 }
Ejemplo n.º 4
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $settings = UserSettings::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
     if ($settings != NULL) {
         $date1 = date($settings->displaydate, strtotime($model->joining_date));
         $date2 = date($settings->displaydate, strtotime($model->date_of_birth));
     }
     $model->joining_date = $date1;
     $model->date_of_birth = $date2;
     if (isset($_POST['Employees'])) {
         $old_model = $model->attributes;
         // For activity feed
         $model->attributes = $_POST['Employees'];
         if ($model->joining_date) {
             $model->joining_date = date('Y-m-d', strtotime($model->joining_date));
         }
         if ($model->date_of_birth) {
             $model->date_of_birth = date('Y-m-d', strtotime($model->date_of_birth));
         }
         if ($file = CUploadedFile::getInstance($model, 'photo_data')) {
             $model->photo_file_name = $file->name;
             $model->photo_content_type = $file->type;
             $model->photo_file_size = $file->size;
             $model->photo_data = file_get_contents($file->tempName);
         }
         if ($model->save()) {
             // Saving to activity feed
             $results = array_diff_assoc($_POST['Employees'], $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 != 'updated_at') {
                     if ($key == 'gender') {
                         if ($value == 'F') {
                             $value = 'Female';
                         } else {
                             $value = 'Male';
                         }
                         if ($old_model[$key] == 'F') {
                             $old_model[$key] = 'Female';
                         } else {
                             $old_model[$key] = 'Male';
                         }
                     } elseif ($key == 'employee_category_id') {
                         $value = EmployeeCategories::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeeCategories::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'employee_position_id') {
                         $value = EmployeePositions::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeePositions::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'employee_department_id') {
                         $value = EmployeeDepartments::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeeDepartments::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'employee_grade_id') {
                         $value = EmployeeGrades::model()->findByAttributes(array('id' => $value));
                         $value = ucfirst($value->name);
                         $old_model_value = EmployeeGrades::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = ucfirst($old_model_value->name);
                     } elseif ($key == 'nationality_id' or $key == 'country_id') {
                         $value = Countries::model()->findByAttributes(array('id' => $value));
                         $value = $value->name;
                         $old_model_value = Countries::model()->findByAttributes(array('id' => $old_model[$key]));
                         $old_model[$key] = $old_model_value->name;
                     }
                     //echo $key.'-'.$model->getAttributeLabel($key).'-'.$value.'-'.$old_model[$key].'<br/>';
                     //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, '24', $model->id, ucfirst($model->first_name) . ' ' . ucfirst($model->middle_name) . ' ' . ucfirst($model->last_name), $model->getAttributeLabel($key), $old_model[$key], $value);
                 }
             }
             //END saving to activity feed
             $this->redirect(array('update2', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model));
 }
Ejemplo n.º 5
0
    ?>
<a href="<?php 
    echo Yii::app()->request->getUrl() . '&Employees[employee_department_id]=';
    ?>
"></a></li>
    <?php 
}
?>
    
    
    <?php 
if (isset($_REQUEST['Employees']['employee_category_id']) and $_REQUEST['Employees']['employee_category_id'] != NULL) {
    $j++;
    ?>
    <li>Category : <?php 
    echo EmployeeCategories::model()->findByAttributes(array('id' => $_REQUEST['Employees']['employee_category_id']))->name;
    ?>
<a href="<?php 
    echo Yii::app()->request->getUrl() . '&Employees[employee_category_id]=';
    ?>
"></a></li>
    <?php 
}
?>
    
    
    <?php 
if (isset($_REQUEST['Employees']['employee_position_id']) and $_REQUEST['Employees']['employee_position_id'] != NULL) {
    $j++;
    ?>
    <li>Position : <?php 
 /**
  * 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 = EmployeeCategories::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }