public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); $events = \Club\Admin\Calendar\Event::getAll(new \DateTime(), $instance["num_events"]); // before and after widget arguments are defined by themes echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } // This is where you run the code and display the output ?> <table> <thead> <tr> <th>Datum</th> <th>Titel</th> </tr> </thead> <tbody> <?php foreach ($events as $event) { ?> <tr> <td><a href="<?php echo get_permalink($event->getPostId()); ?> "><?php echo $event->getFromFormated(false); ?> </a></td> <td><a href="<?php echo get_permalink($event->getPostId()); ?> "><?php echo $event->getTitle(); ?> </a></td> </tr> <?php } ?> </tbody> </table> <?php echo $args['after_widget']; }
public function saveEvent() { if (array_key_exists("action", $_POST) && $_POST['action'] == 'club_calendar_save_event') { $id = null; $event = null; if (array_key_exists("uuid", $_POST)) { $id = $_POST["uuid"]; $event = \Club\Admin\Calendar\Event::findById($id); } else { $event = new \Club\Admin\Calendar\Event($id); } $event->fromPost($_POST, $this->getDateFormat()); $place = null; $newPlace = array_key_exists("newPlace", $_POST) ? filter_var(strtolower($_POST["newPlace"]), FILTER_VALIDATE_BOOLEAN) : false; if (!$newPlace) { $id = $_POST["place"]; $place = \Club\Admin\Calendar\Place::findById($id); } else { $place = new \Club\Admin\Calendar\Place(); $place->setName($_POST["place"]); $place->setLat($_POST["lat"]); $place->setLng($_POST["lng"]); $place->save(false); } $event->setPlace($place); $shortCode = "[club_event event_id=" . $event->getUuid() . " type=event]"; $postId = wp_insert_post(array("ID" => $event->getPostId(), "post_title" => $event->getTitle(), "post_content" => $shortCode, "post_type" => "club_event", "post_status" => "publish", "guid" => $event->getUuid())); $event->setPostId($postId); $event->save($id == null ? false : true); echo json_encode($event); } wp_die(); }
public function deleteEvent() { if (array_key_exists("action", $_POST) && $_POST['action'] == 'club_calendar_delete_evnet') { $nonce = array_key_exists("nonce", $_POST) ? $_POST["nonce"] : null; $uuid = array_key_exists("uuid", $_POST) ? $_POST["uuid"] : null; if (wp_verify_nonce($nonce, "club-delete-event-" . $uuid)) { echo Calendar\Event::findById($uuid)->delete(); } } wp_die(); }
<?php $event = \Club\Admin\Calendar\Event::findById($atts['event_id']); ?> <div class="bootstrap-wrapper"> <div class="container-no-padding container"> <div class="row"> <div class="col-xs-2"> <strong>Wann:</strong> </div> <div class="col-xs-10"> <?php echo $event->getFromFormated(); ?> bis <?php echo $event->getToFormated(); ?> </div> </div> <div class="row"> <div class="col-xs-2"> <strong>Ort:</strong> </div> <div class="col-xs-10"> <?php echo $event->getPlace()->getName(); ?> </div> </div> <?php
<div class="bootstrap-wrapper"> <div class="container-no-padding container"> <table class="table table-hover table-striped"> <thead> <tr> <th>Datum</th> <th>Titel</th> <th>Ort</th> <th> </th> </tr> </thead> <tbody> <?php foreach (\Club\Admin\Calendar\Event::getAll(new \DateTime()) as $event) { ?> <tr> <td><?php echo $event->getFromFormated() . " - " . $event->getToFormated(); ?> </td> <td><?php echo $event->getTitle(); ?> </td> <td><?php echo $event->getPlace()->getName(); ?> </td> <td><a href="<?php echo get_permalink($event->getPostId()); ?>
<?php use Ramsey\Uuid\Uuid; use Club\Admin\Calendar\Event; $uuid = filter_input(INPUT_GET, "uuid"); $edit = false; $event = null; if (!Uuid::isValid($uuid)) { $uuid = null; $event = new Event(); } else { $event = Event::findById($uuid); $edit = true; } $defaultFormat = ""; $momentFormat = ""; $module = \Club\Club::getInstance()->getModules()->getModuleInstance("calendar"); if ($module != NULL) { $defaultFormat = $module->getDateFormat(); $momentFormat = $module->getDateFormat("moment"); } ?> <div class="bootstrap-wrapper"> <div class="container"> <h1>Club Termine</h1> <form class="form-horizontal"> <div class="form-group" id="divTitle" class="can-have-error"> <label for="txtTitle" class="col-sm-2 control-label">Title</label> <div class="col-sm-10"> <input type="text" class="form-control can-have-error" value="<?php
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ use Club\Admin\Calendar\Event; global $wpdb; //var_dump(get_categories()); $events = Event::getAll(); ?> <div class="bootstrap-wrapper"> <div class="container"> <h1>Club Termine</h1> <table class="table table-hover table-striped"> <thead> <tr> <th>Name</th> <th>Von</th> <th>Bis</th> <th>Artikel</th> <th> </th> </tr> </thead> <tbody> <?php foreach ($events as $event) { ?> <tr>