@@ -5,6 +5,6 @@ |
||
5 | 5 | * @author Imanol Losada Oriol <[email protected]> |
6 | 6 | * @package chamilo.plugin.skype |
7 | 7 | */ |
8 | -require_once __DIR__ . '/config.php'; |
|
8 | +require_once __DIR__.'/config.php'; |
|
9 | 9 | |
10 | 10 | Skype::create()->install(); |
@@ -5,6 +5,6 @@ |
||
5 | 5 | * @author Imanol Losada Oriol <[email protected]> |
6 | 6 | * @package chamilo.plugin.skype |
7 | 7 | */ |
8 | -require_once __DIR__ . '/config.php'; |
|
8 | +require_once __DIR__.'/config.php'; |
|
9 | 9 | |
10 | 10 | Skype::create()->install(); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For license terms, see /license.txt */ |
3 | 3 | |
4 | -require_once dirname(__FILE__) . '/config.php'; |
|
4 | +require_once dirname(__FILE__).'/config.php'; |
|
5 | 5 | |
6 | 6 | if (!api_is_platform_admin()) { |
7 | 7 | die ('You must have admin permissions to install plugins'); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @package chamilo.plugin.clockworksms |
8 | 8 | * @author Imanol Losada <[email protected]> |
9 | 9 | */ |
10 | -require_once __DIR__ . '/../../main/inc/global.inc.php'; |
|
10 | +require_once __DIR__.'/../../main/inc/global.inc.php'; |
|
11 | 11 | |
12 | 12 | require_once 'lib/clockworksms.lib.php'; |
13 | 13 | require_once 'vendor/clockworksms_api.php'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $message = ''; |
29 | 29 | $content = ''; |
30 | 30 | |
31 | -$currentUrl = api_get_self() . "?name=$pluginName"; |
|
31 | +$currentUrl = api_get_self()."?name=$pluginName"; |
|
32 | 32 | |
33 | 33 | if (isset($pluginInfo['settings_form'])) { |
34 | 34 | /** @var FormValidator $form */ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | foreach ($values as $key => $value) { |
70 | 70 | api_add_setting( |
71 | 71 | $value, |
72 | - Database::escape_string($pluginName . '_' . $key), |
|
72 | + Database::escape_string($pluginName.'_'.$key), |
|
73 | 73 | $pluginName, |
74 | 74 | 'setting', |
75 | 75 | 'Plugins', |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $interbreadcrumb[] = array( |
102 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php', |
|
102 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/index.php', |
|
103 | 103 | 'name' => get_lang('PlatformAdmin') |
104 | 104 | ); |
105 | 105 | $interbreadcrumb[] = array( |
106 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/settings.php?category=Plugins', |
|
106 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins', |
|
107 | 107 | 'name' => get_lang('Plugins') |
108 | 108 | ); |
109 | 109 |
@@ -314,7 +314,7 @@ |
||
314 | 314 | * Set votes |
315 | 315 | * |
316 | 316 | * @param integer $votes |
317 | - * @return integer |
|
317 | + * @return Message |
|
318 | 318 | */ |
319 | 319 | public function setVotes($votes) |
320 | 320 | { |
@@ -114,7 +114,7 @@ |
||
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Get feedbackDateTime |
117 | - * @return type |
|
117 | + * @return \DateTime |
|
118 | 118 | */ |
119 | 119 | public function getFeedbackDateTime() |
120 | 120 | { |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | $res = Database::query($sql); |
48 | 48 | $refs = array(); |
49 | 49 | $list = array(); |
50 | - $plain_array=array(); |
|
50 | + $plain_array = array(); |
|
51 | 51 | |
52 | 52 | while ($survey = Database::fetch_array($res, 'ASSOC')) { |
53 | - $plain_array[$survey['survey_id']]=$survey; |
|
54 | - $surveys_parents[]=$survey['survey_version']; |
|
55 | - $thisref = &$refs[ $survey['survey_id'] ]; |
|
53 | + $plain_array[$survey['survey_id']] = $survey; |
|
54 | + $surveys_parents[] = $survey['survey_version']; |
|
55 | + $thisref = &$refs[$survey['survey_id']]; |
|
56 | 56 | $thisref['parent_id'] = $survey['parent_id']; |
57 | 57 | $thisref['name'] = $survey['name']; |
58 | 58 | $thisref['id'] = $survey['survey_id']; |
59 | 59 | $thisref['survey_version'] = $survey['survey_version']; |
60 | 60 | if ($survey['parent_id'] == 0) { |
61 | - $list[ $survey['survey_id'] ] = &$thisref; |
|
61 | + $list[$survey['survey_id']] = &$thisref; |
|
62 | 62 | } else { |
63 | - $refs[ $survey['parent_id'] ]['children'][ $survey['survey_id'] ] = &$thisref; |
|
63 | + $refs[$survey['parent_id']]['children'][$survey['survey_id']] = &$thisref; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | $this->surveylist = $list; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function getParentId($id) |
80 | 80 | { |
81 | 81 | $node = $this->plainsurveylist[$id]; |
82 | - if (is_array($node)&& !empty($node['parent_id'])) { |
|
82 | + if (is_array($node) && !empty($node['parent_id'])) { |
|
83 | 83 | return $node['parent_id']; |
84 | 84 | } else { |
85 | 85 | return -1; |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | if (is_array($list)) { |
100 | 100 | foreach ($list as $key => $node) { |
101 | 101 | if (isset($node['children']) && is_array($node['children'])) { |
102 | - $result[$key]= $node['name']; |
|
102 | + $result[$key] = $node['name']; |
|
103 | 103 | $re = self::createList($node['children']); |
104 | 104 | if (!empty($re)) { |
105 | 105 | if (is_array($re)) { |
106 | 106 | foreach ($re as $key => $r) { |
107 | - $result[$key] = '' . $r; |
|
107 | + $result[$key] = ''.$r; |
|
108 | 108 | } |
109 | 109 | } else { |
110 | 110 | $result[] = $re; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | // We exit here if there is no valid $_GET parameter |
45 | 45 | if (!isset($_GET['survey_id']) || !is_numeric($_GET['survey_id'])) { |
46 | 46 | api_not_allowed(true, Display::return_message(get_lang('InvallidSurvey'), 'error', false)); |
47 | - exit; |
|
47 | + exit; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | // Getting the survey information |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | |
54 | 54 | if (empty($survey_data)) { |
55 | 55 | api_not_allowed(true, Display::return_message(get_lang('InvallidSurvey'), 'error', false)); |
56 | - exit; |
|
56 | + exit; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $urlname = strip_tags($survey_data['title']); |
60 | 60 | if (api_is_allowed_to_edit()) { |
61 | - // Breadcrumbs |
|
62 | - $interbreadcrumb[] = array( |
|
61 | + // Breadcrumbs |
|
62 | + $interbreadcrumb[] = array( |
|
63 | 63 | 'url' => api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq(), |
64 | 64 | 'name' => get_lang('SurveyList') |
65 | 65 | ); |
@@ -86,57 +86,57 @@ discard block |
||
86 | 86 | $counter_question = 0; |
87 | 87 | // Only a course admin is allowed to preview a survey: you are a course admin |
88 | 88 | if (api_is_course_admin() || |
89 | - (api_is_course_admin() && $_GET['isStudentView'] == 'true') || |
|
90 | - api_is_allowed_to_session_edit(false, true) |
|
89 | + (api_is_course_admin() && $_GET['isStudentView'] == 'true') || |
|
90 | + api_is_allowed_to_session_edit(false, true) |
|
91 | 91 | ) { |
92 | - // Survey information |
|
93 | - echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>'; |
|
94 | - echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>'; |
|
92 | + // Survey information |
|
93 | + echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>'; |
|
94 | + echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>'; |
|
95 | 95 | |
96 | - // Displaying the survey introduction |
|
97 | - if (!isset($_GET['show'])) { |
|
96 | + // Displaying the survey introduction |
|
97 | + if (!isset($_GET['show'])) { |
|
98 | 98 | if (!empty($survey_data['survey_introduction'])) { |
99 | 99 | echo '<div id="survey_content" class="survey_content">'.$survey_data['survey_introduction'].'</div>'; |
100 | 100 | } |
101 | - $limit = 0; |
|
102 | - } |
|
101 | + $limit = 0; |
|
102 | + } |
|
103 | 103 | |
104 | - // Displaying the survey thanks message |
|
105 | - if (isset($_POST['finish_survey'])) { |
|
106 | - Display::display_confirmation_message(get_lang('SurveyFinished')); |
|
104 | + // Displaying the survey thanks message |
|
105 | + if (isset($_POST['finish_survey'])) { |
|
106 | + Display::display_confirmation_message(get_lang('SurveyFinished')); |
|
107 | 107 | echo $survey_data['survey_thanks']; |
108 | - Display :: display_footer(); |
|
109 | - exit; |
|
110 | - } |
|
108 | + Display :: display_footer(); |
|
109 | + exit; |
|
110 | + } |
|
111 | 111 | |
112 | 112 | $questions = array(); |
113 | 113 | |
114 | - if (isset($_GET['show'])) { |
|
115 | - // Getting all the questions for this page and add them to a |
|
116 | - // multidimensional array where the first index is the page. |
|
117 | - // as long as there is no pagebreak fount we keep adding questions to the page |
|
118 | - $questions_displayed = array(); |
|
119 | - $paged_questions = array(); |
|
120 | - $counter = 0; |
|
121 | - $sql = "SELECT * FROM $table_survey_question |
|
114 | + if (isset($_GET['show'])) { |
|
115 | + // Getting all the questions for this page and add them to a |
|
116 | + // multidimensional array where the first index is the page. |
|
117 | + // as long as there is no pagebreak fount we keep adding questions to the page |
|
118 | + $questions_displayed = array(); |
|
119 | + $paged_questions = array(); |
|
120 | + $counter = 0; |
|
121 | + $sql = "SELECT * FROM $table_survey_question |
|
122 | 122 | WHERE c_id = $course_id AND survey_id = '".intval($survey_id)."' |
123 | 123 | ORDER BY sort ASC"; |
124 | - $result = Database::query($sql); |
|
124 | + $result = Database::query($sql); |
|
125 | 125 | $questions_exists = true; |
126 | 126 | if (Database::num_rows($result)) { |
127 | - while ($row = Database::fetch_array($result)) { |
|
128 | - if ($row['type'] == 'pagebreak') { |
|
129 | - $counter++; |
|
130 | - } else { |
|
131 | - $paged_questions[$counter][] = $row['question_id']; |
|
132 | - } |
|
133 | - } |
|
127 | + while ($row = Database::fetch_array($result)) { |
|
128 | + if ($row['type'] == 'pagebreak') { |
|
129 | + $counter++; |
|
130 | + } else { |
|
131 | + $paged_questions[$counter][] = $row['question_id']; |
|
132 | + } |
|
133 | + } |
|
134 | 134 | } else { |
135 | 135 | $questions_exists = false; |
136 | 136 | } |
137 | 137 | |
138 | - if (array_key_exists($_GET['show'], $paged_questions)) { |
|
139 | - $sql = "SELECT |
|
138 | + if (array_key_exists($_GET['show'], $paged_questions)) { |
|
139 | + $sql = "SELECT |
|
140 | 140 | survey_question.question_id, |
141 | 141 | survey_question.survey_id, |
142 | 142 | survey_question.survey_question, |
@@ -158,75 +158,75 @@ discard block |
||
158 | 158 | survey_question.c_id = $course_id |
159 | 159 | ORDER BY survey_question.sort, survey_question_option.sort ASC"; |
160 | 160 | |
161 | - $result = Database::query($sql); |
|
162 | - $question_counter_max = Database::num_rows($result); |
|
163 | - $limit = 0; |
|
164 | - while ($row = Database::fetch_array($result)) { |
|
165 | - // If the type is not a pagebreak we store it in the $questions array |
|
166 | - if ($row['type'] != 'pagebreak') { |
|
167 | - $questions[$row['sort']]['question_id'] = $row['question_id']; |
|
168 | - $questions[$row['sort']]['survey_id'] = $row['survey_id']; |
|
169 | - $questions[$row['sort']]['survey_question'] = $row['survey_question']; |
|
170 | - $questions[$row['sort']]['display'] = $row['display']; |
|
171 | - $questions[$row['sort']]['type'] = $row['type']; |
|
172 | - $questions[$row['sort']]['options'][intval($row['option_sort'])] = $row['option_text']; |
|
173 | - $questions[$row['sort']]['maximum_score'] = $row['max_value']; |
|
174 | - } else { |
|
175 | - // If the type is a pagebreak we are finished loading the questions for this page |
|
176 | - break; |
|
177 | - } |
|
178 | - $counter_question++; |
|
179 | - } |
|
180 | - } |
|
181 | - } |
|
182 | - |
|
183 | - // Selecting the maximum number of pages |
|
184 | - $sql = "SELECT * FROM $table_survey_question |
|
161 | + $result = Database::query($sql); |
|
162 | + $question_counter_max = Database::num_rows($result); |
|
163 | + $limit = 0; |
|
164 | + while ($row = Database::fetch_array($result)) { |
|
165 | + // If the type is not a pagebreak we store it in the $questions array |
|
166 | + if ($row['type'] != 'pagebreak') { |
|
167 | + $questions[$row['sort']]['question_id'] = $row['question_id']; |
|
168 | + $questions[$row['sort']]['survey_id'] = $row['survey_id']; |
|
169 | + $questions[$row['sort']]['survey_question'] = $row['survey_question']; |
|
170 | + $questions[$row['sort']]['display'] = $row['display']; |
|
171 | + $questions[$row['sort']]['type'] = $row['type']; |
|
172 | + $questions[$row['sort']]['options'][intval($row['option_sort'])] = $row['option_text']; |
|
173 | + $questions[$row['sort']]['maximum_score'] = $row['max_value']; |
|
174 | + } else { |
|
175 | + // If the type is a pagebreak we are finished loading the questions for this page |
|
176 | + break; |
|
177 | + } |
|
178 | + $counter_question++; |
|
179 | + } |
|
180 | + } |
|
181 | + } |
|
182 | + |
|
183 | + // Selecting the maximum number of pages |
|
184 | + $sql = "SELECT * FROM $table_survey_question |
|
185 | 185 | WHERE |
186 | 186 | c_id = $course_id AND |
187 | 187 | type='".Database::escape_string('pagebreak')."' AND |
188 | 188 | survey_id='".intval($survey_id)."'"; |
189 | - $result = Database::query($sql); |
|
190 | - $numberofpages = Database::num_rows($result) + 1; |
|
191 | - |
|
192 | - // Displaying the form with the questions |
|
193 | - if (isset($_GET['show'])) { |
|
194 | - $show = (int)$_GET['show'] + 1; |
|
195 | - } else { |
|
196 | - $show = 0; |
|
197 | - } |
|
198 | - |
|
199 | - $url = api_get_self().'?survey_id='.Security::remove_XSS($survey_id).'&show='.$show; |
|
200 | - $form = new FormValidator('question', 'post', $url); |
|
201 | - |
|
202 | - if (is_array($questions) && count($questions) > 0) { |
|
203 | - foreach ($questions as $key => & $question) { |
|
204 | - $ch_type = 'ch_'.$question['type']; |
|
205 | - /** @var survey_question $display */ |
|
206 | - $display = new $ch_type; |
|
207 | - $form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">'); |
|
208 | - $form->addHtml($question['survey_question']); |
|
209 | - $display->render($form, $question); |
|
210 | - $form->addHtml('</div></div>'); |
|
211 | - } |
|
212 | - } |
|
213 | - |
|
214 | - if (($show < $numberofpages) || (!$_GET['show'] && count($questions) > 0)) { |
|
189 | + $result = Database::query($sql); |
|
190 | + $numberofpages = Database::num_rows($result) + 1; |
|
191 | + |
|
192 | + // Displaying the form with the questions |
|
193 | + if (isset($_GET['show'])) { |
|
194 | + $show = (int)$_GET['show'] + 1; |
|
195 | + } else { |
|
196 | + $show = 0; |
|
197 | + } |
|
198 | + |
|
199 | + $url = api_get_self().'?survey_id='.Security::remove_XSS($survey_id).'&show='.$show; |
|
200 | + $form = new FormValidator('question', 'post', $url); |
|
201 | + |
|
202 | + if (is_array($questions) && count($questions) > 0) { |
|
203 | + foreach ($questions as $key => & $question) { |
|
204 | + $ch_type = 'ch_'.$question['type']; |
|
205 | + /** @var survey_question $display */ |
|
206 | + $display = new $ch_type; |
|
207 | + $form->addHtml('<div class="survey_question_wrapper"><div class="survey_question">'); |
|
208 | + $form->addHtml($question['survey_question']); |
|
209 | + $display->render($form, $question); |
|
210 | + $form->addHtml('</div></div>'); |
|
211 | + } |
|
212 | + } |
|
213 | + |
|
214 | + if (($show < $numberofpages) || (!$_GET['show'] && count($questions) > 0)) { |
|
215 | 215 | if ($show == 0) { |
216 | - $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large'); |
|
216 | + $form->addButton('next_survey_page', get_lang('StartSurvey'), 'arrow-right', 'success', 'large'); |
|
217 | 217 | } else { |
218 | - $form->addButton('next_survey_page', get_lang('NextQuestion'), 'arrow-right'); |
|
218 | + $form->addButton('next_survey_page', get_lang('NextQuestion'), 'arrow-right'); |
|
219 | 219 | } |
220 | - } |
|
221 | - if ($show >= $numberofpages && $_GET['show'] || (isset($_GET['show']) && count($questions) == 0)) { |
|
222 | - if ($questions_exists == false) { |
|
223 | - echo '<p>'.get_lang('ThereAreNotQuestionsForthisSurvey').'</p>'; |
|
224 | - } |
|
225 | - $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); |
|
226 | - } |
|
227 | - $form->display(); |
|
220 | + } |
|
221 | + if ($show >= $numberofpages && $_GET['show'] || (isset($_GET['show']) && count($questions) == 0)) { |
|
222 | + if ($questions_exists == false) { |
|
223 | + echo '<p>'.get_lang('ThereAreNotQuestionsForthisSurvey').'</p>'; |
|
224 | + } |
|
225 | + $form->addButton('finish_survey', get_lang('FinishSurvey'), 'arrow-right'); |
|
226 | + } |
|
227 | + $form->display(); |
|
228 | 228 | } else { |
229 | - Display :: display_error_message(get_lang('NotAllowed'), false); |
|
229 | + Display :: display_error_message(get_lang('NotAllowed'), false); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | Display :: display_footer(); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | survey_question_option.c_id = $course_id |
155 | 155 | WHERE |
156 | 156 | survey_question.survey_id = '".intval($survey_id)."' AND |
157 | - survey_question.question_id IN (".Database::escape_string(implode(',',$paged_questions[$_GET['show']]), null, false).") AND |
|
157 | + survey_question.question_id IN (".Database::escape_string(implode(',', $paged_questions[$_GET['show']]), null, false).") AND |
|
158 | 158 | survey_question.c_id = $course_id |
159 | 159 | ORDER BY survey_question.sort, survey_question_option.sort ASC"; |
160 | 160 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | // Displaying the form with the questions |
193 | 193 | if (isset($_GET['show'])) { |
194 | - $show = (int)$_GET['show'] + 1; |
|
194 | + $show = (int) $_GET['show'] + 1; |
|
195 | 195 | } else { |
196 | 196 | $show = 0; |
197 | 197 | } |