/**
  * Generate the widget and return it as string
  * @param array
  * @return string
  */
 public function parse($arrAttributes = null)
 {
     if (!$this->blnValuesPrepared) {
         $arrSet = array();
         $arrValues = array();
         $arrUuids = array();
         $arrTemp = array();
         if (!empty($this->varValue)) {
             // Can be an array
             $this->varValue = (array) $this->varValue;
             foreach ($this->varValue as $varFile) {
                 if (\Validator::isUuid($varFile)) {
                     $arrUuids[] = $varFile;
                 } else {
                     $arrTemp[] = $varFile;
                 }
             }
             $objFiles = \FilesModel::findMultipleByUuids($arrUuids);
             // Get the database files
             if ($objFiles !== null) {
                 while ($objFiles->next()) {
                     $chunk = $this->generateFileItem($objFiles->path);
                     if (strlen($chunk)) {
                         $arrValues[$objFiles->uuid] = array('id' => in_array($objFiles->uuid, $arrTemp) ? $objFiles->uuid : \StringUtil::binToUuid($objFiles->uuid), 'value' => $chunk);
                         $arrSet[] = $objFiles->uuid;
                     }
                 }
             }
             // Get the temporary files
             foreach ($arrTemp as $varFile) {
                 $chunk = $this->generateFileItem($varFile);
                 if (strlen($chunk)) {
                     $arrValues[$varFile] = array('id' => in_array($varFile, $arrTemp) ? $varFile : \StringUtil::binToUuid($varFile), 'value' => $chunk);
                     $arrSet[] = $varFile;
                 }
             }
         }
         // Parse the set array
         foreach ($arrSet as $k => $v) {
             if (in_array($v, $arrTemp)) {
                 $strSet[$k] = $v;
             } else {
                 $arrSet[$k] = \StringUtil::binToUuid($v);
             }
         }
         $this->set = implode(',', $arrSet);
         $this->values = $arrValues;
         $this->deleteTitle = specialchars($GLOBALS['TL_LANG']['MSC']['delete']);
         $this->extensions = json_encode(trimsplit(',', $this->arrConfiguration['extensions']));
         $this->limit = $this->arrConfiguration['uploaderLimit'] ? $this->arrConfiguration['uploaderLimit'] : 0;
         $this->minSizeLimit = $this->arrConfiguration['minlength'] ? $this->arrConfiguration['minlength'] : 0;
         $this->sizeLimit = $this->arrConfiguration['maxlength'] ? $this->arrConfiguration['maxlength'] : 0;
         $this->chunkSize = $this->arrConfiguration['chunkSize'] ? $this->arrConfiguration['chunkSize'] : 0;
         $this->concurrent = $this->arrConfiguration['concurrent'] ? true : false;
         $this->maxConnections = $this->arrConfiguration['maxConnections'] ? $this->arrConfiguration['maxConnections'] : 3;
         $this->blnValuesPrepared = true;
     }
     return parent::parse($arrAttributes);
 }
 /**
  * Generate the widget and return it as string
  * @param array
  * @return string
  */
 public function parse($arrAttributes = null)
 {
     $arrSet = array();
     $arrValues = array();
     if (!empty($this->varValue)) {
         // Can be an array
         $arrUuids = array();
         $arrTemp = array();
         $this->varValue = (array) $this->varValue;
         foreach ($this->varValue as $varFile) {
             if (\Validator::isBinaryUuid($varFile)) {
                 $arrUuids[] = $varFile;
             } else {
                 $arrTemp[] = $varFile;
             }
         }
         $objFiles = \FilesModel::findMultipleByUuids($arrUuids);
         // Get the database files
         if ($objFiles !== null) {
             while ($objFiles->next()) {
                 $chunk = $this->generateFileItem($objFiles->path);
                 if (strlen($chunk)) {
                     $arrValues[$objFiles->uuid] = array('id' => in_array($objFiles->uuid, $arrTemp) ? $objFiles->uuid : \StringUtil::binToUuid($objFiles->uuid), 'value' => $chunk);
                     $arrSet[] = $objFiles->uuid;
                 }
             }
         }
         // Get the temporary files
         foreach ($arrTemp as $varFile) {
             $chunk = $this->generateFileItem($varFile);
             if (strlen($chunk)) {
                 $arrValues[$varFile] = array('id' => in_array($varFile, $arrTemp) ? $varFile : \StringUtil::binToUuid($varFile), 'value' => $chunk);
                 $arrSet[] = $varFile;
             }
         }
     }
     // Load the fonts for the drag hint (see #4838)
     $GLOBALS['TL_CONFIG']['loadGoogleFonts'] = true;
     // Parse the set array
     foreach ($arrSet as $k => $v) {
         if (in_array($v, $arrTemp)) {
             $strSet[$k] = $v;
         } else {
             $arrSet[$k] = \StringUtil::binToUuid($v);
         }
     }
     $this->set = implode(',', $arrSet);
     $this->sortable = count($arrValues) > 1;
     $this->orderHint = $GLOBALS['TL_LANG']['MSC']['dragItemsHint'];
     $this->values = $arrValues;
     $this->ajax = \Environment::get('isAjaxRequest') && \Input::post('action') !== 'toggleSubpalette';
     $this->deleteTitle = specialchars($GLOBALS['TL_LANG']['MSC']['delete']);
     $this->extensions = json_encode(trimsplit(',', $this->arrConfiguration['extensions']));
     $this->limit = $this->arrConfiguration['uploaderLimit'] ? $this->arrConfiguration['uploaderLimit'] : 0;
     $this->minSizeLimit = $this->arrConfiguration['minlength'] ? $this->arrConfiguration['minlength'] : 0;
     $this->sizeLimit = $this->arrConfiguration['maxlength'] ? $this->arrConfiguration['maxlength'] : 0;
     $this->chunkSize = $this->arrConfiguration['chunkSize'] ? $this->arrConfiguration['chunkSize'] : 0;
     $this->concurrent = $this->arrConfiguration['concurrent'] ? true : false;
     $this->maxConnections = $this->arrConfiguration['maxConnections'] ? $this->arrConfiguration['maxConnections'] : 3;
     return parent::parse($arrAttributes);
 }
 /**
  * Generate the widget and return it as string
  * @param array
  * @return string
  */
 public function parse($arrAttributes = null)
 {
     $arrSet = array();
     $arrValues = array();
     if (!empty($this->varValue)) {
         // Can be an array
         $arrUuids = array();
         $arrTemp = array();
         $this->varValue = (array) $this->varValue;
         foreach ($this->varValue as $varFile) {
             if (\Validator::isBinaryUuid($varFile)) {
                 $arrUuids[] = $varFile;
             } else {
                 $arrTemp[] = $varFile;
             }
         }
         $objFiles = \FilesModel::findMultipleByUuids($arrUuids);
         // Get the database files
         if ($objFiles !== null) {
             while ($objFiles->next()) {
                 $chunk = $this->generateFileItem($objFiles->path);
                 if (strlen($chunk)) {
                     $arrValues[$objFiles->uuid] = array('id' => in_array($objFiles->uuid, $arrTemp) ? $objFiles->uuid : \String::binToUuid($objFiles->uuid), 'value' => $chunk);
                     $arrSet[] = $objFiles->uuid;
                 }
             }
         }
         // Get the temporary files
         foreach ($arrTemp as $varFile) {
             $chunk = $this->generateFileItem($varFile);
             if (strlen($chunk)) {
                 $arrValues[$varFile] = array('id' => in_array($varFile, $arrTemp) ? $varFile : \String::binToUuid($varFile), 'value' => $chunk);
                 $arrSet[] = $varFile;
             }
         }
     }
     // Load the fonts for the drag hint (see #4838)
     $GLOBALS['TL_CONFIG']['loadGoogleFonts'] = true;
     // Parse the set array
     foreach ($arrSet as $k => $v) {
         if (in_array($v, $arrTemp)) {
             $strSet[$k] = $v;
         } else {
             $arrSet[$k] = \String::binToUuid($v);
         }
     }
     $this->set = implode(',', $arrSet);
     $this->sortable = count($arrValues) > 1;
     $this->orderHint = $GLOBALS['TL_LANG']['MSC']['dragItemsHint'];
     $this->values = $arrValues;
     $this->ajax = \Environment::get('isAjaxRequest');
     $this->deleteTitle = specialchars($GLOBALS['TL_LANG']['MSC']['delete']);
     $this->extensions = json_encode(trimsplit(',', $this->arrConfiguration['extensions']));
     $this->limit = $this->arrConfiguration['uploaderLimit'] ? $this->arrConfiguration['uploaderLimit'] : 0;
     $this->sizeLimit = $this->arrConfiguration['maxlength'] ? $this->arrConfiguration['maxlength'] : 0;
     $this->chunkSize = $this->arrConfiguration['chunkSize'] ? $this->arrConfiguration['chunkSize'] : 0;
     $this->config = $this->arrConfiguration['uploaderConfig'];
     $this->texts = json_encode(array('text' => array('formatProgress' => $GLOBALS['TL_LANG']['MSC']['fineuploader_formatProgress'], 'failUpload' => $GLOBALS['TL_LANG']['MSC']['fineuploader_failUpload'], 'waitingForResponse' => $GLOBALS['TL_LANG']['MSC']['fineuploader_waitingForResponse'], 'paused' => $GLOBALS['TL_LANG']['MSC']['fineuploader_paused']), 'messages' => array('tooManyFilesError' => $GLOBALS['TL_LANG']['MSC']['fineuploader_tooManyFilesError'], 'unsupportedBrowser' => $GLOBALS['TL_LANG']['MSC']['fineuploader_unsupportedBrowser']), 'retry' => array('autoRetryNote' => $GLOBALS['TL_LANG']['MSC']['fineuploader_autoRetryNote']), 'deleteFile' => array('confirmMessage' => $GLOBALS['TL_LANG']['MSC']['fineuploader_confirmMessage'], 'deletingStatusText' => $GLOBALS['TL_LANG']['MSC']['fineuploader_deletingStatusText'], 'deletingFailedText' => $GLOBALS['TL_LANG']['MSC']['fineuploader_deletingFailedText']), 'paste' => array('namePromptMessage' => $GLOBALS['TL_LANG']['MSC']['fineuploader_namePromptMessage'])));
     $this->labels = array('drop' => $GLOBALS['TL_LANG']['MSC']['fineuploader_drop'], 'upload' => $GLOBALS['TL_LANG']['MSC']['fineuploader_upload'], 'processing' => $GLOBALS['TL_LANG']['MSC']['fineuploader_processing']);
     return parent::parse($arrAttributes);
 }