本文整理汇总了PHP中Forum::publish方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::publish方法的具体用法?PHP Forum::publish怎么用?PHP Forum::publish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::publish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requireDefaultRecords
/**
* Add default records to database
*
* This function is called whenever the database is built, after the
* database tables have all been created.
*/
public function requireDefaultRecords()
{
parent::requireDefaultRecords();
$code = "ACCESS_FORUM";
if (!($forumGroup = DataObject::get_one("Group", "\"Group\".\"Code\" = 'forum-members'"))) {
$group = new Group();
$group->Code = 'forum-members';
$group->Title = "Forum Members";
$group->write();
Permission::grant($group->ID, $code);
DB::alteration_message(_t('Forum.GROUPCREATED', 'Forum Members group created'), "created");
} else {
if (DB::query("SELECT * FROM \"Permission\" WHERE \"GroupID\" = '{$forumGroup->ID}' AND \"Code\" LIKE '{$code}'")->numRecords() == 0) {
Permission::grant($forumGroup->ID, $code);
}
}
if (!($category = DataObject::get_one("ForumCategory"))) {
$category = new ForumCategory();
$category->Title = _t('Forum.DEFAULTCATEGORY', 'General');
$category->write();
}
if (!DataObject::get_one("ForumHolder")) {
$forumholder = new ForumHolder();
$forumholder->Title = "Forums";
$forumholder->URLSegment = "forums";
$forumholder->Content = "<p>" . _t('Forum.WELCOMEFORUMHOLDER', 'Welcome to SilverStripe Forum Module! This is the default ForumHolder page. You can now add forums.') . "</p>";
$forumholder->Status = "Published";
$forumholder->write();
$forumholder->publish("Stage", "Live");
DB::alteration_message(_t('Forum.FORUMHOLDERCREATED', 'ForumHolder page created'), "created");
$forum = new Forum();
$forum->Title = _t('Forum.TITLE', 'General Discussion');
$forum->URLSegment = "general-discussion";
$forum->ParentID = $forumholder->ID;
$forum->Content = "<p>" . _t('Forum.WELCOMEFORUM', 'Welcome to SilverStripe Forum Module! This is the default Forum page. You can now add topics.') . "</p>";
$forum->Status = "Published";
$forum->CategoryID = $category->ID;
$forum->write();
$forum->publish("Stage", "Live");
DB::alteration_message(_t('Forum.FORUMCREATED', 'Forum page created'), "created");
}
}
示例2: requireDefaultRecords
/**
* Add default records to database
*
* This function is called whenever the database is built, after the
* database tables have all been created.
*/
public function requireDefaultRecords()
{
parent::requireDefaultRecords();
$code = "ACCESS_FORUM";
if (!($forumGroup = Group::get()->filter('Code', 'forum-members')->first())) {
$group = new Group();
$group->Code = 'forum-members';
$group->Title = "Forum Members";
$group->write();
Permission::grant($group->ID, $code);
DB::alteration_message(_t('Forum.GROUPCREATED', 'Forum Members group created'), 'created');
} else {
if (!Permission::get()->filter(array('GroupID' => $forumGroup->ID, 'Code' => $code))->exists()) {
Permission::grant($forumGroup->ID, $code);
}
}
if (!($category = ForumCategory::get()->first())) {
$category = new ForumCategory();
$category->Title = _t('Forum.DEFAULTCATEGORY', 'General');
$category->write();
}
if (!ForumHolder::get()->exists()) {
$forumholder = new ForumHolder();
$forumholder->Title = "Forums";
$forumholder->URLSegment = "forums";
$forumholder->Content = "<p>" . _t('Forum.WELCOMEFORUMHOLDER', 'Welcome to SilverStripe Forum Module! This is the default ForumHolder page. You can now add forums.') . "</p>";
$forumholder->Status = "Published";
$forumholder->write();
$forumholder->publish("Stage", "Live");
DB::alteration_message(_t('Forum.FORUMHOLDERCREATED', 'ForumHolder page created'), "created");
$forum = new Forum();
$forum->Title = _t('Forum.TITLE', 'General Discussion');
$forum->URLSegment = "general-discussion";
$forum->ParentID = $forumholder->ID;
$forum->Content = "<p>" . _t('Forum.WELCOMEFORUM', 'Welcome to SilverStripe Forum Module! This is the default Forum page. You can now add topics.') . "</p>";
$forum->Status = "Published";
$forum->CategoryID = $category->ID;
$forum->write();
$forum->publish("Stage", "Live");
DB::alteration_message(_t('Forum.FORUMCREATED', 'Forum page created'), "created");
}
}