本文整理汇总了PHP中page::save方法的典型用法代码示例。如果您正苦于以下问题:PHP page::save方法的具体用法?PHP page::save怎么用?PHP page::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类page
的用法示例。
在下文中一共展示了page::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePage
/**
* Update a Page of the module
* @param page $page
*/
public function updatePage(page $page)
{
$id = $page->getId();
$this->pages[$id] = $page->getRegex();
$page->save();
}
示例2:
$fail = TRUE;
$redmsg .= "<p>You must have a title between 3 and 50 characters.</p>";
}
if (isset($_POST['content'])) {
$page->text = $_POST['content'];
} else {
$fail = TRUE;
$redmsg .= "<p>You must have some content.</p>";
}
if (isset($_POST['ispublic'])) {
$page->ispublic = TRUE;
} else {
$page->ispublic = FALSE;
}
if ($fail == FALSE) {
if ($page->save()) {
$greenmsg .= "<p>The page has been published.</p>";
} else {
$redmsg .= "<p>Failed to save page.</p>";
$title = $_POST['title'];
$content = $_POST['content'];
}
} else {
$title = $_POST['title'];
$content = $_POST['content'];
}
if ($redmsg != "") {
$redmsg = '<div class="notification red">' . $redmsg . '</div>';
}
if ($greenmsg != "") {
$greenmsg = '<div class="notification green">' . $greenmsg . '</div>';
示例3: createNewObject
function createNewObject($object_type, $post_vars, $system_data_classes, $object_save = 0)
{
if (!$object_type) {
return false;
}
if (!in_array($object_type, $system_data_classes)) {
return false;
}
switch ($object_type) {
case "page":
$object = new page("new page");
$object->update_document_props($post_vars);
if ($object_save == 1) {
$object->createContent();
$object->save();
}
break;
case "process":
$object = new process("new process");
$object->update_document_props($post_vars);
$object->update_design_props($post_vars);
if ($object_save == 1) {
$object->save();
}
break;
case "section":
$object = new section("new section");
$object->update_document_props($post_vars);
if ($object_save == 1) {
$object->createContent();
$object->save();
}
break;
case "image":
$object = new image("new image");
$object->update_document_props($post_vars);
if ($object_save == 1) {
$object->save();
}
break;
case "file":
$object = new file("new file");
$object->update_document_props($post_vars);
if ($object_save == 1) {
$object->save();
}
break;
default:
break;
}
return $object;
}
示例4: testCreateSameIDDifferentLanguage
public function testCreateSameIDDifferentLanguage()
{
$page = new page;
$page->language = 'en';
$page->title = 'Test Blog';
$page->content = 'A';
$page->authorID = 'nathan';
$page->save();
$id1 = $page->ID;
$page = new page;
$page->language = 'nl';
$page->title = 'Test Blog';
$page->content = 'B';
$page->authorID = 'nathan';
$page->save();
$id2 = $page->ID;
$this->assertEquals($id1, $id2);
$page1 = Page::get($id1, 'en');
$page2 = Page::get($id2, 'nl');
$this->assertEquals('Test Blog', $page1->title);
$this->assertEquals('Test Blog', $page2->title);
$this->assertEquals('A', $page1->content);
$this->assertEquals('B', $page2->content);
}
示例5: addToNavigation
public static function addToNavigation()
{
$page = new page();
$pluginsManager = pluginsManager::getInstance();
// Création d'items de navigation absents (plugins)
foreach ($pluginsManager->getPlugins() as $k => $plugin) {
if ($plugin->getConfigVal('activate') && $plugin->getPublicFile() && $plugin->getName() != 'page') {
$find = false;
foreach ($page->getItems() as $k2 => $pageItem) {
if ($pageItem->getTarget() == $plugin->getName()) {
$find = true;
}
}
if (!$find) {
$pageItem = new pageItem();
$pageItem->setName($plugin->getInfoVal('name'));
$pageItem->setPosition($page->makePosition());
$pageItem->setIsHomepage(0);
$pageItem->setContent('');
$pageItem->setIsHidden(0);
$pageItem->setFile('');
$pageItem->setTarget($plugin->getName());
$page->save($pageItem);
}
}
}
// génération de la navigation
foreach ($page->getItems() as $k => $pageItem) {
if (!$pageItem->getIsHidden()) {
$core = core::getInstance();
$pluginsManager->getPlugin('page')->addToNavigation($pageItem->getName(), $page->makeUrl($pageItem), $pageItem->getTargetAttr());
}
}
}
示例6: pageItem
$pageItem = $page->create($_POST['id']);
} else {
$pageItem = new pageItem();
}
$pageItem->setName($_POST['name']);
$pageItem->setPosition($_POST['position']);
$pageItem->setIsHomepage(isset($_POST['isHomepage']) ? 1 : 0);
$pageItem->setContent($_POST['content']);
$pageItem->setFile($_POST['file']);
$pageItem->setIsHidden(isset($_POST['isHidden']) ? 1 : 0);
$pageItem->setMainTitle($_POST['mainTitle']);
$pageItem->setMetaDescriptionTag($_POST['metaDescriptionTag']);
$pageItem->setMetaTitleTag($_POST['metaTitleTag']);
$pageItem->setTarget($_POST['target']);
$pageItem->setTargetAttr($_POST['targetAttr']);
if ($page->save($pageItem)) {
$msg = $core->lang("The changes have been saved.");
$msgType = 'success';
} else {
$msg = $core->lang("An error occurred while saving the changes.");
$msgType = 'error';
}
header('location:index.php?p=page&msg=' . urlencode($msg) . '&msgType=' . $msgType);
die;
}
break;
case 'edit':
if (isset($_GET['id'])) {
$pageItem = $page->create($_GET['id']);
} else {
$pageItem = new pageItem();