<?php 
    $yes = get_string("yes");
    $no  = get_string("no");
?>
<form method="post" action="module.php" id="form">
<div>
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>" />

<table cellpadding="9" cellspacing="0" >
<tr valign="top">
    <td colspan="3" align="center"><strong><?php print_string("glossaryleveldefaultsettings","glossary") ?></strong></td>
</tr>
<tr valign="top">
    <td align="right">glossary_entbypage:</td>
    <td>
    <input name="glossary_entbypage" type="text" size="3" value="<?php p(isset($CFG->glossary_entbypage) ? $CFG->glossary_entbypage : 10) ?>" />
    </td>
    <td>
    <?php print_string("entbypage", "glossary") ?>
    </td>
</tr>
<tr valign="top">
    <td align="right">glossary_dupentries:</td>
    <td>
    <select size="1" name="glossary_dupentries">
<?php 
    $yselected = "";
    $nselected = "";
    if ($CFG->glossary_dupentries) {
        $yselected = " selected=\"selected\" ";
    } else {
        $nselected = " selected=\"selected\" ";
    }
?>
    <option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
    <option value="0" <?php echo $nselected ?>><?php p($no)?></option>
    </select>
    </td>
    <td>
    <?php print_string("cnfallowdupentries", "glossary") ?>
    </td>
</tr>
<tr valign="top">
    <td align="right">glossary_allowcomments:</td>
    <td>
    <select size="1" name="glossary_allowcomments">
<?php 
    $yselected = "";
    $nselected = "";
    if ($CFG->glossary_allowcomments) {
        $yselected = " selected=\"selected\" ";
    } else {
        $nselected = " selected=\"selected\" ";
    }
?>
    <option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
    <option value="0" <?php echo $nselected ?>><?php p($no)?></option>
    </select>
    </td>
    <td>
    <?php print_string("cnfallowcomments", "glossary") ?>
    </td>
</tr>
<tr valign="top">
    <td align="right">glossary_linkbydefault:</td>
    <td>
    <select size="1" name="glossary_linkbydefault">
<?php 
    $yselected = "";
    $nselected = "";
    if ($CFG->glossary_linkbydefault) {
        $yselected = " selected=\"selected\" ";
    } else {
        $nselected = " selected=\"selected\" ";
    }
?>
    <option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
    <option value="0" <?php echo $nselected ?>><?php p($no)?></option>
    </select>
    </td>
    <td>
    <?php print_string("cnflinkglossaries", "glossary") ?>
    </td>
</tr>
<tr valign="top">
    <td align="right">glossary_defaultapproval:</td>
    <td>
    <select size="1" name="glossary_defaultapproval">
<?php 
    $yselected = "";
    $nselected = "";
    if ($CFG->glossary_defaultapproval) {
        $yselected = " selected=\"selected\" ";
    } else {
        $nselected = " selected=\"selected\" ";
    }
?>
    <option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
    <option value="0" <?php echo $nselected ?>><?php p($no)?></option>
    </select>
    </td>
    <td>
    <?php print_string("cnfapprovalstatus", "glossary") ?>
    </td>
</tr>
<tr valign="top">
        <td align="right">glossary_enablerssfeeds:</td>
        <td>
    <?php
        if (!isset($CFG->enablerssfeeds) || $CFG->enablerssfeeds == 0) {
            print_string("no");
        } else {
            unset($options);
            $options[0] = get_string("no");
            $options[1] = get_string("yes");

            $glossary_enablerssfeeds = false;
            if (isset($CFG->glossary_enablerssfeeds) && $CFG->glossary_enablerssfeeds == 1) {
                $glossary_enablerssfeeds = true;
            }

            choose_from_menu ($options, "glossary_enablerssfeeds", $glossary_enablerssfeeds, "", "", "");
        }
    ?>
    </td>
    <td>
    <?php
        print_string("configenablerssfeeds","glossary");
        if (!isset($CFG->enablerssfeeds) || $CFG->enablerssfeeds == 0) {
            print_string("configenablerssfeedsdisabled");
        }
    ?>
    </td>
