當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Gdata_Spreadsheets::getSpreadsheetEntry方法代碼示例

本文整理匯總了PHP中Zend_Gdata_Spreadsheets::getSpreadsheetEntry方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Gdata_Spreadsheets::getSpreadsheetEntry方法的具體用法?PHP Zend_Gdata_Spreadsheets::getSpreadsheetEntry怎麽用?PHP Zend_Gdata_Spreadsheets::getSpreadsheetEntry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Gdata_Spreadsheets的用法示例。


在下文中一共展示了Zend_Gdata_Spreadsheets::getSpreadsheetEntry方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postInsert

 public function postInsert($values)
 {
     set_time_limit(0);
     error_reporting(E_ALL);
     ini_set('display_errors', '1');
     $clientLibraryPath = sfConfig::get('sf_lib_dir') . '/vendor/ZendGdata-1.11.11/library';
     $oldPath = set_include_path($clientLibraryPath);
     // load Zend Gdata libraries
     require_once sfConfig::get('sf_lib_dir') . '/vendor/ZendGdata-1.11.11/library/Zend/Loader.php';
     Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
     Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
     // set credentials for ClientLogin authentication
     $user = "cmp@tvcultura.com.br";
     $pass = "alipio@28042011";
     try {
         // connect to API
         $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
         $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
         $service = new Zend_Gdata_Spreadsheets($client);
         // get spreadsheet entry
         $ssEntry = $service->getSpreadsheetEntry('https://spreadsheets.google.com/feeds/spreadsheets/' . $this->getSpreadsheetId());
         // get worksheet feed for this spreadsheet
         $wsFeed = $service->getWorksheetFeed($ssEntry);
         // create new entry
         $wsEntry = new Zend_Gdata_Spreadsheets_WorksheetEntry();
         $title = new Zend_Gdata_App_Extension_Title($this->getQuestion());
         $wsEntry->setTitle($title);
         $row = new Zend_Gdata_Spreadsheets_Extension_RowCount('10');
         $wsEntry->setRowCount($row);
         $col = new Zend_Gdata_Spreadsheets_Extension_ColCount('3');
         $wsEntry->setColumnCount($col);
         // insert entry
         $entryResult = $service->insertEntry($wsEntry, $wsFeed->getLink('self')->getHref());
         $wsid = end(explode("/", $entryResult->id));
         echo 'The ID of the new worksheet entry is: ' . $wsid;
         $this->worksheet_id = $wsid;
         $this->save();
         //die('ok');
     } catch (Exception $e) {
         die('ERROR: ' . $e->getMessage());
     }
 }
開發者ID:GustavoAdolfo,項目名稱:cmais-frontend-2,代碼行數:42,代碼來源:AssetQuestion.class.php

示例2: gdata_import

function gdata_import($attrib)
{
    if ($attrib["key"] == "" || $attrib["worksheet"] == "" || $attrib["user"] == "" || $attrib["pass"] == "") {
        echo 'ERROR: SET ALL ATTRIBUTES i.e sheet, worksheet, user, pass and columns. ';
        return;
    }
    // load Zend Gdata libraries
    set_include_path(get_include_path() . PATH_SEPARATOR . WP_PLUGIN_DIR . "//gdata-importer//");
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    // set credentials for ClientLogin authentication
    $user = $attrib["user"];
    $pass = $attrib["pass"];
    try {
        // connect to API
        $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
        $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
        $service = new Zend_Gdata_Spreadsheets($client);
        // get spreadsheet entry
        $ssEntry = $service->getSpreadsheetEntry('https://spreadsheets.google.com/feeds/spreadsheets/' . $attrib["key"]);
        // get worksheets in this spreadsheet
        $wsFeed = $ssEntry->getWorksheets($attrib["worksheet"]);
    } catch (Exception $e) {
        echo 'ERROR: ' . $e->getMessage();
        return;
    }
    $content = <<<HTML
\t<table>
HTML;
    foreach ($wsFeed as $wsEntry) {
        if ($wsEntry->getTitle() == $attrib["worksheet"]) {
            //get title
            $query = new Zend_Gdata_Spreadsheets_CellQuery();
            $query->setSpreadsheetKey($attrib["key"]);
            $id = $wsEntry->getId();
            $arr = explode('/', $id);
            $query->setWorksheetId($arr[sizeof($arr) - 1]);
            $query->setMinRow(1);
            $query->setMaxRow(1);
            $cellFeed = $service->getCellFeed($query);
            $content = $content . "<tr>";
            foreach ($cellFeed as $cellEntry) {
                $content = $content . "<td>" . $cellEntry->getCell()->getText() . "</td>";
            }
            $content = $content . "</tr>";
            //get content
            $rows = $wsEntry->getContentsAsRows();
            foreach ($rows as $row) {
                $content = $content . "<tr>";
                foreach ($row as $key => $value) {
                    $content = $content . "<td>" . $value . "</td>";
                }
                $content = $content . "</tr>";
            }
        }
    }
    $content = $content . <<<HTML
\t\t</tbody>
\t</table>
HTML;
    return $content;
}
開發者ID:EliasGoldberg,項目名稱:troop-sim,代碼行數:63,代碼來源:index.php

示例3: die

//die("here");
// load Zend Gdata libraries
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
// set credentials for ClientLogin authentication
$user = "cmaere@kcn.unima.mw";
$pass = "dumitembo";
try {
    // connect to API
    $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
    $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
    $service = new Zend_Gdata_Spreadsheets($client);
    // get spreadsheet entry
    die($ssEntry . "am there");
    $ssEntry = $service->getSpreadsheetEntry('https://docs.google.com/a/kcn.unima.mw/spreadsheet/ccc?key=0AumyFvx6NCRWdHRsUTFLYnBRcThmQ0RpaGwtOU1BNUE#gid=0');
    // get worksheet feed for this spreadsheet
    $wsFeed = $service->getWorksheetFeed($ssEntry);
    // create new entry
    $wsEntry = new Zend_Gdata_Spreadsheets_WorksheetEntry();
    $title = new Zend_Gdata_App_Extension_Title('Jan 2011');
    $wsEntry->setTitle($title);
    $row = new Zend_Gdata_Spreadsheets_Extension_RowCount('10');
    $wsEntry->setRowCount($row);
    $col = new Zend_Gdata_Spreadsheets_Extension_ColCount('10');
    $wsEntry->setColumnCount($col);
    // insert entry
    $entryResult = $service->insertEntry($wsEntry, $wsFeed->getLink('self')->getHref());
    echo 'The ID of the new worksheet entry is: ' . $entryResult->id;
} catch (Exception $e) {
    die('ERROR: ' . $e->getMessage());
開發者ID:cmaere,項目名稱:saris_dev,代碼行數:31,代碼來源:admissionNorminalRoll.php


注:本文中的Zend_Gdata_Spreadsheets::getSpreadsheetEntry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。