Exemplo n.º 1
0
function get_comment_row_html($row)
{
    global $wpdb, $_wt_options;
    $row = (array) $row;
    $comment_id = $row["comment_id"];
    $author = $row["comment_author"];
    $email = $row["comment_author_email"];
    $content = $row["comment_content"];
    $date = $row["comment_date"];
    $event_id = $row["comment_event_id"];
    $comment_total = get_comment_total_by_event($event_id);
    $total = $comment_total["total"];
    $pending = $comment_total["total_pending"];
    $status = $row["comment_approved"] ? "approved" : "unapproved";
    $user_id = $row["comment_user_id"];
    $avatar = get_avatar($user_id, 32);
    ///$event_title = get_event_title($event_id);
    $event = new WT_Event($event_id);
    $event->retrieve();
    $event_data = $event->db_out();
    $response_to = "{$event_data['event_start_date']} at the {$event_data['venue_name']}";
    $unapprove_class = "action-unapprove_comment:comment_id-{$comment_id}:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Comment::NONCE_UNAPPROVE);
    $edit_class = "comment_id-{$comment_id}";
    $approve_class = "action-approve_comment:comment_id-{$comment_id}:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Comment::NONCE_APPROVE);
    $delete_class = "action-delete_comment:comment_id-{$comment_id}:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Comment::NONCE_DELETE);
    $html = "<tr class='{$status}'>\n\t\t\t\t<th class='check-column' scope='row'>\n\t\t\t\t\t<input type='checkbox' value='{$comment_id}'/>\n\t\t\t\t</th>\n\t\t\t\t<td class='author column-author'>\n\t\t\t\t\t<strong>{$avatar} {$author}</strong>\n\t\t\t\t</td>\n\t\t\t\t<td class='comment column-comment'>\n\t\t\t\t\t<div id='submitted-on'>Submitted on <a href='#'>{$date}</a></div>\n\t\t\t\t\t<p><b>{$title}</b><br/>{$content}</p>\n\t\t\t\t\t<div class='row-actions' id='comment-row-actions'>\n\t\t\t\t\t\t<span class='approve'>\n\t\t\t\t\t\t\t<a title='Approve this comment' href='#' class='{$approve_class}'>Approve</a> | \n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span class='unapprove'>\n\t\t\t\t\t\t\t<a title='Unapprove this comment' class='{$unapprove_class}' href='#'>Unapprove</a> | \n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<span class='quickedit'> \n\t\t\t\t\t\t\t<a class='{$edit_class}' title='Edit comment' href='#'>Edit</a>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span class='delete'> | \n\t\t\t\t\t\t<a class='{$delete_class}' href='#'>Delete Permanently</a>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t\t<td class='response column-response'>\n\t\t\t\t\t<div class='response-links'>\n\t\t\t\t\t\t<span class='post-com-count-wrapper'>\n\t\t\t\t\t\t\t<a href='" . admin_url("admin.php?page=wordtour/navigation.php&action=edit&event_id=") . "{$event_id}'>{$response_to}<a/><br/>\n\t\t\t\t\t\t\t<a href='" . admin_url("admin.php?page=wt_comments") . "&e={$event_id}' class='post-com-count'>\n\t\t\t\t\t\t\t\t<span class='comment-count'>{$total}</span>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t</td>\n\t\t\t</tr>";
    return $html;
}
Exemplo n.º 2
0
 public function videos($atts = null, $content = null, $code = "")
 {
     require_once WT_PLUGIN_PATH . 'admin/template.php';
     require_once WT_PLUGIN_PATH . 'admin/handlers.php';
     require_once WT_PLUGIN_PATH . 'dwoo/dwooAutoload.php';
     $dwoo = new Dwoo();
     if (isset($atts["artist"])) {
         $object = new WT_Artist($atts["artist"]);
         $object_type = "artist";
     } else {
         if (isset($atts["tour"])) {
             $object = new WT_Tour($atts["tour"]);
             $object_type = "tour";
         } else {
             if (isset($atts["venue"])) {
                 $object = new WT_Venue($atts["venue"]);
                 $object_type = "venue";
             } else {
                 if (isset($atts["event"])) {
                     $object = new WT_Event($atts["event"]);
                     $object_type = "event";
                 }
             }
         }
     }
     if ($object && $object_type) {
         $videos = $object->video($object->get_videos($object_type));
         $tpl = array("videos" => $videos, "total" => count($videos));
         include WT_PLUGIN_PATH . 'theme/layout.renderer.php';
     }
     return $html;
 }
