public function addHotelBookingToDocs($lead) { $leadArr = array("Transaction ID" => $lead['txnId'], "First Name" => $lead['fname'], "Last Name" => $lead['lname'], "Email" => $lead['email'], "Contact" => $lead['contact'], "Booking Date" => $lead['date_added'], "Check-in Date" => $lead['check_in'], "Check-out Date" => $lead['check_out'], "Room Booked" => $lead['booked_room'], "Max Guests" => $lead['max'], "Total Payment" => $lead['revenue'], "Status" => 0); $spr = new Spreadsheet("*****@*****.**", "breakBoundaries\$\$##123"); $spr->setSpreadsheet("TNF100 2015 Registration")->setWorksheet("HotelBookings")->add($leadArr); if (isset($spr) && !empty($spr->token)) { return true; } else { return false; } }
function execute(&$form, $action_id) { $config = $form->actions_config[$action_id]; $config = new \GCore\Libs\Parameter($config); $doc = new Spreadsheet(); $doc->authenticate($config->get('username'), $config->get('password')); $doc->setSpreadsheet($config->get('spreadsheet')); $doc->setWorksheet($config->get('worksheet')); $path = $config->get('data_path', 'GSheet') ? explode('.', $config->get('data_path', 'GSheet')) : array(); $data = \GCore\Libs\Arr::getVal($form->data, $path, array()); //pr($data); $doc->add($data); $form->debug[$action_id][self::$title] = $doc->debug; }