Example #1
0
 function actionWorkers()
 {
     //$worker_model = new Worker;
     $workers = Worker::model()->with('department', 'position')->findAll();
     $this->render('workers', array('workers' => $workers));
 }
Example #2
0
<div class="form">

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

	<?php 
echo $form->hiddenField($model, 'UserID', array('value' => Yii::app()->user->ID));
?>

	<div class="row" style="float: left;margin-right:52px;">
		<?php 
echo $form->labelEx($model, 'WorkerID');
?>
		<?php 
echo $form->dropDownList($model, 'WorkerID', CHtml::listData(Worker::model()->findAll(), 'ID', 'Fullname'), array('empty' => '-- Selecciona un operario --', 'style' => 'width: 200px;'));
?>
		<?php 
echo $form->error($model, 'WorkerID');
?>
	</div>

	<div class="row" style="float: left;">
		<?php 
echo $form->labelEx($model, 'PointID');
?>
		<?php 
echo $form->dropDownList($model, 'PointID', CHtml::listData(Point::model()->findAll(), 'ID', 'Name'), array('empty' => '-- Selecciona el punto critico --', 'style' => 'width: 360px;'));
?>
		<?php 
echo $form->error($model, 'PointID');
Example #3
0
<div class="form">

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

	<?php 
echo $form->hiddenField($model, 'UserID', array('value' => Yii::app()->user->ID));
?>

	<div class="row" style="float: left;width:31%;">
		<?php 
echo $form->labelEx($model, 'WorkerID');
?>
		<?php 
echo $form->dropDownList($model, 'WorkerID', CHtml::listData(Worker::model()->findAll($criteria), 'ID', 'Fullname'), array('empty' => '-- Selecciona un trabajador --', 'style' => 'width: 100%;'));
?>
		<?php 
echo $form->error($model, 'WorkerID');
?>
	</div>

	<div class="row" style="float: left;width:60%;margin-left: 8%;">
		<?php 
echo $form->labelEx($model, 'PointID');
?>
		<?php 
echo $form->dropDownList($model, 'PointID', CHtml::listData(Point::model()->findAll($criteria), 'ID', 'Name'), array('empty' => '-- Selecciona el punto critico --', 'style' => 'width: 100%;'));
?>
		<?php 
echo $form->error($model, 'PointID');
Example #4
0
 public function actionDeleteWorker()
 {
     $id = intval($_GET['id']) > 0 ? intval($_GET['id']) : 0;
     if ($id == 0) {
         throw new CHttpException(1000, 'Работник не найден');
     } else {
         $cu = User::model()->deleteByPk($id);
         if ($cu > 0) {
             $cw = Worker::model()->deleteByPk($id);
             if ($cw <= 0) {
                 throw new CHttpException(1001, 'В процессе удаления произошла ошибка');
             } else {
                 $this->renderPartial('view', array('data' => 'Ur-data'), false, true);
             }
         } else {
             throw new CHttpException(1001, User::model()->getErrors());
         }
     }
 }
Example #5
0
 /**
  * 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 = Worker::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #6
0
		</tr>
		<tr>
			<td>Fecha</td>
			<td>Superficie</td>
			<td>Metodo y materiales</td>
			<td>Eficacia de la limpieza</td>
			<td>Empleado</td>
			<td>Medida correctora</td>
			<td>Firma responsable</td>
		</tr>
		<?php 
for ($i = 0; $i < $dias; $i++) {
    ?>
		<?php 
    $newFecha = strtotime($_POST["start"]) + $i * 86400;
    $Worker = Worker::model()->findByAttributes(array("UserID" => Yii::app()->user->ID));
    ?>
			<tr>
				<td><?php 
    echo date("d-m-Y", $newFecha);
    ?>
</td>
				<td>Suelos</td>
				<td>Fregado con detergente</td>
				<td>OK</td>
				<td><?php 
    echo $Worker->Fullname;
    ?>
</td>
				<td></td>
				<td></td>