当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata_Calendar::getCalendarListFeed方法代码示例

本文整理汇总了PHP中Zend_Gdata_Calendar::getCalendarListFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Calendar::getCalendarListFeed方法的具体用法?PHP Zend_Gdata_Calendar::getCalendarListFeed怎么用?PHP Zend_Gdata_Calendar::getCalendarListFeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Gdata_Calendar的用法示例。


在下文中一共展示了Zend_Gdata_Calendar::getCalendarListFeed方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: outputCalendarList

/**
 * Outputs an HTML unordered list (ul), with each list item representing a
 * calendar in the authenticated user's calendar list.
 *
 * @param  Zend_Http_Client $client The authenticated client object
 * @return void
 */
function outputCalendarList($client)
{
    $gdataCal = new Zend_Gdata_Calendar($client);
    $calFeed = $gdataCal->getCalendarListFeed();
    echo "<h1>" . $calFeed->title->text . "</h1>\n";
    echo "<ul>\n";
    foreach ($calFeed as $calendar) {
        echo "\t<li>" . $calendar->title->text . "</li>\n";
    }
    echo "</ul>\n";
}
开发者ID:ramyarangan,项目名称:CS50Organizations,代码行数:18,代码来源:calendarSetup.php

示例2: getCalendars

 /**
  * @param string $username
  * @param string $password
  *
  * @return Zend_Gdata_Calendar_ListFeed|NULL
  */
 public static function getCalendars($username, $password)
 {
     try {
         $client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, Zend_Gdata_Calendar::AUTH_SERVICE_NAME);
         $gdataCal = new Zend_Gdata_Calendar($client);
         return $gdataCal->getCalendarListFeed();
     } catch (Exception $e) {
         JError::raiseWarning(200, $e->getMessage());
     }
     return null;
 }
开发者ID:atnospeat,项目名称:joomla-gcalendar,代码行数:17,代码来源:GCalendarZendHelper.php

