]> git.llucax.com Git - mecon/ai.git/commitdiff
Se agrega opción para ordenar los hijos y se ordena por nombre por defecto.
authorLeandro Lucarella <llucax@gmail.com>
Fri, 3 Oct 2003 22:32:17 +0000 (22:32 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Fri, 3 Oct 2003 22:32:17 +0000 (22:32 +0000)
doc/uml.xmi
lib/AI/DBTreeObject.php

index 24229b78cd8c080d9fff6758d8b8a4d82ca4d06e..45fd219fd5c21738c8c84ee13823b925b163d4e2 100644 (file)
@@ -128,6 +128,7 @@ Sólo se obtienen las secciones que todavía no pertenecen a ningún grupo. Si s
     <UML:Operation stereotype="" package="" xmi.id="527" type="mixed" abstract="0" documentation="Carga hijos de un objeto. Si hubo error devuelve un PEAR_Error, si no hubo error, devuleve un array de objetos (los hijos)." name="cargarHijos" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="mixed" abstract="0" documentation="Base de datos o resultado de donde cargar los hijos." name="db" static="0" scope="200" />
      <UML:Parameter stereotype="" package="" xmi.id="2" value="true" type="bool" abstract="0" documentation="Si es true, se cargan solo los hijos con el flag habilitado." name="soloHabilitados" static="0" scope="200" />
+     <UML:Parameter stereotype="" package="" xmi.id="3" value="'nombre'" type="string" abstract="0" documentation="Indica cómo ordenar los hijos cargados." name="orden" static="0" scope="201" />
     </UML:Operation>
     <UML:Operation stereotype="" package="" xmi.id="529" type="PEAR_Error" abstract="0" documentation="Borra el objeto de la base de datos verificando que no tenga hijos." name="borrar" static="0" scope="200" >
      <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="DB" abstract="0" documentation="Base de datos de la cual borrar el objeto." name="db" static="0" scope="200" />
@@ -142,7 +143,7 @@ x2c:get" name="hijos" static="0" scope="202" />
    <UML:Association nameb="" stereotype="" visibilitya="200" visibilityb="200" assoctype="500" rolea="413" roleb="524" multia="" doca="" multib="" docb="" package="" xmi.id="-1" abstract="0" documentation="" name="" static="0" scope="200" changeabilitya="900" changeabilityb="900" namea="" />
   </umlobjects>
   <diagrams>
-   <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" zoom="100" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="733" snapy="10" showatts="1" xmi.id="412" documentation="" type="402" showops="1" showpackage="0" name="Clases" localid="30000" showstereotype="0" showscope="1" snapcsgrid="0" font="Helvetica,12,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="619" >
+   <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" zoom="100" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="819" snapy="10" showatts="1" xmi.id="412" documentation="" type="402" showops="1" showpackage="0" name="Clases" localid="30000" showstereotype="0" showscope="1" snapcsgrid="0" font="Helvetica,12,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="632" >
     <widgets>
      <UML:ClassWidget usesdiagramfillcolour="0" width="152" showattsigs="601" usesdiagramusefillcolour="0" x="386" linecolour="#ff0000" y="353" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="156" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="413" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="369" showattsigs="601" usesdiagramusefillcolour="0" x="9" linecolour="#ff0000" y="180" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="182" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="416" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
@@ -150,7 +151,7 @@ x2c:get" name="hijos" static="0" scope="202" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="68" showattsigs="601" usesdiagramusefillcolour="0" x="175" linecolour="#ff0000" y="374" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#dcdcdc" height="23" usefillcolor="1" showattributes="0" isinstance="0" xmi.id="471" showoperations="0" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="142" showattsigs="601" usesdiagramusefillcolour="0" x="572" linecolour="#ff0000" y="354" showopsigs="600" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="182" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="486" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
      <UML:ClassWidget usesdiagramfillcolour="0" width="324" showattsigs="601" usesdiagramusefillcolour="0" x="244" linecolour="#ff0000" y="10" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="91" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="516" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
-     <UML:ClassWidget usesdiagramfillcolour="0" width="296" showattsigs="601" usesdiagramusefillcolour="0" x="415" linecolour="#ff0000" y="180" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="65" usefillcolor="1" showattributes="1" isinstance="0" xmi.id="524" showoperations="1" showpackage="0" showscope="1" showstereotype="0" font="Helvetica,8,-1,5,50,0,0,0,0,0" />
+     <UML:ClassWidget usesdiagramfillcolour="0" width="415" showattsigs="601" usesdiagramusefillcolour="0" x="415" linecolour="#ff0000" y="180" showopsigs="601" instancename="" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="65" usefillcolor="1" showattributes="1" isinstance="0" 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>
@@ -174,29 +175,29 @@ x2c:get" name="hijos" static="0" scope="202" />
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="3" indexb="2" widgetbid="516" roleBdoc="" widgetaid="524" roleAdoc="" documentation="" type="500" changeabilityA="900" changeabilityB="900" visibilityA="200" >
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="703" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="-33" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="711" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="26" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="711" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="712" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <linepath>
-       <startpoint startx="563" starty="180" />
+       <startpoint startx="622" starty="180" />
        <endpoint endx="460" endy="101" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="3" indexb="2" widgetbid="524" roleBdoc="" widgetaid="486" roleAdoc="" documentation="" type="500" changeabilityA="900" changeabilityB="900" visibilityA="200" >
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="703" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="39" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="703" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="7" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="711" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="712" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="79" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="712" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <linepath>
        <startpoint startx="572" starty="445" />
-       <endpoint endx="612" endy="245" />
+       <endpoint endx="691" endy="245" />
       </linepath>
      </UML:AssocWidget>
      <UML:AssocWidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="3" indexb="1" widgetbid="524" roleBdoc="" widgetaid="413" roleAdoc="" documentation="" type="500" changeabilityA="900" changeabilityB="900" visibilityA="200" >
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="703" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="20" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="703" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="711" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
-      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="0" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="712" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
+      <UML:FloatingTextWidget usesdiagramfillcolour="1" width="0" usesdiagramusefillcolour="1" x="40" linecolour="none" y="0" operation="" instancename="" posttext="" usesdiagramlinecolour="1" role="712" fillcolour="none" height="0" usefillcolor="1" seqnum="" pretext="" isinstance="0" xmi.id="-1" text="" font="helvetica,12,-1,5,50,0,0,0,0,0" />
       <linepath>
        <startpoint startx="462" starty="353" />
-       <endpoint endx="513" endy="245" />
+       <endpoint endx="553" endy="245" />
       </linepath>
      </UML:AssocWidget>
     </associations>
index b2bdaed0689701ab9f4368319e21bee815070224..7877b995d015306bd78d57155664d8e92e427e48 100644 (file)
@@ -79,12 +79,13 @@ class AI_DBTreeObject extends AI_DBObject {
      *
      * @param  mixed $db Base de datos o resultado de donde cargar los hijos.
      * @param  bool $soloHabilitados Si es true, se cargan solo los hijos con el flag habilitado.
+     * @param  string $orden Indica cómo ordenar los hijos cargados.
      *
      * @return mixed
      * @access public
      */
-    function cargarHijos($db, $soloHabilitados = true) // ~X2C
-    {
+    function cargarHijos($db, $soloHabilitados = true, $orden = 'nombre') // ~X2C
+     {
         $id_field = $this->conf['id'];
         $id_padre = $this->conf['padre'];
         $tabla    = $this->conf['base'].'.'.$this->conf['tabla'];
@@ -98,6 +99,9 @@ class AI_DBTreeObject extends AI_DBObject {
             if ($soloHabilitados) {
                 $query .= ' AND ' . $this->conf['habilitado'] . ' = 1';
             }
+            if ($orden) {
+                $query .= ' ORDER BY ' . $orden;
+            }
             $result = $db->query($query);
             if (DB::isError($result)) {
                 return $result;