Render the files in file area.

@param string $component
@param string $area
@param int $submissionid
@return string
344511
public function render_area_files($component, $area, $submissionid) {
        global $USER;

        return $this->get_renderer()->assign_files($this->context, $submissionid, $area, $component);

    }
1060263
protected void renderARIARequired(FacesContext context, UIInput component) throws IOException {
        if (component.isRequired()) {
            ResponseWriter writer = context.getResponseWriter();
            writer.writeAttribute(HTML.ARIA_REQUIRED, "true", null);
        }
    }
694440
public function exportValue(&$submitted, $assoc = false) {

        $value = '';
        $filetypeselement = null;

        foreach ($this->_elements as $key => $element) {
            if ($element->_attributes['name'] === 'filetypes') {
                $filetypeselement = $this->_elements[$key];
            }
        }

        if ($filetypeselement) {
            $formval = $filetypeselement->exportValue($submitted[$this->getName()], false);
            if ($formval) {
                $value = $this->util->normalize_file_types($formval);
                if ($value === ['*'] && !$this->allowall) {
                    $value = [];
                }
                $value = implode(',', $value);
            }
        }

        return $this->_prepareValue($value, $assoc);
    }
838823
protected void renderId(
      FacesContext context,
      UIComponent  component) throws IOException
    {
      if (shouldRenderId(context, component))
      {
        String clientId = getClientId(context, component);
        context.getResponseWriter().writeAttribute(HTML.ID_ATTR, clientId, JSFAttr.ID_ATTR);
      }
    }
970191
public function renderAction(ComponentInterface $component, ContentInterface $content)
    {
        if (!$mediaData = $component->getData('medias')) {
            // @todo log
            return new Response('');
        }

        return $this->get('synapse')
            ->createDecorator($component)
            ->decorate(array(
                'content' => $content,
                'medias' => $this->container->get('synapse.image.loader')
                    ->retrieveAll(array('id' => $component->getData('medias'))),
            ))
        ;
    }
369871
function GrantAddContentToLayoutArea(Area $area)
    {
        $result = $this->Grant(BackendAction::Create(), $area);
        if (!$result->ToBool())
        {
            return $result;
        }
        return $this->GrantAddContentToLayout($area->GetLayout());
    }
916866
private function fillArea(Area $area, $path)
    {
        $finder = new Finder($path);

        foreach (SortorderParser::parse($finder) as $subPath)
        {
            $contentFullPath = $path . DIRECTORY_SEPARATOR . $subPath;
            if(file_exists($contentFullPath))
            {
                //Detect file extension
                $type = substr($subPath, strrpos($subPath, '.') + 1);

                $area->addContentAsLast(
                    new Content(
                        $type,
                        substr($contentFullPath, strlen($this->contentPath))
                    )
                );
            }
            else
            {
                throw new  PageException("Unable to find content at [$contentFullPath]");
            }
        }
    }
874326
public function create_directory($contextid, $component, $filearea, $itemid, $filepath, $userid = null) {
        global $DB;

        // validate all parameters, we do not want any rubbish stored in database, right?
        if (!is_number($contextid) or $contextid < 1) {
            throw new file_exception('storedfileproblem', 'Invalid contextid');
        }

        $component = clean_param($component, PARAM_COMPONENT);
        if (empty($component)) {
            throw new file_exception('storedfileproblem', 'Invalid component');
        }

        $filearea = clean_param($filearea, PARAM_AREA);
        if (empty($filearea)) {
            throw new file_exception('storedfileproblem', 'Invalid filearea');
        }

        if (!is_number($itemid) or $itemid < 0) {
            throw new file_exception('storedfileproblem', 'Invalid itemid');
        }

        $filepath = clean_param($filepath, PARAM_PATH);
        if (strpos($filepath, '/') !== 0 or strrpos($filepath, '/') !== strlen($filepath)-1) {
            // path must start and end with '/'
            throw new file_exception('storedfileproblem', 'Invalid file path');
        }

        $pathnamehash = $this->get_pathname_hash($contextid, $component, $filearea, $itemid, $filepath, '.');

        if ($dir_info = $this->get_file_by_hash($pathnamehash)) {
            return $dir_info;
        }

        static $contenthash = null;
        if (!$contenthash) {
            $this->add_string_to_pool('');
            $contenthash = self::hash_from_string('');
        }

        $now = time();

        $dir_record = new stdClass();
        $dir_record->contextid = $contextid;
        $dir_record->component = $component;
        $dir_record->filearea  = $filearea;
        $dir_record->itemid    = $itemid;
        $dir_record->filepath  = $filepath;
        $dir_record->filename  = '.';
        $dir_record->contenthash  = $contenthash;
        $dir_record->filesize  = 0;

        $dir_record->timecreated  = $now;
        $dir_record->timemodified = $now;
        $dir_record->mimetype     = null;
        $dir_record->userid       = $userid;

        $dir_record->pathnamehash = $pathnamehash;

        $DB->insert_record('files', $dir_record);
        $dir_info = $this->get_file_by_hash($pathnamehash);

        if ($filepath !== '/') {
            //recurse to parent dirs
            $filepath = trim($filepath, '/');
            $filepath = explode('/', $filepath);
            array_pop($filepath);
            $filepath = implode('/', $filepath);
            $filepath = ($filepath === '') ? '/' : "/$filepath/";
            $this->create_directory($contextid, $component, $filearea, $itemid, $filepath, $userid);
        }

        return $dir_info;
    }
