本文整理汇总了PHP中Wiki::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Wiki::save方法的具体用法?PHP Wiki::save怎么用?PHP Wiki::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wiki
的用法示例。
在下文中一共展示了Wiki::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_wiki
function create_wiki($gid = false, $wikiName = 'New wiki')
{
$creatorId = claro_get_current_user_id();
$tblList = claro_sql_get_course_tbl();
$config = array();
$config["tbl_wiki_properties"] = $tblList["wiki_properties"];
$config["tbl_wiki_pages"] = $tblList["wiki_pages"];
$config["tbl_wiki_pages_content"] = $tblList["wiki_pages_content"];
$config["tbl_wiki_acls"] = $tblList["wiki_acls"];
$con = Claroline::getDatabase();
$acl = array();
if ($gid) {
$acl = WikiAccessControl::defaultGroupWikiACL();
} else {
$acl = WikiAccessControl::defaultCourseWikiACL();
}
$wiki = new Wiki($con, $config);
$wiki->setTitle($wikiName);
$wiki->setDescription('This is a sample wiki');
$wiki->setACL($acl);
$wiki->setGroupId($gid);
$wikiId = $wiki->save();
$wikiTitle = $wiki->getTitle();
$mainPageContent = sprintf("This is the main page of the Wiki %s. Click on edit to modify the content.", $wikiTitle);
$wikiPage = new WikiPage($con, $config, $wikiId);
$wikiPage->create($creatorId, '__MainPage__', $mainPageContent, date("Y-m-d H:i:s"), true);
}
示例2: actionEdit
public function actionEdit($id)
{
$model = Wiki::model()->findByPk($id);
if (!$model) {
$model = new Wiki();
$model->id = $id;
}
if (!empty($_POST['Wiki'])) {
if (!empty($_POST['Wiki']['text'])) {
$model->text = $_POST['Wiki']['text'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $id));
}
} else {
Wiki::model()->deleteByPk($id);
}
}
$this->render('edit', array('model' => $model));
}
示例3: testSluggableChildTemplate
public function testSluggableChildTemplate()
{
$this->conn->clear();
$wiki = new Wiki();
$wiki->state(Doctrine_Record::STATE_TDIRTY);
$wiki->save();
$fi = $wiki->Translation['FI'];
$fi->title = 'This is the title';
$fi->content = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla sed.";
$fi->save();
$this->assertEqual($fi->slug, 'this-is-the-title');
}
示例4: Wiki
$groupId = $wiki->getGroupId();
} else {
$message = get_lang("Invalid Wiki Id");
$action = 'error';
}
break;
// execute edit
// execute edit
case 'exEdit':
if ($wikiId == 0) {
$wiki = new Wiki($con, $config);
$wiki->setTitle($wikiTitle);
$wiki->setDescription($wikiDesc);
$wiki->setACL($wikiACL);
$wiki->setGroupId($groupId);
$wikiId = $wiki->save();
//notify wiki modification
$eventNotifier->notifyCourseEvent('wiki_added', claro_get_current_course_id(), claro_get_current_tool_id(), $wikiId, claro_get_current_group_id(), '0');
$mainPageContent = sprintf(get_lang("This is the main page of the Wiki %s. Click on '''Edit''' to modify the content."), $wikiTitle);
$wikiPage = new WikiPage($con, $config, $wikiId);
if ($wikiPage->create($creatorId, '__MainPage__', $mainPageContent, date("Y-m-d H:i:s"), true)) {
$message = get_lang("Wiki creation succeed");
$dialogBox->success($message);
} else {
$message = get_lang("Wiki creation failed");
$dialogBox->error($message . ":" . $wikiPage->getError());
}
} elseif ($wikiStore->wikiIdExists($wikiId)) {
$wiki = $wikiStore->loadWiki($wikiId);
$wiki->setTitle($wikiTitle);
$wiki->setDescription($wikiDesc);
示例5: execute
/**
* @param string $handle (Wiki name)
* @return array(title,content)
*/
function execute($handle)
{
// If it is not CamelCase, it is not a valid Voodoo Wiki
if (!$this->isCamelCase($handle)) {
$wv = new WikiView($this->dispatcher);
return $wv->execute(null, 'Incorrect Wiki name.');
}
// Validate if the user has rights to create a new Wiki
if (!$this->hasRights($_SESSION['access'], 'create', $handle)) {
$wv = new WikiView($this->dispatcher);
return $wv->execute(null, 'This Page Is Currently Unavailable.');
}
$args = $this->defaultArgs;
// We're supposed to save the page, do it.
if (isset($_POST['save']) && !empty($_POST['wikicontent'])) {
$wp = new Wiki($this->db);
// HTMLEntities, no arbitrary code should be inserted.
// TODO: use something better than htmlentities()
$wp->save($handle, htmlentities($_POST['wikicontent']));
header('Location: ' . PATH_TO_DOCROOT . '/wiki/' . $handle);
exit;
} elseif (isset($_POST['preview']) && !empty($_POST['wikicontent'])) {
$wv = new WikiView($this->dispatcher);
list(, $args['preview_content']) = $wv->execute('', htmlentities($_POST['wikicontent']), false);
$args['content'] = htmlentities($_POST['wikicontent']);
$args['preview'] = $this->template->parse('preview', $args);
}
$args['handle'] = $handle;
$args['formaction'] = '/wiki/' . $handle;
$args['actiontype'] = 'Submit changes';
return array($handle . ' - WikiCreate', $this->template->parse('create', $args));
}