Example #1
0
function get_event_row_html($row)
{
    if ($row) {
        $start_date = $row["event_start_date"];
        //get_event_date_string($row["event_start_date"],$row["event_start_time"],$row["event_end_date"],$row["event_end_time"]);
        if (!empty($row["event_start_time"])) {
            $start_date .= "@{$row['event_start_time']}";
        }
        $end_date = $row["event_end_date"];
        if ($row["event_start_date"] == $row["event_end_date"] && empty($row["event_end_time"])) {
            $end_date = "";
        }
        if (!empty($row["event_end_time"])) {
            $end_date .= "@{$row['event_end_time']}";
        }
        //$end_date =
        $event_published = $row["event_published"] == "0" ? false : true;
        $event_id = $row["event_id"];
        $tr_class = !$event_published ? "style='background-color:#ffd37d;'" : "";
        $status = $event_published ? ucwords($row["event_status"]) : ucwords("not published");
        $facebook_class = "page-facebook:event_id-{$event_id}";
        $twitter_class = "page-twitter:event_id-{$event_id}";
        $unpublish_class = "action-unpublish_event:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Event::NONCE_UNPUBLISH);
        $publish_class = "action-publish_event:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Event::NONCE_PUBLISH);
        $delete_class = "action-delete_event:event_id-{$event_id}:_nonce-" . wp_create_nonce(WT_Event::NONCE_DELETE);
        $edit_class = "event_id-{$event_id}";
        $edit_link = admin_url("admin.php?page=wordtour/navigation.php&action=edit&event_id=" . $row["event_id"]);
        $artists = array();
        if (is_array($row["event_more_artists"])) {
            foreach ($row["event_more_artists"] as $a) {
                $artists[] = $a["name"];
            }
        }
        $artists = implode(", ", $artists);
        $html = "<tr {$tr_class}>\n\t\t\t\t<th class='check-column'>\n\t\t\t\t\t<input type='checkbox' value='{$row['event_id']}'/>\n\t\t\t\t</th>\n\t\t\t\t<td>{$event_id}</td>\n\t\t\t\t<td>\t\t\n\t\t\t\t\t<div style='width:400px;'>\n\t\t\t\t\t<a href='{$edit_link}' style='font-weight:bold;'>";
        if (!empty($row["event_title"])) {
            $html .= "<span style='font-size:12px;'>{$row['event_title']}</span><br/>";
        }
        $html .= "{$start_date}";
        if (!empty($end_date)) {
            $html .= "<b> - {$end_date}</b>";
        }
        $html .= "</a></div>\n\t\t\t\t\t\t<div class='row-actions'>\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<a title='View Event' href='" . wt_get_permalink("event", $event_id, array("%date%" => $row["event_start_sql"], "%name%" => $row["venue_name"])) . "'>View</a> |\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span class='quickedit'>\n\t\t\t\t\t\t\t\t<a title='Quick Edit this event' class='{$edit_class}' href='#'>Quick Edit</a> |\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<a title='Edit this event' href='{$edit_link}'>Edit</a> |\n\t\t\t\t\t\t\t</span>";
        if (!$event_published) {
            $html .= "<span class='publish'>\n\t\t\t\t\t\t\t\t\t<a title='Publish Event' class='{$publish_class}' href='{$publish_class}'>Publish</a> |\n\t\t\t\t\t\t\t\t </span>";
        } else {
            $html .= "<span class='unpublish'>\n\t\t\t\t\t\t\t\t\t<a title='Unpublish Event' class='{$unpublish_class}' href='#'>Unpublish</a> | \n\t\t\t\t\t\t\t\t</span>";
        }
        $html .= "<span class='delete'>\n\t\t\t\t\t\t\t\t<a title='Delete this event permanently' class='{$delete_class}' href='#'>Delete</a>\n\t\t\t\t\t\t\t</span>";
        $html .= "</div>\n\t\t\t</td>\n\t\t\t<td>";
        $venue_display = array();
        if (!empty($row["venue_city"])) {
            array_push($venue_display, $row["venue_city"]);
        }
        if (!empty($row["venue_state"])) {
            array_push($venue_display, get_state_by_code($row["venue_state"]));
        }
        if (!empty($row["venue_country"])) {
            array_push($venue_display, get_country_by_code($row["venue_country"]));
        }
        $html .= $row["venue_name"] . "<br><span style='color:#999999' title='" . implode(", ", $venue_display) . "'>" . get_country_by_code($row["venue_country"]) . "</span>";
        $html .= "</td>\n\t\t\t\t<td>{$status}</td>\n\t\t\t\t<td>{$row['artist_name']}</td>\n\t\t\t\t<td>{$artists}</td>\n\t\t\t\t<td>{$row['tour_name']}</td>\n\t\t\t\t<td>\n\t\t\t\t\t<a href='" . admin_url("admin.php?page=wt_comments&e=" . $row["event_id"]) . "'>";
        $comment_total = get_comment_total_by_event($row["event_id"]);
        $html .= "{$comment_total['total']} Comments\n\t\t\t\t\t</a>\n\t\t\t\t\t| {$row['rsvp_count']} Attending</td>\n\t\t\t</tr>";
        return $html;
    }
}
Example #2
0
<?php 
}
?>

