/** * Register the consumer with the webinar. Returns and error if unable to register * @param $confirmation The confirmation string set in the Gravity Form GUI * @param $form - The Gravity Forms form object * @param $entry - The user submitted entry * @return string - the modified confirmation */ public function webinar_form_confirmation($confirmation, $form, $entry) { // Filter the user data, and map it a format that the Citrix Expects $citrix_data = $this->map_citrix_data($form['fields'], $entry); // Get the webinar key from the entry data -- use the entry data because a notification can be forced // after the inital submission, should the Citrix API fail. $webinar_key = $this->get_citrix_key_from_fields($form['fields'], $entry); // Register the User with the Citrix API $webinarClient = new WebinarClient(); $response = $webinarClient->register($webinar_key, $citrix_data); // Check for errors if ($response['has_errors']) { // Get the Admin Options for the Citrix Connect Webinar $options = get_option('citrix-connect-webinar'); //Notifiy the admin of failed registration $this->sendErrorEmail($response, $citrix_data, 'webinar'); // Check if an error message has been set via the Admin Menu if (empty($options['webinar_error'])) { $errors = ''; foreach ($response['errors'] as $error) { $errors .= "<p>" . $error . "</p>"; } $confirmation = $errors . "<p>Unfortunately, we were unable to register you for this webinar. Your registration information has been saved, and an administrator has been notified.</p>\n <p>We will reach out to you shortly regarding your registration. Thank you for your patience.</p>"; } else { $confirmation = $options['webinar_error']; } } else { } return $confirmation; }
function webinar_render_add_registrants_metabox($post) { wp_enqueue_script('datatables'); wp_enqueue_style('datatables'); wp_enqueue_script('cc_datatables'); $webinarClient = new WebinarClient(); $registrants = $webinarClient->getRegistrants(get_post_meta($post->ID, 'webinar_key', true)); // dd($registrants); if (empty($registrants)) { $message = "<p class='error'>There are currently no registrants in the system.</p>"; } else { $message = "<p>Below is a list of current registrants for this webinar.</p>"; } // echo "<h2>Registrants</h2>"; echo $message; if (count($registrants) > 0) { echo "<div class='upcomming-data-table'>"; echo '<table data-order=\'[[ 3, "desc" ]]\'>'; echo '<thead>'; echo '<tr>'; echo '<th>First Name</th>'; echo '<th>Last Name</th>'; echo '<th>Email</th>'; echo '<th>Status</th>'; echo '<th>Date</th>'; echo '<th>Zone</th>'; echo '</tr>'; echo '</thead>'; echo '<tbody>'; foreach ($registrants as $registrant) { // dd($webinar); // $start = date('Y-m-d', strtotime($webinar->times[0]['startTime'])); // $end = date('Y-m-d', strtotime($webinar->times[0]['endTime'])); $time_zone = explode('/', $registrant->timeZone); echo '<tr>'; echo '<td>' . $registrant->firstName . '</td>'; echo '<td>' . $registrant->lastName . '</td>'; echo '<td>' . $registrant->email . '</td>'; echo '<td>' . strtolower($registrant->status) . '</td>'; echo '<td class="date">' . date('Y-m-d', strtotime($registrant->registrationDate)) . '</td>'; echo '<td>' . str_replace('_', ' ', $time_zone[1]) . '</td>'; echo '</tr>'; } echo '</tbody>'; echo '</table>'; echo '</div>'; } }
function citrix_connect_webinar_title($atts, $content) { $a = shortcode_atts(array('default' => '', 'id' => '', 'tag' => 'h3'), $atts); //if the webinar id has not been set, pull it from the post $id = empty($a['id']) ? get_post_meta(get_the_ID(), 'webinar_key', true) : $a['id']; //Set the title to the default $title = $a['default']; //If the default title is blank, grab from Citrix API if ('' === $title) { //Init the webinar client $webinarAPI = new WebinarClient(); $title = $webinarAPI->getTitle($id); } //Wrap the title in the given tag $html = "<" . $a['tag'] . ">" . esc_html($title) . "</" . $a['tag'] . ">"; return $html; }
public function admin_page_display_debug() { wp_enqueue_script('datatables'); wp_enqueue_style('datatables'); wp_enqueue_script('cc_datatables'); $webinar = new WebinarClient(); $upcomming = $webinar->getUpcomming(); if (empty($upcomming)) { $message = "<p class='error'>There are no upcomming webinars at the moment.</p>"; } else { $message = "<p>Below is a list of the upcoming webinars, to ensure that Citrix Connect WP is connecting to GoToWebinar.</p>"; } echo "<h2>Webinar Debug</h2>"; echo $message; if (count($upcomming) > 0) { echo "<div class='upcomming-data-table'>"; echo '<table data-order=\'[[ 3, "desc" ]]\'>'; echo '<thead>'; echo '<tr>'; echo '<th>ID</th>'; echo '<th>Title</th>'; echo '<th>Start Time</th>'; echo '<th>End Time</th>'; echo '<th>URL</th>'; echo '</tr>'; echo '</thead>'; echo '<tbody>'; foreach ($upcomming as $webinar) { // dd($webinar); $start = date('Y-m-d', strtotime($webinar->times[0]['startTime'])); $end = date('Y-m-d', strtotime($webinar->times[0]['endTime'])); echo '<tr>'; echo '<td>' . $webinar->id . '</td>'; echo '<td>' . $webinar->subject . '</td>'; echo '<td>' . $start . '</td>'; echo '<td>' . $end . '</td>'; echo '<td><a href="' . $webinar->registrationUrl . '">Registration Url</a></td>'; echo '</tr>'; } echo '</tbody>'; echo '</table>'; echo '</div>'; } }