예제 #1
0
/**
 * Override or insert PHPTemplate variables into the templates.
 */
function covidien_theme_preprocess_page(&$vars) {
  global $user;
  global $base_url;
  //validate Cross site request forgery start
  $parse_base_url = parse_url($base_url);
  $referer = parse_url($_SERVER['HTTP_REFERER']);
  if ($_SERVER['HTTP_REFERER'] && ($parse_base_url['host'] != $referer['host']) && count($_REQUEST)) {
    drupal_goto(); //go to home page
    exit;
  }
  //validate Cross site request forgery end
  $node_type = '';
  if (is_anonymous()) {
    return;
  } else if ((arg(1) == 'register') || (arg(1) == 'forgot_password') || (arg(1) == 'reset_password') || (arg(0) == 'self')) {
    $vars['template_files'][] = 'page_loggedout';
  } elseif (!$user->uid) {
    $vars['template_files'][] = 'user-login';
  }

  $custom_tabs = user_acccess_custom_menu();
  //update admin menu link   //GATEWAY-2666 Update default to admin user list
  $vars['admin_page_url'] = 'covidien/admin/users/list';
  //check admin user list access 
  $user_page_access = false;
  $user_tabs = user_acccess_custom_menu(false);
  foreach ($user_tabs as $item) {
    if (strpos('covidien/admin/users/list', $item['href']) !== false) {
      $user_page_access = true;
    }
  }
  if (!$user_page_access) {
    $first_admin_menu = array_shift($user_tabs);
    if ($first_admin_menu) {
      $vars['admin_page_url'] = $first_admin_menu['href'];
    }
  }
  //GATEWAY-2666 Update default to admin user list end
  $vars['custom_tabs'] = $custom_tabs;
  if (not_showtab()) {
    $vars['custom_tabs'] = array();
  }
  //ajax
  if (arg(0) == 'covidien' && arg(2) == 'ajax') {
    $vars['template_file'] = 'page-ajax';
  }
  //access-denied
  if (strpos($_GET['q'], 'access-denied') !== false) {
    //$vars['custom_tabs'] = array();
    $variables = array('%device_name' => '', '%serial_number' => '');
    $content = t("You are not authorized to view this page");
    $vars['content'] = theme('covidien_access_no_access_theme', array('output' => $content));
    $vars['title'] = t("Access Denied");
  } else {
    $is_config = ((arg(1) != 'configuration') && (arg(2) != 'ajax'));
    if (arg(1) == 'admin' && arg(2) == 'access_roles') {
      $_SESSION['last_access_url'] = 'covidien/admin/access_roles';
    } else if ($is_config && (arg(2) != 'edit' ) && (arg(0) != 'node' || arg(2) != 'roles') && (arg(2) != 'no-reports') && (arg(1) != 'report') && (arg(0) != 'batch') && (arg(2) != 'reader')) {
      $_SESSION['last_access_url'] = implode('/', arg());
    }
  }
  //have not access to access-denied
  if ((!user_has_devices_access() || !user_has_node_access($vars['node'])) && strpos($_GET['q'], 'access-denied') === false) {
    if (arg(0) == 'covidien' && arg(1) == 'devices') {
      drupal_goto('covidien/devices/access-denied');
    } elseif (arg(0) == 'covidien' && arg(1) == 'reports') {
      //drupal_goto('covidien/reports/access-denied');
    } elseif (arg(0) == 'covidien' && arg(1) == 'users') {
      drupal_goto('covidien/admin/access-denied');
    } else {
      drupal_goto('covidien/access-denied');
    }
  }

  $total_reports = allReportList(); // Get all reports
  $report_list = getReportList(); // Get all reports related to the Product line
  // build menu
  foreach ($total_reports as $key => $val) {
    $class = array();
    if (in_array($val, $report_list)) {
      $vars['report_url'] .= "covidien/reports/filter/$key";
      break;
    }
  }
  if (empty($vars['report_url'])) {
    $vars['report_url'] = "covidien/reports/no-reports";
  }

  // Jump recent activity
  $activity = array(
    "device-type-config" => "Device Configuration",
    "device_type_config" => "Device Configuration",
    "software-approval-unavailable" => "Regulatory Approval",
    "software_reg_approval" => "Regulatory Approval",
    "person-training-record" => "Training Record", "person-application-role" => "Installation Privilege");
  if ((arg(0) == 'node') && (arg(1) == "add")) {
    $desc = '';
    $url = url($_GET['q'], array('absolute' => true));
    $arg2 = filter_xss(arg(2));
    $arg3 = filter_xss(arg(3));
    $desc = $activity[$arg2];
    if (empty($desc)) {
      $desc = $arg2;
    }
    if (arg(2) == "roles") {
      $url = $base_url . "/covidien/admin/roles/list/#add";
    }
    if (arg(2) == "software-approval-unavailable") {
      $url = $base_url . "/covidien/admin/" . $arg3 . "/sw_regulatory_approval/#add";
      $sw_name = node_load($arg3);
      $desc = $activity[$arg2] . " for " . $sw_name->title;
    }
    if (arg(2) == "person-training-record") {
      $url = $base_url . "/covidien/admin/user/" . $arg3 . "/training/#add";
      $name = node_load($arg3);
      $desc = $activity[$arg2] . " for " . $name->title;
    }
    unset($_SESSION['user_activity'][$url]);
    $_SESSION['user_activity'][$url] = t("Add - ") . " $desc";
  } else if ((arg(0) == 'node') && (arg(2) == "edit")) {
    $url = url($_GET['q'], array('absolute' => true));
    $arg1 = arg(1);
    $arg3 = arg(3);
    $result = node_load($arg1);
    $node_type = $result->type;
    if ($result->type == "roles") {
      $url = $base_url . "/covidien/admin/roles/list/#edit/" . $arg1;
    }
    if ($result->type == "software_approval_unavailable") {
      $url = $base_url . "/covidien/admin/" . $arg3 . "/sw_regulatory_approval/#edit/" . $arg1;
      $sw_name = node_load(trim($arg3));
      $result->title = $sw_name->title . " - " . $result->title;
    }
    if ($result->type == "person_training_record") {
      $url = $base_url . "/covidien/admin/user/" . $arg3 . "/training/#edit/" . $arg1;
      $name = node_load(trim($arg3));
      $result->title = $name->title . " - " . $result->title;
    }
    if ($result->type == "person_application_role") {
      $url = $base_url . "/covidien/admin/user/" . $arg3 . "/install_privilege/#edit/" . $arg1;
      $name = node_load(trim($arg3));
      $result->title = $name->title . " - " . $result->title;
    }
    $desc = $activity[str_replace('_', '-', $result->type)];
    if (empty($desc)) {
      $desc = $result->type;
    }
    unset($_SESSION['user_activity'][$url]);
    $_SESSION['user_activity'][$url] = t("Edit - ") . $desc . " - " . $result->title;
  } else if ((arg(1) == 'device')) {
    $url = url($_GET['q'], array('absolute' => true));
    $result = "Serial Number: " . arg(3);
    if (arg(2) != "") {
      $_SESSION['user_activity'][$url] = t("Device Info - ") . $result;
    }
  } else if ((arg(1) == 'reports')) {
    $url = url($_GET['q'], array('absolute' => true));
    if (arg(3) != "") {
      $_SESSION['user_activity'][$url] = t("Report - ") . $total_reports[arg(3)];
    }
  } else if ((arg(2) == 'users') && (arg(3) == "add_new")) {
    $url = url($_GET['q'], array('absolute' => true));
    $_SESSION['user_activity'][$url] = t("Add User");
  } else if ((arg(1) == 'users') && (arg(2) == "settings")) {
    $url = url($_GET['q'], array('absolute' => true));
    $_SESSION['user_activity'][$url] = t("User Profile");
  }
  $block = module_invoke('covidien_ui', 'block', 'view', $delta);
  $vars['pl_block'] = $block['content'];

  // Block product line dropdown to below pages
  if ((arg(2) == 'users' && arg(3) == 'add_new') || (arg(4) == "training") || (arg(1) == "document" && arg(2) == "reader") || (arg(2) == "settings")) {
    $vars['pl_block'] = '';
  }
  if (arg(2) == 'edit') {
    $details = node_load(arg(1));
    if ($details->type == 'person' || $details->type == 'roles') {
      $vars['pl_block'] = '';
    }
  }
  $vars['popup'] = is_not_popup();

  if ($user->uid != 1) {
    $userdet = getuserdetail($user->name);
    $vars['user_name'] = $userdet->name;
  }
  //report menu
  $vars['report_menu'] = covidien_report_filter_list();

  //GATEWAY-2794 add device type filter
  $default_device_type = $_SESSION['default_dtype'];
  $device_url = url('covidien/devices');
  if ($default_device_type) {
    $device_url = url('covidien/devices', array('query' => array('device_type' => $default_device_type)));
  }
  $vars['device_url'] = $device_url;
}
예제 #2
0
 * Load all cached location entries
 */