432461
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WMultiFileWidget widget = (WMultiFileWidget) component;
		XmlStringBuilder xml = renderContext.getWriter();

		// Check if rendering a file upload response
		String uploadId = widget.getFileUploadRequestId();
		if (uploadId != null) {
			handleFileUploadRequest(widget, xml, uploadId);
			return;
		}
		boolean readOnly = widget.isReadOnly();


		xml.appendTagOpen(TAG_NAME);
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", widget.isHidden(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			long maxFileSize = widget.getMaxFileSize();
			int maxFiles = widget.getMaxFiles();
			WComponent dropzone = widget.getDropzone();
			WImageEditor editor = widget.getEditor();

			xml.appendOptionalAttribute("disabled", widget.isDisabled(), "true");
			xml.appendOptionalAttribute("required", widget.isMandatory(), "true");
			xml.appendOptionalAttribute("toolTip", widget.getToolTip());
			xml.appendOptionalAttribute("accessibleText", widget.getAccessibleText());
			xml.appendOptionalAttribute("acceptedMimeTypes", typesToString(widget.getFileTypes()));
			xml.appendOptionalAttribute("maxFileSize", maxFileSize > 0, maxFileSize);
			xml.appendOptionalAttribute("maxFiles", maxFiles > 0, maxFiles);
			if (dropzone != null) {
				xml.appendAttribute("dropzone", dropzone.getId());
			}
			if (editor != null) {
				xml.appendAttribute("editor", editor.getId());
				if (editor.getUseCamera()) {
					xml.appendAttribute("camera", true);
				}
			}
		}
		if (widget.getColumns() != null) {
			xml.appendAttribute("cols", widget.getColumns());
		}
		if (widget.getFileAjaxAction() != null) {
			xml.appendAttribute("ajax", "true");
		}

		List<Diagnostic> diags = readOnly ? null : widget.getDiagnostics(Diagnostic.ERROR);

		if (widget.getFiles().isEmpty()) {
			if (readOnly || diags == null || diags.isEmpty()) {
				xml.appendEnd();
				return;
			}
			xml.appendClose();
		} else {
			xml.appendClose();
			// Render files
			int i = 0;
			for (FileWidgetUpload file : widget.getFiles()) {
				FileWidgetRendererUtil.renderFileElement(widget, xml, file, i++);
			}
		}
		if (!readOnly && diags != null && !diags.isEmpty()) {
			DiagnosticRenderUtil.renderDiagnostics(widget, renderContext);
		}
		xml.appendEndTag(TAG_NAME);
	}
367942
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPartialDateField dateField = (WPartialDateField) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = dateField.isReadOnly();

		String date = formatDate(dateField);

		xml.appendTagOpen("ui:datefield");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", dateField.isHidden(), "true");
		xml.appendOptionalAttribute("date", date);
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			xml.appendAttribute("allowPartial", "true");
			xml.appendOptionalAttribute("disabled", dateField.isDisabled(), "true");
			xml.appendOptionalAttribute("required", dateField.isMandatory(), "true");
			xml.appendOptionalAttribute("toolTip", dateField.getToolTip());
			xml.appendOptionalAttribute("accessibleText", dateField.getAccessibleText());
			WComponent submitControl = dateField.getDefaultSubmitButton();
			String submitControlId = submitControl == null ? null : submitControl.getId();
			xml.appendOptionalAttribute("buttonId", submitControlId);
		}

		xml.appendClose();

		if (date == null) {
			xml.appendEscaped(dateField.getText());
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(dateField, renderContext);
		}
		xml.appendEndTag("ui:datefield");
	}
47867
protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException
    {
        ResponseWriter writer = facesContext.getResponseWriter();
        
        Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR);
        if (addNewLineAtStart != null)
        {
            boolean addNewLineAtStartBoolean = false;
            if (addNewLineAtStart instanceof String)
            {
                addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart);
            }
            else if (addNewLineAtStart instanceof Boolean)
            {
                addNewLineAtStartBoolean = (Boolean) addNewLineAtStart;
            }
            if (addNewLineAtStartBoolean)
            {
                writer.writeText("\n", null);
            }
        }
        
        String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent);
        if (strValue != null)
        {
            writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
        }
    }