<?php 
if ($_GET["page"] == "facebook") {
    $nonce = wp_create_nonce(WT_SOCIAL::NONCE_INSERT);
    $event_id = $_GET["event_id"];
    $event = new WT_Event($event_id);
    $data = $event->retrieve();
    $start_time = prepare_facbook_time(strtotime($data["event_start_date"] . ' ' . ($data["event_start_time"] == "00:00:01" ? "" : $data["event_start_time"])));
    $end_time = prepare_facbook_time(strtotime($data["event_end_date"] . ' ' . ($data["event_end_time"] == "00:00:01" ? "" : $data["event_end_time"])));
    $location = $data["venue_name"];
    $address = $data["venue_address"];
    $city = $data["venue_city"];
    $state = get_state_by_code($data["venue_state"]);
    $country = get_country_by_code($data["venue_country"]);
    if ($options["facebook_status_template"]) {
        $tpl = array();
        foreach ($event->template($data) as $key => $value) {
            $tpl["%" . $key . "%"] = $value;
        }
        $status = strtr($options["facebook_status_template"], $tpl);
    }
    ?>
	<div id="dialog-alert" class='wordtour-alert'></div>
	<form>
		<input type="hidden" name ="_nonce" value="<?php 
    echo $nonce;
    ?>
"></input>
Example #3
0
 public function template($data = null)
 {
     global $wpdb;
     if (!$data) {
         $data = $this->data;
     }
     $db = $this->dbprepere;
     $venue_poster_id = $data["venue_thumbnail"] ? $data["venue_thumbnail"]["id"] : $this->get_thumbnail("venue");
     $venue_poster = $db->media_out($venue_poster_id);
     $map = wt_get_map_str($data);
     return array("id" => $db->int_out($data["venue_id"]), "name" => $db->str_out($data["venue_name"]), "description" => $db->html_out($data["venue_info"]), "short_description" => $db->html_teaser_out($data["venue_info"]), "address" => $db->str_out($data["venue_address"]), "city" => $db->str_out($data["venue_city"]), "zip" => $db->str_out($data["venue_zip"]), "state" => get_state_by_code($data["venue_state"]), "country" => get_country_by_code($data["venue_country"]), "country_code" => $data["venue_country"], "state_code" => $data["venue_state"], "url" => $db->link_out(wt_get_permalink("venue", $data["venue_id"], array("%name%" => $data["venue_name"]))), "website" => $db->link_out($data["venue_url"]), "phone" => $db->str_out($data["venue_phone"]), "google_map" => $map["address"], "poster" => $venue_poster);
 }
 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);
 }