本文整理汇总了PHP中Request::setKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setKey方法的具体用法?PHP Request::setKey怎么用?PHP Request::setKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::setKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAction
function onAction()
{
global $application;
if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
_fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
}
$SessionPost = $_POST;
$SessionPost["ViewState"]["ErrorsArray"] = array();
$fsr_id = $SessionPost["FsRule_id"] = intval($SessionPost["FsRule_id"]);
$SessionPost["FsRuleName"] = trim($SessionPost["FsRuleName"]);
$SessionPost["FsRuleMinSubtotal"] = floatval($SessionPost["FsRuleMinSubtotal"]);
$SessionPost["FsRuleStrictCart"] = intval($SessionPost["StrictCart"]);
if ($SessionPost["FsRuleName"] == "") {
$SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_EMPTY_RULE_NAME";
}
$is_unique = modApiFunc("Shipping_Cost_Calculator", "checkIfFsRuleIsUnique", $SessionPost["FsRuleName"], $fsr_id);
if (!$is_unique) {
$SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_NOT_UNIQUE_RULE_NAME";
}
if ($SessionPost["FormSubmitValue"] == "Save") {
if (count($SessionPost["ViewState"]["ErrorsArray"]) == 0) {
unset($SessionPost["ViewState"]["ErrorsArray"]);
$this->saveSettings($SessionPost);
$SessionPost["ViewState"]["hasCloseScript"] = "true";
}
}
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('FsRule_id', $fsr_id);
$application->redirect($request);
}
示例2: onAction
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$SessionPost = array();
if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
_fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
}
$SessionPost = $_POST;
$nErrors = 0;
$this->getEmails();
if ($this->_valid_emails_count == 0) {
$SessionPost['ViewState']['ErrorsArray'][] = 'ALERT_FILL_EMAILS_TO_SUBSCRIBE';
// @ - ?
$SessionPost['ViewState']['ErrorFields'][] = 'emails_subscribe';
$nErrors++;
} else {
$SessionPost['action_key'] = $this->_action_key;
$SessionPost['ViewState']['stage'] = 'confirm';
}
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('topics', modApiFunc('Request', 'getValueByKey', 'topics'));
if (isset($this->_action_key)) {
$request->setKey('action_key', $this->_action_key);
$request->setKey('stage', 'confirm');
}
$application->redirect($request);
}
示例3: onAction
function onAction()
{
global $application;
$data = array("parent_entity" => $_POST["parent_entity"], "entity_id" => intval($_POST["entity_id"]), "option_id" => intval($_POST["option_id"]));
$check_result = modApiFunc("Product_Options", "checkDataFor", "delOptionFromEntity", $data);
if (!empty($check_result)) {
modApiFunc("Session", "set", "Errors", $check_result);
$request = new Request();
$request->setKey("parent_entity", $data["parent_entity"]);
$request->setKey("entity_id", $data["entity_id"]);
$request->setView('PO_OptionsList');
$application->redirect($request);
} else {
$del_result = modApiFunc("Product_Options", "delOptionFromEntity", $data);
if ($del_result == true) {
modApiFunc("Session", "set", "ResultMessage", "MSG_OPTION_DELETED");
} else {
modApiFunc("Session", "set", "ResultMessage", "MSG_OPTION_NOT_DELETED");
}
$request = new Request();
$request->setView('PO_OptionsList');
$request->setKey('parent_entity', $data["parent_entity"]);
$request->setKey('entity_id', $data["entity_id"]);
$application->redirect($request);
}
}
示例4: onAction
function onAction()
{
global $application;
$emails_keys = modApiFunc('Request', 'getValueByKey', 'emails');
$emails_topics = modApiFunc('Request', 'getValueByKey', 'topic');
$customer_id = modApiFunc('Request', 'getValueByKey', 'customer_id');
if (!is_array($emails_topics)) {
$emails_topics = array();
}
foreach (array_keys($emails_keys) as $email) {
$topics = @$emails_topics[$email];
if (!is_array($topics)) {
$topics = array();
}
modApiFunc('Subscriptions', 'changeSubscriptions', $email, $topics);
$params = array('customer_id' => $customer_id, 'email' => $email);
execQuery('SUBSCR_LINK_SUBSCRIPTION_TO_CUSTOMER', $params);
}
$messages['MESSAGES'][] = getMsg('SYS', 'SUBSCRIPTIONS_UPDATED');
modApiFunc('Session', 'set', 'AplicationSettingsMessages', $messages);
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('page_view', modApiFunc('Request', 'getValueByKey', 'page_view'));
$request->setKey('customer_id', $customer_id);
$application->redirect($request);
}
示例5: onAction
function onAction()
{
global $application;
$request = new Request();
$category_id = $request->getValueByKey('category_id');
$tree_id = $request->getValueByKey('tree_id');
$fp_ids = $request->getValueByKey('to_save');
modApiFunc('Featured_Products', 'deleteAllFPLinksFromCategory', $category_id);
$errors = array();
if ($fp_ids != null) {
if (!modApiFunc('Featured_Products', 'addFPLinksToCategory', $category_id, $fp_ids)) {
$errors[] = 'E_FP_NOT_SAVED';
}
}
if (empty($errors)) {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_FP_SAVED');
} else {
modApiFunc('Session', 'set', 'Errors', $errors);
}
$request->setView('PopupWindow');
$request->setKey('page_view', 'FP_LinksList');
$request->setKey('category_id', $category_id);
$request->setKey('tree_id', $tree_id);
$application->redirect($request);
}
示例6: onAction
function onAction()
{
global $application;
$request = new Request();
$category_id = $request->getValueByKey('category_id');
$tree_id = $request->getValueByKey('tree_id');
$bs_ids = $request->getValueByKey('to_save');
modApiFunc('Bestsellers_API', 'deleteAllBSLinksFromCategory', $category_id);
$errors = array();
if ($bs_ids != null) {
if (!modApiFunc('Bestsellers_API', 'addBSLinksToCategory', $category_id, $bs_ids)) {
$errors[] = 'E_BS_NOT_SAVED';
}
}
if (empty($errors)) {
$sets = $request->getValueByKey('sets');
$sets['BS_FROM_STAT_PERIOD'] = $sets['BS_FROM_STAT_PERIOD']['count'] * $sets['BS_FROM_STAT_PERIOD']['type'];
modApiFunc('Bestsellers_API', 'updateSettings', $category_id, $sets);
}
if (empty($errors)) {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_BS_SAVED');
} else {
modApiFunc('Session', 'set', 'Errors', $errors);
}
$request->setView('PopupWindow');
// $request->setView('BS_LinksList');
$request->setKey('page_view', 'BS_LinksList');
$request->setKey('category_id', $category_id);
$request->setKey('tree_id', $tree_id);
$application->redirect($request);
}
示例7: outputAdminList
/**
*
*
* @
* @param
* @return
*/
function outputAdminList()
{
global $application;
$retval = "";
$admin_members = modApiFunc("Users", "getAdminMembersList");
$i = 0;
//$min_list_size = 10;
foreach ($admin_members as $member) {
$current_admin = modApiFunc("Users", "getCurrentUserID") == $member["id"] ? true : false;
$request = new Request();
$request->setView('AdminMemberInfo');
$request->setAction('SetSelectedUser');
$request->setKey('uid', $member["id"]);
$request->setKey('edit', true);
$link = $request->getURL();
$template_contents = array("AdminMemberInfoLink" => $link, "AdminId" => $member["id"], "Style" => "visible", "AdminCheckBox" => $current_admin ? "" : "select_" . $i, "AdminCheckBoxName" => $current_admin ? "" : "selected_admins[" . ($i + 1) . "]", "AdminName" => prepareHTMLDisplay($member["firstname"] . " " . $member["lastname"]), "CurrentAdmin" => $current_admin ? "<span class=\"font-red\">*</span>" : "", "Email" => $member["email"], "LogNum" => $member["lognum"], "LoggedIn" => $member["logdate"] && $member["logdate"] != "0000-00-00" ? modApiFunc("Localization", "SQL_date_format", $member["logdate"]) : $this->MessageResources->getMessage("ADMIN_MEMBERS_LABEL_001"), "Created" => modApiFunc("Localization", "SQL_date_format", $member["created"]), "Modified" => $member["modified"] && $member["modified"] != "0000-00-00" ? modApiFunc("Localization", "SQL_date_format", $member["modified"]) : $this->MessageResources->getMessage("ADMIN_MEMBERS_LABEL_002"), "Enabled" => $current_admin ? " DISABLED" : "");
$this->_Template_Contents = $template_contents;
$application->registerAttributes($this->_Template_Contents);
$retval .= modApiFunc('TmplFiller', 'fill', "users/admin_members/", "item.tpl.html", array());
if (!$current_admin) {
$i++;
}
}
for (; $i < $min_list_size; $i++) {
$retval .= modApiFunc('TmplFiller', 'fill', "users/admin_members/", "item_empty.tpl.html", array());
}
return $retval;
}
示例8: onAction
/**
* Deletes tax rate by zip set.
*/
function onAction()
{
global $application;
$SessionPost = array();
$SessionPost = $_POST;
$Errors = array();
$Result = array();
$request = new Request();
$request->setView("PopupWindow");
$updateSid = $request->getValueByKey("updateSid", 0);
if ($updateSid) {
$request->setKey("updateSid", $updateSid);
}
$description = '';
if (isset($_POST['file_description'])) {
$description = prepareHTMLDisplay(trim($_POST['file_description']));
}
if ($description == '') {
$SessionPost['Errors'][] = getMsg("TAX_ZIP", "ADD_NEW_SET_EMPTY_FILE_DESCRIPTION_ERROR");
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$request->setKey("page_view", "TaxRateByZip_AddNewSet");
$application->redirect($request);
return;
}
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$sid = modApiFunc("TaxRateByZip", "addSetToDB", $description, $_POST["csv_file_name"]);
$request->setKey("page_view", "TaxRatesImportView");
$request->setKey("sid", $sid);
$application->redirect($request);
}
示例9: onAction
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$attr_id = $request->getValueByKey("customFieldsList");
if (!isset($_POST['customFieldVisible'])) {
$_POST['customFieldVisible'] = 0;
}
if (!isset($_POST['customFieldRequired'])) {
$_POST['customFieldRequired'] = 0;
}
if ($_POST['customFieldRequired'] == 1) {
$_POST['customFieldVisible'] = 1;
}
if ($_POST['customFieldVisible'] == 0) {
$_POST['customFieldRequired'] = 0;
}
#validation
if (isset($_POST['params'])) {
foreach ($_POST['params'] as $name => $v) {
if (!preg_match("/^\\d+\$/", $v)) {
$_data = $_POST;
$_data['invalid_params'] = $_POST['customFieldType'];
modApiFunc("Session", "set", "FormData", $_data);
modApiFunc("Session", "set", "ResultMessage", 'MSG_INVALID_DATA');
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('page_view', 'ManageCustomFields');
$request->setKey('variant_id', $_POST['variant_id']);
$request->setKey('attribute_id', $attr_id);
$request->setKey('mode', 'edit');
$application->redirect($request);
return;
}
}
}
$params = null;
if (isset($_POST['params'])) {
$params = serialize($_POST['params']);
}
$values = array();
if (isset($_POST['customFieldValues'])) {
$values = explode("\n", $_POST['customFieldValues']);
foreach ($values as $i => $v) {
$values[$i] = trim($v);
}
}
$r = modApiFunc('Checkout', 'updateCustomField', $_POST['variant_id'], $attr_id, $_POST['customFieldVisibleName'], $_POST['customFieldDescription'], $_POST['customFieldVisible'], $_POST['customFieldRequired'], $_POST['customFieldType'], $values, $params);
modApiFunc('Checkout', 'updateCheckoutFormHash');
modApiFunc("Session", "set", "UpdateParent", true);
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('page_view', 'ManageCustomFields');
$request->setKey('variant_id', $_POST['variant_id']);
$request->setKey('attribute_id', $attr_id);
$request->setKey('mode', 'edit');
$application->redirect($request);
}
示例10: onAction
function onAction()
{
global $application;
$request =& $application->getInstance('Request');
modApiFunc('Product_Files', 'zeroHotlinkTries', $request->getValueByKey('opid'), $request->getValueByKey('hl_id'));
$r = new Request();
$r->setView(CURRENT_REQUEST_URL);
$r->setKey('page_view', 'PF_OrderHotlinks');
$r->setKey('opid', $request->getValueByKey('opid'));
$application->redirect($r);
}
示例11: output
function output($report_settings)
{
// $res = modApiFunc( "Charts",
// "getStockChartAmchart",
// 'http://localhost/~af/trunk/avactis-system/admin/amcharts/stock/examples/data_at_irregular_intervals/data.csv',
// array('title 1', 'title 2'),
// 460 // width
// );
// $this->__render_settings->getReportID();
// http://localhost/~af/trunk/avactis-system/admin/reports.php?asc_action=getReportContent&type=Excel&reportName=ChartOrdersByDay&format=csv
global $application;
$this->__report_settings = $report_settings;
// , , -
$report_rows = $this->__report_settings->getReportData();
// ,
$report_columns = $this->__report_settings->getColumnList();
// , - , - .
$report_column_headers = $this->__report_settings->getColumnHeaders();
$report_column_units = $this->__report_settings->getColumnUnits();
if (count($report_columns) < 2) {
return "<br><br><br><br>" . getMsg('RPTS', 'CHART_ERROR') . "<br><br><br><br>";
}
if (empty($report_rows)) {
return "<br><br><br><br>" . getMsg('RPTS', 'EMPTY_REPORT') . "<br><br><br><br>";
}
$report_id = $this->__report_settings->getReportID();
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('asc_action', 'getReportContent');
$request->setKey('type', 'Excel');
$request->setKey('format', 'csv');
$request->setKey('csv-header', 'false');
$request->setKey('reportName', $report_id);
$url_csv = $request->getURL();
$chart_width = $this->__report_settings->getReportPlaceholderWidth() - 20;
$series = array();
$units = array();
// , ,
for ($i = 1; $i < count($report_columns); $i++) {
$series[] = $report_column_headers[$report_columns[$i]];
$units[] = isset($report_column_units[$report_columns[$i]]) ? $report_column_units[$report_columns[$i]] : '';
}
$res = modApiFunc("Charts", "getStockChartAmchart", $url_csv, $series, $chart_width, 450, $units);
return $res['html'];
// echo $url_csv;
// echo "<br>";
// _print($series);
// echo $chart_width;
// return '';
}
示例12: onAction
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$attr_id = $request->getValueByKey("customFieldsList");
modApiFunc('Checkout', 'removeCustomField', $_POST['variant_id'], $attr_id);
modApiFunc('Checkout', 'updateCheckoutFormHash');
modApiFunc("Session", "set", "UpdateParent", true);
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('page_view', 'ManageCustomFields');
$request->setKey('variant_id', $_POST['variant_id']);
$application->redirect($request);
}
示例13: onAction
function onAction()
{
global $application;
$sort_array = explode("|", $_POST["optionsSortOrder_hidden"]);
if (modApiFunc("Product_Options", "updateOptionsSortOrder", $sort_array)) {
modApiFunc("Session", "set", "ResultMessage", "MSG_OPTIONS_SORT_ORDER_UPDATED");
} else {
modApiFunc("Session", "set", "ResultMessage", "MSG_OPTIONS_SORT_ORDER_NOT_UPDATED");
}
$request = new Request();
$request->setView('PO_OptionsList');
$request->setKey('parent_entity', $_POST["parent_entity"]);
$request->setKey('entity_id', $_POST["entity_id"]);
$application->redirect($request);
}
示例14: onAction
function onAction()
{
global $application;
$request =& $application->getInstance('Request');
$hl_id = $request->getValueByKey('hl_id');
$opid = $request->getValueByKey('opid');
$edate = explode("/", $request->getValueByKey('edate'));
$ts = mktime($edate[3], $edate[4], 0, $edate[1], $edate[2], $edate[0]);
modApiFunc('Product_Files', 'updateHotlinkExpireDate', $opid, $hl_id, $ts);
$r = new Request();
$r->setView(CURRENT_REQUEST_URL);
$r->setKey('page_view', 'PF_OrderHotlinks');
$r->setKey('opid', $request->getValueByKey('opid'));
$application->redirect($r);
}
示例15: onAction
function onAction()
{
global $application;
$request =& $application->getInstance('Request');
// getting posted review data
$review_data = $request->getValueByKey('review_data');
// getting mode
$mode = $request->getValueByKey('mode');
if ($mode == 'product_changed') {
$review_data['datetime'] = $review_data['year'] . '-' . $review_data['month'] . '-' . $review_data['day'] . ' ' . $review_data['hour'] . ':' . $review_data['minute'] . ':' . $review_data['second'];
// product has been changed, continue...
modApiFunc('Session', 'set', 'SavedReviewData', $review_data);
$req_to_redirect = new Request();
$req_to_redirect->setView(CURRENT_REQUEST_URL);
$req_to_redirect->setKey('page_view', 'CR_Review_Data');
$req_to_redirect->setKey('cr_id', $review_data['cr_id']);
$application->redirect($req_to_redirect);
return;
}
// validating data
$error = $this->validatePostedData($review_data);
if ($error) {
// if there is an error save the data and reload the page
modApiFunc('Session', 'set', 'SavedReviewData', $review_data);
$req_to_redirect = new Request();
$req_to_redirect->setView(CURRENT_REQUEST_URL);
$req_to_redirect->setKey('page_view', 'CR_Review_Data');
$req_to_redirect->setKey('cr_id', $review_data['cr_id']);
$application->redirect($req_to_redirect);
} else {
// no errors... ready to save the data
$cr_id = $this->savePostedData($review_data);
// reload the parent window while reloading
modApiFunc('Session', 'set', 'CR_ReloadParentWindow', 1);
// setting ResultMessage
if (@$review_data['cr_id'] <= 0) {
modApiFunc('Session', 'set', 'ResultMessage', 'CR_MSG_CUSTOMER_REVIEW_ADDED');
} else {
modApiFunc('Session', 'set', 'ResultMessage', 'CR_MSG_CUSTOMER_REVIEW_UPDATED');
}
// prepare the redirect
$req_to_redirect = new Request();
$req_to_redirect->setView(CURRENT_REQUEST_URL);
$req_to_redirect->setKey('page_view', 'CR_Review_Data');
$req_to_redirect->setKey('cr_id', $cr_id);
$application->redirect($req_to_redirect);
}
}