如何设置最小/最大日期添加默认值并禁用管理网格格式化的未来/通过日期

时间:2016-06-02 03:22:28

标签: php magento datetime

我可以在自定义管理网格上的$this->getMassactionBlock()->addItem('setdate', array( 'label' => $this->__('Set Date'), 'url' => $this->getUrl('*/*/massSetdate', array('' => '')), 'confirm' => $this->__('Are you sure?'), 'additional' => array( 'setmaxdate' => array( 'name' => 'setmaxdate', 'time' => true, 'input' => 'datetime', 'type' => 'datetime', 'class' => 'required-entry', 'label' => Mage::helper('setcustomdate')->__('Set Max Date'), //'gmtoffset' => true, 'image' => '/skin/adminhtml/default/default/images/grid-cal.gif', 'format' => 'yyyy-MM-dd H:mm:ss' ) ) )); 日期设置最小/最大(今天),并禁用在未来/通过时单击日期,如果用户不想选择,则立即设置为默认值?

我的代码现在如下:

function user_content_replace($content) {

$sentences_per_paragraph = 3; // settings

$pattern = '~(?<=[.?!…])\s+~'; // some punctuation and trailing space(s)

$sentences_array = preg_split($pattern, $content, -1, PREG_SPLIT_NO_EMPTY); // get sentences into array

$sentences_count = count($sentences_array); // count sentences

$output = ''; // new content init

// see PHP modulus
for($i = 0; $i < $sentences_count; $i++) {
    if($i%$sentences_per_paragraph == 0 && $i == 0) { //divisible by settings and is first
        $output .= "<p>" . $sentences_array[$i] . ' '; // add paragraph and the first sentence
    } elseif($i%$sentences_per_paragraph == 0 && $i > 0) { //divisible by settings and not first
        $output .= "</p><p>" . $sentences_array[$i] . ' '; // close and open paragraph, add the first sentence
    } else {
        $output .= $sentences_array[$i] . ' '; // concatenate other sentences
    }
}

$output .= "</p>"; // close the last paragraph

echo $output;
}
add_filter('the_content','user_content_replace', 99);

0 个答案:

没有答案