Пример #1
0
function manage()
{
    global $oAdminButton, $imagearray;
    $faqAdapters =& xhelpFaqAdapterFactory::installedAdapters();
    $myAdapter =& xhelpFaqAdapterFactory::getFaqAdapter();
    xoops_cp_header();
    echo $oAdminButton->renderButtons('manFaqAdapters');
    echo "<form method='post' action='" . XHELP_ADMIN_URL . "/faqAdapter.php?op=updateActive'>";
    echo "<table width='100%' cellspacing='1' class='outer'>";
    if (!empty($faqAdapters)) {
        echo "<tr><th colspan='5'>" . _AM_XHELP_MENU_MANAGE_FAQ . "</th></tr>";
        echo "<tr class='head'>\r\n                  <td>" . _AM_XHELP_TEXT_NAME . "</td>\r\n                  <td>" . _AM_XHELP_TEXT_PLUGIN_VERSION . "</td>\r\n                  <td>" . _AM_XHELP_TEXT_TESTED_VERSIONS . "</td>\r\n                  <td>" . _AM_XHELP_TEXT_AUTHOR . "</td>\r\n                  <td>" . _AM_XHELP_TEXT_ACTIVE . "</td>\r\n              </tr>";
        $activeAdapter = xhelpGetMeta('faq_adapter');
        foreach ($faqAdapters as $name => $oAdapter) {
            $modname = $name;
            $author = $oAdapter->meta['author'];
            $author_name = $author;
            if ($oAdapter->meta['url'] != '') {
                // If a website is specified
                $name = "<a href='" . $oAdapter->meta['url'] . "'>" . $oAdapter->meta['name'] . "</a>";
                // Add link to module name
            }
            if ($oAdapter->meta['author_email'] != '') {
                $author = "<a href='mailto:" . $oAdapter->meta['author_email'] . "'>" . $author_name . "</a>";
                // Add link to email author
            }
            echo "<tr class='even'>\r\n                      <td>" . $name . "</td>\r\n                      <td>" . $oAdapter->meta['version'] . "</td>\r\n                      <td>" . $oAdapter->meta['tested_versions'] . "</td>\r\n                      <td>" . $author . "</td>\r\n                      <td>\r\n                          <input type='image' src='" . ($activeAdapter == $modname ? XHELP_IMAGE_URL . '/on.png' : XHELP_IMAGE_URL . '/off.png') . "' name='modname' value='" . $modname . "' style='border:0;background:transparent' />\r\n                      </td>\r\n                  </tr>";
        }
    } else {
        // Display "no adapters found" message
        echo "<tr><th>" . _AM_XHELP_MENU_MANAGE_FAQ . "</th></tr>";
        echo "<tr><td class='even'>" . _AM_XHELP_TEXT_NO_FILES . "</td></tr>";
    }
    echo "</table></form>";
    if (is_object($myAdapter)) {
        $faq = $myAdapter->createFaq();
    }
    xhelpAdminFooter();
    xoops_cp_footer();
}