public function actionLists($id) { $countPosts = ActividadDetallada::find()->where(['id_macro' => $id])->count(); $posts = ActividadDetallada::find()->where(['id_macro' => $id])->orderBy('id DESC')->all(); if ($countPosts > 0) { foreach ($posts as $post) { echo "<option value='" . $post->id . "'>" . $post->nombre . "</option>"; } } else { echo "<option>-</option>"; } }
public function getReporteActividad() { $datos = ActividadDetallada::find()->select(['COUNT(*) AS cnt'])->where(['id_organizacion = 1'])->asArray()->all(); return $datos; }
public function getActividadDetallada() { $datos = ActividadDetallada::find()->asArray()->all(); return ArrayHelper::map($datos, 'id', 'nombre'); }