本文整理汇总了PHP中Q_Request::isWebView方法的典型用法代码示例。如果您正苦于以下问题:PHP Q_Request::isWebView方法的具体用法?PHP Q_Request::isWebView怎么用?PHP Q_Request::isWebView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q_Request
的用法示例。
在下文中一共展示了Q_Request::isWebView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Shipping_label_response_content
function Shipping_label_response_content($params)
{
$streamName = Q_Request::uri()->shipmentStreamName;
$publisherId = Users::communityId();
$stream = Streams::fetchOne($publisherId, $publisherId, 'Shipping/shipment/' . $streamName);
if (!$stream->testReadLevel('see')) {
throw new Users_Exception_NotAuthorized();
}
$carrier = json_decode($stream->fields['carrier']) ?: new StdClass();
if (!is_object($carrier)) {
throw new exception("carrier is not an object!");
}
// TNT carrier
if ($carrier->name == "TNT") {
$xml = new XMLReader();
// check if XML valid
if (!$xml->xml($stream->fields['carrierLabel'], NULL, LIBXML_DTDVALID)) {
die("XML not valid");
}
// add back button
$stream->fields['carrierLabel'] = preg_replace("/<CONSIGNMENTBATCH>/", "<CONSIGNMENTBATCH>\n<ISWEBVIEW>" . Q_Request::isWebView() . "</ISWEBVIEW>", $stream->fields['carrierLabel']);
// add FTR Exemptions
$invoice = json_decode($stream->invoiceOptions) ?: new StdClass();
$stream->fields['carrierLabel'] = preg_replace("/<CONSIGNMENTBATCH>/", "<CONSIGNMENTBATCH>\n<FTR>" . $invoice->ftrExemptions . "</FTR>", $stream->fields['carrierLabel']);
header("Content-Type:text/xml");
echo $stream->fields['carrierLabel'];
exit;
} elseif (in_array($carrier->name, array("UPS", "FEDEX"))) {
$labels = Streams::related($stream->publisherId, $stream->publisherId, $stream->name, true, array("type" => "label"));
$orient = Q_Config::expect('Shipping', 'labelsOption', 'orient');
$perPage = (int) Q_Config::expect('Shipping', 'labelsOption', 'perPage');
// angle label rotate 90 or -90
$angle = 1;
// for UPS -90, for other 90
if ($carrier->name == "UPS") {
$angle = -1;
}
// include labels size calculation for all labels
Q_Response::addScript('js/labels.js');
Q_Response::addStylesheet('css/ShipmentLabels.css');
if ($orient == "vertical") {
Q_Response::addStylesheet('css/ShipmentLabelsVertical.css');
}
return Q::view('Shipping/content/imgLabels.php', compact('labels', 'perPage', 'angle'));
} elseif ($carrier->name == "DHL") {
$labels = Streams::related($stream->publisherId, $stream->publisherId, $stream->name, true, array("type" => "label"));
$labelsCount = count($labels[1]);
if ($labelsCount) {
$label = array_shift($labels[1]);
Shipping_Carrier_DHL::fixLabels(APP_DIR . "/web/" . $label->content, $stream);
exit;
//header("location: ".Q_Request::baseUrl().'/'.$label->content);
//exit;
}
}
$title = $stream->fields['title'];
$addressFrom = json_decode($stream->fields['origin']);
$addressTo = json_decode($stream->fields['destination']);
$packages = json_decode($stream->fields['packages']);
//$carrier = json_decode($stream->fields['carrier']);
$invoiceOptions = json_decode($stream->fields['invoiceOptions']);
$addressFrom = ($addressFrom->name ? $addressFrom->name . "<br>" : '') . $addressFrom->street . ($addressFrom->unit ? ' ' . $addressFrom->unit : '') . "<br>" . $addressFrom->city . ' ' . $addressFrom->zipcode . "<br>" . $addressFrom->country;
$addressTo = ($addressTo->name ? $addressTo->name . "<br>" : '') . $addressTo->street . ($addressTo->unit ? ' ' . $addressTo->unit : '') . "<br>" . "<span class='city'>" . $addressTo->city . ' ' . $addressTo->zipcode . "</span><br>" . $addressTo->country;
$exportDate = $invoiceOptions->exportDate;
$class = "Shipping_Carrier_" . strtoupper($carrier->name);
$labels = $class::labels($addressFrom, $addressTo, $packages, $carrier, $exportDate);
echo <<<EOT
\t<!DOCTYPE html>
\t<html>
\t<head>
\t\t<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
\t\t<title>Labels for {$title}</title>
\t</head>
\t<body>
\t{$labels}
\t</body>
</html>
EOT;
exit;
}