|
@@ -1,7 +1,5 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
|
|
|
-use HtmlBuilder\HtmlElement as Html;
|
|
|
|
|
-
|
|
|
|
|
class Connection {
|
|
class Connection {
|
|
|
|
|
|
|
|
private function __construct() {
|
|
private function __construct() {
|
|
@@ -55,118 +53,6 @@ function is_ajax_request() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function build_input_wrap($label, $element) {
|
|
|
|
|
- return Html::instance('div')
|
|
|
|
|
- ->add_property('class', 'form-group col-xs-12')
|
|
|
|
|
- ->add_child(Html::instance('label')->content($label))
|
|
|
|
|
- ->add_child($element);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function build_input_text($label, $name, $value = '') {
|
|
|
|
|
- return Html::instance('div')
|
|
|
|
|
- ->add_property('class', 'form-group col-xs-12')
|
|
|
|
|
- ->add_child(Html::instance('label')->content($label))
|
|
|
|
|
- ->add_child(Html::instance('input')
|
|
|
|
|
- ->add_property('type', 'text')
|
|
|
|
|
- ->add_property('name', $name)
|
|
|
|
|
- ->add_property('value', $value)
|
|
|
|
|
- ->add_property('class', 'form-control'));
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function build_input_password($label, $name) {
|
|
|
|
|
- return Html::instance('div')
|
|
|
|
|
- ->add_property('class', 'form-group col-xs-12')
|
|
|
|
|
- ->add_child(Html::instance('label')->content($label))
|
|
|
|
|
- ->add_child(Html::instance('input')
|
|
|
|
|
- ->add_property('type', 'password')
|
|
|
|
|
- ->add_property('name', $name)
|
|
|
|
|
- ->add_property('class', 'form-control'));
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function build_select($name, $values, $selected = '') {
|
|
|
|
|
- $select = Html::instance('select')
|
|
|
|
|
- ->add_property('class', 'form-control')
|
|
|
|
|
- ->add_property('name', $name);
|
|
|
|
|
-
|
|
|
|
|
- if ($selected == '') {
|
|
|
|
|
- $select->add_child(
|
|
|
|
|
- Html::instance('option')
|
|
|
|
|
- ->add_property('value', '0')
|
|
|
|
|
- ->content('Selecione')
|
|
|
|
|
- ->add_property('selected', 'selected')
|
|
|
|
|
- );
|
|
|
|
|
- } else {
|
|
|
|
|
- $select->add_child(
|
|
|
|
|
- Html::instance('option')
|
|
|
|
|
- ->add_property('value', '0')
|
|
|
|
|
- ->content('Selecione')
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- foreach ($values as $value) {
|
|
|
|
|
- if ($value->id == $selected) {
|
|
|
|
|
- $select->add_child(
|
|
|
|
|
- Html::instance('option')
|
|
|
|
|
- ->add_property('value', $value->id)
|
|
|
|
|
- ->content($value->content)
|
|
|
|
|
- ->add_property('selected', 'selected')
|
|
|
|
|
- );
|
|
|
|
|
- } else {
|
|
|
|
|
- $select->add_child(
|
|
|
|
|
- Html::instance('option')
|
|
|
|
|
- ->add_property('value', $value->id)
|
|
|
|
|
- ->content($value->content)
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return $select;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function build_remote_popup($relay = '', $action = '', $name = '', $label = '', $value = false) {
|
|
|
|
|
-
|
|
|
|
|
- $label = Html::instance('label')->content($label);
|
|
|
|
|
-
|
|
|
|
|
- $first_section = Html::instance('div')->add_property('class', 'col-xs-12 col-md-3');
|
|
|
|
|
- $first_section_input = Html::instance('div')->add_property('class', 'input-group');
|
|
|
|
|
-
|
|
|
|
|
- if($value){
|
|
|
|
|
- $first_section_input->add_child(Html::instance('input')
|
|
|
|
|
- ->add_property('class', 'form-control remote-popup-number')
|
|
|
|
|
- ->add_property('value', $value));
|
|
|
|
|
- }else{
|
|
|
|
|
- $first_section_input->add_child(Html::instance('input')
|
|
|
|
|
- ->add_property('class', 'form-control remote-popup-number'));
|
|
|
|
|
- }
|
|
|
|
|
- $button_input = Html::instance('span')
|
|
|
|
|
- ->add_property('class', 'input-group-btn')
|
|
|
|
|
- ->add_child(Html::instance('button')
|
|
|
|
|
- ->add_property('class', 'btn btn-default')
|
|
|
|
|
- ->add_child(Html::instance('i')
|
|
|
|
|
- ->add_property('class', 'fa fa-search')));
|
|
|
|
|
-
|
|
|
|
|
- $first_section_input->add_child($button_input);
|
|
|
|
|
-
|
|
|
|
|
- $first_section->add_child($first_section_input);
|
|
|
|
|
-
|
|
|
|
|
- $second_section = Html::instance('div')
|
|
|
|
|
- ->add_property('class', 'col-xs-12 col-md-9')
|
|
|
|
|
- ->add_child(Html::instance('input')
|
|
|
|
|
- ->add_property('class', 'form-control remote-popup-label')
|
|
|
|
|
- ->add_property('type', 'text')
|
|
|
|
|
- ->add_property('disabled', 'true'));
|
|
|
|
|
-
|
|
|
|
|
- $wrapper = Html::instance('div')
|
|
|
|
|
- ->add_property('class', 'form-group col-xs-12 remote-popup')
|
|
|
|
|
- ->add_property('data-relay', $relay)
|
|
|
|
|
- ->add_property('data-mode', $action)
|
|
|
|
|
- ->add_child($label)
|
|
|
|
|
- ->add_child(Html::instance('br'))
|
|
|
|
|
- ->add_child($first_section)
|
|
|
|
|
- ->add_child($second_section);
|
|
|
|
|
-
|
|
|
|
|
- return $wrapper->build();
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
function last_class() {
|
|
function last_class() {
|
|
|
$class = get_declared_classes()[sizeof(get_declared_classes()) - 1];
|
|
$class = get_declared_classes()[sizeof(get_declared_classes()) - 1];
|
|
|
return new $class;
|
|
return new $class;
|
|
@@ -223,7 +109,6 @@ class Lang {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
abstract class Controller {
|
|
abstract class Controller {
|