X-Git-Url: https://git.llucax.com/mecon/samurai.git/blobdiff_plain/bcca0c17730ae290fdbdfe15f506354c1acd6c07..ce8c82238fa511d1a2523e67cca4d76b4a66a4a0:/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 ?>