コード例 #1
0
ファイル: amr-ical-config.php プロジェクト: greg3560/plailly
function amr_set_defaults()
{
    global $amr_calprop;
    global $amr_colheading;
    global $amr_compprop;
    global $amr_groupings;
    global $amr_components;
    global $amr_limits, $amr_listtype;
    global $amr_formats;
    global $amr_general;
    global $amr_globaltz;
    global $ical_timezone;
    global $eventtaxonomies;
    global $amr_options, $locale;
    $amr_listtype = '1';
    // global default
    $amr_options = array('ngiyabonga' => false, 'own_css' => false, 'feed_css' => true, 'cssfile' => ICALSTYLEURL, 'date_localise' => 'amr', 'noeventsmessage' => 'No events found within criteria', 'lookmoremessage' => 'Look for more', 'lookprevmessage' => 'Look for previous', 'amr-ical-events-list', 'resetmessage' => 'Reset', 'amr-ical-events-list', 'freebusymessage' => '✖');
    // if they don't have the gettext function the translation scanners will not pick the strings up for inclusion in the .pot/.po file
    $fakeforautolangtranslation = array('noeventsmessage' => __('No events found within criteria', 'amr-ical-events-list'), 'lookmoremessage' => __('Look for more', 'amr-ical-events-list'), 'lookprevmessage' => __('Look for previous', 'amr-ical-events-list'), 'resetmessage' => __('Reset', 'amr-ical-events-list'), 'freebusymessage' => __('Busy', 'amr-ical-events-list'), __("Year", 'amr-ical-events-list'), __("Quarter", 'amr-ical-events-list'), __("Astronomical Season", 'amr-ical-events-list'), __("Traditional Season", 'amr-ical-events-list'), __("Western Zodiac", 'amr-ical-events-list'), __("Month", 'amr-ical-events-list'), __("Week", 'amr-ical-events-list'), __("Day", 'amr-ical-events-list'));
    if (defined('AMR_ICAL_VERSION')) {
        $amr_options['ngiyabonga'] = true;
    }
    //do not show credit link
    $alreadyhave = false;
    //	if ($locale === 'en_US' )  $amr_options['date_localise'] = 'none';   // v4.0.9 commented out - multi lingual situations may have en as base, but will need localisation
    //	else
    $amr_options['date_localise'] = 'wp';
    //
    amr_set_defaults_for_datetime();
    $amr_general = array('name' => __('Default', 'amr-ical-events-list'), 'Description' => __('A default calendar list. This one set to tables with lists in the cells.  Usually needs the css file enabled. If you configure it, I suggest changing this description to aid your memory of how/why it is configured the way that it is. ', 'amr-ical-events-list'), "Default Event URL" => '', 'ListHTMLStyle' => 'table', 'customHTMLstylefile' => '');
    $amr_limits = array("events" => 30, "days" => 90, "cache" => 24, "eventscache" => 0.5);
    // must not set start here
    $amr_components = array("VEVENT" => true, "VTODO" => true, "VJOURNAL" => false, "VFREEBUSY" => true);
    $amr_groupings = amr_define_possible_groupings();
    $amr_colheading = array('1' => __('When', 'amr-ical-events-list'), '2' => __('What', 'amr-ical-events-list'), '3' => __('Where', 'amr-ical-events-list'));
    $dfalse = array('Column' => 0, 'Order' => 999, 'Before' => '', 'After' => '');
    $dtrue = array('Column' => 1, 'Order' => 1, 'Before' => '', 'After' => '');
    $dtrue2 = array('Column' => 2, 'Order' => 1, 'Before' => '', 'After' => '');
    // check if we have any taxonomies that we may wish to assign an event to
    $eventtaxonomies = amr_define_possible_taxonomies();
    foreach ($eventtaxonomies as $i => $tax) {
        $eventtaxonomiesprop[$tax] = array('Column' => 2, 'Order' => 200, 'Before' => '', 'After' => ' ');
    }
    $amr_calprop = array('X-WR-CALNAME' => array('Column' => 1, 'Order' => 1, 'Before' => '', 'After' => ''), 'X-WR-CALDESC' => $dfalse, 'X-WR-TIMEZONE' => array('Column' => 0, 'Order' => 40, 'Before' => '', 'After' => ''), 'icsurl' => array('Column' => 2, 'Order' => 20, 'Before' => '', 'After' => ''), 'addtogoogle' => array('Column' => 2, 'Order' => 10, 'Before' => '', 'After' => ''), 'icalrefresh' => array('Column' => 0, 'Order' => 30, 'Before' => '', 'After' => ''), 'LAST-MODIFIED' => $dtrue);
    /* NB need to switch some field s on for initial plugin view.  This will be common default for all, then some are customised separately */
    $amr_compprop = array('Descriptive' => array_merge(array('SUMMARY' => array('Column' => 2, 'Order' => 10, 'Before' => '<b>', 'After' => '</b>'), 'DESCRIPTION' => array('Column' => 2, 'Order' => 20, 'Before' => '', 'After' => ''), 'excerpt' => array('Column' => 0, 'Order' => 30, 'Before' => '<br />', 'After' => ''), 'postthumbnail' => array('Column' => 0, 'Order' => 35, 'Before' => '<br />', 'After' => ''), 'LOCATION' => array('Column' => 2, 'Order' => 41, 'Before' => '', 'After' => ''), 'map' => array('Column' => 2, 'Order' => 40, 'Before' => '', 'After' => ''), 'addevent' => array('Column' => 2, 'Order' => 1, 'Before' => '', 'After' => ''), 'subscribeevent' => array('Column' => 2, 'Order' => 2, 'Before' => '', 'After' => ''), 'subscribeseries' => array('Column' => 2, 'Order' => 3, 'Before' => '', 'After' => ''), 'GEO' => $dfalse, 'ATTACH' => array('Column' => 2, 'Order' => 150, 'Before' => __('More info: ', 'amr-ical-events-list'), 'After' => '<br />'), 'CATEGORIES' => array('Column' => 2, 'Order' => 200, 'Before' => '', 'After' => ''), 'CLASS' => array('Column' => 0, 'Order' => 210, 'Before' => '', 'After' => ''), 'COMMENT' => $dfalse, 'PERCENT-COMPLETE' => $dfalse, 'PRIORITY' => array('Column' => 0, 'Order' => 220, 'Before' => '', 'After' => ''), 'RESOURCES' => $dfalse, 'STATUS' => array('Column' => 0, 'Order' => 230, 'Before' => '', 'After' => '')), $eventtaxonomiesprop), 'Date and Time' => array('EventDate' => array('Column' => 1, 'Order' => 1, 'Before' => '', 'After' => ''), 'StartTime' => array('Column' => 1, 'Order' => 2, 'Before' => ' ', 'After' => ' '), 'EndDate' => array('Column' => 1, 'Order' => 3, 'Before' => __(' to', 'amr-ical-events-list') . '&nbsp;', 'After' => ''), 'EndTime' => array('Column' => 1, 'Order' => 4, 'Before' => ' ', 'After' => ''), 'DTSTART' => $dfalse, 'DTEND' => $dfalse, 'DUE' => $dfalse, 'DURATION' => array('Column' => 0, 'Order' => 50, 'Before' => '', 'After' => ''), 'allday' => array('Column' => 1, 'Order' => 4, 'Before' => '&nbsp;', 'After' => ''), 'timezone' => $dfalse, 'COMPLETED' => $dfalse, 'FREEBUSY' => $dfalse, 'TRANSP' => $dfalse), 'Relationship' => array('CONTACT' => array('Column' => 0, 'Order' => 350, 'Before' => '', 'After' => ''), 'ORGANIZER' => array('Column' => 0, 'Order' => 360, 'Before' => '', 'After' => ''), 'ATTENDEE' => array('Column' => 0, 'Order' => 370, 'Before' => '', 'After' => ''), 'Attendee-counts' => array('Column' => 0, 'Order' => 380, 'Before' => '', 'After' => ''), 'RECURRENCE-ID' => $dfalse, 'RELATED-TO' => $dfalse, 'URL' => array('Column' => 0, 'Order' => 150, 'Before' => '', 'After' => ''), 'UID' => $dfalse), 'Recurrence' => array('EXDATE' => $dfalse, 'EXRULE' => $dfalse, 'RDATE' => $dfalse, 'RRULE' => $dfalse), 'Alarm' => array('ACTION' => $dfalse, 'REPEAT' => $dfalse, 'TRIGGER' => $dfalse), 'Change Management' => array('CREATED' => $dfalse, 'DTSTAMP' => $dfalse, 'SEQUENCE' => $dfalse, 'LAST-MODIFIED' => $dfalse));
    //		if (function_exists ('amr_indicate_attendance')) {    //pluggable does not exist yet
    //		}
    if (function_exists('amr_rsvp')) {
        $amr_compprop['Relationship']['declined'] = array('Column' => 0, 'Order' => 400, 'Before' => '', 'After' => '');
        $amr_compprop['Relationship']['rsvp'] = array('Column' => 0, 'Order' => 410, 'Before' => '', 'After' => '');
        $amr_compprop['Relationship']['rsvpwithcomment'] = array('Column' => 0, 'Order' => 420, 'Before' => '', 'After' => '');
        $amr_compprop['Relationship']['going_ornot_ormaybe'] = array('Column' => 0, 'Order' => 430, 'Before' => '', 'After' => '');
        $amr_compprop['Relationship']['total_attending'] = array('Column' => 0, 'Order' => 510, 'Before' => '', 'After' => '');
        $amr_compprop['Relationship']['total_maybe'] = array('Column' => 0, 'Order' => 510, 'Before' => '', 'After' => '');
        $amr_compprop['Relationship']['total_declined'] = array('Column' => 0, 'Order' => 510, 'Before' => '', 'After' => '');
    }
    //
    for ($i = 1; $i <= 13; $i++) {
        /* setup some list type defaults if we have empty list type arrays */
        $amr_options['listtypes'][$i] = new_listtype();
        // set up basic
        $amr_options['listtypes'][$i] = customise_listtype($i);
        /* then tweak */
    }
    //		add_option('amr-ical-events-list', $amr_options);  // hmm what to do - if we autosave, then they do not pickup new defaults automatically
}
コード例 #2
0
function amrical_groupingsoption($i)
{
    global $amr_options;
    $listtype = $amr_options['listtypes'][$i];
    $groupings = amr_define_possible_groupings();
    $taxonomies = amr_define_possible_taxonomies();
    echo '<fieldset class="icalgroupings">
		<h4 class="trigger"><a href="#" >';
    _e('Define grouping:', 'amr-ical-events-list');
    echo '</a></h4><div class="toggle_container">';
    echo '<table><tr><th>' . __('Possible Groupings', 'amr-ical-events-list') . '</th><th align=center>' . __('Level', 'amr-ical-events-list') . ' 1</th><th align=center> ' . __('Level', 'amr-ical-events-list') . ' 2</th></tr>';
    $nolevel1 = false;
    $nolevel2 = false;
    if (empty($listtype['grouping'])) {
        echo 'No groupings ?';
        $nolevel1 = true;
        $nolevel2 = true;
    } else {
        if (count($listtype['grouping']) < 2) {
            $nolevel2 = true;
        }
    }
    echo '<tr><td>' . __('No grouping', 'amr-ical-events-list') . '</td>';
    $sel = checked($nolevel1, true, false);
    echo "<td align=center><input type='radio' name='level[1]' value='none' " . $sel . "/></td>";
    $sel = checked($nolevel2, true, false);
    echo "<td align=center><input type='radio' name='level[2]' value='none' " . $sel . "/></td>";
    echo '</tr>';
    echo '<tr><th>' . __('Taxonomies', 'amr-ical-events-list') . '</th><td colspan="2"><em>' . __('(Requires amr-events)', 'amr-ical-events-list') . '</em></td></tr>';
    foreach ($taxonomies as $i => $taxonomy) {
        $taxo = get_taxonomy($taxonomy);
        $c = $taxo->label;
        if (!empty($listtype['grouping'][$taxonomy])) {
            $v = $listtype['grouping'][$taxonomy];
        } else {
            $v = false;
        }
        echo '<tr><td>' . $c . '</td>';
        $sel = checked($v, 1, false);
        echo "<td align=center><input type='radio' name='level[1]' value='" . $taxonomy . "' " . $sel . "/></td>";
        $sel = checked($v, 2, false);
        echo "<td align=center><input type='radio' name='level[2]' value='" . $taxonomy . "' " . $sel . "/></td>";
        echo '</tr>';
    }
    echo '<tr><th>' . __('Date based', 'amr-ical-events-list') . '</th><td colspan="2"><em>' . __('(See also date and time formats)', 'amr-ical-events-list') . '</em></td></tr>';
    foreach ($groupings as $c => $tmp) {
        if (in_array($c, $taxonomies)) {
            continue;
        }
        // don't repeat
        if (!empty($listtype['grouping'][$c])) {
            $v = $listtype['grouping'][$c];
        } else {
            $v = false;
        }
        echo '<tr><td>' . $c . '</td>';
        $sel = checked($v, 1, false);
        echo "<td align=center><input type='radio' name='level[1]' value='" . $c . "' " . $sel . "/></td>";
        $sel = checked($v, 2, false);
        echo "<td align=center><input type='radio' name='level[2]' value='" . $c . "' " . $sel . "/></td>";
        echo '</tr>';
    }
    echo "\n\t" . '</table></div></fieldset> <!-- end of grouping -->';
    return;
}