本文整理汇总了PHP中Forum::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::create方法的具体用法?PHP Forum::create怎么用?PHP Forum::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: approve
/**
* approve - Approve pending project.
*
* @param object The User object who is doing the updating.
* @access public
*/
function approve(&$user)
{
if ($this->getStatus() == 'A') {
$this->setError(_("Group already active"));
return false;
}
db_begin();
// Step 1: Activate group and create LDAP entries
if (!$this->setStatus($user, 'A')) {
db_rollback();
return false;
}
//
//
// Tracker Integration
//
//
$ats = new ArtifactTypes($this);
if (!$ats || !is_object($ats)) {
$this->setError(_('Error creating ArtifactTypes object'));
db_rollback();
return false;
} else {
if ($ats->isError()) {
$this->setError(sprintf(_('ATS%d: %s'), 1, $ats->getErrorMessage()));
db_rollback();
return false;
}
}
if (!$ats->createTrackers()) {
$this->setError(sprintf(_('ATS%d: %s'), 2, $ats->getErrorMessage()));
db_rollback();
return false;
}
//
//
// Forum Integration
//
//
$f = new Forum($this);
if (!$f->create('Open-Discussion', 'General Discussion', 1, '', 1, 0)) {
$this->setError(sprintf(_('F%d: %s'), 1, $f->getErrorMessage()));
db_rollback();
return false;
}
$f = new Forum($this);
if (!$f->create('Help', 'Get Public Help', 1, '', 1, 0)) {
$this->setError(sprintf(_('F%d: %s'), 2, $f->getErrorMessage()));
db_rollback();
return false;
}
$f = new Forum($this);
if (!$f->create('Developers', 'Project Developer Discussion', 0, '', 1, 0)) {
$this->setError(sprintf(_('F%d: %s'), 3, $f->getErrorMessage()));
db_rollback();
return false;
}
//
//
// Doc Mgr Integration
//
//
$dg = new DocumentGroup($this);
if (!$dg->create('Uncategorized Submissions')) {
$this->setError(sprintf(_('DG: %s'), $dg->getErrorMessage()));
db_rollback();
return false;
}
//
//
// FRS integration
//
//
$frs = new FRSPackage($this);
if (!$frs->create($this->getUnixName())) {
$this->setError(sprintf(_('FRSP: %s'), $frs->getErrorMessage()));
db_rollback();
return false;
}
//
//
// PM Integration
//
//
$pg = new ProjectGroup($this);
if (!$pg->create('To Do', 'Things We Have To Do', 1)) {
$this->setError(sprintf(_('PG%d: %s'), 1, $pg->getErrorMessage()));
db_rollback();
return false;
}
$pg = new ProjectGroup($this);
if (!$pg->create('Next Release', 'Items For Our Next Release', 1)) {
$this->setError(sprintf(_('PG%d: %s'), 2, $pg->getErrorMessage()));
db_rollback();
//.........这里部分代码省略.........
示例2: getStringFromRequest
}
$summary = getStringFromRequest('summary');
$details = getStringFromRequest('details');
//check to make sure both fields are there
if ($summary && $details) {
/*
Insert the row into the db if it's a generic message
OR this person is an admin for the group involved
*/
/*
create a new discussion forum without a default msg
if one isn't already there
*/
db_begin();
$f = new Forum(group_get_object($sys_news_group));
if (!$f->create(ereg_replace('[^_\\.0-9a-z-]', '-', strtolower($summary)), $details, 1, '', 0, 0)) {
db_rollback();
exit_error('Error', $f->getErrorMessage());
}
$new_id = $f->getID();
$sanitizer = new TextSanitizer();
$details = $sanitizer->SanitizeHtml($details);
$sql = "INSERT INTO news_bytes (group_id,submitted_by,is_approved,post_date,forum_id,summary,details) " . " VALUES ('{$group_id}','" . user_getid() . "','0','" . time() . "','{$new_id}','" . htmlspecialchars($summary) . "','" . $details . "')";
$result = db_query($sql);
if (!$result) {
db_rollback();
form_release_key(getStringFromRequest('form_key'));
$feedback = ' ' . _('ERROR doing insert') . ' ';
} else {
db_commit();
$feedback = ' ' . _('News Added.') . ' ';