NotificationTemplateTranslation::showSummary PHP Method

showSummary() public method

public showSummary ( NotificationTemplate $template, $options = [] )
$template NotificationTemplate NotificationTemplate object
$options array
    function showSummary(NotificationTemplate $template, $options = array())
    {
        global $DB, $CFG_GLPI;
        $nID = $template->getField('id');
        $canedit = Config::canUpdate();
        if ($canedit) {
            echo "<div class='center'>" . "<a class='vsubmit' href='" . Toolbox::getItemTypeFormURL('NotificationTemplateTranslation') . "?notificationtemplates_id=" . $nID . "'>" . __('Add a new translation') . "</a></div><br>";
        }
        echo "<div class='center' id='tabsbody'>";
        Session::initNavigateListItems('NotificationTemplateTranslation', sprintf(__('%1$s = %2$s'), NotificationTemplate::getTypeName(1), $template->getName()));
        if ($canedit) {
            $rand = mt_rand();
            Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
            $massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
            Html::showMassiveActions($massiveactionparams);
        }
        echo "<table class='tab_cadre_fixe'>";
        echo "<tr class='tab_bg_1'>";
        if ($canedit) {
            echo "<th width='10'>";
            Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
            echo "</th>";
        }
        echo "<th>" . __('Language') . "</th></tr>";
        foreach ($DB->request('glpi_notificationtemplatetranslations', array('notificationtemplates_id' => $nID)) as $data) {
            if ($this->getFromDB($data['id'])) {
                Session::addToNavigateListItems('NotificationTemplateTranslation', $data['id']);
                echo "<tr class='tab_bg_1'>";
                if ($canedit) {
                    echo "<td class='center'>";
                    Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
                    echo "</td>";
                }
                echo "<td class='center'>";
                echo "<a href='" . Toolbox::getItemTypeFormURL('NotificationTemplateTranslation') . "?id=" . $data['id'] . "&amp;notificationtemplates_id=" . $nID . "'>";
                if ($data['language'] != '') {
                    echo $CFG_GLPI['languages'][$data['language']][0];
                } else {
                    _e('Default translation');
                }
                echo "</a></td></tr>";
            }
        }
        echo "</table>";
        if ($canedit) {
            $massiveactionparams['ontop'] = false;
            Html::showMassiveActions($massiveactionparams);
            Html::closeForm();
        }
        echo "</div>";
    }

Usage Example

コード例 #1
0
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkRight("config", 'r');
if (isset($_POST['id']) && $_POST['id'] > 0) {
    if (!isset($_REQUEST['glpi_tab'])) {
        exit;
    }
    $template = new NotificationTemplate();
    $template->getFromDB($_POST['id']);
    switch ($_REQUEST['glpi_tab']) {
        case -1:
        case 1:
            $templatelanguage = new NotificationTemplateTranslation();
            $templatelanguage->showSummary($template);
            break;
        case 12:
            Log::showForItem($template);
            break;
        default:
            if (!Plugin::displayAction($template, $_REQUEST['glpi_tab'])) {
            }
    }
}
ajaxFooter();