本文整理汇总了PHP中Zend_Gdata_Spreadsheets::insertRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Spreadsheets::insertRow方法的具体用法?PHP Zend_Gdata_Spreadsheets::insertRow怎么用?PHP Zend_Gdata_Spreadsheets::insertRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_Spreadsheets
的用法示例。
在下文中一共展示了Zend_Gdata_Spreadsheets::insertRow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gdata_insert_row
public function gdata_insert_row()
{
ProjectConfiguration::registerZend();
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
Zend_Loader::loadClass('Zend_Gdata_Docs');
$username = "sindvig.dentista";
$password = "@bcd1234";
//Chave do arquivo
$key = "0Ak_oCZQf3sTidEJnZGQ4MHdhS0R1NUlSeG1ORkpnalE";
//Carregando o serviço do arquivo
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$spreadSheetService = new Zend_Gdata_Spreadsheets($client);
//Pegando as planilhas do arquivo
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($key);
$feed = $spreadSheetService->getWorksheetFeed($query);
//Escolhendo a planilha correta
foreach ($feed->entries as $entry) {
if ($entry->getTitle() == 'Disponiveis') {
$worksheetId = basename($entry->getId());
}
}
//Configura variaveis da nova linha na planilha
$assoc = $this->getAssociado();
$matricula = $this->isTitular() ? $assoc->getMatricula() : $assoc->getTitular()->getMatricula();
$dependenteId = $this->isDependente() ? $assoc->getId() : '0';
//Monta array para o serviço do arquivo
$rowData = array("data" => $this->getDateTimeObject('created_at')->format('Y-m-d'), "matricula" => $matricula, "nome" => $assoc->getNome(), "dependenteid" => $dependenteId, "encaminhaid" => $this->getId());
//Insere na Planilha
$insertedListEntry = $spreadSheetService->insertRow($rowData, $key, $worksheetId);
}
示例2: json_encode
<?php
require_once 'php/config.php';
set_include_path("gdata/library");
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
Zend_Loader::loadClass('Zend_Gdata_App_AuthException');
Zend_Loader::loadClass('Zend_Http_Client');
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME);
} catch (Zend_Gdata_App_AuthException $ae) {
exit("Error Connecting");
}
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
$post_data = file_get_contents("php://input");
$post_data = json_decode($post_data, true);
$defaults = array('email' => 'none provided', 'date' => date('j F Y h:i:s A'));
$bug = array_merge($defaults, $post_data);
$insertedListEntry = $spreadsheetService->insertRow($bug, $spreadsheetKey, $worksheetId);
echo json_encode($bug);
示例3: check_ipn
function check_ipn()
{
global $wpdb, $purchase_log, $wpsc_cart;
$wpcb_atos = get_option('wpcb_atos');
$wpcb_general = get_option('wpcb_general');
$wpcb_dev = get_option('wpcb_dev');
$purch_log_email = get_option('purch_log_email');
if (!$purch_log_email) {
$purch_log_email = get_bloginfo('admin_email');
}
// Automatic Response ATOS :
if ($_GET['ipn'] == 'atos') {
if (array_key_exists('mode_demo', $wpcb_dev) && $wpcb_dev['mode_demo']) {
// Ce Kit de demo a du vous etre envoyé par la banque
$pathfile = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/cgi-bin/demo/pathfile";
$path_bin_response = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/cgi-bin/demo/response";
$logfile = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/cgi-bin/demo/logfile.txt";
} else {
$pathfile = $wpcb_atos['pathfile'];
$path_bin_response = $wpcb_atos['path_bin_response'];
$logfile = $wpcb_atos['logfile'];
}
// Initialisation du chemin du fichier de log :
if (isset($_POST['DATA'])) {
$data = escapeshellcmd($_POST['DATA']);
$message = "message={$data}";
$pathfile = "pathfile=" . $pathfile;
if (isset($_POST['sandbox'])) {
$result = $_POST['sandbox'];
} else {
$result = exec("{$path_bin_response} {$pathfile} {$message}");
}
$tableau = explode("!", $result);
$response = array('code' => $tableau[1], 'error' => $tableau[2], 'merchantid' => $tableau[3], 'merchantcountry' => $tableau[4], 'amount' => $tableau[5], 'transactionid' => $tableau[6], 'paymentmeans' => $tableau[7], 'transmissiondate' => $tableau[8], 'paymenttime' => $tableau[9], 'paymentdate' => $tableau[10], 'responsecode' => $tableau[11], 'paymentcertificate' => $tableau[12], 'authorisationid' => $tableau[13], 'currencycode' => $tableau[14], 'cardnumber' => $tableau[15], 'cvvflag' => $tableau[16], 'cvvresponsecode' => $tableau[17], 'bankresponsecode' => $tableau[18], 'complementarycode' => $tableau[19], 'complementaryinfo' => $tableau[20], 'returncontext' => $tableau[21], 'caddie' => $tableau[22], 'receiptcomplement' => $tableau[23], 'merchantlanguage' => $tableau[24], 'language' => $tableau[25], 'customerid' => $tableau[26], 'orderid' => $tableau[27], 'customeremail' => $tableau[28], 'customeripaddress' => $tableau[29], 'captureday' => $tableau[30], 'capturemode' => $tableau[31], 'data' => $tableau[32]);
//Session id used by wp ecommerce :
$sessionid = $response['orderid'];
// A venir : Ajout dans un google spreadsheet qui a toutes les entêtes précédentes (requis Zend)
// A coler dans la page admin pour tester
if (WP_ZEND_FRAMEWORK) {
$GoogleConnection = true;
$SpreadSheetConnection = true;
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($wpcb_general['googleemail'], $wpcb_general['googlepassword']);
} catch (Zend_Gdata_App_AuthException $ae) {
echo $ae->exception();
$GoogleConnection = false;
}
if ($GoogleConnection) {
// Test
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($wpcb_general['googleemail'], $wpcb_general['googlepassword'], $service);
// On va chercher le numéro de la feuille :
$query_worksheet = new Zend_Gdata_Spreadsheets_DocumentQuery();
// todo pour pas de client ici ?
$query_worksheet->setSpreadsheetKey($wpcb_general['spreadsheetKey']);
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
try {
$feed = $spreadsheetService->getWorksheetFeed($query_worksheet);
} catch (Zend_Gdata_App_HttpException $ae) {
echo $ae->exception();
$SpreadSheetConnection = false;
}
if ($SpreadSheetConnection) {
// Tout bon on ajoute :
foreach ($feed->entries as $entry) {
if ($entry->title->text == 'CB') {
$worksheetId_CB = basename($entry->id);
} elseif ($entry->title->text == 'Paypal') {
$worksheetId_Paypal = basename($entry->id);
}
}
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
// Insert row in google spreadsheet :
$insertedListEntry = $spreadsheetService->insertRow($response, $wpcb_general['spreadsheetKey'], $worksheetId_CB);
} else {
wp_mail($purch_log_email, 'Email envoyé depuis le auto_response', 'Mauvais Numero de Spreadsheet dans les options du plugin wpcb');
}
} else {
if (WP_DEBUG) {
wp_mail($purch_log_email, 'Email envoyé depuis le auto_response', 'Mauvais login/mot de pass google dans les options du plugin wpcb');
}
}
} else {
wp_mail($purch_log_email, 'Email envoyé depuis le auto_response', 'Installer Zend pour ajouter automatiquement les ventes à google drive !');
}
// analyse du code retour
if (isset($_POST['sandbox'])) {
$message = "-----------SANDBOX-------------------------\n";
foreach ($response as $k => $v) {
$message .= $k . " = " . $v . "\n";
}
$message .= "-------------------------------------------\n";
if ($logfile) {
$fp = fopen($logfile, "a");
fwrite($fp, $message);
fclose($fp);
}
echo $message;
wp_mail($purch_log_email, 'Email pour vous dire qu\'un paiement SANDBOX est arrivé !', $message);
} else {
//.........这里部分代码省略.........
示例4: insertRow
public function insertRow($payload)
{
return $this->spreadsheetService->insertRow($payload, $this->spreadsheetId);
}
示例5: basename
// Set your Google Docs credentials here
$user = 'your@gmail.com';
$pass = 'password';
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
$feed = $spreadsheetService->getSpreadsheetFeed();
// This is not the url displayed when logged in to Goolge Docs, because
// that would just make sense. Oh, no - instead it has to be abstracted
// away in the object. This is the feed url.
$sheetName = "Sheet1";
foreach ($feed->entries as $entry) {
if ($entry->title->text == $sheetName) {
$spreadsheetURL = $entry->id;
echo "SpreadsheetURL is: {$spreadsheetURL} <br /> \n";
break;
}
}
$spreadsheetKey = basename($spreadsheetURL);
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$feed = $spreadsheetService->getWorksheetFeed($query);
echo "Spreadsheet Key : {$spreadsheetKey} <br/> \n";
foreach ($feed->entries as $entry) {
echo "ID of sheet {$entry->title->text} is " . basename($entry->id) . " <br/> \n";
}
//$worksheetId = "Sheet1";
$worksheetId = basename($entry->id);
// Ensure to use all lower case for column (header) names and escape sequences for spaces.
$spreadsheetService->insertRow(array('header1' => 'Blargity', 'header2' => '9001'), $spreadsheetKey, $worksheetId);