Exemplo n.º 1
0
 /**
  * Draws the html form element
  *
  * @param   array  $data           To pre-populate element with
  * @param   int    $repeatCounter  Repeat group counter
  *
  * @return  string	Elements html
  */
 public function render($data, $repeatCounter = 0)
 {
     $this->_repeatGroupCounter = $repeatCounter;
     $id = $this->getHTMLId($repeatCounter);
     $name = $this->getHTMLName($repeatCounter);
     $groupModel = $this->getGroup();
     $element = $this->getElement();
     $params = $this->getParams();
     $use_wip = $params->get('upload_use_wip', '0') == '1';
     $device_capture = $params->get('ul_device_capture', '0');
     if ($element->hidden == '1') {
         return $this->getHiddenField($name, $data[$name], $id);
     }
     $str = array();
     $value = $this->getValue($data, $repeatCounter);
     $value = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     $value = $this->checkForSingleCropValue($value);
     if ($params->get('ajax_upload')) {
         if (isset($value->file)) {
             $value = $value->file;
         }
     }
     $storage = $this->getStorage();
     $use_download_script = $params->get('fu_use_download_script', '0');
     // $$$ rob - explode as it may be grouped data (if element is a repeating upload)
     $values = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     if (!$this->isEditable() && ($use_download_script == FU_DOWNLOAD_SCRIPT_DETAIL || $use_download_script == FU_DOWNLOAD_SCRIPT_BOTH)) {
         $links = array();
         if (!is_array($value)) {
             $value = (array) $value;
         }
         foreach ($value as $v) {
             $links[] = $this->downloadLink($v, $data, $repeatCounter);
         }
         return count($links) < 2 ? implode("\n", $links) : '<ul class="fabrikRepeatData"><li>' . implode('</li><li>', $links) . '</li></ul>';
     }
     $render = new stdClass();
     $render->output = '';
     $allRenders = array();
     /*
      * $$$ hugh testing slide-show display
      */
     if ($params->get('fu_show_image') === '3' && !$this->isEditable()) {
         // Failed validations - format different!
         if (array_key_exists('id', $values)) {
             $values = array_keys($values['id']);
         }
         $rendered = $this->buildCarousel($id, $values, $params, $data);
         return $rendered;
     }
     if ($params->get('fu_show_image') !== '0' && !$params->get('ajax_upload') || !$this->isEditable()) {
         // Failed validations - format different!
         if (array_key_exists('id', $values)) {
             $values = array_keys($values['id']);
         }
         // End failed validations
         foreach ($values as $value) {
             if (is_object($value)) {
                 $value = $value->file;
             }
             $render = $this->loadElement($value);
             if ($use_wip && $this->isEditable() || $value != '' && ($storage->exists(COM_FABRIK_BASE . $value) || JString::substr($value, 0, 4) == 'http')) {
                 $render->render($this, $params, $value);
             }
             if ($render->output != '') {
                 if ($this->isEditable()) {
                     // $$$ hugh - TESTING - using HTML5 to show a selected image, so if no file, still need the span, hidden, but not the actual delete button
                     if ($use_wip && empty($value)) {
                         $render->output = '<span class="fabrikUploadDelete fabrikHide" id="' . $id . '_delete_span">' . $render->output . '</span>';
                     } else {
                         $render->output = '<span class="fabrikUploadDelete" id="' . $id . '_delete_span">' . $this->deleteButton($value, $repeatCounter) . $render->output . '</span>';
                     }
                     /*
                     if ($use_wip)
                     {
                     	$render->output .= '<video id="' . $id . '_video_preview" controls></video>';
                     }
                     */
                 }
                 $allRenders[] = $render->output;
             }
         }
     }
     if (!$this->isEditable()) {
         if ($render->output == '' && $params->get('default_image') != '') {
             $render->output = '<img src="' . $params->get('default_image') . '" alt="image" />';
             $allRenders[] = $render->output;
         }
         $str[] = '<div class="fabrikSubElementContainer">';
         $ul = '<ul class="fabrikRepeatData"><li>' . implode('</li><li>', $allRenders) . '</li></ul>';
         $str[] = count($allRenders) < 2 ? implode("\n", $allRenders) : $ul;
         $str[] = '</div>';
         return implode("\n", $str);
     }
     $allRenders = implode('<br/>', $allRenders);
     $allRenders .= $allRenders == '' ? '' : '<br/>';
     $capture = '';
     switch ($device_capture) {
         case 1:
             $capture = ' capture="camera"';
         case 2:
             $capture = ' accept="image/*"' . $capture;
             break;
         case 3:
             $capture = ' capture="microphone"';
         case 4:
             $capture = ' accept="audio/*"' . $capture;
             break;
         case 5:
             $capture = ' capture="camcorder"';
         case 6:
             $capture = ' accept="video/*"' . $capture;
             break;
         default:
             $capture = implode(",.", $this->_getAllowedExtension());
             $capture = $capture ? ' accept=".' . $capture . '"' : '';
             break;
     }
     $str[] = $allRenders . '<input class="fabrikinput" name="' . $name . '" type="file" id="' . $id . '"' . $capture . ' />' . "\n";
     if ($params->get('fileupload_storage_type', 'filesystemstorage') == 'filesystemstorage' && $params->get('upload_allow_folderselect') == '1') {
         $rDir = JPATH_SITE . '/' . $params->get('ul_directory');
         $folders = JFolder::folders($rDir);
         $str[] = FabrikHelperHTML::folderAjaxSelect($folders);
         if ($groupModel->canRepeat()) {
             $uploadName = FabrikString::rtrimword($name, "[{$repeatCounter}]") . "[ul_end_dir][{$repeatCounter}]";
         } else {
             $uploadName = $name . '[ul_end_dir]';
         }
         $str[] = '<input name="' . $uploadName . '" type="hidden" class="folderpath"/>';
     }
     if ($params->get('ajax_upload')) {
         $str = array();
         $str[] = $allRenders;
         $str = $this->plupload($str, $repeatCounter, $values);
     }
     array_unshift($str, '<div class="fabrikSubElementContainer">');
     $str[] = '</div>';
     return implode("\n", $str);
 }
