本文整理匯總了PHP中ilFormat::checkDecimal方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilFormat::checkDecimal方法的具體用法?PHP ilFormat::checkDecimal怎麽用?PHP ilFormat::checkDecimal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilFormat
的用法示例。
在下文中一共展示了ilFormat::checkDecimal方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: saveCouponForm
public function saveCouponForm()
{
$this->error = '';
if ($_POST['title'] == '') {
$this->error .= 'paya_coupons_title,';
}
if ($_POST['coupon_type'] == '') {
$this->error .= 'paya_coupons_type,';
}
if ($_POST['coupon_value'] == '') {
$this->error .= 'paya_coupons_value,';
} else {
$_POST['coupon_value'] = ilFormat::checkDecimal($_POST['coupon_value']);
}
$this->coupon_obj->setId($_GET['coupon_id']);
$this->coupon_obj->setCouponUser($this->user_obj->getId());
$this->coupon_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
$this->coupon_obj->setDescription(ilUtil::stripSlashes($_POST['description']));
$this->coupon_obj->setType(ilUtil::stripSlashes($_POST['coupon_type']));
$this->coupon_obj->setValue(ilUtil::stripSlashes($_POST['coupon_value']));
$this->coupon_obj->setFromDate(date("Y-m-d", mktime(0, 0, 0, $_POST['from']['date']['m'], $_POST['from']['date']['d'], $_POST['from']['date']['y'])));
$this->coupon_obj->setTillDate(date("Y-m-d", mktime(0, 0, 0, $_POST['til']['date']['m'], $_POST['til']['date']['d'], $_POST['til']['date']['y'])));
// $this->coupon_obj->setFromDateEnabled(ilUtil::stripSlashes($_POST['from_check']));
//$this->coupon_obj->setTillDateEnabled(ilUtil::stripSlashes($_POST['until_check']));
$this->coupon_obj->setFromDateEnabled($_POST['from_check']);
$this->coupon_obj->setTillDateEnabled($_POST['until_check']);
$this->coupon_obj->setUses((int) ilUtil::stripSlashes($_POST['usage']));
$this->coupon_obj->setChangeDate(date('Y-m-d H:i:s'));
if ($this->error == '') {
if ($_GET['coupon_id'] != "") {
$this->coupon_obj->update();
} else {
$_GET['coupon_id'] = $this->coupon_obj->add();
}
ilUtil::sendInfo($this->lng->txt('saved_successfully'));
} else {
if (is_array($e = explode(',', $this->error))) {
$mandatory = '';
for ($i = 0; $i < count($e); $i++) {
$e[$i] = trim($e[$i]);
if ($e[$i] != '') {
$mandatory .= $this->lng->txt($e[$i]);
if (array_key_exists($i + 1, $e) && $e[$i + 1] != '') {
$mandatory .= ', ';
}
}
}
ilUtil::sendInfo($this->lng->txt('fill_out_all_required_fields') . ': ' . $mandatory);
}
}
$this->addCoupon();
return true;
}