本文整理汇总了PHP中Newsletter::write方法的典型用法代码示例。如果您正苦于以下问题:PHP Newsletter::write方法的具体用法?PHP Newsletter::write怎么用?PHP Newsletter::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newsletter
的用法示例。
在下文中一共展示了Newsletter::write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newDraft
static function newDraft($parentID, $subject, $content)
{
if (is_numeric($parentID)) {
$newsletter = new Newsletter();
$newsletter->Status = 'Draft';
$newsletter->Title = $newsletter->Subject = $subject;
$newsletter->ParentID = $parentID;
$newsletter->Content = $content;
$newsletter->write();
} else {
user_error($parentID, E_USER_ERROR);
}
return $newsletter;
}
示例2: newDraft
private function newDraft($parentID)
{
if (!$parentID || !is_numeric($parentID)) {
$parent = DataObject::get_one("NewsletterType");
if ($parent) {
$parentID = $parent->ID;
} else {
// BUGFIX: It could be that no Newsletter types have been created, if so add one to prevent errors.
$parentID = $this->newNewsletterType();
}
}
if ($parentID && is_numeric($parentID)) {
$parent = DataObject::get_by_id("NewsletterType", $parentID);
// BUGFIX: It could be that no Newsletter types have been created, if so add one to prevent errors.
if (!$parent) {
$parentID = $this->newNewsletterType();
}
$newsletter = new Newsletter();
$newsletter->Status = 'Draft';
$newsletter->Title = $newsletter->Subject = _t('NewsletterAdmin.MEWDRAFTMEWSL', 'New draft newsletter');
$newsletter->ParentID = $parentID;
$newsletter->write();
} else {
user_error("You must first create a newsletter type before creating a draft", E_USER_ERROR);
}
return $newsletter->ID;
}