403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/acrit.import/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/acrit.import/lib/forms.php
<?php

namespace Acrit\Import;

use Bitrix\Main;

class Forms
{
    const MODULE_ID = "acrit.import";
    const ELEMENT_TYPE_TEXT = 'text';
    const ELEMENT_TYPE_CHECKBOX = 'checkbox';
    const ELEMENT_TYPE_RADIO = 'radio';
    const ELEMENT_TYPE_DATE = 'date';
    const ELEMENT_TYPE_SELECT = 'select';
	const ELEMENT_TYPE_TEXTBOX = 'textbox';

	public static function getElement($type, $name, $value, $params=[], $variants=[]) {
		$code = false;
		if ($type == self::ELEMENT_TYPE_TEXT) {
			$code = self::getInput($name, $value, $params);
		}
		elseif ($type == self::ELEMENT_TYPE_CHECKBOX) {
			$code = ''; //TODO
		}
		elseif ($type == self::ELEMENT_TYPE_RADIO) {
			$code = ''; //TODO
		}
		elseif ($type == self::ELEMENT_TYPE_SELECT) {
			$code = self::getSelect($name, $value, $params, $variants);
		}
		elseif ($type == self::ELEMENT_TYPE_TEXTBOX) {
			$code = self::getTextbox($name, $value, $params);
		}
		elseif ($type == self::ELEMENT_TYPE_DATE) {
			$code = ''; //TODO
		}
		return $code;
	}

	public static function getInput($name, $value, $params) {
		$code = '<input type="text" name="' . $name . '" value="' . $value . '"' . self::getParams($params) . ' />';
		return $code;
	}

	public static function getSelect($name, $value, $params, $variants) {
		$code = '<select name="' . $name . '" ' . self::getParams($params) . '>';
		foreach ($variants as $variant) {
			if ($variant['items']) {
				$code .= '<optgroup label="' . $variant['name'] . '">';
				foreach ($variant as $item) {
					$code .= '<option value="' . $item['value'] . '"' . ($variant['value']==$value?' selected':'') . '>' . $item['name'] . '</option>';
				}
				$code .= '</optgroup>';
			}
			else {
				$code .= '<option value="' . $variant['value'] . '"' . ($variant['value']==$value?' selected':'') . '>' . $variant['name'] . '</option>';
			}
		}
		$code .= '</select>';
		return $code;
	}

	public static function getTextbox($name, $value, $params) {
		$code = '<textbox name="' . $name . '" ' . self::getParams($params) . '>' . $value . '</textbox>';
		return $code;
	}

	public static function getParams($params) {
		$code = '';
		foreach ($params as $k => $value) {
			$code .= ' ' . $k . '="' . $value . '"';
		}
		return $code;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit