本文整理汇总了PHP中Mage_Core_Model_Email_Template::setAddedAt方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Email_Template::setAddedAt方法的具体用法?PHP Mage_Core_Model_Email_Template::setAddedAt怎么用?PHP Mage_Core_Model_Email_Template::setAddedAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Email_Template
的用法示例。
在下文中一共展示了Mage_Core_Model_Email_Template::setAddedAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareSave
/**
* Prepares template for saving, validates input data
*
* @param Mage_Core_Model_Email_Template $template
* @return array
*/
protected function _prepareSave(Mage_Core_Model_Email_Template $template)
{
$data = array();
$data['template_code'] = $template->getTemplateCode();
$data['template_text'] = $template->getTemplateText();
$data['template_type'] = (int) $template->getTemplateType();
$data['template_subject'] = $template->getTemplateSubject();
$data['template_sender_name'] = $template->getTemplateSenderName();
$data['template_sender_email'] = $template->getTemplateSenderEmail();
if (!$template->getAddedAt()) {
$template->setAddedAt(AO::getSingleton('core/date')->gmtDate());
$template->setModifiedAt(AO::getSingleton('core/date')->gmtDate());
}
$data['modified_at'] = $template->getModifiedAt();
$data['added_at'] = $template->getAddedAt();
if ($this->checkCodeUsage($template)) {
AO::throwException(AO::helper('core')->__('Duplicate Of Template Code'));
}
$validators = array('template_code' => array(Zend_Filter_Input::ALLOW_EMPTY => false), 'template_type' => 'Alnum');
$validateInput = new Zend_Filter_Input(array(), $validators, $data);
if (!$validateInput->isValid()) {
$errorString = '';
foreach ($validateInput->getMessages() as $message) {
if (is_array($message)) {
foreach ($message as $str) {
$errorString .= $str . "\n";
}
} else {
$errorString .= $message . "\n";
}
}
AO::throwException($errorString);
}
return $data;
}