You are here

public static function mo_saml_visualTour::genArray in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 8

3 calls to mo_saml_visualTour::genArray()
MiniorangeConfigOAuthClient::buildForm in src/Form/MiniorangeConfigOAuthClient.php
Form constructor.
MiniorangeLicensing::buildForm in src/Form/MiniorangeLicensing.php
Form constructor.
MiniorangeMapping::buildForm in src/Form/MiniorangeMapping.php
Form constructor.

File

src/mo_saml_visualTour.php, line 6

Class

mo_saml_visualTour

Namespace

Drupal\miniorange_oauth_client

Code

public static function genArray($overAllTour = 'tabTour') {
  $link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  $exploded = explode('/', $link);
  $getPageName = end($exploded);
  $Tour_Token = \Drupal::config('miniorange_oauth_client.settings')
    ->get('mo_saml_tourTaken_' . $getPageName);
  if ($overAllTour == 'overAllTour') {
    $getPageName = 'overAllTour';
  }
  $https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
  $request_scheme = isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : $https;
  $moTourArr = array(
    'pageID' => $getPageName,
    'tourData' => mo_saml_visualTour::getTourData($getPageName),
    'tourTaken' => $Tour_Token,
    'addID' => mo_saml_visualTour::addID(),
    'pageURL' => $request_scheme . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
  );
  \Drupal::configFactory()
    ->getEditable('miniorange_oauth_client.settings')
    ->set('mo_saml_tourTaken_' . $getPageName, TRUE)
    ->save();
  $moTour = json_encode($moTourArr);
  return $moTour;
}