本文整理汇总了PHP中Request::setView方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setView方法的具体用法?PHP Request::setView怎么用?PHP Request::setView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::setView方法的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: outputMoveHref
function outputMoveHref()
{
$request = new Request();
$request->setView('MoveProducts');
$request->setAction('MoveToProducts');
return $request->getURL();
}
示例3: onAction
function onAction()
{
global $application;
$request = new Request();
$key = $request->getValueByKey('key');
$passwd = array('passwd' => $request->getValueByKey('new_password'), 're-type' => $request->getValueByKey('retype_password'));
$account_name = modApiFunc('Customer_Account', 'getAccountByActivationKey', $key);
$errors = array();
if ($account_name != null) {
$validator =& $application->getInstance('CAValidator');
if (!$validator->isValid('passwd', $passwd)) {
$errors[] = 'E_INVALID_PASSWD';
}
}
if (!empty($errors)) {
modApiFunc('Session', 'set', 'RegisterErrors', $errors);
$request->setView('CustomerNewPassword');
$request->setKey('key', $key);
} else {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_PASSWD_UPDATED');
modApiFunc('Customer_Account', 'dropActivationKey', $account_name, 'customer_account');
$obj =& $application->getInstance('CCustomerInfo', $account_name);
$obj->setPersonInfo(array(array('Status', 'A', 'base')));
$obj->changePassword($passwd['passwd']);
$obj->SignIn();
$request->setView('CustomerAccountHome');
}
$application->redirect($request);
}
示例4: onAction
function onAction()
{
global $application;
$attrs = $_POST;
foreach ($attrs as $i => $v) {
if (is_array($v)) {
if (!array_key_exists('visible', $v)) {
$attrs[$i]['visible'] = 0;
}
if (!array_key_exists('required', $v)) {
$attrs[$i]['required'] = 0;
}
if ($attrs[$i]['visible'] == 0) {
$attrs[$i]['required'] = 0;
}
if ($attrs[$i]['required'] == 1) {
$attrs[$i]['visible'] = 1;
}
}
}
$this->saveSettings($attrs);
$request = new Request();
$request->setView('CheckoutInfoList');
$application->redirect($request);
}
示例5: onAction
function onAction()
{
$r = new Request();
$to_cc = $r->getValueByKey('to_currency_code');
$from_cc = $r->getValueByKey('from_currency_code');
$base = $r->getValueByKey('base_rate');
$rate = trim($base);
$errors = array();
if (modApiFunc('Currency_Converter', 'doesManRateExists', $from_cc, $to_cc)) {
$errors[] = 'E_MAN_RATE_EXISTS';
}
#
# base rate validation. should be integer or decimal value
#
if ($this->validateDecimal($rate) != true) {
$errors[] = 'E_MAN_INVALID_RATE';
}
if (empty($errors)) {
if (!modApiFunc('Currency_Converter', 'addManualRate', $from_cc, $to_cc, $rate)) {
$errors[] = 'E_MAN_RATE_NOT_ADDED';
}
}
if (empty($errors)) {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MAN_RATE_ADDED');
} else {
modApiFunc('Session', 'set', 'Errors', $errors);
}
$r->setView('PopupWindow');
$r->setKey('page_view', 'CurrencyRateEditor');
global $application;
$application->redirect($r);
}
示例6: redirect
/**
* Redirect after action
*/
function redirect()
{
global $application;
$request = new Request();
$request->setView('PromoCodesNavigationBar');
$application->redirect($request);
}
示例7: onHook
function onHook()
{
global $zone;
if ($zone == 'CustomerZone') {
global $application;
$sections = $application->getSectionByCurrentPagename();
$settings = modApiFunc('Customer_Account', 'getSettings');
if ($settings['CHECKOUT_TYPE'] == CHECKOUT_TYPE_ACCOUNT_REQUIRED) {
$this->redirect_scheme_not_signed['CustomerSignIn'][] = 'Checkout';
}
$use_scheme = modApiFunc('Customer_Account', 'getCurrentSignedCustomer') == null ? $this->redirect_scheme_not_signed : $this->redirect_scheme_signed;
foreach ($use_scheme as $to_view => $from_views) {
if (array_diff($from_views, $sections) != $from_views) {
$request = new Request();
$request->setView($to_view);
$application->redirect($request);
if (in_array('Checkout', $sections)) {
modApiFunc('Session', 'set', 'toCheckoutAfterSignIn', true);
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_NEED_REGISTER');
}
break;
}
}
}
}
示例8: 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;
$key = $request->getValueByKey('action_key');
// @ check key
$topics = $request->getValueByKey('topics');
$selected_topics = explode(',', $topics);
if (!is_array($selected_topics) || empty($selected_topics)) {
// @ INTERNAL
$SessionPost['ViewState']['ErrorsArray'][] = 'INTERNAL';
$nErrors++;
}
modApiFunc('Subscriptions', 'copyTempEmails', $key);
modApiFunc('Subscriptions', 'linkTempEmails', $key);
modApiFunc('Subscriptions', 'subscribeTempEmails', $key, $selected_topics);
modApiFunc('Subscriptions', 'cleanTempEmails', $key);
execQuery('SUBSCR_LINK_CUSTOMER_EMAILS', null);
execQuery('SUBSCR_LINK_ORDERS_EMAILS', null);
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$request = new Request();
$request->setView('Subscriptions_Manage');
// $request->setKey('stage', 'finish');
$application->redirect($request);
}
示例9: 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);
}
示例10: onAction
/**
*
*/
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$cc_id = $request->getValueByKey("cc_id");
$attrs = $request->getValueByKey("attrs");
$post_visible = $request->getValueByKey("visible");
$post_required = $request->getValueByKey("required");
$SessionPost = $_POST;
$visible = array();
$required = array();
foreach ($attrs as $id) {
if (isset($post_visible[$id]) && $post_visible[$id] == 'on') {
$visible[$id] = 1;
} else {
$visible[$id] = 0;
}
if (isset($post_required[$id]) && $post_required[$id] == 'on') {
$required[$id] = 1;
} else {
$required[$id] = 0;
}
}
$params = array('type' => $cc_id, 'visible' => $visible, 'required' => $required);
modApiFunc('Configuration', 'clearAttributesForCardType', $cc_id);
modApiFunc('Configuration', 'addAttributesForCardType', $params);
// modApiFunc('Session', 'set', 'ResultMessage', $messages);
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('cc_id', $cc_id);
$application->redirect($request);
}
示例11: onAction
function onAction()
{
global $application;
$request = new Request();
$account_name = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
$errors = array();
if ($account_name != null) {
$current_password = $request->getValueByKey('current_password');
if (!modApiFunc('Customer_Account', 'isCorrectAccountAndPasswd', $account_name, $current_password)) {
$errors[] = 'E_INVALID_CURRENT_PASSWD';
} else {
$validator =& $application->getInstance('CAValidator');
$passwd = array('passwd' => $request->getValueByKey('new_password'), 're-type' => $request->getValueByKey('retype_password'));
if (!$validator->isValid('passwd', $passwd)) {
$errors[] = 'E_INVALID_PASSWD';
}
}
if (!empty($errors)) {
modApiFunc('Session', 'set', 'RegisterErrors', $errors);
} else {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_PASSWD_UPDATED');
$obj =& $application->getInstance('CCustomerInfo', $account_name);
$obj->changePassword($passwd['passwd']);
}
}
$request->setView('CustomerChangePassword');
$application->redirect($request);
}
示例12: onAction
function onAction()
{
global $application;
$result = array();
$SessionPost = $_POST;
$subaction = 'calculate';
if (isset($_POST['subaction'])) {
$subaction = $_POST['subaction'];
}
switch ($subaction) {
case 'calculate':
$result["DstCountry"] = trim(intval($SessionPost["DstCountry"]));
$result["DstState_menu_select"] = trim(intval($SessionPost["DstState_menu_select"]));
$result["DstZip"] = trim($SessionPost["DstZip"]);
modApiFunc('Session', 'set', 'ShippingCalculatorPost', $result);
break;
case 'remember':
$choice = isset($_POST["ShippingCalculatorChoice"]) ? preg_replace('/[^A-Z0-9-_]/', '', trim($_POST["ShippingCalculatorChoice"])) : null;
if ($choice != null) {
modApiFunc('Session', 'set', 'ShippingCalculatorChoice', $choice);
}
break;
}
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$application->redirect($request);
}
示例13: onAction
function onAction()
{
$errors = array();
$topics = modApiFunc('Request', 'getValueByKey', 'topic');
if ($topics && is_array($topics)) {
$this->key = modApiFunc('Request', 'getValueByKey', 'key_unsubscribe');
$this->rec = modApiFunc('Newsletter', 'getUnsubscribeRecord', $this->key);
if ($this->rec) {
$email = modApiFunc('Subscriptions', 'getEmailById', $this->rec['email_id']);
if ($email) {
modApiFunc('Subscriptions', 'unsubscribeEmails', $topics, $email);
} else {
$errors[] = getMsg('SUBSCR', 'ERROR_UNSUBSCRIBE_GENERAL');
}
} else {
$errors[] = getMsg('SUBSCR', 'ERROR_UNSUBSCRIBE_GENERAL');
}
} else {
$errors[] = getMsg('SUBSCR', 'ERROR_UNSUBSCRIBE_NO_TOPICS');
}
$SessionPost['ViewState']['ErrorsArray'] = $errors;
$SessionPost['ViewState']['Stage'] = 'finish';
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
global $application;
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$application->redirect($request);
}
示例14: onAction
function onAction()
{
global $application;
$request =& $application->getInstance('Request');
$product_id = $request->getValueByKey('product_id');
$file_descr = $request->getValueByKey('new_file_descr');
if ($file_descr == null) {
$file_descr = '';
}
$file_path = $request->getValueByKey('new_file_name_hidden');
if (preg_match("/^__shell_upload_\\d+\$/", basename(dirname($file_path)))) {
$result = modApiFunc('Product_Files', 'moveFileToPFDir', $product_id, $file_path);
$is_uploaded = true;
modApiFunc('Shell', 'removeDirectory', dirname($file_path));
} else {
$result = array('error' => UPLOAD_ERR_OK, 'full_path' => $file_path, 'base_name' => basename($file_path), 'file_size' => filesize($file_path));
$is_uploaded = false;
}
if ($result['error'] == UPLOAD_ERR_OK) {
modApiFunc('Product_Files', 'addFileToProduct', $product_id, $result['base_name'], $result['full_path'], $file_descr, $is_uploaded);
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_FILE_ADDED');
} else {
modApiFunc('Session', 'set', 'Errors', array($result['error']));
}
$r = new Request();
$r->setView('PF_FilesList');
$r->setKey('product_id', $product_id);
$application->redirect($r);
}
示例15: getTag
/**
* Processes tags in the templates for the given view.
*
* @return string tag value, if tag has been processed. NULL, otherwise.
*/
function getTag($tag)
{
global $application;
$value = null;
switch ($tag) {
case 'Local_SearchFormAction':
$_request = new Request();
$_request->setView('SearchResult');
$value = $_request->getURL();
break;
case 'Local_SearchFormName':
$value = 'CatalogSearchForm';
break;
case 'Local_ActionName':
$value = 'asc_action';
break;
case 'Local_ActionValue':
$value = 'SearchProducts';
break;
case 'Local_SearchTextFieldName':
$value = 'search_pattern';
break;
case 'Local_SearchText':
if (modApiFunc('Session', 'is_Set', 'search_result_id')) {
$search_id = modApiFunc('Session', 'get', 'search_result_id');
$value = modApiFunc('CatalogSearch', 'getSearchPatternInSearchResult', $search_id);
$value = prepareHTMLDisplay($value);
} else {
$value = '';
}
break;
}
return $value;
}