ajout colonne niveau01 (fixes #18)

This commit is contained in:
afornerot 2019-08-22 10:16:30 +02:00
parent 31c0763f1b
commit ba54065443
2 changed files with 15 additions and 5 deletions

View File

@ -53,7 +53,9 @@ class Niveau02Controller extends Controller
$totalf= $em->createQueryBuilder()
->select('COUNT(table)')
->from($this->labelentity,'table')
->where('table.label LIKE :value')
->from("CadolesCoreBundle:Niveau01",'nv1')
->where('table.niveau01=nv1.id')
->andwhere('table.label LIKE :value or nv1.label LIKE :value')
->setParameter("value", "%".$search["value"]."%")
->getQuery()
->getSingleScalarResult();
@ -69,13 +71,19 @@ class Niveau02Controller extends Controller
// Parcours des Enregistrement
$qb = $em->createQueryBuilder();
$qb->select('table')->from($this->labelentity,'table');
$qb->select('table')
->from($this->labelentity,'table')
->from("CadolesCoreBundle:Niveau01",'nv1')
->where('table.niveau01=nv1.id');
if($search["value"]!="") {
$qb ->where('table.label LIKE :value')
$qb ->andwhere('table.label LIKE :value or nv1.label LIKE :value')
->setParameter("value", "%".$search["value"]."%");
}
switch($order[0]["column"]) {
case 1 :
$qb->orderBy('nv1.label',$order[0]["dir"]);
break;
case 2 :
$qb->orderBy('table.label',$order[0]["dir"]);
break;
}
@ -83,9 +91,10 @@ class Niveau02Controller extends Controller
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
foreach($datas as $data) {
//dump($data);
$action ="<a href='".$this->generateUrl('cadoles_core_config_niveau02_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
if($data->getId()>0) $action.="<a href='".$this->generateUrl('cadoles_core_config_niveau02_delete', array('id'=>$data->getId()))."'><i class='fa fa-trash fa-fw'></i></a>";
array_push($output["data"],array($action,$data->getLabel()));
array_push($output["data"],array($action,$data->getNiveau01()->getLabel(),$data->getLabel()));
}
// Retour

View File

@ -16,7 +16,8 @@
<thead>
<tr>
<th width="70px" class="no-sort">Action</th>
<th>Label</th>
<th width="50%">{{ labelniveau01 }}</th>
<th>{{ labelniveau02 }}</th>
</tr>
</thead>
</table>