/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. */ public function getItem($pk = null) { $item = parent::getItem($pk); if ($item) { $item = $this->loadProjectDetails($item); } return $item; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. */ public function getItem($pk = null) { $item = parent::getItem($pk); if (!$item->event_id) { // Get the prid of the record from the request. $id = JFactory::getApplication()->input->getInt('event_id'); if (!$id) { throw new RuntimeException('event_id id is required'); } $item->event_id = $id; } return $item; }
/** * Load item object * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.2 */ public function getItem($pk = null) { $this->paymentName = $this->getState('payment_name', ''); if ($this->paymentName != '' || $this->getState('process_params', '0') == '1') { $item = parent::getItem($pk); if ($this->paymentName && (empty($item->payment_name) || $item->payment_name != $this->paymentName)) { $db = $this->getDbo(); $query = $db->getQuery(true)->select('p.params as plugin_params, p.name as plugin_name, p.element, p.enabled, p.extension_id')->select('CONCAT("plg_redpayment_", p.element) as plugin_path_name')->from($db->qn('#__extensions', 'p'))->where($db->qn('p.type') . '= ' . $db->q("plugin"))->where($db->qn('p.folder') . '= ' . $db->q("redpayment"))->where($db->qn('p.element') . '= ' . $db->q($this->paymentName)); $db->setQuery($query); if ($defaultPlugin = $db->loadObject()) { $item->params = $defaultPlugin->plugin_params; $item->payment_name = $this->paymentName; } } else { $this->paymentName = $item->payment_name; $item->params = json_encode($item->params); } $item->folder = 'redpayment'; $item->element = $this->paymentName; return $item; } return parent::getItem($pk); }
/** * Load item object * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.2 */ public function getItem($pk = null) { if (!($item = parent::getItem($pk))) { return $item; } if (!empty($item->id) && is_null($this->xmlFile)) { try { $this->xmlFile = RApiHalHelper::loadWebserviceConfiguration($item->name, $item->version, 'xml', $item->path, $item->client); } catch (Exception $e) { JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_WEBSERVICE_ERROR_LOADING_XML', $e->getMessage()), 'error'); } } // Add default webservice parameters since this is new webservice if (empty($this->xmlFile)) { $this->xmlFile = $this->defaultXmlFile; } return $item; }
/** * Load item object * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.2 */ public function getItem($pk = null) { if (!($item = parent::getItem($pk))) { return $item; } // Get Access token and Authorization codes $db = $this->getDbo(); // There can be multiple access tokens that are not expired yet so we only load last one $query = $db->getQuery(true)->select('oat.access_token, oat.expires as access_token_expires')->from($db->qn('#__redcore_oauth_access_tokens', 'oat'))->where('oat.client_id = ' . $db->quote($item->client_id))->order('oat.expires DESC'); $db->setQuery($query); if ($accessToken = $db->loadObject()) { $item->access_token = $accessToken->access_token; $item->access_token_expires = $accessToken->access_token_expires; } // There can be multiple authorization codes that are not expired yet so we only load last one $query = $db->getQuery(true)->select('oac.authorization_code, oac.expires as authorization_code_expires')->from($db->qn('#__redcore_oauth_authorization_codes', 'oac'))->where('oac.client_id = ' . $db->quote($item->client_id))->order('oac.expires DESC'); $db->setQuery($query); if ($accessToken = $db->loadObject()) { $item->authorization_code = $accessToken->authorization_code; $item->authorization_code_expires = $accessToken->authorization_code_expires; } // There can be multiple refresh tokens that are not expired yet so we only load last one $query = $db->getQuery(true)->select('ort.refresh_token, ort.expires as refresh_token_expires')->from($db->qn('#__redcore_oauth_refresh_tokens', 'ort'))->where('ort.client_id = ' . $db->quote($item->client_id))->order('ort.expires DESC'); $db->setQuery($query); if ($accessToken = $db->loadObject()) { $item->refresh_token = $accessToken->refresh_token; $item->refresh_token_expires = $accessToken->refresh_token_expires; } $item->grant_types = explode(' ', $item->grant_types); $item->scope = explode(' ', $item->scope); return $item; }