CMS  Version 3.9
move_documents.inc File Reference

Go to the source code of this file.

Variables

 $document_library_id = checkNumeric($_GET["document_library_id"])
 
 $document_ids = checkNumericList($_GET["document_ids"])
 
if(! $document_library_id||! $document_ids) $library = new DocumentLibrary($document_library_id)
 
if(! $library->allowManageFiles()) $documentMove = new DocumentMove()
 
$documentMove from = $document_library_id
 
 $form = new AutoForm($documentMove, "POST", "/action/document/move_documents?document_library_id={$document_library_id}&document_ids={$document_ids}")
 
$form submitLabel = "Move Documents"
 
$form customSaveHandler
 
if($method=="POST") $script = $form->writeScript()
 

Variable Documentation

◆ $document_ids

$document_ids = checkNumericList($_GET["document_ids"])

Definition at line 4 of file move_documents.inc.

◆ $document_library_id

$document_library_id = checkNumeric($_GET["document_library_id"])

Definition at line 3 of file move_documents.inc.

◆ $documentMove

if (! $library->allowManageFiles()) $documentMove = new DocumentMove()

Definition at line 17 of file move_documents.inc.

◆ $form

$form = new AutoForm($documentMove, "POST", "/action/document/move_documents?document_library_id={$document_library_id}&document_ids={$document_ids}")

Definition at line 20 of file move_documents.inc.

◆ $library

if (! $document_library_id||! $document_ids) $library = new DocumentLibrary($document_library_id)

Definition at line 11 of file move_documents.inc.

◆ $script

if ( $method=="POST") $script = $form->writeScript()

Definition at line 59 of file move_documents.inc.

◆ customSaveHandler

$form customSaveHandler
Initial value:
= function($form) use ($library, $document_ids)
{
$to = new DocumentLibrary($form->data->to);
$docs = Query::create(Document, "WHERE document_id IN ($document_ids)")->execute();
foreach($docs as $doc)
{
$fromPath = $library->getLibraryDirectory().DIRECTORY_SEPARATOR.$doc->file;
$toPath = $to->getLibraryDirectory().DIRECTORY_SEPARATOR.$doc->file;
rename($fromPath, $toPath);
$doc->document_library_id = $to->document_library_id;
$doc->save();
}
return true;
}
This class maps the publication table.
Definition: document.inc:43
$document_ids
if(! $document_library_id||! $document_ids) $library

Definition at line 29 of file move_documents.inc.

◆ from

$documentMove from = $document_library_id

Definition at line 18 of file move_documents.inc.

◆ submitLabel

$form submitLabel = "Move Documents"

Definition at line 26 of file move_documents.inc.