示例#1
0
 public function getCouche($profil_id = null, $utilisateur_id = null)
 {
     if ((is_null($profil_id) || trim($profil_id) == "") && (is_null($utilisateur_id) || trim($utilisateur_id) == "")) {
         $sql = " SELECT c.*, true as est_visible, false as est_active, true as est_lecture, true as est_ecriture, true as est_analyse, true as est_export" . " FROM  igo_couche c where c.id={$this->id}; ";
     } else {
         if (!is_null($profil_id) && trim($profil_id) != "") {
             $sql = "SELECT c.*, true as est_visible, false as est_active,est_lecture or est_publique as est_lecture, est_ecriture, est_analyse, est_export" . " FROM  igo_couche c LEFT JOIN igo_permission p ON  c.id=p.couche_id and p.profil_id=" . $profil_id . " where c.id={$this->id} ";
         } else {
             $sql = " SELECT c.*, est_visible, est_active, est_lecture or est_publique as est_lecture, est_ecriture, est_analyse, est_export" . " FROM igo_couche c LEFT JOIN igo_permission p, igo_utilisateur_profil up ON c.id=p.couche_id and and p.profil_id=up.profil_id and up.utilisateur_id=" . $utilisateur_id . "" . " where c.id={$this->id}";
         }
     }
     $igo_couche = new IgoCouche();
     $igo_couche = new Resultset(null, $igo_couche, $igo_couche->getReadConnection()->query($sql));
     return $igo_couche;
 }