/**
  * 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
         $cargos = EmpleoCargo::model()->de_Departamento($id)->findAll();
         if (count($cargos) == 0) {
             $this->reordenarPesoDeleted();
             $this->loadModel($id)->delete();
             Yii::app()->user->setFlash('success', "El Departamento ha sido eliminado con exito!.");
         } else {
             Yii::app()->user->setFlash('error', "No se puede eliminar este Departamento, contiene Cargos asignados.");
         }
         // 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.');
     }
 }
Пример #2
0
?>
 <?php 
echo Empleado::label(2);
?>
</h4>
                <!-- widget action, you can also use btn, btn-group, nav-tabs or nav-pills (also support dropdown). enjoy! -->
                <div class="widget-action">
                    <button data-toggle="collapse" data-collapse="#widget-button" class="btn">
                        <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down  aweso-chevron-up"></i>
                    </button>
                </div>
            </div><!-- /widget header -->
            <!-- widget content -->
            <div class="widget-content bg-white">
                <div style='overflow:auto'> 
                    <?php 
$dataProvider = '';
if (Util::getRolUser(Yii::app()->user->id) == 'OPERADOR') {
    $dataProvider = $model->activos()->searchSubAlterno(Empleado::model()->find('userid=:idUser', array(':idUser' => Yii::app()->user->id))->id, true);
} else {
    $dataProvider = $model->noUser()->activos()->search();
}
//$this->widget('bootstrap.widgets.TbGridView',array(
$this->widget('ext.selgridview.BootSelGridView', array('id' => 'empleado-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $dataProvider, 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'filter' => $model, 'columns' => array(array('id' => 'check_id', 'class' => 'CCheckBoxColumn', 'value' => '$data->id'), array('name' => 'documento', 'value' => 'CHtml::link($data->documento, Yii::app()->createUrl("/personal/empleado/view", array("id"=>$data->id)))', 'type' => 'html'), array('name' => 'nombre_completo', 'value' => 'CHtml::link($data->nombre_completo, Yii::app()->createUrl("/personal/empleado/view", array("id"=>$data->id)))', 'type' => 'html'), array('name' => 'fecha_contratacion', 'value' => 'Util::FormatDate($data->fecha_contratacion, "Y/m/d")'), array('name' => 'usuario_creacion_id', 'value' => 'Yii::app()->user->um->loadUserById($data->usuario_creacion_id)->username'), array('name' => 'empleo_cargo_id', 'value' => 'isset($data->empleoCargo) ? $data->empleoCargo : null', 'filter' => CHtml::listData(EmpleoCargo::model()->findAll(), 'id', EmpleoCargo::representingColumn())), array('name' => 'horario_id', 'value' => 'isset($data->horario) ? $data->horario : null', 'filter' => CHtml::listData(Horario::model()->findAll(), 'id', Horario::representingColumn())), array('class' => 'CButtonColumn', 'template' => '{update} {delete}', 'deleteConfirmation' => CrugeTranslator::t('admin', 'Are you sure you want to delete this user'), 'buttons' => array('update' => array('label' => '<button class="btn btn-info"><i class="aweso-pencil"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Update')), 'imageUrl' => false), 'delete' => array('label' => '<button class="btn btn-danger"><i class="aweso-trash"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Delete')), 'imageUrl' => false)), 'htmlOptions' => array('width' => '80px')))));
?>
                </div>
            </div>
        </div>
    </div>
</div>
<!--</fieldset>-->
 public function sortable($idSort, $pesoS, $idRep, $pesoR)
 {
     $modelEtap = EmpleoCargo::model()->getCargos();
     $ban = FALSE;
     if ($pesoS > $pesoR) {
         foreach ($modelEtap as $etap) {
             if ($etap['id'] == $idRep || $ban) {
                 $etap['peso'] = $etap['peso'] + 1;
                 EmpleoCargo::model()->updateByPk($etap['id'], array('peso' => $etap['peso']));
                 if ($etap['id'] == $idSort) {
                     EmpleoCargo::model()->updateByPk($etap['id'], array('peso' => $pesoR));
                     $ban = false;
                 } else {
                     $ban = TRUE;
                 }
             }
         }
     } else {
         if ($pesoS < $pesoR) {
             $ba2 = false;
             foreach ($modelEtap as $etap) {
                 if ($etap['id'] == $idSort) {
                     EmpleoCargo::model()->updateByPk($etap['id'], array('peso' => $pesoR));
                     $ba2 = TRUE;
                 } else {
                     if ($ba2) {
                         if ($etap['id'] == $idRep) {
                             $etap['peso'] = $etap['peso'] - 1;
                             EmpleoCargo::model()->updateByPk($etap['id'], array('peso' => $etap['peso']));
                             $ba2 = FALSE;
                         } else {
                             $etap['peso'] = $etap['peso'] - 1;
                             EmpleoCargo::model()->updateByPk($etap['id'], array('peso' => $etap['peso']));
                         }
                     }
                 }
             }
         }
     }
 }
Пример #4
0
<?php

/** @var EmpleoCargoController $this */
/** @var EmpleoCargo $model */
$this->breadcrumbs = array('Empleo Cargos');
$this->menu = array(array('label' => Yii::t('AweCrud.app', 'Create') . ' ' . EmpleoCargo::label(), 'icon' => 'plus', 'url' => array('create')), array('label' => Yii::t('AweCrud.app', 'Manage'), 'icon' => 'list-alt', 'url' => array('admin')));
?>

