本文整理汇总了PHP中Validate::isDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isDate方法的具体用法?PHP Validate::isDate怎么用?PHP Validate::isDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validate
的用法示例。
在下文中一共展示了Validate::isDate方法的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: inscription
public function inscription()
{
if (!empty($_POST)) {
$validate = new Validate($_POST);
if ($validate->isEmpty('cgu')) {
$validate->notEmpty('nom', "Veuillez entrer un nom");
$validate->notEmpty('prenom', "Veuillez entrer un prénom");
$validate->isEmail('email', "L'email n'est pas valide");
$email = $this->user->emailExist()->fetch();
$validate->isUnique('email', $email, "L'email est déjà utilisé");
$validate->doubleCheck('password', 'confirmation', "Les mot de passe ne correspondent pas");
//Router::debug($validate->error);
$validate->isVille('ville', "Votre adresse n'est pas valide");
$validate->isDate('date', 'jour', 'mois', 'année', "Votre date de naissance n'est pas valide");
if ($validate->isValid()) {
$_SESSION["inscription"] = $_POST;
$vue = new Vue("CGU", "User");
$vue->render();
} else {
$vue = new Vue("Inscription", "User");
$vue->render(['errors' => $validate->errors]);
}
} else {
$this->user->inscrireUtilisateur($_SESSION["inscription"]);
unset($_SESSION["inscription"]);
$vue = new Vue("Success", "User");
$vue->render(['msg' => "L'inscription a bien été enregistré.<br> Un email vous a été envoyé."]);
}
} else {
$vue = new Vue("Inscription", "User");
$vue->setScript('verif.js');
$vue->render();
}
}
示例3: postProcess
public function postProcess()
{
global $currentIndex;
if (Tools::getValue('submitPrint')) {
if (!Validate::isDate($_POST['date_from'])) {
$this->_errors[] = $this->l('Invalid from date');
}
if (!Validate::isDate($_POST['date_to'])) {
$this->_errors[] = $this->l('Invalid end date');
}
if (!sizeof($this->_errors)) {
$orders = Order::getOrdersIdByDate($_POST['date_from'], $_POST['date_to'], NULL, 'delivery');
if (sizeof($orders)) {
Tools::redirectAdmin('pdf.php?deliveryslips=' . urlencode(serialize($orders)) . '&token=' . $this->token);
} else {
$this->_errors[] = $this->l('No delivery slip found for this period');
}
}
} elseif (Tools::getValue('submitOptionsdelivery')) {
$next_slipnum = abs((int) Tools::getValue('PS_DELIVERY_NUMBER'));
$_POST['PS_DELIVERY_NUMBER'] = $next_slipnum;
$max_existing = abs((int) Db::getInstance()->getValue('SELECT MAX(`delivery_number`) FROM `' . _DB_PREFIX_ . 'orders`'));
if ((int) $next_slipnum < 1 || (int) $next_slipnum > 4294967295) {
$this->_errors[] = $this->l('The delivery number requires a value between 1 and 4294967295');
}
if ($max_existing && $next_slipnum <= abs((int) $max_existing)) {
$this->_errors[] = $this->l('To avoid duplicating numbers assigned to existing slips, delivery slip number must be greater than') . ' ' . $max_existing;
}
if (!count($this->_errors)) {
parent::postProcess();
}
} else {
parent::postProcess();
}
}
示例4: setTimeMode
/** @prototype void public function setTimeMode($from, $to, $granularity) */
public function setTimeMode($from, $to, $granularity)
{
$this->granularity = $granularity;
if (Validate::isDate($from)) {
$from = strtotime($from);
}
$this->from = $from;
if (Validate::isDate($to)) {
$to = strtotime($to);
}
$this->to = $to;
if ($granularity == 'd') {
$this->format = '%d/%m/%y';
}
if ($granularity == 'w') {
$this->format = '%d/%m/%y';
}
if ($granularity == 'm') {
$this->format = '%m/%y';
}
if ($granularity == 'y') {
$this->format = '%y';
}
$this->timeMode = true;
}
示例5: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitAddinvoice_date')) {
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 "To" date');
}
if (!count($this->errors)) {
if (count(OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to')))) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateInvoicesPDF&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')));
}
$this->errors[] = $this->l('No invoice has been found for this period.');
}
} elseif (Tools::isSubmit('submitAddinvoice_status')) {
if (!is_array($status_array = Tools::getValue('id_order_state')) || !count($status_array)) {
$this->errors[] = $this->l('You must select at least one order status.');
} else {
foreach ($status_array as $id_order_state) {
if (count(OrderInvoice::getByStatus((int) $id_order_state))) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateInvoicesPDF2&id_order_state=' . implode('-', $status_array));
}
}
$this->errors[] = $this->l('No invoice has been found for this status.');
}
} else {
parent::postProcess();
}
}
示例6: hookDisplayLeftColumn
public function hookDisplayLeftColumn()
{
if ($this->context->controller->php_self == 'category') {
if (Tools::isSubmit('filter_search_btn')) {
$hotel_cat_id = Tools::getValue('hotel_cat_id');
$check_in = Tools::getValue('check_in_time');
$check_out = Tools::getValue('check_out_time');
$error = false;
if ($hotel_cat_id == '') {
$error = 1;
} elseif ($check_in == '' || !Validate::isDate($check_in)) {
$error = 1;
} elseif ($check_out == '' || !Validate::isDate($check_out)) {
$error = 1;
} elseif ($check_out <= $check_in) {
$error = 1;
}
if (!$error) {
if (Configuration::get('PS_REWRITING_SETTINGS')) {
$redirect_link = $this->context->link->getCategoryLink(new Category($hotel_cat_id, $this->context->language->id), null, $this->context->language->id) . '?date_from=' . $check_in . '&date_to=' . $check_out;
} else {
$redirect_link = $this->context->link->getCategoryLink(new Category($hotel_cat_id, $this->context->language->id), null, $this->context->language->id) . '&date_from=' . $check_in . '&date_to=' . $check_out;
}
} else {
if (Configuration::get('PS_REWRITING_SETTINGS')) {
$redirect_link = $this->context->link->getCategoryLink(new Category($hotel_cat_id, $this->context->language->id), null, $this->context->language->id) . '?error=' . $error;
} else {
$redirect_link = $this->context->link->getCategoryLink(new Category($hotel_cat_id, $this->context->language->id), null, $this->context->language->id) . '&error=' . $error;
}
}
Tools::redirect($redirect_link);
}
if (Tools::getValue('error')) {
$this->context->smarty->assign('error', Tools::getValue('error'));
}
$location_enable = Configuration::get('WK_HOTEL_LOCATION_ENABLE');
$hotel_branch_obj = new HotelBranchInformation();
$htl_id_category = Tools::getValue('id_category');
$category = new Category((int) $htl_id_category);
$parent_dtl = $hotel_branch_obj->getCategoryDataByIdCategory((int) $category->id_parent);
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
$date_to = date('Y-m-d', strtotime($date_from) + 86400);
}
if (!($date_to = Tools::getValue('date_to'))) {
$date_to = date('Y-m-d', strtotime($date_from) + 86400);
}
$search_data['parent_data'] = $parent_dtl;
$search_data['date_from'] = $date_from;
$search_data['date_to'] = $date_to;
$search_data['htl_dtl'] = $hotel_branch_obj->hotelBranchInfoById(HotelBranchInformation::getHotelIdByIdCategory($htl_id_category));
$hotel_info = $hotel_branch_obj->getActiveHotelBranchesInfo();
$this->context->smarty->assign(array('search_data' => $search_data, 'all_hotels_info' => $hotel_info, 'location_enable' => $location_enable));
$this->context->controller->addCSS(_PS_MODULE_DIR_ . $this->name . '/views/css/wkhotelfiltersearchblock.css');
return $this->display(__FILE__, 'htlfiltersearchblock.tpl');
}
}
示例7: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
if (Tools::isSubmit('submitDatePicker')) {
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) or !Validate::isDate($to = Tools::getValue('datepickerTo'))) {
$this->_errors[] = Tools::displayError('Date specified is invalid');
}
}
if (Tools::isSubmit('submitDateDay')) {
$from = date('Y-m-d');
$to = date('Y-m-d');
}
if (Tools::isSubmit('submitDateDayPrev')) {
$yesterday = time() - 60 * 60 * 24;
$from = date('Y-m-d', $yesterday);
$to = date('Y-m-d', $yesterday);
}
if (Tools::isSubmit('submitDateMonth')) {
$from = date('Y-m-01');
$to = date('Y-m-t');
}
if (Tools::isSubmit('submitDateMonthPrev')) {
$m = date('m') == 1 ? 12 : date('m') - 1;
$y = $m == 12 ? date('Y') - 1 : date('Y');
$from = $y . '-' . $m . '-01';
$to = $y . '-' . $m . date('-t', mktime(12, 0, 0, $m, 15, $y));
}
if (Tools::isSubmit('submitDateYear')) {
$from = date('Y-01-01');
$to = date('Y-12-31');
}
if (Tools::isSubmit('submitDateYearPrev')) {
$from = date('Y') - 1 . date('-01-01');
$to = date('Y') - 1 . date('-12-31');
}
if (isset($from) and isset($to) and !sizeof($this->_errors)) {
$employee = new Employee($cookie->id_employee);
$employee->stats_date_from = $from;
$employee->stats_date_to = $to;
$employee->update();
Tools::redirectAdmin($_SERVER['REQUEST_URI']);
}
if (Tools::getValue('submitSettings')) {
if ($this->tabAccess['edit'] === '1') {
$currentIndex .= '&module=' . Tools::getValue('module');
$this->_postConfig($this->_fieldsSettings);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
}
if (sizeof($this->_errors)) {
AdminTab::displayErrors();
}
}
示例8: hookDisplayHeader
public function hookDisplayHeader()
{
$is_hotel_room_search = Tools::getValue('is_hotel_rooms_search');
if (isset($is_hotel_room_search) && $is_hotel_room_search) {
$hotel_cat_id = Tools::getValue('hotel_cat_id');
$check_in = Tools::getValue('check_in_time');
$check_out = Tools::getValue('check_out_time');
$error = false;
if ($hotel_cat_id == '') {
$error = 1;
} elseif ($check_in == '' || !Validate::isDate($check_in)) {
$error = 2;
} elseif ($check_out == '' || !Validate::isDate($check_out)) {
$error = 3;
} elseif ($check_out <= $check_in) {
$error = 4;
}
if (!$error) {
if (Configuration::get('PS_REWRITING_SETTINGS')) {
$redirect_link = $this->context->link->getCategoryLink(new Category($hotel_cat_id, $this->context->language->id), null, $this->context->language->id) . '?date_from=' . $check_in . '&date_to=' . $check_out;
} else {
$redirect_link = $this->context->link->getCategoryLink(new Category($hotel_cat_id, $this->context->language->id), null, $this->context->language->id) . '&date_from=' . $check_in . '&date_to=' . $check_out;
}
Tools::redirect($redirect_link);
} else {
if (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) {
Tools::redirect($protocol_link . Tools::getShopDomainSsl() . __PS_BASE_URI__ . "index.php?error=" . $error);
} else {
Tools::redirect(_PS_BASE_URL_ . __PS_BASE_URI__ . "index.php?error=" . $error);
}
}
}
$location_enable = Configuration::get('WK_HOTEL_LOCATION_ENABLE');
$hotel_branch_obj = new HotelBranchInformation();
$hotel_info = $hotel_branch_obj->getActiveHotelBranchesInfo();
$this->context->smarty->assign('hotel_name', $hotel_info);
$this->context->smarty->assign('header_block_title', Configuration::get('WK_TITLE_HEADER_BLOCK'));
$this->context->smarty->assign('header_block_content', Configuration::get('WK_CONTENT_HEADER_BLOCK'));
$this->context->smarty->assign('location_enable', $location_enable);
$this->context->controller->addJqueryUI(array('ui.datepicker'));
$this->context->controller->addCSS(_PS_MODULE_DIR_ . $this->name . '/views/css/searchblock.css');
$this->context->controller->addJS(_PS_MODULE_DIR_ . $this->name . '/views/js/wksearchblock.js');
}
示例9: postProcess
public function postProcess()
{
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)) {
$orderSlips = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
if (count($orderSlips)) {
Tools::redirectAdmin('pdf.php?slips&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')) . '&token=' . $this->token);
}
$this->_errors[] = $this->l('No order slips found for this period');
}
}
return parent::postProcess();
}
示例10: postProcess
public function postProcess()
{
if (Tools::getValue('submitAddorder_slip')) {
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 "To" date');
}
if (!count($this->errors)) {
$order_slips = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
if (count($order_slips)) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateOrderSlipsPDF&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')));
}
$this->errors[] = $this->l('No order slips were found for this period.');
}
} else {
return parent::postProcess();
}
}
示例11: postProcess
public function postProcess()
{
if (Tools::isSubmit('submitAdddelivery')) {
if (!Validate::isDate(Tools::getValue('date_from'))) {
$this->errors[] = Tools::displayError('Invalid \'from\' date');
}
if (!Validate::isDate(Tools::getValue('date_to'))) {
$this->errors[] = Tools::displayError('Invalid \'to\' date');
}
if (!count($this->errors)) {
if (count(OrderInvoice::getByDeliveryDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to')))) {
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf') . '&submitAction=generateDeliverySlipsPDF&date_from=' . urlencode(Tools::getValue('date_from')) . '&date_to=' . urlencode(Tools::getValue('date_to')));
} else {
$this->errors[] = Tools::displayError('No delivery slip was found for this period.');
}
}
} else {
parent::postProcess();
}
}
示例12: postProcess
public function postProcess()
{
global $currentIndex;
if (Tools::getValue('submitPrint')) {
if (!Validate::isDate($_POST['date_from'])) {
$this->_errors[] = $this->l('Invalid from date');
}
if (!Validate::isDate($_POST['date_to'])) {
$this->_errors[] = $this->l('Invalid end date');
}
if (!sizeof($this->_errors)) {
$orders = Order::getOrdersIdInvoiceByDate($_POST['date_from'], $_POST['date_to'], NULL, 'invoice');
if (sizeof($orders)) {
Tools::redirectAdmin('pdf.php?invoices&date_from=' . urlencode($_POST['date_from']) . '&date_to=' . urlencode($_POST['date_to']) . '&token=' . $this->token);
}
$this->_errors[] = $this->l('No invoice found for this period');
}
} else {
parent::postProcess();
}
}
示例13: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
if (Tools::isSubmit('submitDatePicker')) {
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) or !Validate::isDate($to = Tools::getValue('datepickerTo'))) {
$this->_errors[] = Tools::displayError('date specified not valid');
}
}
if (Tools::isSubmit('submitDateToday')) {
$from = date('Y-m-d');
$to = date('Y-m-d');
}
if (Tools::isSubmit('submitDateMonth')) {
$from = date('Y-m-01');
$to = date('Y-m-t');
}
if (Tools::isSubmit('submitDateYear')) {
$from = date('Y-01-01');
$to = date('Y-12-31');
}
if (isset($from) and isset($to) and !sizeof($this->_errors)) {
$employee = new Employee($cookie->id_employee);
$employee->stats_date_from = $from;
$employee->stats_date_to = $to;
$employee->update();
Tools::redirectAdmin($_SERVER['REQUEST_URI']);
}
if (Tools::getValue('submitSettings')) {
if ($this->tabAccess['edit'] === '1') {
$currentIndex .= '&module=' . Tools::getValue('module');
$this->_postConfig($this->_fieldsSettings);
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit something here.');
}
}
if (sizeof($this->_errors)) {
AdminTab::displayErrors();
}
}
示例14: update
public function update($null_values = false)
{
$this->birthday = empty($this->years) ? $this->birthday : (int) $this->years . '-' . (int) $this->months . '-' . (int) $this->days;
if ($this->newsletter && !Validate::isDate($this->newsletter_date_add)) {
$this->newsletter_date_add = date('Y-m-d H:i:s');
}
if (isset(Context::getContext()->controller) && Context::getContext()->controller->controller_type == 'admin') {
$this->updateGroup($this->groupBox);
}
if ($this->deleted) {
$addresses = $this->getAddresses((int) Configuration::get('PS_LANG_DEFAULT'));
foreach ($addresses as $address) {
$obj = new Address((int) $address['id_address']);
$obj->delete();
}
}
// start of implementation of the module code - taxamo
$taxamo_iso_country_residence = Tools::getValue('taxamoisocountryresidence');
$taxamo_cc_prefix = Tools::getValue('taxamoccprefix');
Taxamoeuvat::updateCCPrefix($this->id, $taxamo_iso_country_residence, $taxamo_cc_prefix);
// end of code implementation module - taxamo
return parent::update(true);
}
示例15: processDateRange
public function processDateRange()
{
if (Tools::isSubmit('submitDatePicker')) {
if (!Validate::isDate($from = Tools::getValue('datepickerFrom')) || !Validate::isDate($to = Tools::getValue('datepickerTo')) || strtotime($from) > strtotime($to)) {
$this->errors[] = Tools::displayError('The specified date is invalid.');
}
}
if (Tools::isSubmit('submitDateDay')) {
$from = date('Y-m-d');
$to = date('Y-m-d');
}
if (Tools::isSubmit('submitDateDayPrev')) {
$yesterday = time() - 60 * 60 * 24;
$from = date('Y-m-d', $yesterday);
$to = date('Y-m-d', $yesterday);
}
if (Tools::isSubmit('submitDateMonth')) {
$from = date('Y-m-01');
$to = date('Y-m-t');
}
if (Tools::isSubmit('submitDateMonthPrev')) {
$m = date('m') == 1 ? 12 : date('m') - 1;
$y = $m == 12 ? date('Y') - 1 : date('Y');
$from = $y . '-' . $m . '-01';
$to = $y . '-' . $m . date('-t', mktime(12, 0, 0, $m, 15, $y));
}
if (Tools::isSubmit('submitDateYear')) {
$from = date('Y-01-01');
$to = date('Y-12-31');
}
if (Tools::isSubmit('submitDateYearPrev')) {
$from = date('Y') - 1 . date('-01-01');
$to = date('Y') - 1 . date('-12-31');
}
if (isset($from) && isset($to) && !count($this->errors)) {
$this->context->employee->stats_date_from = $from;
$this->context->employee->stats_date_to = $to;
$this->context->employee->update();
if (!$this->isXmlHttpRequest()) {
Tools::redirectAdmin($_SERVER['REQUEST_URI']);
}
}
}