function wordtour_settings_eventbrite_panel($collapsed = 0) { wt_dynamic_panel_start(array("title" => "Eventbrite - <a style=\"font-size:12px;font-weight:normal;color:#21759B;text-decoration:none;\" href=\"http://www.eventbrite.com/r/wt/\" target=\"_blank\">Register</a>", "id" => "wordtour-panel-eventbrite"), "eventbrite", $collapsed); global $_wt_options; $options = $_wt_options->options(); $eventbrite = new WT_Eventbrite(); $auto_eventbrite_checked = $eventbrite->is_update() == 1 ? "checked=1" : ""; $import_button_state = $eventbrite->is_init() == 1 ? "" : "disabled='true'"; $organizer_id = $eventbrite->get_organizer_id(); ?> <div class="wordtour-field wordtour-field-block"> <div class="label">User Key *</div> <div> <input type="text" size="80" name="wordtour_settings[eventbrite_user_key]" value="<?php echo $options["eventbrite_user_key"]; ?> "></input> </div> </div> <div class="wordtour-field wordtour-field-block"> <div class="label">Application Key *</div> <div> <input type="text" size="80" name="wordtour_settings[eventbrite_app_key]" value="<?php echo $options["eventbrite_app_key"]; ?> "></input> </div> </div> <?php if ($organizer_id) { ?> <div class="wordtour-field wordtour-field-block"> <div class="label">Organizer ID</div> <div> <input type="text" size="80" name="wordtour_settings[eventbrite_organizer_id]" value="<?php echo $organizer_id; ?> "></input> </div> </div> <?php } ?> <div class="wordtour-field wordtour-field-block"> <input style="width:inherit;" type="checkbox" <?php echo $auto_eventbrite_checked; ?> name="wordtour_settings[eventbrite_auto_update]" value="1"/> Auto Update Event and Venue Info </div> <div class="wordtour-field wordtour-field-block"> <button id="eventbrite-import-button" style='width:100%' <?php echo $import_button_state; ?> >Import Event and Venues</button> </div> <?php wt_dynamic_panel_end(); }
public function update($values) { global $wpdb; $venue_id = $this->id; if ($this->validate($values, self::NONCE_UPDATE)) { if ($venue_id) { $wpdb->update(WORDTOUR_VENUES, $this->db_in($values), array("venue_id" => $venue_id)); if ($wpdb->result) { $update_wpdb = clone $wpdb; if (!empty($values["venue_thumbnail_id"]) && is_string($values["venue_thumbnail_id"])) { $this->update_thumbnail($values["venue_thumbnail_id"], "venue"); } if (!empty($values["venue_category"]) && is_string($values["venue_category"])) { $this->update_category($this->dbprepere->json_in($values["venue_category"]), "venue"); } if (!empty($values["venue_videos"]) && is_string($values["venue_videos"])) { $this->update_videos($this->dbprepere->json_in($values["venue_videos"]), "venue"); } if (!empty($values["venue_gallery"]) && is_string($values["venue_gallery"])) { $this->update_gallery($this->dbprepere->json_in($values["venue_gallery"]), "venue"); } $this->retrieve(); $result = array("result" => $this->db_out(null, 0), "html" => $this->admin_html()); /* Eventbrite */ $eb = new WT_Eventbrite(); if ($eb->is_update()) { $eb->save_venue($this->db_out(null, 0)); if ($eb->response) { $result["eventbrite"] = $eb->response; } } /* */ $this->db_result("success", $update_wpdb, $result); return true; } else { $this->db_result("error", $wpdb, array("msg" => "Error updating venue, please try again<br>" . $wpdb->last_error)); return false; } } } return false; }