]> git.llucax.com Git - mecon/ai.git/commitdiff
Se agrega un método para obtener un array de sistemas (objetos) para usar
authorLeandro Lucarella <llucax@gmail.com>
Tue, 22 Jul 2003 21:09:10 +0000 (21:09 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Tue, 22 Jul 2003 21:09:10 +0000 (21:09 +0000)
en Intranet.

doc/uml.xmi
lib/AI/Sistema.php

index ee2eb86667f8b95399f035d816c64a3f65cf3f7e..c881dfdc74d275b0fad8fa339a8d10294faea961 100644 (file)
@@ -9,7 +9,7 @@
   <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
  </XMI.header>
  <XMI.content>
-  <docsettings viewid="412" documentation="" uniqueid="530" />
+  <docsettings viewid="412" documentation="" uniqueid="531" />
   <umlobjects>
    <UML:Class stereotype="" package="AI" xmi.id="413" abstract="0" documentation="Servicio." name="AI_Servicio" static="0" scope="200" >
     <UML:Operation stereotype="" package="" xmi.id="465" type="void" abstract="0" documentation="" name="AI_Servicio" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="DB" abstract="0" documentation="DB donde guardar." name="db" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="2" value="false" type="bool" abstract="0" documentation="Si es true, se fuerza a guardar el servicio como nuevo." name="nuevo" static="0" scope="200" />
     </UML:Operation>
+    <UML:Operation stereotype="" package="" xmi.id="531" type="array" abstract="0" documentation="" name="getSistemas" static="1" scope="200" >
+     <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="DB" abstract="0" documentation="Base de datos de donde obtener los sistemas." name="db" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="2" value="''" type="string" abstract="0" documentation="Clausula WHERE para filtrar la búsqueda." name="where" static="0" scope="200" />
+    </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="528" type="array" abstract="0" documentation="Obtiene un array con los identificadores de los sistemas cargados." name="getSistemasArray" static="1" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="DB" abstract="0" documentation="Base de datos de la cual obtener los sistemas." name="db" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="2" value="''" type="string" abstract="0" documentation="Clausula WHERE para filtrar resultados." name="where" static="0" scope="200" />
@@ -144,7 +148,7 @@ x2c:get" name="hijos" static="0" scope="202" />
    <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="412" documentation="" type="402" showops="1" showpackage="0" name="Clases" localid="30000" showstereotype="0" showscope="1" font="Helvetica,8,-1,5,50,0,0,0,0,0" linecolor="#ff0000" >
     <widgets>
      <UML:ConceptWidget usesdiagramfillcolour="0" width="170" showattsigs="601" usesdiagramusefillcolour="0" x="267" linecolour="#ff0000" y="310" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="168" usefillcolor="1" showattributes="1" xmi.id="413" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="287" showattsigs="601" usesdiagramusefillcolour="0" x="20" linecolour="#ff0000" y="151" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="154" usefillcolor="1" showattributes="1" xmi.id="416" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="287" showattsigs="601" usesdiagramusefillcolour="0" x="30" linecolour="#ff0000" y="139" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="168" usefillcolor="1" showattributes="1" xmi.id="416" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="262" showattsigs="601" usesdiagramusefillcolour="0" x="410" linecolour="#ff0000" y="543" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="49" usefillcolor="1" showattributes="1" xmi.id="469" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="73" showattsigs="601" usesdiagramusefillcolour="0" x="505" linecolour="#ff0000" y="487" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="24" usefillcolor="1" showattributes="0" xmi.id="471" showoperations="0" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="277" showattsigs="601" usesdiagramusefillcolour="0" x="450" linecolour="#ff0000" y="296" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="182" usefillcolor="1" showattributes="1" xmi.id="486" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
@@ -152,8 +156,8 @@ x2c:get" name="hijos" static="0" scope="202" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="46" showattsigs="601" usesdiagramusefillcolour="0" x="126" linecolour="#ff0000" y="316" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="24" usefillcolor="1" showattributes="0" xmi.id="504" showoperations="0" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="271" showattsigs="601" usesdiagramusefillcolour="0" x="16" linecolour="#ff0000" y="529" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="49" usefillcolor="1" showattributes="1" xmi.id="507" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ConceptWidget usesdiagramfillcolour="0" width="146" showattsigs="601" usesdiagramusefillcolour="0" x="78" linecolour="#ff0000" y="454" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="24" usefillcolor="1" showattributes="0" xmi.id="508" showoperations="0" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="346" showattsigs="601" usesdiagramusefillcolour="0" x="146" linecolour="#ff0000" y="17" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="98" usefillcolor="1" showattributes="1" xmi.id="516" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
-     <UML:ConceptWidget usesdiagramfillcolour="0" width="297" showattsigs="601" usesdiagramusefillcolour="0" x="319" linecolour="#ff0000" y="151" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="70" usefillcolor="1" showattributes="1" xmi.id="524" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="346" showattsigs="601" usesdiagramusefillcolour="0" x="145" linecolour="#ff0000" y="6" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="98" usefillcolor="1" showattributes="1" xmi.id="516" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
+     <UML:ConceptWidget usesdiagramfillcolour="0" width="297" showattsigs="601" usesdiagramusefillcolour="0" x="324" linecolour="#ff0000" y="139" showopsigs="601" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="70" usefillcolor="1" showattributes="1" xmi.id="524" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
     </widgets>
     <messages/>
     <associations>
@@ -171,14 +175,14 @@ x2c:get" name="hijos" static="0" scope="202" />
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" widgetbid="516" widgetaid="416" documentation="" type="500" >
       <linepath>
-       <startpoint startx="163" starty="151" />
-       <endpoint endx="261" endy="115" />
+       <startpoint startx="173" starty="139" />
+       <endpoint endx="260" endy="104" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" widgetbid="516" widgetaid="524" documentation="" type="500" >
       <linepath>
-       <startpoint startx="467" starty="151" />
-       <endpoint endx="376" endy="115" />
+       <startpoint startx="472" starty="139" />
+       <endpoint endx="375" endy="104" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="504" widgetaid="503" documentation="" type="500" >
@@ -190,13 +194,13 @@ x2c:get" name="hijos" static="0" scope="202" />
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" widgetbid="524" widgetaid="486" documentation="" type="500" >
       <linepath>
        <startpoint startx="588" starty="296" />
-       <endpoint endx="517" endy="221" />
+       <endpoint endx="522" endy="209" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" widgetbid="524" widgetaid="413" documentation="" type="500" >
       <linepath>
        <startpoint startx="352" starty="310" />
-       <endpoint endx="418" endy="221" />
+       <endpoint endx="423" endy="209" />
       </linepath>
      </UML:AssocWidget>
     </associations>
@@ -262,6 +266,7 @@ x2c:get" name="hijos" static="0" scope="202" />
       <listitem open="0" type="813" id="416" label="AI_Sistema" >
        <listitem open="0" type="815" id="466" label="AI_Sistema" />
        <listitem open="0" type="814" id="514" label="descripcion" />
+       <listitem open="0" type="815" id="531" label="getSistemas" />
        <listitem open="0" type="815" id="528" label="getSistemasArray" />
        <listitem open="0" type="815" id="459" label="guardar" />
        <listitem open="0" type="814" id="445" label="habilitado" />
index e149668b4f28c8af08e2cd55b6345d6efe9bb16f..6c761aefcce8def330b3c3a9b56b18e2baa2d032 100644 (file)
@@ -172,6 +172,51 @@ FIXME - preguntar a gonzalo si le sirve.
     }
     // -X2C
 
