Buongiorno a tutti. Ho un problema con la visualizzazione della index della pagine dandomi error 404. Questo è il controller:
public function actionIndex($id=null)
{
{
if (empty($id)) {
$model= new VisualizzazioneComplessiva();
$searchModel = new VisualizzazioneComplessivaSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$model->user_id = Yii::$app->user->identity->getId();
} else {
$model = VisualizzazioneComplessiva::findOne(['id' => $id]);
if (!User::isAdmin() && $model->user_id != Yii::$app->user->identity->getId()) {
$this->redirect('visualizzazione-complessiva/index');
}
}
if (Yii::$app->request->isPost && Yii::$app->request->post('_pjax')) {
if (Yii::$app->request->post('user')) {
$model->user_id = Yii::$app->request->post('user');
$this->redirect('visualizzazione-complessiva/index');
}
}
return $this->render('index', [
'model' => $model,
'dataProvider'=>$dataProvider,
]);
}
}
mentre questo è il file index:
<?php use app\models\Profile; use app\models\User; use kartik\select2\Select2; use yii\bootstrap4\ActiveForm; use yii\bootstrap4\Modal; use yii\helpers\ArrayHelper; use kartik\grid\GridView; $this->title = 'Visualizzazione Complessiva'; $this->params['breadcrumbs'][] = $this->title; $admin = User::isAdmin() ? 1 : 0; ?> <?php $crea = \app\models\Configurazione::getValue(\app\models\enums\Configurazione::CREAZIONEPERMESSI); ?><?php echo GridView::widget([
‘model’ => $model,
‘pager’ => [
'class' => '\app\widgets\Pagination'
],
‘hover’ => true,
‘toolbar’ => [
],
‘panel’ => [
'type' => 'default',
'footer' => false
],
‘panelTemplate’ => "<div class=“panel {type}”>
{items}
{panelAfter}
{pager}
</div>",
‘options’ => [‘class’ => ‘dataTables_wrapper no-footer’],
‘columns’ => [
[
'attribute' => 'user_id',
'value' => function ($model, $key, $index, $column) {
},
'format' => 'html',
],
[
'attribute' => 'ore',
'value' => function ($model, $key, $index, $column) {
},
'format' => 'html',
],
[
'attribute' => 'permesso',
'value' => function ($model, $key, $index, $column) {
return "<div class=\"agenda-event\">{$model->titolo}</div>";
},
'format' => 'html',
],
[
'attribute' => 'straordinario',
'value' => function ($model, $key, $index, $column) {
if(isset($model->responsabile)){
return "<div class=\"agenda-event\">{$model->responsabile->name}</div>";
}
return "";
},
],
[
'attribute' => 'ferie',
'value' => function ($model, $key, $index, $column) {
if(isset($model->responsabile)){
return "<div class=\"agenda-event\">{$model->responsabile->name}</div>";
}
return "";
},
],
],
]); ?>
<table border="1" width="100%">
<tr>
<th>Alessio Mantineo</th>
<td align=center>1</td>
<td align=center>2</td>
<td align=center>3</td>
<td align=center>4</td>
<td align=center>5</td>
<td align=center>6</td>
<td align=center>7</td>
<td align=center>8</td>
<td align=center>9</td>
<td align=center>10</td>
<td align=center>11</td>
<td align=center>12</td>
<td align=center>13</td>
<td align=center>14</td>
<td align=center>15</td>
<td align=center>16</td>
<td align=center>17</td>
<td align=center>18</td>
<td align=center>19</td>
<td align=center>20</td>
<td align=center>21</td>
<td align=center>22</td>
<td align=center>23</td>
<td align=center>24</td>
<td align=center>25</td>
<td align=center>26</td>
<td align=center>27</td>
<td align=center>28</td>
<td align=center>29</td>
<td align=center>30</td>
<td align=center>31</td>
<td>Totale ore</td>
<tr>
</tr>
<td>Ore</td>
</tr>
</tr>
<td>Permessi</td>
</tr>
</tr>
<td>Straordinario</td>
</tr>
</tr>
<td>Ferie</td>
</tr>
</table>
<br>
<table border="1" width="100%">
<tr>
<th>Paolo Carilli</th>
<td align=center>1</td>
<td align=center>2</td>
<td align=center>3</td>
<td align=center>4</td>
<td align=center>5</td>
<td align=center>6</td>
<td align=center>7</td>
<td align=center>8</td>
<td align=center>9</td>
<td align=center>10</td>
<td align=center>11</td>
<td align=center>12</td>
<td align=center>13</td>
<td align=center>14</td>
<td align=center>15</td>
<td align=center>16</td>
<td align=center>17</td>
<td align=center>18</td>
<td align=center>19</td>
<td align=center>20</td>
<td align=center>21</td>
<td align=center>22</td>
<td align=center>23</td>
<td align=center>24</td>
<td align=center>25</td>
<td align=center>26</td>
<td align=center>27</td>
<td align=center>28</td>
<td align=center>29</td>
<td align=center>30</td>
<td align=center>31</td>
<td>Totale ore</td>
<tr>
</tr>
<td>Ore</td>
</tr>
</tr>
<td>Permessi</td>
</tr>
</tr>
<td>Straordinario</td>
</tr>
</tr>
<td>Ferie</td>
</tr>
</table>
<tr>
<th>Giovanni Leone</th>
<td align=center>1</td>
<td align=center>2</td>
<td align=center>3</td>
<td align=center>4</td>
<td align=center>5</td>
<td align=center>6</td>
<td align=center>7</td>
<td align=center>8</td>
<td align=center>9</td>
<td align=center>10</td>
<td align=center>11</td>
<td align=center>12</td>
<td align=center>13</td>
<td align=center>14</td>
<td align=center>15</td>
<td align=center>16</td>
<td align=center>17</td>
<td align=center>18</td>
<td align=center>19</td>
<td align=center>20</td>
<td align=center>21</td>
<td align=center>22</td>
<td align=center>23</td>
<td align=center>24</td>
<td align=center>25</td>
<td align=center>26</td>
<td align=center>27</td>
<td align=center>28</td>
<td align=center>29</td>
<td align=center>30</td>
<td align=center>31</td>
<td>Totale ore</td>
<tr>
</tr>
<td>Ore</td>
</tr>
</tr>
<td>Permessi</td>
</tr>
</tr>
<td>Straordinario</td>
</tr>
</tr>
<td>Ferie</td>
</tr>
</table>
<br>
<table border="1" width="100%">
<tr>
<th>Valentina Migliorato</th>
<td align=center>1</td>
<td align=center>2</td>
<td align=center>3</td>
<td align=center>4</td>
<td align=center>5</td>
<td align=center>6</td>
<td align=center>7</td>
<td align=center>8</td>
<td align=center>9</td>
<td align=center>10</td>
<td align=center>11</td>
<td align=center>12</td>
<td align=center>13</td>
<td align=center>14</td>
<td align=center>15</td>
<td align=center>16</td>
<td align=center>17</td>
<td align=center>18</td>
<td align=center>19</td>
<td align=center>20</td>
<td align=center>21</td>
<td align=center>22</td>
<td align=center>23</td>
<td align=center>24</td>
<td align=center>25</td>
<td align=center>26</td>
<td align=center>27</td>
<td align=center>28</td>
<td align=center>29</td>
<td align=center>30</td>
<td align=center>31</td>
<td>Totale ore</td>
<tr>
</tr>
<td>Ore</td>
</tr>
</tr>
<td>Permessi</td>
</tr>
</tr>
<td>Straordinario</td>
</tr>
</tr>
<td>Ferie</td>
</tr>
</table>
<br>
<table border="1" width="100%">
<tr>
<th>Antonio De Marco</th>
<td align=center>1</td>
<td align=center>2</td>
<td align=center>3</td>
<td align=center>4</td>
<td align=center>5</td>
<td align=center>6</td>
<td align=center>7</td>
<td align=center>8</td>
<td align=center>9</td>
<td align=center>10</td>
<td align=center>11</td>
<td align=center>12</td>
<td align=center>13</td>
<td align=center>14</td>
<td align=center>15</td>
<td align=center>16</td>
<td align=center>17</td>
<td align=center>18</td>
<td align=center>19</td>
<td align=center>20</td>
<td align=center>21</td>
<td align=center>22</td>
<td align=center>23</td>
<td align=center>24</td>
<td align=center>25</td>
<td align=center>26</td>
<td align=center>27</td>
<td align=center>28</td>
<td align=center>29</td>
<td align=center>30</td>
<td align=center>31</td>
<td>Totale ore</td>
<tr>
</tr>
<td>Ore</td>
</tr>
</tr>
<td>Permessi</td>
</tr>
</tr>
<td>Straordinario</td>
</tr>
</tr>
<td>Ferie</td>
</tr>
</table>
])?>
<?php
Modal::begin([
'title' => '<br>',
'id' => 'pagamento',
'options' => [
'class' => 'modal fade',
'data' => [
'backdrop' => 'static',
'keyboard' => false
],
'tabindex' => ''
]
]);
?>
<div id='myModalContent'></div>
<?php Modal::end(); ?>
</div>
</div>
<?php
$script = < 0) {
var dd = new Date()
var user_id = {$model->user_id};
var calendarEl = document.getElementById('table');
table = new table.Calendar(calendarEl, {
locale: "it",
headerToolbar: {
left: 'prev',
center: 'title',
right: 'next'
},
longPressDelay: 1,
nextDayThreshold: '00:00:00',
selectAllow: function (selectInfo) {
if (new Date(dd.toDateString() ) > new Date(selectInfo.start.toDateString()) && 1 !== {$admin}) {
return false;
}
var evts = table.getEvents().filter(function(evt) {
var st = evt.start;
var ed = evt.start;
if (evt.end) { ed = evt.end;
ed.setDate(ed.getDate() + 1)
}
else {
ed.setDate(st.getDate() + 1)
}
//return true if the event overlaps with the selection
return (selectInfo.start >= st && selectInfo.end <= ed);
});
return evts != undefined && evts.length == 0;
},
eventDidMount: function(arg) {
if (arg.event.start < dd && 1 !== {$admin}) {
return "";
}
$(arg.el).closest( ".fc-daygrid-event-harness" ).prepend('