Exemplo n.º 2
0
 /**
  * draws the form element
  * @param int repeat group counter
  * @return string returns element html
  */
 function render($data, $repeatCounter = 0)
 {
     $params = $this->getParams();
     $name = $this->getHTMLName($repeatCounter);
     $value = $this->getValue($data, $repeatCounter);
     $id = $this->getHTMLId($repeatCounter);
     $rootFolder = $params->get('selectImage_root_folder');
     // $$$ hugh - tidy up a bit so we don't have so many ///'s in the URL's
     $rootFolder = ltrim($rootFolder, '/');
     $rootFolder = rtrim($rootFolder, '/');
     // $$$ rob - 30/062011 allow for full urls in the image. (e.g from csv import)
     $defaultImage = substr($value, 0, 4) == 'http' ? $value : COM_FABRIK_LIVESITE . $rootFolder . '/' . $value;
     // $$$ rob - 30/06/2011 can only select an image if its not a remote image
     $canSelect = $params->get('image_front_end_select', '0') && substr($value, 0, 4) !== 'http';
     $float = $params->get('image_float');
     $float = $float != '' ? "style='float:{$float};'" : '';
     $str = array();
     $str[] = '<div class="fabrikSubElementContainer" id="' . $id . '">';
     $rootFolder = str_replace('/', DS, $rootFolder);
     if ($canSelect && $this->_editable) {
         $str[] = '<img src="' . $defaultImage . '" alt="' . $value . '" ' . $float . ' class="imagedisplayor"/>';
         if (array_key_exists($name, $data)) {
             if (trim($value) == '') {
                 $path = "/";
             } else {
                 $bits = explode("/", $value);
                 if (count($bits) > 1) {
                     $path = DS . array_shift($bits) . DS;
                     $path = $rootFolder . $path;
                     $val = array_shift($bits);
                 } else {
                     $path = $rootFolder;
                 }
             }
         } else {
             $path = $rootFolder;
         }
         $images = array();
         $imagenames = (array) JFolder::files(JPATH_SITE . DS . $path);
         foreach ($imagenames as $n) {
             $images[] = JHTML::_('select.option', $n, $n);
         }
         // $$$rob not sure about his name since we are adding $repeatCounter to getHTMLName();
         $imageName = $this->_group->canRepeat() ? FabrikString::rtrimWord($name, "][{$repeatCounter}]") . "_image][{$repeatCounter}]" : $id . '_image';
         $image = array_pop(explode('/', $value));
         // $$$ hugh - append $rootFolder to JPATH_SITE, otherwise we're showing folders
         // they aren't supposed to be able to see.
         $folders = JFolder::folders(JPATH_SITE . DS . $rootFolder);
         // @TODO - if $folders is empty, hide the button/widget?  All they can do is select
         // from the initial image dropdown list, so no point having the widget for changing folder?
         $str[] = '<br/>' . JHTML::_('select.genericlist', $images, $imageName, 'class="inputbox imageselector" ', 'value', 'text', $image);
         $str[] = FabrikHelperHTML::folderAjaxSelect($folders);
         $str[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" class="fabrikinput hiddenimagepath folderpath" />';
     } else {
         $linkURL = $params->get('link_url', '');
         $imgstr = '<img src="' . $defaultImage . '" alt="' . $value . '" ' . $float . ' class="imagedisplayor"/>' . "\n";
         if ($linkURL) {
             $imgstr = '<a href="' . $linkURL . '" target="_blank">' . $imgstr . '</a>';
         }
         $str[] = $imgstr;
         $str[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" class="fabrikinput hiddenimagepath folderpath" />';
     }
     $str[] = '</div>';
     return implode("\n", $str);
 }
Exemplo n.º 3
0
 /**
  * draws the form element
  * @param array data
  * @param int repeat group counter
  * @return string returns element html
  */
 function render($data, $repeatCounter = 0)
 {
     $this->_repeatGroupCounter = $repeatCounter;
     $id = $this->getHTMLId($repeatCounter);
     $name = $this->getHTMLName($repeatCounter);
     $groupModel = $this->getGroup();
     $element = $this->getElement();
     $params = $this->getParams();
     if ($element->hidden == '1') {
         return $this->getHiddenField($name, $data[$name], $id);
     }
     $str = '';
     $value = $this->getValue($data, $repeatCounter);
     $value = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     $value = $this->checkForSingleCropValue($value);
     if ($params->get('ajax_upload')) {
         if (isset($value->file)) {
             $value = $value->file;
         }
     }
     $imagedata = array();
     /* 	if (strstr($value, GROUPSPLITTER)) {
     			//crop stuff needs to be removed from data to get correct file path
     		$imagedata = explode(GROUPSPLITTER, $value);
     		// $$$ rob commented out as this was barfing in detailed view (not tested in edit view yet)
     		//$value = $imagedata[0];
     
     		} */
     $ulDir = $params->get('ul_directory');
     $storage = $this->getStorage();
     $formModel = $this->getFormModel();
     $formid = $formModel->getId();
     $use_download_script = $params->get('fu_use_download_script', '0');
     if (!$this->_editable && ($use_download_script == FU_DOWNLOAD_SCRIPT_DETAIL || $use_download_script == FU_DOWNLOAD_SCRIPT_BOTH)) {
         return $this->downloadLink();
     }
     // $$$ rob - explode as it may be grouped data (if element is a repeating upload)
     $values = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     $render = new stdClass();
     $render->output = '';
     if ($params->get('fu_show_image') !== '0' && !$params->get('ajax_upload') || !$this->_editable) {
         foreach ($values as $value) {
             if (is_object($value)) {
                 $value = $value->file;
             }
             $render = $this->loadElement($value);
             if ($value != '' && ($storage->exists(COM_FABRIK_BASE . $value) || substr($value, 0, 4) == 'http')) {
                 $render->render($this, $params, $value);
             }
             if ($render->output != '') {
                 $str .= $render->output;
             }
         }
     }
     if (!$this->_editable) {
         if ($render->output == '' && $params->get('default_image') != '') {
             $render->output = '<img src="' . $params->get('default_image') . '" alt="image" />';
         }
         $str = '<div class="fabrikSubElementContainer">';
         $str .= $render->output;
         $str .= '</div>';
         return $str;
     }
     $str .= '<input class="fabrikinput" name="' . $name . '" type="file" id="' . $id . '" />' . "\n";
     if ($params->get('upload_allow_folderselect') == '1') {
         $rDir = JPATH_SITE . DS . $params->get('ul_directory');
         $folders = JFolder::folders($rDir);
         $str .= FabrikHelperHTML::folderAjaxSelect($folders);
         if ($groupModel->canRepeat()) {
             $ulname = FabrikString::rtrimword($name, "[{$repeatCounter}]") . "[ul_end_dir][{$repeatCounter}]";
         } else {
             $ulname = $name . '[ul_end_dir]';
         }
         $str .= '<input name="' . $ulname . '" type="hidden" class="folderpath"/>';
     }
     if ($params->get('ajax_upload')) {
         $str = $render->output . $this->plupload($str, $repeatCounter, $values);
     }
     $str = '<div class="fabrikSubElementContainer">' . $str;
     $str .= '</div>';
     return $str;
 }
Exemplo n.º 4
0
 /**
  * Draws the html form element
  *
  * @param   array  $data           to preopulate element with
  * @param   int    $repeatCounter  repeat group counter
  *
  * @return  string	elements html
  */
 public function render($data, $repeatCounter = 0)
 {
     $this->_repeatGroupCounter = $repeatCounter;
     $id = $this->getHTMLId($repeatCounter);
     $name = $this->getHTMLName($repeatCounter);
     $groupModel = $this->getGroup();
     $element = $this->getElement();
     $params = $this->getParams();
     if ($element->hidden == '1') {
         return $this->getHiddenField($name, $data[$name], $id);
     }
     $str = array();
     $value = $this->getValue($data, $repeatCounter);
     $value = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     $value = $this->checkForSingleCropValue($value);
     if ($params->get('ajax_upload')) {
         if (isset($value->file)) {
             $value = $value->file;
         }
     }
     $imagedata = array();
     $ulDir = $params->get('ul_directory');
     $storage = $this->getStorage();
     $formModel = $this->getFormModel();
     $formid = $formModel->getId();
     $use_download_script = $params->get('fu_use_download_script', '0');
     // $$$ rob - explode as it may be grouped data (if element is a repeating upload)
     $values = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     if (!$this->isEditable() && ($use_download_script == FU_DOWNLOAD_SCRIPT_DETAIL || $use_download_script == FU_DOWNLOAD_SCRIPT_BOTH)) {
         $links = array();
         if (!is_array($value)) {
             $value = (array) $value;
         }
         foreach ($value as $v) {
             $links[] = $this->downloadLink($v, $data, $repeatCounter);
         }
         return implode("\n", $links);
     }
     $render = new stdClass();
     $render->output = '';
     $allRenders = '';
     if ($params->get('fu_show_image') !== '0' && !$params->get('ajax_upload') || !$this->isEditable()) {
         // Failed validations - format different!
         if (array_key_exists('id', $values)) {
             $values = array_keys($values['id']);
         }
         // End failed validations
         foreach ($values as $value) {
             if (is_object($value)) {
                 $value = $value->file;
             }
             $render = $this->loadElement($value);
             if ($value != '' && ($storage->exists(COM_FABRIK_BASE . $value) || JString::substr($value, 0, 4) == 'http')) {
                 $render->render($this, $params, $value);
             }
             if ($render->output != '') {
                 $allRenders .= $render->output;
             }
         }
     }
     if (!$this->isEditable()) {
         if ($render->output == '' && $params->get('default_image') != '') {
             $render->output = '<img src="' . $params->get('default_image') . '" alt="image" />';
         }
         $str[] = '<div class="fabrikSubElementContainer">';
         $str[] = $allRenders;
         $str[] = '</div>';
         return implode("\n", $str);
     }
     $allRenders .= $allRenders == '' ? '' : '<br/>';
     $str[] = $allRenders . '<input class="fabrikinput" name="' . $name . '" type="file" id="' . $id . '" />' . "\n";
     if ($params->get('upload_allow_folderselect') == '1') {
         $rDir = JPATH_SITE . '/' . $params->get('ul_directory');
         $folders = JFolder::folders($rDir);
         $str[] = FabrikHelperHTML::folderAjaxSelect($folders);
         if ($groupModel->canRepeat()) {
             $ulname = FabrikString::rtrimword($name, "[{$repeatCounter}]") . "[ul_end_dir][{$repeatCounter}]";
         } else {
             $ulname = $name . '[ul_end_dir]';
         }
         $str[] = '<input name="' . $ulname . '" type="hidden" class="folderpath"/>';
     }
     if ($params->get('ajax_upload')) {
         $str = array();
         $str[] = $allRenders;
         $str = $this->plupload($str, $repeatCounter, $values);
     }
     array_unshift($str, '<div class="fabrikSubElementContainer">');
     $str[] = '</div>';
     return implode("\n", $str);
 }
Exemplo n.º 5
0
if ($d->canSelect) {
    ?>
		<img src="<?php 
    echo $d->defaultImage;
    ?>
" alt="<?php 
    echo $d->value;
    ?>
" <?php 
    echo $d->float;
    ?>
 class="imagedisplayor" />
		<br />
		<?php 
    echo JHTML::_('select.genericlist', $d->images, $d->imageName, 'class="inputbox imageselector" ', 'value', 'text', $d->image);
    echo FabrikHelperHTML::folderAjaxSelect($d->folders);
    ?>
		<input type="hidden" name="<?php 
    echo $d->name;
    ?>
" value="<?php 
    echo $d->value;
    ?>
" class="fabrikinput hiddenimagepath folderpath" />
	<?php 
} else {
    if ($d->linkURL) {
        ?>
			<a href="<?php 
        echo $d->linkURL;
        ?>
Exemplo n.º 6
0
 /**
  * draws the form element
  * @param array data
  * @param int repeat group counter
  * @return string returns element html
  */
 function render($data, $repeatCounter = 0)
 {
     $this->_repeatGroupCounter = $repeatCounter;
     $id = $this->getHTMLId($repeatCounter);
     $name = $this->getHTMLName($repeatCounter);
     $groupModel =& $this->getGroup();
     $element =& $this->getElement();
     $params =& $this->getParams();
     if ($element->hidden == '1') {
         return $this->getHiddenField($name, $data[$name], $id);
     }
     $str = '';
     $value = $this->getValue($data, $repeatCounter);
     //if its a single upload crop element
     if ($params->get('ajax_upload') && $params->get('ajax_max', 4) == 1) {
         $singleCropImg = json_decode($value);
         if (empty($singleCropImg)) {
             $value = '';
         } else {
             $singleCropImg = $singleCropImg[0];
             $value = $singleCropImg->file;
         }
     }
     $imagedata = array();
     if (strstr($value, GROUPSPLITTER)) {
         //crop stuff needs to be removed from data to get correct file path
         $imagedata = explode(GROUPSPLITTER, $value);
         // $$$ rob commented out as this was barfing in detailed view (not tested in edit view yet)
         //$value = $imagedata[0];
     }
     $ulDir = $params->get('ul_directory');
     $storage =& $this->getStorage();
     $formModel = $this->getForm();
     $formid = $formModel->getId();
     // $$$ rob - explode as it may be grouped data (if element is a repeating upload)
     $values = explode(GROUPSPLITTER, $value);
     $use_download_script = $params->get('fu_use_download_script', '0');
     if (!$this->_editable && ($use_download_script == FU_DOWNLOAD_SCRIPT_DETAIL || $use_download_script == FU_DOWNLOAD_SCRIPT_BOTH)) {
         $ret_url = array();
         foreach ($values as $v) {
             if (empty($value) || !$storage->exists(COM_FABRIK_BASE . DS . $value)) {
                 return "";
             }
             $aclEl = str_replace('.', '___', $params->get('fu_download_acl', ''));
             if (!empty($aclEl)) {
                 $canDownload = FabrikWorker::getACL($data[$aclEl], 'filedownload');
                 if (!$canDownload) {
                     $img = $params->get('fu_download_noaccess_image');
                     return $img == '' ? '' : "<img src=\"images/stories/{$img}\" alt=\"" . JText::_('DOWNLOAD NO PERMISSION') . "\" />";
                 }
             }
             $rowid = JRequest::getVar('rowid', '0');
             $elementid = $this->_id;
             $title = basename($value);
             if ($params->get('fu_title_element') == '') {
                 $title_name = $this->getFullName(true, true, false) . '__title';
             } else {
                 $title_name = str_replace('.', '___', $params->get('fu_title_element'));
             }
             $title_name .= '_raw';
             if (is_array($formModel->_data)) {
                 if (array_key_exists($title_name, $formModel->_data)) {
                     if (!empty($formModel->_data[$title_name])) {
                         $title = $formModel->_data[$title_name];
                         $title = explode(GROUPSPLITTER, $title);
                         $title = $title[$repeatCounter];
                     }
                 }
             }
             if ($params->get('fu_download_access_image') !== '') {
                 $title = "<img src=\"images/stories/" . $params->get('fu_download_access_image') . "\" alt=\"{$title}\" />";
             }
             //$link = "&format=raw&Itemid=undefined&controller=plugin&task=pluginAjax&plugin=fabrikcascadingdropdown&method=ajax_getOptions&element_id=588"
             $link = COM_FABRIK_LIVESITE . "index.php?option=com_fabrik&controller=plugin&task=pluginAjax&plugin=fabrikfileupload&method=ajax_download&element_id={$elementid}&formid={$formid}&rowid={$rowid}&repeatcount={$repeatCounter}";
             $url = "<a href=\"{$link}\">{$title}</a>";
             $ret_url[] = $url;
         }
         return implode('<br />', $ret_url);
     }
     // $$$ rob - explode as it may be grouped data (if element is a repeating upload)
     $values = explode(GROUPSPLITTER, $value);
     $render =& $this->loadElement($value);
     $render->output = '';
     //if (!$params->get('ajax_upload') || !$this->_editable) { //mutliple images should still be rendered no?
     // $$$ hugh - revert to old behavior at least for non-AJAX uploads, which is to show existing media
     // in form view.
     if (!$this->_editable || $this->_editable && !$params->get('ajax_upload', 0)) {
         if ($params->get('fu_show_image') != '0') {
             foreach ($values as $value) {
                 if ($value != '' && $storage->exists(COM_FABRIK_BASE . DS . $value)) {
                     $render->render($this, $params, $value);
                     //$render->output .= "<br />";//messes up multiple images
                 }
             }
         }
         if ($render->output == '' && $params->get('default_image') != '') {
             $render->output = "<img src=\"{$params->get('default_image')}\" alt=\"image\" />";
         }
         if ($render->output != '') {
             $str .= $render->output . "<br />";
         }
     }
     if (!$this->_editable) {
         $str = "<div class=\"fabrikSubElementContainer\">{$str}";
         $str .= "</div>";
         return $str;
     } else {
         // $$$ rob dont wrap readonly in subElementContainer as it stops dataConsideredEmpty() working when testing ro values
     }
     if ($params->get('ajax_upload')) {
         $str = "<div id=\"{$id}\">" . $render->output . $this->plupload($str, $repeatCounter, $values) . "</div>";
     } else {
         $str .= '<input class="fabrikinput" name="' . $name . '" type="file" id="' . $id . '" />' . "\n";
         if ($params->get('upload_allow_folderselect', 0) == '1') {
             $rDir = JPATH_SITE . DS . $params->get('ul_directory');
             $folders = JFolder::folders($rDir);
             $str .= FabrikHelperHTML::folderAjaxSelect($folders, '');
             if ($groupModel->canRepeat()) {
                 $ulname = FabrikString::rtrimword($name, "[{$repeatCounter}]") . "[ul_end_dir][{$repeatCounter}]";
             } else {
                 $ulname = $name . '[ul_end_dir]';
             }
             $str .= "<input name=\"{$ulname}\" type=\"hidden\" class=\"folderpath\"/>";
         }
     }
     $str = "<div class=\"fabrikSubElementContainer\">{$str}";
     $str .= "</div>";
     return $str;
 }
Exemplo n.º 7
0
 /**
  * draws the form element
  * @param array data
  * @param int repeat group counter
  * @return string returns element html
  */
 function render($data, $repeatCounter = 0)
 {
     $this->_repeatGroupCounter = $repeatCounter;
     $id = $this->getHTMLId($repeatCounter);
     $name = $this->getHTMLName($repeatCounter);
     $groupModel =& $this->getGroup();
     $element = $this->getElement();
     $params = $this->getParams();
     if ($element->hidden == '1') {
         return $this->getHiddenField($name, $data[$name], $id);
     }
     $str = '';
     $value = $this->getValue($data, $repeatCounter);
     $value = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     $ulDir = $params->get('ul_directory');
     $storage =& $this->getStorage();
     $formModel = $this->getFormModel();
     $formid = $formModel->get('id');
     $use_download_script = $params->get('fu_use_download_script', '0');
     if (!$this->_editable && ($use_download_script == FU_DOWNLOAD_SCRIPT_DETAIL || $use_download_script == FU_DOWNLOAD_SCRIPT_BOTH)) {
         return $this->downloadLink();
     }
     // $$$ rob - explode as it may be grouped data (if element is a repeating upload)
     $values = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
     $render = new stdClass();
     $render->output = '';
     if ($params->get('fu_show_image') != '0' && !$params->get('ajax_upload') || !$this->_editable) {
         foreach ($values as $value) {
             $render =& $this->loadElement($value);
             if ($value != '' && ($storage->exists(COM_FABRIK_BASE . $value) || substr($value, 0, 4) == 'http')) {
                 $render->render($this, $params, $value);
             }
             if ($render->output != '') {
                 $str .= $render->output;
             }
         }
     }
     if (!$this->_editable) {
         if ($render->output == '' && $params->get('default_image') != '') {
             $render->output = "<img src=\"{$params->get('default_image')}\" alt=\"image\" />";
         }
     }
     if (!$this->_editable) {
         $str = "<div class=\"fabrikSubElementContainer\">{$str}";
         $str .= "</div>";
         return $str;
     } else {
         // $$$ rob dont wrap readonly in subElementContainer as it stops dataConsideredEmpty() working when testing ro values
     }
     $str .= '<input class="fabrikinput" name="' . $name . '" type="file" id="' . $id . '" />' . "\n";
     if ($params->get('upload_allow_folderselect') == '1') {
         $rDir = JPATH_SITE . DS . $params->get('ul_directory');
         $folders = JFolder::folders($rDir);
         $str .= FabrikHelperHTML::folderAjaxSelect($folders);
         if ($groupModel->canRepeat()) {
             $ulname = FabrikString::rtrimword($name, "[{$repeatCounter}]") . "[ul_end_dir][{$repeatCounter}]";
         } else {
             $ulname = $name . '[ul_end_dir]';
         }
         $str .= "<input name=\"{$ulname}\" type=\"hidden\" class=\"folderpath\"/>";
     }
     if ($params->get('ajax_upload')) {
         $str = $render->output . $this->plupload($str, $repeatCounter, $values);
     }
     $str = "<div class=\"fabrikSubElementContainer\">{$str}";
     $str .= "</div>";
     return $str;
 }