/** * Should handle execution of the task, taking as much (optional) parameters as needed * * The parameters should be optional and failing to provide them should be handled by * the task */ public function execute($trackId = null, $exportOrganizations = false) { $versions = $this->loader->getVersions(); $data = array('gems_version' => $versions->getGemsVersion(), 'project' => $this->project->getName(), 'project_env' => APPLICATION_ENV, 'project_url' => $this->util->getCurrentURI(), 'project_version' => $versions->getProjectVersion()); // Main version data $this->exportTypeHeader('version', false); $this->exportFieldHeaders($data); $this->exportFieldData($data); $this->exportFlush(); }
/** * Return org dependent login url * * @return string */ public function getLoginUrl() { if ($base = $this->_get('base_url')) { return $base; } else { return $this->util->getCurrentURI(); } }
/** * Returns the current organization according to the current site url. * * @static array $url An array of url => orgId values * @return int An organization id or null */ public function getOrganizationIdByUrl() { static $urls; if (!is_array($urls)) { if ($this->cache) { $cacheId = GEMS_PROJECT_NAME . '__' . get_class($this) . '__organizations_url'; $urls = $this->cache->load($cacheId); } else { $cacheId = false; } // When we don't use cache or cache reports 'false' for a miss or expiration // then try to reload the data if ($cacheId === false || $urls === false) { $urls = array(); try { $data = $this->db->fetchPairs("SELECT gor_id_organization, gor_url_base FROM gems__organizations WHERE gor_active=1 AND gor_url_base IS NOT NULL"); } catch (\Zend_Db_Exception $zde) { // Table might not be filled $data = array(); } foreach ($data as $orgId => $urlsBase) { foreach (explode(' ', $urlsBase) as $url) { if ($url) { $urls[$url] = $orgId; } } } if ($cacheId) { $this->cache->save($urls, $cacheId, array('organization', 'organizations')); } } // \MUtil_Echo::track($urls); } $current = $this->util->getCurrentURI(); if (isset($urls[$current])) { return $urls[$current]; } }
/** * Returns the full url Gems should forward to after survey completion. * * This fix allows multiple sites with multiple url's to share a single * installation. * * @return string */ protected function calculateReturnUrl() { $currentUri = $this->util->getCurrentURI(); /* // Referrer would be powerful when someone is usng multiple windows, but // the loop does not always provide a correct referrer. $referrer = $_SERVER["HTTP_REFERER"]; // If a referrer was specified and that referral is from the current site, then use it // as it is more dependable when the user has multiple windows open on the application. if ($referrer && (0 == strncasecmp($referrer, $currentUri, strlen($currentUri)))) { return $referrer; // \MUtil_Echo::track($referrer); } // */ // Use the survey return if available. $surveyReturn = $this->loader->getCurrentUser()->getSurveyReturn(); if ($surveyReturn) { // Do not show the base url as it is in $currentUri $surveyReturn['NoBase'] = true; // Add route reset to prevet the current parameters to be // added to the url. $surveyReturn['RouteReset'] = true; // \MUtil_Echo::track($currentUri, \MUtil_Html::urlString($surveyReturn)); return $currentUri . \MUtil_Html::urlString($surveyReturn); } // Ultimate backup solution for return return $currentUri . '/ask/forward/' . \MUtil_Model::REQUEST_ID . '/' . urlencode($this->getTokenId()); }