</tr>
<tr valign="top">
    <td colspan ="3" align="center"><strong><?php print_string("entryleveldefaultsettings","glossary") ?></strong></td>
</tr>
<tr valign="top">
    <td align="right">glossary_linkentries:</td>
    <td>
    <select size="1" name="glossary_linkentries">
<?php 
    $yselected = "";
    $nselected = "";
    if (isset($CFG->glossary_linkentries) && $CFG->glossary_linkentries) {
        $yselected = " selected=\"selected\" ";
    } else {
        $nselected = " selected=\"selected\" ";
    }
?>
    <option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
    <option value="0" <?php echo $nselected ?>><?php p($no)?></option>
    </select>
    </td>
    <td>
    <?php print_string("cnflinkentry", "glossary") ?>
    </td>
</tr>
<tr valign="top">
    <td align="right">glossary_casesensitive:</td>
    <td>
    <select size="1" name="glossary_casesensitive">
<?php 
    $yselected = "";
    $nselected = "";
    if (isset($CFG->glossary_casesensitive) && $CFG->glossary_casesensitive) {
        $yselected = " selected=\"selected\" ";
    } else {
        $nselected = " selected=\"selected\" ";
    }
?>
    <option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
    <option value="0" <?php echo $nselected ?>><?php p($no)?></option>
    </select>
    </td>
    <td>
    <?php print_string("cnfcasesensitive", "glossary") ?>
    </td>
</tr>
<tr valign="top">
    <td align="right">glossary_fullmatch:</td>
    <td>
    <select size="1" name="glossary_fullmatch">
<?php 
    $yselected = "";
    $nselected = "";
    if (isset($CFG->glossary_fullmatch) && $CFG->glossary_fullmatch) {
        $yselected = " selected=\"selected\" ";
    } else {
        $nselected = " selected=\"selected\" ";
    }
?>
    <option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
    <option value="0" <?php echo $nselected ?>><?php p($no)?></option>
    </select>
    </td>
    <td>
    <?php print_string("cnffullmatch", "glossary") ?>
    </td>
</tr>
<tr valign="top">
    <td colspan ="3" align="center"><a name="formats"><strong><?php print_string("displayformatssetup","glossary") ?></strong></a></td>
</tr>
<tr>
    <td colspan="3" align="center">
<?php

    //Update and get available formats
    $recformats = glossary_get_available_formats();

    $formats = array();

    //Take names
    foreach ($recformats as $format) {
        $formats[$format->id] = get_string("displayformat$format->name", "glossary");
    }
    asort($formats);

    print_simple_box_start('center');
    foreach ($formats as $formatid=>$formatname) {
        $recformat = get_record('glossary_formats','id',$formatid);
        echo '<tr>';
        echo '<td>' . $formatname . '</td>';
        $eicon = "<a title=\"" . get_string("edit") . "\" href=\"$CFG->wwwroot/mod/glossary/formats.php?id=$formatid&amp;mode=edit\"><img class=\"iconsmall\" src=\"../pix/t/edit.gif\" alt=\"".get_string("edit")."\" /></a>";
        if ( $recformat->visible ) {
            $vtitle = get_string("hide");
            $vicon = "hide.gif";
        } else {
            $vtitle = get_string("show");
            $vicon = "show.gif";
        }
        $vicon = "<a title=\"" . $vtitle . "\" href=\"$CFG->wwwroot/mod/glossary/formats.php?id=$formatid&amp;mode=visible\"><img class=\"iconsmall\" src=\"../pix/t/" . $vicon . "\" alt=\"$vtitle\" /></a>";

        echo '<td align="center">' . $eicon . '&nbsp;&nbsp;' . $vicon . '</td>';
        echo '</tr>';
    }
    print_simple_box_end();

?>

    </td>
</tr>
<tr>
    <td colspan="3" align="center">
        <input type="submit" value="<?php print_string("savechanges") ?>" /></td>
</tr>
</table>
</div>
</form>