<fieldset>
    <legend>
        <?php 
echo Yii::t('AweCrud.app', 'List');
?>
 <?php 
echo EmpleoCargo::label(2);
?>
    </legend>

<?php 
$this->widget('bootstrap.widgets.TbListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
?>
</fieldset>
Пример #5
0
?>

<?php 
echo $form->textFieldRow($model, 'userid');
?>

<?php 
echo $form->textFieldRow($model, 'curriculum', array('maxlength' => 200));
?>

<?php 
echo $form->textFieldRow($model, 'foto', array('maxlength' => 200));
?>

<?php 
echo $form->dropDownListRow($model, 'empleo_cargo_id', array('' => ' -- Seleccione -- ') + CHtml::listData(EmpleoCargo::model()->findAll(), 'id', EmpleoCargo::representingColumn()));
?>

<?php 
echo $form->dropDownListRow($model, 'estado_empleo_id', array('' => ' -- Seleccione -- ') + CHtml::listData(EstadoEmpleo::model()->findAll(), 'id', EstadoEmpleo::representingColumn()), array('prompt' => Yii::t('AweApp', 'None')));
?>

<?php 
echo $form->dropDownListRow($model, 'direccion_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Direccion::model()->findAll(), 'id', Direccion::representingColumn()), array('prompt' => Yii::t('AweApp', 'None')));
?>

<?php 
echo $form->dropDownListRow($model, 'horario_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Horario::model()->findAll(), 'id', Horario::representingColumn()), array('prompt' => Yii::t('AweApp', 'None')));
?>

<div class="form-actions">
Пример #6
0
                            </button>
                        </div>
                    </div><!-- /widget header -->
                    <div class="widget-content form bg-white">
                        <div style='overflow:auto'> 
                            <?php 
    $empleadosSubAlternos = $model->activos()->searchSubAlterno($model->id, true)->getData();
    //                        var_dump($empleadosSubAlternos);
    ?>
                            <div id="div-empleado-grid" style="<?php 
    echo !$empleadosSubAlternos ? 'display: none;' : '';
    ?>
">
                                <?php 
    //$this->widget('bootstrap.widgets.TbGridView',array(
    $this->widget('ext.selgridview.BootSelGridView', array('id' => 'empleado-grid', 'type' => 'striped bordered hover advance condensed', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->activos()->searchSubAlterno($model->id, true), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array(array('name' => 'nombre_completo', 'value' => 'CHtml::link($data->nombre_completo, Yii::app()->createUrl("/personal/empleado/view", array("id"=>$data->id)))', 'type' => 'html'), array('name' => 'empleo_cargo_id', 'value' => 'isset($data->empleoCargo) ? $data->empleoCargo : null', 'filter' => CHtml::listData(EmpleoCargo::model()->findAll(), 'id', EmpleoCargo::representingColumn())), array('name' => 'horario_id', 'value' => 'isset($data->horario) ? $data->horario : null', 'filter' => CHtml::listData(Horario::model()->findAll(), 'id', Horario::representingColumn())))));
    ?>
                            </div>
                            <?php 
    if (Util::checkAccess(array('action_empleado_SubAlternos'))) {
        ?>

                                <?php 
        $this->widget('bootstrap.widgets.TbButton', array('id' => 'add-EmpleadoSubalterno', 'label' => !empty($empleadosSubAlternos) ? 'Agregar' : '<h3>Empleados A Cargo</h3>', 'encodeLabel' => false, 'icon' => !empty($empleadosSubAlternos) ? 'plus-sign' : 'group', 'htmlOptions' => array('onClick' => 'viewModal("personal/empleado/SubAlternos/id/' . $model->id . '",false,function(){' . 'maskAttributes();})', 'class' => !empty($empleadosSubAlternos) ? '' : 'empty-portlet')));
        ?>
                            <?php 
    } else {
        ?>
                                <?php 
        $this->widget('bootstrap.widgets.TbButton', array('id' => 'add-EmpleadoSubalterno', 'label' => !empty($empleadosSubAlternos) ? 'Agregar' : '<h3>Empleados A Cargo</h3>', 'encodeLabel' => false, 'icon' => !empty($empleadosSubAlternos) ? 'plus-sign' : 'group', 'htmlOptions' => array('class' => !Util::checkAccess(array('action_empleado_SubAlternos')) && !empty($empleadosSubAlternos) ? 'hidden' : 'empty-portlet')));
        ?>
Пример #7
0
/** @var EmpleoCargoController $this */
/** @var EmpleoCargo $model */
/** @var AweActiveForm $form */
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array('id' => 'empleo-cargo-form', 'type' => 'horizontal', 'enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => false, 'validateOnChange' => true), 'enableClientValidation' => false));
?>
<div class="row-fluid">
    <div class="span12">
        <!-- widget button -->
        <div class="widget border-cyan" id="widget-button">

            <!-- widget header -->
            <div class="widget-header bg-cyan">
                <!-- widget title -->
                <h4 class="widget-title"><i class="aweso-briefcase"></i> <?php 
echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . EmpleoCargo::label();
?>
</h4>
                <!-- widget action, you can also use btn, btn-group, nav-tabs or nav-pills (also support dropdown). enjoy! -->
                <div class="widget-action">
                    <button data-toggle="collapse" data-collapse="#widget-button" class="btn">
                        <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down  aweso-chevron-up"></i>
                    </button>
                </div>
            </div><!-- /widget header -->
            <div class="widget-content form bg-white">


                <p class="note">
                    <?php 
echo Yii::t('AweCrud.app', 'Fields with');
Util::tsRegisterAssetJs('_adminEmpleadosSubAlternos.js');
?>
<div class = "modal-header">
    <button type = "button" class = "close" data-dismiss = "modal" aria-hidden = "true">&times;
    </button>
    <h3 id = "sampleModal1" >
        <i class="aweso-group">  
            <?php 
echo ' Agregar Subaltenos ';
?>
        </i>
    </h3>
</div>
<div class = "modal-body">
    <?php 
//            var_dump($model->id);die();
//    var_dump(count($model->activos()->searchSubAlterno($model->id)->getData()));
//$this->widget('bootstrap.widgets.TbGridView',array(
$this->widget('ext.selgridview.BootSelGridView', array('id' => 'empleado-modal-grid', 'type' => 'striped bordered hover advance condensed', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->activos()->searchSubAlterno($model->id), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array(array('id' => 'check_id', 'class' => 'CCheckBoxColumn', 'value' => '$data->id'), array('name' => 'nombre_completo', 'value' => '$data->nombre_completo'), array('name' => 'fecha_contratacion', 'value' => 'Util::FormatDate($data->fecha_contratacion, "Y/m/d")'), array('name' => 'empleo_cargo_id', 'value' => 'isset($data->empleoCargo) ? $data->empleoCargo : null', 'filter' => CHtml::listData(EmpleoCargo::model()->findAll(), 'id', EmpleoCargo::representingColumn())))));
?>
</div>
<div class = "modal-footer">
    <?php 
$this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'label' => 'Agregar', 'htmlOptions' => array('onClick' => 'js:AjaxAtualizacionInformacion(' . $model->id . ')')));
?>

    <?php 
$this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('AweCrud.app', 'Cancel'), 'htmlOptions' => array('data-dismiss' => 'modal')));
?>
</div>