Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 2500 Rev 2501
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 64... Línea 64...
64
echo <<<JS
64
echo <<<JS
65
 
65
 
66
const classFormGenerator = function() {
66
    const classFormGenerator = function() {
67
    this.id = 0,
67
             this.id = 0,
68
        this.table = '',
68
            this.table = '',
69
        this.name = '',
69
            this.name = '',
70
        this.text = '',
70
            this.text = '',
71
        this.status = 'a',
71
            this.status = 'a',
72
        this.competency = [],
72
            this.competency = [],
73
        this.clear = function() {
73
            this.clear = function() {
74
            this.competency = [];
74
                this.competency = [];
75
            this.render();
75
                this.render();
76
        },
76
            },
77
        /**
77
            /**
78
         * Add element to section array
78
             * Add element to section array
79
         */
79
             */
80
        this.addSection = function(name, text, value) {
80
            this.addSection = function(name, text, value) {
81
            var d = new Date();
81
                var d = new Date();
82
            var slug = 'section' + d.getTime();
82
                var slug = 'section' + d.getTime();
83
            var position = 0;
83
                var position = 0;
84
            $.each(this.competency, function(index, section) {
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,
85
                if (position < section.position) {
96
                    'behaviors': [],
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
97
                    'status': 0
98
            }
98
                }
99
            this.competency.push(section);
99
                this.competency.push(section);
100
        },
100
            },
101
         /**
101
             /**
102
         * Edit element to section array
102
             * Edit element to section array
103
         */
103
             */
104
        this.editSection = function(slug, name, text, value) {
104
            this.editSection = function(slug, name, text, value) {
105
            var renderTable = false;
105
                var renderTable = false;
106
            for (i = 0; i < this.competency.length; i++) {
106
                for (i = 0; i < this.competency.length; i++) {
107
                if (slug == this.competency[i].slug_competency) {
107
                    if (slug == this.competency[i].slug_competency) {
108
                    this.competency[i].name = name;
108
                        this.competency[i].name = name;
109
                    this.competency[i].text = text;
109
                        this.competency[i].text = text;
110
                    this.competency[i].value = value;
110
                        this.competency[i].value = value;
-
 
111
                        renderTable = true;
111
                    renderTable = true;
112
                        break;
112
                    break;
-
 
113
                }
113
                    }
114
            }
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;
115
                if (renderTable) {
128
                    break;
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
                }
129
                    }
130
            }
130
                }
131
            if (renderTable) {
131
                if (renderTable) {
132
                $('#panel' + slug).remove();
132
                    $('#panel' + slug).remove();
-
 
133
                }
-
 
134
            },
-
 
135
    }
133
            }
136
    function htmlEntities(str) {
134
        },
-
 
135
    }
-
 
136
function htmlEntities(str) {
-
 
Línea 137... Línea 137...
137
    return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
137
        return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
138
}
138
    }
139
 
139
 
140
jQuery( document ).ready(function( $ ) {
140
jQuery( document ).ready(function( $ ) {