+    // +X2C Operation 531
+    /**
+     * @param  DB $db Base de datos de donde obtener los sistemas.
+     * @param  string $where Clausula WHERE para filtrar la bsqueda.
+     *
+     * @return array
+     * @access public
+     * @static
+     */
+    function getSistemas($db, $where = '') // ~X2C
+    {
+        static $conf;
+        if (!$conf) {
+            $conf = parse_ini_file(AI_SISTEMA_CONFFILE, true);
+        }
+        $id_field = $conf['id'];
+        $tabla    = $conf['base'].'.'.$conf['tabla'];
+        // FIXME - ver como manejar JOINs - Ver de hacer el JOIN tambien en cargar.
+        $query = "SELECT AI.*, SA.nombre_sistema as nombre, SA.desc_sistema as descripcion FROM $tabla as AI, samurai.sistema as SA WHERE SA.id_sistema = AI.sistema and SA.estado = 1";
+        if ($where) {
+            $query .= " WHERE $where";
+        }
+        $query  .= ' ORDER BY nombre ASC';
+        $result  = $db->query($query);
+        if (DB::isError($result)) {
+            return $result;
+        }
+        $sistemas = array();
+        $sistema  = new AI_Sistema;
+        $err      = $sistema->cargar($result);
+        while (!PEAR::isError($err)) {
+            $sistemas[] = $sistema->__clone();
+            $err = $sistema->cargar($result);
+        }
+        // Si no hay mas resultados (terminó bien) devuelve el array de
+        // sistemas.
+        if (AI_Error::isError($err)
+                and $err->getCode() == AI_ERROR_NO_RESULTADOS) {
+            return $sistemas;
+        }
+        // Si no, se devuelve el error.
+        return $err;
+    }
+    // -X2C
+
 } // -X2C Class :AI_Sistema
 
-?>
\ No newline at end of file
+?>