Example #1
0
<style>
td {
  padding: 5px;
}

button {
  font-size: 0.6em;
}
</style>

<?php 
if (isset($_REQUEST['action'])) {
    if ($_REQUEST['action'] == "add") {
        DependencyManager::addDependencyByID($_GET['id'], $_REQUEST['aid']);
    } else {
        if ($_REQUEST['action'] == "delete") {
            DependencyManager::removeDependencyByAddonID($_GET['id'], $_REQUEST['aid']);
        }
    }
}
$dep = DependencyManager::getDependenciesFromAddonID($_GET['id']);
if (sizeof($dep) == 0) {
    $html = "<b>No Dependencies!</b>";
} else {
    $html = "<form action=\"\" method=\"post\"><input type=\"hidden\" name=\"action\" value=\"delete\" />";
    $html .= "<table><tbody><tr><td colspan=\"2\"><b>Dependencies:</b></td></tr>";
    foreach ($dep as $did) {
        $d = DependencyManager::getFromId($did);
        $html = $html . "<td>" . AddonManager::getFromId($d->getRequired())->getName() . "</td><td><button name=\"aid\" value=\"" . $d->getRequired() . "\">Delete</button></td></tr>";
    }
    $html = $html . "</tbody></table></form>";