X-Git-Url: https://git.llucax.com/mecon/samurai.git/blobdiff_plain/346c91ca894a5f231f481f0eed740208a7573e34..698ca0ba3178e27141c4d03c943f085c13107d39:/lib/SAMURAI/Permiso.php diff --git a/lib/SAMURAI/Permiso.php b/lib/SAMURAI/Permiso.php index a6004e0..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 -?> \ No newline at end of file +?>