Skip to content

Commit

Permalink
Add list of no application candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
spapad committed Sep 13, 2018
1 parent e04af71 commit 09e479b
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 1 deletion.
53 changes: 52 additions & 1 deletion controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function behaviors()
'class' => AccessControl::className(),
'rules' => [
[
'actions' => ['index', 'overview', 'view-candidates', 'view-applications', 'print-applications', 'view-denials', 'print-denials'],
'actions' => ['index', 'overview', 'view-candidates', 'view-applications', 'print-applications', 'view-denials', 'print-denials', 'print-no-application-candidates'],
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {
Expand Down Expand Up @@ -169,6 +169,57 @@ public function actionExportCsv()
\Yii::$app->end();
}

public function actionPrintNoApplicationCandidates()
{
Yii::trace('No application candidates print', 'admin');

$dataProvider = new ArrayDataProvider([
'allModels' => Applicant::find()
->andWhere(['state' => 0])
->joinWith([
'applications' => function (\yii\db\ActiveQuery $query) {
$query->andWhere([Application::tableName() . '.[[id]]' => null]);
}
])
->orderBy(['specialty' => SORT_ASC, 'points' => SORT_DESC])
->all(),
'pagination' => false
]);

$actionlogo = "file:///" . realpath(Yii::getAlias('@images/logo.jpg'));
$pdelogo = "file:///" . realpath(Yii::getAlias('@images/pdelogo.jpg'));
$content = $this->renderPartial('print-no-applications', [
'dataProvider' => $dataProvider,
'actionlogo' => $actionlogo
]);

$pdf = new Pdf([
'mode' => Pdf::MODE_UTF8,
'format' => Pdf::FORMAT_A4,
'orientation' => Pdf::ORIENT_PORTRAIT,
'filename' => "ΧΩΡΙΣ_ΑΙΤΗΣΗ.pdf",
'destination' => Pdf::DEST_DOWNLOAD,
'content' => $content,
'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css',
'cssInline' => '.kv-heading-1{font-size:16px}',
'options' => [
'title' => 'Περιφερειακή Διεύθυνση Πρωτοβάθμιας και Δευτεροβάθμιας Εκπαίδευσης Κρήτης',
'defaultheaderline' => 0,
'defaultfooterline' => 0
],
'marginTop' => Yii::$app->params['pdf']['marginTop'],
'marginBottom' => Yii::$app->params['pdf']['marginBottom'],
'methods' => [
'SetHeader' => ['<img src=\'' . $pdelogo . '\'>'],
'SetFooter' => ['<p style="text-align: center; border-top: 1px solid #ccc;">Σελίδα {PAGENO} από {nb}<br><img src=\'' . $actionlogo . '\'></p>'],
]
]);

return $pdf->render();

// return $this->render('view-no-applications', ['users' => $dataProvider]);
}

public function actionViewApplications()
{
Yii::trace('Applications view', 'admin');
Expand Down
7 changes: 7 additions & 0 deletions views/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@
<p>Προβολή υποψηφηφίων εκπαιδευτικών που βρίσκονται στη βάση και αναμένεται να δηλώσουν τοποθέτηση ή
άρνηση τοποθέτησης.</p>

<hr/>
<p>
<?= Html::a(Html::icon('print') . ' Χωρίς αίτηση', Url::to(['admin/print-no-application-candidates']), ['class' => 'btn btn-info', 'data-method' => 'POST']) ?>
</p>
<p>Η λειτουργία αυτή εκτυπώνει τα στοιχεία των υποψήφιων εκπαιδευτικών που <strong>δεν</strong> έχουν
υποβάλει αίτηση-δήλωση ούτε δήλωση άρνησης τοποθέτησης.</p>

<hr/>
<p>
<?= Html::a(Html::icon('list') . ' Κενά', Url::to(['view-choices']), ['class' => 'btn btn-primary']) ?>
Expand Down
48 changes: 48 additions & 0 deletions views/admin/print-no-applications.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

use yii\bootstrap\Html;
use yii\grid\GridView;
use yii\widgets\ListView;

$this->title = 'Εκπαιδευτικοί χωρίς αίτηση και χωρίς δήλωση άρνησης';
$this->params['breadcrumbs'][] = ['label' => 'Διαχειριστικές λειτουργίες', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<h3 style="text-align: center;"><?= Html::encode($this->title) ?></h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 5%">#</th>
<th style="width: 20%">Επώνυμο</th>
<th style="width: 20%">Όνομα</th>
<th style="width: 15%">Πατρώνυμο</th>
<th style="width: 15%">Α.Φ.Μ.</th>
<th style="width: 15%">Α.Δ.Τ.</th>
<th style="width: 10%">Ειδικότητα</th>
</tr>
</thead>
<tbody>
<?=
ListView::widget([
'dataProvider' => $dataProvider,
'itemView' => function ($model, $key, $index, $widget) {
$serial = $index + 1;
return <<< EOUTMPL
<tr>
<td>{$serial}</td>
<td>{$model->lastname}</td>
<td>{$model->firstname}</td>
<td>{$model->fathername}</td>
<td>{$model->vat}</td>
<td>{$model->identity}</td>
<td>{$model->specialty}</td>
</tr>
EOUTMPL;
},
'summary' => '<h3>Συνολικά: {totalCount}</h3>'
]);

?>
</tbody>
</table>
<p class="text-muted"><small>Παραγωγή αρχείου <?php echo date('c'); ?></small></p>

0 comments on commit 09e479b

Please sign in to comment.