__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Nextend\Framework\Form\Element;
use Nextend\Framework\Asset\Js\Js;
use Nextend\Framework\View\Html;
class Select extends AbstractFieldHidden {
public $value;
protected $values = array();
protected $options = array();
protected $optgroup = array();
protected $isMultiple = false;
protected $size = '';
protected $relatedValueFields = array();
protected $relatedAttribute = '';
protected function fetchElement() {
$this->values = explode('||', $this->getValue());
if (!is_array($this->values)) {
$this->values = array();
}
$html = Html::openTag("div", array(
"class" => "n2_field_select",
"style" => $this->style
));
$selectAttributes = array(
'id' => $this->fieldID . '_select',
'name' => 'select' . $this->getFieldName(),
'aria-labelledby' => $this->fieldID,
'autocomplete' => 'off'
);
if (!empty($this->size)) {
$selectAttributes['size'] = $this->size;
}
if ($this->isMultiple) {
$selectAttributes['multiple'] = 'multiple';
$selectAttributes['class'] = 'nextend-element-hastip';
$selectAttributes['title'] = n2_('Hold down the ctrl (Windows) or command (MAC) button to select multiple options.');
}
$html .= Html::tag('select', $selectAttributes, $this->renderOptions($this->options) . (!empty($this->optgroup) ? $this->renderOptgroup() : ''));
$html .= Html::closeTag("div");
$html .= parent::fetchElement();
$options = array();
if (!empty($this->relatedFields)) {
$options['relatedFields'] = $this->relatedFields;
}
if (!empty($this->relatedValueFields)) {
$options['relatedValueFields'] = $this->relatedValueFields;
}
if (!empty($this->relatedAttribute)) {
$options['relatedAttribute'] = $this->relatedAttribute;
}
Js::addInline('new _N2.FormElementList("' . $this->fieldID . '", ' . json_encode($options) . ');');
return $html;
}
/**
*
* @return string
*/
protected function renderOptgroup() {
$html = '';
foreach ($this->optgroup as $label => $options) {
if (is_array($options)) {
$html .= "<optgroup label='" . $label . "'>";
$html .= $this->renderOptions($options);
$html .= "</optgroup>";
} else {
$html .= $this->renderOption($label, $options);
}
}
return $html;
}
/**
* @param array $options
*
* @return string
*/
protected function renderOptions($options) {
$html = '';
foreach ($options as $value => $label) {
$html .= $this->renderOption($value, $label);
}
return $html;
}
protected function renderOption($value, $label) {
return '<option value="' . esc_attr($value) . '" ' . $this->isSelected($value) . '>' . $label . '</option>';
}
protected function isSelected($value) {
if (in_array($value, $this->values)) {
return ' selected="selected"';
}
return '';
}
/**
* @param array $options
*/
public function setOptions($options) {
$this->options = $options;
}
/**
* @param array $optgroup
*/
public function setOptgroup($optgroup) {
$this->optgroup = $optgroup;
}
/**
* @param bool $isMultiple
*/
public function setIsMultiple($isMultiple) {
$this->isMultiple = $isMultiple;
$this->size = 10;
}
/**
* @param string $size
*/
public function setSize($size) {
$this->size = $size;
}
protected function createTree(&$list, &$new, $parent, $cindent = '', $indent = '- ') {
if (isset($new[$parent])) {
for ($i = 0; $i < count($new[$parent]); $i++) {
$new[$parent][$i]->treename = $cindent . $new[$parent][$i]->name;
$list[] = $new[$parent][$i];
$this->createTree($list, $new, $new[$parent][$i]->cat_ID, $cindent . $indent, $indent);
}
}
return $list;
}
public function setRelatedValueFields($relatedValueFields) {
$this->relatedValueFields = $relatedValueFields;
}
public function setRelatedAttribute($relatedAttribute) {
$this->relatedAttribute = $relatedAttribute;
}
}| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Button | Folder | 0775 |
|
|
| Group | Folder | 0775 |
|
|
| Hidden | Folder | 0775 |
|
|
| Message | Folder | 0775 |
|
|
| MixedField | Folder | 0775 |
|
|
| Radio | Folder | 0775 |
|
|
| Select | Folder | 0775 |
|
|
| Text | Folder | 0775 |
|
|
| Textarea | Folder | 0775 |
|
|
| AbstractChooser.php | File | 1.58 KB | 0664 |
|
| AbstractChooserText.php | File | 2.09 KB | 0664 |
|
| AbstractFieldHidden.php | File | 979 B | 0664 |
|
| Breakpoint.php | File | 2.96 KB | 0664 |
|
| Button.php | File | 1.41 KB | 0664 |
|
| CheckboxOnOff.php | File | 1.63 KB | 0664 |
|
| Connected.php | File | 554 B | 0664 |
|
| Decoration.php | File | 1.73 KB | 0664 |
|
| Devices.php | File | 1.32 KB | 0664 |
|
| EmptyArea.php | File | 303 B | 0664 |
|
| Font.php | File | 1.51 KB | 0664 |
|
| Gap.php | File | 2.08 KB | 0664 |
|
| Grouping.php | File | 877 B | 0664 |
|
| Hidden.php | File | 396 B | 0664 |
|
| IconTab.php | File | 2.6 KB | 0664 |
|
| LayerWindowFocus.php | File | 1.6 KB | 0664 |
|
| MarginPadding.php | File | 2.09 KB | 0664 |
|
| Message.php | File | 557 B | 0664 |
|
| MixedField.php | File | 1.87 KB | 0664 |
|
| OnOff.php | File | 2.65 KB | 0664 |
|
| Radio.php | File | 1.76 KB | 0664 |
|
| RichTextarea.php | File | 1.71 KB | 0664 |
|
| Select.php | File | 4.53 KB | 0664 |
|
| SelectIcon.php | File | 1.68 KB | 0664 |
|
| Style.php | File | 2.17 KB | 0664 |
|
| Tab.php | File | 1.7 KB | 0664 |
|
| Text.php | File | 2.23 KB | 0664 |
|
| Textarea.php | File | 1.5 KB | 0664 |
|
| Token.php | File | 196 B | 0664 |
|
| Unit.php | File | 1.41 KB | 0664 |
|
| Upload.php | File | 1.01 KB | 0664 |
|