Пример #1
0
 public function actiondeleteTE($id)
 {
     $model = TipoEmpresa::model()->findByPk($id);
     $model->tem_desabilitado = 1;
     $model->save();
     $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('tipoempresa'));
 }
 /**
  * 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 $id the ID of the model to be loaded
  * @return TipoEmpresa the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TipoEmpresa::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #3
0
 public function getMenuTipoEmpresa()
 {
     return CHtml::listData(TipoEmpresa::model()->findAll("Activo=?", array(1)), "IdTipoEmpresa", "NombreTipoEmpresa");
 }
Пример #4
0
<?php 
$form = $this->beginWidget('bootstrap.widgets.BsActiveForm', array('layout' => BsHtml::FORM_LAYOUT_HORIZONTAL, 'enableClientValidation' => true));
?>

    <p class="help-block">Los campos con un <span class="required">*</span> son requeridos.</p>

    <?php 
echo $form->errorSummary($model);
?>

    <?php 
echo $form->textFieldControlGroup($model, 'emp_rut', array('maxlength' => 13, 'disabled' => Yii::app()->controller->action->id !== 'create'));
?>
    <?php 
echo $form->dropDownListControlGroup($model, 'tem_id', CHtml::listData(TipoEmpresa::model()->findAll('tem_desabilitado=0'), 'tem_id', 'tem_nombre'), array('empty' => 'Seleccione un tipo'));
?>
    <?php 
echo $form->dropDownListControlGroup($model, 'are_id', CHtml::listData(AreaOperativa::model()->findAll('are_desabilitado=0'), 'are_id', 'are_nombre'), array('empty' => 'Seleccione un Área'));
?>
    <?php 
echo $form->textFieldControlGroup($model, 'emp_nombre', array('maxlength' => 256));
?>
    <?php 
echo $form->textFieldControlGroup($model, 'emp_direccion', array('maxlength' => 512));
?>
    <?php 
echo $form->textFieldControlGroup($model, 'emp_fono', array('maxlength' => 64));
?>
    <?php 
echo $form->textFieldControlGroup($model, 'emp_email', array('maxlength' => 256));
 public function actionCrearTipoEmpresa()
 {
     date_default_timezone_set('America/Tegucigalpa');
     $model = new TipoEmpresa();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['NombreTipoEmpresa'])) {
         $model->NombreTipoEmpresa = $_POST['NombreTipoEmpresa'];
         $model->Activo = 1;
         $model->CreadoPor = Yii::app()->user->name;
         $model->FechaCreacion = date('Y-m-d H:i:s');
         if ($model->save()) {
             Yii::app()->user->setFlash("success", "<strong>Excelente! </strong> Se ha creado una nuevo tipo de empresa llamado <strong>" . $model->NombreTipoEmpresa . "</strong>");
             $this->redirect(Yii::app()->request->urlReferrer . "#tipoEmpresa");
         }
     }
 }
Пример #6
0
 public function gettem_nombre()
 {
     return TipoEmpresa::model()->findByPk($this->tem_id)->tem_nombre;
 }