Detailed Description
SaveController is a controller that saves Node data.
The controller supports the following actions:
Parameter | Description |
---|---|
in / out | Key/value pairs of serialized object ids and PersistentObject instances to save |
in uploadDir | The directory where attached files should be stored on the server (optional) (see SaveController::getUploadDir()) |
out oid | The object id of the last newly created object |
Response Actions | |
ok | In all cases |
Errors concerning single input fields are added to the session (the keys are the input field names)
Definition at line 46 of file SaveController.php.
Protected Member Functions | |
getFileUtil () | |
validate () | |
doExecute () | |
saveUploadFile (ObjectId $oid, $valueName, array $data) | |
isFileUpload (array $data) | |
checkFile (ObjectId $oid, $valueName, $filename, $mimeType=null) | |
getUploadFilename (ObjectId $oid, $valueName, $filename) | |
shouldOverride (ObjectId $oid, $valueName, $filename) | |
getUploadDir (ObjectId $oid, $valueName) | |
confirmSaveValue ($node, $valueName, $newValue) | |
confirmSave ($node) | |
beforeSave ($node) | |
afterSave ($node) | |
Protected Member Functions inherited from Controller | |
validate () | |
executeSubAction ($action) | |
getLogger () | |
getSession () | |
getPersistenceFacade () | |
getPermissionManager () | |
getActionMapper () | |
getLocalization () | |
getMessage () | |
getConfiguration () | |
assignResponseDefaults () | |
isLocalizedRequest () | |
checkLanguageParameter () | |
Additional Inherited Members | |
Public Member Functions inherited from Controller | |
__construct (Session $session, PersistenceFacade $persistenceFacade, PermissionManager $permissionManager, ActionMapper $actionMapper, Localization $localization, Message $message, Configuration $configuration) | |
initialize (Request $request, Response $response) | |
execute ($method=null) | |
getRequest () | |
getResponse () | |
Member Function Documentation
|
protected |
|
protected |
- See also
- Controller::validate()
Definition at line 64 of file SaveController.php.
|
protected |
- See also
- Controller::doExecute()
Definition at line 75 of file SaveController.php.
|
protected |
Save uploaded file.
This method calls checkFile which will prevent upload if returning false.
- Parameters
-
$oid The ObjectId of the object to which the file is associated $valueName The name of the value to which the file is associated $data An assoziative array with keys 'name', 'type', 'tmp_name' as contained in the php $_FILES array.
- Returns
- The final filename if the upload was successful, null on error
Definition at line 310 of file SaveController.php.
|
protected |
Check if the given data defines a file upload.
File uploads are defined in an assoziative array with keys 'name', 'type', 'tmp_name' as contained in the php $_FILES array.
- Parameters
-
$data Array
- Returns
- Boolean
Definition at line 361 of file SaveController.php.
|
protected |
Check if the file is valid for a given object value.
The implementation returns true.
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$oid The ObjectId of the object $valueName The name of the value of the object identified by oid $filename The name of the file to upload (including path) $mimeType The mime type of the file (if null it will not be checked) (default: null)
- Returns
- Boolean whether the file is ok or not.
Definition at line 374 of file SaveController.php.
|
protected |
Get the name for the uploaded file.
The implementation replaces all non alphanumerical characters except for ., -, _ with underscores and turns the name to lower case.
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$oid The ObjectId of the object $valueName The name of the value of the object identified by oid $filename The name of the file to upload (including path)
- Returns
- The filename
Definition at line 388 of file SaveController.php.
|
protected |
Determine what to do if a file with the same name already exists.
The implementation returns true.
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$oid The ObjectId of the object $valueName The name of the value of the object identified by oid $filename The name of the file to upload (including path)
- Returns
- Boolean whether to override the file or to create a new unique filename
Definition at line 402 of file SaveController.php.
|
protected |
Get the name of the directory to upload a file to and make shure that it exists.
The default implementation will first look for a parameter 'uploadDir' and then, if it is not given, for an 'uploadDir'. type key in the configuration file (section 'media') and finally for an 'uploadDir' key at the same place.
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$oid The ObjectId of the object which will hold the association to the file $valueName The name of the value which will hold the association to the file
- Returns
- The directory name
Definition at line 416 of file SaveController.php.
|
protected |
Confirm save action on given Node value.
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$node A reference to the Node to confirm. $valueName The name of the value to save. $newValue The new value to set.
- Returns
- Boolean whether the value should be changed (default: true).
Definition at line 451 of file SaveController.php.
|
protected |
Confirm save action on given Node.
This method is called before modify()
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$node A reference to the Node to confirm.
- Returns
- Boolean whether the Node should be saved (default: true).
Definition at line 461 of file SaveController.php.
|
protected |
Called before save.
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$node A reference to the Node to be saved.
- Returns
- Boolean whether the Node was modified (default: false).
Definition at line 471 of file SaveController.php.
|
protected |
Called after save.
- Note
- subclasses will override this to implement special application requirements.
- Parameters
-
$node A reference to the Node saved.
Definition at line 480 of file SaveController.php.