Ejemplo n.º 1
0
 /**
  * Handle versioning of the attachment
  *
  * @todo Move this to the DBA wrapper class when DM datatype_blob behaves better
  */
 private function _backup_attachment()
 {
     // First, look at post data (from in-form replace/delete buttons)
     if (array_key_exists('document', $_POST)) {
         if (sizeof($_POST['document']) > 0) {
             foreach ($_POST['document'] as $key => $value) {
                 if (strpos($key, '_delete') || strpos($key, '_upload') && !strpos($key, 'new_upload')) {
                     $this->_document->backup_version();
                     return;
                 }
             }
         }
     }
     // If nothing is found, try looking in quickform (regular form submission)
     $group = $this->_controller->formmanager->form->getElement('document');
     foreach ($group->getElements() as $element) {
         if (preg_match('/e_exist_.+?_file$/', $element->getName()) && $element->isUploadedFile()) {
             $this->_document->backup_version();
             return;
         }
     }
 }