当前位置: 首页>>代码示例>>PHP>>正文


PHP files::processObjectUploads方法代码示例

本文整理汇总了PHP中files::processObjectUploads方法的典型用法代码示例。如果您正苦于以下问题:PHP files::processObjectUploads方法的具体用法?PHP files::processObjectUploads怎么用?PHP files::processObjectUploads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在files的用法示例。


在下文中一共展示了files::processObjectUploads方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: submit

 public static function submit($formID, $objectID = NULL, $importing = FALSE)
 {
     $engine = mfcs::$engine;
     $backgroundProcessing = array();
     if (isnull($objectID)) {
         $newObject = TRUE;
     } else {
         $newObject = FALSE;
     }
     // Get the current Form
     if (($form = self::get($formID)) === FALSE) {
         errorHandle::newError(__METHOD__ . "() - retrieving form by formID", errorHandle::DEBUG);
         return FALSE;
     }
     // the form is an object form, make sure that it has an ID field defined.
     // @TODO this check can probably be removed, its being checked in object class
     if ($form['metadata'] == "0") {
         $idnoInfo = self::getFormIDInfo($formID);
         if ($idnoInfo === FALSE) {
             errorHandle::newError(__METHOD__ . "() - no IDNO field for object form.", errorHandle::DEBUG);
             return FALSE;
         }
     }
     $fields = $form['fields'];
     if (usort($fields, 'sortFieldsByPosition') !== TRUE) {
         errorHandle::newError(__METHOD__ . "() - usort", errorHandle::DEBUG);
         if (!$importing) {
             errorHandle::errorMsg("Error retrieving form.");
         }
         return FALSE;
     }
     $values = array();
     // go through all the fields, get their values
     foreach ($fields as $field) {
         $value = isset($engine->cleanPost['RAW'][$field['name']]) ? $engine->cleanPost['RAW'][$field['name']] : "";
         $validationTests = self::validateSubmission($formID, $field, $value, $objectID);
         if (isnull($validationTests) || $validationTests === FALSE) {
             continue;
         }
         if (strtolower($field['readonly']) == "true") {
             // need to pull the data that loaded with the form
             if ($newObject === FALSE) {
                 // grab it from the database
                 $oldObject = objects::get($objectID);
                 $values[$field['name']] = $oldObject['data'][$field['name']];
             } else {
                 // If the form has a variable in the value we apply the variable, otherwise, field value.
                 // we need to check for disabled on insert form
                 if (!isset($field['disabledInsert']) || isset($field['disabledInsert']) && $field['disabledInsert'] == "false") {
                     $values[$field['name']] = self::hasFieldVariables($field['value']) ? self::applyFieldVariables($value) : $field['value'];
                 }
                 // grab the default value from the form.
                 // $values[$field['name']] = $field['value'];
             }
         } else {
             if (strtolower($field['type']) == "file" && isset($engine->cleanPost['MYSQL'][$field['name']])) {
                 // Process uploaded files
                 $uploadID = $engine->cleanPost['MYSQL'][$field['name']];
                 // Process the uploads and put them into their archival locations
                 if (($tmpArray = files::processObjectUploads($objectID, $uploadID)) === FALSE) {
                     errorHandle::newError(__METHOD__ . "() - Archival Location", errorHandle::DEBUG);
                     return FALSE;
                 }
                 if ($tmpArray !== TRUE) {
                     // didn't generate a proper uuid for the items, rollback
                     if (!isset($tmpArray['uuid'])) {
                         $engine->openDB->transRollback();
                         $engine->openDB->transEnd();
                         errorHandle::newError(__METHOD__ . "() - No UUID", errorHandle::DEBUG);
                         return FALSE;
                     }
                     // ads this field to the files object
                     // we can't do inserts yet because we don't have the objectID on
                     // new objects
                     files::addProcessingField($field['name']);
                     // Should the files be processed now or later?
                     if (isset($field['bgProcessing']) && str2bool($field['bgProcessing']) === TRUE) {
                         $backgroundProcessing[$field['name']] = TRUE;
                     } else {
                         $backgroundProcessing[$field['name']] = FALSE;
                     }
                     $values[$field['name']] = $tmpArray;
                 } else {
                     // if we don't have files, and this is an update, we need to pull the files information from the
                     // version that is already in the system.
                     $oldObject = objects::get($objectID);
                     if ($newObject === FALSE && objects::hasFiles($objectID, $field['name']) === TRUE) {
                         $values[$field['name']] = $oldObject['data'][$field['name']];
                     }
                 }
             } else {
                 $values[$field['name']] = $value;
             }
         }
     }
     if (isset($engine->errorStack['error']) && count($engine->errorStack['error']) > 0) {
         // errorHandle::newError(__METHOD__."() - Error stack not empty.", errorHandle::DEBUG);
         return FALSE;
     }
     // start transactions
//.........这里部分代码省略.........
开发者ID:PseudoAj,项目名称:mfcs,代码行数:101,代码来源:forms.php


注:本文中的files::processObjectUploads方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。