Exemplo n.º 1
0
if (!is_object($object)) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($object->attribute('status') != eZContentObject::STATUS_ARCHIVED) {
    eZDebug::writeError("Object with ID " . (int) $objectID . " is not archived, cannot restore.");
    return $module->redirectToView('trash');
}
$ini = eZINI::instance();
$userClassID = $ini->variable("UserSettings", "UserClassID");
if ($module->isCurrentAction('Cancel')) {
    return $module->redirectToView('trash');
}
$class = $object->contentClass();
$version = $object->attribute('current');
$location = null;
$trashNode = eZContentObjectTrashNode::fetchByContentObjectID($objectID);
if ($trashNode instanceof eZContentObjectTrashNode) {
    $location = $trashNode->attribute('original_parent');
}
if ($module->isCurrentAction('Confirm')) {
    $type = $module->actionParameter('RestoreType');
    if ($type == 1) {
        $selectedNodeIDArray = array($location->attribute('node_id'));
        $module->setCurrentAction('AddLocation');
    } elseif ($type == 2) {
        $languageCode = $object->attribute('initial_language_code');
        eZContentBrowse::browse(array('action_name' => 'AddNodeAssignment', 'description_template' => 'design:content/browse_placement.tpl', 'keys' => array('class' => $class->attribute('id'), 'class_id' => $class->attribute('identifier'), 'classgroup' => $class->attribute('ingroup_id_list'), 'section' => $object->attribute('section_id')), 'ignore_nodes_select' => array(), 'ignore_nodes_click' => array(), 'persistent_data' => array('ContentObjectID' => $objectID, 'AddLocationAction' => '1'), 'content' => array('object_id' => $objectID, 'object_version' => $version->attribute('version'), 'object_language' => $languageCode), 'cancel_page' => '/content/trash/', 'from_page' => "/content/restore/" . $objectID), $module);
        return;
    }
}
if ($module->isCurrentAction('AddLocation')) {