本文整理汇总了PHP中Tools::isSubmit方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::isSubmit方法的具体用法?PHP Tools::isSubmit怎么用?PHP Tools::isSubmit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::isSubmit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
global $currentIndex;
if (Tools::isSubmit('submitPrint')) {
if (!Validate::isDate(Tools::getValue('date_from'))) {
$this->_errors[] = $this->l('Invalid from date');
}
if (!Validate::isDate(Tools::getValue('date_to'))) {
$this->_errors[] = $this->l('Invalid end date');
}
if (!sizeof($this->_errors)) {
$orders = Order::getOrdersIdInvoiceByDate(Tools::getValue('date_from'), Tools::getValue('date_to'), NULL, 'invoice');
if (sizeof($orders)) {
Tools::redirectAdmin('pdf.php?invoices&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')) . '&token=' . $this->token);
}
$this->_errors[] = $this->l('No invoice found for this period');
}
} elseif (Tools::isSubmit('submitOptionsinvoice')) {
if (intval(Tools::getValue('PS_INVOICE_NUMBER')) == 0) {
$this->_errors[] = $this->l('Invalid invoice number');
} else {
parent::postProcess();
}
} else {
parent::postProcess();
}
}
示例2: getContent
public function getContent()
{
$html = '';
// If we try to update the settings
if (Tools::isSubmit('submitModule')) {
Configuration::updateValue('blockcontact_telnumber', Tools::getValue('telnumber'));
Configuration::updateValue('blockcontact_email', Tools::getValue('email'));
$html .= '<div class="confirm">' . $this->l('Configuration updated') . '</div>';
}
$html .= '
<h2>' . $this->displayName . '</h2>
<form action="' . Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']) . '" method="post">
<fieldset>
<label for="telnumber">' . $this->l('Telephone number:') . '</label>
<input type="text" id="telnumber" name="telnumber" value="' . (Configuration::get('blockcontact_telnumber') != '' ? Tools::safeOutput(Configuration::get('blockcontact_telnumber')) : '') . '" />
<div class="clear"> </div>
<label for="email">' . $this->l('Email:') . '</label>
<input type="text" id="email" name="email" value="' . (Configuration::get('blockcontact_email') != '' ? Tools::safeOutput(Configuration::get('blockcontact_email')) : '') . '" />
<div class="clear"> </div>
<div class="margin-form">
<input type="submit" name="submitModule" value="' . $this->l('Update settings') . '" class="button" /></center>
</div>
</fieldset>
</form>';
return $html;
}
示例3: getContent
public function getContent()
{
$output = '<h2>' . $this->displayName . '</h2>';
if (Tools::isSubmit('submitBlockRss')) {
$urlfeed = strval(Tools::getValue('urlfeed'));
$title = strval(Tools::getValue('title'));
$nbr = intval(Tools::getValue('nbr'));
if ($urlfeed and !Validate::isUrl($urlfeed)) {
$errors[] = $this->l('Invalid feed URL');
} elseif (!$title or empty($title) or !Validate::isGenericName($title)) {
$errors[] = $this->l('Invalid title');
} elseif (!$nbr or $nbr <= 0 or !Validate::isInt($nbr)) {
$errors[] = $this->l('Invalid number of feeds');
} else {
Configuration::updateValue('RSS_FEED_URL', $urlfeed);
Configuration::updateValue('RSS_FEED_TITLE', $title);
Configuration::updateValue('RSS_FEED_NBR', $nbr);
}
if (isset($errors) and sizeof($errors)) {
$output .= $this->displayError(implode('<br />', $errors));
} else {
$output .= $this->displayConfirmation($this->l('Settings updated'));
}
}
return $output . $this->displayForm();
}
示例4: getContent
public function getContent()
{
$output = '';
$errors = array();
if (Tools::isSubmit('submitHomeFeatured')) {
$nbr = Tools::getValue('HOME_FEATURED_NBR');
if (!Validate::isInt($nbr) || $nbr <= 0) {
$errors[] = $this->l('The number of products is invalid. Please enter a positive number.');
}
$cat = Tools::getValue('HOME_FEATURED_CAT');
if (!Validate::isInt($cat) || $cat <= 0) {
$errors[] = $this->l('The category ID is invalid. Please choose an existing category ID.');
}
$rand = Tools::getValue('HOME_FEATURED_RANDOMIZE');
if (!Validate::isBool($rand)) {
$errors[] = $this->l('Invalid value for the "randomize" flag.');
}
if (isset($errors) && count($errors)) {
$output = $this->displayError(implode('<br />', $errors));
} else {
Configuration::updateValue('HOME_FEATURED_NBR', (int) $nbr);
Configuration::updateValue('HOME_FEATURED_CAT', (int) $cat);
Configuration::updateValue('HOME_FEATURED_RANDOMIZE', (bool) $rand);
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('homefeatured.tpl'));
$output = $this->displayConfirmation($this->l('Your settings have been updated.'));
}
}
return $output . $this->renderForm();
}
示例5: getContent
public function getContent()
{
if (Tools::isSubmit('updatePositions')) {
$this->updatePositionsDnd();
}
$helper = new HelperList();
// Obligatoire
$helper->shopLinkType = '';
// Obligatoire. Correspondant souvent à id_*
$helper->identifier = 'id_example_data';
// Permet de ne pas afficher le header complet.
$helper->simple_header = true;
//
$helper->module = $this;
// Important.
$helper->token = Tools::getAdminTokenLite('AdminModules');
// Permet de définir le champ sur lequel est associé les positions.
$helper->position_identifier = 'position';
// Si utilisation des positions, obligatoire.
$helper->orderBy = 'position';
$helper->orderWay = 'ASC';
// Permet de définir l'ID de la table. Le terme "module-" en préfixe est TRES important.
$helper->table_id = 'module-helperlist_positions';
// Ou encore
$helper->table_id = 'module-' . $this->name;
// Permet de récupérer les champs/headers de la liste. On passe par une méthode, par lisitibilité du code.
$fields_list = $this->getListHeader();
// Permet de récupérer les enregistrements/lignes de la liste. On passe par une méthode, par lisibilité du code.
$values = $this->getListValues();
return $helper->generateList($values, $fields_list);
}
示例6: postProcess
public function postProcess()
{
global $cookie;
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
if (Tools::isSubmit('submitAdd' . $this->table)) {
if ($id_category = intval(Tools::getValue('id_category'))) {
if (!Category::checkBeforeMove($id_category, intval(Tools::getValue('id_parent')))) {
$this->_errors[] = Tools::displayError('category cannot be moved here');
return false;
}
// Updating customer's group
if ($this->tabAccess['edit'] !== '1') {
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
} else {
$object = new $this->className($id_category);
if (Validate::isLoadedObject($object)) {
$object->updateGroup(Tools::getValue('groupBox'));
} else {
$this->_errors[] = Tools::displayError('an error occurred while updating object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
}
}
}
parent::postProcess();
}
示例7: getContent
public function getContent()
{
$output = '';
$errors = array();
if (Tools::isSubmit('submitBlockTags')) {
$tagsNbr = Tools::getValue('BLOCKTAGS_NBR');
if (!strlen($tagsNbr)) {
$errors[] = $this->l('Please complete the "Displayed tags" field.');
} elseif (!Validate::isInt($tagsNbr) || (int) $tagsNbr <= 0) {
$errors[] = $this->l('Invalid number.');
}
$tagsLevels = Tools::getValue('BLOCKTAGS_MAX_LEVEL');
if (!strlen($tagsLevels)) {
$errors[] = $this->l('Please complete the "Tag levels" field.');
} elseif (!Validate::isInt($tagsLevels) || (int) $tagsLevels <= 0) {
$errors[] = $this->l('Invalid value for "Tag levels". Choose a positive integer number.');
}
$randomize = Tools::getValue('BLOCKTAGS_RANDOMIZE');
if (!strlen($randomize)) {
$errors[] = $this->l('Please complete the "Randomize" field.');
} elseif (!Validate::isBool($randomize)) {
$errors[] = $this->l('Invalid value for "Randomize". It has to be a boolean.');
}
if (count($errors)) {
$output = $this->displayError(implode('<br />', $errors));
} else {
Configuration::updateValue('BLOCKTAGS_NBR', (int) $tagsNbr);
Configuration::updateValue('BLOCKTAGS_MAX_LEVEL', (int) $tagsLevels);
Configuration::updateValue('BLOCKTAGS_RANDOMIZE', (bool) $randomize);
$output = $this->displayConfirmation($this->l('Settings updated'));
}
}
return $output . $this->renderForm();
}
示例8: preProcess
public function preProcess()
{
parent::preProcess();
$this->id_cart = (int) Tools::getValue('id_cart', 0);
/* check if the cart has been made by a Guest customer, for redirect link */
if (Cart::isGuestCartByCartId($this->id_cart)) {
$redirectLink = 'guest-tracking.php';
} else {
$redirectLink = 'history.php';
}
$this->id_module = (int) Tools::getValue('id_module', 0);
$this->id_order = Order::getOrderByCartId((int) $this->id_cart);
$this->secure_key = Tools::getValue('key', false);
if (!$this->id_order or !$this->id_module or !$this->secure_key or empty($this->secure_key)) {
Tools::redirect($redirectLink . (Tools::isSubmit('slowvalidation') ? '?slowvalidation' : ''));
}
$order = new Order((int) $this->id_order);
if (!Validate::isLoadedObject($order) or $order->id_customer != self::$cookie->id_customer or $this->secure_key != $order->secure_key) {
Tools::redirect($redirectLink);
}
$module = Module::getInstanceById((int) $this->id_module);
if ($order->payment != $module->displayName) {
Tools::redirect($redirectLink);
}
}
示例9: postProcess
/**
* Start forms process.
*
* @see FrontController::postProcess()
*/
public function postProcess()
{
$order_reference = current(explode('#', Tools::getValue('order_reference')));
$email = Tools::getValue('email');
if (!$email && !$order_reference) {
return;
} elseif (!$email || !$order_reference) {
$this->errors[] = $this->getTranslator()->trans('Please provide the required information', array(), 'Shop.Notifications.Error');
return;
}
$isCustomer = Customer::customerExists($email, false, true);
if ($isCustomer) {
$this->info[] = $this->trans('Please log in to your customer account to view the order', array(), 'Shop.Notifications.Info');
$this->redirectWithNotifications($this->context->link->getPageLink('history'));
} else {
$this->order = Order::getByReferenceAndEmail($order_reference, $email);
if (!Validate::isLoadedObject($this->order)) {
$this->errors[] = $this->getTranslator()->trans('We couldn\'t find your order with the information provided, please try again', array(), 'Shop.Notifications.Error');
}
}
if (Tools::isSubmit('submitTransformGuestToCustomer') && Tools::getValue('password')) {
$customer = new Customer((int) $this->order->id_customer);
$password = Tools::getValue('password');
if (strlen($password) < Validate::PASSWORD_LENGTH) {
$this->errors[] = $this->trans('Your password must be at least %min% characters long.', array('%min%' => Validate::PASSWORD_LENGTH), 'Shop.Forms.Help');
} elseif ($customer->transformToCustomer($this->context->language->id, $password)) {
$this->success[] = $this->trans('Your guest account has been successfully transformed into a customer account. You can now log in as a registered shopper.', array(), 'Shop.Notifications.Success');
} else {
$this->success[] = $this->trans('An unexpected error occurred while creating your account.', array(), 'Shop.Notifications.Error');
}
}
}
示例10: getContent
/**
* Prestashop config page
*/
public function getContent()
{
global $smarty;
$errors = array();
if (Tools::isSubmit('submitMtgox')) {
foreach ($this->getConfigFields() as $field) {
$field_val = Tools::getValue(strtolower($field['config_name']));
if (isset($field['empty']) and $field['empty'] == false) {
if ($field_val != '0' and empty($field_val)) {
$errors[] = $this->l($field['display_name'] . ' field cannot be empty');
continue;
}
}
if (isset($field['boolean']) and $field['boolean'] == true) {
if (!in_array($field_val, array('0', '1'))) {
$errors[] = $this->l($field['display_name'] . ' field must be a string containing 0 or 1');
continue;
}
}
Configuration::updateValue($field['config_name'], $field_val);
}
if (!$errors) {
// Retro 1.4
global $currentIndex;
$curr_index = Tools::property_exists('AdminController', 'currentIndex') ? AdminController::$currentIndex : $currentIndex;
Tools::redirectAdmin($curr_index . '&configure=mtgox&token=' . Tools::safeOutput(Tools::getValue('token')) . '&conf=4');
}
}
$smarty->assign(array('displayName' => $this->displayName, 'requestUrl' => Tools::safeOutput($_SERVER['REQUEST_URI']), 'merchantId' => Tools::safeOutput(Tools::getValue('mtgox_merchant_id', Configuration::get('MTGOX_MERCHANT_ID'))), 'apiKey' => Tools::safeOutput(Tools::getValue('mtgox_api_key', Configuration::get('MTGOX_API_KEY'))), 'apiSecretKey' => Tools::safeOutput(Tools::getValue('mtgox_api_secret_key', Configuration::get('MTGOX_API_SECRET_KEY'))), 'paymentDescription' => Tools::safeOutput(Tools::getValue('mtgox_payment_description', Configuration::get('MTGOX_PAYMENT_DESCRIPTION'))), 'autosell' => Tools::safeOutput(Tools::getValue('mtgox_autosell', Configuration::get('MTGOX_AUTOSELL'))), 'email' => Tools::safeOutput(Tools::getValue('mtgox_email_on_success', Configuration::get('MTGOX_EMAIL_ON_SUCCESS'))), 'instantonly' => Tools::safeOutput(Tools::getValue('mtgox_instant_only', Configuration::get('MTGOX_INSTANT_ONLY'))), 'submit' => Tools::isSubmit('submitMtgox'), 'errors' => $errors));
return $this->display(__FILE__, 'views/templates/back/configure.tpl');
}
示例11: postProcess
public function postProcess()
{
${"GLOBALS"}["blpimnned"] = "id_order_seller";
$dbodbxes = "id_order";
${${"GLOBALS"}["qusrvgm"]} = (int) Tools::getValue("id_order");
if (!$this->context->customer->isLogged() && !Tools::getValue("secure_key")) {
Tools::redirect("index.php?controller=authentication&back=my-account");
}
${"GLOBALS"}["tvasln"] = "id_order";
$jpdhpfqcj = "id_order";
if (!(int) Configuration::get("PS_INVOICE")) {
die(Tools::displayError("Invoices are disabled in this shop."));
}
if (isset(${${"GLOBALS"}["qusrvgm"]}) && Validate::isUnsignedId(${$dbodbxes})) {
${${"GLOBALS"}["ymjzko"]} = new Order(${$jpdhpfqcj});
}
if (!isset(${${"GLOBALS"}["ymjzko"]}) || !Validate::isLoadedObject(${${"GLOBALS"}["ymjzko"]})) {
die(Tools::displayError("Invoice not found"));
}
${${"GLOBALS"}["vewtbt"]} = AgileSellerManager::getObjectOwnerID("order", ${${"GLOBALS"}["tvasln"]});
${${"GLOBALS"}["sokafjqdei"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id);
if (${${"GLOBALS"}["blpimnned"]} != ${${"GLOBALS"}["sokafjqdei"]}) {
die(Tools::displayError("You do not have permission to see this invoice"));
}
if (Tools::isSubmit("secure_key") && $order->secure_key != Tools::getValue("secure_key")) {
die(Tools::displayError("You do not have permission to see this invoice"));
}
if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) {
die(Tools::displayError("No invoice available"));
}
$this->order = ${${"GLOBALS"}["ymjzko"]};
}
示例12: getContent
public function getContent()
{
global $cookie;
$html = '
<h2>' . $this->l('Payment logo') . '</h2>
';
if (Tools::isSubmit('submitConfiguration')) {
if (Validate::isUnsignedInt(Tools::getValue('id_cms'))) {
Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', intval(Tools::getValue('id_cms')));
$html .= $this->displayConfirmation($this->l('Settings are updated'));
}
}
$cmss = CMS::listCms(intval($cookie->id_lang));
if (!sizeof($cmss)) {
$html .= $this->displayError($this->l('No CMS page is available'));
} else {
$html .= '
<form action="' . $_SERVER['REQUEST_URI'] . '" method="post">
<fieldset>
<legend><img src="' . $this->_path . '/logo.gif" alt="" /> ' . $this->l('Configure') . '</legend>
<label>' . $this->l('Page CMS for link') . ':</label>
<div class="margin-form">
<select name="id_cms">';
foreach ($cmss as $cms) {
$html .= '<option value="' . $cms['id_cms'] . '"' . (Configuration::get('PS_PAYMENT_LOGO_CMS_ID') == $cms['id_cms'] ? ' selected="selected"' : '') . '>' . $cms['meta_title'] . '</option>';
}
$html .= '</select>
</div>
<p class="center"><input class="button" type="submit" name="submitConfiguration" value="' . $this->l('Save settings') . '" /></p>
</fieldset>
</form>
';
}
return $html;
}
示例13: getContent
public function getContent()
{
$html = '
<h2>' . $this->l('Payment logo.') . '</h2>
';
if (Tools::isSubmit('submitConfiguration')) {
if (Validate::isUnsignedInt(Tools::getValue('id_cms'))) {
Configuration::updateValue('PS_PAYMENT_LOGO_CMS_ID', (int) Tools::getValue('id_cms'));
$this->_clearCache('blockpaymentlogo.tpl');
$html .= $this->displayConfirmation($this->l('The settings have been updated.'));
}
}
$cmss = CMS::listCms($this->context->language->id);
if (!count($cmss)) {
$html .= $this->displayError($this->l('No CMS page is available.'));
} else {
$html .= '
<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">
<fieldset>
<legend><img src="' . $this->_path . '/logo.gif" alt="" /> ' . $this->l('Configure') . '</legend>
<label>' . $this->l('Page CMS for link') . ':</label>
<div class="margin-form">
<select name="id_cms"><option value="0">(' . $this->l('Select a page') . ')</option>';
foreach ($cmss as $cms) {
$html .= '<option value="' . $cms['id_cms'] . '"' . (Configuration::get('PS_PAYMENT_LOGO_CMS_ID') == $cms['id_cms'] ? ' selected="selected"' : '') . '>' . $cms['meta_title'] . '</option>';
}
$html .= '</select>
</div>
<p class="center"><input class="button" type="submit" name="submitConfiguration" value="' . $this->l('Save settings') . '" /></p>
</fieldset>
</form>
';
}
return $html;
}
示例14: postProcess
protected function postProcess()
{
$errors = '';
if (Tools::isSubmit('deleteImage')) {
if (!file_exists(dirname(__FILE__) . '/img/' . $this->_getUserImg())) {
$errors .= $this->displayError($this->l('This action cannot be taken.'));
} else {
unlink(dirname(__FILE__) . '/img/' . $this->_getUserImg());
Tools::redirectAdmin('index.php?tab=AdminModules&conf=4&configure=' . $this->name . '&token=' . Tools::getAdminToken('AdminModules' . (int) Tab::getIdFromClassName('AdminModules') . (int) $this->context->employee->id));
}
}
if (Tools::isSubmit('submitUpdateScrolltop')) {
if (isset($_FILES['image']) && $_FILES['image']['error'] == 0) {
if ($error = ImageManager::validateUpload($_FILES['image'])) {
$errors .= $this->displayError($error);
} elseif (!ImageManager::resize($_FILES['image']['tmp_name'], dirname(__FILE__) . '/img/' . $this->_getUserImg())) {
$errors .= $this->displayError($this->l('An error occurred during the image upload.'));
}
}
foreach ($this->_scrollParams as $param => $value) {
if ($val = (int) Tools::getValue($param)) {
$this->_setScrollParam($param, $val);
} else {
$errors .= $this->displayError($this->l('"' . $param . '" is not valid.'));
}
}
if (!$errors) {
Tools::redirectAdmin('index.php?tab=AdminModules&conf=4&configure=' . $this->name . '&token=' . Tools::getAdminToken('AdminModules' . (int) Tab::getIdFromClassName('AdminModules') . (int) $this->context->employee->id));
}
}
$this->_html .= $errors;
}
示例15: preProcess
public function preProcess()
{
if (!Tools::hasFunction('admin_list')) {
Tools::redirect('index.php');
}
$this->brandNavi[] = array("name" => "Admin List", "url" => $this->php_self);
$idList = $_POST['idlist'] == '' ? '' : $_POST['idlist'];
if (Tools::isSubmit("delete")) {
if (is_array($idList)) {
foreach ($idList as $aid) {
Member::DeleteMember($aid);
}
}
exit;
} else {
if (Tools::isSubmit("del_permanent")) {
if (is_array($idList)) {
foreach ($idList as $aid) {
Member::DeleteMemberPermanent($aid);
}
}
exit;
} else {
if (Tools::isSubmit("undel")) {
if (is_array($idList)) {
foreach ($idList as $aid) {
Member::UnDeleteMember($aid);
}
}
exit;
}
}
}
}