Source for file SubmitFieldsPlugin.php
Documentation is available at SubmitFieldsPlugin.php
* The submit fields plugin
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
* @copyright Copyright (c) 2006,2007 Mirchev Ideas Ltd. All rights reserved.
* Array with the submit fields this plugin works on
* The array has the following format
* array('fieldName' => '', 'namePrefixSave' => '', 'namePrefixWeb' => '', 'nameSuffix' => ''),
* array('fieldName' => '', 'namePrefixSave' => '', 'namePrefixWeb' => '', 'nameSuffix' => ''),
* Constructs the submit fields hanlder
* @param array $submitFields the submit fields
* Assign the submit fields template variables as page elements
if (file_exists($field['namePrefixSave'] .
$id .
$field['nameSuffix'])) {
$templateVars['%%' .
strtoupper($field['fieldName']) .
'%%'] =
$field['namePrefixWeb'] .
$id .
$field['nameSuffix'];
$templateVars['%%' .
strtoupper($field['fieldName']) .
'_MISSING%%'] =
'';
$templateVars['%%' .
strtoupper($field['fieldName']) .
'%%'] =
'';
$templateVars['%%' .
strtoupper($field['fieldName']) .
'_MISSING%%'] =
'style="display: none"';
$this->_view->addMainPageElements($templateVars);
* Processes the submit fields
* @param int $id the id of the currently created/edited row
if (empty($_FILES[$field['fieldName']]['name']))
$dest =
$field['namePrefixSave'] .
$id .
$field['nameSuffix'];
throw
new miException('Cannot upload file. Saving into "' .
$dest .
'" failed.');
* Delete all attached files
* @param int $id the id of the deleted row
$name =
$field['namePrefixSave'] .
$id .
$field['nameSuffix'];
@unlink($name); // Ignore errors
* If the action is one of View, Create or Edit assign the submit fields display vars
* @param miAction $actionObj action object, subclassed from miAction
* @param string $actionStep the action step
if ($actionStep ==
'preShowForm' &&
!($actionObj instanceof
miCreateAction)) {
if (($actionStep ==
'postCreate') or ($actionStep ==
'postUpdate')) {
if ($actionStep ==
'postDelete') {
Documentation generated on Thu, 08 May 2008 16:57:41 +0300 by phpDocumentor 1.4.1