Creates a jQuery sortable

@param string $element
@param array $options
@return string
972672
public function sortable($element, $options=array()) {
		if (count($options)>0) {
			$sort_options=array ();
			foreach ( $options as $k => $v ) {
				$sort_options[]="\n\t\t".$k.': '.$v."";
			}
			$sort_options=implode(",", $sort_options);
		} else {
			$sort_options='';
		}

		return "$(".Javascript::prep_element($element).").sortable({".$sort_options."\n\t});";
	}
1265003
function createTopNodeListDOMNode( $options )
    {
        $dom = new DOMDocument( '1.0', 'utf-8' );
        $topNodeListDOMNode = $dom->createElement( 'top-node-list' );
        $dom->appendChild( $topNodeListDOMNode );

        foreach( $this->RootNodeObjectArray as $rootNode )
        {
            unset( $topNode );
            $topNode = $dom->createElement( 'top-node' );
            $topNode->appendChild( $dom->createTextNode( $rootNode->attribute( 'name' ) ) );
            $topNode->setAttribute( 'node-id', $rootNode->attribute( 'node_id' ) );
            $topNode->setAttribute( 'remote-id', $rootNode->attribute( 'remote_id' ) );
            $topNodeListDOMNode->appendChild( $topNode );
        }

        return $topNodeListDOMNode;
    }
1013167
private function getSelectOptions($options, $selected)
    {
        $select = '';

        foreach ($options as $key => $value) {
            $isSelected = ($selected == $key) ? 'selected="selected"' : '';
            $select .= "<option $isSelected value='".$key."'>".$value.'</option>'.PHP_EOL;
        }

        return $select;
    }
482727
public function sort($element, $direction)
    {
        // simple sorting
        if (in_array($element, $sortable = app('scaffold.module')->sortable(), true)) {
            if ($table = app('scaffold.module')->model()->getTable()) {
                $element = "{$table}.{$element}";
            }

            $this->query->orderBy($element, $direction);
        }

        if (array_key_exists($element, $sortable) && is_callable($callback = $sortable[$element])) {
            $this->query = call_user_func_array($callback, [$this->query, $element, $direction]);
        }

        if (array_key_exists($element, $sortable) && is_string($handler = $sortable[$element])) {
            $handler = new $handler($this->query, $element, $direction);
            if (!$handler instanceof QueryBuilder || !method_exists($handler, 'build')) {
                throw new \Exception('Handler class must implement '.QueryBuilder::class.' contract');
            }
            $this->query = $handler->build();
        }

        return $this;
    }
661053
public function orderBy($key, $mode = 'ASC', $options = SORT_REGULAR)
    {
        return $this->sortBy($key, $options, ($mode === 'DESC' ? true : false));
    }
717398
public function generateSelectElement(array $options = array(), array $attributes = array(), $selectedValue = "", $templateToBeRendered = 'html_element_template')
    {
        $_options_html = "";

        foreach($options as $_option => $_val)
        {
            $_attributes = array("value" => $_val);

            if($_val == $selectedValue) {
                $_attributes['selected'] = "true";
            }

            $_options_html .= $this->generateElement(
                'option',
                $_attributes,
                $_val
            );
        }

        return $this->generateElement('select', $attributes, $_options_html, true, $templateToBeRendered);
    }
763550
public static function renderElement($type, $content, $options = [])
    {
        $tag = ArrayHelper::remove($options, 'tag', 'div');

        $class = ArrayHelper::remove($options, 'class');
        Html::addCssClass($options, 'ui ' . $class . ' ' . $type);

        return Html::tag($tag, $content, $options);
    }
