Пример #1
0
function displayBridgeCard($bridgeReference, $bridgeInformations, $formats, $isActive = true)
{
    $name = isset($bridgeInformations['homepage']) ? '<a href="' . $bridgeInformations['homepage'] . '">' . $bridgeInformations['name'] . '</a>' : $bridgeInformations['name'];
    $description = isset($bridgeInformations['description']) ? $bridgeInformations['description'] : 'No description provided';
    $card = <<<CARD
\t<section id="bridge-{$bridgeReference}" data-ref="{$bridgeReference}">
\t\t<h2>{$name}</h2>
\t\t<p class="description">
\t\t\t{$description}
\t\t</p>
CARD;
    if (isset($bridgeInformations['use']) && count($bridgeInformations['use']) > 0) {
        $card .= '<ol class="list-use">' . PHP_EOL;
        foreach ($bridgeInformations['use'] as $anUseNum => $anUse) {
            $card .= '<li data-use="' . $anUseNum . '">' . PHP_EOL;
            $card .= '<form method="GET" action="?">
							<input type="hidden" name="action" value="display" />
							<input type="hidden" name="bridge" value="' . $bridgeReference . '" />' . PHP_EOL;
            foreach ($anUse as $argValue) {
                $idArg = 'arg-' . $bridgeReference . '-' . $anUseNum . '-' . $argValue['query-name'];
                if ($argValue['type'] == null || $argValue['type'] == "text") {
                    //If we have no type, treat it as a text field for compatibility
                    $card .= '<input id="' . $idArg . '" type="text" value="" placeholder="' . $argValue['value'] . '" name="' . $argValue['query-name'] . '" />' . PHP_EOL;
                } else {
                    if ($argValue['type'] == "list") {
                        $card .= '<select id="' . $idArg . '" name="' . $argValue['query-name'] . '" >' . PHP_EOL;
                        $optionList = explode(";", $argValue['value']);
                        foreach ($optionList as $option) {
                            $option = explode("=>", $option);
                            $card .= "<option value='" . $option[1] . "'>" . $option[0] . "</option>";
                        }
                        $card .= "</select>";
                    }
                }
            }
            $card .= '<br />';
            if ($isActive) {
                $card .= getHelperButtonsFormat($formats);
            } else {
                $card .= '<span style="font-weight: bold;">Inactive</span>';
            }
            $card .= '</form></li>' . PHP_EOL;
        }
        $card .= '</ol>' . PHP_EOL;
    } else {
        $card .= '<form method="GET" action="?">
				<input type="hidden" name="action" value="display" />
				<input type="hidden" name="bridge" value="' . $bridgeReference . '" />' . PHP_EOL;
        if ($isActive) {
            $card .= getHelperButtonsFormat($formats);
        } else {
            $card .= '<span style="font-weight: bold;">Inactive</span>';
        }
        $card .= '</form>' . PHP_EOL;
    }
    $card .= isset($bridgeInformations['maintainer']) ? '<span class="maintainer">' . $bridgeInformations['maintainer'] . '</span>' : '';
    $card .= '</section>';
    return $card;
}
Пример #2
0
function displayBridgeCard($bridgeReference, $bridgeInformations, $formats, $isActive = true)
{
    $name = isset($bridgeInformations['homepage']) ? '<a href="' . $bridgeInformations['homepage'] . '">' . $bridgeInformations['name'] . '</a>' : $bridgeInformations['name'];
    $description = isset($bridgeInformations['description']) ? $bridgeInformations['description'] : 'No description provided';
    $card = <<<CARD
\t<section id="bridge-{$bridgeReference}" data-ref="{$bridgeReference}">
\t\t<h2>{$name}</h2>
\t\t<p class="description">
\t\t\t{$description}
\t\t</p>
CARD;
    if (isset($bridgeInformations['use']) && count($bridgeInformations['use']) > 0) {
        $card .= '<ol class="list-use">' . PHP_EOL;
        foreach ($bridgeInformations['use'] as $anUseNum => $anUse) {
            $card .= '<li data-use="' . $anUseNum . '">' . PHP_EOL;
            $card .= '<form method="GET" action="?">
							<input type="hidden" name="action" value="display" />
							<input type="hidden" name="bridge" value="' . $bridgeReference . '" />' . PHP_EOL;
            foreach ($anUse as $argName => $argDescription) {
                $idArg = 'arg-' . $bridgeReference . '-' . $anUseNum . '-' . $argName;
                $card .= '<input id="' . $idArg . '" type="text" value="" placeholder="' . $argDescription . '" name="' . $argName . '" />' . PHP_EOL;
            }
            $card .= '<br />';
            if ($isActive) {
                $card .= getHelperButtonsFormat($formats);
            } else {
                $card .= '<span style="font-weight: bold;">Inactive</span>';
            }
            $card .= '</form></li>' . PHP_EOL;
        }
        $card .= '</ol>' . PHP_EOL;
    } else {
        $card .= '<form method="GET" action="?">
				<input type="hidden" name="action" value="display" />
				<input type="hidden" name="bridge" value="' . $bridgeReference . '" />' . PHP_EOL;
        if ($isActive) {
            $card .= getHelperButtonsFormat($formats);
        } else {
            $card .= '<span style="font-weight: bold;">Inactive</span>';
        }
        $card .= '</form>' . PHP_EOL;
    }
    $card .= isset($bridgeInformations['maintainer']) ? '<span class="maintainer">' . $bridgeInformations['maintainer'] . '</span>' : '';
    $card .= '</section>';
    return $card;
}