function amrical_choose_fields()
{
    global $amr_options;
    //$nonce = wp_create_nonce('amr-ical-events-list'); /* used for security to verify that any action request comes from this plugin's forms */
    amrical_admin_heading(__('Choose event and calendar fields ', 'amr-ical-events-list'));
    $inuse = amr_whats_in_use();
    $desc = amr_set_helpful_descriptions();
    if (isset($_POST['action']) and $_POST['action'] == "save") {
        $nonce = $_REQUEST['_wpnonce'];
        if (!wp_verify_nonce($nonce, 'amr-ical-events-list')) {
            die("Cancelled due to failed security check");
        }
        /* Validate the input and save */
        if (isset($_POST['reset'])) {
            echo '<div class="updated"><p>';
            _e('Resetting....', 'amr-ical-events-list');
            delete_option('amr-event-fields-in-use');
            echo '</p></div>';
            $inuse = amr_whats_in_use();
        } else {
            $inuse = amr_ical_validate_fields($inuse);
        }
    }
    array_multisort(array_values($inuse), SORT_DESC, array_keys($inuse), SORT_ASC, $inuse);
    //$fields - an array of fields used in a column
    echo '<p>' . __('Choose a subset of fields to work with:') . '</p>';
    echo '<div style="columns: 300px 2;">';
    foreach ($inuse as $f => $bool) {
        echo '<p><lable><input type="checkbox" name="inuse[' . $f . ']" ';
        if ($bool) {
            echo ' checked="checked" >';
        } else {
            echo '>';
        }
        echo '<b>' . $f . '</b> (' . $bool . 'x)';
        if (!empty($desc[$f])) {
            echo ' - <em>' . $desc[$f] . '</em>';
        }
        echo '</lable></p>';
    }
    amr_ical_submit_buttons(__('Reset', 'amr-ical-events-list'));
    echo '</div></form></div>';
}
示例#2
0
function amrical_componentsoption($i)
{
    global $amr_options;
    $listtype = $amr_options['listtypes'][$i];
    echo '<fieldset id="components" class="components" >
	<h4 class="trigger"><a href="#" >';
    _e('Select components to show:', 'amr-ical-events-list');
    echo '</a>&nbsp;<a title="';
    _e('Wikipedia entry describing components', 'amr-ical-events-list');
    echo '"	href="http://en.wikipedia.org/wiki/ICalendar#Events_.28VEVENT.29">?</a></h4>
	<div class="toggle_container">';
    $desc = amr_set_helpful_descriptions();
    if (!isset($listtype['component'])) {
        echo 'No default components set';
    } else {
        foreach ($listtype['component'] as $c => $v) {
            echo '<br /><label for="C' . $i . $c . '" > &nbsp;';
            echo '<input type="checkbox" id="C' . $i . $c . '" name="component[' . $i . '][' . $c . ']"';
            echo $v ? ' checked="checked" />' : '/>';
            echo $c . '</label> <em>' . $desc[$c] . '</em>';
        }
    }
    echo "\n\t" . '</div></fieldset>';
    return;
}