Добавил namespace и зависимости
This commit is contained in:
parent
e9f7c23990
commit
32ec09a66a
92 changed files with 454 additions and 128 deletions
|
|
@ -3,6 +3,9 @@
|
|||
/**
|
||||
* Поле с цветом
|
||||
*/
|
||||
class Form_Color extends Form_Field
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Field;
|
||||
|
||||
class Color extends Field
|
||||
{
|
||||
}
|
||||
|
|
@ -2,5 +2,8 @@
|
|||
/**
|
||||
* Поле с датой
|
||||
*/
|
||||
class Form_Date extends Form_Field {
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Field;
|
||||
|
||||
class Date extends Field {
|
||||
}
|
||||
|
|
@ -2,7 +2,9 @@
|
|||
/**
|
||||
* Элемент формы
|
||||
*/
|
||||
class Form_Field
|
||||
namespace ctiso\Form;
|
||||
|
||||
class Field
|
||||
{
|
||||
public $hidden = false;
|
||||
public $name;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,15 @@
|
|||
* При рендеринге каждому классу соответствует шаблон (см. themes/maxim/templates/macros.html)
|
||||
*/
|
||||
|
||||
class TCheckbox extends Form_Field
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Field,
|
||||
ctiso\Form\Select,
|
||||
ctiso\Form\Input,
|
||||
ctiso\View\View,
|
||||
ctiso\Validator\Validator,
|
||||
ctiso\HttpRequest;
|
||||
|
||||
class TCheckbox extends Field
|
||||
{
|
||||
public $checked = false;
|
||||
function setValue($value)
|
||||
|
|
@ -14,7 +22,7 @@ class TCheckbox extends Form_Field
|
|||
}
|
||||
}
|
||||
|
||||
class TQuestionType extends Form_Select
|
||||
class TQuestionType extends Select
|
||||
{
|
||||
function setValue($value)
|
||||
{
|
||||
|
|
@ -26,29 +34,29 @@ class TQuestionType extends Form_Select
|
|||
}
|
||||
}
|
||||
|
||||
class TDateTime extends Form_Input {
|
||||
class TDateTime extends Input {
|
||||
}
|
||||
|
||||
/**
|
||||
* Поле для ввода пароля
|
||||
*/
|
||||
class TSecret extends Form_Field {
|
||||
class TSecret extends Field {
|
||||
}
|
||||
|
||||
class TUpload extends Form_Field {
|
||||
class TUpload extends Field {
|
||||
}
|
||||
|
||||
class THidden extends Form_Input {
|
||||
class THidden extends Input {
|
||||
public $hidden = true;
|
||||
}
|
||||
|
||||
class TComponentBrowserInput extends Form_Input {
|
||||
class TComponentBrowserInput extends Input {
|
||||
}
|
||||
|
||||
/**
|
||||
* Форма для ввода
|
||||
*/
|
||||
class Form_Form extends View_View {
|
||||
class Form extends View {
|
||||
public $field = array(); //Поля формы
|
||||
public $fieldsets = array(); //Группы полей (fieldset). Некоторые поля могут не принадлежать никаким группам
|
||||
|
||||
|
|
@ -163,7 +171,7 @@ class Form_Form extends View_View {
|
|||
/**
|
||||
* Устанавливает ошибки после проверки
|
||||
*/
|
||||
function setError(Validator_Validator $validator)
|
||||
function setError(Validator $validator)
|
||||
{
|
||||
foreach ($validator->getErrorMsg() as $name => $error)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,5 +3,8 @@
|
|||
/**
|
||||
* Поле ввода Input
|
||||
*/
|
||||
class Form_Input extends Form_Field {
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Field;
|
||||
|
||||
class Input extends Field {
|
||||
}
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
<?php
|
||||
|
||||
class Form_OptionFactory {
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Select,
|
||||
ctiso\Model\Resources,
|
||||
ctiso\Model\Factory;
|
||||
|
||||
class OptionFactory {
|
||||
public $db;
|
||||
public $registry;
|
||||
function __construct($db, $registry = null) {
|
||||
|
|
@ -8,23 +13,23 @@ class Form_OptionFactory {
|
|||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
function create(Form_Select $field, $input) {
|
||||
function create(Select $field, $input) {
|
||||
if (isset($input['options.resid'])) {
|
||||
$type = $input['options.resid'];
|
||||
|
||||
$res = new Model_Resources($this->db);
|
||||
$res = new Resources($this->db);
|
||||
$field->options = $this->optionsArray('id_section', 'title', $res->getSubsections('', $type));
|
||||
|
||||
} else if (isset($input['options.res'])) {
|
||||
$type = $input['options.res'];
|
||||
|
||||
$res = new Model_Resources($this->db);
|
||||
$res = new Resources($this->db);
|
||||
$field->options = $this->optionsArray('path', 'title', $res->getSubsections('', $type));
|
||||
|
||||
} else if (isset($input['options.all_res'])) {
|
||||
$type = $input['options.all_res'];
|
||||
|
||||
$res = new Model_Resources($this->db);
|
||||
$res = new Resources($this->db);
|
||||
$field->options = $this->optionsArray('id_resource', 'subtitle', $res->getAllResource($type));
|
||||
|
||||
} else if (isset($input['options.db'])) {
|
||||
|
|
@ -39,7 +44,7 @@ class Form_OptionFactory {
|
|||
} elseif (isset($input['options.pair'])) {
|
||||
$field->options = $this->optionsPair($input['options.pair']);
|
||||
} elseif (isset($input['options.model'])) {
|
||||
$factory = new Model_Factory($this->db, $this->registry);
|
||||
$factory = new Factory($this->db, $this->registry);
|
||||
$model = $factory->getModel($input['options.model']);
|
||||
$field->options = $model->getAllAsOptions();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
|
||||
class Form_Select extends Form_Field
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Field;
|
||||
|
||||
class Select extends Field
|
||||
{
|
||||
public $options = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
|
||||
class Form_SelectMany extends Form_Select
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Select;
|
||||
|
||||
class SelectMany extends Select
|
||||
{
|
||||
function setValue($value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
/**
|
||||
* Выбор из одного элемента
|
||||
*/
|
||||
class Form_SelectOne extends Form_Select
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Select;
|
||||
|
||||
class SelectOne extends Select
|
||||
{
|
||||
function setValue($value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
/**
|
||||
* Текстовое поле
|
||||
*/
|
||||
class Form_TextArea extends Form_Field {
|
||||
namespace ctiso\Form;
|
||||
use ctiso\Form\Field;
|
||||
|
||||
class TextArea extends Field {
|
||||
function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
* http://www.alternateinterior.com/2006/09/a-viewstate-for-php.html
|
||||
* Управление состоянием между страницами
|
||||
*/
|
||||
class Form_ViewState // extends Collection
|
||||
namespace ctiso\Form;
|
||||
|
||||
class ViewState // extends Collection
|
||||
{
|
||||
private $values = array();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue