<?php $maxlength=70; ?>

<form action="course.php" method="post">
<div>
<table style="margin-left:auto;margin-right:auto">
    <tr>
        <td>
            <label for="removeoutcomes"><?php print_string('outcomescourse', 'grades'); ?></label>
            <br />
            <select id="removeoutcomes" size="20" name="removeoutcomes[]" multiple="multiple">
            <?php
            if ($co_standard_notused) {
                echo '<optgroup label="'.get_string('outcomescoursenotused', 'grades').'">';
                foreach ($co_standard_notused as $outcome) {
                    echo '<option value="'.$outcome->id.'">'.shorten_text($outcome->get_name(), $maxlength).'</option>';
                }
                echo '</optgroup>';
            }
            if ($co_standard_used) {
                echo '<optgroup label="'.get_string('outcomescourseused', 'grades').'">';
                foreach ($co_standard_used as $outcome) {
                    echo '<option value="'.$outcome->id.'">'.shorten_text($outcome->get_name(), $maxlength).'</option>';
                }
                echo '</optgroup>';
            }
            if ($co_custom) {
                echo '<optgroup label="'.get_string('outcomescoursecustom', 'grades').'">';
                foreach ($co_custom as $outcome) {
                    echo '<option value="'.$outcome->id.'">'.shorten_text($outcome->get_name(), $maxlength).'</option>';
                }
                echo '</optgroup>';
            }
            ?>
            </select>
        </td>
        <?php
        if (has_capability('moodle/grade:manageoutcomes', $context)) {
        ?>
        <td>
            <p class="arrow_button">
                <input name="add" id="add" type="submit" value="<?php echo '&nbsp; '.$THEME->larrow.' &nbsp; &nbsp; '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
                <br />
                <input name="remove" id="remove" type="submit" value="<?php echo '&nbsp;'.$THEME->rarrow.' &nbsp; &nbsp; '.get_string('remove'); ?>" title="<?php print_string('remove'); ?>" />
            </p>
        </td>
        <?php } ?>
        <td>
            <label for="addoutcomes"><?php print_string('outcomesstandardavailable', 'grades'); ?></label>
            <br />
            <select id="addoutcomes" size="20" name="addoutcomes[]" multiple="multiple">

            <?php
            foreach ($standardoutcomes as $outcome) {
                echo '<option value="'.$outcome->id.'">'.shorten_text($outcome->get_name(), $maxlength).'</option>';
            }
            ?>
            </select>
        </td>
    </tr>
</table>

<input name="id" type="hidden" value="<?php echo $courseid?>"/>
</div>
</form>
