/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TiposEstadosEmocionais::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id_tipo_estado_emocional' => $this->id_tipo_estado_emocional, 'privado' => $this->privado, 'ativo' => 1]);
     $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'icone', $this->icone]);
     return $dataProvider;
 }
Beispiel #2
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="estados-emocionais-checkin">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <h2>Olá <?php 
echo Html::encode(Yii::$app->user->identity->nome_completo);
?>
!</h2>
    <h3>Selecione abaixo seu estado emocional de hoje:</h3>
    <ul>
    <?php 
$estadosEmocionais = TiposEstadosEmocionais::find()->where(['privado' => 0, 'ativo' => 1])->all();
foreach ($estadosEmocionais as $estadoEmocional) {
    ?>
        <li> <?php 
    echo Html::a(Html::img($estadoEmocional->getImageUrl(), ['width' => '200', 'height' => '200']), Url::toRoute(['estados-emocionais/checkin', 'id_tipo_estado_emocional' => $estadoEmocional->id_tipo_estado_emocional]), ['class' => 'btn', 'data' => ['confirm' => 'Você está certo que quer selecionar ' . $estadoEmocional->nome, 'method' => 'post']]);
    ?>
 <br> <?php 
    echo $estadoEmocional->nome;
    ?>
</li>
    <?php 
}
?>
    </ul>
</div>
<?php 
Beispiel #3
0
use yii\widgets\ActiveForm;
use app\models\Usuarios;
use app\models\TiposEstadosEmocionais;
/* @var $this yii\web\View */
/* @var $model app\models\EstadosEmocionais */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="estados-emocionais-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'id_tipo_estado_emocional')->dropdownList(ArrayHelper::map(TiposEstadosEmocionais::find()->where(['privado' => 0, 'ativo' => 1])->orderBy('nome')->all(), 'id_tipo_estado_emocional', 'nome'), ['prompt' => 'Selecione o tipo de estado emocional']);
?>
    <div style="<?php 
$model->scenario == 'update' ? print 'display: none' : '';
?>
">
        <?php 
echo $form->field($model, 'id_usuario')->dropdownList(ArrayHelper::map(Usuarios::find()->where(['ativo' => 1])->orderBy('nome_completo')->all(), 'id_usuario', 'nome_completo'), ['prompt' => 'Selecione o usuário']);
?>
    
        <?php 
echo $form->field($model, 'motivo')->textarea(['maxlength' => true]);
?>
    </div>
    <div class="form-group">
        <?php 
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTipoAfastamento()
 {
     return $this->hasOne(TiposEstadosEmocionais::className(), ['id_tipo_estado_emocional' => 'id_tipo_afastamento']);
 }
Beispiel #5
0
        </li>
        <li>
            <a href="<?php 
echo Url::toRoute(["periodos-afastamento/index"]);
?>
">
            <img src="images/periodo-afastamento.png">
            <p>Afastamentos</p>
            </a>
        </li>
        <li>
            <a href="<?php 
echo Url::toRoute(["usuarios/index"]);
?>
">
            <img src="images/usuarios.png">
            <p>Usuários</p>
            </a>
        </li>
    </ul>
</div>
    <?php 
$tipo_estado_emocional_ruim = TiposEstadosEmocionais::find()->select('id_tipo_estado_emocional')->where(['nome' => Yii::$app->params['estadosRuins']])->all();
$ids = [];
foreach ($tipo_estado_emocional_ruim as $key => $value) {
    $ids[] = $value->id_tipo_estado_emocional;
}
$dataProvider = new ActiveDataProvider(['query' => EstadosEmocionais::find()->where(['id_tipo_estado_emocional' => $ids, 'motivo' => ""]), 'pagination' => ['pageSize' => 20]]);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'tipoEstadoEmocional', 'label' => 'Estado Emocional', 'value' => 'tipoEstadoEmocional.imageUrl', 'format' => ['image', ['width' => '50', 'height' => '50']]], ['attribute' => 'usuario.nome_completo', 'label' => 'Colaborador'], ['attribute' => 'usuario.setor', 'label' => 'Setor'], ['attribute' => 'motivo'], ['attribute' => 'data', 'format' => ['date', 'dd/MM/Y']], ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Resolver', 'template' => '{update}', 'controller' => 'estados-emocionais']]]);
 /**
  * Finds the TiposEstadosEmocionais model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TiposEstadosEmocionais the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TiposEstadosEmocionais::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }