Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 2314 | Rev 2501 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2314 Rev 2500
Línea 61... Línea 61...
61
$this->headStyle()->captureEnd();
61
$this->headStyle()->captureEnd();
Línea 62... Línea 62...
62
 
62
 
63
$this->inlineScript()->captureStart();
63
$this->inlineScript()->captureStart();
Línea -... Línea 64...
-
 
64
echo <<<JS
-
 
65
 
-
 
66
const classFormGenerator = function() {
-
 
67
    this.id = 0,
-
 
68
        this.table = '',
-
 
69
        this.name = '',
64
echo <<<JS
70
        this.text = '',
-
 
71
        this.status = 'a',
65
 
72
        this.competency = [],
-
 
73
        this.clear = function() {
-
 
74
            this.competency = [];
-
 
75
            this.render();
-
 
76
        },
-
 
77
        /**
-
 
78
         * Add element to section array
-
 
79
         */
-
 
80
        this.addSection = function(name, text, value) {
-
 
81
            var d = new Date();
-
 
82
            var slug = 'section' + d.getTime();
-
 
83
            var position = 0;
-
 
84
            $.each(this.competency, function(index, section) {
-
 
85
                if (position < section.position) {
-
 
86
                    position = section.position;
-
 
87
                }
-
 
88
            });
-
 
89
            position++;
-
 
90
            var section = {
-
 
91
                'slug_competency': slug,
-
 
92
                'name': name,
-
 
93
                'text': text,
-
 
94
                'value': value,
-
 
95
                'position': position,
-
 
96
                'behaviors': [],
-
 
97
                'status': 0
-
 
98
            }
-
 
99
            this.competency.push(section);
-
 
100
        },
-
 
101
         /**
-
 
102
         * Edit element to section array
-
 
103
         */
-
 
104
        this.editSection = function(slug, name, text, value) {
-
 
105
            var renderTable = false;
-
 
106
            for (i = 0; i < this.competency.length; i++) {
-
 
107
                if (slug == this.competency[i].slug_competency) {
-
 
108
                    this.competency[i].name = name;
-
 
109
                    this.competency[i].text = text;
-
 
110
                    this.competency[i].value = value;
-
 
111
                    renderTable = true;
-
 
112
                    break;
-
 
113
                }
-
 
114
            }
-
 
115
            if (renderTable) {
-
 
116
                this.renderSection(slug);
-
 
117
            }
-
 
118
        },
-
 
119
         /**
-
 
120
         * Remove element to section array
-
 
121
         */
-
 
122
        this.deleteSection = function(slug) {
-
 
123
            var renderTable = false;
-
 
124
            for (i = 0; i < this.competency.length; i++) {
-
 
125
                if (slug == this.competency[i].slug_competency) {
-
 
126
                    this.competency.splice(i, 1);
-
 
127
                    renderTable = true;
-
 
128
                    break;
-
 
129
                }
-
 
130
            }
-
 
131
            if (renderTable) {
-
 
132
                $('#panel' + slug).remove();
-
 
133
            }
-
 
134
        },
-
 
135
    }
-
 
136
function htmlEntities(str) {
-
 
137
    return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
66
var competencies = [];
138
}
67
var competencies_type = [];
139
 
68
jQuery( document ).ready(function( $ ) {
140
jQuery( document ).ready(function( $ ) {
69
    $.validator.setDefaults({
141
    $.validator.setDefaults({
70
        debug: true,
142
        debug: true,