function update($values, $object, $loc) { global $db; if (!isset($values['id'])) { // Only deal with the inc/dec stuff if adding a module. $src = ""; if (isset($values['i_src'])) { if ($values['i_src'] == "new_source") { $src = "@random" . uniqid(""); $object->is_existing = 0; } else { $src = $values[$values['i_src']]; $object->is_existing = 1; } } else { $object->is_existing = 0; } $newInternal = pathos_core_makeLocation($values['i_mod'], $src); // REFERENCES - Section and Location //$sect = $db->selectObject('section','id='.$_POST['current_section']); pathos_core_incrementLocationReference($newInternal, $_POST['current_section']); // Rank is only updateable from the order action $object->rank = $values['rank']; if (isset($values['rerank'])) { $db->increment("container", "rank", 1, "external='" . serialize($loc) . "' AND rank >= " . $values['rank']); } $object->internal = serialize($newInternal); $object->external = serialize($loc); } $object->is_private = isset($_POST['is_private']) ? 1 : 0; // UPDATE the container $object->view = $values['view']; $object->title = $values['title']; return $object; }
function copyContent($oloc, $nloc) { global $db; foreach ($db->selectObjects('container', "external='" . serialize($oloc) . "'") as $c) { unset($c->id); $c->external = serialize($nloc); if (!$c->is_existing == 1) { // Copy over content to a new source $oldinternal = unserialize($c->internal); $iloc = pathos_core_makeLocation($oldinternal->mod, '@random' . uniqid('')); $c->internal = serialize($iloc); $db->insertObject($c, 'container'); // Now copy over content if (call_user_func(array($oldinternal->mod, 'hasContent')) == true) { call_user_func(array($oldinternal->mod, 'copyContent'), $oldinternal, $iloc); // Incrementors! pathos_core_incrementLocationReference($iloc, 0); // SECTION } } else { $db->insertObject($c, 'container'); pathos_core_incrementLocationReference($iloc, 0); // SECTION } } }