本文整理汇总了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;
}