status == 'CREATED'); $IS_VALIDATED = ($materiel->status == 'VALIDATED'); $IS_TOBEARCHIVED = ($materiel->status == 'TOBEARCHIVED'); $IS_ARCHIVED = ($materiel->status == 'ARCHIVED'); /* * Couleurs en fonction du statut du matos * // CREATED => bleu if ($IS_CREATED) $color = 'blue'; // VALIDATED => noir if ($IS_VALIDATED) $color = 'black'; //if ($IS_VALIDATED) $color = 'green'; // TBA => orange if ($IS_TOBEARCHIVED) $color = 'orange'; // ARCHIVED => rouge if ($IS_ARCHIVED) $color = 'red'; */ $color = $statuses_color[$materiel->status]; $color = "style='color: $color'"; $USER_IS_CREATOR_OR_OWNER = in_array($username, [$materiel->nom_createur, $materiel->nom_responsable]); $USER_IS_SAME_GROUP_AS_MATERIEL = ( ( isset($priviledgedUser->groupes_metier_id) && $priviledgedUser->groupes_metier_id!=$idGmNa && $materiel->groupes_metier_id==$priviledgedUser->groupes_metier_id ) || ( isset($priviledgedUser->groupes_thematique_id) && $priviledgedUser->groupes_thematique_id!=$idGtNa && $materiel->groupes_thematique_id==$priviledgedUser->groupes_thematique_id ) ); $USER_IS_RESPONSABLE_AND_SAME_GROUP_AS_MATERIEL = $USER_IS_RESPONSABLE && $USER_IS_SAME_GROUP_AS_MATERIEL; $CONTEXT1 = $USER_IS_ADMIN_OR_MORE || $USER_IS_CREATOR_OR_OWNER || $USER_IS_RESPONSABLE_AND_SAME_GROUP_AS_MATERIEL; // Détermination des autorisations pour tous les boutons "éditer", "supprimer", "valider", ... $id = $materiel->id; $CAN_EDIT = $controller->isAuthorizedAction('edit', $id); //$CAN_EDIT = $IS_CREATED && ($USER_IS_ADMIN_OR_MORE || $USER_IS_CREATOR_OR_OWNER || $USER_IS_RESPONSABLE_AND_SAME_GROUP_AS_MATERIEL); //$CAN_EDIT = $IS_CREATED && ($USER_IS_ADMIN_OR_MORE || $USER_IS_UTILISATEUR_AND_CREATOR_OR_OWNER || $USER_IS_RESPONSABLE_AND_SAME_GROUP_AS_MATERIEL || $USER_IS_RESPONSABLE_AND_CREATOR_OR_OWNER); $CAN_DELETE = $controller->isAuthorizedAction('delete', $id); //$CAN_DELETE = $CAN_EDIT; /* $CAN_VALIDATE_OR_INVALIDATE = $USER_IS_ADMIN_OR_MORE || ( ($materiel->materiel_administratif == 0) && $USER_IS_RESPONSABLE && $USER_IS_SAME_GROUP_AS_MATERIEL ); $CAN_VALIDATE = $IS_CREATED && $CAN_VALIDATE_OR_INVALIDATE; $CAN_INVALIDATE = !$IS_CREATED && $CAN_VALIDATE_OR_INVALIDATE; $CAN_TBA = $IS_VALIDATED && ($USER_IS_ADMIN_OR_MORE || $USER_IS_CREATOR_OR_OWNER || ($USER_IS_RESPONSABLE && $USER_IS_SAME_GROUP_AS_MATERIEL)); $CAN_ARCHIVE = $IS_TOBEARCHIVED && $CAN_VALIDATE_OR_INVALIDATE; */ $CAN_INVALIDATE = $controller->isAuthorizedAction('statusCreated', $id); $CAN_VALIDATE = $controller->isAuthorizedAction('statusValidated', $id); $CAN_TBA = $controller->isAuthorizedAction('statusTobearchived', $id); $CAN_ARCHIVE = $controller->isAuthorizedAction('statusArchived', $id); echo '
= __('') ?> | = $this->Paginator->sort('designation','Désignation') ?> | = $this->Paginator->sort('numero_laboratoire', 'N° inv.') ?> | = $this->Paginator->sort('numero_inventaire_organisme', 'N° tut.') ?> | = $this->paginator->sort('hors_service', ' ') ?> | = $this->Paginator->sort('numero_commande', 'BC') ?> | = $this->Paginator->sort('nom_user', "Utilisateur") ?> | = $this->Paginator->sort('Users.nom', 'Gestionnaire') ?> | = $this->Paginator->sort('Categories.nom', 'Catégorie') ?> | = $this->Paginator->sort('status', 'Statut') ?> | = $this->Paginator->sort('date_acquisition', 'Date Achat') ?> | = $this->Paginator->sort('prix_ht', 'Prix') ?> | = $this->Paginator->sort('Fournisseurs.nom', 'Fournisseur') ?> | = $this->Paginator->sort('Sites.nom', 'Lieu') ?> | ".$this->Paginator->sort('metrologie', 'Metro')."" if ($METRO) echo "".$this->Paginator->sort('metrologie', 'Metro')." | " ?>
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
' . $this->Form->checkbox($materiel->id, [ 'style' => 'margin: 3px', 'id' => $materiel->id ]) . ' | '; } // $color = $displayActionButtonsForMateriel($materiel, $statuses_color, $username, $USER_IS_RESPONSABLE, $USER_IS_ADMIN_OR_MORE, $USER_IS_SUPERADMIN, $controller, $this->Html); ?>= $materiel->has('designation') ? $this->Html->link( $materiel->designation, ['controller' => 'Materiels', 'action' => 'view', $materiel->id],[$color] ) : '' ?> | = h($materiel->numero_laboratoire) ?> | = h($materiel->numero_inventaire_organisme) ?> | = ($materiel->hors_service) ? 'HS' : '' ?> | = h($materiel->numero_commande) ?> | = h($materiel->nom_user) ?> | = $materiel->has('user') ? h($materiel->user->nom) : '' ?> | = $materiel->has('category') ? h($materiel->category->nom) : '' ?> | getNiceStatus(); /* switch (h($materiel->status)) { case 'CREATED': //$statut = 'C'; $statut = 'A Valider'; break; case 'VALIDATED': //$statut = 'V'; $statut = 'Validé'; break; case 'TOBEARCHIVED': //$statut = 'T'; $statut = 'A sortir'; break; case 'ARCHIVED': //$statut = 'A'; $statut = 'Archivé'; break; default: $statut = ''; break; } */ ?>>=$statut?> | >= h($materiel->date_acquisition) ?> | = h($materiel->prix_ht.'€') ?> | = $materiel->has('fournisseur') ? h($materiel->fournisseur->nom) : '' ?> | has('site') ? h($materiel->site->nom) : ''; if ($materiel->lieu_detail) { if ($materiel->has('site')) $lieu .= '-'; $lieu .= $materiel->lieu_detail; } ?>=$lieu?> | '. (h($materiel->metrologie)=='1' ? 'Y':'N').''; ?>