public function generateRoleDropdown($person_id, $project_id) { $role_array = array(); $roles = $this->roles; // Get person project id $person_project = PersonProject::find()->where(['user_id' => $person_id, 'project_id' => $project_id])->one(); // Get project roles if ($roles) { foreach ($roles as $id => $role) { $role_array[$role->id] = $role->title; } } // Generate dropdown list if (count($role_array)) { return Html::DropDownList('role', $person_project->role, $role_array, ['class' => 'form-control input-sm role-select', 'data-id' => $person_project->id, 'prompt' => '']); } return ''; }
public function actionRenderPdf($id, $list) { $project = Project::findOne($id); $people = PersonProject::find()->where(['project_id' => $id, 'list' => $list])->all(); if ($list == 1) { $list_type = 'Available'; } if ($list == 2) { $list_type = 'Final'; } $content = $this->renderPartial('_pdf', ['people' => $people]); $pdf = new Pdf(['mode' => Pdf::MODE_CORE, 'format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssInline' => '.kv-heading-1{font-size:18px}, img{max-width:150px}, td{border-bottom:1px solid #CCC !important;}', 'options' => ['title' => $project->title], 'methods' => ['SetHeader' => [$project->title . ' - ' . $list_type . ' List'], 'SetFooter' => ['{PAGENO}']]]); return $pdf->render(); }
public function getCount() { return PersonProject::find()->where(['role' => $this->id])->count(); }