//loadLocationCache();
$accountID = $EWS_HEADERS['accountID'];
/*
 * Initialize SOAP clients for different services
 */
$basicReportService = createClient(EWS_VERSION . "/BasicReportService", $accountID);
//start  Report object creation
$dateRange = 'Yesterday';
$reportName = 'campaign name';
$reportType = 'KeywordSummaryByDay';
$reportRequestObj = new ewsBasicReportRequest($dateRange, '', $reportName, $reportType, '');
$reportId = addReportRequestForAccountID($accountID, $reportRequestObj);
$onlyCompleted = true;
$reportList = getReportList($onlyCompleted);
$fileFormatObj = new ewsFileOutputFormat('XML', false);
// ReportOutputUrl stored the url of getReportOutputURL , It  stores the value in array.
$ReportOutputUrl = getCustomUrl($reportList, $fileFormatObj);
displayUrl($ReportOutputUrl);
function displayUrl($ReportOutputUrl)
{
    echo "<br><h1> KeywordSummaryByDay reportOutputUrl in XML format. </h1> </br>";
    echo "<p> Here display the url which are stored in ReportOutputUrl variable  </p>";
    foreach ($ReportOutputUrl as $value) {
        echo "<br> Url : {$value}  </br>";
    }
}
/**
 * Request a report for an account (specified by accountID)
 *