@@ -124,8 +124,8 @@ |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | - * @param $link |
|
128 | - * @param $courseCode |
|
127 | + * @param integer $link |
|
128 | + * @param null|string $courseCode |
|
129 | 129 | * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink |
130 | 130 | */ |
131 | 131 | private function createLink($link, $courseCode) |
@@ -10,133 +10,133 @@ |
||
10 | 10 | */ |
11 | 11 | class LinkForm extends FormValidator |
12 | 12 | { |
13 | - const TYPE_CREATE = 1; |
|
14 | - const TYPE_MOVE = 2; |
|
15 | - /** @var Category */ |
|
16 | - private $category_object; |
|
17 | - private $link_object; |
|
18 | - private $extra; |
|
13 | + const TYPE_CREATE = 1; |
|
14 | + const TYPE_MOVE = 2; |
|
15 | + /** @var Category */ |
|
16 | + private $category_object; |
|
17 | + private $link_object; |
|
18 | + private $extra; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Builds a form containing form items based on a given parameter |
|
22 | - * @param int form_type 1=choose link |
|
23 | - * @param obj cat_obj the category object |
|
24 | - * @param string form name |
|
25 | - * @param method |
|
26 | - * @param action |
|
27 | - */ |
|
28 | - public function LinkForm( |
|
29 | - $form_type, |
|
30 | - $category_object, |
|
31 | - $link_object, |
|
32 | - $form_name, |
|
33 | - $method = 'post', |
|
34 | - $action = null, |
|
35 | - $extra = null |
|
36 | - ) { |
|
37 | - parent :: __construct($form_name, $method, $action); |
|
20 | + /** |
|
21 | + * Builds a form containing form items based on a given parameter |
|
22 | + * @param int form_type 1=choose link |
|
23 | + * @param obj cat_obj the category object |
|
24 | + * @param string form name |
|
25 | + * @param method |
|
26 | + * @param action |
|
27 | + */ |
|
28 | + public function LinkForm( |
|
29 | + $form_type, |
|
30 | + $category_object, |
|
31 | + $link_object, |
|
32 | + $form_name, |
|
33 | + $method = 'post', |
|
34 | + $action = null, |
|
35 | + $extra = null |
|
36 | + ) { |
|
37 | + parent :: __construct($form_name, $method, $action); |
|
38 | 38 | |
39 | - if (isset ($category_object)) { |
|
40 | - $this->category_object = $category_object; |
|
41 | - } else { |
|
42 | - if (isset($link_object)) { |
|
43 | - $this->link_object = $link_object; |
|
44 | - } |
|
45 | - } |
|
39 | + if (isset ($category_object)) { |
|
40 | + $this->category_object = $category_object; |
|
41 | + } else { |
|
42 | + if (isset($link_object)) { |
|
43 | + $this->link_object = $link_object; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | - if (isset ($extra)) { |
|
48 | - $this->extra = $extra; |
|
49 | - } |
|
50 | - if ($form_type == self :: TYPE_CREATE) { |
|
51 | - $this->build_create(); |
|
52 | - } elseif ($form_type == self :: TYPE_MOVE) { |
|
53 | - $this->build_move(); |
|
54 | - } |
|
55 | - } |
|
47 | + if (isset ($extra)) { |
|
48 | + $this->extra = $extra; |
|
49 | + } |
|
50 | + if ($form_type == self :: TYPE_CREATE) { |
|
51 | + $this->build_create(); |
|
52 | + } elseif ($form_type == self :: TYPE_MOVE) { |
|
53 | + $this->build_move(); |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - protected function build_move() |
|
58 | - { |
|
59 | - $renderer =& $this->defaultRenderer(); |
|
60 | - $renderer->setCustomElementTemplate('<span>{element}</span> '); |
|
61 | - $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" '); |
|
62 | - $this->addElement('static',null,null,get_lang('MoveTo').' : '); |
|
63 | - $select = $this->addElement('select','move_cat',null,null); |
|
64 | - $line = ''; |
|
65 | - foreach ($this->link_object->get_target_categories() as $cat) { |
|
66 | - for ($i=0;$i<$cat[2];$i++) { |
|
67 | - $line .= '—'; |
|
68 | - } |
|
69 | - $select->addoption($line.' '.$cat[1],$cat[0]); |
|
70 | - $line = ''; |
|
71 | - } |
|
72 | - $this->addElement('submit', null, get_lang('Ok')); |
|
73 | - } |
|
57 | + protected function build_move() |
|
58 | + { |
|
59 | + $renderer =& $this->defaultRenderer(); |
|
60 | + $renderer->setCustomElementTemplate('<span>{element}</span> '); |
|
61 | + $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" '); |
|
62 | + $this->addElement('static',null,null,get_lang('MoveTo').' : '); |
|
63 | + $select = $this->addElement('select','move_cat',null,null); |
|
64 | + $line = ''; |
|
65 | + foreach ($this->link_object->get_target_categories() as $cat) { |
|
66 | + for ($i=0;$i<$cat[2];$i++) { |
|
67 | + $line .= '—'; |
|
68 | + } |
|
69 | + $select->addoption($line.' '.$cat[1],$cat[0]); |
|
70 | + $line = ''; |
|
71 | + } |
|
72 | + $this->addElement('submit', null, get_lang('Ok')); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Builds the form |
|
77 | - */ |
|
78 | - protected function build_create() |
|
79 | - { |
|
80 | - $this->addElement('header', get_lang('MakeLink')); |
|
81 | - $select = $this->addElement( |
|
82 | - 'select', |
|
83 | - 'select_link', |
|
84 | - get_lang('ChooseLink'), |
|
85 | - null, |
|
86 | - array('onchange' => 'document.create_link.submit()') |
|
87 | - ); |
|
75 | + /** |
|
76 | + * Builds the form |
|
77 | + */ |
|
78 | + protected function build_create() |
|
79 | + { |
|
80 | + $this->addElement('header', get_lang('MakeLink')); |
|
81 | + $select = $this->addElement( |
|
82 | + 'select', |
|
83 | + 'select_link', |
|
84 | + get_lang('ChooseLink'), |
|
85 | + null, |
|
86 | + array('onchange' => 'document.create_link.submit()') |
|
87 | + ); |
|
88 | 88 | |
89 | - $linkTypes = LinkFactory::get_all_types(); |
|
89 | + $linkTypes = LinkFactory::get_all_types(); |
|
90 | 90 | |
91 | - $select->addoption('['.get_lang('ChooseLink').']', 0); |
|
91 | + $select->addoption('['.get_lang('ChooseLink').']', 0); |
|
92 | 92 | |
93 | - $courseCode = $this->category_object->get_course_code(); |
|
93 | + $courseCode = $this->category_object->get_course_code(); |
|
94 | 94 | |
95 | - foreach ($linkTypes as $linkType) { |
|
96 | - // The hot potatoe link will be added "inside" the exercise option. |
|
97 | - if ($linkType == LINK_HOTPOTATOES) { |
|
98 | - continue; |
|
99 | - } |
|
100 | - $link = $this->createLink($linkType, $courseCode); |
|
101 | - // disable this element if the link works with a dropdownlist |
|
102 | - // and if there are no links left |
|
103 | - if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') { |
|
104 | - $select->addoption($link->get_type_name(), $linkType, 'disabled'); |
|
105 | - } else { |
|
106 | - if ($link->get_type() == LINK_EXERCISE) { |
|
107 | - // Adding exercise |
|
108 | - $select->addoption($link->get_type_name(), $linkType); |
|
109 | - // Adding hot potatoes |
|
110 | - $linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode); |
|
111 | - $select->addoption( |
|
112 | - ' '.$linkHot->get_type_name(), |
|
113 | - LINK_HOTPOTATOES |
|
114 | - ); |
|
115 | - } else { |
|
116 | - $select->addoption($link->get_type_name(), $linkType); |
|
117 | - } |
|
118 | - } |
|
119 | - } |
|
95 | + foreach ($linkTypes as $linkType) { |
|
96 | + // The hot potatoe link will be added "inside" the exercise option. |
|
97 | + if ($linkType == LINK_HOTPOTATOES) { |
|
98 | + continue; |
|
99 | + } |
|
100 | + $link = $this->createLink($linkType, $courseCode); |
|
101 | + // disable this element if the link works with a dropdownlist |
|
102 | + // and if there are no links left |
|
103 | + if (!$link->needs_name_and_description() && count($link->get_all_links()) == '0') { |
|
104 | + $select->addoption($link->get_type_name(), $linkType, 'disabled'); |
|
105 | + } else { |
|
106 | + if ($link->get_type() == LINK_EXERCISE) { |
|
107 | + // Adding exercise |
|
108 | + $select->addoption($link->get_type_name(), $linkType); |
|
109 | + // Adding hot potatoes |
|
110 | + $linkHot = $this->createLink(LINK_HOTPOTATOES, $courseCode); |
|
111 | + $select->addoption( |
|
112 | + ' '.$linkHot->get_type_name(), |
|
113 | + LINK_HOTPOTATOES |
|
114 | + ); |
|
115 | + } else { |
|
116 | + $select->addoption($link->get_type_name(), $linkType); |
|
117 | + } |
|
118 | + } |
|
119 | + } |
|
120 | 120 | |
121 | - if (isset($this->extra)) { |
|
122 | - $this->setDefaults(array('select_link' => $this->extra)); |
|
123 | - } |
|
124 | - } |
|
121 | + if (isset($this->extra)) { |
|
122 | + $this->setDefaults(array('select_link' => $this->extra)); |
|
123 | + } |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * @param $link |
|
128 | - * @param $courseCode |
|
129 | - * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink |
|
130 | - */ |
|
131 | - private function createLink($link, $courseCode) |
|
132 | - { |
|
133 | - $link = LinkFactory::create($link); |
|
134 | - if (!empty($courseCode)) { |
|
135 | - $link->set_course_code($courseCode); |
|
136 | - } elseif(!empty($_GET['course_code'])) { |
|
137 | - $link->set_course_code(Database::escape_string($_GET['course_code'], null, false)); |
|
138 | - } |
|
126 | + /** |
|
127 | + * @param $link |
|
128 | + * @param $courseCode |
|
129 | + * @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink |
|
130 | + */ |
|
131 | + private function createLink($link, $courseCode) |
|
132 | + { |
|
133 | + $link = LinkFactory::create($link); |
|
134 | + if (!empty($courseCode)) { |
|
135 | + $link->set_course_code($courseCode); |
|
136 | + } elseif(!empty($_GET['course_code'])) { |
|
137 | + $link->set_course_code(Database::escape_string($_GET['course_code'], null, false)); |
|
138 | + } |
|
139 | 139 | |
140 | - return $link; |
|
141 | - } |
|
140 | + return $link; |
|
141 | + } |
|
142 | 142 | } |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | |
57 | 57 | protected function build_move() |
58 | 58 | { |
59 | - $renderer =& $this->defaultRenderer(); |
|
59 | + $renderer = & $this->defaultRenderer(); |
|
60 | 60 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
61 | - $this->addElement('static',null,null,'"'.$this->link_object->get_name().'" '); |
|
62 | - $this->addElement('static',null,null,get_lang('MoveTo').' : '); |
|
63 | - $select = $this->addElement('select','move_cat',null,null); |
|
61 | + $this->addElement('static', null, null, '"'.$this->link_object->get_name().'" '); |
|
62 | + $this->addElement('static', null, null, get_lang('MoveTo').' : '); |
|
63 | + $select = $this->addElement('select', 'move_cat', null, null); |
|
64 | 64 | $line = ''; |
65 | 65 | foreach ($this->link_object->get_target_categories() as $cat) { |
66 | - for ($i=0;$i<$cat[2];$i++) { |
|
66 | + for ($i = 0; $i < $cat[2]; $i++) { |
|
67 | 67 | $line .= '—'; |
68 | 68 | } |
69 | - $select->addoption($line.' '.$cat[1],$cat[0]); |
|
69 | + $select->addoption($line.' '.$cat[1], $cat[0]); |
|
70 | 70 | $line = ''; |
71 | 71 | } |
72 | 72 | $this->addElement('submit', null, get_lang('Ok')); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $link = LinkFactory::create($link); |
134 | 134 | if (!empty($courseCode)) { |
135 | 135 | $link->set_course_code($courseCode); |
136 | - } elseif(!empty($_GET['course_code'])) { |
|
136 | + } elseif (!empty($_GET['course_code'])) { |
|
137 | 137 | $link->set_course_code(Database::escape_string($_GET['course_code'], null, false)); |
138 | 138 | } |
139 | 139 |
@@ -76,7 +76,7 @@ |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Exports the complete report as an XLS file |
79 | - * @return boolean False on error |
|
79 | + * @return boolean|null False on error |
|
80 | 80 | */ |
81 | 81 | public function exportCompleteReportXLS($data) |
82 | 82 | { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * constructor of the class |
16 | 16 | */ |
17 | - public function __construct($get_questions=false,$get_answers=false) |
|
17 | + public function __construct($get_questions = false, $get_answers = false) |
|
18 | 18 | { |
19 | 19 | } |
20 | 20 | |
@@ -36,21 +36,21 @@ discard block |
||
36 | 36 | //titles |
37 | 37 | |
38 | 38 | foreach ($dato[0] as $header_col) { |
39 | - if(!empty($header_col)) { |
|
40 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($header_col))).';'; |
|
39 | + if (!empty($header_col)) { |
|
40 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($header_col))).';'; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - $data .="\r\n"; |
|
44 | + $data .= "\r\n"; |
|
45 | 45 | $cant_students = count($dato[1]); |
46 | 46 | //print_r($data); exit(); |
47 | 47 | |
48 | - for($i=0;$i<$cant_students;$i++) { |
|
48 | + for ($i = 0; $i < $cant_students; $i++) { |
|
49 | 49 | $column = 0; |
50 | - foreach($dato[1][$i] as $col_name) { |
|
51 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($col_name))).';'; |
|
50 | + foreach ($dato[1][$i] as $col_name) { |
|
51 | + $data .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($col_name))).';'; |
|
52 | 52 | } |
53 | - $data .="\r\n"; |
|
53 | + $data .= "\r\n"; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | //output the results |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | for ($i = 0; $i < $cant_students; $i++) { |
102 | 102 | $column = 0; |
103 | 103 | foreach ($data[1][$i] as $col_name) { |
104 | - $worksheet->SetCellValueByColumnAndRow($line,$column, html_entity_decode(strip_tags($col_name))); |
|
104 | + $worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($col_name))); |
|
105 | 105 | $column++; |
106 | 106 | } |
107 | 107 | $line++; |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | 'border_sz' => 20 |
138 | 138 | ); |
139 | 139 | $lines = 0; |
140 | - $values[] = implode("\t",$data[0]); |
|
140 | + $values[] = implode("\t", $data[0]); |
|
141 | 141 | foreach ($data[1] as $line) { |
142 | - $values[] = implode("\t",$line); |
|
142 | + $values[] = implode("\t", $line); |
|
143 | 143 | $lines++; |
144 | 144 | } |
145 | 145 | //$data = array(); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // 'right' => 4000, |
155 | 155 | // 'left' => 4000 |
156 | 156 | ); |
157 | - $docx->createDocx($filepath,$paramsPage); |
|
157 | + $docx->createDocx($filepath, $paramsPage); |
|
158 | 158 | //output the results |
159 | 159 | $data = file_get_contents($filepath.'.docx'); |
160 | 160 | $len = strlen($data); |
@@ -19,6 +19,7 @@ discard block |
||
19 | 19 | * @param int Visibility (0 hidden, 1 shown) |
20 | 20 | * @param int Session ID (optional or 0 if not defined) |
21 | 21 | * @param int |
22 | + * @param integer $resource_type |
|
22 | 23 | * @return boolean True on success, false on failure |
23 | 24 | */ |
24 | 25 | public static function add_resource_to_course_gradebook( |
@@ -117,7 +118,6 @@ discard block |
||
117 | 118 | |
118 | 119 | /** |
119 | 120 | * Builds an img tag for a gradebook item |
120 | - * @param string $type value returned by a gradebookitem's get_icon_name() |
|
121 | 121 | */ |
122 | 122 | public static function build_type_icon_tag($kind, $attributes = array()) |
123 | 123 | { |
@@ -382,6 +382,7 @@ discard block |
||
382 | 382 | * @param int Resource type (use constants defined in linkfactory.class.php) |
383 | 383 | * @param int Resource ID in the corresponding tool |
384 | 384 | * @param int Session ID (optional - 0 if not defined) |
385 | + * @param integer $resource_type |
|
385 | 386 | * @return int false on error or array of resource |
386 | 387 | */ |
387 | 388 | public static function is_resource_in_course_gradebook($course_code, $resource_type, $resource_id, $session_id = 0) |
@@ -579,6 +580,9 @@ discard block |
||
579 | 580 | * @param int The user id |
580 | 581 | * @param float The score obtained for certified |
581 | 582 | * @param Datetime The date when you obtained the certificate |
583 | + * @param integer $cat_id |
|
584 | + * @param integer $user_id |
|
585 | + * @param string $date_certificate |
|
582 | 586 | * @return void() |
583 | 587 | */ |
584 | 588 | public static function register_user_info_about_certificate($cat_id, $user_id, $score_certificate, $date_certificate) |
@@ -955,7 +959,7 @@ discard block |
||
955 | 959 | } |
956 | 960 | |
957 | 961 | /** |
958 | - * @param array $list_values |
|
962 | + * @param string[] $list_values |
|
959 | 963 | * @return string |
960 | 964 | */ |
961 | 965 | public static function score_badges($list_values) |
@@ -1015,7 +1019,7 @@ discard block |
||
1015 | 1019 | } |
1016 | 1020 | |
1017 | 1021 | /** |
1018 | - * @param $result |
|
1022 | + * @param Doctrine\DBAL\Driver\Statement|null $result |
|
1019 | 1023 | * @return array |
1020 | 1024 | */ |
1021 | 1025 | public static function get_user_array_from_sql_result($result) |
@@ -249,7 +249,7 @@ |
||
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | - $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
252 | + $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
253 | 253 | Display::return_icon( |
254 | 254 | 'percentage.png', |
255 | 255 | get_lang('EditAllWeights'), |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible'; |
214 | 214 | $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible'; |
215 | 215 | |
216 | - $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' . |
|
217 | - Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>'; |
|
216 | + $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'. |
|
217 | + Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>'; |
|
218 | 218 | |
219 | 219 | if (!api_is_allowed_to_edit(null, true)) { |
220 | 220 | $modify_icons .= Display::url( |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | '', |
225 | 225 | ICON_SIZE_SMALL |
226 | 226 | ), |
227 | - 'personal_stats.php?' . http_build_query([ |
|
227 | + 'personal_stats.php?'.http_build_query([ |
|
228 | 228 | 'selectcat' => $cat->get_id() |
229 | - ]) . '&' . api_get_cidreq(), |
|
229 | + ]).'&'.api_get_cidreq(), |
|
230 | 230 | [ |
231 | 231 | 'class' => 'ajax', |
232 | 232 | 'data-title' => get_lang('FlatView') |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | ) { |
244 | 244 | if ($cat->is_locked()) { |
245 | 245 | if (api_is_platform_admin()) { |
246 | - $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' . |
|
247 | - Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
246 | + $modify_icons .= ' <a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'. |
|
247 | + Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
248 | 248 | } else { |
249 | - $modify_icons .= ' <a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>'; |
|
249 | + $modify_icons .= ' <a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>'; |
|
250 | 250 | } |
251 | - $modify_icons .= ' <a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; |
|
251 | + $modify_icons .= ' <a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>'; |
|
252 | 252 | } else { |
253 | - $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' . |
|
254 | - Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
255 | - $modify_icons .= ' <a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; |
|
253 | + $modify_icons .= ' <a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'. |
|
254 | + Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
255 | + $modify_icons .= ' <a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>'; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
@@ -260,38 +260,38 @@ discard block |
||
260 | 260 | if ($cat->is_locked() && !api_is_platform_admin()) { |
261 | 261 | $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
262 | 262 | } else { |
263 | - $modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
263 | + $modify_icons .= '<a href="gradebook_edit_cat.php?'.'editcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
264 | 264 | Display::return_icon( |
265 | 265 | 'edit.png', |
266 | 266 | get_lang('Modify'), |
267 | 267 | '', |
268 | 268 | ICON_SIZE_SMALL |
269 | - ) . '</a>'; |
|
269 | + ).'</a>'; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | - $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
273 | + $modify_icons .= '<a href="gradebook_edit_all.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
274 | 274 | Display::return_icon( |
275 | 275 | 'percentage.png', |
276 | 276 | get_lang('EditAllWeights'), |
277 | 277 | '', |
278 | 278 | ICON_SIZE_SMALL |
279 | - ) . '</a>'; |
|
279 | + ).'</a>'; |
|
280 | 280 | |
281 | - $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' . |
|
281 | + $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
282 | 282 | Display::return_icon( |
283 | 283 | 'stats.png', |
284 | 284 | get_lang('FlatView'), |
285 | 285 | '', |
286 | 286 | ICON_SIZE_SMALL |
287 | - ) . '</a>'; |
|
288 | - $modify_icons .= ' <a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' . |
|
287 | + ).'</a>'; |
|
288 | + $modify_icons .= ' <a href="'.api_get_self().'?visiblecat='.$cat->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
289 | 289 | Display::return_icon( |
290 | - $visibility_icon . '.png', |
|
290 | + $visibility_icon.'.png', |
|
291 | 291 | get_lang('Visible'), |
292 | 292 | '', |
293 | 293 | ICON_SIZE_SMALL |
294 | - ) . '</a>'; |
|
294 | + ).'</a>'; |
|
295 | 295 | //no move ability for root categories |
296 | 296 | if ($cat->is_movable()) { |
297 | 297 | /* $modify_icons .= ' <a href="' . api_get_self() . '?movecat=' . $cat->get_id() . '&selectcat=' . $selectcat . ' &cidReq='.$cat->get_course_code().'"> |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | if ($cat->is_locked() && !api_is_platform_admin()) { |
304 | 304 | $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL); |
305 | 305 | } else { |
306 | - $modify_icons .= ' <a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '" onclick="return confirmation();">' . |
|
307 | - Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>'; |
|
306 | + $modify_icons .= ' <a href="'.api_get_self().'?deletecat='.$cat->get_id().'&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'" onclick="return confirmation();">'. |
|
307 | + Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>'; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
@@ -331,21 +331,21 @@ discard block |
||
331 | 331 | if ($is_locked && !api_is_platform_admin()) { |
332 | 332 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
333 | 333 | } else { |
334 | - $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
335 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
334 | + $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
335 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
336 | 336 | } |
337 | 337 | |
338 | - $modify_icons .= ' <a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$eval->getSessionId(). ' ">' . |
|
339 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
338 | + $modify_icons .= ' <a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$eval->getSessionId().' ">'. |
|
339 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
340 | 340 | if (api_is_allowed_to_edit(null, true)) { |
341 | - $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
342 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
341 | + $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
342 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | if ($is_locked && !api_is_platform_admin()) { |
346 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
346 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
347 | 347 | } else { |
348 | - $modify_icons .= ' <a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
348 | + $modify_icons .= ' <a href="'.api_get_self().'?deleteeval='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
349 | 349 | } |
350 | 350 | return $modify_icons; |
351 | 351 | } |
@@ -375,23 +375,23 @@ discard block |
||
375 | 375 | if ($is_locked && !api_is_platform_admin()) { |
376 | 376 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
377 | 377 | } else { |
378 | - $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id().'">' . |
|
379 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
378 | + $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'. |
|
379 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | //$modify_icons .= ' <a href="' . api_get_self() . '?movelink=' . $link->get_id() . '&selectcat=' . $selectcat . '"><img src="../img/deplacer_fichier.gif" border="0" title="' . get_lang('Move') . '" alt="" /></a>'; |
383 | - $modify_icons .= ' <a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$link->get_session_id(). ' ">' . |
|
384 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
385 | - $modify_icons .= ' <a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '">' . |
|
386 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
383 | + $modify_icons .= ' <a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$link->get_session_id().' ">'. |
|
384 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
385 | + $modify_icons .= ' <a href="gradebook_showlog_link.php?visiblelink='.$link->get_id().'&selectcat='.$selectcat.'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'. |
|
386 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
387 | 387 | |
388 | 388 | //If a work is added in a gradebook you can only delete the link in the work tool |
389 | 389 | |
390 | 390 | if ($is_locked && !api_is_platform_admin()) { |
391 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
391 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
392 | 392 | } else { |
393 | - $modify_icons .= ' <a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '" onclick="return confirmation();">' . |
|
394 | - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
393 | + $modify_icons .= ' <a href="'.api_get_self().'?deletelink='.$link->get_id().'&selectcat='.$selectcat.' &cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'" onclick="return confirmation();">'. |
|
394 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
395 | 395 | } |
396 | 396 | return $modify_icons; |
397 | 397 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | { |
633 | 633 | $result = Result :: load($resid); |
634 | 634 | if ($importscore > $eval_max) { |
635 | - header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax='); |
|
635 | + header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax='); |
|
636 | 636 | exit; |
637 | 637 | } |
638 | 638 | $result[0]->set_score($importscore); |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | { |
674 | 674 | $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
675 | 675 | $sql = 'SELECT COUNT(*) as count |
676 | - FROM ' . $table . ' gc |
|
677 | - WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" '; |
|
676 | + FROM ' . $table.' gc |
|
677 | + WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" '; |
|
678 | 678 | $rs_exist = Database::query($sql); |
679 | 679 | $row = Database::fetch_array($rs_exist); |
680 | 680 | if ($row['count'] == 0) { |
@@ -697,8 +697,8 @@ discard block |
||
697 | 697 | public static function get_certificate_by_user_id($cat_id, $user_id) |
698 | 698 | { |
699 | 699 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
700 | - $sql = 'SELECT * FROM ' . $table_certificate . ' |
|
701 | - WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"'; |
|
700 | + $sql = 'SELECT * FROM '.$table_certificate.' |
|
701 | + WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"'; |
|
702 | 702 | |
703 | 703 | $result = Database::query($sql); |
704 | 704 | $row = Database::fetch_array($result, 'ASSOC'); |
@@ -717,18 +717,18 @@ discard block |
||
717 | 717 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
718 | 718 | $table_user = Database::get_main_table(TABLE_MAIN_USER); |
719 | 719 | $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username |
720 | - FROM ' . $table_user . ' u |
|
721 | - INNER JOIN ' . $table_certificate . ' gc |
|
720 | + FROM ' . $table_user.' u |
|
721 | + INNER JOIN ' . $table_certificate.' gc |
|
722 | 722 | ON u.user_id=gc.user_id '; |
723 | 723 | if (!is_null($cat_id) && $cat_id > 0) { |
724 | - $sql.=' WHERE cat_id=' . intval($cat_id); |
|
724 | + $sql .= ' WHERE cat_id='.intval($cat_id); |
|
725 | 725 | } |
726 | 726 | if (!empty($userList)) { |
727 | 727 | $userList = array_map('intval', $userList); |
728 | 728 | $userListCondition = implode("','", $userList); |
729 | 729 | $sql .= " AND u.user_id IN ('$userListCondition')"; |
730 | 730 | } |
731 | - $sql.=' ORDER BY u.firstname'; |
|
731 | + $sql .= ' ORDER BY u.firstname'; |
|
732 | 732 | $rs = Database::query($sql); |
733 | 733 | |
734 | 734 | $list_users = array(); |
@@ -749,10 +749,10 @@ discard block |
||
749 | 749 | { |
750 | 750 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
751 | 751 | $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id |
752 | - FROM ' . $table_certificate . ' gc |
|
753 | - WHERE gc.user_id="' . intval($user_id) . '" '; |
|
752 | + FROM ' . $table_certificate.' gc |
|
753 | + WHERE gc.user_id="' . intval($user_id).'" '; |
|
754 | 754 | if (!is_null($cat_id) && $cat_id > 0) { |
755 | - $sql.=' AND cat_id=' . intval($cat_id); |
|
755 | + $sql .= ' AND cat_id='.intval($cat_id); |
|
756 | 756 | } |
757 | 757 | |
758 | 758 | $rs = Database::query($sql); |
@@ -790,21 +790,21 @@ discard block |
||
790 | 790 | $variables = $content_html['variables']; |
791 | 791 | } |
792 | 792 | |
793 | - $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery'; |
|
793 | + $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery'; |
|
794 | 794 | $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html); |
795 | 795 | |
796 | - $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document'; |
|
796 | + $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document'; |
|
797 | 797 | $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html); |
798 | - $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
798 | + $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
799 | 799 | |
800 | 800 | //add print header |
801 | 801 | if ($hide_print_button == false) { |
802 | 802 | $print = '<style media="print" type="text/css">#print_div {visibility:hidden;}</style>'; |
803 | - $print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="' . api_get_path(WEB_CODE_PATH) . 'img/printmgr.gif" alt="' . get_lang('Print') . '" /> ' . get_lang('Print') . '</a>'; |
|
803 | + $print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="'.api_get_path(WEB_CODE_PATH).'img/printmgr.gif" alt="'.get_lang('Print').'" /> '.get_lang('Print').'</a>'; |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | // Add header |
807 | - $new_content_html = $contentHead. $print . '</head>' . $new_content_html; |
|
807 | + $new_content_html = $contentHead.$print.'</head>'.$new_content_html; |
|
808 | 808 | |
809 | 809 | return array( |
810 | 810 | 'content' => $new_content_html, |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | if (!empty($session_id)) { |
859 | 859 | $my_session_id = api_get_session_id(); |
860 | 860 | $s_name = api_get_session_name($my_session_id); |
861 | - $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name); |
|
861 | + $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name); |
|
862 | 862 | $cat->set_session_id($session_id); |
863 | 863 | } else { |
864 | 864 | $cat->set_name($course_code); |
@@ -982,13 +982,13 @@ discard block |
||
982 | 982 | |
983 | 983 | if ($use_grade_model) { |
984 | 984 | if ($parent_id == 0) { |
985 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
985 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
986 | 986 | } else { |
987 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')'; |
|
987 | + $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')'; |
|
988 | 988 | } |
989 | 989 | } else { |
990 | 990 | if ($parent_id == 0) { |
991 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
991 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
992 | 992 | } else { |
993 | 993 | $title = api_strtoupper(get_lang('Average')); |
994 | 994 | } |
@@ -1042,11 +1042,11 @@ discard block |
||
1042 | 1042 | } else { |
1043 | 1043 | $column = 0; |
1044 | 1044 | $table->setCellContents($row, $column, get_lang('NoResults')); |
1045 | - $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"'); |
|
1045 | + $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"'); |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | $pdfParams = array( |
1049 | - 'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), |
|
1049 | + 'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(), |
|
1050 | 1050 | 'pdf_title' => $title, |
1051 | 1051 | 'course_code' => $course_code, |
1052 | 1052 | 'add_signatures' => true |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | $a_students = array(); |
1132 | 1132 | while ($user = Database::fetch_array($result)) { |
1133 | 1133 | if (!array_key_exists($user['user_id'], $a_students)) { |
1134 | - $a_current_student = array (); |
|
1134 | + $a_current_student = array(); |
|
1135 | 1135 | $a_current_student[] = $user['user_id']; |
1136 | 1136 | $a_current_student[] = $user['username']; |
1137 | 1137 | $a_current_student[] = $user['lastname']; |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | foreach ($links as $link) { |
1190 | 1190 | // links are always in a course |
1191 | 1191 | $coursecode = $link->get_course_code(); |
1192 | - if (!array_key_exists($coursecode,$coursecodes)) { |
|
1192 | + if (!array_key_exists($coursecode, $coursecodes)) { |
|
1193 | 1193 | $coursecodes[$coursecode] = '1'; |
1194 | 1194 | $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode)); |
1195 | 1195 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | * Search students matching a given last name and/or first name |
1203 | 1203 | * @author Bert Steppé |
1204 | 1204 | */ |
1205 | - public static function find_students($mask= '') |
|
1205 | + public static function find_students($mask = '') |
|
1206 | 1206 | { |
1207 | 1207 | // students shouldn't be here // don't search if mask empty |
1208 | 1208 | if (!api_is_allowed_to_edit() || empty ($mask)) { |
@@ -1213,23 +1213,23 @@ discard block |
||
1213 | 1213 | $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
1214 | 1214 | $tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
1215 | 1215 | $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code |
1216 | - FROM ' . $tbl_user . ' user'; |
|
1216 | + FROM ' . $tbl_user.' user'; |
|
1217 | 1217 | if (!api_is_platform_admin()) { |
1218 | - $sql .= ', ' . $tbl_cru . ' cru'; |
|
1218 | + $sql .= ', '.$tbl_cru.' cru'; |
|
1219 | 1219 | } |
1220 | 1220 | |
1221 | - $sql .= ' WHERE user.status = ' . STUDENT; |
|
1222 | - $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'"; |
|
1223 | - $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')"; |
|
1221 | + $sql .= ' WHERE user.status = '.STUDENT; |
|
1222 | + $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'"; |
|
1223 | + $sql .= ' OR user.firstname LIKE '."'%".$mask."%')"; |
|
1224 | 1224 | |
1225 | 1225 | if (!api_is_platform_admin()) { |
1226 | 1226 | $sql .= ' AND user.user_id = cru.user_id AND |
1227 | 1227 | cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND |
1228 | 1228 | cru.c_id in ( |
1229 | - SELECT c_id FROM '.$tbl_cru . ' |
|
1229 | + SELECT c_id FROM '.$tbl_cru.' |
|
1230 | 1230 | WHERE |
1231 | - user_id = ' . api_get_user_id() . ' AND |
|
1232 | - status = ' . COURSEMANAGER . ' |
|
1231 | + user_id = ' . api_get_user_id().' AND |
|
1232 | + status = ' . COURSEMANAGER.' |
|
1233 | 1233 | ) |
1234 | 1234 | '; |
1235 | 1235 | } |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | 'course' => $courseInfo['title'], |
1372 | 1372 | 'score' => $certificateInfo['score_certificate'], |
1373 | 1373 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
1374 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
1374 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
1375 | 1375 | ]; |
1376 | 1376 | } |
1377 | 1377 | |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | 'course' => $course['title'], |
1436 | 1436 | 'score' => $certificateInfo['score_certificate'], |
1437 | 1437 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
1438 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
1438 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
1439 | 1439 | ]; |
1440 | 1440 | } |
1441 | 1441 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | /** |
234 | 234 | * @param int $category_id |
235 | - * @return bool |
|
235 | + * @return false|null |
|
236 | 236 | */ |
237 | 237 | public function insert_defaults($category_id) |
238 | 238 | { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
266 | - * @return int|null|string |
|
266 | + * @return integer |
|
267 | 267 | */ |
268 | 268 | public function get_number_decimals() |
269 | 269 | { |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | |
338 | 338 | /** |
339 | 339 | * @param $score |
340 | - * @param $type |
|
341 | - * @return float|string |
|
340 | + * @param integer $type |
|
341 | + * @return string |
|
342 | 342 | */ |
343 | 343 | private function display_default($score, $type) |
344 | 344 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * Compare the custom display of 2 scores, can be useful in sorting |
36 | 36 | */ |
37 | - public static function compare_scores_by_custom_display ($score1, $score2) |
|
37 | + public static function compare_scores_by_custom_display($score1, $score2) |
|
38 | 38 | { |
39 | 39 | if (!isset($score1)) { |
40 | 40 | return (isset($score2) ? 1 : 0); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($custom1 == $custom2) { |
48 | 48 | return 0; |
49 | 49 | } else { |
50 | - return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1); |
|
50 | + return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // Setting custom enabled |
79 | 79 | $value = api_get_setting('gradebook.gradebook_score_display_custom'); |
80 | - $this->custom_enabled = $value == 'true' ? true : false; |
|
80 | + $this->custom_enabled = $value == 'true' ? true : false; |
|
81 | 81 | |
82 | 82 | if ($this->custom_enabled) { |
83 | 83 | $params = array('category = ?' => array('Gradebook')); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | sort($portal_displays); |
95 | 95 | } |
96 | 96 | $this->custom_display = $portal_displays; |
97 | - if (count($this->custom_display)>0) { |
|
97 | + if (count($this->custom_display) > 0) { |
|
98 | 98 | $value = api_get_setting('gradebook_score_display_upperlimit'); |
99 | 99 | $value = $value['my_display_upperlimit']; |
100 | - $this->upperlimit_included = $value == 'true' ? true : false; |
|
100 | + $this->upperlimit_included = $value == 'true' ? true : false; |
|
101 | 101 | $this->custom_display_conv = $this->convert_displays($this->custom_display); |
102 | 102 | } |
103 | 103 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | //Load course settings |
112 | 112 | if ($this->custom_enabled) { |
113 | 113 | $this->custom_display = $this->get_custom_displays(); |
114 | - if (count($this->custom_display)> 0) { |
|
114 | + if (count($this->custom_display) > 0) { |
|
115 | 115 | $this->custom_display_conv = $this->convert_displays($this->custom_display); |
116 | 116 | } |
117 | 117 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | ); |
263 | 263 | |
264 | 264 | $tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY); |
265 | - foreach($display as $value => $text) { |
|
265 | + foreach ($display as $value => $text) { |
|
266 | 266 | $params = array( |
267 | 267 | 'score' => $value, |
268 | 268 | 'display' => $text, |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $my_score = $score == 0 ? 1 : $score; |
321 | 321 | |
322 | 322 | if ($type == SCORE_BAR) { |
323 | - $percentage = $my_score[0]/$my_score[1]*100; |
|
323 | + $percentage = $my_score[0] / $my_score[1] * 100; |
|
324 | 324 | |
325 | 325 | return Display::bar_progress($percentage); |
326 | 326 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | case SCORE_PERCENT : // XX % |
362 | 362 | return $this->display_as_percent($score); |
363 | 363 | case SCORE_DIV_PERCENT : // X / Y (XX %) |
364 | - return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'; |
|
364 | + return $this->display_as_div($score).' ('.$this->display_as_percent($score).')'; |
|
365 | 365 | case SCORE_AVERAGE : // XX % |
366 | 366 | return $this->display_as_percent($score); |
367 | 367 | case SCORE_DECIMAL : // 0.50 (X/Y) |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if (!empty($custom)) { |
372 | 372 | $custom = ' - '.$custom; |
373 | 373 | } |
374 | - return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom; |
|
374 | + return $this->display_as_div($score).' ('.$this->display_as_percent($score).')'.$custom; |
|
375 | 375 | case SCORE_DIV_SIMPLE_WITH_CUSTOM : // X - Good! |
376 | 376 | $custom = $this->display_custom($score); |
377 | 377 | |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | */ |
424 | 424 | private function display_as_decimal($score) |
425 | 425 | { |
426 | - $score_denom = ($score[1]==0) ? 1 : $score[1]; |
|
426 | + $score_denom = ($score[1] == 0) ? 1 : $score[1]; |
|
427 | 427 | |
428 | - return $this->format_score($score[0]/$score_denom); |
|
428 | + return $this->format_score($score[0] / $score_denom); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | */ |
434 | 434 | private function display_as_percent($score) |
435 | 435 | { |
436 | - $score_denom = ($score[1]==0) ? 1 : $score[1]; |
|
436 | + $score_denom = ($score[1] == 0) ? 1 : $score[1]; |
|
437 | 437 | |
438 | - return $this->format_score($score[0]/$score_denom*100) . ' %'; |
|
438 | + return $this->format_score($score[0] / $score_denom * 100).' %'; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | } else { |
452 | 452 | $score[0] = isset($score[0]) ? $this->format_score($score[0]) : 0; |
453 | 453 | $score[1] = isset($score[1]) ? $this->format_score($score[1]) : 0; |
454 | - return $score[0] . ' / ' . $score[1]; |
|
454 | + return $score[0].' / '.$score[1]; |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | */ |
462 | 462 | private function display_custom($score) |
463 | 463 | { |
464 | - $my_score_denom= ($score[1]==0) ? 1 : $score[1]; |
|
464 | + $my_score_denom = ($score[1] == 0) ? 1 : $score[1]; |
|
465 | 465 | $scaledscore = $score[0] / $my_score_denom; |
466 | 466 | if ($this->upperlimit_included) { |
467 | 467 | foreach ($this->custom_display_conv as $displayitem) { |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | ORDER BY score'; |
526 | 526 | $result = Database::query($sql); |
527 | 527 | |
528 | - return Database::store_result($result,'ASSOC'); |
|
528 | + return Database::store_result($result, 'ASSOC'); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -471,7 +471,7 @@ |
||
471 | 471 | * Display a user icon that links to the user page |
472 | 472 | * |
473 | 473 | * @param integer $user_id the id of the user |
474 | - * @return html code |
|
474 | + * @return string code |
|
475 | 475 | * |
476 | 476 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
477 | 477 | * @version April 2008 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | require_once '../inc/global.inc.php'; |
13 | -$current_course_tool = TOOL_GROUP; |
|
13 | +$current_course_tool = TOOL_GROUP; |
|
14 | 14 | |
15 | 15 | // Notice for unauthorized people. |
16 | 16 | api_protect_course_script(true); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | echo '<div class="actions">'; |
71 | 71 | echo '<a href="group.php">'. |
72 | - Display::return_icon('back.png',get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM). |
|
72 | + Display::return_icon('back.png', get_lang('BackToGroupList'), '', ICON_SIZE_MEDIUM). |
|
73 | 73 | '</a>'; |
74 | 74 | |
75 | 75 | /* |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | $unsubscribe_group = ''; |
88 | 88 | if (GroupManager :: is_self_unregistration_allowed($user_id, $current_group['id'])) { |
89 | - $unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."'".')) return false;">'. |
|
89 | + $unsubscribe_group = '<a class="btn btn-default" href="'.api_get_self().'?selfUnReg=1" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."'".')) return false;">'. |
|
90 | 90 | get_lang("StudentUnsubscribe").'</a>'; |
91 | 91 | } |
92 | 92 | echo ' </div>'; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id()) |
99 | 99 | ) { |
100 | 100 | $my_origin = isset($origin) ? $origin : ''; |
101 | - $edit_url = '<a href="'.api_get_path(WEB_CODE_PATH).'group/settings.php?'.api_get_cidreq().'&origin='.$my_origin.'">'. |
|
102 | - Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a>'; |
|
101 | + $edit_url = '<a href="'.api_get_path(WEB_CODE_PATH).'group/settings.php?'.api_get_cidreq().'&origin='.$my_origin.'">'. |
|
102 | + Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a>'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | echo Display::page_header( |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $forums_of_groups = get_forums_of_group($current_group['id']); |
123 | 123 | |
124 | 124 | if (is_array($forums_of_groups)) { |
125 | - if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE ) { |
|
125 | + if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE) { |
|
126 | 126 | foreach ($forums_of_groups as $key => $value) { |
127 | 127 | |
128 | 128 | //*!empty($user_subscribe_to_current_group) && */ |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $actions_array[] = array( |
136 | 136 | 'url' => '../forum/viewforum.php?forum='.$value['forum_id'].'&'.api_get_cidreq().'&origin=group', |
137 | - 'content' => Display::return_icon('forum.png', get_lang('Forum').': '.$value['forum_title'] , array(), 32) |
|
137 | + 'content' => Display::return_icon('forum.png', get_lang('Forum').': '.$value['forum_title'], array(), 32) |
|
138 | 138 | ); |
139 | 139 | } |
140 | 140 | } |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | $forums_of_groups = get_forums_of_group($current_group['id']); |
213 | 213 | |
214 | 214 | if (is_array($forums_of_groups)) { |
215 | - if ( $current_group['forum_state'] == GroupManager::TOOL_PUBLIC ) { |
|
215 | + if ($current_group['forum_state'] == GroupManager::TOOL_PUBLIC) { |
|
216 | 216 | foreach ($forums_of_groups as $key => $value) { |
217 | - if ($value['forum_group_public_private'] == 'public' ) { |
|
217 | + if ($value['forum_group_public_private'] == 'public') { |
|
218 | 218 | $actions_array[] = array( |
219 | 219 | 'url' => '../forum/viewforum.php?cidReq='.api_get_course_id().'&forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&origin=group', |
220 | 220 | 'content' => Display::return_icon('forum.png', get_lang('GroupForum'), array(), ICON_SIZE_MEDIUM) |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ); |
266 | 266 | } |
267 | 267 | |
268 | - if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC ) { |
|
268 | + if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC) { |
|
269 | 269 | // Link to the chat area of this group |
270 | 270 | if (api_get_course_setting('allow_open_chat_window')) { |
271 | 271 | $actions_array[] = array( |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if (count($tutors) == 0) { |
295 | 295 | $tutor_info = get_lang('GroupNoneMasc'); |
296 | 296 | } else { |
297 | - isset($origin) ? $my_origin = $origin:$my_origin=''; |
|
297 | + isset($origin) ? $my_origin = $origin : $my_origin = ''; |
|
298 | 298 | $tutor_info .= '<ul class="thumbnails">'; |
299 | 299 | foreach ($tutors as $index => $tutor) { |
300 | 300 | $userInfo = api_get_user_info($tutor['user_id']); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | FROM ".$table_group_user." |
374 | 374 | WHERE c_id = $course_id AND group_id='".Database::escape_string($current_group['id'])."'"; |
375 | 375 | $result = Database::query($sql); |
376 | - $return = Database::fetch_array($result,'ASSOC'); |
|
376 | + $return = Database::fetch_array($result, 'ASSOC'); |
|
377 | 377 | return $return['number_of_users']; |
378 | 378 | } |
379 | 379 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | global $current_group; |
395 | 395 | |
396 | 396 | // Database table definition |
397 | - $table_group_user = Database :: get_course_table(TABLE_GROUP_USER); |
|
398 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
397 | + $table_group_user = Database :: get_course_table(TABLE_GROUP_USER); |
|
398 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
399 | 399 | |
400 | 400 | $course_id = api_get_course_int_id(); |
401 | 401 |
@@ -1,8 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | -use ChamiloSession as Session; |
|
5 | - |
|
6 | 4 | /** |
7 | 5 | * Class ExerciseLib |
8 | 6 | * shows a question and its answers |
@@ -189,6 +189,8 @@ |
||
189 | 189 | * @param float Timeout |
190 | 190 | * @param bool Include HTTP Request headers? |
191 | 191 | * @param bool Include HTTP Response headers? |
192 | + * @param string $ip |
|
193 | + * @return string |
|
192 | 194 | */ |
193 | 195 | function _http_request($ip, $port = 80, $uri = '/', $getdata = array(), $timeout = 5, $req_hdr = false, $res_hdr = false) |
194 | 196 | { |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $urlInfo['url'])); |
51 | 51 | $cleanUrl = str_replace('/', '-', $url); |
52 | 52 | |
53 | - $newUrlDir = api_get_path(SYS_APP_PATH) . "home/$cleanUrl/admin/"; |
|
53 | + $newUrlDir = api_get_path(SYS_APP_PATH)."home/$cleanUrl/admin/"; |
|
54 | 54 | } else { |
55 | - $newUrlDir = api_get_path(SYS_APP_PATH) . "home/admin/"; |
|
55 | + $newUrlDir = api_get_path(SYS_APP_PATH)."home/admin/"; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | if (!file_exists($newUrlDir)) { |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | if ($system_version != $version_info) { |
169 | - $output = '<br /><span style="color:red">' . get_lang('YourVersionNotUpToDate') . '. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version. '</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>'; |
|
169 | + $output = '<br /><span style="color:red">'.get_lang('YourVersionNotUpToDate').'. '.get_lang('LatestVersionIs').' <b>Chamilo '.$version_info.'</b>. '.get_lang('YourVersionIs').' <b>Chamilo '.$system_version.'</b>. '.str_replace('http://www.chamilo.org', '<a href="http://www.chamilo.org">http://www.chamilo.org</a>', get_lang('PleaseVisitOurWebsite')).'</span>'; |
|
170 | 170 | } else { |
171 | 171 | $output = '<br /><span style="color:green">'.get_lang('VersionUpToDate').': Chamilo '.$version_info.'</span>'; |
172 | 172 | } |
173 | 173 | } else { |
174 | - $output = '<span style="color:red">' . get_lang('ImpossibleToContactVersionServerPleaseTryAgain') . '</span>'; |
|
174 | + $output = '<span style="color:red">'.get_lang('ImpossibleToContactVersionServerPleaseTryAgain').'</span>'; |
|
175 | 175 | } |
176 | 176 | } else { |
177 | - $output = '<span style="color:red">' . get_lang('AllowurlfopenIsSetToOff') . '</span>'; |
|
177 | + $output = '<span style="color:red">'.get_lang('AllowurlfopenIsSetToOff').'</span>'; |
|
178 | 178 | } |
179 | 179 | return $output; |
180 | 180 | } |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | $getdata_str = count($getdata) ? '?' : ''; |
198 | 198 | |
199 | 199 | foreach ($getdata as $k => $v) { |
200 | - $getdata_str .= urlencode($k) .'='. urlencode($v) . '&'; |
|
200 | + $getdata_str .= urlencode($k).'='.urlencode($v).'&'; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | $crlf = "\r\n"; |
204 | - $req = $verb .' '. $uri . $getdata_str .' HTTP/1.1' . $crlf; |
|
205 | - $req .= 'Host: '. $ip . $crlf; |
|
206 | - $req .= 'User-Agent: Mozilla/5.0 Firefox/3.6.12' . $crlf; |
|
207 | - $req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' . $crlf; |
|
208 | - $req .= 'Accept-Language: en-us,en;q=0.5' . $crlf; |
|
209 | - $req .= 'Accept-Encoding: deflate' . $crlf; |
|
210 | - $req .= 'Accept-Charset: utf-8;q=0.7,*;q=0.7' . $crlf; |
|
204 | + $req = $verb.' '.$uri.$getdata_str.' HTTP/1.1'.$crlf; |
|
205 | + $req .= 'Host: '.$ip.$crlf; |
|
206 | + $req .= 'User-Agent: Mozilla/5.0 Firefox/3.6.12'.$crlf; |
|
207 | + $req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'.$crlf; |
|
208 | + $req .= 'Accept-Language: en-us,en;q=0.5'.$crlf; |
|
209 | + $req .= 'Accept-Encoding: deflate'.$crlf; |
|
210 | + $req .= 'Accept-Charset: utf-8;q=0.7,*;q=0.7'.$crlf; |
|
211 | 211 | |
212 | 212 | $req .= $crlf; |
213 | 213 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Responses to AJAX calls |
|
5 | - */ |
|
4 | + * Responses to AJAX calls |
|
5 | + */ |
|
6 | 6 | |
7 | 7 | require_once '../global.inc.php'; |
8 | 8 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * a given string |
23 | 23 | * @param string String to search for |
24 | 24 | * @param int Deprecated param |
25 | - * @return string A formatted, xajax answer block |
|
25 | + * @return xajaxResponse A formatted, xajax answer block |
|
26 | 26 | * @assert () === false |
27 | 27 | */ |
28 | 28 | function search_courses($needle, $id) |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Definition of the Accessurleditcoursestourl class |
|
5 | - * @package chamilo.library |
|
6 | - */ |
|
4 | + * Definition of the Accessurleditcoursestourl class |
|
5 | + * @package chamilo.library |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Access_url_edit_courses_to_url class |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | $needle = Database::escape_string($needle); |
39 | 39 | // search courses where username or firstname or lastname begins likes $needle |
40 | 40 | $sql = 'SELECT code, title FROM '.$tbl_course.' u '. |
41 | - ' WHERE (title LIKE "'.$needle.'%" '. |
|
42 | - ' OR code LIKE "'.$needle.'%" '. |
|
43 | - ' ) '. |
|
44 | - ' ORDER BY title, code '. |
|
45 | - ' LIMIT 11'; |
|
41 | + ' WHERE (title LIKE "'.$needle.'%" '. |
|
42 | + ' OR code LIKE "'.$needle.'%" '. |
|
43 | + ' ) '. |
|
44 | + ' ORDER BY title, code '. |
|
45 | + ' LIMIT 11'; |
|
46 | 46 | $rs = Database::query($sql); |
47 | 47 | $i=0; |
48 | 48 | while ($course = Database :: fetch_array($rs)) { |
49 | 49 | $i++; |
50 | 50 | if ($i<=10) { |
51 | - $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />'; |
|
51 | + $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($course['code']).'\',\''.addslashes($course['title']).' ('.addslashes($course['code']).')'.'\')">'.$course['title'].' ('.$course['code'].')</a><br />'; |
|
52 | 52 | } else { |
53 | 53 | $return .= '...<br />'; |
54 | 54 | } |
@@ -44,17 +44,17 @@ |
||
44 | 44 | ORDER BY name, id |
45 | 45 | LIMIT 11'; |
46 | 46 | $rs = Database::query($sql); |
47 | - $i=0; |
|
47 | + $i = 0; |
|
48 | 48 | while ($session = Database :: fetch_array($rs)) { |
49 | 49 | $i++; |
50 | - if ($i<=10) { |
|
50 | + if ($i <= 10) { |
|
51 | 51 | $return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />'; |
52 | 52 | } else { |
53 | 53 | $return .= '...<br />'; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | - $xajax_response -> addAssign('ajax_list_courses','innerHTML',api_utf8_encode($return)); |
|
57 | + $xajax_response -> addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return)); |
|
58 | 58 | return $xajax_response; |
59 | 59 | } |
60 | 60 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * search string |
24 | 24 | * @param string Search string |
25 | 25 | * @param int Deprecated param |
26 | - * @return string Xajax response block |
|
26 | + * @return xajaxResponse Xajax response block |
|
27 | 27 | * @assert () === false |
28 | 28 | */ |
29 | 29 | function search_users($needle, $id) |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Accessurledituserstourl class definition |
|
5 | - * @package chamilo.library |
|
6 | - */ |
|
4 | + * Accessurledituserstourl class definition |
|
5 | + * @package chamilo.library |
|
6 | + */ |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Accessurledituserstourl class definition |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | // search users where username or firstname or lastname begins likes $needle |
41 | 41 | $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; |
42 | 42 | $sql = 'SELECT u.user_id, username, lastname, firstname FROM '.$tbl_user.' u '. |
43 | - ' WHERE (username LIKE "'.$needle.'%" '. |
|
44 | - ' OR firstname LIKE "'.$needle.'%" '. |
|
45 | - ' OR lastname LIKE "'.$needle.'%") '. |
|
43 | + ' WHERE (username LIKE "'.$needle.'%" '. |
|
44 | + ' OR firstname LIKE "'.$needle.'%" '. |
|
45 | + ' OR lastname LIKE "'.$needle.'%") '. |
|
46 | 46 | $order_clause . |
47 | - ' LIMIT 11'; |
|
47 | + ' LIMIT 11'; |
|
48 | 48 | |
49 | 49 | $rs = Database::query($sql); |
50 | 50 | $i=0; |
@@ -43,22 +43,22 @@ |
||
43 | 43 | ' WHERE (username LIKE "'.$needle.'%" '. |
44 | 44 | ' OR firstname LIKE "'.$needle.'%" '. |
45 | 45 | ' OR lastname LIKE "'.$needle.'%") '. |
46 | - $order_clause . |
|
46 | + $order_clause. |
|
47 | 47 | ' LIMIT 11'; |
48 | 48 | |
49 | 49 | $rs = Database::query($sql); |
50 | - $i=0; |
|
50 | + $i = 0; |
|
51 | 51 | |
52 | 52 | while ($user = Database :: fetch_array($rs)) { |
53 | 53 | $i++; |
54 | - if ($i<=10) { |
|
54 | + if ($i <= 10) { |
|
55 | 55 | $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($user['user_id']).'\',\''.api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])).' ('.addslashes($user['username']).')'.'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />'; |
56 | 56 | } else { |
57 | 57 | $return .= '...<br />'; |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | - $xajax_response -> addAssign('ajax_list_users','innerHTML',api_utf8_encode($return)); |
|
61 | + $xajax_response -> addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return)); |
|
62 | 62 | return $xajax_response; |
63 | 63 | } |
64 | 64 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | /** |
191 | 191 | * Gets an array with all the course tables (deprecated?) |
192 | - * @return array |
|
192 | + * @return string[] |
|
193 | 193 | * @assert (null) !== null |
194 | 194 | */ |
195 | 195 | public static function get_course_tables() |
@@ -310,6 +310,8 @@ discard block |
||
310 | 310 | * @param string Complete path to directory we want to list |
311 | 311 | * @param array A list of files to which we want to add the files found |
312 | 312 | * @param string Type of base directory from which we want to recover the files |
313 | + * @param string $path |
|
314 | + * @param string $media |
|
313 | 315 | * @return array |
314 | 316 | * @assert (null,null,null) === false |
315 | 317 | * @assert ('abc',array(),'') === array() |
@@ -371,6 +373,7 @@ discard block |
||
371 | 373 | * Sorts pictures by type (used?) |
372 | 374 | * @param array List of files (sthg like array(0=>array('png'=>1))) |
373 | 375 | * @param string File type |
376 | + * @param string $type |
|
374 | 377 | * @return array The received array without files not matching type |
375 | 378 | * @assert (array(),null) === array() |
376 | 379 | */ |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | while (!$keys_are_unique) { |
47 | 47 | |
48 | - $keys_course_id = $prefix_for_all . $unique_prefix . $wanted_code . $final_suffix['CourseId']; |
|
48 | + $keys_course_id = $prefix_for_all.$unique_prefix.$wanted_code.$final_suffix['CourseId']; |
|
49 | 49 | //$keys_course_db_name = $prefix_for_base_name . $unique_prefix . strtoupper($keys_course_id) . $final_suffix['CourseDb']; |
50 | - $keys_course_repository = $prefix_for_path . $unique_prefix . $wanted_code . $final_suffix['CourseDir']; |
|
50 | + $keys_course_repository = $prefix_for_path.$unique_prefix.$wanted_code.$final_suffix['CourseDir']; |
|
51 | 51 | $keys_are_unique = true; |
52 | 52 | |
53 | 53 | // Check whether they are unique. |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | |
57 | 57 | if (Database::num_rows($result)) { |
58 | 58 | $keys_are_unique = false; |
59 | - $try_new_fsc_id ++; |
|
59 | + $try_new_fsc_id++; |
|
60 | 60 | $final_suffix['CourseId'] = substr(md5(uniqid(rand())), 0, 4); |
61 | 61 | } |
62 | 62 | if (file_exists(api_get_path(SYS_COURSE_PATH).$keys_course_repository)) { |
63 | 63 | $keys_are_unique = false; |
64 | - $try_new_fsc_dir ++; |
|
64 | + $try_new_fsc_dir++; |
|
65 | 65 | $final_suffix['CourseDir'] = substr(md5(uniqid(rand())), 0, 4); |
66 | 66 | } |
67 | 67 | |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | $perm = api_get_permissions_for_new_directories(); |
90 | 90 | $perm_file = api_get_permissions_for_new_files(); |
91 | 91 | $htmlpage = "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>Not authorized</title>\n </head>\n <body>\n </body>\n</html>"; |
92 | - $cp = api_get_path(SYS_COURSE_PATH) . $course_repository; |
|
92 | + $cp = api_get_path(SYS_COURSE_PATH).$course_repository; |
|
93 | 93 | |
94 | 94 | //Creating document folder |
95 | 95 | mkdir($cp, $perm); |
96 | - mkdir($cp . '/document', $perm); |
|
97 | - $cpt = $cp . '/document/index.html'; |
|
96 | + mkdir($cp.'/document', $perm); |
|
97 | + $cpt = $cp.'/document/index.html'; |
|
98 | 98 | $fd = fopen($cpt, 'w'); |
99 | 99 | fwrite($fd, $htmlpage); |
100 | 100 | fclose($fd); |
@@ -116,49 +116,49 @@ discard block |
||
116 | 116 | @copy($cpt, $cp . '/document/video/index.html'); */ |
117 | 117 | |
118 | 118 | //Creatind dropbox folder |
119 | - mkdir($cp . '/dropbox', $perm); |
|
120 | - $cpt = $cp . '/dropbox/index.html'; |
|
119 | + mkdir($cp.'/dropbox', $perm); |
|
120 | + $cpt = $cp.'/dropbox/index.html'; |
|
121 | 121 | $fd = fopen($cpt, 'w'); |
122 | 122 | fwrite($fd, $htmlpage); |
123 | 123 | fclose($fd); |
124 | 124 | @chmod($cpt, $perm_file); |
125 | - mkdir($cp . '/group', $perm); |
|
126 | - @copy($cpt, $cp . '/group/index.html'); |
|
127 | - mkdir($cp . '/page', $perm); |
|
128 | - @copy($cpt, $cp . '/page/index.html'); |
|
129 | - mkdir($cp . '/scorm', $perm); |
|
130 | - @copy($cpt, $cp . '/scorm/index.html'); |
|
131 | - mkdir($cp . '/upload', $perm); |
|
132 | - @copy($cpt, $cp . '/upload/index.html'); |
|
133 | - mkdir($cp . '/upload/forum', $perm); |
|
134 | - @copy($cpt, $cp . '/upload/forum/index.html'); |
|
135 | - mkdir($cp . '/upload/forum/images', $perm); |
|
136 | - @copy($cpt, $cp . '/upload/forum/images/index.html'); |
|
137 | - mkdir($cp . '/upload/test', $perm); |
|
138 | - @copy($cpt, $cp . '/upload/test/index.html'); |
|
139 | - mkdir($cp . '/upload/blog', $perm); |
|
140 | - @copy($cpt, $cp . '/upload/blog/index.html'); |
|
141 | - mkdir($cp . '/upload/learning_path', $perm); |
|
142 | - @copy($cpt, $cp . '/upload/learning_path/index.html'); |
|
143 | - mkdir($cp . '/upload/learning_path/images', $perm); |
|
144 | - @copy($cpt, $cp . '/upload/learning_path/images/index.html'); |
|
145 | - mkdir($cp . '/upload/calendar', $perm); |
|
146 | - @copy($cpt, $cp . '/upload/calendar/index.html'); |
|
147 | - mkdir($cp . '/upload/calendar/images', $perm); |
|
148 | - @copy($cpt, $cp . '/upload/calendar/images/index.html'); |
|
149 | - mkdir($cp . '/work', $perm); |
|
150 | - @copy($cpt, $cp . '/work/index.html'); |
|
151 | - mkdir($cp . '/upload/announcements', $perm); |
|
152 | - @copy($cpt, $cp . '/upload/announcements/index.html'); |
|
153 | - mkdir($cp . '/upload/announcements/images', $perm); |
|
154 | - @copy($cpt, $cp . '/upload/announcements/images/index.html'); |
|
125 | + mkdir($cp.'/group', $perm); |
|
126 | + @copy($cpt, $cp.'/group/index.html'); |
|
127 | + mkdir($cp.'/page', $perm); |
|
128 | + @copy($cpt, $cp.'/page/index.html'); |
|
129 | + mkdir($cp.'/scorm', $perm); |
|
130 | + @copy($cpt, $cp.'/scorm/index.html'); |
|
131 | + mkdir($cp.'/upload', $perm); |
|
132 | + @copy($cpt, $cp.'/upload/index.html'); |
|
133 | + mkdir($cp.'/upload/forum', $perm); |
|
134 | + @copy($cpt, $cp.'/upload/forum/index.html'); |
|
135 | + mkdir($cp.'/upload/forum/images', $perm); |
|
136 | + @copy($cpt, $cp.'/upload/forum/images/index.html'); |
|
137 | + mkdir($cp.'/upload/test', $perm); |
|
138 | + @copy($cpt, $cp.'/upload/test/index.html'); |
|
139 | + mkdir($cp.'/upload/blog', $perm); |
|
140 | + @copy($cpt, $cp.'/upload/blog/index.html'); |
|
141 | + mkdir($cp.'/upload/learning_path', $perm); |
|
142 | + @copy($cpt, $cp.'/upload/learning_path/index.html'); |
|
143 | + mkdir($cp.'/upload/learning_path/images', $perm); |
|
144 | + @copy($cpt, $cp.'/upload/learning_path/images/index.html'); |
|
145 | + mkdir($cp.'/upload/calendar', $perm); |
|
146 | + @copy($cpt, $cp.'/upload/calendar/index.html'); |
|
147 | + mkdir($cp.'/upload/calendar/images', $perm); |
|
148 | + @copy($cpt, $cp.'/upload/calendar/images/index.html'); |
|
149 | + mkdir($cp.'/work', $perm); |
|
150 | + @copy($cpt, $cp.'/work/index.html'); |
|
151 | + mkdir($cp.'/upload/announcements', $perm); |
|
152 | + @copy($cpt, $cp.'/upload/announcements/index.html'); |
|
153 | + mkdir($cp.'/upload/announcements/images', $perm); |
|
154 | + @copy($cpt, $cp.'/upload/announcements/images/index.html'); |
|
155 | 155 | |
156 | 156 | //Oral expression question type |
157 | - mkdir($cp . '/exercises', $perm); |
|
158 | - @copy($cpt, $cp . '/exercises/index.html'); |
|
157 | + mkdir($cp.'/exercises', $perm); |
|
158 | + @copy($cpt, $cp.'/exercises/index.html'); |
|
159 | 159 | |
160 | 160 | // Create .htaccess in the dropbox directory. |
161 | - $fp = fopen($cp . '/dropbox/.htaccess', 'w'); |
|
161 | + $fp = fopen($cp.'/dropbox/.htaccess', 'w'); |
|
162 | 162 | fwrite( |
163 | 163 | $fp, |
164 | 164 | "AuthName AllowLocalAccess |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | { |
302 | 302 | $list = self::get_course_tables(); |
303 | 303 | foreach ($list as $table) { |
304 | - $sql = "DROP TABLE IF EXISTS " . DB_COURSE_PREFIX . $table; |
|
304 | + $sql = "DROP TABLE IF EXISTS ".DB_COURSE_PREFIX.$table; |
|
305 | 305 | Database::query($sql); |
306 | 306 | } |
307 | 307 | } |
@@ -323,47 +323,47 @@ discard block |
||
323 | 323 | if ($media == 'images') { |
324 | 324 | $code_path = api_get_path( |
325 | 325 | SYS_CODE_PATH |
326 | - ) . 'default_course_document/images/'; |
|
326 | + ).'default_course_document/images/'; |
|
327 | 327 | } |
328 | 328 | if ($media == 'audio') { |
329 | 329 | $code_path = api_get_path( |
330 | 330 | SYS_CODE_PATH |
331 | - ) . 'default_course_document/audio/'; |
|
331 | + ).'default_course_document/audio/'; |
|
332 | 332 | } |
333 | 333 | if ($media == 'flash') { |
334 | 334 | $code_path = api_get_path( |
335 | 335 | SYS_CODE_PATH |
336 | - ) . 'default_course_document/flash/'; |
|
336 | + ).'default_course_document/flash/'; |
|
337 | 337 | } |
338 | 338 | if ($media == 'video') { |
339 | 339 | $code_path = api_get_path( |
340 | 340 | SYS_CODE_PATH |
341 | - ) . 'default_course_document/video/'; |
|
341 | + ).'default_course_document/video/'; |
|
342 | 342 | } |
343 | 343 | if ($media == 'certificates') { |
344 | 344 | $code_path = api_get_path( |
345 | 345 | SYS_CODE_PATH |
346 | - ) . 'default_course_document/certificates/'; |
|
346 | + ).'default_course_document/certificates/'; |
|
347 | 347 | } |
348 | 348 | if (is_dir($path)) { |
349 | 349 | $handle = opendir($path); |
350 | 350 | while (false !== ($file = readdir($handle))) { |
351 | - if (is_dir($path . $file) && strpos($file, '.') !== 0) { |
|
351 | + if (is_dir($path.$file) && strpos($file, '.') !== 0) { |
|
352 | 352 | $files[]['dir'] = str_replace( |
353 | 353 | $code_path, |
354 | 354 | '', |
355 | - $path . $file . '/' |
|
355 | + $path.$file.'/' |
|
356 | 356 | ); |
357 | 357 | $files = self::browse_folders( |
358 | - $path . $file . '/', |
|
358 | + $path.$file.'/', |
|
359 | 359 | $files, |
360 | 360 | $media |
361 | 361 | ); |
362 | - } elseif (is_file($path . $file) && strpos($file, '.') !== 0) { |
|
362 | + } elseif (is_file($path.$file) && strpos($file, '.') !== 0) { |
|
363 | 363 | $files[]['file'] = str_replace( |
364 | 364 | $code_path, |
365 | 365 | '', |
366 | - $path . $file |
|
366 | + $path.$file |
|
367 | 367 | ); |
368 | 368 | } |
369 | 369 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | |
552 | 552 | Database::query( |
553 | 553 | "INSERT INTO $TABLEGROUPCATEGORIES (c_id, id, title , description, max_student, self_reg_allowed, self_unreg_allowed, groups_per_user, display_order) |
554 | - VALUES ($course_id, '2', '" . self::lang2db(get_lang('DefaultGroupCategory')) . "', '', '8', '0', '0', '0', '0');" |
|
554 | + VALUES ($course_id, '2', '".self::lang2db(get_lang('DefaultGroupCategory'))."', '', '8', '0', '0', '0', '0');" |
|
555 | 555 | ); |
556 | 556 | |
557 | 557 | /* Example Material */ |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $perm = api_get_permissions_for_new_directories(); |
578 | 578 | $perm_file = api_get_permissions_for_new_files(); |
579 | 579 | |
580 | - $chat_path = $sys_course_path . $course_repository . '/document/chat_files'; |
|
580 | + $chat_path = $sys_course_path.$course_repository.'/document/chat_files'; |
|
581 | 581 | |
582 | 582 | if (!is_dir($chat_path)) { |
583 | 583 | @mkdir($chat_path, api_get_permissions_for_new_directories()); |
@@ -609,11 +609,11 @@ discard block |
||
609 | 609 | 'certificates', |
610 | 610 | ); |
611 | 611 | |
612 | - $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document/'; |
|
612 | + $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document/'; |
|
613 | 613 | |
614 | 614 | $default_document_array = array(); |
615 | 615 | foreach ($folders_to_copy_from_default_course as $folder) { |
616 | - $default_course_folder_path = $default_course_path . $folder . '/'; |
|
616 | + $default_course_folder_path = $default_course_path.$folder.'/'; |
|
617 | 617 | $files = self::browse_folders( |
618 | 618 | $default_course_folder_path, |
619 | 619 | array(), |
@@ -642,30 +642,30 @@ discard block |
||
642 | 642 | //hack until feature #5242 is implemented |
643 | 643 | if ($media_type == 'images') { |
644 | 644 | $media_type = 'images/gallery'; |
645 | - $images_folder = $sys_course_path . $course_repository . "/document/images/"; |
|
645 | + $images_folder = $sys_course_path.$course_repository."/document/images/"; |
|
646 | 646 | |
647 | 647 | if (!is_dir($images_folder)) { |
648 | 648 | //Creating index.html |
649 | 649 | mkdir($images_folder, $perm); |
650 | - $fd = fopen($images_folder . 'index.html', 'w'); |
|
650 | + $fd = fopen($images_folder.'index.html', 'w'); |
|
651 | 651 | fwrite($fd, $htmlpage); |
652 | - @chmod($images_folder . 'index.html', $perm_file); |
|
652 | + @chmod($images_folder.'index.html', $perm_file); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | |
656 | - $course_documents_folder = $sys_course_path . $course_repository . "/document/$media_type/"; |
|
657 | - $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document' . $path_documents; |
|
656 | + $course_documents_folder = $sys_course_path.$course_repository."/document/$media_type/"; |
|
657 | + $default_course_path = api_get_path(SYS_CODE_PATH).'default_course_document'.$path_documents; |
|
658 | 658 | |
659 | 659 | if (!is_dir($course_documents_folder)) { |
660 | 660 | // Creating index.html |
661 | 661 | mkdir($course_documents_folder, $perm); |
662 | 662 | $fd = fopen( |
663 | - $course_documents_folder . 'index.html', |
|
663 | + $course_documents_folder.'index.html', |
|
664 | 664 | 'w' |
665 | 665 | ); |
666 | 666 | fwrite($fd, $htmlpage); |
667 | 667 | @chmod( |
668 | - $course_documents_folder . 'index.html', |
|
668 | + $course_documents_folder.'index.html', |
|
669 | 669 | $perm_file |
670 | 670 | ); |
671 | 671 | } |
@@ -673,15 +673,15 @@ discard block |
||
673 | 673 | if (is_array($array_media) && count($array_media) > 0) { |
674 | 674 | foreach ($array_media as $key => $value) { |
675 | 675 | if (isset($value['dir']) && !empty($value['dir'])) { |
676 | - if (!is_dir($course_documents_folder . $value['dir'])) { |
|
676 | + if (!is_dir($course_documents_folder.$value['dir'])) { |
|
677 | 677 | //Creating folder |
678 | 678 | mkdir( |
679 | - $course_documents_folder . $value['dir'], |
|
679 | + $course_documents_folder.$value['dir'], |
|
680 | 680 | $perm |
681 | 681 | ); |
682 | 682 | |
683 | 683 | //Creating index.html (for light protection) |
684 | - $index_html = $course_documents_folder . $value['dir'] . '/index.html'; |
|
684 | + $index_html = $course_documents_folder.$value['dir'].'/index.html'; |
|
685 | 685 | $fd = fopen($index_html, 'w'); |
686 | 686 | fwrite($fd, $htmlpage); |
687 | 687 | @chmod($index_html, $perm_file); |
@@ -703,12 +703,12 @@ discard block |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | if ($media_type == 'images/gallery') { |
706 | - $folder_path = 'gallery/' . $folder_path; |
|
706 | + $folder_path = 'gallery/'.$folder_path; |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | Database::query( |
710 | 710 | "INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size) |
711 | - VALUES ($course_id,'$path_documents" . $folder_path . "','" . $title . "','folder','0')" |
|
711 | + VALUES ($course_id,'$path_documents".$folder_path."','".$title."','folder','0')" |
|
712 | 712 | ); |
713 | 713 | $image_id = Database:: insert_id(); |
714 | 714 | |
@@ -721,33 +721,33 @@ discard block |
||
721 | 721 | |
722 | 722 | if (isset($value['file']) && !empty($value['file'])) { |
723 | 723 | if (!file_exists( |
724 | - $course_documents_folder . $value['file'] |
|
724 | + $course_documents_folder.$value['file'] |
|
725 | 725 | ) |
726 | 726 | ) { |
727 | 727 | //Copying file |
728 | 728 | copy( |
729 | - $default_course_path . $value['file'], |
|
730 | - $course_documents_folder . $value['file'] |
|
729 | + $default_course_path.$value['file'], |
|
730 | + $course_documents_folder.$value['file'] |
|
731 | 731 | ); |
732 | 732 | chmod( |
733 | - $course_documents_folder . $value['file'], |
|
733 | + $course_documents_folder.$value['file'], |
|
734 | 734 | $perm_file |
735 | 735 | ); |
736 | 736 | //echo $default_course_path.$value['file']; echo ' - '; echo $course_documents_folder.$value['file']; echo '<br />'; |
737 | 737 | $temp = explode('/', $value['file']); |
738 | 738 | $file_size = filesize( |
739 | - $course_documents_folder . $value['file'] |
|
739 | + $course_documents_folder.$value['file'] |
|
740 | 740 | ); |
741 | 741 | |
742 | 742 | //hack until feature #5242 is implemented |
743 | 743 | if ($media_type == 'images/gallery') { |
744 | - $value["file"] = 'gallery/' . $value["file"]; |
|
744 | + $value["file"] = 'gallery/'.$value["file"]; |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | //Inserting file in the DB |
748 | 748 | Database::query( |
749 | 749 | "INSERT INTO $TABLETOOLDOCUMENT (c_id, path,title,filetype,size) |
750 | - VALUES ($course_id,'$path_documents" . $value["file"] . "','" . $temp[count($temp) - 1] . "','file','$file_size')" |
|
750 | + VALUES ($course_id,'$path_documents".$value["file"]."','".$temp[count($temp) - 1]."','file','$file_size')" |
|
751 | 751 | ); |
752 | 752 | $image_id = Database:: insert_id(); |
753 | 753 | if ($image_id) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | $sql = "UPDATE $TABLETOOLDOCUMENT SET id = iid WHERE iid = $image_id"; |
756 | 756 | Database::query($sql); |
757 | 757 | |
758 | - if ($path_documents . $value['file'] == '/certificates/default.html') { |
|
758 | + if ($path_documents.$value['file'] == '/certificates/default.html') { |
|
759 | 759 | $example_cert_id = $image_id; |
760 | 760 | } |
761 | 761 | Database::query( |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | 'c_id' => $course_id, |
796 | 796 | 'url' => 'http://www.google.com', |
797 | 797 | 'title' => 'Google', |
798 | - 'description' => get_lang('Google') , |
|
798 | + 'description' => get_lang('Google'), |
|
799 | 799 | 'category_id' => 0, |
800 | 800 | 'on_homepage' => 0, |
801 | 801 | 'target' => '_self', |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | 'c_id' => $course_id, |
806 | 806 | 'url' => 'http://www.wikipedia.org', |
807 | 807 | 'title' => 'Wikipedia', |
808 | - 'description' => get_lang('Wikipedia') , |
|
808 | + 'description' => get_lang('Wikipedia'), |
|
809 | 809 | 'category_id' => 0, |
810 | 810 | 'on_homepage' => 0, |
811 | 811 | 'target' => '_self', |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | ] |
814 | 814 | ]; |
815 | 815 | |
816 | - foreach($links as $params) { |
|
816 | + foreach ($links as $params) { |
|
817 | 817 | $link->save($params); |
818 | 818 | } |
819 | 819 | |
@@ -832,8 +832,8 @@ discard block |
||
832 | 832 | /* Introduction text */ |
833 | 833 | |
834 | 834 | $intro_text = '<p style="text-align: center;"> |
835 | - <img src="' . api_get_path(REL_CODE_PATH) . 'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" /> |
|
836 | - <h2>' . self::lang2db(get_lang('IntroductionText')) . '</h2> |
|
835 | + <img src="' . api_get_path(REL_CODE_PATH).'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" /> |
|
836 | + <h2>' . self::lang2db(get_lang('IntroductionText')).'</h2> |
|
837 | 837 | </p>'; |
838 | 838 | |
839 | 839 | $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro(); |
@@ -869,9 +869,9 @@ discard block |
||
869 | 869 | $html = '<table width="100%" border="0" cellpadding="0" cellspacing="0"> |
870 | 870 | <tr> |
871 | 871 | <td width="110" valign="top" align="left"> |
872 | - <img src="' . api_get_path(WEB_CODE_PATH) . 'default_course_document/images/mr_dokeos/thinking.jpg"> |
|
872 | + <img src="' . api_get_path(WEB_CODE_PATH).'default_course_document/images/mr_dokeos/thinking.jpg"> |
|
873 | 873 | </td> |
874 | - <td valign="top" align="left">' . get_lang('Antique') . '</td></tr> |
|
874 | + <td valign="top" align="left">' . get_lang('Antique').'</td></tr> |
|
875 | 875 | </table>'; |
876 | 876 | $exercise->type = 1; |
877 | 877 | $exercise->setRandom(0); |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | 'https://' |
1151 | 1151 | ) === false |
1152 | 1152 | ) { |
1153 | - $department_url = 'http://' . $department_url; |
|
1153 | + $department_url = 'http://'.$department_url; |
|
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | //just in case |
@@ -1204,12 +1204,12 @@ discard block |
||
1204 | 1204 | ); |
1205 | 1205 | |
1206 | 1206 | if (!empty($user_id)) { |
1207 | - $sql = "INSERT INTO " . $TABLECOURSUSER . " SET |
|
1208 | - c_id = '" . $course_id . "', |
|
1209 | - user_id = '" . intval($user_id) . "', |
|
1207 | + $sql = "INSERT INTO ".$TABLECOURSUSER." SET |
|
1208 | + c_id = '" . $course_id."', |
|
1209 | + user_id = '" . intval($user_id)."', |
|
1210 | 1210 | status = '1', |
1211 | 1211 | is_tutor = '0', |
1212 | - sort = '" . ($i_course_sort) . "', |
|
1212 | + sort = '" . ($i_course_sort)."', |
|
1213 | 1213 | relation_type = 0, |
1214 | 1214 | user_course_cat = '0'"; |
1215 | 1215 | Database::query($sql); |
@@ -1229,12 +1229,12 @@ discard block |
||
1229 | 1229 | if (empty($key)) { |
1230 | 1230 | continue; |
1231 | 1231 | } |
1232 | - $sql = "INSERT INTO " . $TABLECOURSUSER . " SET |
|
1233 | - c_id = '" . Database::escape_string($course_id) . "', |
|
1234 | - user_id = '" . Database::escape_string($key) . "', |
|
1232 | + $sql = "INSERT INTO ".$TABLECOURSUSER." SET |
|
1233 | + c_id = '" . Database::escape_string($course_id)."', |
|
1234 | + user_id = '" . Database::escape_string($key)."', |
|
1235 | 1235 | status = '1', |
1236 | 1236 | is_tutor = '0', |
1237 | - sort = '" . ($sort + 1) . "', |
|
1237 | + sort = '" . ($sort + 1)."', |
|
1238 | 1238 | relation_type = 0, |
1239 | 1239 | user_course_cat = '0'"; |
1240 | 1240 | Database::query($sql); |
@@ -1277,13 +1277,13 @@ discard block |
||
1277 | 1277 | api_get_setting('admin.administrator_surname') |
1278 | 1278 | ); |
1279 | 1279 | $iname = api_get_setting('platform.institution'); |
1280 | - $subject = get_lang('NewCourseCreatedIn') . ' ' . $siteName . ' - ' . $iname; |
|
1281 | - $message = get_lang('Dear') . ' ' . $recipient_name . ",\n\n" . |
|
1282 | - get_lang('MessageOfNewCourseToAdmin') . ' ' . $siteName . ' - ' . $iname . "\n"; |
|
1283 | - $message .= get_lang('CourseName') . ' ' . $title . "\n"; |
|
1284 | - $message .= get_lang('Category') . ' ' . $category_code . "\n"; |
|
1285 | - $message .= get_lang('Tutor') . ' ' . $tutor_name . "\n"; |
|
1286 | - $message .= get_lang('Language') . ' ' . $course_language; |
|
1280 | + $subject = get_lang('NewCourseCreatedIn').' '.$siteName.' - '.$iname; |
|
1281 | + $message = get_lang('Dear').' '.$recipient_name.",\n\n". |
|
1282 | + get_lang('MessageOfNewCourseToAdmin').' '.$siteName.' - '.$iname."\n"; |
|
1283 | + $message .= get_lang('CourseName').' '.$title."\n"; |
|
1284 | + $message .= get_lang('Category').' '.$category_code."\n"; |
|
1285 | + $message .= get_lang('Tutor').' '.$tutor_name."\n"; |
|
1286 | + $message .= get_lang('Language').' '.$course_language; |
|
1287 | 1287 | |
1288 | 1288 | $userInfo = api_get_user_info($user_id); |
1289 | 1289 |