Ejemplo n.º 1
0
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'vendor/autoload.php';
use Citrix\Citrix;
use Citrix\GoToWebinar;
use Citrix\Entity\Consumer;
//authenticate
$client = new Citrix('CONSUMER_KEY');
$client->auth('USERNAME', 'PASSWORD');
//get upcoming weibnars
$goToWebinar = new GoToWebinar($client);
$webinars = $goToWebinar->getUpcoming();
//get info for a single webinar
/* @var $webinar Citrix\Enttiy\Webinar */
$webinar = reset($webinars);
//get registraion/join url
$registrationUrl = $webinar->getRegistrationUrl();
//get more info about a webinar
$webinarInfo = $goToWebinar->getWebinar($webinar->getId());
//get registrants for given webinar
$registrants = $webinar->getRegistrants();
//register a user for a webinar
$data = array('email' => '*****@*****.**', 'firstName' => 'Teodor', 'lastName' => 'Talov');
$consumer = new Consumer($client);
$consumer->setData($data)->populate();
$registration = $webinar->registerConsumer($consumer);
if ($registration->hasErrors()) {
    throw new \Exception($registration->getError());
}
var_dump('You just registered!');
Ejemplo n.º 2
0
 /**
  * Register consumer for a webinar
  *
  * @param \Citrix\Entity\Consumer $consumer
  * @return \Citrix\GoToWebinar
  */
 public function registerConsumer(\Citrix\Entity\Consumer $consumer)
 {
     $goToWebinar = new GoToWebinar($this->getClient());
     $goToWebinar->register($this->getId(), $consumer->toArray());
     return $goToWebinar;
 }
Ejemplo n.º 3
0
 /**
  * @param bool $single    If we expect a single entity from the server, make this true.
  *                        Single webinar request wasn't working because it was looping its properties.
  */
 public function processResponse($single = false)
 {
     $response = $this->getResponse();
     $this->reset();
     if (isset($response['int_err_code'])) {
         $this->addError($response['msg']);
     }
     if (isset($response['description'])) {
         $this->addError($response['description']);
     }
     if ($single === true) {
         if (isset($response['webinarKey'])) {
             $webinar = new Webinar($this->getClient());
             $webinar->setData($response)->populate();
             $this->setResponse($webinar);
         }
         if (isset($response['registrantKey'])) {
             $webinar = new Consumer($this->getClient());
             $webinar->setData($response)->populate();
             $this->setResponse($webinar);
         }
     } else {
         $collection = new \ArrayObject(array());
         foreach ($response as $entity) {
             if (isset($entity['webinarKey'])) {
                 $webinar = new Webinar($this->getClient());
                 $webinar->setData($entity)->populate();
                 $collection->append($webinar);
             }
             if (isset($entity['registrantKey'])) {
                 $webinar = new Consumer($this->getClient());
                 $webinar->setData($entity)->populate();
                 $collection->append($webinar);
             }
         }
         $this->setResponse($collection);
     }
 }
Ejemplo n.º 4
0
 /**
  * Each class that makes calls to
  * Citrix API should define how to process
  * the response.
  */
 public function processResponse($single = false)
 {
     $response = $this->getResponse();
     $this->reset();
     //        dd($response);
     if (isset($response['int_err_code'])) {
         $this->addError($response['msg']);
     }
     if (isset($response['description'])) {
         $this->addError($response['description']);
     }
     if ($single === true) {
         if (isset($response['trainingKey'])) {
             $training = new Training($this->getClient());
             $training->setData($response)->populate();
             $this->setResponse($training);
         }
         if (isset($response['registrantKey'])) {
             $training = new Consumer($this->getClient());
             $training->setData($response)->populate();
             $this->setResponse($training);
         }
         if (isset($response['recordingList'])) {
             // need to build out a recording class I supose.
         }
     } else {
         $collection = new \ArrayObject(array());
         foreach ($response as $entity) {
             if (isset($entity['trainingKey'])) {
                 $training = new Training($this->getClient());
                 $training->setData($entity)->populate();
                 $collection->append($training);
             }
             if (isset($entity['registrantKey'])) {
                 $training = new Consumer($this->getClient());
                 $training->setData($entity)->populate();
                 $collection->append($training);
             }
         }
         $this->setResponse($collection);
     }
 }