Exemplo n.º 3
0
    $genres = wordtour_get_all_genre();
    ?>
	<div class="wordtour-selectable">
		
		<?php 
    foreach ($genres as $genre) {
        $genre = ucwords($genre);
        echo "<a class='ui-selectee' href='#'><strong>{$genre}</strong></a>";
    }
    ?>
	</div>	
	
<?php 
}
if ($_GET["page"] == "twitter") {
    $event = new WT_Event($_GET["event_id"]);
    $data = $event->retrieve();
    $event_id = $_GET["event_id"];
    $nonce = wp_create_nonce(WT_SOCIAL::NONCE_INSERT);
    if ($options["twitter_template"]) {
        $tpl = array();
        foreach ($event->template($data) as $key => $value) {
            $tpl["%" . $key . "%"] = $value;
        }
        $status = strtr($options["twitter_template"], $tpl);
    }
    ?>
<form>
	<div id="dialog-alert" class='wordtour-alert'></div>
	<input type="hidden" name="_twitter_nonce" value="<?php 
    echo $nonce;
Exemplo n.º 4
0
 public static function all_by_artist($artist_id = array(), $order = "tour_name")
 {
     global $wpdb;
     $artist_sql = $artist_id ? " AND e.event_artist_id={$artist_id}" : "";
     $tour = $wpdb->get_results($wpdb->prepare(WT_Event::sql_all_tables("tour_id,tour_name,tour_order,tour_thumbnail_id", array("meta" => 0, "venue" => 0, "artists" => 0, "tour" => 1)) . " \n\t\t\t\t\t{$artist_sql} GROUP BY e.event_tour_id ORDER BY {$order} ASC"), "ARRAY_A");
     return $tour;
 }
Exemplo n.º 5
0
function wt_group_by_month($start_date = "")
{
    global $wpdb;
    $date_sql = "";
    if ($start_date) {
        $date_sql = "AND e.event_start_date >= '{$start_date}'";
    }
    $sql = WT_Event::sql("COUNT(*) as total,MONTH(e.event_start_date) as month,YEAR(e.event_start_date) as year") . " {$date_sql} GROUP BY year,month";
    $dates = $wpdb->get_results($wpdb->prepare($sql), "ARRAY_A");
    return $dates;
}
Exemplo n.º 6
0
 public function import($artist_id = 0)
 {
     $results = array();
     if (!$artist_id || empty($artist_id)) {
         $this->is_valid_response('{"error": {"error_type": "Artist Missing", "error_message": "Can\\"t import events without an artist"}}');
     } else {
         // get list of all venues
         $venues = wt_file_get_contents("http://www.eventbrite.com/json/user_list_venues?app_key={$this->app_key}&user_key={$this->user_key}");
         $venues_parents = array();
         if ($this->is_valid_response($venues)) {
             $social = new WT_Social();
             try {
                 if (!$this->response["venues"]) {
                     throw new Exception("Connection Error");
                 }
                 foreach ($this->response["venues"] as $v) {
                     $venue_id = 0;
                     $social_regist = $social->get_by_ref_id($v["venue"]["id"], "venue", "ebvenue");
                     if (!$social_regist) {
                         $venue_params = array("_nonce" => wp_create_nonce(WT_Venue::NONCE_INSERT), "venue_name" => $v["venue"]["name"], "venue_city" => $v["venue"]["city"], "venue_country" => get_country_by_code($v["venue"]["country_code"]), "venue_state" => get_state_by_code($v["venue"]["region"]), "venue_zip" => $v["venue"]["postal_code"], "venue_address" => $v["venue"]["address"], "venue_tour_status" => 1, "venue_gallery_status" => 1, "venue_video_status" => 1, "venue_flickr_status" => 1, "venue_post_status" => 1);
                         $venue = new WT_Venue();
                         $venue->insert($venue_params, 0);
                         if ($venue->data) {
                             $venue_id = $venue->data["venue_id"];
                             $social->insert(wp_create_nonce(WT_SOCIAL::NONCE_INSERT), "ebvenue", $venue->data["venue_id"], $v["venue"]["id"], "venue");
                         } else {
                             $results["venues"][] = array("venue" => $v["venue"], "msg" => $venue->db_response());
                         }
                     } else {
                         $venue_id = $social_regist["social_parent_id"];
                     }
                     if ($venue_id) {
                         $venues_parents[$v["venue"]["id"]] = $venue_id;
                     }
                 }
                 $events = wt_file_get_contents("http://www.eventbrite.com/json/user_list_events?app_key={$this->app_key}&user_key={$this->user_key}");
                 if ($this->is_valid_response($events)) {
                     if (!$this->response["events"]) {
                         throw new Exception("Connection Error");
                     }
                     foreach ($this->response["events"] as $e) {
                         if ($e["event"]["status"] != "Canceled") {
                             $social_regist = $social->get_by_ref_id($e["event"]["id"], "event", "ebevent");
                             if (!$social_regist) {
                                 $event_params = array("_nonce" => wp_create_nonce(WT_Event::NONCE_INSERT), "event_title" => $e["event"]["title"], "event_notes" => $e["event"]["description"], "event_start_date" => mysql2date("Y-m-d", $e["event"]["start_date"]), "event_start_time" => mysql2date("H:i:s", $e["event"]["start_date"]), "event_end_date" => mysql2date("Y-m-d", $e["event"]["end_date"]), "event_end_time" => mysql2date("H:i:s", $e["event"]["end_date"]), "event_venue_id" => $venues_parents[$e["event"]["venue"]["id"]], "event_artist_id" => $artist_id, "event_published" => 1, 'event_status' => $e["event"]["status"] == "Canceled" ? "cancelled" : "active", "tkts_url" => $e["event"]["url"], "tkts_price" => $e["ticket"]["price"] . $e["ticket"]["currency"], 'comment_status' => 1, 'rsvp_status' => 1, 'gallery_status' => 1, 'flickr_status' => 1, 'post_status' => 1, 'video_status' => 1);
                                 $event = new WT_Event();
                                 $event->insert($event_params, 0);
                                 if ($event->data) {
                                     $event_id = $event->data["event_id"];
                                     $social->insert(wp_create_nonce(WT_SOCIAL::NONCE_INSERT), "ebevent", $event->data["event_id"], $e["event"]["id"], "event");
                                 } else {
                                     $results["events"][] = array("event" => $e["event"], "msg" => $event->db_response());
                                 }
                             }
                         }
                     }
                     $this->response = array("type" => "success", "log" => $results);
                     return 1;
                 }
             } catch (Exception $e) {
                 $this->is_valid_response(0);
             }
         }
     }
     $this->response = array("type" => "error", "log" => $this->response);
 }
Exemplo n.º 7
0
         $event->db_response("json");
     }
     break;
 case "unpublish_event":
     $event = new WT_Event($_POST["event_id"]);
     $event->unpublish($_POST);
     $event->db_response("json");
     break;
 case "publish_event":
     $event = new WT_Event($_POST["event_id"]);
     $event->publish($_POST);
     $event->db_response("json");
     break;
 case "get_event_rsvp":
     if (!empty($_POST["event_id"])) {
         $event = new WT_Event($_POST["event_id"]);
         echo json_encode($event->get_rsvp_users());
     }
     break;
     // VENUE
 // VENUE
 case "get_venue":
     $venue = new WT_Venue($_POST["venue_id"]);
     if (!empty($_POST["venue_id"])) {
         $venue->retrieve();
     } else {
         $venue->defaults();
     }
     echo json_encode($venue->db_out(null, 0));
     break;
 case "update_venue":