288974
public function renderForm( $legend = null, $submitButton = 'Submit', array $attributes = array() )
    {
        if ( static::VerticalGroupPattern !== $this->_blockPattern )
        {
            $attributes['class'] = static::addValue( Option::get( $attributes, 'class', array() ), 'form' . $this->_formType );
        }

        $_html = Convert::kvpToString( $attributes );

        if ( !empty( $legend ) )
        {
            $legend = static::wrap( 'legend', $legend );
        }

        $_submit = null;

        if ( !empty( $submitButton ) )
        {
            $_submit = $this->button(
                'submit',
                array(
                    'text' => ( true === $submitButton ? 'Submit' : $submitButton ),
                )
            );
        }

        $_html = <<<HTML
<form {$_html}>
	{$legend}
	{$this->_contents}
	<div class="form-actions">
	{$_submit}
	</div>
	{$this->_csrf}
</form>
HTML;

        $this->_contents = null;

        return $_html;
    }
1304007
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WSection section = (WSection) component;
		XmlStringBuilder xml = renderContext.getWriter();

		boolean renderChildren = isRenderContent(section);

		xml.appendTagOpen("ui:section");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		if (SectionMode.LAZY.equals(section.getMode())) {
			xml.appendOptionalAttribute("hidden", !renderChildren, "true");
		} else {
			xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
		}

		SectionMode mode = section.getMode();
		if (mode != null) {
			switch (mode) {
				case LAZY:
					xml.appendAttribute("mode", "lazy");
					break;
				case EAGER:
					xml.appendAttribute("mode", "eager");
					break;
				default:
					throw new SystemException("Unknown section mode: " + section.getMode());
			}
		}

		xml.appendClose();

		// Render margin
		MarginRendererUtil.renderMargin(section, renderContext);

		if (renderChildren) {
			// Label
			section.getDecoratedLabel().paint(renderContext);
			// Content
			section.getContent().paint(renderContext);
		}

		xml.appendEndTag("ui:section");
	}
1162660
public function getPanelForArea(AreaComponent $area)
    {
        // Answer Panel from Children:
        
        foreach ($this->owner->getChildPanels() as $panel) {
            
            if ($panel->hasArea($area)) {
                return $panel;
            }
            
        }
        
        // Answer Panel from Owner:
        
        foreach ($this->owner->Panels() as $panel) {
            
            if ($panel->hasArea($area)) {
                return $panel;
            }
            
        }
        
        // Answer Panel from Parent:
        
        if (($parent = $this->owner->getParent()) && $parent instanceof Page) {
            
            if (($panel = $parent->getPanelForArea($area)) && $panel->isInherited()) {
                return $panel;
            }
            
        }
        
        // Answer Panel for All Pages:
        
        return $area->getFolderPanels()->find('ShowOn', 'AllPages');
    }
520089
function renderLayout( pageElement, areaHelper, layoutInfo ) {
         addClass( pageElement, layoutInfo.className );
         pageElement.innerHTML = layoutInfo.html;

         const areas = findWidgetAreas( pageElement );
         const deregisterFuncs = Object.keys( areas )
            .map( areaName => areaHelper.register( areaName, areas[ areaName ] ) );

         DEFAULT_AREAS.forEach( area => {
            if( areaHelper.exists( area.name ) ) {
               return;
            }

            const node = document.createElement( 'div' );
            if( area.hidden ) {
               node.style.display = 'none';
            }
            deregisterFuncs.push( areaHelper.register( area.name, node, area.name ) );
            pageElement.appendChild( node );
         } );

         return () => {
            deregisterFuncs.forEach( func => func() );
            removeClass( pageElement, layoutInfo.className );
         };
      }
792884
public function get_file_info($component, $filearea, $itemid, $filepath, $filename) {
        // try to emulate require_login() tests here
        if (!isloggedin()) {
            return null;
        }

        $coursecontext = $this->context->get_course_context(true);
        if (!$this->course->visible and !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
            return null;
        }

        if (!is_viewing($this->context) and !$this->browser->is_enrolled($this->course->id)) {
            // no peaking here if not enrolled or inspector
            return null;
        }

        if (!$this->cm->uservisible) {
            // activity hidden sorry
            return null;
        }

        if (empty($component)) {
            return $this;
        }

        if ($component == 'mod_'.$this->modname and $filearea === 'intro') {
            return $this->get_area_intro($itemid, $filepath, $filename);
        } else if ($component == 'backup' and $filearea === 'activity') {
            return $this->get_area_backup($itemid, $filepath, $filename);
        }

        if ($functionname = component_callback_exists('mod_'.$this->modname, 'get_file_info')) {
            $cm = $this->cm->get_course_module_record();
            return $functionname($this->browser, $this->areas, $this->course, $cm,
                $this->context, $filearea, $itemid, $filepath, $filename);
        }

        return null;
    }
461158
public function renderAction(ComponentInterface $component, ContentInterface $content)
    {
        $menu = array();
        foreach ($component->getData('tree', array()) as $linkData) {
            // name / url required
            if (empty($linkData['name']) || empty($linkData['url'])) {
                continue;
            }
            $menu[$linkData['name']] = array(
                'url' => $linkData['url'],
                'children' => array(),
            );
        }

        return $this->get('synapse')
            ->createDecorator($component)
            ->decorate(array(
                'content' => $content,
                'menu' => $menu,
            ))
        ;
    }