示例3: gCalendar

    /**
     * Get the user notes from Google calendar (Gdata Zend functions are necessary)
     */
    public function gCalendar() {
        // Security check
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('IWagendas::', '::', ACCESS_READ));

        // get user uid
        $user = (UserUtil::getVar('uid') == '') ? '-1' : UserUtil::getVar('uid');
        $usability = ModUtil::func('IWagendas', 'user', 'getGdataFunctionsUsability');
        if ($usability !== true) {
            throw new Zikula_Exception_Forbidden();
        }
        //Load required classes
        require_once 'Zend/Loader.php';
        Zend_Loader::loadClass('Zend_Gdata');
        Zend_Loader::loadClass('Zend_Gdata_AuthSub');
        Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
        Zend_Loader::loadClass('Zend_Gdata_HttpClient');
        Zend_Loader::loadClass('Zend_Gdata_Calendar');
        //@var string Location of AuthSub key file.  include_path is used to find this
        $_authSubKeyFile = null; // Example value for secure use: 'mykey.pem'
        //@var string Passphrase for AuthSub key file.
        $_authSubKeyFilePassphrase = null;
        $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
        $userSettings = ModUtil::func('IWagendas', 'user', 'getUserGCalendarSettings');
        if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
            try {
                $client = Zend_Gdata_ClientLogin::getHttpClient($userSettings['gUserName'], base64_decode($userSettings['gUserPass']), $service);
            } catch (exception $e) {
                $authSubUrl = ModUtil::func('IWagendas', 'user', 'getAuthSubUrl');
                return System::redirect(ModUtil::url('IWwebbox', 'user', 'main', array('url' => str_replace('&', '*', str_replace('?', '**', $authSubUrl)))));
            }
        } else
            $client = ModUtil::func('IWagendas', 'user', 'getAuthSubHttpClient');
        try {
            $gdataCal = new Zend_Gdata_Calendar($client);
        } catch (exception $e) {
            LogUtil::registerError($this->__('Connection with Google failed. Imposible to synchronize the agenda'));
            return false;
        }
        //get user calendars
        try {
            $calFeed = $gdataCal->getCalendarListFeed();
        } catch (exception $e) {
            LogUtil::registerError($this->__('Connection with Google failed. Imposible to synchronize the agenda'));
            return false;
        }
        $gCalendarsIdsArray = array();
        foreach ($calFeed as $calendar) {
            $gCalendarsIdsArray[] = $calendar->id;
        }
        // Get all existing google calendars stored in database. We need them to know if the received google calendars exists or not
        $gAgendas = ModUtil::apiFunc('IWagendas', 'user', 'getAllAgendas', array('gAgendas' => 1,
                    'gCalendarsIdsArray' => $gCalendarsIdsArray));
        $gCalendarsIdsArray = array();
        foreach ($gAgendas as $g) {
            $gIds[$g['gCalendarId']] = $g;
        }
        $existingCalendar = array();
        // Create or edit the calendars if it were necessary
        foreach ($calFeed as $calendar) {
            //sincronize calendars
            $id = $calendar->id;
            $resp = '$' . $user . '$';
            $accessLevel = '$' . substr($calendar->accessLevel->value, 0, 4) . '|' . $user . '$';
            $color = '$' . $calendar->color->value . '|' . $user . '$';
            // Create a calendar array based on the calendar id
            $existingCalendar["$id"] = 1;
            if (!array_key_exists("$id", $gIds)) {
                $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
                $agenda = ModUtil::apiFunc('IWagendas', 'admin', 'create', array('nom_agenda' => $calendar->title,
                            'descriu' => $calendar->summary->text,
                            'c1' => $this->__('What'),
                            'c2' => $this->__('End'),
                            'c3' => $this->__('Where'),
                            'c4' => $this->__('Content'),
                            'c5' => $this->__('Author'),
                            'tc1' => 1,
                            'tc2' => 1,
                            'tc3' => 1,
                            'tc4' => 2,
                            'tc5' => 1,
                            'activa' => 1,
                            'adjunts' => 0,
                            'protegida' => 1,
                            'gColor' => '$' . $color,
                            'color' => '',
                            'gCalendarId' => $id,
                            'gAccessLevel' => '$' . $accessLevel,
                            'resp' => '$' . $resp,
                            'sv' => $sv));
                // add new agenda into the array in case the agenda is created recently
                $gIds["$id"] = $agenda;
            } else {
                if ($gIds["$id"]['nom_agenda'] != $calendar->title ||
                        $gIds["$id"]['descriu'] != $calendar->summary->text ||
                        strpos($gIds["$id"]['gColor'], $color) === false ||
                        strpos($gIds["$id"]['resp'], $resp) === false ||
                        strpos($gIds["$id"]['gAccessLevel'], $accessLevel) === false) {
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:User.php

示例4: outputCalendarList

 /**
  * Display list of calendars in the sidemenu with 
  * checkbox ahead of each calendar's title.
  *
  * @param Zend client object
  *
  * @return void
  */
 public function outputCalendarList($client)
 {
     $gdataCal = new Zend_Gdata_Calendar($client);
     $calFeed = $gdataCal->getCalendarListFeed();
     //Get calendar list from database
     $query = "SELECT * FROM %scalendar_google_sync WHERE userid=%d";
     $rowval = queryDB($query, array(TABLE_PREFIX, $_SESSION['member_id']), TRUE);
     $prevval = $rowval['calids'];
     $selectd = '';
     $i = 1;
     //Iterate through each calendar id
     foreach ($calFeed as $calendar) {
         //set state according to database and if changed then update database
         if (strpos($prevval, $calendar->id->text . ',') === false) {
             $selectd = '';
         } else {
             $selectd = "checked='checked'";
         }
         echo "\t <div class='fc-square fc-inline-block'\n                    style='background-color:" . $calendar->color->value . "' ></div>\n                    <input id='gcal" . $i . "' type='checkbox' name ='calid' value='" . $calendar->id->text . "' " . $selectd . " onclick='if(this.checked) \$.get(\"mods/_standard/calendar/google_calendar_db_sync.php\",\n                    { calid: this.value, mode: \"add\" },function (data){ refreshevents(); } );\n                    else \$.get(\"mods/_standard/calendar/google_calendar_db_sync.php\",\n                    { calid: this.value, mode: \"remove\" },function (data){ refreshevents(); } );'\n                    />\n                    <label for='gcal" . $i . "'>" . $calendar->title->text . "</label><br/>";
         $i++;
     }
 }
开发者ID:genaromendezl,项目名称:ATutor,代码行数:30,代码来源:googlecalendar.class.php

示例5: googleAction

 public function googleAction()
 {
     //$this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $my_calendar = 'http://www.google.com/calendar/feeds/default/private/full';
     if (!isset($_SESSION['cal_token'])) {
         if (isset($_GET['token'])) {
             // You can convert the single-use token to a session token.
             $session_token = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
             // Store the session token in our session.
             $_SESSION['cal_token'] = $session_token;
         } else {
             // Display link to generate single-use token
             $googleUri = Zend_Gdata_AuthSub::getAuthSubTokenUri('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'], $my_calendar, 0, 1);
             echo "Click <a href='{$googleUri}'>here</a> " . "to authorize this application.";
             exit;
         }
     }
     // Create an authenticated HTTP Client to talk to Google.
     $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['cal_token']);
     // Create a Gdata object using the authenticated Http Client
     $cal = new Zend_Gdata_Calendar($client);
     var_export($cal->getCalendarListFeed()->count());
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:24,代码来源:AuthenticateController.php

示例6: outputCalendarList

 /**
  * Grabs a list of a users calendars
  *
  * @param String $client - Access token
  * @return calendars in array form
  */
 function outputCalendarList($client)
 {
     $gdataCal = new Zend_Gdata_Calendar($client);
     $calFeed = $gdataCal->getCalendarListFeed();
     return $calFeed;
 }
开发者ID:abdullahbutt,项目名称:Codeigniter-Gcal,代码行数:12,代码来源:Gcal.php

示例7: getOnlineData

 /**
  * Method to get a calendar
  * @return object with data
  */
 function getOnlineData()
 {
     $this->loadZendClasses();
     $client = $this->getAuthSubHttpClient();
     if (!$client) {
         $this->_data = array();
     } else {
         $gdataCal = new Zend_Gdata_Calendar($client);
         $calFeed = $gdataCal->getCalendarListFeed();
         $tmp = array();
         JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_gcalendar' . DS . 'tables');
         foreach ($calFeed as $calendar) {
             $table_instance =& $this->getTable('import');
             $table_instance->id = 0;
             $cal_id = substr($calendar->id->text, strripos($calendar->id->text, '/') + 1);
             $table_instance->calendar_id = $cal_id;
             $table_instance->name = $calendar->title->text;
             if (strpos($calendar->color->value, '#') === 0) {
                 $color = str_replace("#", "", $calendar->color->value);
             }
             $table_instance->color = $color;
             $tmp[] = $table_instance;
         }
         $this->_data = $tmp;
     }
     return $this->_data;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:31,代码来源:import.php

示例8: foreach

        function export_google_calendar() {
		ajx_current("empty");
                
                require_once 'Zend/Loader.php';

                Zend_Loader::loadClass('Zend_Gdata');
                Zend_Loader::loadClass('Zend_Gdata_AuthSub');
                Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
                Zend_Loader::loadClass('Zend_Gdata_Calendar');
                
                $users = ExternalCalendarUsers::findByContactId();
                if($users){
                    if($users->getSync() == 1){
                        $sql = "SELECT ec.* FROM `".TABLE_PREFIX."external_calendars` ec,`".TABLE_PREFIX."external_calendar_users` ecu 
                                WHERE ec.calendar_feng = 1 AND ecu.contact_id = ".logged_user()->getId();
                        $calendar_feng = DB::executeOne($sql);
                        $events = ProjectEvents::findNoSync();

                        $user = $users->getAuthUser();
                        $pass = $users->getAuthPass();
                        $service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;

                        try
                        {
                                $client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$service);  
                                $gdataCal = new Zend_Gdata_Calendar($client);

                                if ($calendar_feng){
                                    foreach ($events as $event){
                                        $calendarUrl = 'http://www.google.com/calendar/feeds/'.$calendar_feng['calendar_user'].'/private/full';

                                        $newEvent = $gdataCal->newEventEntry();
                                        $newEvent->title = $gdataCal->newTitle($event->getObjectName());
                                        $newEvent->content = $gdataCal->newContent($event->getDescription());

                                        $star_time = explode(" ",$event->getStart()->format("Y-m-d H:i:s"));
                                        $end_time = explode(" ",$event->getDuration()->format("Y-m-d H:i:s"));

                                        if($event->getTypeId() == 2){
                                            $when = $gdataCal->newWhen();
                                            $when->startTime = $star_time[0];
                                            $when->endTime = $end_time[0];
                                            $newEvent->when = array($when);
                                        }else{                                    
                                            $when = $gdataCal->newWhen();
                                            $when->startTime = $star_time[0]."T".$star_time[1].".000-00:00";
                                            $when->endTime = $end_time[0]."T".$end_time[1].".000-00:00";
                                            $newEvent->when = array($when);
                                        }

                                        // insert event
                                        $createdEvent = $gdataCal->insertEvent($newEvent, $calendarUrl);

                                        $event_id = explode("/",$createdEvent->id->text);
                                        $special_id = end($event_id); 
                                        $event->setSpecialID($special_id);
                                        $event->setUpdateSync(ProjectEvents::date_google_to_sql($createdEvent->updated));
                                        $event->setExtCalId($calendar_feng['id']);
                                        $event->save();
                                    }                             
                                }else{
                                    $appCalUrl = '';
                                    $calFeed = $gdataCal->getCalendarListFeed();        
                                    foreach ($calFeed as $calF){
                                        $instalation = explode("/", ROOT_URL);
                                        $instalation_name = end($instalation);
                                        if($calF->title->text == lang('feng calendar',$instalation_name)){
                                            $appCalUrl = $calF->content->src;
                                            $t_calendario = $calF->title->text;
                                        }
                                    }    

                                    if($appCalUrl != ""){
                                        $title_cal = $t_calendario;
                                    }else{
                                        $instalation = explode("/", ROOT_URL);
                                        $instalation_name = end($instalation);
                                        $appCal = $gdataCal -> newListEntry();
                                        $appCal -> title = $gdataCal-> newTitle(lang('feng calendar',$instalation_name));                         
                                        $own_cal = "http://www.google.com/calendar/feeds/default/owncalendars/full";                        
                                        $new_cal = $gdataCal->insertEvent($appCal, $own_cal);

                                        $title_cal = $new_cal->title->text;
                                        $appCalUrl = $new_cal->content->src;                                
                                    }               

                                    $cal_src = explode("/",$appCalUrl);
                                    array_pop($cal_src);
                                    $calendar_visibility = end($cal_src);
                                    array_pop($cal_src);
                                    $calendar_user = end($cal_src);                            

                                    $calendar = new ExternalCalendar();
                                    $calendar->setCalendarUser($calendar_user);
                                    $calendar->setCalendarVisibility($calendar_visibility);
                                    $calendar->setCalendarName($title_cal);
                                    $calendar->setExtCalUserId($users->getId());
                                    $calendar->setCalendarFeng(1);
                                    $calendar->save();

//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:EventController.class.php

示例9: apologize

             apologize("The club's categories could not be stored.");
         }
     }
 }
 // mark user as an administrator
 $rows = query("UPDATE users SET admin = ? WHERE id = ?", true, $_SESSION["id"]);
 $privacy = query("SELECT * FROM privacy WHERE description = 'admin'");
 // insert user into subscriptions database (as an admin for this club)
 $result = query("INSERT INTO subscriptions (userID, clubID, level) \n                VALUES(?, ?, ?)", $_SESSION["id"], $clubID, $privacy[0]["level"]);
 // if user subscription not added, notify user
 if ($result === false) {
     apologize("Your subscription to this club could not be added to the database.");
 }
 $gdataCal = new Zend_Gdata_Calendar($_SESSION["client"]);
 //Get list of existing calendars
 $calFeed = $gdataCal->getCalendarListFeed();
 $levels = query("SELECT * FROM privacy");
 $num = count($levels);
 for ($i = 1; $i <= $num; $i++) {
     // ensure that when POST  variables are extracted  during loops, the abbr is not incorrect
     $abbreviation = strtoupper($abbreviation);
     if (isset($_POST["abbreviation"]) && $abbreviation == "") {
         $abbreviation = strtoupper($_POST[name]);
     }
     // I actually had to guess this method based on Google API's "magic" factory
     $appCal = $gdataCal->newListEntry();
     // I only set the title, other options like color are available.
     $appCal->title = $gdataCal->newTitle($abbreviation . $i);
     //This is the right URL to post to for new calendars...
     //Notice that the user's info is nowhere in there
     $own_cal = "http://www.google.com/calendar/feeds/default/owncalendars/full";
开发者ID:ramyarangan,项目名称:CS50Organizations,代码行数:31,代码来源:createClub.php

示例10: outputCalendarByDateRange

/**
 * Iterate through all the Google Calendars and create a JSON encoded array of events.
 *
 * @return array of events in JSON format
 */
function outputCalendarByDateRange($client, $startDate, $endDate, $idsofcal, $gcalobj)
{
    $gdataCal = new Zend_Gdata_Calendar($client);
    $rows = array();
    $idsofcal = explode(',', $idsofcal);
    $calFeed = $gdataCal->getCalendarListFeed();
    foreach ($idsofcal as $idofcal) {
        if ($idofcal != '') {
            $query = $gdataCal->newEventQuery();
            $query->setUser(substr($idofcal, strrpos($idofcal, "/") + 1));
            $query->setVisibility('private');
            $query->setProjection('full');
            $query->setOrderby('starttime');
            $query->setStartMin($startDate);
            $query->setStartMax($endDate);
            $eventFeed = $gdataCal->getCalendarEventFeed($query);
            $color = CALENDAR_DEF_COLOR;
            $accesslevl = true;
            foreach ($calFeed as $calendar) {
                if (strpos($idofcal, $calendar->id->text) !== false) {
                    $color = $calendar->color->value;
                    if ($calendar->accesslevel->value == 'read') {
                        $accesslevl = false;
                    }
                }
            }
            foreach ($eventFeed as $event) {
                foreach ($event->when as $when) {
                    $startD = substr($when->startTime, 0, 19);
                    $startD = str_replace('T', ' ', $startD);
                    $endD = substr($when->endTime, 0, 19);
                    $endD = str_replace('T', ' ', $endD);
                    /*
                     * If both start time and end time are different and their time parts differ then allDay is false
                     */
                    if ($startD != $endD && substr($startD, 0, 10) == substr($endD, 0, 10)) {
                        $allDay = "false";
                    } else {
                        $allDay = "true";
                    }
                    $row = array();
                    $row["title"] = $event->title->text;
                    $row["id"] = $event->id->text;
                    $row["editable"] = $accesslevl;
                    $row["start"] = $startD;
                    $row["end"] = $endD;
                    $row["allDay"] = $allDay;
                    $row["color"] = $color;
                    $row["textColor"] = "white";
                    $row["calendar"] = "Google Calendar event";
                    array_push($rows, $row);
                }
            }
        }
    }
    //Encode in JSON format.
    $str = json_encode($rows);
    //Replace "true","false" with true,false for javascript.
    $str = str_replace('"true"', 'true', $str);
    $str = str_replace('"false"', 'false', $str);
    //Return the events in the JSON format.
    echo $str;
}
开发者ID:genaromendezl,项目名称:ATutor,代码行数:68,代码来源:json-events-gcal.php


注:本文中的Zend_Gdata_Calendar::getCalendarListFeed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。