X-Git-Url: https://git.llucax.com/mecon/samurai.git/blobdiff_plain/f058984ad70f86039f58f8c9a70617fb1c3522a0..a880b34d71d1a4e53778792b76b182beb7c442dc:/lib/SAMURAI/Permiso.php?ds=inline diff --git a/lib/SAMURAI/Permiso.php b/lib/SAMURAI/Permiso.php index beba603..faca0f8 100644 --- a/lib/SAMURAI/Permiso.php +++ b/lib/SAMURAI/Permiso.php @@ -389,6 +389,42 @@ class SAMURAI_Permiso { } // -X2C + /** + * Metodo que devuelve los datos necesarios para listar permisos. + * + * @param SAMURAI_DB &$db Base de Datos + * @param int $id_sistema Identificador de un sistema en particular. + * + * @return mixed + * @access public + * @static + */ + function getPermisosPager(&$db, $id_sistema = null) { + + //@TODO REEMPLAZA A getPermisos + + if ($id_sistema) { + $sql = ' + SELECT p.id_permiso, p.desc_permiso, p.responsable + FROM samurai.permiso AS p, samurai.perm_sist AS ps + WHERE ps.id_sistema = '. $id_sistema .' + AND ps.id_permiso = p.id_permiso + ORDER BY p.desc_permiso + '; + } + else { + $sql = ' + SELECT p.id_permiso, p.desc_permiso, NOT count(ps.id_sistema) AS cuenta + FROM samurai.permiso AS p + LEFT JOIN samurai.perm_sist AS ps + ON (p.id_permiso = ps.id_permiso) + GROUP BY p.id_permiso, p.desc_permiso + ORDER BY p.desc_permiso + '; + } + return $db->query ($sql); + } + } // -X2C Class :SAMURAI_Permiso ?>