public function actionAemployee($type_id) { $dev = DeviceType::findOne(['id' => $type_id]); $title = $dev->title; // $query1 = (new Query())->select('workplace_id')->from('devices')->where(['type_id' => $type_id])->groupBy('workplace_id'); // $query = (new Query())->select('employees.branch_id, workplace_id, workplaces_title, snp, job_title, date')->from('wp_owners, employees, workplaces')->where(['workplace_id' => $query1])->andWhere('employees.id = wp_owners.employee_id')->andWhere('workplaces.id = workplace_id'); $dp = new ActiveDataProvider(['query' => $query]); return $this->render('a_employee', ['dp' => $dp, 'title' => $title, 'type_id' => $type_id]); }
/** * Finds the DeviceType model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return DeviceType the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = DeviceType::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
} else { if ($t) { echo '</table></div></td></tr>'; $t = false; } $n++; if (in_array($model['id'], $parentsId)) { //если устройство в текущей строке относится к родительским то //указываем что эта строка управляет видимостью скрытой таблицы echo '<tr class = "accordion-toggle success" data-toggle="collapse" data-target=".rows' . $n . '">'; } else { echo '<tr>'; } foreach ($model as $key => $item) { if ($key == 'type_id') { echo '<td>' . DeviceType::findOne($item)->title . '</td>'; } else { echo '<td>' . $item . '</td>'; } } echo "</tr>"; $cn = $n; } $oldParent = $parent; } ?> </tbody> </table>