Location: PHPKode > projects > Mozart > Mozart-0.0.4/links.inc
<?
// called from: every program which presents a screen to the user
// description: a smart link page.  It looks to see which program is being executed,
//              and customizes the links for that program.
//
// $PHP_SELF will contain the name of the program which include()'s this module
//
// $array will be an array containing each element of the path to the .php module
// which includes links.inc.  For example, given the path of /mozart/display.php:
// $array[0] = ""
// $array[1] = "mozart"
// $array[2] = ""
// $array[3] = display.php
$array = explode("/", $PHP_SELF);

// $num is the number of elements in $array.  Following the example above, $num would
// be 3 (remember the zero offset).
$num = count($array);

// the following links are standard for every page
?>
<center>
<table border=0 cellspacing=0 cellpadding=5>
<tr>
<td><a href="index.php">Main</a></td>
<td><a href="calendar.php">Calendar</a></td>
<td><a href="contactlist.php">Contacts</a></td>
<td><a href="projectlist.php">Projects</a></td>
</tr><tr>
<?
// now we begin customizing the links depending upon which module is being
// executed
for ($x=0; $x <= $num; $x++) {
    if ($array[$x] == "contactlist.php") {
    ?>
        <td><b>Contact:</b></td>
        <td><a href="addcontact.php">Add New</a></td>
    <?
    }
    elseif ($array[$x] == "projectlist.php") {
    ?>
        <td><b>Project:</b></td>
        <td><a href="addproject.php">Add New</a></td>
    <?
    }
    elseif ($array[$x] == "display.php" or
        $array[$x] == "updcontact.php" or
        $array[$x] == "delcontact.php") {
    ?>
       <td><b>Contact:</b></td>
       <td><a href="updcontact.php?id=<? echo $id?>">Update</a></td>
       <td><a href="delcontact.php?id=<? echo $id?>">Delete</a></td>
       <td><a href="addtomylist.php?id=<? echo $id?>">Add To My Contact List</a></td>
    <?
    }
    elseif ($array[$x] == "projectdisplay.php" or
            $array[$x] == "updproject.php") {
    ?>
       <td><b>Project:</b></td>
       <td><a href="updproject.php?id=<? echo $id?>">Update</a></td>
       <td><a href="delproject.php?id=<? echo $id?>">Delete</a></td>
       <td><a href="multidate.php?id=<? echo $id?>">MultiDate Input</a></td>
       </tr>
    <?
    }
    elseif ($array[$x] == "calendar.php") {
    ?>
       <td><b>Calendar:</b></td>
       <td><a href="calendar.php?PrevMon=<? echo $PrevMon?>&PrevYear=<? echo $PrevYear?>&SearchSys=<? echo $SearchSys?>">Previous</a></td>
       <td><a href="calendar.php?SearchSys=<? echo $SearchSys?>">Today</a></td>
       <td><a href="calendar.php?NextMon=<? echo $NextMon?>&NextYear=<? echo $NextYear?>&SearchSys=<? echo $SearchSys?>">Next</a></td>
    <?
    }
}
?>
</tr>
</table>
</center>
Return current item: Mozart