예제 #1
0
    /**
     * Creates the filter and pagination bar in the overview
     * @param $filter
     * @param $part
     * @param $page
     * @param $epp
     * @param $count
     * @param $bl
     * @return unknown_type
     */
    function printNavigationBar($filter = array(), $part = 1, $page = 1, $epp = 20, $count = 0, $bl = '')
    {
        global $wpdb;
        global $fsCalendar;
        ?>
		<div class="tablenav">
			<div class="alignleft actions">
				<select name="action<?php 
        echo $part == 2 ? '2' : '';
        ?>
">
					<option selected="selected" value=""><?php 
        _e('Choose action', fsCalendar::$plugin_textdom);
        ?>
</option>
					<option value="delete"><?php 
        _e('Delete', fsCalendar::$plugin_textdom);
        ?>
</option>
					<?php 
        if ($fsCalendar->userCanPublishEvents()) {
            echo '<option value="publish">' . __('Publish', fsCalendar::$plugin_textdom) . '</option>';
        }
        ?>
					<?php 
        if ($fsCalendar->userCanEditEvents()) {
            echo '<option value="draft">' . __('Set to Draft', fsCalendar::$plugin_textdom) . '</option>';
        }
        ?>
				</select>
				<input id="doaction<?php 
        echo $part;
        ?>
" class="button-secondary action" type="submit" name="doaction" value="<?php 
        _e('Apply', fsCalendar::$plugin_textdom);
        ?>
" />
				<?php 
        if ($part == 1) {
            ?>
					<select name="event_start">
					<option value="-1"<?php 
            echo !isset($filter['datefrom']) ? ' selected="selected"' : '';
            ?>
><?php 
            _e('Show all dates', fsCalendar::$plugin_textdom);
            ?>
</option>
					<option value="0"<?php 
            echo isset($filter['datefrom']) && !isset($filter['dateto']) ? ' selected="selected"' : '';
            ?>
><?php 
            _e('Show future dates only', fsCalendar::$plugin_textdom);
            ?>
</option>
					<?php 
            $min = $wpdb->get_var('SELECT MIN(tsfrom) AS min FROM ' . $wpdb->prefix . 'fsevents');
            $max = $wpdb->get_var('SELECT MAX(tsto)   AS max FROM ' . $wpdb->prefix . 'fsevents');
            if ($min != NULL && $max != NULL) {
                $ms = fsCalendar::date('m', $min);
                $ys = fsCalendar::date('Y', $min);
                $me = fsCalendar::date('m', $max);
                $ye = fsCalendar::date('Y', $max);
                while ($ys <= $ye) {
                    while ($ms <= 12 && ($ys < $ye || $ms <= $me)) {
                        $time = mktime(0, 0, 0, $ms, 1, $ys);
                        echo '<option value="' . $time . '"' . ($time == $filter['datefrom'] ? ' selected="selected"' : '') . '>' . fsCalendar::date_i18n('F Y', $time) . '</option>';
                        $ms++;
                    }
                    $ms = 1;
                    $ys++;
                }
            }
            ?>
					</select>
					
					<?php 
            $dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'name' => 'event_category', 'orderby' => 'name');
            if (isset($filter['categories'][0])) {
                $dropdown_options['selected'] = $filter['categories'][0];
            }
            wp_dropdown_categories($dropdown_options);
            ?>
					<input id="event-query-submit" class="button-secondary" type="submit" value="<?php 
            _e('Filter', fsCalendar::$plugin_textdom);
            ?>
" />
				<?php 
        }
        ?>
			</div>
		<?php 
        if ($count > $epp) {
            $evon = ($page - 1) * $epp + 1;
            $ebis = $page * $epp;
            $pages = ceil($count / $epp);
            ?>
			<div class="tablenav-pages">		
			<span class="displaying-num"><?php 
            printf('Showing %d-%d of %d', $evon, $ebis, $count);
            ?>
</span>
				<?php 
            if ($page > 1) {
                echo '<a class="prev page-numbers" href="' . $bl . 'paged=1">&laquo;</a>';
            }
            for ($i = 1; $i <= $pages; $i++) {
                if ($i == $page) {
                    echo '<span class="page-numbers current">' . $i . '</span>';
                } else {
                    echo '<a class="page-numbers" href="' . $bl . 'paged=' . $i . '">' . $i . '</a>';
                }
            }
            if ($page < $pages) {
                echo '<a class="next page-numbers" href="' . $bl . 'paged=' . $pages . '">&raquo;</a>';
            }
            ?>
			</div>
		<?php 
        }
        ?>
		</div>
		<?php 
    }
