public function getOnlineData() { try { $user = JRequest::getVar('user', null); $pass = JRequest::getVar('pass', null); $calendars = GCalendarZendHelper::getCalendars($user, $pass); if ($calendars == null) { return null; } $this->_data = array(); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_gcalendar/tables'); foreach ($calendars as $calendar) { $table =& $this->getTable('Import', 'GCalendarTable'); $table->id = 0; $cal_id = substr($calendar->getId(), strripos($calendar->getId(), '/') + 1); $table->calendar_id = $cal_id; $table->username = $user; $table->password = $pass; $table->name = (string) $calendar->getTitle(); if (strpos($calendar->getColor(), '#') === 0) { $color = str_replace("#", "", (string) $calendar->getColor()); $table->color = $color; } $this->_data[] = $table; } } catch (Exception $e) { JError::raiseWarning(200, $e->getMessage()); $this->_data = null; } return $this->_data; }