/** * Duplicate current page contents into another one * All contents and external datas are duplicated too * * @param CMS_user user, the user processing to creation * @return boolean true on success, false on failure */ function duplicateContent(&$user, &$page) { $_proceed = true; if (!is_a($page, "CMS_page") || !is_a($user, "CMS_profile_user")) { $_proceed = false; } else { //Duplicate contents, get all blocks and duplicate them $_allBlocks = CMS_blocksCatalog::getAllBlocksForPage($this, false); $page->lock($user); $page->addEdition(RESOURCE_EDITION_CONTENT, $user); foreach ($_allBlocks as $b) { if (!($done = $b->duplicate($page))) { $_proceed = false; } } $page->writeToPersistence(); $page->unlock(); } return $_proceed; }