Вынес класс в отдельный файл
This commit is contained in:
parent
7187963ac9
commit
7bbccea3b0
5 changed files with 68 additions and 62 deletions
50
src/Form/Field.php
Normal file
50
src/Form/Field.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Элемент формы
|
||||
*/
|
||||
class Form_Field
|
||||
{
|
||||
public $hidden = false;
|
||||
public $name;
|
||||
public $label; // Метка поля
|
||||
public $value; // Значение поля
|
||||
public $type = ""; // Каждому типу элемента соответствует макрос TAL
|
||||
public $error_msg = null;
|
||||
public $default = null;
|
||||
public $error = false;
|
||||
public $require = false;
|
||||
public $hint = null;
|
||||
public $fieldset = null;
|
||||
// Блоки (Убрать в отдельный класс!!!)
|
||||
public $_title = array();
|
||||
public $description = "";
|
||||
public $alias = array();
|
||||
|
||||
public function __construct ($input = array(), $factory = null)
|
||||
{
|
||||
|
||||
$this->default = null;
|
||||
if (isset($input['validate'])) {
|
||||
$this->require = strpos($input['validate'], 'require') !== false;
|
||||
}
|
||||
if (isset($input['fieldset'])) {
|
||||
$this->fieldset = $input['fieldset'];
|
||||
}
|
||||
// Инициализация свойст обьетка
|
||||
foreach (array('label', 'name', 'type', 'description') as $name) {
|
||||
if (isset($input[$name])) {
|
||||
$this->$name = $input[$name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setValue(/*.any.*/$value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
function getId()
|
||||
{
|
||||
return $this->name . '_label';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Элемент формы
|
||||
*/
|
||||
class TField
|
||||
{
|
||||
public $hidden = false;
|
||||
public $name;
|
||||
public $label; // Метка поля
|
||||
public $value; // Значение поля
|
||||
public $type = ""; // Каждому типу элемента соответствует макрос TAL
|
||||
public $error_msg = null;
|
||||
public $default = null;
|
||||
public $error = false;
|
||||
public $require = false;
|
||||
public $hint = null;
|
||||
public $fieldset = null;
|
||||
// Блоки (Убрать в отдельный класс!!!)
|
||||
public $_title = array();
|
||||
public $description = "";
|
||||
public $alias = array();
|
||||
|
||||
public function __construct ($input = array(), $factory = null)
|
||||
{
|
||||
|
||||
$this->default = null;
|
||||
if (isset($input['validate'])) {
|
||||
$this->require = strpos($input['validate'], 'require') !== false;
|
||||
}
|
||||
if (isset($input['fieldset'])) {
|
||||
$this->fieldset = $input['fieldset'];
|
||||
}
|
||||
// Инициализация свойст обьетка
|
||||
foreach (array('label', 'name', 'type', 'description') as $name) {
|
||||
if (isset($input[$name])) {
|
||||
$this->$name = $input[$name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setValue(/*.any.*/$value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
function getId()
|
||||
{
|
||||
return $this->name . '_label';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Поле ввода Input
|
||||
*/
|
||||
class TInput extends TField {
|
||||
class TInput extends Form_Field {
|
||||
}
|
||||
|
||||
class TCheckbox extends TField
|
||||
class TCheckbox extends Form_Field
|
||||
{
|
||||
public $checked = false;
|
||||
function setValue($value)
|
||||
|
|
@ -67,7 +17,7 @@ class TCheckbox extends TField
|
|||
}
|
||||
|
||||
|
||||
class TSelect extends TField
|
||||
class TSelect extends Form_Field
|
||||
{
|
||||
public $options = array();
|
||||
|
||||
|
|
@ -140,14 +90,14 @@ class TQuestionType extends TSelect
|
|||
/**
|
||||
* Поле с датой
|
||||
*/
|
||||
class TDate extends TField
|
||||
class TDate extends Form_Field
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Поле с цветом
|
||||
*/
|
||||
class TColor extends TField
|
||||
class TColor extends Form_Field
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +105,7 @@ class TColor extends TField
|
|||
/**
|
||||
* Текстовое поле
|
||||
*/
|
||||
class TTextArea extends TField
|
||||
class TTextArea extends Form_Field
|
||||
{
|
||||
function setValue($value)
|
||||
{
|
||||
|
|
@ -166,11 +116,11 @@ class TTextArea extends TField
|
|||
/**
|
||||
* Поле для ввода пароля
|
||||
*/
|
||||
class TSecret extends TField
|
||||
class TSecret extends Form_Field
|
||||
{
|
||||
}
|
||||
|
||||
class TUpload extends TField
|
||||
class TUpload extends Form_Field
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
class MailAlt
|
||||
{
|
||||
public $mailer;
|
||||
public $_notify;
|
||||
|
||||
function __construct() {
|
||||
$this->mailer = new PHPMailer();
|
||||
|
|
@ -35,7 +36,7 @@ class MailAlt
|
|||
*/
|
||||
function copy($name) // recipient cc
|
||||
{
|
||||
$this->addCC($name);
|
||||
$this->mailer->addCC($name);
|
||||
}
|
||||
|
||||
function notify($notify)
|
||||
|
|
@ -87,4 +88,8 @@ class MailAlt
|
|||
{
|
||||
return $this->mailer->send();
|
||||
}
|
||||
|
||||
function eml() {
|
||||
return $this->mailer->getSentMIMEMessage();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class View_Page extends View_View
|
|||
function replaceContent($match, $offset)
|
||||
{
|
||||
//$result = phptal_component($match, $offset);
|
||||
/*.Controller_Component.*/$component = null;
|
||||
|
||||
|
||||
if(class_exists("Controller_Site")){ //Если мы в CMS2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue