Buying Puzzled and looking for some help

Discussion in 'Programming' started by Scubasjl, May 25, 2010.

  1. #1
    The following code gives me a pedigree table, code is modified to hide the first result in the table. The problem that I ran into is that now in the table you only are allowed to add to it, but when you do. The information never shows just allows you to add. Send me a PM if interested.

    
    <?php
    function DbTriad($dogVO, $level, $generations, $childText) {
    	global $THUMBNAIL_WIDTH;
    	global $dogDAO;
    	# do the individual.
    
    	if ($level == $generations) {
    
    		echo "<TD >";
    
    	} else {
            if($level != 1){
    		echo "<TD ROWSPAN=" . pow(2,($generations - $level));
    
    		echo " >";
            }
    
    	}
       if($level != 1){
    	if (($dogVO != -1) && (!empty($dogVO ))) {
    
    		if (empty($dogVO)) {
    
    			echo "Unknown Individual";
    
    		} else {
    
    			$name = $dogVO->name;
    
    			$sireId = $dogVO->sire->id;
    
    			$damId = $dogVO->dam->id;
    
    			$landofbirth = $dogVO->landofbirth;
    
    			$yearofbirth = $dogVO->yearofbirth;
    
    			$color = $dogVO->color;
    
    			$title = $dogVO->title;
    
    			$photo = $dogVO->photo->thumb_ref;
    			if (empty($photo))
    				$photo = $dogVO->photo->reference;
    
    			### Highlight title w/ red font
    
    			if (!empty($title)) {
    				echo "<label>";
    				echo "<font color=\"red\">$title</font><BR>";
    				echo "</label>";
    			}
    
    			echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$dogVO->id.'">';
    
    			if (!empty($photo)) {
    
    				echo '<p><img SRC="'.$photo.'" width="'.$THUMBNAIL_WIDTH.'"></p>';
    
    			}
    
    			echo "$name</a>";
    
    			echo "<label>";
    
    			//if (($level <= 3) && (!empty($color))) {
    
    			if (!empty($color)) {
    
    				echo "<BR>$color ";
    
    			}
    
    			if (!empty($landofbirth)) {
    
    				echo "<BR>$landofbirth";
    
    			}
    
    			if (!empty($yearofbirth)) {
    
    				echo "<BR>$yearofbirth";
    
    			}
    
    			echo "</label>";
    		}
    
    	} else {
    
    		echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    
    		if (!empty($childText) ) {
    
    			echo '<a href="addPerson.php?child='.$childText.'">Add A Person</a>';
            }
    
    	}
    
    	echo "</TD>";
        }
    
    // do the father.
    
    	if ($level < $generations) {
    
    		if (!empty($dogVO))
    
    			$childText = "fatherOf_".$dogVO->id;
    
    		else
    
    			unset($childText);
    
    		$dogDAO = new DogDAO();
    		if (empty($sireId))
    			$father = null;
    		else
    			$father = $dogDAO->get($sireId);
    		DbTriad($father, $level + 1, $generations, $childText);
    
    	}
    
    # do the mother.
    
    	if ($level < $generations) {
    
    		if (!empty($dogVO))
    
    			$childText = "motherOf_".$dogVO->id;
    
    		else
    
    			unset($childText);
    
    		$dogDAO = new DogDAO();
    		if (empty($damId))
    			$mother = null;
    		else
    			$mother = $dogDAO->get($damId);
    		DbTriad($mother, $level + 1, $generations, $childText);
    
    	}
    
    # finish up.
    
    	if ($level == $generations) {
    
    	 	echo "</TR><TR>";
    
    	}
    
    
    
    }
    
    
    # begin table
    
    	echo '<table id="pedigree" align="center" width="97%" border="0"><tr><th colspan='.$generations.'>Pedigree</th></tr>';
    
    # do tree.
    
    	$dogDAO = new DogDAO();
    
    	$dog = $dogDAO->get($currId);
    
    	DbTriad ($dog, 1, $generations, null);
    
    # end table
    
    	echo "</td></tr></table>";
    
     ?>
    
    Code (markup):

     
    Scubasjl, May 25, 2010 IP