예제 #2
0
 static function date_i18n($fmt, $ts)
 {
     // First check, if hack is on and get offset
     if (fsCalendar::$gmt_offset == -1) {
         if (get_option('fse_gmt_hack') == true) {
             fsCalendar::$gmt_offset = intval(get_option('gmt_offset')) * 3600;
         } else {
             fsCalendar::$gmt_offset = 0;
         }
     }
     return date_i18n($fmt, $ts + fsCalendar::$gmt_offset);
 }
예제 #3
0
 /**
  * Returns the formatted end date/time string
  * @param $fmt Format (See PHP function date())
  * @param $mode Mode (1=Date+Time, 2=Date only, 3=Time only)
  * @return String Formatted date string
  */
 function getEnd($fmt = '', $mode = 1)
 {
     if (empty($this->tsto)) {
         return '';
     }
     if (empty($fmt)) {
         switch ($mode) {
             case 1:
                 $fmt = $this->date_format . ' ' . $this->time_format;
                 break;
             case 2:
                 $fmt = $this->date_format;
                 break;
             case 3:
                 $fmt = $this->time_format;
                 break;
         }
     }
     return fsCalendar::date_i18n($fmt, $this->tsto);
 }
예제 #4
0
						</div>
						<div class="misc-pub-section">
							<?php 
    _e('Published by', fsCalendar::$plugin_textdom);
    ?>
: <span id="post-status-display"> <?php 
    echo empty($evt->publishauthor_t) ? '-' : esc_attr($evt->publishauthor_t);
    ?>
</span>
						</div>
						<div class="misc-pub-section">
							<?php 
    _e('Published', fsCalendar::$plugin_textdom);
    ?>
: <span id="post-status-display"> <?php 
    echo !empty($evt->publishdate) ? fsCalendar::date_i18n($evt->date_time_format, $evt->publishdate) : '-';
    ?>
</span>
						</div>
						<?php 
    if ($action != 'view' && $evt->updatedbypost == true) {
        echo '<div class="misc-pub-section">';
        echo sprintf(__('This event is synchronized with <a href="post.php?post=%d&action=edit">this post</a>. Click ' . "<a class=\"hide-if-no-js\" href=\"\" onClick=\"document.forms['event'].jsaction.value='nosync'; document.forms['event'].submit(); return false;\"'>" . 'here</a> to disable the synchronization.', fsCalendar::$plugin_textdom), $evt->postid);
        echo '</div>';
    }
    ?>
					</div>
					<div class="clear"/></div>
				</div>
			
				<?php 
예제 #5
0
</td>
					<td class="num">
					<?php 
            $count = $wpdb->get_var('SELECT COUNT(*) FROM ' . $wpdb->commentmeta . ' WHERE meta_key="event_id" AND meta_value="' . $e->eventid . '"');
            echo '<span class="post-com-count" style="cursor: default"><span class="comment-count" style="cursor: default">' . $count . '</span></span>';
            ?>
					</td>
					<td><?php 
            echo esc_attr(fsCalendar::$valid_states[$e->state]);
            ?>
 <?php 
            _e('on', fsCalendar::$plugin_textdom);
            ?>
<br />
					<?php 
            echo fsCalendar::date('d.m.Y H:i:s', $e->state == 'publish' ? $e->publishdate : $e->createdate);
            ?>
<br /></td>
				</tr>
				<?php 
        }
    }
    ?>
		</tbody>
	</table>
	<?php 
    $this->printNavigationBar($filter, 2, $page, $epp, $event_count, $bl_filter);
    ?>
	<?php 
    if ($fsCalendar->userCanAddEvents()) {
        ?>