697989
public function horizontalMenu($elements = array(), $options = array())
    {
        $default_options = ['selected' => null, 'container' => true, 'navbar_class' => 'navbar navbar-default'];

        $options = array_merge($default_options, $options);

        /*
         * Default alignment is left
         */
        if(!isset($elements['_left_']))
        {
            $elements['_left_'] = $elements;
        }

        if(isset($elements['_left_']['_right_']))
        {
            $elements['_right_'] = $elements['_left_']['_right_'];
            unset($elements['_left_']['_right_']);
        }


        $html   = [];

        if($options['container'] === true)
        {
            $html[] = '<nav class="' . $options['navbar_class'] . '" role="navigation">';
            $html[] = '  <div class="container-fluid">';

            $navbar_dom_id = 'navbar_links_' . time();

            $html[] = '<div class="navbar-header">';
            $html[] = '  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#' . $navbar_dom_id . '">';
            $html[] = '    <span class="sr-only">Toggle navigation</span>';
            $html[] = '    <span class="icon-bar"></span>';
            $html[] = '    <span class="icon-bar"></span>';
            $html[] = '    <span class="icon-bar"></span>';
            $html[] = '  </button>';
            $html[] = '</div>';

            $html[] = '    <div class="collapse navbar-collapse" id="' . $navbar_dom_id . '">';
        }

        /*
         * Left aligned links
         */
        if(isset($elements['_left_']) && !empty($elements['_left_']))
        {
            $html[] = $this->getElementsGroup($elements['_left_'], [], $options);
        }

        /*
         * Right aligned links
         */
        if(isset($elements['_right_']) && !empty($elements['_right_']))
        {
            $html[] = $this->getElementsGroup($elements['_right_'], ['align' => 'right'], $options);
        }

        if($options['container'] === true)
        {
            $html[] = '    </div>';

            $html[] = '  </div>';
            $html[] = '</nav>';
        }

        $html_str = "\n" . implode("\n", $html);

        if($options['container'] !== true && !empty($options['container']))
        {
            $html_str = str_ireplace('{content}', $html_str, $options['container']);
        }

        return $html_str;
    }
1201861
public static function addJs(string $js, int $sort = 0, array $options = []) {
		$js = str_replace('\\', '/', $js);
		Application::set(['layout', 'js', $js], $sort);
		if (!empty($options)) {
			Application::set(['layout', 'js_options', $js], $options);
		}
	}
1157567
protected static function create(array $element)
    {
        $class = self::getClassName($element['type']);
        $object = new $class;
        if ($object instanceof ContainerInterface) {
            static::execute($object, $element);
        }
        return $object;
    }
103036
protected function createElement(array $options)
    {
        $options = array_merge($options, $this->getMultiplier());

        return parent::createElement($options);
    }
1337755
private function buildSearchElement($element)
    {
        $panelElement = new DefaultSearchElement();
        foreach ($element->getPropertyNames() as $propName) {
            $panelElement->addProperty($propName);
        }

        return $panelElement;
    }
424779
public function loadXml($xml, $options = null)
    {
        return $this->load($xml, false, Document::TYPE_XML, $options);
    }
758542
public function addElement(array $element)
    {
        if (array_key_exists('boxes', $element)) {
            if (array_key_exists($element['key'], $this->dashboard['boxes'])) {
                $this->dashboard['boxes'][$element['key']] = array_merge($this->dashboard['boxes'][$element['key']], $element['boxes']);
            } else {
                $this->dashboard['boxes'][$element['key']] = $element['boxes'];
            }
        }
        if (array_key_exists('cards', $element)) {
            if (array_key_exists($element['key'], $this->dashboard['cards'])) {
                $this->dashboard['cards'][$element['key']] = array_merge($this->dashboard['cards'][$element['key']], $element['cards']);
            } else {
                $this->dashboard['cards'][$element['key']] = $element['cards'];
            }
        }

        return $this;
    }
146187
private function elementToRdf(JsonObject $element)
    {
        if (property_exists($element, '@value')) {
            return Value::fromJsonLd($element);
        }

        $iri = new IRI($element->{'@id'});

        return $iri->isAbsolute() ? $iri : null;
    }
831692
public function renderInput($element)
	{
		if ($element instanceof Option ||
			$element instanceof Optgroup ||
			$element instanceof Checkbox ||
			$element instanceof Radio )
		{
			return $element->render($this);
		}

		$name = $element->getName();
		$element->setAttribute('id', 'form_'.$name);

		$this->table->addCell($element->getLabel());
		$this->table->addCell($element->render($this));
		$this->table->addRow();

		return '';
	}
597079
protected function createElement(array $options)
    {
        $type = isset($options['type']) ? $options['type'] : null;
        unset($options['type']);

        return FactoryFields::initElement($type, $options);
    }