I am developing a site with ci 2.1.4

I used this tutorial to create an event in google calendar:
Click Here

When I change a date on the view, it calls the controller function with ajax, used to work fine, now the page just hangs and I can’t figure out what is going on.

My controller function (Calling create_event from the zend_helper):

public function set_paid()

  some code here....

  $title = $firstName . ' ' . $lastName . ' - order has been paid.';
  $where = 'Clarens';

  $content = "Order Details:\n";
  foreach($dets as $item)
   $qty = $item['qty'];
   $coffee = $item['coffee'];
   $weight = $item['weight'];
   $content .= "Qty: $qty\nCoffee: $coffee\nWeight: $weight\n\n";

  $content .= "Postage type: $postageType\n\n";
  $content .= "\nPostal Address:\n";

  foreach($addr as $item)
   $addrLine1 = $item->addr_line_1;
   $addrLine2 = $item->addr_line_2;
   $suburb = $item->suburb;
   $city = $item->city;
   $postCode = $item->post_code;
   $province = $item->province;

   $content .= "$addrLine1\n";
    $content .= "$addrLine2\n";
   $content .= "$suburb\n$city $postCode\n$province"; 

  create_event($title, $where, $content);

My zend helper:

//Changed this today, copied the Zend folder to application/libraries
/*if(ENVIRONMENT != 'production')
 ini_set("include_path", ini_get("include_path").PATH_SEPARATOR.str_replace("/", "\\", BASEPATH)."contrib\\");
 require_once ('Zend/Loader.php');
 ini_set("include_path", ini_get("include_path").PATH_SEPARATOR.BASEPATH."/contrib/");
 require_once 'Zend/Loader.php';
require_once (APPPATH . 'libraries/Zend/Loader.php');

function create_event($title, $where, $content)
  // Parameters for ClientAuth authentication

 $user = "user";
 $pass = "pass";

 $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
 $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
 $service = new Zend_Gdata_Calendar($client);

 // Create a new entry using the calendar service's magic factory method
 $event= $service->newEventEntry();

 // Populate the event with the desired information
 // Note that each attribute is crated as an instance of a matching class
 $event->title = $service->newTitle($title);
 $event->where = array($service->newWhere($where));
 $event->content = $service->newContent($content);

 // Set the date using RFC 3339 format.
 $date = new DateTime('NOW');
 $duration = new DateInterval('PT15M');

 $calendar_date = $date->format('Y-m-d');
 $startTime = $date->format('H:i');

 $endDate = $date;
 $endTime = $endDate->format('H:i');

 $tzOffset = "+02";

 $when = $service->newWhen();

 $when->startTime = "{$calendar_date}T{$startTime}:00.000{$tzOffset}:00";
 $when->endTime = "{$calendar_date}T{$endTime}:00.000{$tzOffset}:00";
 $reminder = $service->newReminder();
 $reminder->method = "sms";
 $reminder->minutes = "5";

 // Apply the reminder to an existing event's when property
 $when->reminders = array($reminder);
 $event->when = array($when);

 // Upload the event to the calendar server
 // A copy of the event as it is recorded on the server is returned
 $newEvent = $service->insertEvent($event);

I have the zend installed in two places now:

Do I have to use Zend to connect to google? I searched google but can’t find a solution.

I also found this spark: Click Here but it uses ZF2 and I have no clue what to do with it. Also installing sparks and getting the loader to work with HMVC broke the whole site.

Can someone please help me? I don’t get any errors in firebug, I can’t understand what is going on.

4 Years
Discussion Span
Last Post by cgull

Thanks pritaeas, but I see this library is still in development so rather not use it.


Ok, found the problem, it was the csrf.

I added my function in the config file:
$config['csrf_exclude_uris'] = array('cart/admin/orders/set_paid');

And everything is back to normal.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.