@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | $tool_name = get_lang('Search'); |
| 21 | 21 | $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork')); |
| 22 | 22 | |
| 23 | -$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null; |
|
| 24 | -$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null; |
|
| 23 | +$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : null; |
|
| 24 | +$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0', '1', '2')) ? $_GET['search_type'] : null; |
|
| 25 | 25 | $extra_fields = UserManager::get_extra_filtrable_fields(); |
| 26 | 26 | $query_vars = array('q' => $query, 'search_type' => $query_search_type); |
| 27 | 27 | if (!empty($extra_fields)) { |
| 28 | 28 | foreach ($extra_fields as $extra_field) { |
| 29 | - $field_name = 'field_' . $extra_field['variable']; |
|
| 29 | + $field_name = 'field_'.$extra_field['variable']; |
|
| 30 | 30 | if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') { |
| 31 | 31 | $query_vars[$field_name] = $_GET[$field_name]; |
| 32 | 32 | } |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | $usergroup = new UserGroup(); |
| 47 | 47 | |
| 48 | 48 | // I'm searching something |
| 49 | -if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) ) { |
|
| 49 | +if ($query != '' || ($query_vars['search_type'] == '1' && count($query_vars) > 2)) { |
|
| 50 | 50 | $itemPerPage = 8; |
| 51 | 51 | |
| 52 | - if ($_GET['search_type']=='0' || $_GET['search_type']=='1') { |
|
| 52 | + if ($_GET['search_type'] == '0' || $_GET['search_type'] == '1') { |
|
| 53 | 53 | $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1; |
| 54 | 54 | $totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true); |
| 55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if ($_GET['search_type']=='0' || $_GET['search_type']=='2') { |
|
| 61 | + if ($_GET['search_type'] == '0' || $_GET['search_type'] == '2') { |
|
| 62 | 62 | $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1; |
| 63 | 63 | // Groups |
| 64 | 64 | $fromGroups = intval(($pageGroup - 1) * $itemPerPage); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | // Show send invitation icon if they are not friends yet |
| 86 | 86 | if ($relation_type != 3 && $relation_type != 4 && $user_info['user_id'] != api_get_user_id()) { |
| 87 | - $send_inv = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="' . $user_info['user_id'] . '"> |
|
| 87 | + $send_inv = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="'.$user_info['user_id'].'"> |
|
| 88 | 88 | <em class="fa fa-user"></em> '.get_lang('SendInvitation').'</a>'; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | </div> |
| 131 | 131 | <div class="user-info"> |
| 132 | 132 | <p>'.$user_info['complete_name'].'</p> |
| 133 | - <div class="items-user-status">' . $status_icon . $user_icon . '</div> |
|
| 133 | + <div class="items-user-status">' . $status_icon.$user_icon.'</div> |
|
| 134 | 134 | <div class="toolbar"> |
| 135 | 135 | '.$invitations.' |
| 136 | 136 | </div> |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $tags = null; |
| 188 | 188 | $group['picture'] = '<img class="img-responsive img-circle" src="'.$picture['file'].'" />'; |
| 189 | 189 | |
| 190 | - $members = Display::returnFontAwesomeIcon('user') . '( ' .$count_users_group . ' )'; |
|
| 190 | + $members = Display::returnFontAwesomeIcon('user').'( '.$count_users_group.' )'; |
|
| 191 | 191 | $item_1 = Display::tag('p', $url_open.$name.$url_close); |
| 192 | 192 | |
| 193 | 193 | $block_groups .= ' |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | </div> |
| 199 | 199 | <div class="user-info"> |
| 200 | 200 | '.$item_1.' |
| 201 | - <p>' . $members . '</p> |
|
| 202 | - <p>' . $group['description'] . '</p> |
|
| 203 | - <p>' . $tags . '</p> |
|
| 204 | - <p>' . $url_open.get_lang('SeeMore') . $url_close . '</p> |
|
| 201 | + <p>' . $members.'</p> |
|
| 202 | + <p>' . $group['description'].'</p> |
|
| 203 | + <p>' . $tags.'</p> |
|
| 204 | + <p>' . $url_open.get_lang('SeeMore').$url_close.'</p> |
|
| 205 | 205 | </div> |
| 206 | 206 | </div> |
| 207 | 207 | </div>'; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $tpl->assign('social_search', $block_search); |
| 242 | 242 | $tpl->assign('search_form', $searchForm); |
| 243 | 243 | |
| 244 | -$formModalTpl = new Template(); |
|
| 244 | +$formModalTpl = new Template(); |
|
| 245 | 245 | $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation')); |
| 246 | 246 | $formModals = $formModalTpl->fetch('default/social/form_modals.tpl'); |
| 247 | 247 | |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
| 16 | 16 | require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
| 17 | 17 | |
| 18 | -$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'. api_get_path(WEB_PATH) .'main/newscorm/lp_list_search.css" />'; |
|
| 18 | +$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_PATH).'main/newscorm/lp_list_search.css" />'; |
|
| 19 | 19 | Event::event_access_tool(TOOL_SEARCH); |
| 20 | 20 | |
| 21 | -if (isset($_SESSION['gradebook'])){ |
|
| 21 | +if (isset($_SESSION['gradebook'])) { |
|
| 22 | 22 | $gradebook = $_SESSION['gradebook']; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | if (!empty($gradebook) && $gradebook == 'view') { |
| 26 | - $interbreadcrumb[]= array ( |
|
| 26 | + $interbreadcrumb[] = array( |
|
| 27 | 27 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
| 28 | 28 | 'name' => get_lang('ToolGradebook') |
| 29 | 29 | ); |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | $term_array = array(); |
| 60 | 60 | $specific_fields = get_specific_field_list(); |
| 61 | 61 | foreach ($specific_fields as $specific_field) { |
| 62 | - if (!empty($_REQUEST[ 'sf_'. $specific_field['code'] ])) { |
|
| 63 | - $values = $_REQUEST[ 'sf_'. $specific_field['code'] ]; |
|
| 62 | + if (!empty($_REQUEST['sf_'.$specific_field['code']])) { |
|
| 63 | + $values = $_REQUEST['sf_'.$specific_field['code']]; |
|
| 64 | 64 | if (in_array('__all__', $values)) { |
| 65 | 65 | $sf_terms_for_code = xapian_get_all_terms(1000, $specific_field['code']); |
| 66 | 66 | foreach ($sf_terms_for_code as $term) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | foreach ($values as $term) { |
| 73 | 73 | if (!empty($term)) { |
| 74 | 74 | $prefix = $specific_field['code']; |
| 75 | - $term_array[] = chamilo_get_boolean_query($prefix . $term); |
|
| 75 | + $term_array[] = chamilo_get_boolean_query($prefix.$term); |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | // Get right group of terms to show on multiple select. |
| 91 | 91 | $fixed_queries = array(); |
| 92 | 92 | $course_filter = null; |
| 93 | -if ( ($cid=api_get_course_id()) != -1 ) { |
|
| 93 | +if (($cid = api_get_course_id()) != -1) { |
|
| 94 | 94 | // Results only from actual course. |
| 95 | - $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); |
|
| 95 | + $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if (count($term_array)) { |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if ($mode == 'gallery') { |
| 140 | - $title = $a_prefix.str_replace('_',' ',$result['title']). $a_sufix; |
|
| 140 | + $title = $a_prefix.str_replace('_', ' ', $result['title']).$a_sufix; |
|
| 141 | 141 | $blocks[] = array( |
| 142 | - $a_prefix .'<img src="'.$result['thumbnail'].'" />'. $a_sufix .'<br />'.$title.'<br />'.$result['author'], |
|
| 142 | + $a_prefix.'<img src="'.$result['thumbnail'].'" />'.$a_sufix.'<br />'.$title.'<br />'.$result['author'], |
|
| 143 | 143 | ); |
| 144 | 144 | } else { |
| 145 | - $title = '<div style="text-align:left;">'. $a_prefix . $result['title']. $a_sufix .(!empty($result['author']) ? ' '.$result['author'] : '').'<div>'; |
|
| 145 | + $title = '<div style="text-align:left;">'.$a_prefix.$result['title'].$a_sufix.(!empty($result['author']) ? ' '.$result['author'] : '').'<div>'; |
|
| 146 | 146 | $blocks[] = array($title); |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -154,19 +154,19 @@ discard block |
||
| 154 | 154 | $s->display_mode = $mode; // default |
| 155 | 155 | $s->display_mode_params = 3; |
| 156 | 156 | $s->per_page = 9; |
| 157 | - $additional_parameters = array ( |
|
| 157 | + $additional_parameters = array( |
|
| 158 | 158 | 'mode' => $mode, |
| 159 | 159 | 'action' => 'search', |
| 160 | 160 | 'query' => Security::remove_XSS($_REQUEST['query']), |
| 161 | 161 | ); |
| 162 | 162 | $get_params = ''; |
| 163 | 163 | foreach ($specific_fields as $specific_field) { |
| 164 | - if (isset($_REQUEST[ 'sf_'. $specific_field['code'] ])) { |
|
| 165 | - $values = $_REQUEST[ 'sf_'. $specific_field['code'] ]; |
|
| 164 | + if (isset($_REQUEST['sf_'.$specific_field['code']])) { |
|
| 165 | + $values = $_REQUEST['sf_'.$specific_field['code']]; |
|
| 166 | 166 | //Sortable additional_parameters doesn't accept multi dimensional arrays |
| 167 | 167 | //$additional_parameters[ 'sf_'. $specific_field['code'] ] = $values; |
| 168 | - foreach ( $values as $value ) { |
|
| 169 | - $get_params .= '&sf_' . $specific_field['code'] .'[]='. $value; |
|
| 168 | + foreach ($values as $value) { |
|
| 169 | + $get_params .= '&sf_'.$specific_field['code'].'[]='.$value; |
|
| 170 | 170 | } |
| 171 | 171 | $get_params .= '&'; |
| 172 | 172 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // Percentage progress as saved in the db. |
| 54 | 54 | public $progress_db = '0'; |
| 55 | 55 | public $proximity; // Wether the content is distant or local or unknown. |
| 56 | - public $refs_list = array (); //list of items by ref => db_id. Used only for prerequisites match. |
|
| 56 | + public $refs_list = array(); //list of items by ref => db_id. Used only for prerequisites match. |
|
| 57 | 57 | // !!!This array (refs_list) is built differently depending on the nature of the LP. |
| 58 | 58 | // If SCORM, uses ref, if Chamilo, uses id to keep a unique value. |
| 59 | 59 | public $type; //type of learnpath. Could be 'dokeos', 'scorm', 'scorm2004', 'aicc', ... |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if ($row['expired_on'] != '0000-00-00 00:00:00') { |
| 157 | - $this->expired_on = $row['expired_on']; |
|
| 157 | + $this->expired_on = $row['expired_on']; |
|
| 158 | 158 | } |
| 159 | 159 | if ($this->type == 2) { |
| 160 | 160 | if ($row['force_commit'] == 1) { |
@@ -198,12 +198,12 @@ discard block |
||
| 198 | 198 | ORDER BY view_count DESC"; |
| 199 | 199 | $res = Database::query($sql); |
| 200 | 200 | if ($this->debug > 2) { |
| 201 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - querying lp_view: ' . $sql, 0); |
|
| 201 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - querying lp_view: '.$sql, 0); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if (Database :: num_rows($res) > 0) { |
| 205 | 205 | if ($this->debug > 2) { |
| 206 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - Found previous view', 0); |
|
| 206 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - Found previous view', 0); |
|
| 207 | 207 | } |
| 208 | 208 | $row = Database :: fetch_array($res); |
| 209 | 209 | $this->attempt = $row['view_count']; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $this->lp_view_session_id = $row['session_id']; |
| 214 | 214 | } else if (!api_is_invitee()) { |
| 215 | 215 | if ($this->debug > 2) { |
| 216 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - NOT Found previous view', 0); |
|
| 216 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - NOT Found previous view', 0); |
|
| 217 | 217 | } |
| 218 | 218 | $this->attempt = 1; |
| 219 | 219 | $params = [ |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $this->lp_view_id = Database::insert_id(); |
| 229 | 229 | |
| 230 | 230 | if ($this->debug > 2) { |
| 231 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - inserting new lp_view: ' . $sql, 0); |
|
| 231 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - inserting new lp_view: '.$sql, 0); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $sql = "UPDATE $lp_table SET id = iid WHERE iid = ".$this->lp_view_id; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $res = Database::query($sql); |
| 245 | 245 | |
| 246 | 246 | if ($this->debug > 2) { |
| 247 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - query lp items: ' . $sql, 0); |
|
| 247 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - query lp items: '.$sql, 0); |
|
| 248 | 248 | error_log('-- Start while--', 0); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | $this->refs_list[$oItem->ref] = $my_item_id; |
| 265 | 265 | if ($this->debug > 2) { |
| 266 | 266 | error_log( |
| 267 | - 'New LP - learnpath::__construct() - ' . |
|
| 268 | - 'aicc object with id ' . $my_item_id . |
|
| 267 | + 'New LP - learnpath::__construct() - '. |
|
| 268 | + 'aicc object with id '.$my_item_id. |
|
| 269 | 269 | ' set in items[]', |
| 270 | 270 | 0 |
| 271 | 271 | ); |
@@ -284,19 +284,19 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $this->refs_list[$oItem->ref] = $my_item_id; |
| 286 | 286 | if ($this->debug > 2) { |
| 287 | - error_log('New LP - object with id ' . $my_item_id . ' set in items[]', 0); |
|
| 287 | + error_log('New LP - object with id '.$my_item_id.' set in items[]', 0); |
|
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | break; |
| 291 | 291 | case 1: |
| 292 | 292 | default: |
| 293 | 293 | if ($this->debug > 2) { |
| 294 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - calling learnpathItem', 0); |
|
| 294 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - calling learnpathItem', 0); |
|
| 295 | 295 | } |
| 296 | 296 | $oItem = new learnpathItem($row['id'], $user_id, $course_id, $row); |
| 297 | 297 | |
| 298 | 298 | if ($this->debug > 2) { |
| 299 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - end calling learnpathItem', 0); |
|
| 299 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - end calling learnpathItem', 0); |
|
| 300 | 300 | } |
| 301 | 301 | if (is_object($oItem)) { |
| 302 | 302 | $my_item_id = $oItem->get_id(); |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | $this->refs_list[$my_item_id] = $my_item_id; |
| 308 | 308 | if ($this->debug > 2) { |
| 309 | 309 | error_log( |
| 310 | - 'New LP - learnpath::__construct() ' . __LINE__ . |
|
| 311 | - ' - object with id ' . $my_item_id . ' set in items[]', |
|
| 310 | + 'New LP - learnpath::__construct() '.__LINE__. |
|
| 311 | + ' - object with id '.$my_item_id.' set in items[]', |
|
| 312 | 312 | 0); |
| 313 | 313 | } |
| 314 | 314 | } |
@@ -326,13 +326,13 @@ discard block |
||
| 326 | 326 | $this->items[$row['id']]->set_lp_view($this->lp_view_id, $course_id); |
| 327 | 327 | if ($this->items[$row['id']]->get_type() == TOOL_HOTPOTATOES) { |
| 328 | 328 | $this->items[$row['id']]->current_start_time = 0; |
| 329 | - $this->items[$row['id']]->current_stop_time = 0; |
|
| 329 | + $this->items[$row['id']]->current_stop_time = 0; |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | if ($this->debug > 2) { |
| 335 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' ----- end while ----', 0); |
|
| 335 | + error_log('New LP - learnpath::__construct() '.__LINE__.' ----- end while ----', 0); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | if (!empty($lp_item_id_list)) { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | // TODO: Define the current item better. |
| 425 | 425 | $this->first(); |
| 426 | 426 | if ($this->debug > 2) { |
| 427 | - error_log('New LP - learnpath::__construct() ' . __LINE__ . ' - End of learnpath constructor for learnpath ' . $this->get_id(), 0); |
|
| 427 | + error_log('New LP - learnpath::__construct() '.__LINE__.' - End of learnpath constructor for learnpath '.$this->get_id(), 0); |
|
| 428 | 428 | } |
| 429 | 429 | return true; |
| 430 | 430 | } |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | ) { |
| 499 | 499 | $course_id = $this->course_info['real_id']; |
| 500 | 500 | if ($this->debug > 0) { |
| 501 | - error_log('New LP - In learnpath::add_item(' . $parent . ',' . $previous . ',' . $type . ',' . $id . ',' . $title . ')', 0); |
|
| 501 | + error_log('New LP - In learnpath::add_item('.$parent.','.$previous.','.$type.','.$id.','.$title.')', 0); |
|
| 502 | 502 | } |
| 503 | 503 | if (empty($course_id)) { |
| 504 | 504 | // Sometimes Oogie doesn't catch the course info but sets $this->cc |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | FROM $tbl_lp_item |
| 519 | 519 | WHERE |
| 520 | 520 | c_id = $course_id AND |
| 521 | - lp_id = " . $this->get_id() . " AND |
|
| 521 | + lp_id = ".$this->get_id()." AND |
|
| 522 | 522 | parent_item_id = " . $parent; |
| 523 | 523 | |
| 524 | 524 | $res_count = Database::query($sql); |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | if ($num > 0) { |
| 529 | 529 | if ($previous == 0) { |
| 530 | 530 | $sql = "SELECT id, next_item_id, display_order |
| 531 | - FROM " . $tbl_lp_item . " |
|
| 531 | + FROM " . $tbl_lp_item." |
|
| 532 | 532 | WHERE |
| 533 | 533 | c_id = $course_id AND |
| 534 | - lp_id = " . $this->get_id() . " AND |
|
| 535 | - parent_item_id = " . $parent . " AND |
|
| 534 | + lp_id = ".$this->get_id()." AND |
|
| 535 | + parent_item_id = " . $parent." AND |
|
| 536 | 536 | previous_item_id = 0 OR |
| 537 | 537 | previous_item_id=" . $parent; |
| 538 | 538 | $result = Database::query($sql); |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | FROM $tbl_lp_item |
| 548 | 548 | WHERE |
| 549 | 549 | c_id = $course_id AND |
| 550 | - lp_id = " . $this->get_id() . " AND |
|
| 550 | + lp_id = ".$this->get_id()." AND |
|
| 551 | 551 | id = " . $previous; |
| 552 | 552 | |
| 553 | 553 | $result = Database::query($sql); |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | $typeCleaned = Database::escape_string($type); |
| 568 | 568 | if ($type == 'quiz') { |
| 569 | 569 | $sql = 'SELECT SUM(ponderation) |
| 570 | - FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question |
|
| 571 | - INNER JOIN ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question |
|
| 570 | + FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION).' as quiz_question |
|
| 571 | + INNER JOIN ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION).' as quiz_rel_question |
|
| 572 | 572 | ON |
| 573 | 573 | quiz_question.id = quiz_rel_question.question_id AND |
| 574 | 574 | quiz_question.c_id = quiz_rel_question.c_id |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | $new_item_id = Database::insert($tbl_lp_item, $params); |
| 615 | 615 | |
| 616 | 616 | if ($this->debug > 2) { |
| 617 | - error_log('New LP - Inserting chapter: ' . $new_item_id, 0); |
|
| 617 | + error_log('New LP - Inserting chapter: '.$new_item_id, 0); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | if ($new_item_id) { |
@@ -631,28 +631,28 @@ discard block |
||
| 631 | 631 | Database::query($sql); |
| 632 | 632 | |
| 633 | 633 | // Update all the items after the new item. |
| 634 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 634 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 635 | 635 | SET display_order = display_order + 1 |
| 636 | 636 | WHERE |
| 637 | 637 | c_id = $course_id AND |
| 638 | - lp_id = " . $this->get_id() . " AND |
|
| 639 | - id <> " . $new_item_id . " AND |
|
| 640 | - parent_item_id = " . $parent . " AND |
|
| 638 | + lp_id = ".$this->get_id()." AND |
|
| 639 | + id <> " . $new_item_id." AND |
|
| 640 | + parent_item_id = " . $parent." AND |
|
| 641 | 641 | display_order > " . $display_order; |
| 642 | 642 | Database::query($sql); |
| 643 | 643 | |
| 644 | 644 | // Update the item that should come after the new item. |
| 645 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 646 | - SET ref = " . $new_item_id . " |
|
| 647 | - WHERE c_id = $course_id AND id = " . $new_item_id; |
|
| 645 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 646 | + SET ref = " . $new_item_id." |
|
| 647 | + WHERE c_id = $course_id AND id = ".$new_item_id; |
|
| 648 | 648 | Database::query($sql); |
| 649 | 649 | |
| 650 | 650 | // Upload audio. |
| 651 | 651 | if (!empty($_FILES['mp3']['name'])) { |
| 652 | 652 | // Create the audio folder if it does not exist yet. |
| 653 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
| 654 | - if (!is_dir($filepath . 'audio')) { |
|
| 655 | - mkdir($filepath . 'audio', api_get_permissions_for_new_directories()); |
|
| 653 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 654 | + if (!is_dir($filepath.'audio')) { |
|
| 655 | + mkdir($filepath.'audio', api_get_permissions_for_new_directories()); |
|
| 656 | 656 | $audio_id = add_document( |
| 657 | 657 | $_course, |
| 658 | 658 | '/audio', |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | $file_path = handle_uploaded_document( |
| 690 | 690 | $_course, |
| 691 | 691 | $_FILES['mp3'], |
| 692 | - api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document', |
|
| 692 | + api_get_path(SYS_COURSE_PATH).$_course['path'].'/document', |
|
| 693 | 693 | '/audio', |
| 694 | 694 | api_get_user_id(), |
| 695 | 695 | '', |
@@ -705,8 +705,8 @@ discard block |
||
| 705 | 705 | |
| 706 | 706 | // Store the mp3 file in the lp_item table. |
| 707 | 707 | $sql = "UPDATE $tbl_lp_item SET |
| 708 | - audio = '" . Database::escape_string($file) . "' |
|
| 709 | - WHERE id = '" . intval($new_item_id) . "'"; |
|
| 708 | + audio = '".Database::escape_string($file)."' |
|
| 709 | + WHERE id = '" . intval($new_item_id)."'"; |
|
| 710 | 710 | Database::query($sql); |
| 711 | 711 | } |
| 712 | 712 | } |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | while (Database :: num_rows($res_name)) { |
| 783 | 783 | // There is already one such name, update the current one a bit. |
| 784 | 784 | $i++; |
| 785 | - $name = $name . ' - ' . $i; |
|
| 785 | + $name = $name.' - '.$i; |
|
| 786 | 786 | $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '$name'"; |
| 787 | 787 | $res_name = Database::query($check_name); |
| 788 | 788 | } |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | // if $item points to an object and there is a parent. |
| 895 | 895 | if ($debug) { |
| 896 | 896 | error_log( |
| 897 | - 'Autocompleting parent of item ' . $item . ' "'.$currentItem->get_title().'" (item ' . $parent_id . ' "'.$parent->get_title().'") ', |
|
| 897 | + 'Autocompleting parent of item '.$item.' "'.$currentItem->get_title().'" (item '.$parent_id.' "'.$parent->get_title().'") ', |
|
| 898 | 898 | 0 |
| 899 | 899 | ); |
| 900 | 900 | } |
@@ -922,7 +922,7 @@ discard block |
||
| 922 | 922 | if ($childItemId != $item) { |
| 923 | 923 | if ($debug) { |
| 924 | 924 | error_log( |
| 925 | - 'Looking at brother #'.$childItemId . ' "' . $childItem->get_title() . '", status is ' . $childItem->get_status(), |
|
| 925 | + 'Looking at brother #'.$childItemId.' "'.$childItem->get_title().'", status is '.$childItem->get_status(), |
|
| 926 | 926 | 0 |
| 927 | 927 | ); |
| 928 | 928 | } |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | } else { |
| 943 | 943 | if ($debug > 2) { |
| 944 | 944 | error_log( |
| 945 | - 'Found one incomplete child of parent #' . $parent_id . ': child #'.$childItemId . ' "' . $childItem->get_title() . '", is ' . $childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id, |
|
| 945 | + 'Found one incomplete child of parent #'.$parent_id.': child #'.$childItemId.' "'.$childItem->get_title().'", is '.$childItem->get_status().' db_item_view_id:#'.$childItem->db_item_view_id, |
|
| 946 | 946 | 0 |
| 947 | 947 | ); |
| 948 | 948 | } |
@@ -1047,15 +1047,15 @@ discard block |
||
| 1047 | 1047 | // Delete lp item id. |
| 1048 | 1048 | foreach ($this->items as $id => $dummy) { |
| 1049 | 1049 | $sql = "DELETE FROM $lp_item_view |
| 1050 | - WHERE c_id = $course_id AND lp_item_id = '" . $id . "'"; |
|
| 1050 | + WHERE c_id = $course_id AND lp_item_id = '".$id."'"; |
|
| 1051 | 1051 | Database::query($sql); |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | // Proposed by Christophe (nickname: clefevre) |
| 1055 | - $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 1055 | + $sql = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 1056 | 1056 | Database::query($sql); |
| 1057 | 1057 | |
| 1058 | - $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 1058 | + $sql = "DELETE FROM $lp_view WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 1059 | 1059 | Database::query($sql); |
| 1060 | 1060 | |
| 1061 | 1061 | self::toggle_publish($this->lp_id, 'i'); |
@@ -1063,32 +1063,32 @@ discard block |
||
| 1063 | 1063 | if ($this->type == 2 || $this->type == 3) { |
| 1064 | 1064 | // This is a scorm learning path, delete the files as well. |
| 1065 | 1065 | $sql = "SELECT path FROM $lp |
| 1066 | - WHERE c_id = ".$course_id." AND id = " . $this->lp_id; |
|
| 1066 | + WHERE c_id = ".$course_id." AND id = ".$this->lp_id; |
|
| 1067 | 1067 | $res = Database::query($sql); |
| 1068 | 1068 | if (Database :: num_rows($res) > 0) { |
| 1069 | 1069 | $row = Database :: fetch_array($res); |
| 1070 | 1070 | $path = $row['path']; |
| 1071 | 1071 | $sql = "SELECT id FROM $lp |
| 1072 | - WHERE c_id = ".$course_id." AND path = '$path' AND id != " . $this->lp_id; |
|
| 1072 | + WHERE c_id = ".$course_id." AND path = '$path' AND id != ".$this->lp_id; |
|
| 1073 | 1073 | $res = Database::query($sql); |
| 1074 | 1074 | if (Database :: num_rows($res) > 0) { // Another learning path uses this directory, so don't delete it. |
| 1075 | 1075 | if ($this->debug > 2) { |
| 1076 | - error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0); |
|
| 1076 | + error_log('New LP - In learnpath::delete(), found other LP using path '.$path.', keeping directory', 0); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | } else { |
| 1079 | 1079 | // No other LP uses that directory, delete it. |
| 1080 | - $course_rel_dir = api_get_course_path() . '/scorm/'; // scorm dir web path starting from /courses |
|
| 1081 | - $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir; // The absolute system path for this course. |
|
| 1082 | - if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty ($course_scorm_dir)) { |
|
| 1080 | + $course_rel_dir = api_get_course_path().'/scorm/'; // scorm dir web path starting from /courses |
|
| 1081 | + $course_scorm_dir = api_get_path(SYS_COURSE_PATH).$course_rel_dir; // The absolute system path for this course. |
|
| 1082 | + if ($delete == 'remove' && is_dir($course_scorm_dir.$path) and !empty ($course_scorm_dir)) { |
|
| 1083 | 1083 | if ($this->debug > 2) { |
| 1084 | - error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0); |
|
| 1084 | + error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: '.$course_scorm_dir.$path, 0); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | // Proposed by Christophe (clefevre). |
| 1087 | 1087 | if (strcmp(substr($path, -2), "/.") == 0) { |
| 1088 | 1088 | $path = substr($path, 0, -1); // Remove "." at the end. |
| 1089 | 1089 | } |
| 1090 | 1090 | //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way. |
| 1091 | - rmdirr($course_scorm_dir . $path); |
|
| 1091 | + rmdirr($course_scorm_dir.$path); |
|
| 1092 | 1092 | } |
| 1093 | 1093 | } |
| 1094 | 1094 | } |
@@ -1101,7 +1101,7 @@ discard block |
||
| 1101 | 1101 | WHERE c_id = ".$course_id." AND (link LIKE '$link%' AND image='scormbuilder.gif')"; |
| 1102 | 1102 | Database::query($sql); |
| 1103 | 1103 | |
| 1104 | - $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = " . $this->lp_id; |
|
| 1104 | + $sql = "DELETE FROM $lp WHERE c_id = ".$course_id." AND id = ".$this->lp_id; |
|
| 1105 | 1105 | Database::query($sql); |
| 1106 | 1106 | // Updates the display order of all lps. |
| 1107 | 1107 | $this->update_display_order(); |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | api_get_user_id() |
| 1115 | 1115 | ); |
| 1116 | 1116 | |
| 1117 | - $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4 , $id, api_get_session_id()); |
|
| 1117 | + $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id()); |
|
| 1118 | 1118 | if ($link_info !== false) { |
| 1119 | 1119 | GradebookUtils::remove_resource_from_course_gradebook($link_info['id']); |
| 1120 | 1120 | } |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | { |
| 1135 | 1135 | $course_id = $this->course_info['real_id']; |
| 1136 | 1136 | if ($this->debug > 0) { |
| 1137 | - error_log('New LP - In learnpath::delete_children_items(' . $id . ')', 0); |
|
| 1137 | + error_log('New LP - In learnpath::delete_children_items('.$id.')', 0); |
|
| 1138 | 1138 | } |
| 1139 | 1139 | $num = 0; |
| 1140 | 1140 | if (empty ($id) || $id != strval(intval($id))) { |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | $res = Database::query($sql); |
| 1146 | 1146 | while ($row = Database :: fetch_array($res)) { |
| 1147 | 1147 | $num += $this->delete_children_items($row['id']); |
| 1148 | - $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
| 1148 | + $sql_del = "DELETE FROM $lp_item WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
| 1149 | 1149 | Database::query($sql_del); |
| 1150 | 1150 | $num++; |
| 1151 | 1151 | } |
@@ -1186,12 +1186,12 @@ discard block |
||
| 1186 | 1186 | // Delete children items. |
| 1187 | 1187 | $num = $this->delete_children_items($id); |
| 1188 | 1188 | if ($this->debug > 2) { |
| 1189 | - error_log('New LP - learnpath::delete_item() - deleted ' . $num . ' children of element ' . $id, 0); |
|
| 1189 | + error_log('New LP - learnpath::delete_item() - deleted '.$num.' children of element '.$id, 0); |
|
| 1190 | 1190 | } |
| 1191 | 1191 | // Now delete the item. |
| 1192 | 1192 | $sql_del = "DELETE FROM $lp_item WHERE c_id = $course_id AND id = $id"; |
| 1193 | 1193 | if ($this->debug > 2) { |
| 1194 | - error_log('New LP - Deleting item: ' . $sql_del, 0); |
|
| 1194 | + error_log('New LP - Deleting item: '.$sql_del, 0); |
|
| 1195 | 1195 | } |
| 1196 | 1196 | Database::query($sql_del); |
| 1197 | 1197 | // Now update surrounding items. |
@@ -1266,15 +1266,15 @@ discard block |
||
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | 1268 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 1269 | - $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id; |
|
| 1269 | + $sql_select = "SELECT * FROM ".$tbl_lp_item." WHERE c_id = ".$course_id." AND id = ".$id; |
|
| 1270 | 1270 | $res_select = Database::query($sql_select); |
| 1271 | 1271 | $row_select = Database :: fetch_array($res_select); |
| 1272 | 1272 | $audio_update_sql = ''; |
| 1273 | 1273 | if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) { |
| 1274 | 1274 | // Create the audio folder if it does not exist yet. |
| 1275 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
| 1276 | - if (!is_dir($filepath . 'audio')) { |
|
| 1277 | - mkdir($filepath . 'audio', api_get_permissions_for_new_directories()); |
|
| 1275 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 1276 | + if (!is_dir($filepath.'audio')) { |
|
| 1277 | + mkdir($filepath.'audio', api_get_permissions_for_new_directories()); |
|
| 1278 | 1278 | $audio_id = add_document( |
| 1279 | 1279 | $_course, |
| 1280 | 1280 | '/audio', |
@@ -1312,11 +1312,11 @@ discard block |
||
| 1312 | 1312 | $pi = pathinfo($audio['name']); |
| 1313 | 1313 | if ($pi['extension'] == 'mp3') { |
| 1314 | 1314 | $c_det = api_get_course_info($this->cc); |
| 1315 | - $bp = api_get_path(SYS_COURSE_PATH) . $c_det['path'] . '/document'; |
|
| 1315 | + $bp = api_get_path(SYS_COURSE_PATH).$c_det['path'].'/document'; |
|
| 1316 | 1316 | $path = handle_uploaded_document($c_det, $audio, $bp, '/audio', api_get_user_id(), 0, null, 0, 'rename', false, 0); |
| 1317 | 1317 | $path = substr($path, 7); |
| 1318 | 1318 | // Update reference in lp_item - audio path is the path from inside de document/audio/ dir. |
| 1319 | - $audio_update_sql = ", audio = '" . Database::escape_string($path) . "' "; |
|
| 1319 | + $audio_update_sql = ", audio = '".Database::escape_string($path)."' "; |
|
| 1320 | 1320 | } |
| 1321 | 1321 | } |
| 1322 | 1322 | |
@@ -1326,13 +1326,13 @@ discard block |
||
| 1326 | 1326 | // TODO: htmlspecialchars to be checked for encoding related problems. |
| 1327 | 1327 | if ($same_parent && $same_previous) { |
| 1328 | 1328 | // Only update title and description. |
| 1329 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1330 | - SET title = '" . Database::escape_string($title) . "', |
|
| 1331 | - prerequisite = '" . $prerequisites . "', |
|
| 1332 | - description = '" . Database::escape_string($description) . "' |
|
| 1333 | - " . $audio_update_sql . ", |
|
| 1334 | - max_time_allowed = '" . Database::escape_string($max_time_allowed) . "' |
|
| 1335 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
| 1329 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1330 | + SET title = '" . Database::escape_string($title)."', |
|
| 1331 | + prerequisite = '" . $prerequisites."', |
|
| 1332 | + description = '" . Database::escape_string($description)."' |
|
| 1333 | + " . $audio_update_sql.", |
|
| 1334 | + max_time_allowed = '" . Database::escape_string($max_time_allowed)."' |
|
| 1335 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
| 1336 | 1336 | Database::query($sql); |
| 1337 | 1337 | } else { |
| 1338 | 1338 | $old_parent = $row_select['parent_item_id']; |
@@ -1347,27 +1347,27 @@ discard block |
||
| 1347 | 1347 | |
| 1348 | 1348 | if ($old_previous != 0) { |
| 1349 | 1349 | // Next |
| 1350 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1351 | - SET next_item_id = " . $old_next . " |
|
| 1352 | - WHERE c_id = ".$course_id." AND id = " . $old_previous; |
|
| 1350 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1351 | + SET next_item_id = " . $old_next." |
|
| 1352 | + WHERE c_id = ".$course_id." AND id = ".$old_previous; |
|
| 1353 | 1353 | Database::query($sql); |
| 1354 | 1354 | } |
| 1355 | 1355 | |
| 1356 | 1356 | if ($old_next != 0) { |
| 1357 | 1357 | // Previous |
| 1358 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1359 | - SET previous_item_id = " . $old_previous . " |
|
| 1360 | - WHERE c_id = ".$course_id." AND id = " . $old_next; |
|
| 1358 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1359 | + SET previous_item_id = " . $old_previous." |
|
| 1360 | + WHERE c_id = ".$course_id." AND id = ".$old_next; |
|
| 1361 | 1361 | Database::query($sql); |
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | // display_order - 1 for every item with a display_order bigger then the display_order of the current item. |
| 1365 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1365 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1366 | 1366 | SET display_order = display_order - 1 |
| 1367 | 1367 | WHERE |
| 1368 | 1368 | c_id = ".$course_id." AND |
| 1369 | - display_order > " . $old_order . " AND |
|
| 1370 | - lp_id = " . $this->lp_id . " AND |
|
| 1369 | + display_order > " . $old_order." AND |
|
| 1370 | + lp_id = " . $this->lp_id." AND |
|
| 1371 | 1371 | parent_item_id = " . $old_parent; |
| 1372 | 1372 | Database::query($sql); |
| 1373 | 1373 | /* END -- virtually remove the current item id */ |
@@ -1377,11 +1377,11 @@ discard block |
||
| 1377 | 1377 | if ($previous == 0) { |
| 1378 | 1378 | // Select the data of the item that should come after the current item. |
| 1379 | 1379 | $sql = "SELECT id, display_order |
| 1380 | - FROM " . $tbl_lp_item . " |
|
| 1380 | + FROM " . $tbl_lp_item." |
|
| 1381 | 1381 | WHERE |
| 1382 | 1382 | c_id = ".$course_id." AND |
| 1383 | - lp_id = " . $this->lp_id . " AND |
|
| 1384 | - parent_item_id = " . $parent . " AND |
|
| 1383 | + lp_id = " . $this->lp_id." AND |
|
| 1384 | + parent_item_id = " . $parent." AND |
|
| 1385 | 1385 | previous_item_id = " . $previous; |
| 1386 | 1386 | $res_select_old = Database::query($sql); |
| 1387 | 1387 | $row_select_old = Database::fetch_array($res_select_old); |
@@ -1397,8 +1397,8 @@ discard block |
||
| 1397 | 1397 | } else { |
| 1398 | 1398 | // Select the data of the item that should come before the current item. |
| 1399 | 1399 | $sql = "SELECT next_item_id, display_order |
| 1400 | - FROM " . $tbl_lp_item . " |
|
| 1401 | - WHERE c_id = ".$course_id." AND id = " . $previous; |
|
| 1400 | + FROM " . $tbl_lp_item." |
|
| 1401 | + WHERE c_id = ".$course_id." AND id = ".$previous; |
|
| 1402 | 1402 | $res_select_old = Database::query($sql); |
| 1403 | 1403 | $row_select_old = Database :: fetch_array($res_select_old); |
| 1404 | 1404 | $new_next = $row_select_old['next_item_id']; |
@@ -1407,57 +1407,57 @@ discard block |
||
| 1407 | 1407 | |
| 1408 | 1408 | // TODO: htmlspecialchars to be checked for encoding related problems. |
| 1409 | 1409 | // Update the current item with the new data. |
| 1410 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1410 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1411 | 1411 | SET |
| 1412 | - title = '" . Database::escape_string($title) . "', |
|
| 1413 | - description = '" . Database::escape_string($description) . "', |
|
| 1414 | - parent_item_id = " . $parent . ", |
|
| 1415 | - previous_item_id = " . $previous . ", |
|
| 1416 | - next_item_id = " . $new_next . ", |
|
| 1417 | - display_order = " . $new_order . " |
|
| 1418 | - " . $audio_update_sql . " |
|
| 1419 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
| 1412 | + title = '" . Database::escape_string($title)."', |
|
| 1413 | + description = '" . Database::escape_string($description)."', |
|
| 1414 | + parent_item_id = " . $parent.", |
|
| 1415 | + previous_item_id = " . $previous.", |
|
| 1416 | + next_item_id = " . $new_next.", |
|
| 1417 | + display_order = " . $new_order." |
|
| 1418 | + " . $audio_update_sql." |
|
| 1419 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
| 1420 | 1420 | Database::query($sql); |
| 1421 | 1421 | |
| 1422 | 1422 | if ($previous != 0) { |
| 1423 | 1423 | // Update the previous item's next_item_id. |
| 1424 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1425 | - SET next_item_id = " . $id . " |
|
| 1426 | - WHERE c_id = ".$course_id." AND id = " . $previous; |
|
| 1424 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1425 | + SET next_item_id = " . $id." |
|
| 1426 | + WHERE c_id = ".$course_id." AND id = ".$previous; |
|
| 1427 | 1427 | Database::query($sql); |
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | 1430 | if ($new_next != 0) { |
| 1431 | 1431 | // Update the next item's previous_item_id. |
| 1432 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1433 | - SET previous_item_id = " . $id . " |
|
| 1434 | - WHERE c_id = ".$course_id." AND id = " . $new_next; |
|
| 1432 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1433 | + SET previous_item_id = " . $id." |
|
| 1434 | + WHERE c_id = ".$course_id." AND id = ".$new_next; |
|
| 1435 | 1435 | Database::query($sql); |
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | if ($old_prerequisite != $prerequisites) { |
| 1439 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1440 | - SET prerequisite = '" . $prerequisites . "' |
|
| 1441 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
| 1439 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1440 | + SET prerequisite = '" . $prerequisites."' |
|
| 1441 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
| 1442 | 1442 | Database::query($sql); |
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | if ($old_max_time_allowed != $max_time_allowed) { |
| 1446 | 1446 | // update max time allowed |
| 1447 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1448 | - SET max_time_allowed = " . $max_time_allowed . " |
|
| 1449 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
| 1447 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1448 | + SET max_time_allowed = " . $max_time_allowed." |
|
| 1449 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
| 1450 | 1450 | Database::query($sql); |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 | // Update all the items with the same or a bigger display_order than the current item. |
| 1454 | - $sql = "UPDATE " . $tbl_lp_item . " |
|
| 1454 | + $sql = "UPDATE ".$tbl_lp_item." |
|
| 1455 | 1455 | SET display_order = display_order + 1 |
| 1456 | 1456 | WHERE |
| 1457 | 1457 | c_id = ".$course_id." AND |
| 1458 | - lp_id = " . $this->get_id() . " AND |
|
| 1459 | - id <> " . $id . " AND |
|
| 1460 | - parent_item_id = " . $parent . " AND |
|
| 1458 | + lp_id = " . $this->get_id()." AND |
|
| 1459 | + id <> " . $id." AND |
|
| 1460 | + parent_item_id = " . $parent." AND |
|
| 1461 | 1461 | display_order >= " . $new_order; |
| 1462 | 1462 | |
| 1463 | 1463 | Database::query($sql); |
@@ -1483,7 +1483,7 @@ discard block |
||
| 1483 | 1483 | { |
| 1484 | 1484 | $course_id = api_get_course_int_id(); |
| 1485 | 1485 | if ($this->debug > 0) { |
| 1486 | - error_log('New LP - In learnpath::edit_item_prereq(' . $id . ',' . $prerequisite_id . ',' . $mastery_score . ',' . $max_score . ')', 0); |
|
| 1486 | + error_log('New LP - In learnpath::edit_item_prereq('.$id.','.$prerequisite_id.','.$mastery_score.','.$max_score.')', 0); |
|
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | if (empty($id) || ($id != strval(intval($id))) || empty ($prerequisite_id)) { |
@@ -1581,8 +1581,8 @@ discard block |
||
| 1581 | 1581 | error_log('New LP - In learnpath::get_brother_chapters()', 0); |
| 1582 | 1582 | } |
| 1583 | 1583 | |
| 1584 | - if (empty($id)|| $id != strval(intval($id))) { |
|
| 1585 | - return array (); |
|
| 1584 | + if (empty($id) || $id != strval(intval($id))) { |
|
| 1585 | + return array(); |
|
| 1586 | 1586 | } |
| 1587 | 1587 | |
| 1588 | 1588 | $lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
@@ -1600,13 +1600,13 @@ discard block |
||
| 1600 | 1600 | item_type='dokeos_chapter' |
| 1601 | 1601 | ORDER BY display_order"; |
| 1602 | 1602 | $res_bros = Database::query($sql_bros); |
| 1603 | - $list = array (); |
|
| 1603 | + $list = array(); |
|
| 1604 | 1604 | while ($row_bro = Database :: fetch_array($res_bros)) { |
| 1605 | 1605 | $list[] = $row_bro; |
| 1606 | 1606 | } |
| 1607 | 1607 | return $list; |
| 1608 | 1608 | } |
| 1609 | - return array (); |
|
| 1609 | + return array(); |
|
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | /** |
@@ -1619,11 +1619,11 @@ discard block |
||
| 1619 | 1619 | { |
| 1620 | 1620 | $course_id = api_get_course_int_id(); |
| 1621 | 1621 | if ($this->debug > 0) { |
| 1622 | - error_log('New LP - In learnpath::get_brother_items(' . $id . ')', 0); |
|
| 1622 | + error_log('New LP - In learnpath::get_brother_items('.$id.')', 0); |
|
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | 1625 | if (empty ($id) || $id != strval(intval($id))) { |
| 1626 | - return array (); |
|
| 1626 | + return array(); |
|
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | $lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
@@ -1635,13 +1635,13 @@ discard block |
||
| 1635 | 1635 | $sql_bros = "SELECT * FROM $lp_item WHERE c_id = ".$course_id." AND parent_item_id = $parent |
| 1636 | 1636 | ORDER BY display_order"; |
| 1637 | 1637 | $res_bros = Database::query($sql_bros); |
| 1638 | - $list = array (); |
|
| 1638 | + $list = array(); |
|
| 1639 | 1639 | while ($row_bro = Database :: fetch_array($res_bros)) { |
| 1640 | 1640 | $list[] = $row_bro; |
| 1641 | 1641 | } |
| 1642 | 1642 | return $list; |
| 1643 | 1643 | } |
| 1644 | - return array (); |
|
| 1644 | + return array(); |
|
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | 1647 | /** |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | $current = $this->current; |
| 1712 | 1712 | } |
| 1713 | 1713 | if ($this->debug > 2) { |
| 1714 | - error_log('New LP - In learnpath::get_current_item_id() - Returning ' . $current, 0); |
|
| 1714 | + error_log('New LP - In learnpath::get_current_item_id() - Returning '.$current, 0); |
|
| 1715 | 1715 | } |
| 1716 | 1716 | return $current; |
| 1717 | 1717 | } |
@@ -1792,7 +1792,7 @@ discard block |
||
| 1792 | 1792 | ) { |
| 1793 | 1793 | |
| 1794 | 1794 | if ($this->debug > 2) { |
| 1795 | - error_log('New LP - In learnpath::first() - Last item seen is ' . $this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0); |
|
| 1795 | + error_log('New LP - In learnpath::first() - Last item seen is '.$this->last_item_seen.' of type '.$this->items[$this->last_item_seen]->get_type(), 0); |
|
| 1796 | 1796 | } |
| 1797 | 1797 | $index = -1; |
| 1798 | 1798 | foreach ($this->ordered_items as $myindex => $item_id) { |
@@ -1804,7 +1804,7 @@ discard block |
||
| 1804 | 1804 | if ($index == -1) { |
| 1805 | 1805 | // Index hasn't changed, so item not found - panic (this shouldn't happen). |
| 1806 | 1806 | if ($this->debug > 2) { |
| 1807 | - error_log('New LP - Last item (' . $this->last_item_seen . ') was found in items but not in ordered_items, panic!', 0); |
|
| 1807 | + error_log('New LP - Last item ('.$this->last_item_seen.') was found in items but not in ordered_items, panic!', 0); |
|
| 1808 | 1808 | } |
| 1809 | 1809 | return false; |
| 1810 | 1810 | } else { |
@@ -1819,7 +1819,7 @@ discard block |
||
| 1819 | 1819 | $index = 0; |
| 1820 | 1820 | // Loop through all ordered items and stop at the first item that is |
| 1821 | 1821 | // not a directory *and* that has not been completed yet. |
| 1822 | - while ( !empty($this->ordered_items[$index]) AND |
|
| 1822 | + while (!empty($this->ordered_items[$index]) AND |
|
| 1823 | 1823 | is_a($this->items[$this->ordered_items[$index]], 'learnpathItem') AND |
| 1824 | 1824 | ( |
| 1825 | 1825 | $this->items[$this->ordered_items[$index]]->get_type() == 'dir' OR |
@@ -1833,14 +1833,14 @@ discard block |
||
| 1833 | 1833 | $this->current = isset($this->ordered_items[$index]) ? $this->ordered_items[$index] : null; |
| 1834 | 1834 | $this->index = $index; |
| 1835 | 1835 | if ($this->debug > 2) { |
| 1836 | - error_log('$index ' . $index); |
|
| 1836 | + error_log('$index '.$index); |
|
| 1837 | 1837 | } |
| 1838 | 1838 | if ($this->debug > 2) { |
| 1839 | - error_log('New LP - In learnpath::first() - No last item seen. New last = ' . $this->last . '(' . $this->ordered_items[$index] . ')', 0); |
|
| 1839 | + error_log('New LP - In learnpath::first() - No last item seen. New last = '.$this->last.'('.$this->ordered_items[$index].')', 0); |
|
| 1840 | 1840 | } |
| 1841 | 1841 | } |
| 1842 | 1842 | if ($this->debug > 2) { |
| 1843 | - error_log('New LP - In learnpath::first() - First item is ' . $this->get_current_item_id()); |
|
| 1843 | + error_log('New LP - In learnpath::first() - First item is '.$this->get_current_item_id()); |
|
| 1844 | 1844 | } |
| 1845 | 1845 | } |
| 1846 | 1846 | |
@@ -1853,7 +1853,7 @@ discard block |
||
| 1853 | 1853 | public function get_js_info($item_id = '') |
| 1854 | 1854 | { |
| 1855 | 1855 | if ($this->debug > 0) { |
| 1856 | - error_log('New LP - In learnpath::get_js_info(' . $item_id . ')', 0); |
|
| 1856 | + error_log('New LP - In learnpath::get_js_info('.$item_id.')', 0); |
|
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | 1859 | $info = ''; |
@@ -1863,17 +1863,17 @@ discard block |
||
| 1863 | 1863 | //if item is defined, return values from DB |
| 1864 | 1864 | $oItem = $this->items[$item_id]; |
| 1865 | 1865 | $info .= '<script language="javascript">'; |
| 1866 | - $info .= "top.set_score(" . $oItem->get_score() . ");\n"; |
|
| 1867 | - $info .= "top.set_max(" . $oItem->get_max() . ");\n"; |
|
| 1868 | - $info .= "top.set_min(" . $oItem->get_min() . ");\n"; |
|
| 1869 | - $info .= "top.set_lesson_status('" . $oItem->get_status() . "');"; |
|
| 1870 | - $info .= "top.set_session_time('" . $oItem->get_scorm_time('js') . "');"; |
|
| 1871 | - $info .= "top.set_suspend_data('" . $oItem->get_suspend_data() . "');"; |
|
| 1872 | - $info .= "top.set_saved_lesson_status('" . $oItem->get_status() . "');"; |
|
| 1866 | + $info .= "top.set_score(".$oItem->get_score().");\n"; |
|
| 1867 | + $info .= "top.set_max(".$oItem->get_max().");\n"; |
|
| 1868 | + $info .= "top.set_min(".$oItem->get_min().");\n"; |
|
| 1869 | + $info .= "top.set_lesson_status('".$oItem->get_status()."');"; |
|
| 1870 | + $info .= "top.set_session_time('".$oItem->get_scorm_time('js')."');"; |
|
| 1871 | + $info .= "top.set_suspend_data('".$oItem->get_suspend_data()."');"; |
|
| 1872 | + $info .= "top.set_saved_lesson_status('".$oItem->get_status()."');"; |
|
| 1873 | 1873 | $info .= "top.set_flag_synchronized();"; |
| 1874 | 1874 | $info .= '</script>'; |
| 1875 | 1875 | if ($this->debug > 2) { |
| 1876 | - error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0); |
|
| 1876 | + error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0); |
|
| 1877 | 1877 | } |
| 1878 | 1878 | return $info; |
| 1879 | 1879 | |
@@ -1881,17 +1881,17 @@ discard block |
||
| 1881 | 1881 | |
| 1882 | 1882 | // If item_id is empty, just update to default SCORM data. |
| 1883 | 1883 | $info .= '<script language="javascript">'; |
| 1884 | - $info .= "top.set_score(" . learnpathItem :: get_score() . ");\n"; |
|
| 1885 | - $info .= "top.set_max(" . learnpathItem :: get_max() . ");\n"; |
|
| 1886 | - $info .= "top.set_min(" . learnpathItem :: get_min() . ");\n"; |
|
| 1887 | - $info .= "top.set_lesson_status('" . learnpathItem :: get_status() . "');"; |
|
| 1888 | - $info .= "top.set_session_time('" . learnpathItem :: getScormTimeFromParameter('js') . "');"; |
|
| 1889 | - $info .= "top.set_suspend_data('" . learnpathItem :: get_suspend_data() . "');"; |
|
| 1890 | - $info .= "top.set_saved_lesson_status('" . learnpathItem :: get_status() . "');"; |
|
| 1884 | + $info .= "top.set_score(".learnpathItem :: get_score().");\n"; |
|
| 1885 | + $info .= "top.set_max(".learnpathItem :: get_max().");\n"; |
|
| 1886 | + $info .= "top.set_min(".learnpathItem :: get_min().");\n"; |
|
| 1887 | + $info .= "top.set_lesson_status('".learnpathItem :: get_status()."');"; |
|
| 1888 | + $info .= "top.set_session_time('".learnpathItem :: getScormTimeFromParameter('js')."');"; |
|
| 1889 | + $info .= "top.set_suspend_data('".learnpathItem :: get_suspend_data()."');"; |
|
| 1890 | + $info .= "top.set_saved_lesson_status('".learnpathItem :: get_status()."');"; |
|
| 1891 | 1891 | $info .= "top.set_flag_synchronized();"; |
| 1892 | 1892 | $info .= '</script>'; |
| 1893 | 1893 | if ($this->debug > 2) { |
| 1894 | - error_log('New LP - in learnpath::get_js_info(' . $item_id . ') - returning: ' . $info, 0); |
|
| 1894 | + error_log('New LP - in learnpath::get_js_info('.$item_id.') - returning: '.$info, 0); |
|
| 1895 | 1895 | } |
| 1896 | 1896 | return $info; |
| 1897 | 1897 | } |
@@ -1945,12 +1945,12 @@ discard block |
||
| 1945 | 1945 | * Gets the navigation bar for the learnpath display screen |
| 1946 | 1946 | * @return string The HTML string to use as a navigation bar |
| 1947 | 1947 | */ |
| 1948 | - public function get_navigation_bar($idBar = null, $display=null) { |
|
| 1948 | + public function get_navigation_bar($idBar = null, $display = null) { |
|
| 1949 | 1949 | if ($this->debug > 0) { |
| 1950 | 1950 | error_log('New LP - In learnpath::get_navigation_bar()', 0); |
| 1951 | 1951 | } |
| 1952 | - if(empty($idBar)){ |
|
| 1953 | - $idBar='control-top'; |
|
| 1952 | + if (empty($idBar)) { |
|
| 1953 | + $idBar = 'control-top'; |
|
| 1954 | 1954 | } |
| 1955 | 1955 | /* if(empty($display)){ |
| 1956 | 1956 | $display='display:block'; |
@@ -1963,16 +1963,16 @@ discard block |
||
| 1963 | 1963 | $navbar = ' |
| 1964 | 1964 | <span id="'.$idBar.'" class="buttons"> |
| 1965 | 1965 | <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link"> |
| 1966 | - <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span> |
|
| 1966 | + <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span> |
|
| 1967 | 1967 | </a> |
| 1968 | - <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"> |
|
| 1969 | - <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span> |
|
| 1968 | + <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous"> |
|
| 1969 | + <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span> |
|
| 1970 | 1970 | </a> |
| 1971 | - <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"> |
|
| 1972 | - <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span> |
|
| 1971 | + <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next"> |
|
| 1972 | + <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span> |
|
| 1973 | 1973 | </a> |
| 1974 | 1974 | <a class="icon-toolbar" id="view-embedded" href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode"> |
| 1975 | - <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen') . '</span> |
|
| 1975 | + <span class="fa fa-columns"></span><span class="sr-only">' . get_lang('ScormExitFullScreen').'</span> |
|
| 1976 | 1976 | </a> |
| 1977 | 1977 | </span>'; |
| 1978 | 1978 | |
@@ -1980,13 +1980,13 @@ discard block |
||
| 1980 | 1980 | $navbar = ' |
| 1981 | 1981 | <span id="'.$idBar.'" class="buttons text-right"> |
| 1982 | 1982 | <a class="icon-toolbar" href="lp_controller.php?action=stats&'.api_get_cidreq(true).'&lp_id='.$lp_id.'" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link"> |
| 1983 | - <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting') . '</span> |
|
| 1983 | + <span class="fa fa-info"></span><span class="sr-only">' . get_lang('Reporting').'</span> |
|
| 1984 | 1984 | </a> |
| 1985 | - <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"> |
|
| 1986 | - <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious') . '</span> |
|
| 1985 | + <a class="icon-toolbar" id="scorm-previous" href="#" onclick="switch_item(' . $mycurrentitemid.',\'previous\');return false;" title="previous"> |
|
| 1986 | + <span class="fa fa-chevron-left"></span><span class="sr-only">' . get_lang('ScormPrevious').'</span> |
|
| 1987 | 1987 | </a> |
| 1988 | - <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"> |
|
| 1989 | - <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext') . '</span> |
|
| 1988 | + <a class="icon-toolbar" id="scorm-next" href="#" onclick="switch_item(' . $mycurrentitemid.',\'next\');return false;" title="next"> |
|
| 1989 | + <span class="fa fa-chevron-right"></span><span class="sr-only">' . get_lang('ScormNext').'</span> |
|
| 1990 | 1990 | </a> |
| 1991 | 1991 | </span>'; |
| 1992 | 1992 | } |
@@ -2007,11 +2007,11 @@ discard block |
||
| 2007 | 2007 | $index = $this->index; |
| 2008 | 2008 | $index++; |
| 2009 | 2009 | if ($this->debug > 2) { |
| 2010 | - error_log('New LP - Now looking at ordered_items[' . ($index) . '] - type is ' . $this->items[$this->ordered_items[$index]]->type, 0); |
|
| 2010 | + error_log('New LP - Now looking at ordered_items['.($index).'] - type is '.$this->items[$this->ordered_items[$index]]->type, 0); |
|
| 2011 | 2011 | } |
| 2012 | 2012 | while (!empty ($this->ordered_items[$index]) AND ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') AND $index < $this->max_ordered_items) { |
| 2013 | 2013 | $index++; |
| 2014 | - if ($index == $this->max_ordered_items){ |
|
| 2014 | + if ($index == $this->max_ordered_items) { |
|
| 2015 | 2015 | if ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter') { |
| 2016 | 2016 | return $this->index; |
| 2017 | 2017 | } else { |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | return $this->index; |
| 2024 | 2024 | } |
| 2025 | 2025 | if ($this->debug > 2) { |
| 2026 | - error_log('New LP - index is now ' . $index, 0); |
|
| 2026 | + error_log('New LP - index is now '.$index, 0); |
|
| 2027 | 2027 | } |
| 2028 | 2028 | return $index; |
| 2029 | 2029 | } |
@@ -2041,7 +2041,7 @@ discard block |
||
| 2041 | 2041 | if (!empty ($new_index)) { |
| 2042 | 2042 | if (isset ($this->ordered_items[$new_index])) { |
| 2043 | 2043 | if ($this->debug > 2) { |
| 2044 | - error_log('New LP - In learnpath::get_next_index() - Returning ' . $this->ordered_items[$new_index], 0); |
|
| 2044 | + error_log('New LP - In learnpath::get_next_index() - Returning '.$this->ordered_items[$new_index], 0); |
|
| 2045 | 2045 | } |
| 2046 | 2046 | return $this->ordered_items[$new_index]; |
| 2047 | 2047 | } |
@@ -2083,7 +2083,7 @@ discard block |
||
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | 2085 | // Filename without its extension. |
| 2086 | - $file_base_name = str_replace('.' . $extension, '', $filename); |
|
| 2086 | + $file_base_name = str_replace('.'.$extension, '', $filename); |
|
| 2087 | 2087 | |
| 2088 | 2088 | $zipFile = new PclZip($file_path); |
| 2089 | 2089 | // Check the zip content (real size and file extension). |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | break; // Exit the foreach loop. |
| 2108 | 2108 | } elseif ( |
| 2109 | 2109 | preg_match('/aicc\//i', $thisContent['filename']) || |
| 2110 | - in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array( 'crs','au','des','cst')) |
|
| 2110 | + in_array(strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)), array('crs', 'au', 'des', 'cst')) |
|
| 2111 | 2111 | ) { |
| 2112 | 2112 | $ext = strtolower(pathinfo($thisContent['filename'], PATHINFO_EXTENSION)); |
| 2113 | 2113 | switch ($ext) { |
@@ -2149,7 +2149,7 @@ discard block |
||
| 2149 | 2149 | error_log('New LP - In learnpath::get_previous_index()', 0); |
| 2150 | 2150 | } |
| 2151 | 2151 | $index = $this->index; |
| 2152 | - if (isset ($this->ordered_items[$index -1])) { |
|
| 2152 | + if (isset ($this->ordered_items[$index - 1])) { |
|
| 2153 | 2153 | $index--; |
| 2154 | 2154 | while (isset($this->ordered_items[$index]) && ($this->items[$this->ordered_items[$index]]->get_type() == 'dir' || $this->items[$this->ordered_items[$index]]->get_type() == 'dokeos_chapter')) { |
| 2155 | 2155 | $index--; |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | } |
| 2160 | 2160 | } else { |
| 2161 | 2161 | if ($this->debug > 2) { |
| 2162 | - error_log('New LP - get_previous_index() - there was no previous index available, reusing ' . $index, 0); |
|
| 2162 | + error_log('New LP - get_previous_index() - there was no previous index available, reusing '.$index, 0); |
|
| 2163 | 2163 | } |
| 2164 | 2164 | // There is no previous item. |
| 2165 | 2165 | } |
@@ -2202,8 +2202,8 @@ discard block |
||
| 2202 | 2202 | { |
| 2203 | 2203 | $course_id = api_get_course_int_id(); |
| 2204 | 2204 | $_course = api_get_course_info(); |
| 2205 | - $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
| 2206 | - $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW); |
|
| 2205 | + $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
|
| 2206 | + $tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW); |
|
| 2207 | 2207 | |
| 2208 | 2208 | // Getting all the information about the item. |
| 2209 | 2209 | $sql = "SELECT * FROM ".$tbl_lp_item." as lp |
@@ -2214,7 +2214,7 @@ discard block |
||
| 2214 | 2214 | lp.c_id = $course_id AND |
| 2215 | 2215 | lp_view.c_id = $course_id"; |
| 2216 | 2216 | $result = Database::query($sql); |
| 2217 | - $row = Database::fetch_assoc($result); |
|
| 2217 | + $row = Database::fetch_assoc($result); |
|
| 2218 | 2218 | $output = ''; |
| 2219 | 2219 | |
| 2220 | 2220 | if (!empty ($row['audio'])) { |
@@ -2222,8 +2222,8 @@ discard block |
||
| 2222 | 2222 | $list = $_SESSION['oLP']->get_toc(); |
| 2223 | 2223 | $type_quiz = false; |
| 2224 | 2224 | |
| 2225 | - foreach($list as $toc) { |
|
| 2226 | - if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type']=='quiz') ) { |
|
| 2225 | + foreach ($list as $toc) { |
|
| 2226 | + if ($toc['id'] == $_SESSION['oLP']->current && ($toc['type'] == 'quiz')) { |
|
| 2227 | 2227 | $type_quiz = true; |
| 2228 | 2228 | } |
| 2229 | 2229 | } |
@@ -2286,7 +2286,7 @@ discard block |
||
| 2286 | 2286 | $courseCode = null, |
| 2287 | 2287 | $sessionId = null |
| 2288 | 2288 | ) { |
| 2289 | - $lp_id = (int)$lp_id; |
|
| 2289 | + $lp_id = (int) $lp_id; |
|
| 2290 | 2290 | $courseInfo = api_get_course_info($courseCode); |
| 2291 | 2291 | $sessionId = intval($sessionId); |
| 2292 | 2292 | |
@@ -2452,10 +2452,10 @@ discard block |
||
| 2452 | 2452 | */ |
| 2453 | 2453 | public static function get_progress_bar($percentage = -1, $text_add = '') |
| 2454 | 2454 | { |
| 2455 | - $text = $percentage . $text_add; |
|
| 2455 | + $text = $percentage.$text_add; |
|
| 2456 | 2456 | $output = '<div class="progress"> |
| 2457 | - <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage. '" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';"> |
|
| 2458 | - '. $text .' |
|
| 2457 | + <div id="progress_bar_value" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="' .$percentage.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';"> |
|
| 2458 | + '. $text.' |
|
| 2459 | 2459 | </div> |
| 2460 | 2460 | </div>'; |
| 2461 | 2461 | |
@@ -2491,16 +2491,16 @@ discard block |
||
| 2491 | 2491 | } |
| 2492 | 2492 | $total_items = $this->get_total_items_count_without_chapters(); |
| 2493 | 2493 | if ($this->debug > 2) { |
| 2494 | - error_log('New LP - Total items available in this learnpath: ' . $total_items, 0); |
|
| 2494 | + error_log('New LP - Total items available in this learnpath: '.$total_items, 0); |
|
| 2495 | 2495 | } |
| 2496 | 2496 | $completeItems = $this->get_complete_items_count(); |
| 2497 | 2497 | if ($this->debug > 2) { |
| 2498 | - error_log('New LP - Items completed so far: ' . $completeItems, 0); |
|
| 2498 | + error_log('New LP - Items completed so far: '.$completeItems, 0); |
|
| 2499 | 2499 | } |
| 2500 | 2500 | if ($add != 0) { |
| 2501 | 2501 | $completeItems += $add; |
| 2502 | 2502 | if ($this->debug > 2) { |
| 2503 | - error_log('New LP - Items completed so far (+modifier): ' . $completeItems, 0); |
|
| 2503 | + error_log('New LP - Items completed so far (+modifier): '.$completeItems, 0); |
|
| 2504 | 2504 | } |
| 2505 | 2505 | } |
| 2506 | 2506 | $text = ''; |
@@ -2518,7 +2518,7 @@ discard block |
||
| 2518 | 2518 | $text = '%'; |
| 2519 | 2519 | } elseif ($mode == 'abs') { |
| 2520 | 2520 | $percentage = $completeItems; |
| 2521 | - $text = '/' . $total_items; |
|
| 2521 | + $text = '/'.$total_items; |
|
| 2522 | 2522 | } |
| 2523 | 2523 | |
| 2524 | 2524 | return array( |
@@ -2714,7 +2714,7 @@ discard block |
||
| 2714 | 2714 | // and replace them, one by one, by the internal IDs (chamilo db) |
| 2715 | 2715 | // TODO: Modify the '*' replacement to replace the multiplier in front of it |
| 2716 | 2716 | // by a space as well. |
| 2717 | - $find = array ( |
|
| 2717 | + $find = array( |
|
| 2718 | 2718 | '&', |
| 2719 | 2719 | '|', |
| 2720 | 2720 | '~', |
@@ -2726,7 +2726,7 @@ discard block |
||
| 2726 | 2726 | '(', |
| 2727 | 2727 | ')' |
| 2728 | 2728 | ); |
| 2729 | - $replace = array ( |
|
| 2729 | + $replace = array( |
|
| 2730 | 2730 | ' ', |
| 2731 | 2731 | ' ', |
| 2732 | 2732 | ' ', |
@@ -2743,7 +2743,7 @@ discard block |
||
| 2743 | 2743 | foreach ($ids as $id) { |
| 2744 | 2744 | $id = trim($id); |
| 2745 | 2745 | if (isset ($this->refs_list[$id])) { |
| 2746 | - $prereq = preg_replace('/[^a-zA-Z_0-9](' . $id . ')[^a-zA-Z_0-9]/', 'ITEM_' . $this->refs_list[$id], $prereq); |
|
| 2746 | + $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq); |
|
| 2747 | 2747 | } |
| 2748 | 2748 | } |
| 2749 | 2749 | |
@@ -2851,9 +2851,9 @@ discard block |
||
| 2851 | 2851 | if ($this->debug > 0) { |
| 2852 | 2852 | error_log('New LP - In learnpath::get_items_status_list()', 0); |
| 2853 | 2853 | } |
| 2854 | - $list = array (); |
|
| 2854 | + $list = array(); |
|
| 2855 | 2855 | foreach ($this->ordered_items as $item_id) { |
| 2856 | - $list[] = array ( |
|
| 2856 | + $list[] = array( |
|
| 2857 | 2857 | $item_id => $this->items[$item_id]->get_status() |
| 2858 | 2858 | ); |
| 2859 | 2859 | } |
@@ -2907,7 +2907,7 @@ discard block |
||
| 2907 | 2907 | $res = Database::query($sql); |
| 2908 | 2908 | $num = Database :: num_rows($res); |
| 2909 | 2909 | if ($num > 0) { |
| 2910 | - $list[] = array ( |
|
| 2910 | + $list[] = array( |
|
| 2911 | 2911 | 'order_id' => api_htmlentities(get_lang('Order'), ENT_QUOTES), |
| 2912 | 2912 | 'id' => api_htmlentities(get_lang('InteractionID'), ENT_QUOTES), |
| 2913 | 2913 | 'type' => api_htmlentities(get_lang('Type'), ENT_QUOTES), |
@@ -2918,7 +2918,7 @@ discard block |
||
| 2918 | 2918 | 'latency' => api_htmlentities(get_lang('LatencyTimeSpent'), ENT_QUOTES) |
| 2919 | 2919 | ); |
| 2920 | 2920 | while ($row = Database :: fetch_array($res)) { |
| 2921 | - $list[] = array ( |
|
| 2921 | + $list[] = array( |
|
| 2922 | 2922 | 'order_id' => ($row['order_id'] + 1), |
| 2923 | 2923 | 'id' => urldecode($row['interaction_id']), //urldecode because they often have %2F or stuff like that |
| 2924 | 2924 | 'type' => $row['interaction_type'], |
@@ -2986,7 +2986,7 @@ discard block |
||
| 2986 | 2986 | 'status' => api_htmlentities(get_lang('ObjectiveStatus'), ENT_QUOTES) |
| 2987 | 2987 | ); |
| 2988 | 2988 | while ($row = Database :: fetch_array($res)) { |
| 2989 | - $list[] = array ( |
|
| 2989 | + $list[] = array( |
|
| 2990 | 2990 | 'order_id' => ($row['order_id'] + 1), |
| 2991 | 2991 | 'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that. |
| 2992 | 2992 | 'score_raw' => $row['score_raw'], |
@@ -3013,10 +3013,10 @@ discard block |
||
| 3013 | 3013 | $toc = array(); |
| 3014 | 3014 | foreach ($this->ordered_items as $item_id) { |
| 3015 | 3015 | if ($this->debug > 2) { |
| 3016 | - error_log('learnpath::get_toc(): getting info for item ' . $item_id, 0); |
|
| 3016 | + error_log('learnpath::get_toc(): getting info for item '.$item_id, 0); |
|
| 3017 | 3017 | } |
| 3018 | 3018 | // TODO: Change this link generation and use new function instead. |
| 3019 | - $toc[] = array ( |
|
| 3019 | + $toc[] = array( |
|
| 3020 | 3020 | 'id' => $item_id, |
| 3021 | 3021 | 'title' => $this->items[$item_id]->get_title(), |
| 3022 | 3022 | 'status' => $this->items[$item_id]->get_status(), |
@@ -3027,7 +3027,7 @@ discard block |
||
| 3027 | 3027 | ); |
| 3028 | 3028 | } |
| 3029 | 3029 | if ($this->debug > 2) { |
| 3030 | - error_log('New LP - In learnpath::get_toc() - TOC array: ' . print_r($toc, true), 0); |
|
| 3030 | + error_log('New LP - In learnpath::get_toc() - TOC array: '.print_r($toc, true), 0); |
|
| 3031 | 3031 | } |
| 3032 | 3032 | return $toc; |
| 3033 | 3033 | } |
@@ -3044,10 +3044,10 @@ discard block |
||
| 3044 | 3044 | } |
| 3045 | 3045 | $toc = $varname.' = new Array();'; |
| 3046 | 3046 | foreach ($this->ordered_items as $item_id) { |
| 3047 | - $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; |
|
| 3047 | + $toc .= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';"; |
|
| 3048 | 3048 | } |
| 3049 | 3049 | if ($this->debug > 2) { |
| 3050 | - error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0); |
|
| 3050 | + error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: '.print_r($toc, true), 0); |
|
| 3051 | 3051 | } |
| 3052 | 3052 | return $toc; |
| 3053 | 3053 | } |
@@ -3071,7 +3071,7 @@ discard block |
||
| 3071 | 3071 | } |
| 3072 | 3072 | } |
| 3073 | 3073 | if ($this->debug > 2) { |
| 3074 | - error_log('New LP - In learnpath::get_type() - Returning ' . ($res ? $res : 'false'), 0); |
|
| 3074 | + error_log('New LP - In learnpath::get_type() - Returning '.($res ? $res : 'false'), 0); |
|
| 3075 | 3075 | } |
| 3076 | 3076 | return $res; |
| 3077 | 3077 | } |
@@ -3087,7 +3087,7 @@ discard block |
||
| 3087 | 3087 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
| 3088 | 3088 | $lp_id = intval($lp_id); |
| 3089 | 3089 | $sql = "SELECT lp_type FROM $tbl_lp |
| 3090 | - WHERE c_id = $course_id AND id = '" . $lp_id . "'"; |
|
| 3090 | + WHERE c_id = $course_id AND id = '".$lp_id."'"; |
|
| 3091 | 3091 | $res = Database::query($sql); |
| 3092 | 3092 | if ($res === false) { |
| 3093 | 3093 | return null; |
@@ -3200,7 +3200,7 @@ discard block |
||
| 3200 | 3200 | $dirTypes = self::getChapterTypes(); |
| 3201 | 3201 | |
| 3202 | 3202 | if (in_array($item['type'], $dirTypes)) { |
| 3203 | - $scorm_color_background ='scorm_item_section '; |
|
| 3203 | + $scorm_color_background = 'scorm_item_section '; |
|
| 3204 | 3204 | $style_item = ''; |
| 3205 | 3205 | } |
| 3206 | 3206 | if ($item['id'] == $this->current) { |
@@ -3209,7 +3209,7 @@ discard block |
||
| 3209 | 3209 | $scorm_color_background = 'scorm_item_normal '.$scorm_color_background.' '; |
| 3210 | 3210 | } |
| 3211 | 3211 | |
| 3212 | - $html .= '<div id="toc_' . $item['id'] . '" class="' . $scorm_color_background . ' '.$class_name[$item['status']].' ">'; |
|
| 3212 | + $html .= '<div id="toc_'.$item['id'].'" class="'.$scorm_color_background.' '.$class_name[$item['status']].' ">'; |
|
| 3213 | 3213 | |
| 3214 | 3214 | // Learning path title |
| 3215 | 3215 | $title = $item['title']; |
@@ -3239,7 +3239,7 @@ discard block |
||
| 3239 | 3239 | $html .= stripslashes($title); |
| 3240 | 3240 | } else { |
| 3241 | 3241 | $this->get_link('http', $item['id'], $toc_list); |
| 3242 | - $html .= '<a class="items-list" href="#" onclick="switch_item(' .$mycurrentitemid . ',' .$item['id'] . ');' .'return false;" >' . stripslashes($title) . '</a>'; |
|
| 3242 | + $html .= '<a class="items-list" href="#" onclick="switch_item('.$mycurrentitemid.','.$item['id'].');'.'return false;" >'.stripslashes($title).'</a>'; |
|
| 3243 | 3243 | } |
| 3244 | 3244 | $html .= "</div>"; |
| 3245 | 3245 | |
@@ -3273,12 +3273,12 @@ discard block |
||
| 3273 | 3273 | if ($this->get_lp_session_id() == api_get_session_id()) { |
| 3274 | 3274 | $html .= '<div id="actions_lp" class="actions_lp"><hr>'; |
| 3275 | 3275 | $html .= '<div class="btn-group">'; |
| 3276 | - $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" . |
|
| 3277 | - Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>"; |
|
| 3278 | - $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq()."&action=add_item&type=step&lp_id=" . $this->lp_id . "&isStudentView=false' target='_parent'>" . |
|
| 3279 | - Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>"; |
|
| 3280 | - $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=" . $this->lp_id.'&isStudentView=false">' . |
|
| 3281 | - Display::returnFontAwesomeIcon('cog') . get_lang('Settings').'</a>'; |
|
| 3276 | + $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&gradebook=$gradebook&action=build&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>". |
|
| 3277 | + Display::returnFontAwesomeIcon('street-view').get_lang('Overview')."</a>"; |
|
| 3278 | + $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?".api_get_cidreq()."&action=add_item&type=step&lp_id=".$this->lp_id."&isStudentView=false' target='_parent'>". |
|
| 3279 | + Display::returnFontAwesomeIcon('pencil').get_lang('Edit')."</a>"; |
|
| 3280 | + $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?'.api_get_cidreq()."&gradebook=$gradebook&action=edit&lp_id=".$this->lp_id.'&isStudentView=false">'. |
|
| 3281 | + Display::returnFontAwesomeIcon('cog').get_lang('Settings').'</a>'; |
|
| 3282 | 3282 | $html .= '</div>'; |
| 3283 | 3283 | $html .= '</div>'; |
| 3284 | 3284 | } |
@@ -3329,11 +3329,11 @@ discard block |
||
| 3329 | 3329 | $course_id = $this->get_course_int_id(); |
| 3330 | 3330 | |
| 3331 | 3331 | if ($this->debug > 0) { |
| 3332 | - error_log('New LP - In learnpath::get_link(' . $type . ',' . $item_id . ')', 0); |
|
| 3332 | + error_log('New LP - In learnpath::get_link('.$type.','.$item_id.')', 0); |
|
| 3333 | 3333 | } |
| 3334 | 3334 | if (empty($item_id)) { |
| 3335 | 3335 | if ($this->debug > 2) { |
| 3336 | - error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: ' . $this->get_current_item_id(), 0); |
|
| 3336 | + error_log('New LP - In learnpath::get_link() - no item id given in learnpath::get_link(), using current: '.$this->get_current_item_id(), 0); |
|
| 3337 | 3337 | } |
| 3338 | 3338 | $item_id = $this->get_current_item_id(); |
| 3339 | 3339 | } |
@@ -3365,7 +3365,7 @@ discard block |
||
| 3365 | 3365 | ON (li.lp_id = l.id AND l.c_id = $course_id AND li.c_id = $course_id ) |
| 3366 | 3366 | WHERE li.id = $item_id "; |
| 3367 | 3367 | if ($this->debug > 2) { |
| 3368 | - error_log('New LP - In learnpath::get_link() - selecting item ' . $sql, 0); |
|
| 3368 | + error_log('New LP - In learnpath::get_link() - selecting item '.$sql, 0); |
|
| 3369 | 3369 | } |
| 3370 | 3370 | $res = Database::query($sql); |
| 3371 | 3371 | if (Database :: num_rows($res) > 0) { |
@@ -3379,9 +3379,9 @@ discard block |
||
| 3379 | 3379 | if (empty($lp_item_params) && strpos($lp_item_path, '?') !== false) { |
| 3380 | 3380 | list($lp_item_path, $lp_item_params) = explode('?', $lp_item_path); |
| 3381 | 3381 | } |
| 3382 | - $sys_course_path = api_get_path(SYS_COURSE_PATH) . api_get_course_path(); |
|
| 3382 | + $sys_course_path = api_get_path(SYS_COURSE_PATH).api_get_course_path(); |
|
| 3383 | 3383 | if ($type == 'http') { |
| 3384 | - $course_path = api_get_path(WEB_COURSE_PATH) . api_get_course_path(); //web path |
|
| 3384 | + $course_path = api_get_path(WEB_COURSE_PATH).api_get_course_path(); //web path |
|
| 3385 | 3385 | } else { |
| 3386 | 3386 | $course_path = $sys_course_path; //system path |
| 3387 | 3387 | } |
@@ -3392,8 +3392,8 @@ discard block |
||
| 3392 | 3392 | } |
| 3393 | 3393 | |
| 3394 | 3394 | if ($this->debug > 2) { |
| 3395 | - error_log('New LP - In learnpath::get_link() - $lp_type ' . $lp_type, 0); |
|
| 3396 | - error_log('New LP - In learnpath::get_link() - $lp_item_type ' . $lp_item_type, 0); |
|
| 3395 | + error_log('New LP - In learnpath::get_link() - $lp_type '.$lp_type, 0); |
|
| 3396 | + error_log('New LP - In learnpath::get_link() - $lp_item_type '.$lp_item_type, 0); |
|
| 3397 | 3397 | } |
| 3398 | 3398 | |
| 3399 | 3399 | // Now go through the specific cases to get the end of the path |
@@ -3412,7 +3412,7 @@ discard block |
||
| 3412 | 3412 | ); |
| 3413 | 3413 | |
| 3414 | 3414 | if ($this->debug > 0) { |
| 3415 | - error_log('rl_get_resource_link_for_learnpath - file: ' . $file, 0); |
|
| 3415 | + error_log('rl_get_resource_link_for_learnpath - file: '.$file, 0); |
|
| 3416 | 3416 | } |
| 3417 | 3417 | |
| 3418 | 3418 | if ($lp_item_type == 'link') { |
@@ -3432,7 +3432,7 @@ discard block |
||
| 3432 | 3432 | $linkProtocol = substr($file, 0, 5); |
| 3433 | 3433 | if ($linkProtocol === 'http:') { |
| 3434 | 3434 | //this is the special intervention case |
| 3435 | - $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source=' . urlencode($file); |
|
| 3435 | + $file = api_get_path(WEB_CODE_PATH).'newscorm/embed.php?type=nonhttps&source='.urlencode($file); |
|
| 3436 | 3436 | } |
| 3437 | 3437 | } |
| 3438 | 3438 | } |
@@ -3472,8 +3472,8 @@ discard block |
||
| 3472 | 3472 | $sql = "SELECT count(*) FROM $lp_item_view_table |
| 3473 | 3473 | WHERE |
| 3474 | 3474 | c_id = $course_id AND |
| 3475 | - lp_item_id='" . $lp_item_id . "' AND |
|
| 3476 | - lp_view_id ='" . $lp_view_id . "' AND |
|
| 3475 | + lp_item_id='".$lp_item_id."' AND |
|
| 3476 | + lp_view_id ='" . $lp_view_id."' AND |
|
| 3477 | 3477 | status='completed'"; |
| 3478 | 3478 | $result = Database::query($sql); |
| 3479 | 3479 | $row_count = Database :: fetch_row($result); |
@@ -3482,7 +3482,7 @@ discard block |
||
| 3482 | 3482 | if ($prevent_reinit === 1 && $count_item_view > 0) { |
| 3483 | 3483 | $not_multiple_attempt = 1; |
| 3484 | 3484 | } |
| 3485 | - $file .= '¬_multiple_attempt=' . $not_multiple_attempt; |
|
| 3485 | + $file .= '¬_multiple_attempt='.$not_multiple_attempt; |
|
| 3486 | 3486 | } |
| 3487 | 3487 | |
| 3488 | 3488 | $tmp_array = explode('/', $file); |
@@ -3495,7 +3495,7 @@ discard block |
||
| 3495 | 3495 | break; |
| 3496 | 3496 | case 2 : |
| 3497 | 3497 | if ($this->debug > 2) { |
| 3498 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0); |
|
| 3498 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0); |
|
| 3499 | 3499 | } |
| 3500 | 3500 | |
| 3501 | 3501 | if ($lp_item_type != 'dir') { |
@@ -3509,19 +3509,19 @@ discard block |
||
| 3509 | 3509 | //if ($this->prerequisites_match($item_id)) { |
| 3510 | 3510 | if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) { |
| 3511 | 3511 | if ($this->debug > 2) { |
| 3512 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0); |
|
| 3512 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0); |
|
| 3513 | 3513 | } |
| 3514 | 3514 | // Distant url, return as is. |
| 3515 | 3515 | $file = $lp_item_path; |
| 3516 | 3516 | } else { |
| 3517 | 3517 | if ($this->debug > 2) { |
| 3518 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0); |
|
| 3518 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0); |
|
| 3519 | 3519 | } |
| 3520 | 3520 | // Prevent getting untranslatable urls. |
| 3521 | 3521 | $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path); |
| 3522 | 3522 | $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path); |
| 3523 | 3523 | // Prepare the path. |
| 3524 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path; |
|
| 3524 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path; |
|
| 3525 | 3525 | // TODO: Fix this for urls with protocol header. |
| 3526 | 3526 | $file = str_replace('//', '/', $file); |
| 3527 | 3527 | $file = str_replace(':/', '://', $file); |
@@ -3529,11 +3529,11 @@ discard block |
||
| 3529 | 3529 | $lp_path = substr($lp_path, 0, -1); |
| 3530 | 3530 | } |
| 3531 | 3531 | |
| 3532 | - if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $lp_item_path))) { |
|
| 3532 | + if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$lp_item_path))) { |
|
| 3533 | 3533 | // if file not found. |
| 3534 | 3534 | $decoded = html_entity_decode($lp_item_path); |
| 3535 | 3535 | list ($decoded) = explode('?', $decoded); |
| 3536 | - if (!is_file(realpath($sys_course_path . '/scorm/' . $lp_path . '/' . $decoded))) { |
|
| 3536 | + if (!is_file(realpath($sys_course_path.'/scorm/'.$lp_path.'/'.$decoded))) { |
|
| 3537 | 3537 | require_once 'resourcelinker.inc.php'; |
| 3538 | 3538 | $file = rl_get_resource_link_for_learnpath( |
| 3539 | 3539 | $course_id, |
@@ -3553,14 +3553,14 @@ discard block |
||
| 3553 | 3553 | } |
| 3554 | 3554 | } |
| 3555 | 3555 | } else { |
| 3556 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $decoded; |
|
| 3556 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$decoded; |
|
| 3557 | 3557 | } |
| 3558 | 3558 | } |
| 3559 | 3559 | } |
| 3560 | 3560 | |
| 3561 | 3561 | // We want to use parameters if they were defined in the imsmanifest |
| 3562 | 3562 | if (strpos($file, 'blank.php') === false) { |
| 3563 | - $file .= (strstr($file, '?') === false ? '?' : '') . $lp_item_params; |
|
| 3563 | + $file .= (strstr($file, '?') === false ? '?' : '').$lp_item_params; |
|
| 3564 | 3564 | } |
| 3565 | 3565 | } else { |
| 3566 | 3566 | $file = 'lp_content.php?type=dir'; |
@@ -3568,12 +3568,12 @@ discard block |
||
| 3568 | 3568 | break; |
| 3569 | 3569 | case 3 : |
| 3570 | 3570 | if ($this->debug > 2) { |
| 3571 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Item type: ' . $lp_item_type, 0); |
|
| 3571 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Item type: '.$lp_item_type, 0); |
|
| 3572 | 3572 | } |
| 3573 | 3573 | // Formatting AICC HACP append URL. |
| 3574 | - $aicc_append = '?aicc_sid=' . urlencode(session_id()) . '&aicc_url=' . urlencode(api_get_path(WEB_CODE_PATH) . 'newscorm/aicc_hacp.php') . '&'; |
|
| 3574 | + $aicc_append = '?aicc_sid='.urlencode(session_id()).'&aicc_url='.urlencode(api_get_path(WEB_CODE_PATH).'newscorm/aicc_hacp.php').'&'; |
|
| 3575 | 3575 | if (!empty($lp_item_params)) { |
| 3576 | - $aicc_append .= $lp_item_params . '&'; |
|
| 3576 | + $aicc_append .= $lp_item_params.'&'; |
|
| 3577 | 3577 | } |
| 3578 | 3578 | if ($lp_item_type != 'dir') { |
| 3579 | 3579 | // Quite complex here: |
@@ -3585,7 +3585,7 @@ discard block |
||
| 3585 | 3585 | |
| 3586 | 3586 | if (preg_match('#^[a-zA-Z]{2,5}://#', $lp_item_path) != 0) { |
| 3587 | 3587 | if ($this->debug > 2) { |
| 3588 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - Found match for protocol in ' . $lp_item_path, 0); |
|
| 3588 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - Found match for protocol in '.$lp_item_path, 0); |
|
| 3589 | 3589 | } |
| 3590 | 3590 | // Distant url, return as is. |
| 3591 | 3591 | $file = $lp_item_path; |
@@ -3598,19 +3598,19 @@ discard block |
||
| 3598 | 3598 | if (stripos($file, '<servername>') !== false) { |
| 3599 | 3599 | //$file = str_replace('<servername>',$course_path.'/scorm/'.$lp_path.'/',$lp_item_path); |
| 3600 | 3600 | $web_course_path = str_replace('https://', '', str_replace('http://', '', $course_path)); |
| 3601 | - $file = str_replace('<servername>', $web_course_path . '/scorm/' . $lp_path, $lp_item_path); |
|
| 3601 | + $file = str_replace('<servername>', $web_course_path.'/scorm/'.$lp_path, $lp_item_path); |
|
| 3602 | 3602 | } |
| 3603 | 3603 | // |
| 3604 | 3604 | $file .= $aicc_append; |
| 3605 | 3605 | } else { |
| 3606 | 3606 | if ($this->debug > 2) { |
| 3607 | - error_log('New LP - In learnpath::get_link() ' . __LINE__ . ' - No starting protocol in ' . $lp_item_path, 0); |
|
| 3607 | + error_log('New LP - In learnpath::get_link() '.__LINE__.' - No starting protocol in '.$lp_item_path, 0); |
|
| 3608 | 3608 | } |
| 3609 | 3609 | // Prevent getting untranslatable urls. |
| 3610 | 3610 | $lp_item_path = preg_replace('/%2F/', '/', $lp_item_path); |
| 3611 | 3611 | $lp_item_path = preg_replace('/%3A/', ':', $lp_item_path); |
| 3612 | 3612 | // Prepare the path - lp_path might be unusable because it includes the "aicc" subdir name. |
| 3613 | - $file = $course_path . '/scorm/' . $lp_path . '/' . $lp_item_path; |
|
| 3613 | + $file = $course_path.'/scorm/'.$lp_path.'/'.$lp_item_path; |
|
| 3614 | 3614 | // TODO: Fix this for urls with protocol header. |
| 3615 | 3615 | $file = str_replace('//', '/', $file); |
| 3616 | 3616 | $file = str_replace(':/', '://', $file); |
@@ -3629,7 +3629,7 @@ discard block |
||
| 3629 | 3629 | $file = !empty($file) ? str_replace('&', '&', $file) : ''; |
| 3630 | 3630 | } |
| 3631 | 3631 | if ($this->debug > 2) { |
| 3632 | - error_log('New LP - In learnpath::get_link() - returning "' . $file . '" from get_link', 0); |
|
| 3632 | + error_log('New LP - In learnpath::get_link() - returning "'.$file.'" from get_link', 0); |
|
| 3633 | 3633 | } |
| 3634 | 3634 | return $file; |
| 3635 | 3635 | } |
@@ -3647,7 +3647,7 @@ discard block |
||
| 3647 | 3647 | $search = ''; |
| 3648 | 3648 | // Use $attempt_num to enable multi-views management (disabled so far). |
| 3649 | 3649 | if ($attempt_num != 0 AND intval(strval($attempt_num)) == $attempt_num) { |
| 3650 | - $search = 'AND view_count = ' . $attempt_num; |
|
| 3650 | + $search = 'AND view_count = '.$attempt_num; |
|
| 3651 | 3651 | } |
| 3652 | 3652 | // When missing $attempt_num, search for a unique lp_view record for this lp and user. |
| 3653 | 3653 | $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW); |
@@ -3657,9 +3657,9 @@ discard block |
||
| 3657 | 3657 | |
| 3658 | 3658 | $sql = "SELECT id, view_count FROM $lp_view_table |
| 3659 | 3659 | WHERE |
| 3660 | - c_id = " . $course_id . " AND |
|
| 3661 | - lp_id = " . $this->get_id() . " AND |
|
| 3662 | - user_id = " . $this->get_user_id() . " AND |
|
| 3660 | + c_id = ".$course_id." AND |
|
| 3661 | + lp_id = " . $this->get_id()." AND |
|
| 3662 | + user_id = " . $this->get_user_id()." AND |
|
| 3663 | 3663 | session_id = $sessionId |
| 3664 | 3664 | $search |
| 3665 | 3665 | ORDER BY view_count DESC"; |
@@ -3670,7 +3670,7 @@ discard block |
||
| 3670 | 3670 | } else if (!api_is_invitee()) { |
| 3671 | 3671 | // There is no database record, create one. |
| 3672 | 3672 | $sql = "INSERT INTO $lp_view_table (c_id, lp_id,user_id, view_count, session_id) VALUES |
| 3673 | - ($course_id, " . $this->get_id() . "," . $this->get_user_id() . ", 1, $sessionId)"; |
|
| 3673 | + ($course_id, ".$this->get_id().",".$this->get_user_id().", 1, $sessionId)"; |
|
| 3674 | 3674 | Database::query($sql); |
| 3675 | 3675 | $id = Database :: insert_id(); |
| 3676 | 3676 | $this->lp_view_id = $id; |
@@ -3770,15 +3770,15 @@ discard block |
||
| 3770 | 3770 | { |
| 3771 | 3771 | $course_id = api_get_course_int_id(); |
| 3772 | 3772 | if ($this->debug > 0) { |
| 3773 | - error_log('New LP - In learnpath::move_item(' . $id . ',' . $direction . ')', 0); |
|
| 3773 | + error_log('New LP - In learnpath::move_item('.$id.','.$direction.')', 0); |
|
| 3774 | 3774 | } |
| 3775 | 3775 | if (empty($id) || empty($direction)) { |
| 3776 | 3776 | return false; |
| 3777 | 3777 | } |
| 3778 | 3778 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 3779 | 3779 | $sql_sel = "SELECT * |
| 3780 | - FROM " . $tbl_lp_item . " |
|
| 3781 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
| 3780 | + FROM " . $tbl_lp_item." |
|
| 3781 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
| 3782 | 3782 | $res_sel = Database::query($sql_sel); |
| 3783 | 3783 | // Check if elem exists. |
| 3784 | 3784 | if (Database :: num_rows($res_sel) < 1) { |
@@ -3803,7 +3803,7 @@ discard block |
||
| 3803 | 3803 | WHERE c_id = ".$course_id." AND id = $previous"; |
| 3804 | 3804 | |
| 3805 | 3805 | if ($this->debug > 2) { |
| 3806 | - error_log('Selecting previous: ' . $sql_sel2, 0); |
|
| 3806 | + error_log('Selecting previous: '.$sql_sel2, 0); |
|
| 3807 | 3807 | } |
| 3808 | 3808 | $res_sel2 = Database::query($sql_sel2); |
| 3809 | 3809 | if (Database :: num_rows($res_sel2) < 1) { |
@@ -3856,7 +3856,7 @@ discard block |
||
| 3856 | 3856 | } |
| 3857 | 3857 | Database::query($sql_upd2); |
| 3858 | 3858 | } |
| 3859 | - $display = $display -1; |
|
| 3859 | + $display = $display - 1; |
|
| 3860 | 3860 | } |
| 3861 | 3861 | break; |
| 3862 | 3862 | case 'down': |
@@ -3867,7 +3867,7 @@ discard block |
||
| 3867 | 3867 | } else { |
| 3868 | 3868 | $sql_sel2 = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = $next"; |
| 3869 | 3869 | if ($this->debug > 2) { |
| 3870 | - error_log('Selecting next: ' . $sql_sel2, 0); |
|
| 3870 | + error_log('Selecting next: '.$sql_sel2, 0); |
|
| 3871 | 3871 | } |
| 3872 | 3872 | $res_sel2 = Database::query($sql_sel2); |
| 3873 | 3873 | if (Database :: num_rows($res_sel2) < 1) { |
@@ -3905,7 +3905,7 @@ discard block |
||
| 3905 | 3905 | WHERE c_id = ".$course_id." AND id = $next_next"; |
| 3906 | 3906 | Database::query($sql_upd2); |
| 3907 | 3907 | } |
| 3908 | - $display = $display +1; |
|
| 3908 | + $display = $display + 1; |
|
| 3909 | 3909 | } |
| 3910 | 3910 | break; |
| 3911 | 3911 | default : |
@@ -3928,8 +3928,8 @@ discard block |
||
| 3928 | 3928 | $res = Database::query($sql); |
| 3929 | 3929 | if ($res === false) |
| 3930 | 3930 | return false; |
| 3931 | - $lps = array (); |
|
| 3932 | - $lp_order = array (); |
|
| 3931 | + $lps = array(); |
|
| 3932 | + $lp_order = array(); |
|
| 3933 | 3933 | $num = Database :: num_rows($res); |
| 3934 | 3934 | // First check the order is correct, globally (might be wrong because |
| 3935 | 3935 | // of versions < 1.8.4) |
@@ -3939,7 +3939,7 @@ discard block |
||
| 3939 | 3939 | if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it. |
| 3940 | 3940 | $need_fix = true; |
| 3941 | 3941 | $sql_u = "UPDATE $lp_table SET display_order = $i |
| 3942 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
| 3942 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
| 3943 | 3943 | Database::query($sql_u); |
| 3944 | 3944 | } |
| 3945 | 3945 | $row['display_order'] = $i; |
@@ -3952,10 +3952,10 @@ discard block |
||
| 3952 | 3952 | $order = $lps[$lp_id]['display_order']; |
| 3953 | 3953 | if ($order > 1) { // If it's the first element, no need to move up. |
| 3954 | 3954 | $sql_u1 = "UPDATE $lp_table SET display_order = $order |
| 3955 | - WHERE c_id = ".$course_id." AND id = " . $lp_order[$order - 1]; |
|
| 3955 | + WHERE c_id = ".$course_id." AND id = ".$lp_order[$order - 1]; |
|
| 3956 | 3956 | Database::query($sql_u1); |
| 3957 | - $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order - 1) . " |
|
| 3958 | - WHERE c_id = ".$course_id." AND id = " . $lp_id; |
|
| 3957 | + $sql_u2 = "UPDATE $lp_table SET display_order = ".($order - 1)." |
|
| 3958 | + WHERE c_id = ".$course_id." AND id = ".$lp_id; |
|
| 3959 | 3959 | Database::query($sql_u2); |
| 3960 | 3960 | } |
| 3961 | 3961 | } |
@@ -3976,8 +3976,8 @@ discard block |
||
| 3976 | 3976 | if ($res === false) { |
| 3977 | 3977 | return false; |
| 3978 | 3978 | } |
| 3979 | - $lps = array (); |
|
| 3980 | - $lp_order = array (); |
|
| 3979 | + $lps = array(); |
|
| 3980 | + $lp_order = array(); |
|
| 3981 | 3981 | $num = Database :: num_rows($res); |
| 3982 | 3982 | $max = 0; |
| 3983 | 3983 | // First check the order is correct, globally (might be wrong because |
@@ -3989,7 +3989,7 @@ discard block |
||
| 3989 | 3989 | if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it. |
| 3990 | 3990 | $need_fix = true; |
| 3991 | 3991 | $sql_u = "UPDATE $lp_table SET display_order = $i |
| 3992 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
| 3992 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
| 3993 | 3993 | Database::query($sql_u); |
| 3994 | 3994 | } |
| 3995 | 3995 | $row['display_order'] = $i; |
@@ -4002,10 +4002,10 @@ discard block |
||
| 4002 | 4002 | $order = $lps[$lp_id]['display_order']; |
| 4003 | 4003 | if ($order < $max) { // If it's the first element, no need to move up. |
| 4004 | 4004 | $sql_u1 = "UPDATE $lp_table SET display_order = $order |
| 4005 | - WHERE c_id = ".$course_id." AND id = " . $lp_order[$order + 1]; |
|
| 4005 | + WHERE c_id = ".$course_id." AND id = ".$lp_order[$order + 1]; |
|
| 4006 | 4006 | Database::query($sql_u1); |
| 4007 | - $sql_u2 = "UPDATE $lp_table SET display_order = " . ($order + 1) . " |
|
| 4008 | - WHERE c_id = ".$course_id." AND id = " . $lp_id; |
|
| 4007 | + $sql_u2 = "UPDATE $lp_table SET display_order = ".($order + 1)." |
|
| 4008 | + WHERE c_id = ".$course_id." AND id = ".$lp_id; |
|
| 4009 | 4009 | Database::query($sql_u2); |
| 4010 | 4010 | } |
| 4011 | 4011 | } |
@@ -4025,15 +4025,15 @@ discard block |
||
| 4025 | 4025 | $this->autocomplete_parents($this->last); |
| 4026 | 4026 | $new_index = $this->get_next_index(); |
| 4027 | 4027 | if ($this->debug > 2) { |
| 4028 | - error_log('New LP - New index: ' . $new_index, 0); |
|
| 4028 | + error_log('New LP - New index: '.$new_index, 0); |
|
| 4029 | 4029 | } |
| 4030 | 4030 | $this->index = $new_index; |
| 4031 | 4031 | if ($this->debug > 2) { |
| 4032 | - error_log('New LP - Now having orderedlist[' . $new_index . '] = ' . $this->ordered_items[$new_index], 0); |
|
| 4032 | + error_log('New LP - Now having orderedlist['.$new_index.'] = '.$this->ordered_items[$new_index], 0); |
|
| 4033 | 4033 | } |
| 4034 | 4034 | $this->current = $this->ordered_items[$new_index]; |
| 4035 | 4035 | if ($this->debug > 2) { |
| 4036 | - error_log('New LP - new item id is ' . $this->current . '-' . $this->get_current_item_id(), 0); |
|
| 4036 | + error_log('New LP - new item id is '.$this->current.'-'.$this->get_current_item_id(), 0); |
|
| 4037 | 4037 | } |
| 4038 | 4038 | } |
| 4039 | 4039 | |
@@ -4097,7 +4097,7 @@ discard block |
||
| 4097 | 4097 | // Clean spaces. |
| 4098 | 4098 | $prereq_string = str_replace(' ', '', $prereq_string); |
| 4099 | 4099 | if ($debug > 0) { |
| 4100 | - error_log('Found prereq_string: ' . $prereq_string, 0); |
|
| 4100 | + error_log('Found prereq_string: '.$prereq_string, 0); |
|
| 4101 | 4101 | } |
| 4102 | 4102 | // Now send to the parse_prereq() function that will check this component's prerequisites. |
| 4103 | 4103 | $result = $currentItem->parse_prereq( |
@@ -4113,12 +4113,12 @@ discard block |
||
| 4113 | 4113 | } else { |
| 4114 | 4114 | $result = true; |
| 4115 | 4115 | if ($debug > 1) { |
| 4116 | - error_log('$this->items[' . $itemId . '] was not an object', 0); |
|
| 4116 | + error_log('$this->items['.$itemId.'] was not an object', 0); |
|
| 4117 | 4117 | } |
| 4118 | 4118 | } |
| 4119 | 4119 | |
| 4120 | 4120 | if ($debug > 1) { |
| 4121 | - error_log('End of prerequisites_match(). Error message is now ' . $this->error, 0); |
|
| 4121 | + error_log('End of prerequisites_match(). Error message is now '.$this->error, 0); |
|
| 4122 | 4122 | } |
| 4123 | 4123 | return $result; |
| 4124 | 4124 | } |
@@ -4184,12 +4184,12 @@ discard block |
||
| 4184 | 4184 | $row = Database :: fetch_array($result); |
| 4185 | 4185 | $name = domesticate($row['name']); |
| 4186 | 4186 | if ($set_visibility == 'i') { |
| 4187 | - $s = $name . " " . get_lang('LearnpathNotPublished'); |
|
| 4187 | + $s = $name." ".get_lang('LearnpathNotPublished'); |
|
| 4188 | 4188 | $dialogBox = $s; |
| 4189 | 4189 | $v = 0; |
| 4190 | 4190 | } |
| 4191 | 4191 | if ($set_visibility == 'v') { |
| 4192 | - $s = $name . " " . get_lang('LearnpathPublished'); |
|
| 4192 | + $s = $name." ".get_lang('LearnpathPublished'); |
|
| 4193 | 4193 | $dialogBox = $s; |
| 4194 | 4194 | $v = 1; |
| 4195 | 4195 | } |
@@ -4272,9 +4272,9 @@ discard block |
||
| 4272 | 4272 | $course_id = api_get_course_int_id(); |
| 4273 | 4273 | $lp_view_table = Database :: get_course_table(TABLE_LP_VIEW); |
| 4274 | 4274 | $sql = "INSERT INTO $lp_view_table (c_id, lp_id, user_id, view_count, session_id) |
| 4275 | - VALUES ($course_id, " . $this->lp_id . "," . $this->get_user_id() . "," . ($this->attempt + 1) . ", $session_id)"; |
|
| 4275 | + VALUES ($course_id, ".$this->lp_id.",".$this->get_user_id().",".($this->attempt + 1).", $session_id)"; |
|
| 4276 | 4276 | if ($this->debug > 2) { |
| 4277 | - error_log('New LP - Inserting new lp_view for restart: ' . $sql, 0); |
|
| 4277 | + error_log('New LP - Inserting new lp_view for restart: '.$sql, 0); |
|
| 4278 | 4278 | } |
| 4279 | 4279 | $res = Database::query($sql); |
| 4280 | 4280 | $view_id = Database::insert_id(); |
@@ -4312,10 +4312,10 @@ discard block |
||
| 4312 | 4312 | // TODO: Do a better check on the index pointing to the right item (it is supposed to be working |
| 4313 | 4313 | // on $ordered_items[] but not sure it's always safe to use with $items[]). |
| 4314 | 4314 | if ($this->debug > 2) { |
| 4315 | - error_log('New LP - save_current() saving item ' . $this->current, 0); |
|
| 4315 | + error_log('New LP - save_current() saving item '.$this->current, 0); |
|
| 4316 | 4316 | } |
| 4317 | 4317 | if ($this->debug > 2) { |
| 4318 | - error_log('' . print_r($this->items, true), 0); |
|
| 4318 | + error_log(''.print_r($this->items, true), 0); |
|
| 4319 | 4319 | } |
| 4320 | 4320 | if (isset($this->items[$this->current]) && |
| 4321 | 4321 | is_object($this->items[$this->current]) |
@@ -4339,7 +4339,7 @@ discard block |
||
| 4339 | 4339 | { |
| 4340 | 4340 | $debug = $this->debug; |
| 4341 | 4341 | if ($debug) { |
| 4342 | - error_log('In learnpath::save_item(' . $item_id . ',' . intval($from_outside). ')', 0); |
|
| 4342 | + error_log('In learnpath::save_item('.$item_id.','.intval($from_outside).')', 0); |
|
| 4343 | 4343 | } |
| 4344 | 4344 | // TODO: Do a better check on the index pointing to the right item (it is supposed to be working |
| 4345 | 4345 | // on $ordered_items[] but not sure it's always safe to use with $items[]). |
@@ -4362,7 +4362,7 @@ discard block |
||
| 4362 | 4362 | |
| 4363 | 4363 | if ($debug) { |
| 4364 | 4364 | error_log('update_queue before:'); |
| 4365 | - error_log(print_r($this->update_queue,1)); |
|
| 4365 | + error_log(print_r($this->update_queue, 1)); |
|
| 4366 | 4366 | } |
| 4367 | 4367 | $this->autocomplete_parents($item_id); |
| 4368 | 4368 | |
@@ -4370,9 +4370,9 @@ discard block |
||
| 4370 | 4370 | $this->update_queue[$item_id] = $status; |
| 4371 | 4371 | |
| 4372 | 4372 | if ($debug) { |
| 4373 | - error_log('get_status(): ' . $status); |
|
| 4373 | + error_log('get_status(): '.$status); |
|
| 4374 | 4374 | error_log('update_queue after:'); |
| 4375 | - error_log(print_r($this->update_queue,1)); |
|
| 4375 | + error_log(print_r($this->update_queue, 1)); |
|
| 4376 | 4376 | } |
| 4377 | 4377 | return $res; |
| 4378 | 4378 | } |
@@ -4393,17 +4393,17 @@ discard block |
||
| 4393 | 4393 | |
| 4394 | 4394 | if (isset($this->current) && !api_is_invitee()) { |
| 4395 | 4395 | if ($this->debug > 2) { |
| 4396 | - error_log('New LP - Saving current item (' . $this->current . ') for later review', 0); |
|
| 4396 | + error_log('New LP - Saving current item ('.$this->current.') for later review', 0); |
|
| 4397 | 4397 | } |
| 4398 | 4398 | $sql = "UPDATE $table SET |
| 4399 | - last_item = " . intval($this->get_current_item_id()). " |
|
| 4399 | + last_item = ".intval($this->get_current_item_id())." |
|
| 4400 | 4400 | WHERE |
| 4401 | 4401 | c_id = $course_id AND |
| 4402 | - lp_id = " . $this->get_id() . " AND |
|
| 4402 | + lp_id = ".$this->get_id()." AND |
|
| 4403 | 4403 | user_id = " . $this->get_user_id()." ".$session_condition; |
| 4404 | 4404 | |
| 4405 | 4405 | if ($this->debug > 2) { |
| 4406 | - error_log('New LP - Saving last item seen : ' . $sql, 0); |
|
| 4406 | + error_log('New LP - Saving last item seen : '.$sql, 0); |
|
| 4407 | 4407 | } |
| 4408 | 4408 | Database::query($sql); |
| 4409 | 4409 | } |
@@ -4417,7 +4417,7 @@ discard block |
||
| 4417 | 4417 | progress = $progress |
| 4418 | 4418 | WHERE |
| 4419 | 4419 | c_id = ".$course_id." AND |
| 4420 | - lp_id = " . $this->get_id() . " AND |
|
| 4420 | + lp_id = " . $this->get_id()." AND |
|
| 4421 | 4421 | user_id = " . $this->get_user_id()." ".$session_condition; |
| 4422 | 4422 | // Ignore errors as some tables might not have the progress field just yet. |
| 4423 | 4423 | Database::query($sql); |
@@ -4433,7 +4433,7 @@ discard block |
||
| 4433 | 4433 | public function set_current_item($item_id = null) |
| 4434 | 4434 | { |
| 4435 | 4435 | if ($this->debug > 0) { |
| 4436 | - error_log('New LP - In learnpath::set_current_item(' . $item_id . ')', 0); |
|
| 4436 | + error_log('New LP - In learnpath::set_current_item('.$item_id.')', 0); |
|
| 4437 | 4437 | } |
| 4438 | 4438 | if (empty ($item_id)) { |
| 4439 | 4439 | if ($this->debug > 2) { |
@@ -4442,7 +4442,7 @@ discard block |
||
| 4442 | 4442 | // Do nothing. |
| 4443 | 4443 | } else { |
| 4444 | 4444 | if ($this->debug > 2) { |
| 4445 | - error_log('New LP - New current item given is ' . $item_id . '...', 0); |
|
| 4445 | + error_log('New LP - New current item given is '.$item_id.'...', 0); |
|
| 4446 | 4446 | } |
| 4447 | 4447 | if (is_numeric($item_id)) { |
| 4448 | 4448 | $item_id = intval($item_id); |
@@ -4457,10 +4457,10 @@ discard block |
||
| 4457 | 4457 | } |
| 4458 | 4458 | } |
| 4459 | 4459 | if ($this->debug > 2) { |
| 4460 | - error_log('New LP - set_current_item(' . $item_id . ') done. Index is now : ' . $this->index, 0); |
|
| 4460 | + error_log('New LP - set_current_item('.$item_id.') done. Index is now : '.$this->index, 0); |
|
| 4461 | 4461 | } |
| 4462 | 4462 | } else { |
| 4463 | - error_log('New LP - set_current_item(' . $item_id . ') failed. Not a numeric value: ', 0); |
|
| 4463 | + error_log('New LP - set_current_item('.$item_id.') failed. Not a numeric value: ', 0); |
|
| 4464 | 4464 | } |
| 4465 | 4465 | } |
| 4466 | 4466 | } |
@@ -4485,7 +4485,7 @@ discard block |
||
| 4485 | 4485 | $lp = $this->get_id(); |
| 4486 | 4486 | if ($lp != 0) { |
| 4487 | 4487 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
| 4488 | - $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = " . $lp; |
|
| 4488 | + $sql = "UPDATE $tbl_lp SET default_encoding = '$enc' WHERE c_id = ".$course_id." AND id = ".$lp; |
|
| 4489 | 4489 | $res = Database::query($sql); |
| 4490 | 4490 | return $res; |
| 4491 | 4491 | } |
@@ -4509,7 +4509,7 @@ discard block |
||
| 4509 | 4509 | |
| 4510 | 4510 | if ($lp != 0) { |
| 4511 | 4511 | $tbl_lp = Database :: get_course_table(TABLE_LP_MAIN); |
| 4512 | - $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = " . $lp; |
|
| 4512 | + $sql = "UPDATE $tbl_lp SET js_lib = '$lib' WHERE c_id = ".$course_id." AND id = ".$lp; |
|
| 4513 | 4513 | $res = Database::query($sql); |
| 4514 | 4514 | return $res; |
| 4515 | 4515 | } else { |
@@ -4534,10 +4534,10 @@ discard block |
||
| 4534 | 4534 | $course_id = api_get_course_int_id(); |
| 4535 | 4535 | $lp_id = $this->get_id(); |
| 4536 | 4536 | $sql = "UPDATE $lp_table SET |
| 4537 | - content_maker = '" . Database::escape_string($this->maker) . "' |
|
| 4537 | + content_maker = '".Database::escape_string($this->maker)."' |
|
| 4538 | 4538 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4539 | 4539 | if ($this->debug > 2) { |
| 4540 | - error_log('New LP - lp updated with new content_maker : ' . $this->maker, 0); |
|
| 4540 | + error_log('New LP - lp updated with new content_maker : '.$this->maker, 0); |
|
| 4541 | 4541 | } |
| 4542 | 4542 | Database::query($sql); |
| 4543 | 4543 | return true; |
@@ -4561,10 +4561,10 @@ discard block |
||
| 4561 | 4561 | $lp_id = $this->get_id(); |
| 4562 | 4562 | $course_id = $this->course_info['real_id']; |
| 4563 | 4563 | $sql = "UPDATE $lp_table SET |
| 4564 | - name = '" . Database::escape_string($this->name). "' |
|
| 4564 | + name = '".Database::escape_string($this->name)."' |
|
| 4565 | 4565 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4566 | 4566 | if ($this->debug > 2) { |
| 4567 | - error_log('New LP - lp updated with new name : ' . $this->name, 0); |
|
| 4567 | + error_log('New LP - lp updated with new name : '.$this->name, 0); |
|
| 4568 | 4568 | } |
| 4569 | 4569 | $result = Database::query($sql); |
| 4570 | 4570 | // If the lp is visible on the homepage, change his name there. |
@@ -4572,7 +4572,7 @@ discard block |
||
| 4572 | 4572 | $session_id = api_get_session_id(); |
| 4573 | 4573 | $session_condition = api_get_session_condition($session_id); |
| 4574 | 4574 | $tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST); |
| 4575 | - $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id; |
|
| 4575 | + $link = 'newscorm/lp_controller.php?action=view&lp_id='.$lp_id.'&id_session='.$session_id; |
|
| 4576 | 4576 | $sql = "UPDATE $tbl_tool SET name = '$this->name' |
| 4577 | 4577 | WHERE |
| 4578 | 4578 | c_id = $course_id AND |
@@ -4650,10 +4650,10 @@ discard block |
||
| 4650 | 4650 | |
| 4651 | 4651 | // Save it to search engine. |
| 4652 | 4652 | foreach ($missing_terms as $term) { |
| 4653 | - $doc->add_term($prefix . $term, 1); |
|
| 4653 | + $doc->add_term($prefix.$term, 1); |
|
| 4654 | 4654 | } |
| 4655 | 4655 | foreach ($deprecated_terms as $term) { |
| 4656 | - $doc->remove_term($prefix . $term); |
|
| 4656 | + $doc->remove_term($prefix.$term); |
|
| 4657 | 4657 | } |
| 4658 | 4658 | $di->getDb()->replace_document((int) $se_ref['search_did'], $doc); |
| 4659 | 4659 | $di->getDb()->flush(); |
@@ -4678,10 +4678,10 @@ discard block |
||
| 4678 | 4678 | $this->theme = $name; |
| 4679 | 4679 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4680 | 4680 | $lp_id = $this->get_id(); |
| 4681 | - $sql = "UPDATE $lp_table SET theme = '" . Database::escape_string($this->theme). "' |
|
| 4681 | + $sql = "UPDATE $lp_table SET theme = '".Database::escape_string($this->theme)."' |
|
| 4682 | 4682 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4683 | 4683 | if ($this->debug > 2) { |
| 4684 | - error_log('New LP - lp updated with new theme : ' . $this->theme, 0); |
|
| 4684 | + error_log('New LP - lp updated with new theme : '.$this->theme, 0); |
|
| 4685 | 4685 | } |
| 4686 | 4686 | Database::query($sql); |
| 4687 | 4687 | |
@@ -4704,10 +4704,10 @@ discard block |
||
| 4704 | 4704 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4705 | 4705 | $lp_id = $this->get_id(); |
| 4706 | 4706 | $sql = "UPDATE $lp_table SET |
| 4707 | - preview_image = '" . Database::escape_string($this->preview_image). "' |
|
| 4707 | + preview_image = '".Database::escape_string($this->preview_image)."' |
|
| 4708 | 4708 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4709 | 4709 | if ($this->debug > 2) { |
| 4710 | - error_log('New LP - lp updated with new preview image : ' . $this->preview_image, 0); |
|
| 4710 | + error_log('New LP - lp updated with new preview image : '.$this->preview_image, 0); |
|
| 4711 | 4711 | } |
| 4712 | 4712 | Database::query($sql); |
| 4713 | 4713 | return true; |
@@ -4727,10 +4727,10 @@ discard block |
||
| 4727 | 4727 | $this->author = $name; |
| 4728 | 4728 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4729 | 4729 | $lp_id = $this->get_id(); |
| 4730 | - $sql = "UPDATE $lp_table SET author = '" . Database::escape_string($name). "' |
|
| 4730 | + $sql = "UPDATE $lp_table SET author = '".Database::escape_string($name)."' |
|
| 4731 | 4731 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4732 | 4732 | if ($this->debug > 2) { |
| 4733 | - error_log('New LP - lp updated with new preview author : ' . $this->author, 0); |
|
| 4733 | + error_log('New LP - lp updated with new preview author : '.$this->author, 0); |
|
| 4734 | 4734 | } |
| 4735 | 4735 | Database::query($sql); |
| 4736 | 4736 | |
@@ -4748,15 +4748,15 @@ discard block |
||
| 4748 | 4748 | if ($this->debug > 0) { |
| 4749 | 4749 | error_log('New LP - In learnpath::set_hide_toc_frame()', 0); |
| 4750 | 4750 | } |
| 4751 | - if (intval($hide) == $hide){ |
|
| 4751 | + if (intval($hide) == $hide) { |
|
| 4752 | 4752 | $this->hide_toc_frame = $hide; |
| 4753 | 4753 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4754 | 4754 | $lp_id = $this->get_id(); |
| 4755 | 4755 | $sql = "UPDATE $lp_table SET |
| 4756 | - hide_toc_frame = '" . $this->hide_toc_frame . "' |
|
| 4756 | + hide_toc_frame = '".$this->hide_toc_frame."' |
|
| 4757 | 4757 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4758 | 4758 | if ($this->debug > 2) { |
| 4759 | - error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0); |
|
| 4759 | + error_log('New LP - lp updated with new preview hide_toc_frame : '.$this->author, 0); |
|
| 4760 | 4760 | } |
| 4761 | 4761 | Database::query($sql); |
| 4762 | 4762 | |
@@ -4783,7 +4783,7 @@ discard block |
||
| 4783 | 4783 | $sql = "UPDATE $lp_table SET prerequisite = '".$this->prerequisite."' |
| 4784 | 4784 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4785 | 4785 | if ($this->debug > 2) { |
| 4786 | - error_log('New LP - lp updated with new preview requisite : ' . $this->requisite, 0); |
|
| 4786 | + error_log('New LP - lp updated with new preview requisite : '.$this->requisite, 0); |
|
| 4787 | 4787 | } |
| 4788 | 4788 | Database::query($sql); |
| 4789 | 4789 | return true; |
@@ -4807,10 +4807,10 @@ discard block |
||
| 4807 | 4807 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4808 | 4808 | $lp_id = $this->get_id(); |
| 4809 | 4809 | $sql = "UPDATE $lp_table SET |
| 4810 | - content_local = '" . Database::escape_string($name) . "' |
|
| 4810 | + content_local = '".Database::escape_string($name)."' |
|
| 4811 | 4811 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4812 | 4812 | if ($this->debug > 2) { |
| 4813 | - error_log('New LP - lp updated with new proximity : ' . $this->proximity, 0); |
|
| 4813 | + error_log('New LP - lp updated with new proximity : '.$this->proximity, 0); |
|
| 4814 | 4814 | } |
| 4815 | 4815 | Database::query($sql); |
| 4816 | 4816 | return true; |
@@ -4844,11 +4844,11 @@ discard block |
||
| 4844 | 4844 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4845 | 4845 | $lp_id = $this->get_id(); |
| 4846 | 4846 | $sql = "UPDATE $lp_table SET |
| 4847 | - use_max_score = '" . $this->use_max_score . "' |
|
| 4847 | + use_max_score = '".$this->use_max_score."' |
|
| 4848 | 4848 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4849 | 4849 | |
| 4850 | 4850 | if ($this->debug > 2) { |
| 4851 | - error_log('New LP - lp updated with new use_max_score : ' . $this->use_max_score, 0); |
|
| 4851 | + error_log('New LP - lp updated with new use_max_score : '.$this->use_max_score, 0); |
|
| 4852 | 4852 | } |
| 4853 | 4853 | Database::query($sql); |
| 4854 | 4854 | |
@@ -4875,10 +4875,10 @@ discard block |
||
| 4875 | 4875 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4876 | 4876 | $lp_id = $this->get_id(); |
| 4877 | 4877 | $sql = "UPDATE $lp_table SET |
| 4878 | - expired_on = '" . Database::escape_string($this->expired_on) . "' |
|
| 4878 | + expired_on = '".Database::escape_string($this->expired_on)."' |
|
| 4879 | 4879 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4880 | 4880 | if ($this->debug > 2) { |
| 4881 | - error_log('New LP - lp updated with new expired_on : ' . $this->expired_on, 0); |
|
| 4881 | + error_log('New LP - lp updated with new expired_on : '.$this->expired_on, 0); |
|
| 4882 | 4882 | } |
| 4883 | 4883 | Database::query($sql); |
| 4884 | 4884 | |
@@ -4904,10 +4904,10 @@ discard block |
||
| 4904 | 4904 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4905 | 4905 | $lp_id = $this->get_id(); |
| 4906 | 4906 | $sql = "UPDATE $lp_table SET |
| 4907 | - publicated_on = '" . Database::escape_string($this->publicated_on) . "' |
|
| 4907 | + publicated_on = '".Database::escape_string($this->publicated_on)."' |
|
| 4908 | 4908 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4909 | 4909 | if ($this->debug > 2) { |
| 4910 | - error_log('New LP - lp updated with new publicated_on : ' . $this->publicated_on, 0); |
|
| 4910 | + error_log('New LP - lp updated with new publicated_on : '.$this->publicated_on, 0); |
|
| 4911 | 4911 | } |
| 4912 | 4912 | Database::query($sql); |
| 4913 | 4913 | |
@@ -4927,10 +4927,10 @@ discard block |
||
| 4927 | 4927 | $this->modified_on = api_get_utc_datetime(); |
| 4928 | 4928 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 4929 | 4929 | $lp_id = $this->get_id(); |
| 4930 | - $sql = "UPDATE $lp_table SET modified_on = '" . $this->modified_on . "' |
|
| 4930 | + $sql = "UPDATE $lp_table SET modified_on = '".$this->modified_on."' |
|
| 4931 | 4931 | WHERE c_id = ".$course_id." AND id = '$lp_id'"; |
| 4932 | 4932 | if ($this->debug > 2) { |
| 4933 | - error_log('New LP - lp updated with new expired_on : ' . $this->modified_on, 0); |
|
| 4933 | + error_log('New LP - lp updated with new expired_on : '.$this->modified_on, 0); |
|
| 4934 | 4934 | } |
| 4935 | 4935 | Database::query($sql); |
| 4936 | 4936 | return true; |
@@ -5001,13 +5001,13 @@ discard block |
||
| 5001 | 5001 | |
| 5002 | 5002 | if ($this->last != 0 && $this->last != $this->current && is_object($this->items[$this->last])) { |
| 5003 | 5003 | if ($this->debug > 2) { |
| 5004 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' is object', 0); |
|
| 5004 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' is object', 0); |
|
| 5005 | 5005 | } |
| 5006 | 5006 | switch ($this->get_type()) { |
| 5007 | 5007 | case '3' : |
| 5008 | 5008 | if ($this->items[$this->last]->get_type() != 'au') { |
| 5009 | 5009 | if ($this->debug > 2) { |
| 5010 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 3 is <> au', 0); |
|
| 5010 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 3 is <> au', 0); |
|
| 5011 | 5011 | } |
| 5012 | 5012 | $this->items[$this->last]->close(); |
| 5013 | 5013 | //$this->autocomplete_parents($this->last); |
@@ -5020,7 +5020,7 @@ discard block |
||
| 5020 | 5020 | case '2' : |
| 5021 | 5021 | if ($this->items[$this->last]->get_type() != 'sco') { |
| 5022 | 5022 | if ($this->debug > 2) { |
| 5023 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 2 is <> sco', 0); |
|
| 5023 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 2 is <> sco', 0); |
|
| 5024 | 5024 | } |
| 5025 | 5025 | $this->items[$this->last]->close(); |
| 5026 | 5026 | //$this->autocomplete_parents($this->last); |
@@ -5034,7 +5034,7 @@ discard block |
||
| 5034 | 5034 | case '1' : |
| 5035 | 5035 | default : |
| 5036 | 5036 | if ($this->debug > 2) { |
| 5037 | - error_log('New LP - In learnpath::stop_previous_item() - ' . $this->last . ' in lp_type 1 is asset', 0); |
|
| 5037 | + error_log('New LP - In learnpath::stop_previous_item() - '.$this->last.' in lp_type 1 is asset', 0); |
|
| 5038 | 5038 | } |
| 5039 | 5039 | $this->items[$this->last]->close(); |
| 5040 | 5040 | break; |
@@ -5060,7 +5060,7 @@ discard block |
||
| 5060 | 5060 | } |
| 5061 | 5061 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5062 | 5062 | $sql = "SELECT * FROM $lp_table |
| 5063 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5063 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5064 | 5064 | $res = Database::query($sql); |
| 5065 | 5065 | if (Database :: num_rows($res) > 0) { |
| 5066 | 5066 | $row = Database :: fetch_array($res); |
@@ -5081,14 +5081,14 @@ discard block |
||
| 5081 | 5081 | break; |
| 5082 | 5082 | } |
| 5083 | 5083 | $sql = "UPDATE $lp_table SET default_view_mod = '$view_mode' |
| 5084 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5084 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5085 | 5085 | Database::query($sql); |
| 5086 | 5086 | $this->mode = $view_mode; |
| 5087 | 5087 | |
| 5088 | 5088 | return $view_mode; |
| 5089 | 5089 | } else { |
| 5090 | 5090 | if ($this->debug > 2) { |
| 5091 | - error_log('New LP - Problem in update_default_view() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
| 5091 | + error_log('New LP - Problem in update_default_view() - could not find LP '.$this->get_id().' in DB', 0); |
|
| 5092 | 5092 | } |
| 5093 | 5093 | } |
| 5094 | 5094 | return -1; |
@@ -5106,7 +5106,7 @@ discard block |
||
| 5106 | 5106 | } |
| 5107 | 5107 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5108 | 5108 | $sql = "SELECT * FROM $lp_table |
| 5109 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5109 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5110 | 5110 | $res = Database::query($sql); |
| 5111 | 5111 | if (Database :: num_rows($res) > 0) { |
| 5112 | 5112 | $row = Database :: fetch_array($res); |
@@ -5119,14 +5119,14 @@ discard block |
||
| 5119 | 5119 | $force_return = true; |
| 5120 | 5120 | } |
| 5121 | 5121 | $sql = "UPDATE $lp_table SET force_commit = $force |
| 5122 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5122 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5123 | 5123 | Database::query($sql); |
| 5124 | 5124 | $this->force_commit = $force_return; |
| 5125 | 5125 | |
| 5126 | 5126 | return $force_return; |
| 5127 | 5127 | } else { |
| 5128 | 5128 | if ($this->debug > 2) { |
| 5129 | - error_log('New LP - Problem in update_default_scorm_commit() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
| 5129 | + error_log('New LP - Problem in update_default_scorm_commit() - could not find LP '.$this->get_id().' in DB', 0); |
|
| 5130 | 5130 | } |
| 5131 | 5131 | } |
| 5132 | 5132 | return -1; |
@@ -5155,7 +5155,7 @@ discard block |
||
| 5155 | 5155 | if ($row['display_order'] != $i) { // If we find a gap in the order, we need to fix it. |
| 5156 | 5156 | $need_fix = true; |
| 5157 | 5157 | $sql = "UPDATE $lp_table SET display_order = $i |
| 5158 | - WHERE c_id = ".$course_id." AND id = " . $row['id']; |
|
| 5158 | + WHERE c_id = ".$course_id." AND id = ".$row['id']; |
|
| 5159 | 5159 | Database::query($sql); |
| 5160 | 5160 | } |
| 5161 | 5161 | $i++; |
@@ -5176,7 +5176,7 @@ discard block |
||
| 5176 | 5176 | } |
| 5177 | 5177 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5178 | 5178 | $sql = "SELECT * FROM $lp_table |
| 5179 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5179 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5180 | 5180 | $res = Database::query($sql); |
| 5181 | 5181 | if (Database :: num_rows($res) > 0) { |
| 5182 | 5182 | $row = Database :: fetch_array($res); |
@@ -5187,13 +5187,13 @@ discard block |
||
| 5187 | 5187 | $force = 1; |
| 5188 | 5188 | } |
| 5189 | 5189 | $sql = "UPDATE $lp_table SET prevent_reinit = $force |
| 5190 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5190 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5191 | 5191 | Database::query($sql); |
| 5192 | 5192 | $this->prevent_reinit = $force; |
| 5193 | 5193 | return $force; |
| 5194 | 5194 | } else { |
| 5195 | 5195 | if ($this->debug > 2) { |
| 5196 | - error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
| 5196 | + error_log('New LP - Problem in update_reinit() - could not find LP '.$this->get_id().' in DB', 0); |
|
| 5197 | 5197 | } |
| 5198 | 5198 | } |
| 5199 | 5199 | return -1; |
@@ -5209,11 +5209,11 @@ discard block |
||
| 5209 | 5209 | { |
| 5210 | 5210 | //Set default value for seriousgame_mode |
| 5211 | 5211 | if (!isset($this->seriousgame_mode)) { |
| 5212 | - $this->seriousgame_mode=0; |
|
| 5212 | + $this->seriousgame_mode = 0; |
|
| 5213 | 5213 | } |
| 5214 | 5214 | // Set default value for prevent_reinit |
| 5215 | 5215 | if (!isset($this->prevent_reinit)) { |
| 5216 | - $this->prevent_reinit =1; |
|
| 5216 | + $this->prevent_reinit = 1; |
|
| 5217 | 5217 | } |
| 5218 | 5218 | if ($this->seriousgame_mode == 1 && $this->prevent_reinit == 1) { |
| 5219 | 5219 | return 'seriousgame'; |
@@ -5261,7 +5261,7 @@ discard block |
||
| 5261 | 5261 | $sql = "UPDATE $lp_table SET |
| 5262 | 5262 | prevent_reinit = $prevent_reinit , |
| 5263 | 5263 | seriousgame_mode = $sg_mode |
| 5264 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5264 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5265 | 5265 | $res = Database::query($sql); |
| 5266 | 5266 | if ($res) { |
| 5267 | 5267 | return true; |
@@ -5313,7 +5313,7 @@ discard block |
||
| 5313 | 5313 | error_log('New LP - In learnpath::set_seriousgame_mode()', 0); |
| 5314 | 5314 | } |
| 5315 | 5315 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5316 | - $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5316 | + $sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5317 | 5317 | $res = Database::query($sql); |
| 5318 | 5318 | if (Database :: num_rows($res) > 0) { |
| 5319 | 5319 | $row = Database :: fetch_array($res); |
@@ -5324,13 +5324,13 @@ discard block |
||
| 5324 | 5324 | $force = 1; |
| 5325 | 5325 | } |
| 5326 | 5326 | $sql = "UPDATE $lp_table SET seriousgame_mode = $force |
| 5327 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5327 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5328 | 5328 | Database::query($sql); |
| 5329 | 5329 | $this->seriousgame_mode = $force; |
| 5330 | 5330 | return $force; |
| 5331 | 5331 | } else { |
| 5332 | 5332 | if ($this->debug > 2) { |
| 5333 | - error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
| 5333 | + error_log('New LP - Problem in set_seriousgame_mode() - could not find LP '.$this->get_id().' in DB', 0); |
|
| 5334 | 5334 | } |
| 5335 | 5335 | } |
| 5336 | 5336 | return -1; |
@@ -5348,7 +5348,7 @@ discard block |
||
| 5348 | 5348 | } |
| 5349 | 5349 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5350 | 5350 | $sql = "SELECT * FROM $lp_table |
| 5351 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5351 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5352 | 5352 | $res = Database::query($sql); |
| 5353 | 5353 | if (Database :: num_rows($res) > 0) { |
| 5354 | 5354 | $row = Database :: fetch_array($res); |
@@ -5359,13 +5359,13 @@ discard block |
||
| 5359 | 5359 | $force = 1; |
| 5360 | 5360 | } |
| 5361 | 5361 | $sql = "UPDATE $lp_table SET debug = $force |
| 5362 | - WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
|
| 5362 | + WHERE c_id = ".$course_id." AND id = ".$this->get_id(); |
|
| 5363 | 5363 | $res = Database::query($sql); |
| 5364 | 5364 | $this->scorm_debug = $force; |
| 5365 | 5365 | return $force; |
| 5366 | 5366 | } else { |
| 5367 | 5367 | if ($this->debug > 2) { |
| 5368 | - error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0); |
|
| 5368 | + error_log('New LP - Problem in update_scorm_debug() - could not find LP '.$this->get_id().' in DB', 0); |
|
| 5369 | 5369 | } |
| 5370 | 5370 | } |
| 5371 | 5371 | return -1; |
@@ -5394,7 +5394,7 @@ discard block |
||
| 5394 | 5394 | * @param int $depth |
| 5395 | 5395 | * @param array $tmp |
| 5396 | 5396 | */ |
| 5397 | - public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array ()) |
|
| 5397 | + public function create_tree_array($array, $parent = 0, $depth = -1, $tmp = array()) |
|
| 5398 | 5398 | { |
| 5399 | 5399 | if ($this->debug > 1) { |
| 5400 | 5400 | error_log('New LP - In learnpath::create_tree_array())', 0); |
@@ -5480,7 +5480,7 @@ discard block |
||
| 5480 | 5480 | |
| 5481 | 5481 | // we need to start a form when we want to update all the mp3 files |
| 5482 | 5482 | if ($update_audio == 'true') { |
| 5483 | - $return .= '<form action="' . api_get_self() . '?cidReq=' . Security :: remove_XSS($_GET['cidReq']) . '&updateaudio=' . Security :: remove_XSS($_GET['updateaudio']) .'&action=' . Security :: remove_XSS($_GET['action']) . '&lp_id=' . $_SESSION['oLP']->lp_id . '" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">'; |
|
| 5483 | + $return .= '<form action="'.api_get_self().'?cidReq='.Security :: remove_XSS($_GET['cidReq']).'&updateaudio='.Security :: remove_XSS($_GET['updateaudio']).'&action='.Security :: remove_XSS($_GET['action']).'&lp_id='.$_SESSION['oLP']->lp_id.'" method="post" enctype="multipart/form-data" name="updatemp3" id="updatemp3">'; |
|
| 5484 | 5484 | } |
| 5485 | 5485 | $return .= '<div id="message"></div>'; |
| 5486 | 5486 | if (count($this->items) == 0) { |
@@ -5488,14 +5488,14 @@ discard block |
||
| 5488 | 5488 | } else { |
| 5489 | 5489 | $return_audio = '<table class="data_table">'; |
| 5490 | 5490 | $return_audio .= '<tr>'; |
| 5491 | - $return_audio .= '<th width="40%">' . get_lang('Title') . '</th>'; |
|
| 5492 | - $return_audio .= '<th>' . get_lang('Audio') . '</th>'; |
|
| 5491 | + $return_audio .= '<th width="40%">'.get_lang('Title').'</th>'; |
|
| 5492 | + $return_audio .= '<th>'.get_lang('Audio').'</th>'; |
|
| 5493 | 5493 | $return_audio .= '</tr>'; |
| 5494 | 5494 | |
| 5495 | 5495 | if ($update_audio != 'true') { |
| 5496 | 5496 | $return .= '<div class="col-md-12">'; |
| 5497 | 5497 | $return .= self::return_new_tree($update_audio); |
| 5498 | - $return .='</div>'; |
|
| 5498 | + $return .= '</div>'; |
|
| 5499 | 5499 | $return .= Display::div(Display::url(get_lang('Save'), '#', array('id'=>'listSubmit', 'class'=>'btn btn-primary')), array('style'=>'float:left; margin-top:15px;width:100%')); |
| 5500 | 5500 | } else { |
| 5501 | 5501 | $return_audio .= self::return_new_tree($update_audio); |
@@ -5505,7 +5505,7 @@ discard block |
||
| 5505 | 5505 | // We need to close the form when we are updating the mp3 files. |
| 5506 | 5506 | if ($update_audio == 'true') { |
| 5507 | 5507 | $return .= '<div class="footer-audio">'; |
| 5508 | - $return .= Display::button('save_audio','<em class="fa fa-file-audio-o"></em> '. get_lang('SaveAudioAndOrganization'),array('class'=>'btn btn-primary','type'=>'submit')); |
|
| 5508 | + $return .= Display::button('save_audio', '<em class="fa fa-file-audio-o"></em> '.get_lang('SaveAudioAndOrganization'), array('class'=>'btn btn-primary', 'type'=>'submit')); |
|
| 5509 | 5509 | $return .= '</div>'; |
| 5510 | 5510 | //$return .= '<div><button class="btn btn-primary" type="submit" name="save_audio" id="save_audio">' . get_lang('SaveAudioAndOrganization') . '</button></div>'; // TODO: What kind of language variable is this? |
| 5511 | 5511 | } |
@@ -5526,7 +5526,7 @@ discard block |
||
| 5526 | 5526 | public function return_new_tree($update_audio = 'false', $drop_element_here = false) |
| 5527 | 5527 | { |
| 5528 | 5528 | $return = ''; |
| 5529 | - $is_allowed_to_edit = api_is_allowed_to_edit(null,true); |
|
| 5529 | + $is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
| 5530 | 5530 | |
| 5531 | 5531 | $course_id = api_get_course_int_id(); |
| 5532 | 5532 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
@@ -5574,7 +5574,7 @@ discard block |
||
| 5574 | 5574 | |
| 5575 | 5575 | // Link for the documents |
| 5576 | 5576 | if ($arrLP[$i]['item_type'] == 'document') { |
| 5577 | - $url = api_get_self() . '?'.api_get_cidreq().'&action=view_item&mode=preview_document&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id; |
|
| 5577 | + $url = api_get_self().'?'.api_get_cidreq().'&action=view_item&mode=preview_document&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
|
| 5578 | 5578 | $title_cut = Display::url( |
| 5579 | 5579 | $title_cut, |
| 5580 | 5580 | $url, |
@@ -5590,14 +5590,14 @@ discard block |
||
| 5590 | 5590 | } else { |
| 5591 | 5591 | $oddClass = 'row_even'; |
| 5592 | 5592 | } |
| 5593 | - $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'] .'" class="' . $oddClass . '">'; |
|
| 5593 | + $return_audio .= '<tr id ="lp_item_'.$arrLP[$i]['id'].'" class="'.$oddClass.'">'; |
|
| 5594 | 5594 | |
| 5595 | 5595 | $icon_name = str_replace(' ', '', $arrLP[$i]['item_type']); |
| 5596 | 5596 | |
| 5597 | - if (file_exists('../img/lp_' . $icon_name . '.png')) { |
|
| 5597 | + if (file_exists('../img/lp_'.$icon_name.'.png')) { |
|
| 5598 | 5598 | $icon = Display::return_icon('lp_'.$icon_name.'.png'); |
| 5599 | 5599 | } else { |
| 5600 | - if (file_exists('../img/lp_' . $icon_name . '.gif')) { |
|
| 5600 | + if (file_exists('../img/lp_'.$icon_name.'.gif')) { |
|
| 5601 | 5601 | $icon = Display::return_icon('lp_'.$icon_name.'.gif'); |
| 5602 | 5602 | } else { |
| 5603 | 5603 | $icon = Display::return_icon('folder_document.gif'); |
@@ -5605,7 +5605,7 @@ discard block |
||
| 5605 | 5605 | } |
| 5606 | 5606 | |
| 5607 | 5607 | // The audio column. |
| 5608 | - $return_audio .= '<td align="left" style="padding-left:10px;">'; |
|
| 5608 | + $return_audio .= '<td align="left" style="padding-left:10px;">'; |
|
| 5609 | 5609 | $audio = ''; |
| 5610 | 5610 | |
| 5611 | 5611 | if (!$update_audio || $update_audio <> 'true') { |
@@ -5616,10 +5616,10 @@ discard block |
||
| 5616 | 5616 | } else { |
| 5617 | 5617 | $types = self::getChapterTypes(); |
| 5618 | 5618 | if (!in_array($arrLP[$i]['item_type'], $types)) { |
| 5619 | - $audio .= '<input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />'; |
|
| 5619 | + $audio .= '<input type="file" name="mp3file'.$arrLP[$i]['id'].'" id="mp3file" />'; |
|
| 5620 | 5620 | if (!empty ($arrLP[$i]['audio'])) { |
| 5621 | 5621 | $audio .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<br /> |
| 5622 | - <input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio'); |
|
| 5622 | + <input type="checkbox" name="removemp3' . $arrLP[$i]['id'].'" id="checkbox'.$arrLP[$i]['id'].'" />'.get_lang('RemoveAudio'); |
|
| 5623 | 5623 | } |
| 5624 | 5624 | } |
| 5625 | 5625 | } |
@@ -5643,7 +5643,7 @@ discard block |
||
| 5643 | 5643 | // No edit for this item types |
| 5644 | 5644 | if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) { |
| 5645 | 5645 | if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) { |
| 5646 | - $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">'; |
|
| 5646 | + $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">'; |
|
| 5647 | 5647 | $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY); |
| 5648 | 5648 | $edit_icon .= '</a>'; |
| 5649 | 5649 | |
@@ -5656,7 +5656,7 @@ discard block |
||
| 5656 | 5656 | $this->lp_session_id |
| 5657 | 5657 | ) |
| 5658 | 5658 | ) { |
| 5659 | - $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
| 5659 | + $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
| 5660 | 5660 | 'action' => 'dissociate_forum', |
| 5661 | 5661 | 'id' => $arrLP[$i]['id'], |
| 5662 | 5662 | 'lp_id' => $this->lp_id |
@@ -5667,7 +5667,7 @@ discard block |
||
| 5667 | 5667 | ['class' => 'btn btn-default lp-btn-dissociate-forum'] |
| 5668 | 5668 | ); |
| 5669 | 5669 | } else { |
| 5670 | - $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ |
|
| 5670 | + $forumIconUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ |
|
| 5671 | 5671 | 'action' => 'create_forum', |
| 5672 | 5672 | 'id' => $arrLP[$i]['id'], |
| 5673 | 5673 | 'lp_id' => $this->lp_id |
@@ -5680,17 +5680,17 @@ discard block |
||
| 5680 | 5680 | } |
| 5681 | 5681 | } |
| 5682 | 5682 | } else { |
| 5683 | - $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '&path_item=' . $arrLP[$i]['path'] . '" class="btn btn-default">'; |
|
| 5683 | + $edit_icon .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'&path_item='.$arrLP[$i]['path'].'" class="btn btn-default">'; |
|
| 5684 | 5684 | $edit_icon .= Display::return_icon('edit.png', get_lang('LearnpathEditModule'), array(), ICON_SIZE_TINY); |
| 5685 | 5685 | $edit_icon .= '</a>'; |
| 5686 | 5686 | } |
| 5687 | 5687 | } |
| 5688 | 5688 | |
| 5689 | - $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id=' . $arrLP[$i]['id'] . '&lp_id=' . $this->lp_id . '" onclick="return confirmation(\'' . addslashes($title) . '\');" class="btn btn-default">'; |
|
| 5689 | + $delete_icon .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete_item&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id.'" onclick="return confirmation(\''.addslashes($title).'\');" class="btn btn-default">'; |
|
| 5690 | 5690 | $delete_icon .= Display::return_icon('delete.png', get_lang('LearnpathDeleteModule'), array(), ICON_SIZE_TINY); |
| 5691 | 5691 | $delete_icon .= '</a>'; |
| 5692 | 5692 | |
| 5693 | - $url = api_get_self() . '?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id; |
|
| 5693 | + $url = api_get_self().'?'.api_get_cidreq().'&view=build&id='.$arrLP[$i]['id'].'&lp_id='.$this->lp_id; |
|
| 5694 | 5694 | |
| 5695 | 5695 | if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) { |
| 5696 | 5696 | $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('LearnpathPrerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq', ['class' => 'btn btn-default']); |
@@ -5699,8 +5699,8 @@ discard block |
||
| 5699 | 5699 | } |
| 5700 | 5700 | } |
| 5701 | 5701 | if ($update_audio != 'true') { |
| 5702 | - $row = $move_icon . ' ' . $icon . |
|
| 5703 | - Display::span($title_cut) . |
|
| 5702 | + $row = $move_icon.' '.$icon. |
|
| 5703 | + Display::span($title_cut). |
|
| 5704 | 5704 | Display::tag( |
| 5705 | 5705 | 'div', |
| 5706 | 5706 | "<div class=\"btn-group btn-group-xs\">$audio $edit_icon $forumIcon $prerequisities_icon $move_item_icon $audio_icon $delete_icon</div>", |
@@ -5721,8 +5721,8 @@ discard block |
||
| 5721 | 5721 | $parent_arrays = array(); |
| 5722 | 5722 | if ($arrLP[$i]['depth'] > 1) { |
| 5723 | 5723 | //Getting list of parents |
| 5724 | - for($j = 0; $j < $arrLP[$i]['depth']; $j++) { |
|
| 5725 | - foreach($arrLP as $item) { |
|
| 5724 | + for ($j = 0; $j < $arrLP[$i]['depth']; $j++) { |
|
| 5725 | + foreach ($arrLP as $item) { |
|
| 5726 | 5726 | if ($item['id'] == $parent_id) { |
| 5727 | 5727 | if ($item['parent_item_id'] == 0) { |
| 5728 | 5728 | $parent_id = $item['id']; |
@@ -5744,8 +5744,8 @@ discard block |
||
| 5744 | 5744 | $parent_arrays = array_reverse($parent_arrays); |
| 5745 | 5745 | $val = '$elements'; |
| 5746 | 5746 | $x = 0; |
| 5747 | - foreach($parent_arrays as $item) { |
|
| 5748 | - if ($x != count($parent_arrays) -1) { |
|
| 5747 | + foreach ($parent_arrays as $item) { |
|
| 5748 | + if ($x != count($parent_arrays) - 1) { |
|
| 5749 | 5749 | $val .= '["'.$item.'"]["children"]'; |
| 5750 | 5750 | } else { |
| 5751 | 5751 | $val .= '["'.$item.'"]["children"]'; |
@@ -5808,7 +5808,7 @@ discard block |
||
| 5808 | 5808 | if (isset($_REQUEST['id']) && $key == $_REQUEST['id']) { |
| 5809 | 5809 | $active = 'active'; |
| 5810 | 5810 | } |
| 5811 | - $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container')); |
|
| 5811 | + $return .= Display::tag('li', Display::div($item['data'], array('class'=>"item_data $active")).$sub_list, array('id'=>$key, 'class'=>'record li_container')); |
|
| 5812 | 5812 | } else { |
| 5813 | 5813 | //sections |
| 5814 | 5814 | if (isset($item['children'])) { |
@@ -5831,17 +5831,17 @@ discard block |
||
| 5831 | 5831 | { |
| 5832 | 5832 | $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null; |
| 5833 | 5833 | $return = '<div class="actions">'; |
| 5834 | - $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id . '&isStudentView=true">' . Display :: return_icon('preview_view.png', get_lang('Display'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
| 5835 | - $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id=' . $_SESSION['oLP']->lp_id . '&updateaudio=true">' . Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 5836 | - $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id . '">' . Display :: return_icon('settings.png', get_lang('CourseSettings'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 5834 | + $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=view&lp_id='.$_SESSION['oLP']->lp_id.'&isStudentView=true">'.Display :: return_icon('preview_view.png', get_lang('Display'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
| 5835 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=admin_view&lp_id='.$_SESSION['oLP']->lp_id.'&updateaudio=true">'.Display :: return_icon('upload_audio.png', get_lang('UpdateAllAudioFragments'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 5836 | + $return .= '<a href="lp_controller.php?'.api_get_cidreq().'&action=edit&lp_id='.$_SESSION['oLP']->lp_id.'">'.Display :: return_icon('settings.png', get_lang('CourseSettings'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 5837 | 5837 | $buttons = array( |
| 5838 | 5838 | array( |
| 5839 | 5839 | 'title' => get_lang('SetPrerequisiteForEachItem'), |
| 5840 | - 'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id=' . $_SESSION['oLP']->lp_id, |
|
| 5840 | + 'href' => 'lp_controller.php?'.api_get_cidreq().'&action=set_previous_step_as_prerequisite&lp_id='.$_SESSION['oLP']->lp_id, |
|
| 5841 | 5841 | ), |
| 5842 | 5842 | array( |
| 5843 | 5843 | 'title' => get_lang('ClearAllPrerequisites'), |
| 5844 | - 'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id=' . $_SESSION['oLP']->lp_id, |
|
| 5844 | + 'href' => 'lp_controller.php?'.api_get_cidreq().'&action=clear_prerequisites&lp_id='.$_SESSION['oLP']->lp_id, |
|
| 5845 | 5845 | ), |
| 5846 | 5846 | ); |
| 5847 | 5847 | $return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons); |
@@ -5862,7 +5862,7 @@ discard block |
||
| 5862 | 5862 | { |
| 5863 | 5863 | // Creating learning_path folder |
| 5864 | 5864 | $dir = '/learning_path'; |
| 5865 | - $filepath = api_get_path(SYS_COURSE_PATH).$course['path'] . '/document'; |
|
| 5865 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'; |
|
| 5866 | 5866 | $folder = false; |
| 5867 | 5867 | if (!is_dir($filepath.'/'.$dir)) { |
| 5868 | 5868 | $folderData = create_unexisting_directory( |
@@ -5903,9 +5903,9 @@ discard block |
||
| 5903 | 5903 | // Creating LP folder |
| 5904 | 5904 | if ($folder) { |
| 5905 | 5905 | //Limits title size |
| 5906 | - $title = api_substr(api_replace_dangerous_char($lp_name), 0 , 80); |
|
| 5906 | + $title = api_substr(api_replace_dangerous_char($lp_name), 0, 80); |
|
| 5907 | 5907 | $dir = $dir.$title; |
| 5908 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'; |
|
| 5908 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'; |
|
| 5909 | 5909 | if (!is_dir($filepath.'/'.$dir)) { |
| 5910 | 5910 | $folderData = create_unexisting_directory( |
| 5911 | 5911 | $course, |
@@ -5925,7 +5925,7 @@ discard block |
||
| 5925 | 5925 | } |
| 5926 | 5926 | $dir = $dir.'/'; |
| 5927 | 5927 | if ($folder) { |
| 5928 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir; |
|
| 5928 | + $filepath = api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$dir; |
|
| 5929 | 5929 | } |
| 5930 | 5930 | } |
| 5931 | 5931 | $array = array( |
@@ -5964,12 +5964,12 @@ discard block |
||
| 5964 | 5964 | $dir = substr($dir, 1); |
| 5965 | 5965 | } |
| 5966 | 5966 | if (!empty($dir[0]) && $dir[0] != '/') { |
| 5967 | - $dir = '/' . $dir; |
|
| 5967 | + $dir = '/'.$dir; |
|
| 5968 | 5968 | } |
| 5969 | 5969 | if (isset($dir[strlen($dir) - 1]) && $dir[strlen($dir) - 1] != '/') { |
| 5970 | 5970 | $dir .= '/'; |
| 5971 | 5971 | } |
| 5972 | - $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $dir; |
|
| 5972 | + $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$dir; |
|
| 5973 | 5973 | |
| 5974 | 5974 | if (empty($_POST['dir']) && empty($_GET['dir'])) { |
| 5975 | 5975 | //Generates folder |
@@ -5979,7 +5979,7 @@ discard block |
||
| 5979 | 5979 | } |
| 5980 | 5980 | |
| 5981 | 5981 | if (!is_dir($filepath)) { |
| 5982 | - $filepath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/'; |
|
| 5982 | + $filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document/'; |
|
| 5983 | 5983 | $dir = '/'; |
| 5984 | 5984 | } |
| 5985 | 5985 | |
@@ -6002,10 +6002,10 @@ discard block |
||
| 6002 | 6002 | $tmp_filename = $filename; |
| 6003 | 6003 | |
| 6004 | 6004 | $i = 0; |
| 6005 | - while (file_exists($filepath . $tmp_filename . '.'.$extension)) |
|
| 6006 | - $tmp_filename = $filename . '_' . ++ $i; |
|
| 6005 | + while (file_exists($filepath.$tmp_filename.'.'.$extension)) |
|
| 6006 | + $tmp_filename = $filename.'_'.++ $i; |
|
| 6007 | 6007 | |
| 6008 | - $filename = $tmp_filename . '.'.$extension; |
|
| 6008 | + $filename = $tmp_filename.'.'.$extension; |
|
| 6009 | 6009 | if ($extension == 'html') { |
| 6010 | 6010 | $content = stripslashes($content); |
| 6011 | 6011 | $content = str_replace( |
@@ -6040,12 +6040,12 @@ discard block |
||
| 6040 | 6040 | ); |
| 6041 | 6041 | } |
| 6042 | 6042 | |
| 6043 | - if (!file_exists($filepath . $filename)) { |
|
| 6044 | - if ($fp = @ fopen($filepath . $filename, 'w')) { |
|
| 6043 | + if (!file_exists($filepath.$filename)) { |
|
| 6044 | + if ($fp = @ fopen($filepath.$filename, 'w')) { |
|
| 6045 | 6045 | fputs($fp, $content); |
| 6046 | 6046 | fclose($fp); |
| 6047 | 6047 | |
| 6048 | - $file_size = filesize($filepath . $filename); |
|
| 6048 | + $file_size = filesize($filepath.$filename); |
|
| 6049 | 6049 | $save_file_path = $dir.$filename; |
| 6050 | 6050 | |
| 6051 | 6051 | $document_id = add_document( |
@@ -6077,12 +6077,12 @@ discard block |
||
| 6077 | 6077 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
| 6078 | 6078 | $ct = ''; |
| 6079 | 6079 | if ($new_comment) |
| 6080 | - $ct .= ", comment='" . Database::escape_string($new_comment). "'"; |
|
| 6080 | + $ct .= ", comment='".Database::escape_string($new_comment)."'"; |
|
| 6081 | 6081 | if ($new_title) |
| 6082 | - $ct .= ", title='" . Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' "; |
|
| 6082 | + $ct .= ", title='".Database::escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' "; |
|
| 6083 | 6083 | |
| 6084 | - $sql = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." |
|
| 6085 | - WHERE c_id = ".$course_id." AND id = " . $document_id; |
|
| 6084 | + $sql = "UPDATE ".$tbl_doc." SET ".substr($ct, 1)." |
|
| 6085 | + WHERE c_id = ".$course_id." AND id = ".$document_id; |
|
| 6086 | 6086 | Database::query($sql); |
| 6087 | 6087 | } |
| 6088 | 6088 | } |
@@ -6110,42 +6110,42 @@ discard block |
||
| 6110 | 6110 | $dir = substr($dir, 1); |
| 6111 | 6111 | |
| 6112 | 6112 | if ($dir[0] != '/') |
| 6113 | - $dir = '/' . $dir; |
|
| 6113 | + $dir = '/'.$dir; |
|
| 6114 | 6114 | |
| 6115 | 6115 | if ($dir[strlen($dir) - 1] != '/') |
| 6116 | 6116 | $dir .= '/'; |
| 6117 | 6117 | |
| 6118 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; |
|
| 6118 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
| 6119 | 6119 | |
| 6120 | 6120 | if (!is_dir($filepath)) { |
| 6121 | - $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; |
|
| 6121 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 6122 | 6122 | $dir = '/'; |
| 6123 | 6123 | } |
| 6124 | 6124 | |
| 6125 | 6125 | $table_doc = Database :: get_course_table(TABLE_DOCUMENT); |
| 6126 | 6126 | if (isset($_POST['path']) && !empty($_POST['path'])) { |
| 6127 | 6127 | $document_id = intval($_POST['path']); |
| 6128 | - $sql = "SELECT path FROM " . $table_doc . " |
|
| 6129 | - WHERE c_id = $course_id AND id = " . $document_id; |
|
| 6128 | + $sql = "SELECT path FROM ".$table_doc." |
|
| 6129 | + WHERE c_id = $course_id AND id = ".$document_id; |
|
| 6130 | 6130 | $res = Database::query($sql); |
| 6131 | 6131 | $row = Database :: fetch_array($res); |
| 6132 | 6132 | $content = stripslashes($_POST['content_lp']); |
| 6133 | - $file = $filepath . $row['path']; |
|
| 6133 | + $file = $filepath.$row['path']; |
|
| 6134 | 6134 | |
| 6135 | 6135 | if ($fp = @ fopen($file, 'w')) { |
| 6136 | - $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'] . '/courses/', $content); |
|
| 6136 | + $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content); |
|
| 6137 | 6137 | |
| 6138 | 6138 | // Change the path of mp3 to absolute. |
| 6139 | 6139 | // The first regexp deals with :// urls. |
| 6140 | - $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content); |
|
| 6140 | + $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/', $content); |
|
| 6141 | 6141 | // The second regexp deals with audio/ urls. |
| 6142 | - $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content); |
|
| 6142 | + $content = preg_replace("|(flashvars=\"file=)([^:/]+)/|", "$1".api_get_path(REL_COURSE_PATH).$_course['path'].'/document/$2/', $content); |
|
| 6143 | 6143 | fputs($fp, $content); |
| 6144 | 6144 | fclose($fp); |
| 6145 | 6145 | |
| 6146 | - $sql = "UPDATE " . $table_doc ." SET |
|
| 6146 | + $sql = "UPDATE ".$table_doc." SET |
|
| 6147 | 6147 | title='".Database::escape_string($_POST['title'])."' |
| 6148 | - WHERE c_id = ".$course_id." AND id = " . $document_id; |
|
| 6148 | + WHERE c_id = ".$course_id." AND id = ".$document_id; |
|
| 6149 | 6149 | Database::query($sql); |
| 6150 | 6150 | } |
| 6151 | 6151 | } |
@@ -6163,10 +6163,10 @@ discard block |
||
| 6163 | 6163 | $return = ''; |
| 6164 | 6164 | if (is_numeric($item_id)) { |
| 6165 | 6165 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 6166 | - $sql = "SELECT lp.* FROM " . $tbl_lp_item . " as lp |
|
| 6167 | - WHERE c_id = ".$course_id." AND lp.id = " . intval($item_id); |
|
| 6166 | + $sql = "SELECT lp.* FROM ".$tbl_lp_item." as lp |
|
| 6167 | + WHERE c_id = ".$course_id." AND lp.id = ".intval($item_id); |
|
| 6168 | 6168 | $result = Database::query($sql); |
| 6169 | - while ($row = Database :: fetch_array($result,'ASSOC')) { |
|
| 6169 | + while ($row = Database :: fetch_array($result, 'ASSOC')) { |
|
| 6170 | 6170 | $_SESSION['parent_item_id'] = ($row['item_type'] == 'dokeos_chapter' || $row['item_type'] == 'dokeos_module' || $row['item_type'] == 'dir') ? $item_id : 0; |
| 6171 | 6171 | |
| 6172 | 6172 | // Prevents wrong parent selection for document, see Bug#1251. |
@@ -6193,8 +6193,8 @@ discard block |
||
| 6193 | 6193 | break; |
| 6194 | 6194 | case TOOL_DOCUMENT: |
| 6195 | 6195 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
| 6196 | - $sql_doc = "SELECT path FROM " . $tbl_doc . " |
|
| 6197 | - WHERE c_id = ".$course_id." AND id = " . intval($row['path']); |
|
| 6196 | + $sql_doc = "SELECT path FROM ".$tbl_doc." |
|
| 6197 | + WHERE c_id = ".$course_id." AND id = ".intval($row['path']); |
|
| 6198 | 6198 | $result = Database::query($sql_doc); |
| 6199 | 6199 | $path_file = Database::result($result, 0, 0); |
| 6200 | 6200 | $path_parts = pathinfo($path_file); |
@@ -6233,7 +6233,7 @@ discard block |
||
| 6233 | 6233 | if (is_numeric($item_id)) { |
| 6234 | 6234 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 6235 | 6235 | $sql = "SELECT * FROM $tbl_lp_item |
| 6236 | - WHERE c_id = ".$course_id." AND id = " . intval($item_id); |
|
| 6236 | + WHERE c_id = ".$course_id." AND id = ".intval($item_id); |
|
| 6237 | 6237 | $res = Database::query($sql); |
| 6238 | 6238 | $row = Database::fetch_array($res); |
| 6239 | 6239 | |
@@ -6244,21 +6244,21 @@ discard block |
||
| 6244 | 6244 | case 'sco' : |
| 6245 | 6245 | if (isset ($_GET['view']) && $_GET['view'] == 'build') { |
| 6246 | 6246 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
| 6247 | - $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row); |
|
| 6247 | + $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter').' :', 'edit', $item_id, $row); |
|
| 6248 | 6248 | } else { |
| 6249 | - $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row); |
|
| 6249 | + $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter').' :', $row); |
|
| 6250 | 6250 | } |
| 6251 | 6251 | break; |
| 6252 | 6252 | case TOOL_DOCUMENT : |
| 6253 | 6253 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
| 6254 | 6254 | $sql = "SELECT lp.*, doc.path as dir |
| 6255 | - FROM " . $tbl_lp_item . " as lp |
|
| 6256 | - LEFT JOIN " . $tbl_doc . " as doc |
|
| 6255 | + FROM " . $tbl_lp_item." as lp |
|
| 6256 | + LEFT JOIN " . $tbl_doc." as doc |
|
| 6257 | 6257 | ON doc.id = lp.path |
| 6258 | 6258 | WHERE |
| 6259 | 6259 | lp.c_id = $course_id AND |
| 6260 | 6260 | doc.c_id = $course_id AND |
| 6261 | - lp.id = " . intval($item_id); |
|
| 6261 | + lp.id = ".intval($item_id); |
|
| 6262 | 6262 | $res_step = Database::query($sql); |
| 6263 | 6263 | $row_step = Database :: fetch_array($res_step); |
| 6264 | 6264 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
@@ -6268,8 +6268,8 @@ discard block |
||
| 6268 | 6268 | $link_id = (string) $row['path']; |
| 6269 | 6269 | if (ctype_digit($link_id)) { |
| 6270 | 6270 | $tbl_link = Database :: get_course_table(TABLE_LINK); |
| 6271 | - $sql_select = 'SELECT url FROM ' . $tbl_link . ' |
|
| 6272 | - WHERE c_id = '.$course_id.' AND id = ' . intval($link_id); |
|
| 6271 | + $sql_select = 'SELECT url FROM '.$tbl_link.' |
|
| 6272 | + WHERE c_id = '.$course_id.' AND id = '.intval($link_id); |
|
| 6273 | 6273 | $res_link = Database::query($sql_select); |
| 6274 | 6274 | $row_link = Database :: fetch_array($res_link); |
| 6275 | 6275 | if (is_array($row_link)) { |
@@ -6282,9 +6282,9 @@ discard block |
||
| 6282 | 6282 | case 'dokeos_module' : |
| 6283 | 6283 | if (isset ($_GET['view']) && $_GET['view'] == 'build') { |
| 6284 | 6284 | $return .= $this->display_manipulate($item_id, $row['item_type']); |
| 6285 | - $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule') . ' :', 'edit', $item_id, $row); |
|
| 6285 | + $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentModule').' :', 'edit', $item_id, $row); |
|
| 6286 | 6286 | } else { |
| 6287 | - $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule') . ' :', $row); |
|
| 6287 | + $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentModule').' :', $row); |
|
| 6288 | 6288 | } |
| 6289 | 6289 | break; |
| 6290 | 6290 | case TOOL_QUIZ : |
@@ -6339,7 +6339,7 @@ discard block |
||
| 6339 | 6339 | |
| 6340 | 6340 | $headers = array( |
| 6341 | 6341 | Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG), |
| 6342 | - Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG), |
|
| 6342 | + Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG), |
|
| 6343 | 6343 | Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG), |
| 6344 | 6344 | Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG), |
| 6345 | 6345 | Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG), |
@@ -6379,16 +6379,16 @@ discard block |
||
| 6379 | 6379 | $course_id = api_get_course_int_id(); |
| 6380 | 6380 | $return = ''; |
| 6381 | 6381 | $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); |
| 6382 | - $sql_doc = "SELECT * FROM " . $tbl_doc . " |
|
| 6383 | - WHERE c_id = ".$course_id." AND id = " . $id; |
|
| 6382 | + $sql_doc = "SELECT * FROM ".$tbl_doc." |
|
| 6383 | + WHERE c_id = ".$course_id." AND id = ".$id; |
|
| 6384 | 6384 | $res_doc = Database::query($sql_doc); |
| 6385 | 6385 | $row_doc = Database :: fetch_array($res_doc); |
| 6386 | 6386 | |
| 6387 | 6387 | // TODO: Add a path filter. |
| 6388 | 6388 | if ($iframe) { |
| 6389 | - $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="' . api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . str_replace('%2F', '/', urlencode($row_doc['path'])) . '?' . api_get_cidreq() . '"></iframe>'; |
|
| 6389 | + $return .= '<iframe id="learnpath_preview_frame" frameborder="0" height="400" width="100%" scrolling="auto" src="'.api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.str_replace('%2F', '/', urlencode($row_doc['path'])).'?'.api_get_cidreq().'"></iframe>'; |
|
| 6390 | 6390 | } else { |
| 6391 | - $return .= file_get_contents(api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $row_doc['path']); |
|
| 6391 | + $return .= file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row_doc['path']); |
|
| 6392 | 6392 | } |
| 6393 | 6393 | |
| 6394 | 6394 | return $return; |
@@ -6412,8 +6412,8 @@ discard block |
||
| 6412 | 6412 | $item_description = $extra_info['description']; |
| 6413 | 6413 | } elseif (is_numeric($extra_info)) { |
| 6414 | 6414 | $sql = "SELECT title, description |
| 6415 | - FROM " . $tbl_quiz . " |
|
| 6416 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
| 6415 | + FROM " . $tbl_quiz." |
|
| 6416 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
| 6417 | 6417 | |
| 6418 | 6418 | $result = Database::query($sql); |
| 6419 | 6419 | $row = Database::fetch_array($result); |
@@ -6423,8 +6423,8 @@ discard block |
||
| 6423 | 6423 | $item_title = ''; |
| 6424 | 6424 | $item_description = ''; |
| 6425 | 6425 | } |
| 6426 | - $item_title = Security::remove_XSS($item_title); |
|
| 6427 | - $item_description = Security::remove_XSS($item_description); |
|
| 6426 | + $item_title = Security::remove_XSS($item_title); |
|
| 6427 | + $item_description = Security::remove_XSS($item_description); |
|
| 6428 | 6428 | |
| 6429 | 6429 | $legend = '<legend>'; |
| 6430 | 6430 | if ($id != 0 && is_array($extra_info)) |
@@ -6432,13 +6432,13 @@ discard block |
||
| 6432 | 6432 | else |
| 6433 | 6433 | $parent = 0; |
| 6434 | 6434 | |
| 6435 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 6436 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 6435 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 6436 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 6437 | 6437 | |
| 6438 | 6438 | $result = Database::query($sql); |
| 6439 | - $arrLP = array (); |
|
| 6439 | + $arrLP = array(); |
|
| 6440 | 6440 | while ($row = Database :: fetch_array($result)) { |
| 6441 | - $arrLP[] = array ( |
|
| 6441 | + $arrLP[] = array( |
|
| 6442 | 6442 | 'id' => $row['id'], |
| 6443 | 6443 | 'item_type' => $row['item_type'], |
| 6444 | 6444 | 'title' => $row['title'], |
@@ -6461,15 +6461,15 @@ discard block |
||
| 6461 | 6461 | unset ($this->arrMenu); |
| 6462 | 6462 | |
| 6463 | 6463 | if ($action == 'add') { |
| 6464 | - $legend .= get_lang('CreateTheExercise') . ' :'; |
|
| 6464 | + $legend .= get_lang('CreateTheExercise').' :'; |
|
| 6465 | 6465 | } elseif ($action == 'move') { |
| 6466 | - $legend .= get_lang('MoveTheCurrentExercise') . ' :'; |
|
| 6466 | + $legend .= get_lang('MoveTheCurrentExercise').' :'; |
|
| 6467 | 6467 | } else { |
| 6468 | - $legend .= get_lang('EditCurrentExecice') . ' :'; |
|
| 6468 | + $legend .= get_lang('EditCurrentExecice').' :'; |
|
| 6469 | 6469 | } |
| 6470 | 6470 | |
| 6471 | 6471 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
| 6472 | - $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument')); |
|
| 6472 | + $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument')); |
|
| 6473 | 6473 | } |
| 6474 | 6474 | |
| 6475 | 6475 | $legend .= '</legend>'; |
@@ -6482,34 +6482,34 @@ discard block |
||
| 6482 | 6482 | |
| 6483 | 6483 | if ($action != 'move') { |
| 6484 | 6484 | $return .= '<tr>'; |
| 6485 | - $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>'; |
|
| 6486 | - $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" /></td>'; |
|
| 6485 | + $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>'; |
|
| 6486 | + $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" /></td>'; |
|
| 6487 | 6487 | $return .= '</tr>'; |
| 6488 | 6488 | } |
| 6489 | 6489 | |
| 6490 | 6490 | $return .= '<tr>'; |
| 6491 | 6491 | |
| 6492 | - $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>'; |
|
| 6492 | + $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>'; |
|
| 6493 | 6493 | $return .= '<td class="input">'; |
| 6494 | 6494 | |
| 6495 | 6495 | // Select for Parent item, root or chapter |
| 6496 | 6496 | $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" size="1">'; |
| 6497 | 6497 | |
| 6498 | - $return .= '<option class="top" value="0">' . $this->name . '</option>'; |
|
| 6498 | + $return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
| 6499 | 6499 | |
| 6500 | - $arrHide = array ( |
|
| 6500 | + $arrHide = array( |
|
| 6501 | 6501 | $id |
| 6502 | 6502 | ); |
| 6503 | 6503 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6504 | 6504 | if ($action != 'add') { |
| 6505 | 6505 | if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) { |
| 6506 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6506 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 6507 | 6507 | } else { |
| 6508 | 6508 | $arrHide[] = $arrLP[$i]['id']; |
| 6509 | 6509 | } |
| 6510 | 6510 | } else { |
| 6511 | 6511 | if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
| 6512 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6512 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 6513 | 6513 | } |
| 6514 | 6514 | } |
| 6515 | 6515 | if (is_array($arrLP)) { |
@@ -6521,11 +6521,11 @@ discard block |
||
| 6521 | 6521 | $return .= '</tr>'; |
| 6522 | 6522 | $return .= '<tr>'; |
| 6523 | 6523 | |
| 6524 | - $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>'; |
|
| 6524 | + $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>'; |
|
| 6525 | 6525 | $return .= '<td class="input">'; |
| 6526 | 6526 | |
| 6527 | 6527 | $return .= '<select class="learnpath_item_form" style="width:100%;" id="previous" name="previous" size="1">'; |
| 6528 | - $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
|
| 6528 | + $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>'; |
|
| 6529 | 6529 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6530 | 6530 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
| 6531 | 6531 | if (is_array($extra_info)) { |
@@ -6537,7 +6537,7 @@ discard block |
||
| 6537 | 6537 | } else { |
| 6538 | 6538 | $selected = ''; |
| 6539 | 6539 | } |
| 6540 | - $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
|
| 6540 | + $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
| 6541 | 6541 | } |
| 6542 | 6542 | } |
| 6543 | 6543 | $return .= '</select>'; |
@@ -6554,7 +6554,7 @@ discard block |
||
| 6554 | 6554 | } |
| 6555 | 6555 | } |
| 6556 | 6556 | } |
| 6557 | - $arrHide = array (); |
|
| 6557 | + $arrHide = array(); |
|
| 6558 | 6558 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6559 | 6559 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
| 6560 | 6560 | if (is_array($extra_info)) { |
@@ -6600,27 +6600,27 @@ discard block |
||
| 6600 | 6600 | |
| 6601 | 6601 | $return .= '<tr>'; |
| 6602 | 6602 | if ($action == 'add') { |
| 6603 | - $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddExercise') . '</button></td>'; |
|
| 6603 | + $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddExercise').'</button></td>'; |
|
| 6604 | 6604 | } else { |
| 6605 | - $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentExecice') . '</button></td>'; |
|
| 6605 | + $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentExecice').'</button></td>'; |
|
| 6606 | 6606 | } |
| 6607 | 6607 | |
| 6608 | 6608 | $return .= '</tr>'; |
| 6609 | 6609 | $return .= '</table>'; |
| 6610 | 6610 | |
| 6611 | 6611 | if ($action == 'move') { |
| 6612 | - $return .= '<input name="title" type="hidden" value="' . $item_title . '" />'; |
|
| 6613 | - $return .= '<input name="description" type="hidden" value="' . $item_description . '" />'; |
|
| 6612 | + $return .= '<input name="title" type="hidden" value="'.$item_title.'" />'; |
|
| 6613 | + $return .= '<input name="description" type="hidden" value="'.$item_description.'" />'; |
|
| 6614 | 6614 | } |
| 6615 | 6615 | |
| 6616 | 6616 | if (is_numeric($extra_info)) { |
| 6617 | - $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
|
| 6617 | + $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />'; |
|
| 6618 | 6618 | } elseif (is_array($extra_info)) { |
| 6619 | - $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
|
| 6619 | + $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />'; |
|
| 6620 | 6620 | } |
| 6621 | 6621 | |
| 6622 | - $return .= '<input name="type" type="hidden" value="' . TOOL_QUIZ . '" />'; |
|
| 6623 | - $return .= '<input name="post_time" type="hidden" value="' . time() . '" />'; |
|
| 6622 | + $return .= '<input name="type" type="hidden" value="'.TOOL_QUIZ.'" />'; |
|
| 6623 | + $return .= '<input name="post_time" type="hidden" value="'.time().'" />'; |
|
| 6624 | 6624 | |
| 6625 | 6625 | $return .= '</form>'; |
| 6626 | 6626 | $return .= '</div>'; |
@@ -6647,11 +6647,11 @@ discard block |
||
| 6647 | 6647 | } elseif (is_numeric($extra_info)) { |
| 6648 | 6648 | $TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT); |
| 6649 | 6649 | |
| 6650 | - $sql = "SELECT * FROM " . $TBL_DOCUMENT . " |
|
| 6650 | + $sql = "SELECT * FROM ".$TBL_DOCUMENT." |
|
| 6651 | 6651 | WHERE |
| 6652 | 6652 | c_id = ".$course_id." AND |
| 6653 | - path LIKE '" . $uploadPath . "/%/%htm%' AND |
|
| 6654 | - id = " . (int) $extra_info . " |
|
| 6653 | + path LIKE '" . $uploadPath."/%/%htm%' AND |
|
| 6654 | + id = " . (int) $extra_info." |
|
| 6655 | 6655 | ORDER BY id ASC"; |
| 6656 | 6656 | |
| 6657 | 6657 | $res_hot = Database::query($sql); |
@@ -6675,11 +6675,11 @@ discard block |
||
| 6675 | 6675 | } |
| 6676 | 6676 | |
| 6677 | 6677 | $sql = "SELECT * FROM $tbl_lp_item |
| 6678 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 6678 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 6679 | 6679 | $result = Database::query($sql); |
| 6680 | - $arrLP = array (); |
|
| 6680 | + $arrLP = array(); |
|
| 6681 | 6681 | while ($row = Database :: fetch_array($result)) { |
| 6682 | - $arrLP[] = array ( |
|
| 6682 | + $arrLP[] = array( |
|
| 6683 | 6683 | 'id' => $row['id'], |
| 6684 | 6684 | 'item_type' => $row['item_type'], |
| 6685 | 6685 | 'title' => $row['title'], |
@@ -6704,7 +6704,7 @@ discard block |
||
| 6704 | 6704 | else |
| 6705 | 6705 | $legend .= get_lang('EditCurrentExecice'); |
| 6706 | 6706 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
| 6707 | - $legend .= Display :: return_warning_message(get_lang('Warning') . ' ! ' . get_lang('WarningEditingDocument')); |
|
| 6707 | + $legend .= Display :: return_warning_message(get_lang('Warning').' ! '.get_lang('WarningEditingDocument')); |
|
| 6708 | 6708 | } |
| 6709 | 6709 | $legend .= '</legend>'; |
| 6710 | 6710 | |
@@ -6712,11 +6712,11 @@ discard block |
||
| 6712 | 6712 | $return .= $legend; |
| 6713 | 6713 | $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">'; |
| 6714 | 6714 | $return .= '<tr>'; |
| 6715 | - $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . ' :</label></td>'; |
|
| 6715 | + $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').' :</label></td>'; |
|
| 6716 | 6716 | $return .= '<td class="input">'; |
| 6717 | 6717 | $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">'; |
| 6718 | - $return .= '<option class="top" value="0">' . $this->name . '</option>'; |
|
| 6719 | - $arrHide = array ( |
|
| 6718 | + $return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
| 6719 | + $arrHide = array( |
|
| 6720 | 6720 | $id |
| 6721 | 6721 | ); |
| 6722 | 6722 | |
@@ -6724,13 +6724,13 @@ discard block |
||
| 6724 | 6724 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6725 | 6725 | if ($action != 'add') { |
| 6726 | 6726 | if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) { |
| 6727 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6727 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 6728 | 6728 | } else { |
| 6729 | 6729 | $arrHide[] = $arrLP[$i]['id']; |
| 6730 | 6730 | } |
| 6731 | 6731 | } else { |
| 6732 | 6732 | if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
| 6733 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6733 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 6734 | 6734 | } |
| 6735 | 6735 | } |
| 6736 | 6736 | |
@@ -6741,10 +6741,10 @@ discard block |
||
| 6741 | 6741 | $return .= '</td>'; |
| 6742 | 6742 | $return .= '</tr>'; |
| 6743 | 6743 | $return .= '<tr>'; |
| 6744 | - $return .= '<td class="label"><label for="previous">' . get_lang('Position') . ' :</label></td>'; |
|
| 6744 | + $return .= '<td class="label"><label for="previous">'.get_lang('Position').' :</label></td>'; |
|
| 6745 | 6745 | $return .= '<td class="input">'; |
| 6746 | 6746 | $return .= '<select id="previous" name="previous" size="1">'; |
| 6747 | - $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
|
| 6747 | + $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>'; |
|
| 6748 | 6748 | |
| 6749 | 6749 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6750 | 6750 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
@@ -6754,7 +6754,7 @@ discard block |
||
| 6754 | 6754 | else |
| 6755 | 6755 | $selected = ''; |
| 6756 | 6756 | |
| 6757 | - $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
|
| 6757 | + $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
| 6758 | 6758 | } |
| 6759 | 6759 | } |
| 6760 | 6760 | |
@@ -6764,8 +6764,8 @@ discard block |
||
| 6764 | 6764 | |
| 6765 | 6765 | if ($action != 'move') { |
| 6766 | 6766 | $return .= '<tr>'; |
| 6767 | - $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . ' :</label></td>'; |
|
| 6768 | - $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>'; |
|
| 6767 | + $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').' :</label></td>'; |
|
| 6768 | + $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>'; |
|
| 6769 | 6769 | $return .= '</tr>'; |
| 6770 | 6770 | $id_prerequisite = 0; |
| 6771 | 6771 | if (is_array($arrLP) && count($arrLP) > 0) { |
@@ -6776,7 +6776,7 @@ discard block |
||
| 6776 | 6776 | } |
| 6777 | 6777 | } |
| 6778 | 6778 | |
| 6779 | - $arrHide = array (); |
|
| 6779 | + $arrHide = array(); |
|
| 6780 | 6780 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6781 | 6781 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
| 6782 | 6782 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -6790,22 +6790,22 @@ discard block |
||
| 6790 | 6790 | } |
| 6791 | 6791 | |
| 6792 | 6792 | $return .= '<tr>'; |
| 6793 | - $return .= '<td> </td><td><button class="save" name="submit_button" action="edit" type="submit">' . get_lang('SaveHotpotatoes') . '</button></td>'; |
|
| 6793 | + $return .= '<td> </td><td><button class="save" name="submit_button" action="edit" type="submit">'.get_lang('SaveHotpotatoes').'</button></td>'; |
|
| 6794 | 6794 | $return .= '</tr>'; |
| 6795 | 6795 | $return .= '</table>'; |
| 6796 | 6796 | |
| 6797 | 6797 | if ($action == 'move') { |
| 6798 | - $return .= '<input name="title" type="hidden" value="' . $item_title . '" />'; |
|
| 6799 | - $return .= '<input name="description" type="hidden" value="' . $item_description . '" />'; |
|
| 6798 | + $return .= '<input name="title" type="hidden" value="'.$item_title.'" />'; |
|
| 6799 | + $return .= '<input name="description" type="hidden" value="'.$item_description.'" />'; |
|
| 6800 | 6800 | } |
| 6801 | 6801 | |
| 6802 | 6802 | if (is_numeric($extra_info)) { |
| 6803 | - $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
|
| 6803 | + $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />'; |
|
| 6804 | 6804 | } elseif (is_array($extra_info)) { |
| 6805 | - $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
|
| 6805 | + $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />'; |
|
| 6806 | 6806 | } |
| 6807 | - $return .= '<input name="type" type="hidden" value="' . TOOL_HOTPOTATOES . '" />'; |
|
| 6808 | - $return .= '<input name="post_time" type="hidden" value="' . time() . '" />'; |
|
| 6807 | + $return .= '<input name="type" type="hidden" value="'.TOOL_HOTPOTATOES.'" />'; |
|
| 6808 | + $return .= '<input name="post_time" type="hidden" value="'.time().'" />'; |
|
| 6809 | 6809 | $return .= '</form>'; |
| 6810 | 6810 | |
| 6811 | 6811 | return $return; |
@@ -6828,8 +6828,8 @@ discard block |
||
| 6828 | 6828 | $item_title = stripslashes($extra_info['title']); |
| 6829 | 6829 | } elseif (is_numeric($extra_info)) { |
| 6830 | 6830 | $sql = "SELECT forum_title as title, forum_comment as comment |
| 6831 | - FROM " . $tbl_forum . " |
|
| 6832 | - WHERE c_id = ".$course_id." AND forum_id = " . $extra_info; |
|
| 6831 | + FROM " . $tbl_forum." |
|
| 6832 | + WHERE c_id = ".$course_id." AND forum_id = ".$extra_info; |
|
| 6833 | 6833 | |
| 6834 | 6834 | $result = Database::query($sql); |
| 6835 | 6835 | $row = Database :: fetch_array($result); |
@@ -6849,7 +6849,7 @@ discard block |
||
| 6849 | 6849 | $parent = 0; |
| 6850 | 6850 | } |
| 6851 | 6851 | |
| 6852 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 6852 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 6853 | 6853 | WHERE |
| 6854 | 6854 | c_id = ".$course_id." AND |
| 6855 | 6855 | lp_id = " . $this->lp_id; |
@@ -6857,7 +6857,7 @@ discard block |
||
| 6857 | 6857 | $arrLP = array(); |
| 6858 | 6858 | |
| 6859 | 6859 | while ($row = Database :: fetch_array($result)) { |
| 6860 | - $arrLP[] = array ( |
|
| 6860 | + $arrLP[] = array( |
|
| 6861 | 6861 | 'id' => $row['id'], |
| 6862 | 6862 | 'item_type' => $row['item_type'], |
| 6863 | 6863 | 'title' => $row['title'], |
@@ -6879,10 +6879,10 @@ discard block |
||
| 6879 | 6879 | unset($this->arrMenu); |
| 6880 | 6880 | |
| 6881 | 6881 | if ($action == 'add') |
| 6882 | - $legend .= get_lang('CreateTheForum') . ' :'; |
|
| 6883 | - elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum') . ' :'; |
|
| 6882 | + $legend .= get_lang('CreateTheForum').' :'; |
|
| 6883 | + elseif ($action == 'move') $legend .= get_lang('MoveTheCurrentForum').' :'; |
|
| 6884 | 6884 | else |
| 6885 | - $legend .= get_lang('EditCurrentForum') . ' :'; |
|
| 6885 | + $legend .= get_lang('EditCurrentForum').' :'; |
|
| 6886 | 6886 | |
| 6887 | 6887 | $legend .= '</legend>'; |
| 6888 | 6888 | $return = '<div class="sectioncomment">'; |
@@ -6892,16 +6892,16 @@ discard block |
||
| 6892 | 6892 | |
| 6893 | 6893 | if ($action != 'move') { |
| 6894 | 6894 | $return .= '<tr>'; |
| 6895 | - $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>'; |
|
| 6896 | - $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="' . $item_title . '" class="learnpath_item_form" /></td>'; |
|
| 6895 | + $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>'; |
|
| 6896 | + $return .= '<td class="input"><input id="idTitle" size="44" name="title" type="text" value="'.$item_title.'" class="learnpath_item_form" /></td>'; |
|
| 6897 | 6897 | $return .= '</tr>'; |
| 6898 | 6898 | } |
| 6899 | 6899 | |
| 6900 | 6900 | $return .= '<tr>'; |
| 6901 | - $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>'; |
|
| 6901 | + $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>'; |
|
| 6902 | 6902 | $return .= '<td class="input">'; |
| 6903 | 6903 | $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">'; |
| 6904 | - $return .= '<option class="top" value="0">' . $this->name . '</option>'; |
|
| 6904 | + $return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
| 6905 | 6905 | $arrHide = array( |
| 6906 | 6906 | $id |
| 6907 | 6907 | ); |
@@ -6910,13 +6910,13 @@ discard block |
||
| 6910 | 6910 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6911 | 6911 | if ($action != 'add') { |
| 6912 | 6912 | if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) { |
| 6913 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6913 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 6914 | 6914 | } else { |
| 6915 | 6915 | $arrHide[] = $arrLP[$i]['id']; |
| 6916 | 6916 | } |
| 6917 | 6917 | } else { |
| 6918 | 6918 | if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
| 6919 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 6919 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 6920 | 6920 | } |
| 6921 | 6921 | } |
| 6922 | 6922 | if (is_array($arrLP)) { |
@@ -6927,10 +6927,10 @@ discard block |
||
| 6927 | 6927 | $return .= '</td>'; |
| 6928 | 6928 | $return .= '</tr>'; |
| 6929 | 6929 | $return .= '<tr>'; |
| 6930 | - $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>'; |
|
| 6930 | + $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>'; |
|
| 6931 | 6931 | $return .= '<td class="input">'; |
| 6932 | 6932 | $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">'; |
| 6933 | - $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
|
| 6933 | + $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>'; |
|
| 6934 | 6934 | |
| 6935 | 6935 | for ($i = 0; $i < count($arrLP); $i++) { |
| 6936 | 6936 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
@@ -6940,8 +6940,8 @@ discard block |
||
| 6940 | 6940 | else |
| 6941 | 6941 | $selected = ''; |
| 6942 | 6942 | |
| 6943 | - $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . |
|
| 6944 | - get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
|
| 6943 | + $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'. |
|
| 6944 | + get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
| 6945 | 6945 | } |
| 6946 | 6946 | } |
| 6947 | 6947 | |
@@ -6975,25 +6975,25 @@ discard block |
||
| 6975 | 6975 | $return .= '<tr>'; |
| 6976 | 6976 | |
| 6977 | 6977 | if ($action == 'add') { |
| 6978 | - $return .= '<td> </td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('AddForumToCourse') . ' </button></td>'; |
|
| 6978 | + $return .= '<td> </td><td><button class="save" name="submit_button" type="submit"> '.get_lang('AddForumToCourse').' </button></td>'; |
|
| 6979 | 6979 | } else { |
| 6980 | - $return .= '<td> </td><td><button class="save" name="submit_button" type="submit"> ' . get_lang('EditCurrentForum') . ' </button></td>'; |
|
| 6980 | + $return .= '<td> </td><td><button class="save" name="submit_button" type="submit"> '.get_lang('EditCurrentForum').' </button></td>'; |
|
| 6981 | 6981 | } |
| 6982 | 6982 | $return .= '</tr>'; |
| 6983 | 6983 | $return .= '</table>'; |
| 6984 | 6984 | |
| 6985 | 6985 | if ($action == 'move') { |
| 6986 | - $return .= '<input name="title" type="hidden" value="' . $item_title . '" />'; |
|
| 6987 | - $return .= '<input name="description" type="hidden" value="' . $item_description . '" />'; |
|
| 6986 | + $return .= '<input name="title" type="hidden" value="'.$item_title.'" />'; |
|
| 6987 | + $return .= '<input name="description" type="hidden" value="'.$item_description.'" />'; |
|
| 6988 | 6988 | } |
| 6989 | 6989 | |
| 6990 | 6990 | if (is_numeric($extra_info)) { |
| 6991 | - $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
|
| 6991 | + $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />'; |
|
| 6992 | 6992 | } elseif (is_array($extra_info)) { |
| 6993 | - $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
|
| 6993 | + $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />'; |
|
| 6994 | 6994 | } |
| 6995 | - $return .= '<input name="type" type="hidden" value="' . TOOL_FORUM . '" />'; |
|
| 6996 | - $return .= '<input name="post_time" type="hidden" value="' . time() . '" />'; |
|
| 6995 | + $return .= '<input name="type" type="hidden" value="'.TOOL_FORUM.'" />'; |
|
| 6996 | + $return .= '<input name="post_time" type="hidden" value="'.time().'" />'; |
|
| 6997 | 6997 | $return .= '</form>'; |
| 6998 | 6998 | $return .= '</div>'; |
| 6999 | 6999 | |
@@ -7020,7 +7020,7 @@ discard block |
||
| 7020 | 7020 | $item_title = stripslashes($extra_info['title']); |
| 7021 | 7021 | } elseif (is_numeric($extra_info)) { |
| 7022 | 7022 | $sql = "SELECT thread_title as title FROM $tbl_forum |
| 7023 | - WHERE c_id = $course_id AND thread_id = " . $extra_info; |
|
| 7023 | + WHERE c_id = $course_id AND thread_id = ".$extra_info; |
|
| 7024 | 7024 | |
| 7025 | 7025 | $result = Database::query($sql); |
| 7026 | 7026 | $row = Database :: fetch_array($result); |
@@ -7040,15 +7040,15 @@ discard block |
||
| 7040 | 7040 | $parent = 0; |
| 7041 | 7041 | } |
| 7042 | 7042 | |
| 7043 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 7044 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 7043 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 7044 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 7045 | 7045 | |
| 7046 | 7046 | $result = Database::query($sql); |
| 7047 | 7047 | |
| 7048 | - $arrLP = array (); |
|
| 7048 | + $arrLP = array(); |
|
| 7049 | 7049 | |
| 7050 | 7050 | while ($row = Database :: fetch_array($result)) { |
| 7051 | - $arrLP[] = array ( |
|
| 7051 | + $arrLP[] = array( |
|
| 7052 | 7052 | 'id' => $row['id'], |
| 7053 | 7053 | 'item_type' => $row['item_type'], |
| 7054 | 7054 | 'title' => $row['title'], |
@@ -7071,31 +7071,31 @@ discard block |
||
| 7071 | 7071 | |
| 7072 | 7072 | $return .= '<form method="POST">'; |
| 7073 | 7073 | if ($action == 'add') |
| 7074 | - $return .= '<legend>' . get_lang('CreateTheForum') . '</legend>'; |
|
| 7075 | - elseif ($action == 'move') $return .= '<p class="lp_title">' . get_lang('MoveTheCurrentForum') . ' :</p>'; |
|
| 7074 | + $return .= '<legend>'.get_lang('CreateTheForum').'</legend>'; |
|
| 7075 | + elseif ($action == 'move') $return .= '<p class="lp_title">'.get_lang('MoveTheCurrentForum').' :</p>'; |
|
| 7076 | 7076 | else |
| 7077 | - $return .= '<legend>' . get_lang('EditCurrentForum') . '</legend>'; |
|
| 7077 | + $return .= '<legend>'.get_lang('EditCurrentForum').'</legend>'; |
|
| 7078 | 7078 | |
| 7079 | 7079 | $return .= '<table cellpadding="0" cellspacing="0" class="lp_form">'; |
| 7080 | 7080 | $return .= '<tr>'; |
| 7081 | - $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>'; |
|
| 7081 | + $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>'; |
|
| 7082 | 7082 | $return .= '<td class="input">'; |
| 7083 | 7083 | $return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">'; |
| 7084 | - $return .= '<option class="top" value="0">' . $this->name . '</option>'; |
|
| 7085 | - $arrHide = array ( |
|
| 7084 | + $return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
| 7085 | + $arrHide = array( |
|
| 7086 | 7086 | $id |
| 7087 | 7087 | ); |
| 7088 | 7088 | |
| 7089 | 7089 | for ($i = 0; $i < count($arrLP); $i++) { |
| 7090 | 7090 | if ($action != 'add') { |
| 7091 | 7091 | if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) { |
| 7092 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 7092 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 7093 | 7093 | } else { |
| 7094 | 7094 | $arrHide[] = $arrLP[$i]['id']; |
| 7095 | 7095 | } |
| 7096 | 7096 | } else { |
| 7097 | 7097 | if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
| 7098 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 7098 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 7099 | 7099 | } |
| 7100 | 7100 | } |
| 7101 | 7101 | |
@@ -7107,10 +7107,10 @@ discard block |
||
| 7107 | 7107 | $return .= '</td>'; |
| 7108 | 7108 | $return .= '</tr>'; |
| 7109 | 7109 | $return .= '<tr>'; |
| 7110 | - $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>'; |
|
| 7110 | + $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>'; |
|
| 7111 | 7111 | $return .= '<td class="input">'; |
| 7112 | 7112 | $return .= '<select id="previous" name="previous" size="1">'; |
| 7113 | - $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
|
| 7113 | + $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>'; |
|
| 7114 | 7114 | for ($i = 0; $i < count($arrLP); $i++) { |
| 7115 | 7115 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
| 7116 | 7116 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -7119,7 +7119,7 @@ discard block |
||
| 7119 | 7119 | else |
| 7120 | 7120 | $selected = ''; |
| 7121 | 7121 | |
| 7122 | - $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
|
| 7122 | + $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
| 7123 | 7123 | } |
| 7124 | 7124 | } |
| 7125 | 7125 | $return .= '</select>'; |
@@ -7127,8 +7127,8 @@ discard block |
||
| 7127 | 7127 | $return .= '</tr>'; |
| 7128 | 7128 | if ($action != 'move') { |
| 7129 | 7129 | $return .= '<tr>'; |
| 7130 | - $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>'; |
|
| 7131 | - $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="' . $item_title . '" /></td>'; |
|
| 7130 | + $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>'; |
|
| 7131 | + $return .= '<td class="input"><input id="idTitle" name="title" type="text" value="'.$item_title.'" /></td>'; |
|
| 7132 | 7132 | $return .= '</tr>'; |
| 7133 | 7133 | $return .= '<tr>'; |
| 7134 | 7134 | $return .= '</tr>'; |
@@ -7155,17 +7155,17 @@ discard block |
||
| 7155 | 7155 | } |
| 7156 | 7156 | |
| 7157 | 7157 | $return .= '<tr>'; |
| 7158 | - $return .= '<td class="label"><label for="idPrerequisites">' . get_lang('LearnpathPrerequisites') . '</label></td>'; |
|
| 7159 | - $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">' . get_lang('NoPrerequisites') . '</option>'; |
|
| 7158 | + $return .= '<td class="label"><label for="idPrerequisites">'.get_lang('LearnpathPrerequisites').'</label></td>'; |
|
| 7159 | + $return .= '<td class="input"><select name="prerequisites" id="prerequisites"><option value="0">'.get_lang('NoPrerequisites').'</option>'; |
|
| 7160 | 7160 | |
| 7161 | 7161 | foreach ($arrHide as $key => $value) { |
| 7162 | 7162 | if ($key == $s_selected_position && $action == 'add') { |
| 7163 | - $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>'; |
|
| 7163 | + $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>'; |
|
| 7164 | 7164 | } |
| 7165 | 7165 | elseif ($key == $id_prerequisite && $action == 'edit') { |
| 7166 | - $return .= '<option value="' . $key . '" selected="selected">' . $value['value'] . '</option>'; |
|
| 7166 | + $return .= '<option value="'.$key.'" selected="selected">'.$value['value'].'</option>'; |
|
| 7167 | 7167 | } else { |
| 7168 | - $return .= '<option value="' . $key . '">' . $value['value'] . '</option>'; |
|
| 7168 | + $return .= '<option value="'.$key.'">'.$value['value'].'</option>'; |
|
| 7169 | 7169 | } |
| 7170 | 7170 | } |
| 7171 | 7171 | $return .= "</select></td>"; |
@@ -7179,19 +7179,19 @@ discard block |
||
| 7179 | 7179 | $return .= '</table>'; |
| 7180 | 7180 | |
| 7181 | 7181 | if ($action == 'move') { |
| 7182 | - $return .= '<input name="title" type="hidden" value="' . $item_title . '" />'; |
|
| 7183 | - $return .= '<input name="description" type="hidden" value="' . $item_description . '" />'; |
|
| 7182 | + $return .= '<input name="title" type="hidden" value="'.$item_title.'" />'; |
|
| 7183 | + $return .= '<input name="description" type="hidden" value="'.$item_description.'" />'; |
|
| 7184 | 7184 | } |
| 7185 | 7185 | |
| 7186 | 7186 | if (is_numeric($extra_info)) { |
| 7187 | - $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
|
| 7187 | + $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />'; |
|
| 7188 | 7188 | } |
| 7189 | 7189 | elseif (is_array($extra_info)) { |
| 7190 | - $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
|
| 7190 | + $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />'; |
|
| 7191 | 7191 | } |
| 7192 | 7192 | |
| 7193 | - $return .= '<input name="type" type="hidden" value="' . TOOL_THREAD . '" />'; |
|
| 7194 | - $return .= '<input name="post_time" type="hidden" value="' . time() . '" />'; |
|
| 7193 | + $return .= '<input name="type" type="hidden" value="'.TOOL_THREAD.'" />'; |
|
| 7194 | + $return .= '<input name="post_time" type="hidden" value="'.time().'" />'; |
|
| 7195 | 7195 | $return .= '</form>'; |
| 7196 | 7196 | $return .= '</div>'; |
| 7197 | 7197 | |
@@ -7217,10 +7217,10 @@ discard block |
||
| 7217 | 7217 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 7218 | 7218 | |
| 7219 | 7219 | if ($id != 0 && is_array($extra_info)) { |
| 7220 | - $item_title = $extra_info['title']; |
|
| 7221 | - $item_description = $extra_info['description']; |
|
| 7222 | - $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); |
|
| 7223 | - $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); |
|
| 7220 | + $item_title = $extra_info['title']; |
|
| 7221 | + $item_description = $extra_info['description']; |
|
| 7222 | + $item_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/scorm/'.$this->path.'/'.stripslashes($extra_info['path']); |
|
| 7223 | + $item_path_fck = '/scorm/'.$this->path.'/'.stripslashes($extra_info['path']); |
|
| 7224 | 7224 | } else { |
| 7225 | 7225 | $item_title = ''; |
| 7226 | 7226 | $item_description = ''; |
@@ -7234,17 +7234,17 @@ discard block |
||
| 7234 | 7234 | } |
| 7235 | 7235 | |
| 7236 | 7236 | $id = intval($id); |
| 7237 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 7237 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 7238 | 7238 | WHERE |
| 7239 | 7239 | c_id = ".$course_id." AND |
| 7240 | - lp_id = " . $this->lp_id . " AND |
|
| 7240 | + lp_id = " . $this->lp_id." AND |
|
| 7241 | 7241 | id != $id"; |
| 7242 | 7242 | |
| 7243 | 7243 | if ($item_type == 'module') |
| 7244 | 7244 | $sql .= " AND parent_item_id = 0"; |
| 7245 | 7245 | |
| 7246 | 7246 | $result = Database::query($sql); |
| 7247 | - $arrLP = array (); |
|
| 7247 | + $arrLP = array(); |
|
| 7248 | 7248 | |
| 7249 | 7249 | while ($row = Database :: fetch_array($result)) { |
| 7250 | 7250 | $arrLP[] = array( |
@@ -7272,9 +7272,9 @@ discard block |
||
| 7272 | 7272 | |
| 7273 | 7273 | $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null; |
| 7274 | 7274 | |
| 7275 | - $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; |
|
| 7275 | + $url = api_get_self().'?'.api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; |
|
| 7276 | 7276 | |
| 7277 | - $form = new FormValidator('form', 'POST', $url); |
|
| 7277 | + $form = new FormValidator('form', 'POST', $url); |
|
| 7278 | 7278 | |
| 7279 | 7279 | $defaults['title'] = api_html_entity_decode($item_title, ENT_QUOTES, $charset); |
| 7280 | 7280 | $defaults['description'] = $item_description; |
@@ -7318,7 +7318,7 @@ discard block |
||
| 7318 | 7318 | $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', array('id' => 'idParent', 'onchange' => "javascript: load_cbo(this.value);")); |
| 7319 | 7319 | |
| 7320 | 7320 | foreach ($arrHide as $key => $value) { |
| 7321 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
| 7321 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
| 7322 | 7322 | } |
| 7323 | 7323 | if (!empty($s_selected_parent)) { |
| 7324 | 7324 | $parent_select->setSelected($s_selected_parent); |
@@ -7340,16 +7340,16 @@ discard block |
||
| 7340 | 7340 | $s_selected_position = $arrLP[$i]['id']; |
| 7341 | 7341 | } |
| 7342 | 7342 | |
| 7343 | - $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
|
| 7343 | + $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"'; |
|
| 7344 | 7344 | } |
| 7345 | 7345 | } |
| 7346 | 7346 | |
| 7347 | 7347 | $position = $form->addElement('select', 'previous', get_lang('Position'), '', array('id' => 'previous')); |
| 7348 | 7348 | $padding = isset($value['padding']) ? $value['padding'] : 0; |
| 7349 | - $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:' . $padding . 'px;"'); |
|
| 7349 | + $position->addOption(get_lang('FirstPosition'), 0, 'style="padding-left:'.$padding.'px;"'); |
|
| 7350 | 7350 | |
| 7351 | 7351 | foreach ($arrHide as $key => $value) { |
| 7352 | - $position->addOption($value['value'] . '"', $key, 'style="padding-left:' . $padding . 'px;"'); |
|
| 7352 | + $position->addOption($value['value'].'"', $key, 'style="padding-left:'.$padding.'px;"'); |
|
| 7353 | 7353 | } |
| 7354 | 7354 | |
| 7355 | 7355 | if (!empty ($s_selected_position)) { |
@@ -7378,23 +7378,23 @@ discard block |
||
| 7378 | 7378 | //assets can't be modified |
| 7379 | 7379 | |
| 7380 | 7380 | //$item_type == 'asset' || |
| 7381 | - if (( $item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) { |
|
| 7381 | + if (($item_type == 'sco') && ($extension == 'html' || $extension == 'htm')) { |
|
| 7382 | 7382 | |
| 7383 | 7383 | if ($item_type == 'sco') { |
| 7384 | - $form->addElement('html', '<script type="text/javascript">alert("' . get_lang('WarningWhenEditingScorm') . '")</script>'); |
|
| 7384 | + $form->addElement('html', '<script type="text/javascript">alert("'.get_lang('WarningWhenEditingScorm').'")</script>'); |
|
| 7385 | 7385 | } |
| 7386 | 7386 | $renderer = $form->defaultRenderer(); |
| 7387 | 7387 | $renderer->setElementTemplate('<br /> {label}<br />{element}', 'content_lp'); |
| 7388 | 7388 | |
| 7389 | 7389 | $relative_prefix = ''; |
| 7390 | 7390 | |
| 7391 | - $editor_config = array( 'ToolbarSet' => 'LearningPathDocuments', |
|
| 7391 | + $editor_config = array('ToolbarSet' => 'LearningPathDocuments', |
|
| 7392 | 7392 | 'Width' => '100%', |
| 7393 | 7393 | 'Height' => '500', |
| 7394 | 7394 | 'FullPage' => true, |
| 7395 | 7395 | 'CreateDocumentDir' => $relative_prefix, |
| 7396 | - 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/scorm/', |
|
| 7397 | - 'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck |
|
| 7396 | + 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/scorm/', |
|
| 7397 | + 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().$item_path_fck |
|
| 7398 | 7398 | ); |
| 7399 | 7399 | |
| 7400 | 7400 | $form->addElement('html_editor', 'content_lp', '', null, $editor_config); |
@@ -7403,7 +7403,7 @@ discard block |
||
| 7403 | 7403 | $defaults['content_lp'] = file_get_contents($content_path); |
| 7404 | 7404 | } |
| 7405 | 7405 | |
| 7406 | - $form->addElement('hidden', 'type', 'dokeos_' . $item_type); |
|
| 7406 | + $form->addElement('hidden', 'type', 'dokeos_'.$item_type); |
|
| 7407 | 7407 | $form->addElement('hidden', 'post_time', time()); |
| 7408 | 7408 | $form->setDefaults($defaults); |
| 7409 | 7409 | return $form->return_form(); |
@@ -7441,8 +7441,8 @@ discard block |
||
| 7441 | 7441 | // We don't display the document form if it's not an editable document (html or txt file). |
| 7442 | 7442 | if ($action == "add") { |
| 7443 | 7443 | if (is_numeric($extra_info)) { |
| 7444 | - $sql_doc = "SELECT path FROM " . $tbl_doc . " |
|
| 7445 | - WHERE c_id = ".$course_id." AND id = " . intval($extra_info); |
|
| 7444 | + $sql_doc = "SELECT path FROM ".$tbl_doc." |
|
| 7445 | + WHERE c_id = ".$course_id." AND id = ".intval($extra_info); |
|
| 7446 | 7446 | $result = Database::query($sql_doc); |
| 7447 | 7447 | $path_file = Database :: result($result, 0, 0); |
| 7448 | 7448 | $path_parts = pathinfo($path_file); |
@@ -7460,13 +7460,13 @@ discard block |
||
| 7460 | 7460 | $item_title = stripslashes($path_parts['filename']); |
| 7461 | 7461 | } |
| 7462 | 7462 | } elseif (is_numeric($extra_info)) { |
| 7463 | - $sql_doc = "SELECT path, title FROM " . $tbl_doc . " |
|
| 7463 | + $sql_doc = "SELECT path, title FROM ".$tbl_doc." |
|
| 7464 | 7464 | WHERE |
| 7465 | 7465 | c_id = ".$course_id." AND |
| 7466 | 7466 | id = " . intval($extra_info); |
| 7467 | 7467 | |
| 7468 | 7468 | $result = Database::query($sql_doc); |
| 7469 | - $row = Database::fetch_array($result); |
|
| 7469 | + $row = Database::fetch_array($result); |
|
| 7470 | 7470 | $item_title = $row['title']; |
| 7471 | 7471 | $item_title = str_replace('_', ' ', $item_title); |
| 7472 | 7472 | if (empty ($item_title)) { |
@@ -7485,11 +7485,11 @@ discard block |
||
| 7485 | 7485 | $parent = 0; |
| 7486 | 7486 | } |
| 7487 | 7487 | |
| 7488 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 7489 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 7488 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 7489 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 7490 | 7490 | |
| 7491 | 7491 | $result = Database::query($sql); |
| 7492 | - $arrLP = array (); |
|
| 7492 | + $arrLP = array(); |
|
| 7493 | 7493 | while ($row = Database :: fetch_array($result)) { |
| 7494 | 7494 | $arrLP[] = array( |
| 7495 | 7495 | 'id' => $row['id'], |
@@ -7523,9 +7523,9 @@ discard block |
||
| 7523 | 7523 | $return .= '</legend>'; |
| 7524 | 7524 | |
| 7525 | 7525 | if (isset ($_GET['edit']) && $_GET['edit'] == 'true') { |
| 7526 | - $return .= Display :: return_warning_message('<strong>' . get_lang('Warning') . ' !</strong><br />' . get_lang('WarningEditingDocument'), false); |
|
| 7526 | + $return .= Display :: return_warning_message('<strong>'.get_lang('Warning').' !</strong><br />'.get_lang('WarningEditingDocument'), false); |
|
| 7527 | 7527 | } |
| 7528 | - $form = new FormValidator('form', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data")); |
|
| 7528 | + $form = new FormValidator('form', 'POST', api_get_self().'?'.$_SERVER['QUERY_STRING'], '', array('enctype'=> "multipart/form-data")); |
|
| 7529 | 7529 | $defaults['title'] = Security :: remove_XSS($item_title); |
| 7530 | 7530 | if (empty($item_title)) { |
| 7531 | 7531 | $defaults['title'] = Security::remove_XSS($item_title); |
@@ -7561,15 +7561,15 @@ discard block |
||
| 7561 | 7561 | } |
| 7562 | 7562 | |
| 7563 | 7563 | $parent_select = $form->addElement('select', 'parent', get_lang('Parent'), '', 'class="form-control" id="idParent" " onchange="javascript: load_cbo(this.value);"'); |
| 7564 | - $my_count=0; |
|
| 7564 | + $my_count = 0; |
|
| 7565 | 7565 | foreach ($arrHide as $key => $value) { |
| 7566 | - if ($my_count!=0) { |
|
| 7566 | + if ($my_count != 0) { |
|
| 7567 | 7567 | // The LP name is also the first section and is not in the same charset like the other sections. |
| 7568 | 7568 | $value['value'] = Security :: remove_XSS($value['value']); |
| 7569 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
| 7569 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
| 7570 | 7570 | } else { |
| 7571 | 7571 | $value['value'] = Security :: remove_XSS($value['value']); |
| 7572 | - $parent_select->addOption($value['value'], $key, 'style="padding-left:' . $value['padding'] . 'px;"'); |
|
| 7572 | + $parent_select->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"'); |
|
| 7573 | 7573 | } |
| 7574 | 7574 | $my_count++; |
| 7575 | 7575 | } |
@@ -7577,7 +7577,7 @@ discard block |
||
| 7577 | 7577 | if (!empty($id)) { |
| 7578 | 7578 | $parent_select->setSelected($parent); |
| 7579 | 7579 | } else { |
| 7580 | - $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0 ; |
|
| 7580 | + $parent_item_id = isset($_SESSION['parent_item_id']) ? $_SESSION['parent_item_id'] : 0; |
|
| 7581 | 7581 | $parent_select->setSelected($parent_item_id); |
| 7582 | 7582 | } |
| 7583 | 7583 | |
@@ -7594,7 +7594,7 @@ discard block |
||
| 7594 | 7594 | if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) |
| 7595 | 7595 | $s_selected_position = $arrLP[$i]['id']; |
| 7596 | 7596 | elseif ($action == 'add') $s_selected_position = $arrLP[$i]['id']; |
| 7597 | - $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After') . ' "' . $arrLP[$i]['title'] . '"'; |
|
| 7597 | + $arrHide[$arrLP[$i]['id']]['value'] = get_lang('After').' "'.$arrLP[$i]['title'].'"'; |
|
| 7598 | 7598 | } |
| 7599 | 7599 | } |
| 7600 | 7600 | |
@@ -7602,8 +7602,8 @@ discard block |
||
| 7602 | 7602 | $position->addOption(get_lang('FirstPosition'), 0); |
| 7603 | 7603 | |
| 7604 | 7604 | foreach ($arrHide as $key => $value) { |
| 7605 | - $padding = isset($value['padding']) ? $value['padding']: 0; |
|
| 7606 | - $position->addOption($value['value'], $key, 'style="padding-left:' . $padding . 'px;"'); |
|
| 7605 | + $padding = isset($value['padding']) ? $value['padding'] : 0; |
|
| 7606 | + $position->addOption($value['value'], $key, 'style="padding-left:'.$padding.'px;"'); |
|
| 7607 | 7607 | } |
| 7608 | 7608 | $position->setSelected($s_selected_position); |
| 7609 | 7609 | |
@@ -7673,7 +7673,7 @@ discard block |
||
| 7673 | 7673 | $relative_path = array_slice($relative_path, 1, $cnt); |
| 7674 | 7674 | $relative_path = implode('/', $relative_path); |
| 7675 | 7675 | if (strlen($relative_path) > 0) { |
| 7676 | - $relative_path = $relative_path . '/'; |
|
| 7676 | + $relative_path = $relative_path.'/'; |
|
| 7677 | 7677 | } |
| 7678 | 7678 | } else { |
| 7679 | 7679 | $result = $this->generate_lp_folder($_course); |
@@ -7687,8 +7687,8 @@ discard block |
||
| 7687 | 7687 | 'Height' => '500', |
| 7688 | 7688 | 'FullPage' => true, |
| 7689 | 7689 | 'CreateDocumentDir' => $relative_prefix, |
| 7690 | - 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/', |
|
| 7691 | - 'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path |
|
| 7690 | + 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/', |
|
| 7691 | + 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path |
|
| 7692 | 7692 | ); |
| 7693 | 7693 | |
| 7694 | 7694 | if ($_GET['action'] == 'add_item') { |
@@ -7755,8 +7755,8 @@ discard block |
||
| 7755 | 7755 | $item_url = stripslashes($extra_info['url']); |
| 7756 | 7756 | } elseif (is_numeric($extra_info)) { |
| 7757 | 7757 | $extra_info = intval($extra_info); |
| 7758 | - $sql = "SELECT title, description, url FROM " . $tbl_link . " |
|
| 7759 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
| 7758 | + $sql = "SELECT title, description, url FROM ".$tbl_link." |
|
| 7759 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
| 7760 | 7760 | $result = Database::query($sql); |
| 7761 | 7761 | $row = Database :: fetch_array($result); |
| 7762 | 7762 | $item_title = $row['title']; |
@@ -7776,8 +7776,8 @@ discard block |
||
| 7776 | 7776 | $parent = 0; |
| 7777 | 7777 | } |
| 7778 | 7778 | |
| 7779 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 7780 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 7779 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 7780 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 7781 | 7781 | $result = Database::query($sql); |
| 7782 | 7782 | $arrLP = array(); |
| 7783 | 7783 | |
@@ -7804,10 +7804,10 @@ discard block |
||
| 7804 | 7804 | unset ($this->arrMenu); |
| 7805 | 7805 | |
| 7806 | 7806 | if ($action == 'add') |
| 7807 | - $legend .= get_lang('CreateTheLink') . ' :'; |
|
| 7808 | - elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink') . ' :'; |
|
| 7807 | + $legend .= get_lang('CreateTheLink').' :'; |
|
| 7808 | + elseif ($action == 'move') $legend .= get_lang('MoveCurrentLink').' :'; |
|
| 7809 | 7809 | else |
| 7810 | - $legend .= get_lang('EditCurrentLink') . ' :'; |
|
| 7810 | + $legend .= get_lang('EditCurrentLink').' :'; |
|
| 7811 | 7811 | |
| 7812 | 7812 | $legend .= '</legend>'; |
| 7813 | 7813 | |
@@ -7818,16 +7818,16 @@ discard block |
||
| 7818 | 7818 | |
| 7819 | 7819 | if ($action != 'move') { |
| 7820 | 7820 | $return .= '<tr>'; |
| 7821 | - $return .= '<td class="label"><label for="idTitle">' . get_lang('Title') . '</label></td>'; |
|
| 7822 | - $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="' . $item_title . '" class="learnpath_item_form"/></td>'; |
|
| 7821 | + $return .= '<td class="label"><label for="idTitle">'.get_lang('Title').'</label></td>'; |
|
| 7822 | + $return .= '<td class="input"><input id="idTitle" name="title" size="44" type="text" value="'.$item_title.'" class="learnpath_item_form"/></td>'; |
|
| 7823 | 7823 | $return .= '</tr>'; |
| 7824 | 7824 | } |
| 7825 | 7825 | |
| 7826 | 7826 | $return .= '<tr>'; |
| 7827 | - $return .= '<td class="label"><label for="idParent">' . get_lang('Parent') . '</label></td>'; |
|
| 7827 | + $return .= '<td class="label"><label for="idParent">'.get_lang('Parent').'</label></td>'; |
|
| 7828 | 7828 | $return .= '<td class="input">'; |
| 7829 | 7829 | $return .= '<select id="idParent" style="width:100%;" name="parent" onChange="javascript: load_cbo(this.value);" class="learnpath_item_form" size="1">'; |
| 7830 | - $return .= '<option class="top" value="0">' . $this->name . '</option>'; |
|
| 7830 | + $return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
| 7831 | 7831 | $arrHide = array( |
| 7832 | 7832 | $id |
| 7833 | 7833 | ); |
@@ -7837,13 +7837,13 @@ discard block |
||
| 7837 | 7837 | for ($i = 0; $i < count($arrLP); $i++) { |
| 7838 | 7838 | if ($action != 'add') { |
| 7839 | 7839 | if (($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') && !in_array($arrLP[$i]['id'], $arrHide) && !in_array($arrLP[$i]['parent_item_id'], $arrHide)) { |
| 7840 | - $return .= '<option ' . (($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 7840 | + $return .= '<option '.(($parent == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 7841 | 7841 | } else { |
| 7842 | 7842 | $arrHide[] = $arrLP[$i]['id']; |
| 7843 | 7843 | } |
| 7844 | 7844 | } else { |
| 7845 | 7845 | if ($arrLP[$i]['item_type'] == 'dokeos_module' || $arrLP[$i]['item_type'] == 'dokeos_chapter' || $arrLP[$i]['item_type'] == 'dir') |
| 7846 | - $return .= '<option ' . (($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '') . 'style="padding-left:' . ($arrLP[$i]['depth'] * 10) . 'px;" value="' . $arrLP[$i]['id'] . '">' . $arrLP[$i]['title'] . '</option>'; |
|
| 7846 | + $return .= '<option '.(($parent_item_id == $arrLP[$i]['id']) ? 'selected="selected" ' : '').'style="padding-left:'.($arrLP[$i]['depth'] * 10).'px;" value="'.$arrLP[$i]['id'].'">'.$arrLP[$i]['title'].'</option>'; |
|
| 7847 | 7847 | } |
| 7848 | 7848 | } |
| 7849 | 7849 | |
@@ -7855,11 +7855,11 @@ discard block |
||
| 7855 | 7855 | $return .= '</td>'; |
| 7856 | 7856 | $return .= '</tr>'; |
| 7857 | 7857 | $return .= '<tr>'; |
| 7858 | - $return .= '<td class="label"><label for="previous">' . get_lang('Position') . '</label></td>'; |
|
| 7858 | + $return .= '<td class="label"><label for="previous">'.get_lang('Position').'</label></td>'; |
|
| 7859 | 7859 | $return .= '<td class="input">'; |
| 7860 | 7860 | |
| 7861 | 7861 | $return .= '<select id="previous" name="previous" style="width:100%;" size="1" class="learnpath_item_form">'; |
| 7862 | - $return .= '<option class="top" value="0">' . get_lang('FirstPosition') . '</option>'; |
|
| 7862 | + $return .= '<option class="top" value="0">'.get_lang('FirstPosition').'</option>'; |
|
| 7863 | 7863 | for ($i = 0; $i < count($arrLP); $i++) { |
| 7864 | 7864 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
| 7865 | 7865 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -7869,7 +7869,7 @@ discard block |
||
| 7869 | 7869 | else |
| 7870 | 7870 | $selected = ''; |
| 7871 | 7871 | |
| 7872 | - $return .= '<option ' . $selected . 'value="' . $arrLP[$i]['id'] . '">' . get_lang('After') . ' "' . $arrLP[$i]['title'] . '"</option>'; |
|
| 7872 | + $return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
| 7873 | 7873 | } |
| 7874 | 7874 | } |
| 7875 | 7875 | $return .= '</select>'; |
@@ -7878,8 +7878,8 @@ discard block |
||
| 7878 | 7878 | |
| 7879 | 7879 | if ($action != 'move') { |
| 7880 | 7880 | $return .= '<tr>'; |
| 7881 | - $return .= '<td class="label"><label for="idURL">' . get_lang('Url') . '</label></td>'; |
|
| 7882 | - $return .= '<td class="input"><input' . (is_numeric($extra_info) ? ' disabled="disabled"' : '') . ' id="idURL" name="url" style="width:99%;" type="text" value="' . $item_url . '" class="learnpath_item_form" /></td>'; |
|
| 7881 | + $return .= '<td class="label"><label for="idURL">'.get_lang('Url').'</label></td>'; |
|
| 7882 | + $return .= '<td class="input"><input'.(is_numeric($extra_info) ? ' disabled="disabled"' : '').' id="idURL" name="url" style="width:99%;" type="text" value="'.$item_url.'" class="learnpath_item_form" /></td>'; |
|
| 7883 | 7883 | $return .= '</tr>'; |
| 7884 | 7884 | $id_prerequisite = 0; |
| 7885 | 7885 | if (is_array($arrLP)) { |
@@ -7906,25 +7906,25 @@ discard block |
||
| 7906 | 7906 | |
| 7907 | 7907 | $return .= '<tr>'; |
| 7908 | 7908 | if ($action == 'add') { |
| 7909 | - $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">' . get_lang('AddLinkToCourse') . '</button></td>'; |
|
| 7909 | + $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">'.get_lang('AddLinkToCourse').'</button></td>'; |
|
| 7910 | 7910 | } else { |
| 7911 | - $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">' . get_lang('EditCurrentLink') . '</button></td>'; |
|
| 7911 | + $return .= '<td> </td><td><button class="save" name="submit_button" type="submit">'.get_lang('EditCurrentLink').'</button></td>'; |
|
| 7912 | 7912 | } |
| 7913 | 7913 | $return .= '</tr>'; |
| 7914 | 7914 | $return .= '</table>'; |
| 7915 | 7915 | |
| 7916 | 7916 | if ($action == 'move') { |
| 7917 | - $return .= '<input name="title" type="hidden" value="' . $item_title . '" />'; |
|
| 7918 | - $return .= '<input name="description" type="hidden" value="' . $item_description . '" />'; |
|
| 7917 | + $return .= '<input name="title" type="hidden" value="'.$item_title.'" />'; |
|
| 7918 | + $return .= '<input name="description" type="hidden" value="'.$item_description.'" />'; |
|
| 7919 | 7919 | } |
| 7920 | 7920 | |
| 7921 | 7921 | if (is_numeric($extra_info)) { |
| 7922 | - $return .= '<input name="path" type="hidden" value="' . $extra_info . '" />'; |
|
| 7922 | + $return .= '<input name="path" type="hidden" value="'.$extra_info.'" />'; |
|
| 7923 | 7923 | } elseif (is_array($extra_info)) { |
| 7924 | - $return .= '<input name="path" type="hidden" value="' . $extra_info['path'] . '" />'; |
|
| 7924 | + $return .= '<input name="path" type="hidden" value="'.$extra_info['path'].'" />'; |
|
| 7925 | 7925 | } |
| 7926 | - $return .= '<input name="type" type="hidden" value="' . TOOL_LINK . '" />'; |
|
| 7927 | - $return .= '<input name="post_time" type="hidden" value="' . time() . '" />'; |
|
| 7926 | + $return .= '<input name="type" type="hidden" value="'.TOOL_LINK.'" />'; |
|
| 7927 | + $return .= '<input name="post_time" type="hidden" value="'.time().'" />'; |
|
| 7928 | 7928 | $return .= '</form>'; |
| 7929 | 7929 | $return .= '</div>'; |
| 7930 | 7930 | |
@@ -7950,8 +7950,8 @@ discard block |
||
| 7950 | 7950 | } elseif (is_numeric($extra_info)) { |
| 7951 | 7951 | $extra_info = intval($extra_info); |
| 7952 | 7952 | $sql = "SELECT title, description |
| 7953 | - FROM " . $tbl_publication . " |
|
| 7954 | - WHERE c_id = ".$course_id." AND id = " . $extra_info; |
|
| 7953 | + FROM " . $tbl_publication." |
|
| 7954 | + WHERE c_id = ".$course_id." AND id = ".$extra_info; |
|
| 7955 | 7955 | |
| 7956 | 7956 | $result = Database::query($sql); |
| 7957 | 7957 | $row = Database :: fetch_array($result); |
@@ -7967,13 +7967,13 @@ discard block |
||
| 7967 | 7967 | $parent = 0; |
| 7968 | 7968 | } |
| 7969 | 7969 | |
| 7970 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 7971 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 7970 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 7971 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 7972 | 7972 | |
| 7973 | 7973 | $result = Database::query($sql); |
| 7974 | 7974 | $arrLP = array(); |
| 7975 | 7975 | while ($row = Database :: fetch_array($result)) { |
| 7976 | - $arrLP[] = array ( |
|
| 7976 | + $arrLP[] = array( |
|
| 7977 | 7977 | 'id' => $row['id'], |
| 7978 | 7978 | 'item_type' => $row['item_type'], |
| 7979 | 7979 | 'title' => $row['title'], |
@@ -8019,7 +8019,7 @@ discard block |
||
| 8019 | 8019 | ] |
| 8020 | 8020 | ); |
| 8021 | 8021 | |
| 8022 | - $arrHide = array ( |
|
| 8022 | + $arrHide = array( |
|
| 8023 | 8023 | $id |
| 8024 | 8024 | ); |
| 8025 | 8025 | |
@@ -8037,7 +8037,7 @@ discard block |
||
| 8037 | 8037 | $parentSelect->addOption( |
| 8038 | 8038 | $arrLP[$i]['title'], |
| 8039 | 8039 | $arrLP[$i]['id'], |
| 8040 | - ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;'] |
|
| 8040 | + ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;'] |
|
| 8041 | 8041 | ); |
| 8042 | 8042 | |
| 8043 | 8043 | if ($parent == $arrLP[$i]['id']) { |
@@ -8054,7 +8054,7 @@ discard block |
||
| 8054 | 8054 | $parentSelect->addOption( |
| 8055 | 8055 | $arrLP[$i]['title'], |
| 8056 | 8056 | $arrLP[$i]['id'], |
| 8057 | - ['style' => 'padding-left: ' . (($arrLP[$i]['depth'] * 10) + 20) . 'px;'] |
|
| 8057 | + ['style' => 'padding-left: '.(($arrLP[$i]['depth'] * 10) + 20).'px;'] |
|
| 8058 | 8058 | ); |
| 8059 | 8059 | |
| 8060 | 8060 | if ($parent == $arrLP[$i]['id']) { |
@@ -8078,7 +8078,7 @@ discard block |
||
| 8078 | 8078 | for ($i = 0; $i < count($arrLP); $i++) { |
| 8079 | 8079 | if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { |
| 8080 | 8080 | $previousSelect->addOption( |
| 8081 | - get_lang('After') . ' "' . $arrLP[$i]['title'] . '"', |
|
| 8081 | + get_lang('After').' "'.$arrLP[$i]['title'].'"', |
|
| 8082 | 8082 | $arrLP[$i]['id'] |
| 8083 | 8083 | ); |
| 8084 | 8084 | |
@@ -8100,7 +8100,7 @@ discard block |
||
| 8100 | 8100 | } |
| 8101 | 8101 | } |
| 8102 | 8102 | } |
| 8103 | - $arrHide = array (); |
|
| 8103 | + $arrHide = array(); |
|
| 8104 | 8104 | for ($i = 0; $i < count($arrLP); $i++) { |
| 8105 | 8105 | if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dokeos_chapter') { |
| 8106 | 8106 | if ($extra_info['previous_item_id'] == $arrLP[$i]['id']) |
@@ -8192,8 +8192,8 @@ discard block |
||
| 8192 | 8192 | |
| 8193 | 8193 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 8194 | 8194 | $item_id = intval($item_id); |
| 8195 | - $sql = "SELECT * FROM " . $tbl_lp_item . " as lp |
|
| 8196 | - WHERE lp.c_id = ".$course_id." AND lp.id = " . $item_id; |
|
| 8195 | + $sql = "SELECT * FROM ".$tbl_lp_item." as lp |
|
| 8196 | + WHERE lp.c_id = ".$course_id." AND lp.id = ".$item_id; |
|
| 8197 | 8197 | $result = Database::query($sql); |
| 8198 | 8198 | $row = Database::fetch_assoc($result); |
| 8199 | 8199 | |
@@ -8207,16 +8207,16 @@ discard block |
||
| 8207 | 8207 | $audio_player .= '<script> |
| 8208 | 8208 | var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF"); |
| 8209 | 8209 | s1.addParam("allowscriptaccess","always"); |
| 8210 | - s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=true"); |
|
| 8210 | + s1.addParam("flashvars","file=../../courses/' . $_course['path'].'/document/audio/'.$row['audio'].'&autostart=true"); |
|
| 8211 | 8211 | s1.write("container"); |
| 8212 | 8212 | </script>'; |
| 8213 | 8213 | } |
| 8214 | 8214 | |
| 8215 | - $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id .'&lp_id='.$this->lp_id; |
|
| 8215 | + $url = api_get_self().'?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$item_id.'&lp_id='.$this->lp_id; |
|
| 8216 | 8216 | |
| 8217 | 8217 | $return .= Display::url( |
| 8218 | 8218 | Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), |
| 8219 | - $url.'&action=edit_item&path_item=' . $row['path'] |
|
| 8219 | + $url.'&action=edit_item&path_item='.$row['path'] |
|
| 8220 | 8220 | ); |
| 8221 | 8221 | |
| 8222 | 8222 | $return .= Display::url( |
@@ -8236,12 +8236,12 @@ discard block |
||
| 8236 | 8236 | $url.'&action=delete_item' |
| 8237 | 8237 | ); |
| 8238 | 8238 | |
| 8239 | - if ($item_type == TOOL_HOTPOTATOES ) { |
|
| 8239 | + if ($item_type == TOOL_HOTPOTATOES) { |
|
| 8240 | 8240 | $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code); |
| 8241 | 8241 | $return .= get_lang('File').': '.$document_data['absolute_path_from_document']; |
| 8242 | 8242 | } |
| 8243 | 8243 | |
| 8244 | - if ($item_type == TOOL_DOCUMENT ) { |
|
| 8244 | + if ($item_type == TOOL_DOCUMENT) { |
|
| 8245 | 8245 | $document_data = DocumentManager::get_document_data_by_id($row['path'], $course_code); |
| 8246 | 8246 | $return .= get_lang('File').': '.$document_data['absolute_path_from_document']; |
| 8247 | 8247 | } |
@@ -8262,13 +8262,13 @@ discard block |
||
| 8262 | 8262 | public function get_js_dropdown_array() |
| 8263 | 8263 | { |
| 8264 | 8264 | $course_id = api_get_course_int_id(); |
| 8265 | - $return = 'var child_name = new Array();' . "\n"; |
|
| 8266 | - $return .= 'var child_value = new Array();' . "\n\n"; |
|
| 8267 | - $return .= 'child_name[0] = new Array();' . "\n"; |
|
| 8268 | - $return .= 'child_value[0] = new Array();' . "\n\n"; |
|
| 8265 | + $return = 'var child_name = new Array();'."\n"; |
|
| 8266 | + $return .= 'var child_value = new Array();'."\n\n"; |
|
| 8267 | + $return .= 'child_name[0] = new Array();'."\n"; |
|
| 8268 | + $return .= 'child_value[0] = new Array();'."\n\n"; |
|
| 8269 | 8269 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 8270 | - $sql_zero = "SELECT * FROM " . $tbl_lp_item . " |
|
| 8271 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id . " AND parent_item_id = 0 |
|
| 8270 | + $sql_zero = "SELECT * FROM ".$tbl_lp_item." |
|
| 8271 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id." AND parent_item_id = 0 |
|
| 8272 | 8272 | ORDER BY display_order ASC"; |
| 8273 | 8273 | $res_zero = Database::query($sql_zero); |
| 8274 | 8274 | $i = 0; |
@@ -8278,28 +8278,28 @@ discard block |
||
| 8278 | 8278 | $row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']); |
| 8279 | 8279 | } |
| 8280 | 8280 | $js_var = json_encode(get_lang('After').' '.$row_zero['title']); |
| 8281 | - $return .= 'child_name[0][' . $i . '] = '.$js_var.' ;' . "\n"; |
|
| 8282 | - $return .= 'child_value[0][' . $i++ . '] = "' . $row_zero['id'] . '";' . "\n"; |
|
| 8281 | + $return .= 'child_name[0]['.$i.'] = '.$js_var.' ;'."\n"; |
|
| 8282 | + $return .= 'child_value[0]['.$i++.'] = "'.$row_zero['id'].'";'."\n"; |
|
| 8283 | 8283 | } |
| 8284 | 8284 | $return .= "\n"; |
| 8285 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 8286 | - WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id; |
|
| 8285 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 8286 | + WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id; |
|
| 8287 | 8287 | $res = Database::query($sql); |
| 8288 | 8288 | while ($row = Database :: fetch_array($res)) { |
| 8289 | - $sql_parent = "SELECT * FROM " . $tbl_lp_item . " |
|
| 8289 | + $sql_parent = "SELECT * FROM ".$tbl_lp_item." |
|
| 8290 | 8290 | WHERE |
| 8291 | 8291 | c_id = ".$course_id." AND |
| 8292 | - parent_item_id = " . $row['id'] . " |
|
| 8292 | + parent_item_id = " . $row['id']." |
|
| 8293 | 8293 | ORDER BY display_order ASC"; |
| 8294 | 8294 | $res_parent = Database::query($sql_parent); |
| 8295 | 8295 | $i = 0; |
| 8296 | - $return .= 'child_name[' . $row['id'] . '] = new Array();' . "\n"; |
|
| 8297 | - $return .= 'child_value[' . $row['id'] . '] = new Array();' . "\n\n"; |
|
| 8296 | + $return .= 'child_name['.$row['id'].'] = new Array();'."\n"; |
|
| 8297 | + $return .= 'child_value['.$row['id'].'] = new Array();'."\n\n"; |
|
| 8298 | 8298 | |
| 8299 | 8299 | while ($row_parent = Database :: fetch_array($res_parent)) { |
| 8300 | 8300 | $js_var = json_encode(get_lang('After').' '.$row_parent['title']); |
| 8301 | - $return .= 'child_name[' . $row['id'] . '][' . $i . '] = '.$js_var.' ;' . "\n"; |
|
| 8302 | - $return .= 'child_value[' . $row['id'] . '][' . $i++ . '] = "' . $row_parent['id'] . '";' . "\n"; |
|
| 8301 | + $return .= 'child_name['.$row['id'].']['.$i.'] = '.$js_var.' ;'."\n"; |
|
| 8302 | + $return .= 'child_value['.$row['id'].']['.$i++.'] = "'.$row_parent['id'].'";'."\n"; |
|
| 8303 | 8303 | } |
| 8304 | 8304 | $return .= "\n"; |
| 8305 | 8305 | } |
@@ -8320,8 +8320,8 @@ discard block |
||
| 8320 | 8320 | if (is_numeric($item_id)) { |
| 8321 | 8321 | $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); |
| 8322 | 8322 | |
| 8323 | - $sql = "SELECT * FROM " . $tbl_lp_item . " |
|
| 8324 | - WHERE c_id = ".$course_id." AND id = " . $item_id; |
|
| 8323 | + $sql = "SELECT * FROM ".$tbl_lp_item." |
|
| 8324 | + WHERE c_id = ".$course_id." AND id = ".$item_id; |
|
| 8325 | 8325 | |
| 8326 | 8326 | $res = Database::query($sql); |
| 8327 | 8327 | $row = Database :: fetch_array($res); |
@@ -8380,7 +8380,7 @@ discard block |
||
| 8380 | 8380 | */ |
| 8381 | 8381 | public function display_item_small_form($item_type, $title = '', $data = array()) |
| 8382 | 8382 | { |
| 8383 | - $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id; |
|
| 8383 | + $url = api_get_self().'?'.api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id; |
|
| 8384 | 8384 | $form = new FormValidator('small_form', 'post', $url); |
| 8385 | 8385 | $form->addElement('header', $title); |
| 8386 | 8386 | $form->addElement('text', 'title', get_lang('Title')); |
@@ -8406,7 +8406,7 @@ discard block |
||
| 8406 | 8406 | $item_id = intval($item_id); |
| 8407 | 8407 | /* Current prerequisite */ |
| 8408 | 8408 | $sql = "SELECT * FROM $tbl_lp_item |
| 8409 | - WHERE c_id = $course_id AND id = " . $item_id; |
|
| 8409 | + WHERE c_id = $course_id AND id = ".$item_id; |
|
| 8410 | 8410 | $result = Database::query($sql); |
| 8411 | 8411 | $row = Database::fetch_array($result); |
| 8412 | 8412 | $prerequisiteId = $row['prerequisite']; |
@@ -8416,20 +8416,20 @@ discard block |
||
| 8416 | 8416 | $return .= '<form method="POST">'; |
| 8417 | 8417 | $return .= '<table class="data_table">'; |
| 8418 | 8418 | $return .= '<tr>'; |
| 8419 | - $return .= '<th height="24">' . get_lang('LearnpathPrerequisites') . '</th>'; |
|
| 8420 | - $return .= '<th width="70" >' . get_lang('Minimum') . '</th>'; |
|
| 8421 | - $return .= '<th width="70">' . get_lang('Maximum') . '</th>'; |
|
| 8419 | + $return .= '<th height="24">'.get_lang('LearnpathPrerequisites').'</th>'; |
|
| 8420 | + $return .= '<th width="70" >'.get_lang('Minimum').'</th>'; |
|
| 8421 | + $return .= '<th width="70">'.get_lang('Maximum').'</th>'; |
|
| 8422 | 8422 | $return .= '</tr>'; |
| 8423 | 8423 | |
| 8424 | 8424 | // Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146 |
| 8425 | 8425 | $return .= '<tr >'; |
| 8426 | 8426 | $return .= '<td colspan="3" class="radio">'; |
| 8427 | 8427 | $return .= '<input checked="checked" id="idNone" name="prerequisites" style="margin-left:0px; margin-right:10px;" type="radio" />'; |
| 8428 | - $return .= '<label for="idNone">' . get_lang('None') . '</label>'; |
|
| 8428 | + $return .= '<label for="idNone">'.get_lang('None').'</label>'; |
|
| 8429 | 8429 | $return .= '</tr>'; |
| 8430 | 8430 | |
| 8431 | 8431 | $sql = "SELECT * FROM $tbl_lp_item |
| 8432 | - WHERE c_id = $course_id AND lp_id = " . $this->lp_id; |
|
| 8432 | + WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
| 8433 | 8433 | $result = Database::query($sql); |
| 8434 | 8434 | $arrLP = array(); |
| 8435 | 8435 | |
@@ -8472,25 +8472,25 @@ discard block |
||
| 8472 | 8472 | } |
| 8473 | 8473 | |
| 8474 | 8474 | $selectedMaxScoreValue = isset($selectedMaxScore[$item['id']]) ? $selectedMaxScore[$item['id']] : $item['max_score']; |
| 8475 | - $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']]: 0; |
|
| 8475 | + $selectedMinScoreValue = isset($selectedMinScore[$item['id']]) ? $selectedMinScore[$item['id']] : 0; |
|
| 8476 | 8476 | |
| 8477 | 8477 | $return .= '<tr>'; |
| 8478 | - $return .= '<td class="radio"' . (($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . '>'; |
|
| 8479 | - $return .= '<label for="id' . $item['id'] . '">'; |
|
| 8480 | - $return .= '<input' . (in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '') . (($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ') . 'id="id' . $item['id'] . '" name="prerequisites" style="margin-left:' . $item['depth'] * 10 . 'px; margin-right:10px;" type="radio" value="' . $item['id'] . '" />'; |
|
| 8478 | + $return .= '<td class="radio"'.(($item['item_type'] != TOOL_QUIZ && $item['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '').'>'; |
|
| 8479 | + $return .= '<label for="id'.$item['id'].'">'; |
|
| 8480 | + $return .= '<input'.(in_array($prerequisiteId, array($item['id'], $item['ref'])) ? ' checked="checked" ' : '').(($item['item_type'] == 'dokeos_module' || $item['item_type'] == 'dokeos_chapter') ? ' disabled="disabled" ' : ' ').'id="id'.$item['id'].'" name="prerequisites" style="margin-left:'.$item['depth'] * 10.'px; margin-right:10px;" type="radio" value="'.$item['id'].'" />'; |
|
| 8481 | 8481 | $icon_name = str_replace(' ', '', $item['item_type']); |
| 8482 | 8482 | |
| 8483 | - if (file_exists('../img/lp_' . $icon_name . '.png')) { |
|
| 8484 | - $return .= Display::return_icon('lp_' . $icon_name . '.png'); |
|
| 8483 | + if (file_exists('../img/lp_'.$icon_name.'.png')) { |
|
| 8484 | + $return .= Display::return_icon('lp_'.$icon_name.'.png'); |
|
| 8485 | 8485 | } else { |
| 8486 | - if (file_exists('../img/lp_' . $icon_name . '.gif')) { |
|
| 8487 | - $return .= Display::return_icon('lp_' . $icon_name . '.gif'); |
|
| 8486 | + if (file_exists('../img/lp_'.$icon_name.'.gif')) { |
|
| 8487 | + $return .= Display::return_icon('lp_'.$icon_name.'.gif'); |
|
| 8488 | 8488 | } else { |
| 8489 | 8489 | $return .= Display::return_icon('folder_document.gif', '', array('style'=>'margin-right:5px;')); |
| 8490 | 8490 | } |
| 8491 | 8491 | } |
| 8492 | 8492 | |
| 8493 | - $return .= $item['title'] . '</label>'; |
|
| 8493 | + $return .= $item['title'].'</label>'; |
|
| 8494 | 8494 | $return .= '</td>'; |
| 8495 | 8495 | |
| 8496 | 8496 | if ($item['item_type'] == TOOL_QUIZ) { |
@@ -8504,19 +8504,19 @@ discard block |
||
| 8504 | 8504 | $item['max_score'] = $tmp_obj_lp_item->max_score; |
| 8505 | 8505 | |
| 8506 | 8506 | $return .= '<td class="exercise">'; |
| 8507 | - $return .= '<input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue. '" />'; |
|
| 8507 | + $return .= '<input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" />'; |
|
| 8508 | 8508 | $return .= '</td>'; |
| 8509 | 8509 | $return .= '<td class="exercise">'; |
| 8510 | - $return .= '<input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMaxScoreValue . '" />'; |
|
| 8510 | + $return .= '<input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" />'; |
|
| 8511 | 8511 | $return .= '</td>'; |
| 8512 | 8512 | } |
| 8513 | 8513 | |
| 8514 | 8514 | if ($item['item_type'] == TOOL_HOTPOTATOES) { |
| 8515 | 8515 | $return .= '<td class="exercise">'; |
| 8516 | - $return .= '<center><input size="4" maxlength="3" name="min_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="' . $selectedMinScoreValue . '" /></center>'; |
|
| 8516 | + $return .= '<center><input size="4" maxlength="3" name="min_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMinScoreValue.'" /></center>'; |
|
| 8517 | 8517 | $return .= '</td>'; |
| 8518 | 8518 | $return .= '<td class="exercise"">'; |
| 8519 | - $return .= '<center><input size="4" maxlength="3" name="max_' . $item['id'] . '" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue . '" /></center>'; |
|
| 8519 | + $return .= '<center><input size="4" maxlength="3" name="max_'.$item['id'].'" type="number" min="0" step="any" max="'.$item['max_score'].'" value="'.$selectedMaxScoreValue.'" /></center>'; |
|
| 8520 | 8520 | $return .= '</td>'; |
| 8521 | 8521 | } |
| 8522 | 8522 | $return .= '</tr>'; |
@@ -8525,7 +8525,7 @@ discard block |
||
| 8525 | 8525 | $return .= '</tr>'; |
| 8526 | 8526 | $return .= '</table>'; |
| 8527 | 8527 | $return .= '<div style="padding-top:3px;">'; |
| 8528 | - $return .= '<button class="btn btn-primary" name="submit_button" type="submit">' . get_lang('ModifyPrerequisites') . '</button>'; |
|
| 8528 | + $return .= '<button class="btn btn-primary" name="submit_button" type="submit">'.get_lang('ModifyPrerequisites').'</button>'; |
|
| 8529 | 8529 | $return .= '</form>'; |
| 8530 | 8530 | |
| 8531 | 8531 | return $return; |
@@ -8561,7 +8561,7 @@ discard block |
||
| 8561 | 8561 | if ($row['id'] == $lp_id) { |
| 8562 | 8562 | continue; |
| 8563 | 8563 | } |
| 8564 | - $return .= '<option value="'.$row['id'].'" '.(($row['id']==$prerequisiteId)?' selected ' : '').'>'.$row['name'].'</option>'; |
|
| 8564 | + $return .= '<option value="'.$row['id'].'" '.(($row['id'] == $prerequisiteId) ? ' selected ' : '').'>'.$row['name'].'</option>'; |
|
| 8565 | 8565 | } |
| 8566 | 8566 | } |
| 8567 | 8567 | $return .= '</select>'; |
@@ -8621,8 +8621,8 @@ discard block |
||
| 8621 | 8621 | WHERE c_id = $course_id AND $activeCondition $condition_session |
| 8622 | 8622 | ORDER BY title ASC"; |
| 8623 | 8623 | |
| 8624 | - $sql_hot = "SELECT * FROM $tbl_doc |
|
| 8625 | - WHERE c_id = $course_id AND path LIKE '" . $uploadPath . "/%/%htm%' $condition_session |
|
| 8624 | + $sql_hot = "SELECT * FROM $tbl_doc |
|
| 8625 | + WHERE c_id = $course_id AND path LIKE '".$uploadPath."/%/%htm%' $condition_session |
|
| 8626 | 8626 | ORDER BY id ASC"; |
| 8627 | 8627 | |
| 8628 | 8628 | $res_quiz = Database::query($sql_quiz); |
@@ -8631,8 +8631,8 @@ discard block |
||
| 8631 | 8631 | $return = '<ul class="lp_resource">'; |
| 8632 | 8632 | $return .= '<li class="lp_resource_element">'; |
| 8633 | 8633 | $return .= Display::return_icon('new_test_small.gif'); |
| 8634 | - $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id=' . $this->lp_id . '">' . |
|
| 8635 | - get_lang('NewExercise') . '</a>'; |
|
| 8634 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'exercice/exercise_admin.php?'.api_get_cidreq().'&lp_id='.$this->lp_id.'">'. |
|
| 8635 | + get_lang('NewExercise').'</a>'; |
|
| 8636 | 8636 | $return .= '</li>'; |
| 8637 | 8637 | |
| 8638 | 8638 | // Display hotpotatoes |
@@ -8644,8 +8644,8 @@ discard block |
||
| 8644 | 8644 | $return .= '</a> '; |
| 8645 | 8645 | |
| 8646 | 8646 | $return .= Display::return_icon('hotpotatoes_s.png'); |
| 8647 | - $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq().'&action=add_item&type=' . TOOL_HOTPOTATOES . '&file=' . $row_hot['id'] . '&lp_id=' . $this->lp_id . '">'. |
|
| 8648 | - ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])) . '</a>'; |
|
| 8647 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_HOTPOTATOES.'&file='.$row_hot['id'].'&lp_id='.$this->lp_id.'">'. |
|
| 8648 | + ((!empty ($row_hot['comment'])) ? $row_hot['comment'] : Security :: remove_XSS($row_hot['title'])).'</a>'; |
|
| 8649 | 8649 | $return .= '</li>'; |
| 8650 | 8650 | } |
| 8651 | 8651 | |
@@ -8655,7 +8655,7 @@ discard block |
||
| 8655 | 8655 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
| 8656 | 8656 | $return .= '</a> '; |
| 8657 | 8657 | $return .= Display::return_icon('quizz_small.gif', '', array(), ICON_SIZE_TINY); |
| 8658 | - $return .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_QUIZ . '&file=' . $row_quiz['id'] . '&lp_id=' . $this->lp_id . '">' . |
|
| 8658 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_QUIZ.'&file='.$row_quiz['id'].'&lp_id='.$this->lp_id.'">'. |
|
| 8659 | 8659 | Security :: remove_XSS(cut($row_quiz['title'], 80)). |
| 8660 | 8660 | '</a>'; |
| 8661 | 8661 | $return .= '</li>'; |
@@ -8729,7 +8729,7 @@ discard block |
||
| 8729 | 8729 | foreach ($categorizedLinks as $categoryId => $links) { |
| 8730 | 8730 | $linkNodes = null; |
| 8731 | 8731 | foreach ($links as $key => $title) { |
| 8732 | - if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) { |
|
| 8732 | + if (api_get_item_visibility($course, TOOL_LINK, $key, $session_id) != 2) { |
|
| 8733 | 8733 | $linkNodes .= |
| 8734 | 8734 | '<li class="lp_resource_element" data_id="'.$key.'" data_type="'.TOOL_LINK.'" title="'.$title.'" > |
| 8735 | 8735 | <a class="moved" href="#">'. |
@@ -8767,7 +8767,7 @@ discard block |
||
| 8767 | 8767 | $return = '<div class="lp_resource" >'; |
| 8768 | 8768 | $return .= '<div class="lp_resource_element">'; |
| 8769 | 8769 | $return .= Display::return_icon('works_small.gif', '', array(), ICON_SIZE_TINY); |
| 8770 | - $return .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_STUDENTPUBLICATION . '&lp_id=' . $this->lp_id . '">' . get_lang('AddAssignmentPage') . '</a>'; |
|
| 8770 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_STUDENTPUBLICATION.'&lp_id='.$this->lp_id.'">'.get_lang('AddAssignmentPage').'</a>'; |
|
| 8771 | 8771 | $return .= '</div>'; |
| 8772 | 8772 | $return .= '</div>'; |
| 8773 | 8773 | return $return; |
@@ -8788,7 +8788,7 @@ discard block |
||
| 8788 | 8788 | //First add link |
| 8789 | 8789 | $return .= '<li class="lp_resource_element">'; |
| 8790 | 8790 | $return .= Display::return_icon('forum_new_small.gif'); |
| 8791 | - $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&action=add&content=forum&origin=learnpath&lp_id=' . $this->lp_id . '" title="' . get_lang('CreateANewForum') . '">' . get_lang('CreateANewForum') . '</a>'; |
|
| 8791 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&action=add&content=forum&origin=learnpath&lp_id='.$this->lp_id.'" title="'.get_lang('CreateANewForum').'">'.get_lang('CreateANewForum').'</a>'; |
|
| 8792 | 8792 | $return .= '</li>'; |
| 8793 | 8793 | |
| 8794 | 8794 | $return .= '<script> |
@@ -8810,15 +8810,15 @@ discard block |
||
| 8810 | 8810 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
| 8811 | 8811 | $return .= ' </a>'; |
| 8812 | 8812 | $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY); |
| 8813 | - $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle"> |
|
| 8814 | - <img src="' . Display::returnIconPath('add.gif').'" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" /> |
|
| 8813 | + $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum('.$forum['forum_id'].')" style="vertical-align:middle"> |
|
| 8814 | + <img src="' . Display::returnIconPath('add.gif').'" id="forum_'.$forum['forum_id'].'_opener" align="absbottom" /> |
|
| 8815 | 8815 | </a> |
| 8816 | - <a href="' . api_get_self() . '?'.api_get_cidreq().'&action=add_item&type=' . TOOL_FORUM . '&forum_id=' . $forum['forum_id'] . '&lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . |
|
| 8817 | - Security :: remove_XSS($forum['forum_title']) . '</a>'; |
|
| 8816 | + <a href="' . api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_FORUM.'&forum_id='.$forum['forum_id'].'&lp_id='.$this->lp_id.'" style="vertical-align:middle">'. |
|
| 8817 | + Security :: remove_XSS($forum['forum_title']).'</a>'; |
|
| 8818 | 8818 | |
| 8819 | 8819 | $return .= '</li>'; |
| 8820 | 8820 | |
| 8821 | - $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">'; |
|
| 8821 | + $return .= '<div style="display:none" id="forum_'.$forum['forum_id'].'_content">'; |
|
| 8822 | 8822 | $a_threads = get_threads($forum['forum_id']); |
| 8823 | 8823 | if (is_array($a_threads)) { |
| 8824 | 8824 | foreach ($a_threads as $thread) { |
@@ -8827,8 +8827,8 @@ discard block |
||
| 8827 | 8827 | $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); |
| 8828 | 8828 | $return .= ' </a>'; |
| 8829 | 8829 | $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY); |
| 8830 | - $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' . |
|
| 8831 | - Security :: remove_XSS($thread['thread_title']) . '</a>'; |
|
| 8830 | + $return .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_THREAD.'&thread_id='.$thread['thread_id'].'&lp_id='.$this->lp_id.'">'. |
|
| 8831 | + Security :: remove_XSS($thread['thread_title']).'</a>'; |
|
| 8832 | 8832 | $return .= '</li>'; |
| 8833 | 8833 | } |
| 8834 | 8834 | } |
@@ -8899,7 +8899,7 @@ discard block |
||
| 8899 | 8899 | if (is_dir($current_course_path.'/scorm/'.$this->path) && is_file($current_course_path.'/scorm/'.$this->path.'/imsmanifest.xml')) { |
| 8900 | 8900 | // Remove the possible . at the end of the path. |
| 8901 | 8901 | $dest_path_to_lp = substr($this->path, -1) == '.' ? substr($this->path, 0, -1) : $this->path; |
| 8902 | - $dest_path_to_scorm_folder = str_replace('//','/',$temp_zip_dir.'/scorm/'.$dest_path_to_lp); |
|
| 8902 | + $dest_path_to_scorm_folder = str_replace('//', '/', $temp_zip_dir.'/scorm/'.$dest_path_to_lp); |
|
| 8903 | 8903 | mkdir($dest_path_to_scorm_folder, api_get_permissions_for_new_directories(), true); |
| 8904 | 8904 | $zip_files_dist = copyr($current_course_path.'/scorm/'.$this->path, $dest_path_to_scorm_folder, array('imsmanifest'), $zip_files); |
| 8905 | 8905 | } |
@@ -8967,7 +8967,7 @@ discard block |
||
| 8967 | 8967 | if ($item->type == 'sco') { |
| 8968 | 8968 | $inc_docs = $item->get_resources_from_source( |
| 8969 | 8969 | null, |
| 8970 | - api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/' . 'scorm/' . $this->path . '/' . $item->get_path() |
|
| 8970 | + api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.'scorm/'.$this->path.'/'.$item->get_path() |
|
| 8971 | 8971 | ); |
| 8972 | 8972 | } else { |
| 8973 | 8973 | $inc_docs = $item->get_resources_from_source(); |
@@ -9183,7 +9183,7 @@ discard block |
||
| 9183 | 9183 | $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
| 9184 | 9184 | $zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9185 | 9185 | $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9186 | - $my_dep_file->setAttribute('href','document/'.$file_path); |
|
| 9186 | + $my_dep_file->setAttribute('href', 'document/'.$file_path); |
|
| 9187 | 9187 | $my_dep->setAttribute('xml:base', ''); |
| 9188 | 9188 | } |
| 9189 | 9189 | } |
@@ -9314,7 +9314,7 @@ discard block |
||
| 9314 | 9314 | //$my_item->appendChild($my_max_score); |
| 9315 | 9315 | // Give a child element <adlcp:prerequisites> to the <item> element. |
| 9316 | 9316 | $my_prereqs = $xmldoc->createElement('adlcp:prerequisites', $item->get_prereq_string()); |
| 9317 | - $my_prereqs->setAttribute('type','aicc_script'); |
|
| 9317 | + $my_prereqs->setAttribute('type', 'aicc_script'); |
|
| 9318 | 9318 | $my_item->appendChild($my_prereqs); |
| 9319 | 9319 | // Give a child element <adlcp:masteryscore> to the <item> element. |
| 9320 | 9320 | $my_masteryscore = $xmldoc->createElement('adlcp:masteryscore', $item->get_mastery_score()); |
@@ -9367,7 +9367,7 @@ discard block |
||
| 9367 | 9367 | $my_resource->appendChild($my_file); |
| 9368 | 9368 | |
| 9369 | 9369 | // Get included docs. |
| 9370 | - $inc_docs = $item->get_resources_from_source(null,$tmp_file_path); |
|
| 9370 | + $inc_docs = $item->get_resources_from_source(null, $tmp_file_path); |
|
| 9371 | 9371 | // Dependency to other files - not yet supported. |
| 9372 | 9372 | $i = 1; |
| 9373 | 9373 | foreach ($inc_docs as $doc_info) { |
@@ -9428,7 +9428,7 @@ discard block |
||
| 9428 | 9428 | $my_dep_file->setAttribute('href', $file_path); |
| 9429 | 9429 | $my_dep->setAttribute('xml:base', ''); |
| 9430 | 9430 | |
| 9431 | - if (strstr($file_path,$main_path) !== false) { |
|
| 9431 | + if (strstr($file_path, $main_path) !== false) { |
|
| 9432 | 9432 | // The calculated real path is really inside the chamilo root path. |
| 9433 | 9433 | // Reduce file path to what's under the DocumentRoot. |
| 9434 | 9434 | $file_path = substr($file_path, strlen($root_path)); |
@@ -9446,7 +9446,7 @@ discard block |
||
| 9446 | 9446 | $file_path = $_SERVER['DOCUMENT_ROOT'].$doc_info[0]; |
| 9447 | 9447 | $file_path = str_replace('//', '/', $file_path); |
| 9448 | 9448 | if (file_exists($file_path)) { |
| 9449 | - $file_path = substr($file_path,strlen($current_dir)); // We get the relative path. |
|
| 9449 | + $file_path = substr($file_path, strlen($current_dir)); // We get the relative path. |
|
| 9450 | 9450 | $zip_files[] = $my_sub_dir.'/'.$file_path; |
| 9451 | 9451 | $link_updates[$my_file_path][] = array('orig' => $doc_info[0], 'dest' => $file_path); |
| 9452 | 9452 | $my_dep_file->setAttribute('href', 'document/'.$file_path); |
@@ -9675,7 +9675,7 @@ discard block |
||
| 9675 | 9675 | if (strpos($extra_file, '.') === 0) |
| 9676 | 9676 | continue; |
| 9677 | 9677 | else { |
| 9678 | - $dest_file = $archive_path . $temp_dir_short . '/' . $extra_file; |
|
| 9678 | + $dest_file = $archive_path.$temp_dir_short.'/'.$extra_file; |
|
| 9679 | 9679 | $this->create_path($dest_file); |
| 9680 | 9680 | copy($main_code_path.$extra_file, $dest_file); |
| 9681 | 9681 | } |
@@ -9728,7 +9728,7 @@ discard block |
||
| 9728 | 9728 | } |
| 9729 | 9729 | $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$file_data['path']; |
| 9730 | 9730 | if (file_exists($file_path)) { |
| 9731 | - $files_to_export[] = array('title'=>$item->get_title(),'path'=>$file_path); |
|
| 9731 | + $files_to_export[] = array('title'=>$item->get_title(), 'path'=>$file_path); |
|
| 9732 | 9732 | } |
| 9733 | 9733 | break; |
| 9734 | 9734 | case 'asset': //commes from a scorm package generated by chamilo |
@@ -9768,12 +9768,12 @@ discard block |
||
| 9768 | 9768 | |
| 9769 | 9769 | foreach ($path_bits as $bit) { |
| 9770 | 9770 | if (!empty ($bit)) { |
| 9771 | - $new_path = $path_built . $bit; |
|
| 9771 | + $new_path = $path_built.$bit; |
|
| 9772 | 9772 | if (is_dir($new_path)) { |
| 9773 | - $path_built = $new_path . '/'; |
|
| 9773 | + $path_built = $new_path.'/'; |
|
| 9774 | 9774 | } else { |
| 9775 | 9775 | mkdir($new_path, api_get_permissions_for_new_directories()); |
| 9776 | - $path_built = $new_path . '/'; |
|
| 9776 | + $path_built = $new_path.'/'; |
|
| 9777 | 9777 | } |
| 9778 | 9778 | } |
| 9779 | 9779 | } |
@@ -9817,9 +9817,9 @@ discard block |
||
| 9817 | 9817 | |
| 9818 | 9818 | if ($upload_ok) { |
| 9819 | 9819 | if ($has_attachment) { |
| 9820 | - $courseDir = api_get_course_path() . '/upload/learning_path/images'; |
|
| 9820 | + $courseDir = api_get_course_path().'/upload/learning_path/images'; |
|
| 9821 | 9821 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 9822 | - $updir = $sys_course_path . $courseDir; |
|
| 9822 | + $updir = $sys_course_path.$courseDir; |
|
| 9823 | 9823 | // Try to add an extension to the file if it hasn't one. |
| 9824 | 9824 | $new_file_name = add_ext_on_mime(stripslashes($image_array['name']), $image_array['type']); |
| 9825 | 9825 | |
@@ -9874,7 +9874,7 @@ discard block |
||
| 9874 | 9874 | //Setting my lp_id to autolaunch = 1 |
| 9875 | 9875 | $attributes['autolaunch'] = 1; |
| 9876 | 9876 | $where = array('id = ? AND session_id = ? AND c_id = ?'=> array($lp_id, api_get_session_id(), $course_id)); |
| 9877 | - Database::update($lp_table, $attributes, $where ); |
|
| 9877 | + Database::update($lp_table, $attributes, $where); |
|
| 9878 | 9878 | } |
| 9879 | 9879 | } |
| 9880 | 9880 | |
@@ -9893,13 +9893,13 @@ discard block |
||
| 9893 | 9893 | |
| 9894 | 9894 | // Get the max order of the items |
| 9895 | 9895 | $sql_max_order = "SELECT max(display_order) AS display_order FROM $table_lp_item |
| 9896 | - WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "'"; |
|
| 9896 | + WHERE c_id = $course_id AND lp_id = '".$this->lp_id."'"; |
|
| 9897 | 9897 | $rs_max_order = Database::query($sql_max_order); |
| 9898 | 9898 | $row_max_order = Database::fetch_object($rs_max_order); |
| 9899 | 9899 | $max_order = $row_max_order->display_order; |
| 9900 | 9900 | // Get the previous item ID |
| 9901 | 9901 | $sql = "SELECT id as previous FROM $table_lp_item |
| 9902 | - WHERE c_id = $course_id AND lp_id = '" . $this->lp_id . "' AND display_order = '".$max_order."' "; |
|
| 9902 | + WHERE c_id = $course_id AND lp_id = '".$this->lp_id."' AND display_order = '".$max_order."' "; |
|
| 9903 | 9903 | $rs_max = Database::query($sql); |
| 9904 | 9904 | $row_max = Database::fetch_object($rs_max); |
| 9905 | 9905 | |
@@ -9955,9 +9955,9 @@ discard block |
||
| 9955 | 9955 | $documents_total_space = DocumentManager::documents_total_space(); |
| 9956 | 9956 | $course_max_space = DocumentManager::get_course_quota(); |
| 9957 | 9957 | $total_size = filesize($s) + $documents_total_space; |
| 9958 | - if (filesize($s)>$post_max || filesize($s)>$upl_max || $total_size>$course_max_space ){ |
|
| 9958 | + if (filesize($s) > $post_max || filesize($s) > $upl_max || $total_size > $course_max_space) { |
|
| 9959 | 9959 | return true; |
| 9960 | - } else{ |
|
| 9960 | + } else { |
|
| 9961 | 9961 | return false; |
| 9962 | 9962 | } |
| 9963 | 9963 | } |
@@ -10297,7 +10297,7 @@ discard block |
||
| 10297 | 10297 | if ($this->debug > 0) { |
| 10298 | 10298 | error_log('New LP - In learnpath::set_subscribe_users()', 0); |
| 10299 | 10299 | } |
| 10300 | - $this->subscribeUsers = intval($value);; |
|
| 10300 | + $this->subscribeUsers = intval($value); ; |
|
| 10301 | 10301 | $lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 10302 | 10302 | $lp_id = $this->get_id(); |
| 10303 | 10303 | $sql = "UPDATE $lp_table SET subscribe_users = ".$this->subscribeUsers." |
@@ -10643,7 +10643,7 @@ discard block |
||
| 10643 | 10643 | */ |
| 10644 | 10644 | public function createForum($forumCategoryId) |
| 10645 | 10645 | { |
| 10646 | - require_once api_get_path(SYS_CODE_PATH) . '/forum/forumfunction.inc.php'; |
|
| 10646 | + require_once api_get_path(SYS_CODE_PATH).'/forum/forumfunction.inc.php'; |
|
| 10647 | 10647 | |
| 10648 | 10648 | $forumId = store_forum( |
| 10649 | 10649 | [ |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | /** |
| 9 | 9 | * Code |
| 10 | 10 | */ |
| 11 | -include_once dirname(__FILE__) . '/../../../global.inc.php'; |
|
| 12 | -require_once dirname(__FILE__) . '/search_processor.class.php'; |
|
| 11 | +include_once dirname(__FILE__).'/../../../global.inc.php'; |
|
| 12 | +require_once dirname(__FILE__).'/search_processor.class.php'; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Process links before pass it to search listing scripts |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $link_id = intval($link_id); |
| 106 | 106 | $sql = "SELECT insert_user_id FROM $item_property_table |
| 107 | - WHERE ref = $link_id AND tool = '" . TOOL_LINK . "' AND c_id = $course_id |
|
| 107 | + WHERE ref = $link_id AND tool = '".TOOL_LINK."' AND c_id = $course_id |
|
| 108 | 108 | LIMIT 1"; |
| 109 | 109 | |
| 110 | 110 | $name = get_lang('Links'); |
| 111 | - $url = api_get_path(WEB_PATH) . 'main/link/link.php?cidReq=%s'; |
|
| 111 | + $url = api_get_path(WEB_PATH).'main/link/link.php?cidReq=%s'; |
|
| 112 | 112 | $url = sprintf($url, $course_id_alpha); |
| 113 | 113 | // Get the image path |
| 114 | 114 | $thumbnail = Display::returnIconPath('link.png'); |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | /** |
| 9 | 9 | * Code |
| 10 | 10 | */ |
| 11 | -include_once dirname(__FILE__) . '/../../../global.inc.php'; |
|
| 12 | -require_once dirname(__FILE__) . '/search_processor.class.php'; |
|
| 11 | +include_once dirname(__FILE__).'/../../../global.inc.php'; |
|
| 12 | +require_once dirname(__FILE__).'/search_processor.class.php'; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Process documents before pass it to search listing scripts |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $dk_result = Database::query($sql); |
| 83 | 83 | |
| 84 | 84 | $sql = "SELECT insert_user_id FROM $item_property_table |
| 85 | - WHERE ref = $doc_id AND tool = '" . TOOL_DOCUMENT . "' AND c_id = $course_id |
|
| 85 | + WHERE ref = $doc_id AND tool = '".TOOL_DOCUMENT."' AND c_id = $course_id |
|
| 86 | 86 | LIMIT 1"; |
| 87 | 87 | $name = ''; |
| 88 | 88 | if ($row = Database::fetch_array($dk_result)) { |
@@ -6,115 +6,114 @@ discard block |
||
| 6 | 6 | * |
| 7 | 7 | * Contains several functions dealing with displaying, |
| 8 | 8 | * editing,... of a blog |
| 9 | - |
|
| 10 | 9 | * @package chamilo.blogs |
| 11 | 10 | * @author Toon Keppens <[email protected]> |
| 12 | 11 | * @author Julio Montoya - Cleaning code |
| 13 | 12 | */ |
| 14 | 13 | class Blog |
| 15 | 14 | { |
| 16 | - /** |
|
| 17 | - * Get the title of a blog |
|
| 18 | - * @author Toon Keppens |
|
| 19 | - * |
|
| 20 | - * @param int $blog_id |
|
| 21 | - * |
|
| 22 | - * @return String Blog Title |
|
| 23 | - */ |
|
| 24 | - public static function get_blog_title ($blog_id) |
|
| 25 | - { |
|
| 26 | - $course_id = api_get_course_int_id(); |
|
| 27 | - |
|
| 28 | - if (is_numeric($blog_id)) { |
|
| 29 | - // init |
|
| 30 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 31 | - |
|
| 32 | - $sql = "SELECT blog_name |
|
| 15 | + /** |
|
| 16 | + * Get the title of a blog |
|
| 17 | + * @author Toon Keppens |
|
| 18 | + * |
|
| 19 | + * @param int $blog_id |
|
| 20 | + * |
|
| 21 | + * @return String Blog Title |
|
| 22 | + */ |
|
| 23 | + public static function get_blog_title ($blog_id) |
|
| 24 | + { |
|
| 25 | + $course_id = api_get_course_int_id(); |
|
| 26 | + |
|
| 27 | + if (is_numeric($blog_id)) { |
|
| 28 | + // init |
|
| 29 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 30 | + |
|
| 31 | + $sql = "SELECT blog_name |
|
| 33 | 32 | FROM " . $tbl_blogs . " |
| 34 | 33 | WHERE c_id = $course_id AND blog_id = " . intval($blog_id); |
| 35 | 34 | |
| 36 | - $result = Database::query($sql); |
|
| 37 | - $blog = Database::fetch_array($result); |
|
| 38 | - return stripslashes($blog['blog_name']); |
|
| 39 | - } |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Get the description of a blog |
|
| 45 | - * @author Toon Keppens |
|
| 46 | - * |
|
| 47 | - * @param Integer $blog_id |
|
| 48 | - * |
|
| 49 | - * @return String Blog description |
|
| 50 | - */ |
|
| 51 | - public static function get_blog_subtitle($blog_id) |
|
| 52 | - { |
|
| 53 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 54 | - $course_id = api_get_course_int_id(); |
|
| 55 | - $sql = "SELECT blog_subtitle FROM $tbl_blogs |
|
| 35 | + $result = Database::query($sql); |
|
| 36 | + $blog = Database::fetch_array($result); |
|
| 37 | + return stripslashes($blog['blog_name']); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Get the description of a blog |
|
| 44 | + * @author Toon Keppens |
|
| 45 | + * |
|
| 46 | + * @param Integer $blog_id |
|
| 47 | + * |
|
| 48 | + * @return String Blog description |
|
| 49 | + */ |
|
| 50 | + public static function get_blog_subtitle($blog_id) |
|
| 51 | + { |
|
| 52 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 53 | + $course_id = api_get_course_int_id(); |
|
| 54 | + $sql = "SELECT blog_subtitle FROM $tbl_blogs |
|
| 56 | 55 | WHERE c_id = $course_id AND blog_id ='".intval($blog_id)."'"; |
| 57 | - $result = Database::query($sql); |
|
| 58 | - $blog = Database::fetch_array($result); |
|
| 59 | - |
|
| 60 | - return stripslashes($blog['blog_subtitle']); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Get the users of a blog |
|
| 65 | - * @author Toon Keppens |
|
| 66 | - * |
|
| 67 | - * @param Integer $blog_id |
|
| 68 | - * |
|
| 69 | - * @return Array Returns an array with [userid]=>[username] |
|
| 70 | - */ |
|
| 71 | - public static function get_blog_users($blog_id) |
|
| 72 | - { |
|
| 73 | - // Database table definitions |
|
| 74 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 75 | - $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 76 | - |
|
| 77 | - $course_id = api_get_course_int_id(); |
|
| 78 | - |
|
| 79 | - // Get blog members |
|
| 80 | - $sql = "SELECT user.user_id, user.firstname, user.lastname |
|
| 56 | + $result = Database::query($sql); |
|
| 57 | + $blog = Database::fetch_array($result); |
|
| 58 | + |
|
| 59 | + return stripslashes($blog['blog_subtitle']); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Get the users of a blog |
|
| 64 | + * @author Toon Keppens |
|
| 65 | + * |
|
| 66 | + * @param Integer $blog_id |
|
| 67 | + * |
|
| 68 | + * @return Array Returns an array with [userid]=>[username] |
|
| 69 | + */ |
|
| 70 | + public static function get_blog_users($blog_id) |
|
| 71 | + { |
|
| 72 | + // Database table definitions |
|
| 73 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 74 | + $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 75 | + |
|
| 76 | + $course_id = api_get_course_int_id(); |
|
| 77 | + |
|
| 78 | + // Get blog members |
|
| 79 | + $sql = "SELECT user.user_id, user.firstname, user.lastname |
|
| 81 | 80 | FROM " . $tbl_blogs_rel_user . " blogs_rel_user |
| 82 | 81 | INNER JOIN " . $tbl_users . " user |
| 83 | 82 | ON blogs_rel_user.user_id = user.user_id |
| 84 | 83 | WHERE |
| 85 | 84 | blogs_rel_user.c_id = $course_id AND |
| 86 | 85 | blogs_rel_user.blog_id = '" . (int)$blog_id."'"; |
| 87 | - $result = Database::query($sql); |
|
| 88 | - $blog_members = array (); |
|
| 89 | - while($user = Database::fetch_array($result)) { |
|
| 90 | - $blog_members[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - return $blog_members; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Creates a new blog in the given course |
|
| 98 | - * @author Toon Keppens |
|
| 99 | - * @param Integer $course_id Id |
|
| 100 | - * @param String $title |
|
| 101 | - * @param Text $description |
|
| 102 | - */ |
|
| 103 | - public static function create_blog($title, $subtitle) |
|
| 104 | - { |
|
| 105 | - $_user = api_get_user_info(); |
|
| 86 | + $result = Database::query($sql); |
|
| 87 | + $blog_members = array (); |
|
| 88 | + while($user = Database::fetch_array($result)) { |
|
| 89 | + $blog_members[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + return $blog_members; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Creates a new blog in the given course |
|
| 97 | + * @author Toon Keppens |
|
| 98 | + * @param Integer $course_id Id |
|
| 99 | + * @param String $title |
|
| 100 | + * @param Text $description |
|
| 101 | + */ |
|
| 102 | + public static function create_blog($title, $subtitle) |
|
| 103 | + { |
|
| 104 | + $_user = api_get_user_info(); |
|
| 106 | 105 | $course_id = api_get_course_int_id(); |
| 107 | 106 | |
| 108 | - $current_date=date('Y-m-d H:i:s',time()); |
|
| 109 | - $session_id = api_get_session_id(); |
|
| 110 | - // Tabel definitions |
|
| 107 | + $current_date=date('Y-m-d H:i:s',time()); |
|
| 108 | + $session_id = api_get_session_id(); |
|
| 109 | + // Tabel definitions |
|
| 111 | 110 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
| 112 | 111 | $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); |
| 113 | 112 | $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
| 114 | 113 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
| 115 | 114 | |
| 116 | - //verified if exist blog |
|
| 117 | - $sql = 'SELECT COUNT(*) as count FROM '.$tbl_blogs.' |
|
| 115 | + //verified if exist blog |
|
| 116 | + $sql = 'SELECT COUNT(*) as count FROM '.$tbl_blogs.' |
|
| 118 | 117 | WHERE |
| 119 | 118 | c_id = '.$course_id.' AND |
| 120 | 119 | blog_name="'.Database::escape_string($title).'" AND |
@@ -123,9 +122,9 @@ discard block |
||
| 123 | 122 | $info_count = Database::result($res, 0, 0); |
| 124 | 123 | |
| 125 | 124 | if ($info_count == 0) { |
| 126 | - // Create the blog |
|
| 125 | + // Create the blog |
|
| 127 | 126 | $params = [ |
| 128 | - 'blog_id' => 0, |
|
| 127 | + 'blog_id' => 0, |
|
| 129 | 128 | 'c_id' => $course_id, |
| 130 | 129 | 'blog_name' => $title, |
| 131 | 130 | 'blog_subtitle' => $subtitle, |
@@ -133,14 +132,14 @@ discard block |
||
| 133 | 132 | 'visibility' => 1 , |
| 134 | 133 | 'session_id' => $session_id, |
| 135 | 134 | ]; |
| 136 | - $this_blog_id = Database::insert($tbl_blogs, $params); |
|
| 135 | + $this_blog_id = Database::insert($tbl_blogs, $params); |
|
| 137 | 136 | |
| 138 | - if ($this_blog_id > 0) { |
|
| 137 | + if ($this_blog_id > 0) { |
|
| 139 | 138 | |
| 140 | 139 | $sql = "UPDATE $tbl_blogs SET blog_id = iid WHERE iid = $this_blog_id"; |
| 141 | 140 | Database::query($sql); |
| 142 | 141 | |
| 143 | - // insert into item_property |
|
| 142 | + // insert into item_property |
|
| 144 | 143 | api_item_property_update( |
| 145 | 144 | api_get_course_info(), |
| 146 | 145 | TOOL_BLOGS, |
@@ -148,12 +147,12 @@ discard block |
||
| 148 | 147 | 'BlogAdded', |
| 149 | 148 | api_get_user_id() |
| 150 | 149 | ); |
| 151 | - } |
|
| 150 | + } |
|
| 152 | 151 | |
| 153 | - // Make first post. :) |
|
| 152 | + // Make first post. :) |
|
| 154 | 153 | |
| 155 | 154 | $params = [ |
| 156 | - 'post_id' => 0, |
|
| 155 | + 'post_id' => 0, |
|
| 157 | 156 | 'c_id' => $course_id, |
| 158 | 157 | 'title' => get_lang("Welcome"), |
| 159 | 158 | 'full_text' => get_lang('FirstPostText'), |
@@ -167,10 +166,10 @@ discard block |
||
| 167 | 166 | Database::query($sql); |
| 168 | 167 | } |
| 169 | 168 | |
| 170 | - // Put it on course homepage |
|
| 171 | - $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, session_id) |
|
| 169 | + // Put it on course homepage |
|
| 170 | + $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, session_id) |
|
| 172 | 171 | VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int)$this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id')"; |
| 173 | - Database::query($sql); |
|
| 172 | + Database::query($sql); |
|
| 174 | 173 | |
| 175 | 174 | $toolId = Database::insert_id(); |
| 176 | 175 | if ($toolId) { |
@@ -178,37 +177,37 @@ discard block |
||
| 178 | 177 | Database::query($sql); |
| 179 | 178 | } |
| 180 | 179 | |
| 181 | - // Subscribe the teacher to this blog |
|
| 182 | - Blog::set_user_subscribed($this_blog_id, $_user['user_id']); |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Update title and subtitle of a blog in the given course |
|
| 188 | - * @author Toon Keppens |
|
| 189 | - * @param Integer $course_id Id |
|
| 190 | - * @param String $title |
|
| 191 | - * @param Text $description |
|
| 192 | - */ |
|
| 193 | - public static function edit_blog($blog_id, $title, $subtitle) |
|
| 194 | - { |
|
| 195 | - // Table definitions |
|
| 196 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 197 | - $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); |
|
| 180 | + // Subscribe the teacher to this blog |
|
| 181 | + Blog::set_user_subscribed($this_blog_id, $_user['user_id']); |
|
| 182 | + } |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * Update title and subtitle of a blog in the given course |
|
| 187 | + * @author Toon Keppens |
|
| 188 | + * @param Integer $course_id Id |
|
| 189 | + * @param String $title |
|
| 190 | + * @param Text $description |
|
| 191 | + */ |
|
| 192 | + public static function edit_blog($blog_id, $title, $subtitle) |
|
| 193 | + { |
|
| 194 | + // Table definitions |
|
| 195 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 196 | + $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); |
|
| 198 | 197 | |
| 199 | 198 | $course_id = api_get_course_int_id(); |
| 200 | 199 | |
| 201 | - // Update the blog |
|
| 202 | - $sql = "UPDATE $tbl_blogs SET |
|
| 200 | + // Update the blog |
|
| 201 | + $sql = "UPDATE $tbl_blogs SET |
|
| 203 | 202 | blog_name = '".Database::escape_string($title)."', |
| 204 | 203 | blog_subtitle = '".Database::escape_string($subtitle)."' |
| 205 | 204 | WHERE |
| 206 | 205 | c_id = $course_id AND |
| 207 | 206 | blog_id ='".Database::escape_string((int)$blog_id)."' |
| 208 | 207 | LIMIT 1"; |
| 209 | - Database::query($sql); |
|
| 208 | + Database::query($sql); |
|
| 210 | 209 | |
| 211 | - //update item_property (update) |
|
| 210 | + //update item_property (update) |
|
| 212 | 211 | api_item_property_update( |
| 213 | 212 | api_get_course_info(), |
| 214 | 213 | TOOL_BLOGS, |
@@ -217,60 +216,60 @@ discard block |
||
| 217 | 216 | api_get_user_id() |
| 218 | 217 | ); |
| 219 | 218 | |
| 220 | - // Update course homepage link |
|
| 221 | - $sql = "UPDATE $tbl_tool SET |
|
| 219 | + // Update course homepage link |
|
| 220 | + $sql = "UPDATE $tbl_tool SET |
|
| 222 | 221 | name = '".Database::escape_string($title)."' |
| 223 | 222 | WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int)$blog_id."' LIMIT 1"; |
| 224 | - Database::query($sql); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * Deletes a blog and it's posts from the course database |
|
| 229 | - * @author Toon Keppens |
|
| 230 | - * @param Integer $blog_id |
|
| 231 | - */ |
|
| 232 | - public static function delete_blog($blog_id) |
|
| 233 | - { |
|
| 234 | - // Init |
|
| 223 | + Database::query($sql); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Deletes a blog and it's posts from the course database |
|
| 228 | + * @author Toon Keppens |
|
| 229 | + * @param Integer $blog_id |
|
| 230 | + */ |
|
| 231 | + public static function delete_blog($blog_id) |
|
| 232 | + { |
|
| 233 | + // Init |
|
| 235 | 234 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
| 236 | 235 | $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
| 237 | 236 | $tbl_blogs_comment = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
| 238 | 237 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
| 239 | 238 | $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); |
| 240 | 239 | $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
| 241 | - $tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 240 | + $tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 242 | 241 | |
| 243 | 242 | $course_id = api_get_course_int_id(); |
| 244 | 243 | $blog_id = intval($blog_id); |
| 245 | 244 | |
| 246 | - // Delete posts from DB and the attachments |
|
| 247 | - delete_all_blog_attachment($blog_id); |
|
| 245 | + // Delete posts from DB and the attachments |
|
| 246 | + delete_all_blog_attachment($blog_id); |
|
| 248 | 247 | |
| 249 | - //Delete comments |
|
| 250 | - $sql = "DELETE FROM $tbl_blogs_comment WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 251 | - Database::query($sql); |
|
| 248 | + //Delete comments |
|
| 249 | + $sql = "DELETE FROM $tbl_blogs_comment WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 250 | + Database::query($sql); |
|
| 252 | 251 | |
| 253 | - // Delete posts |
|
| 254 | - $sql = "DELETE FROM $tbl_blogs_posts WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 255 | - Database::query($sql); |
|
| 252 | + // Delete posts |
|
| 253 | + $sql = "DELETE FROM $tbl_blogs_posts WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 254 | + Database::query($sql); |
|
| 256 | 255 | |
| 257 | - // Delete tasks |
|
| 258 | - $sql = "DELETE FROM $tbl_blogs_tasks WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 259 | - Database::query($sql); |
|
| 256 | + // Delete tasks |
|
| 257 | + $sql = "DELETE FROM $tbl_blogs_tasks WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 258 | + Database::query($sql); |
|
| 260 | 259 | |
| 261 | - // Delete ratings |
|
| 262 | - $sql = "DELETE FROM $tbl_blogs_rating WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 263 | - Database::query($sql); |
|
| 260 | + // Delete ratings |
|
| 261 | + $sql = "DELETE FROM $tbl_blogs_rating WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 262 | + Database::query($sql); |
|
| 264 | 263 | |
| 265 | - // Delete blog |
|
| 266 | - $sql ="DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 267 | - Database::query($sql); |
|
| 264 | + // Delete blog |
|
| 265 | + $sql ="DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 266 | + Database::query($sql); |
|
| 268 | 267 | |
| 269 | - // Delete from course homepage |
|
| 270 | - $sql = "DELETE FROM $tbl_tool WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".$blog_id."'"; |
|
| 271 | - Database::query($sql); |
|
| 268 | + // Delete from course homepage |
|
| 269 | + $sql = "DELETE FROM $tbl_tool WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".$blog_id."'"; |
|
| 270 | + Database::query($sql); |
|
| 272 | 271 | |
| 273 | - //update item_property (delete) |
|
| 272 | + //update item_property (delete) |
|
| 274 | 273 | api_item_property_update( |
| 275 | 274 | api_get_course_info(), |
| 276 | 275 | TOOL_BLOGS, |
@@ -278,152 +277,152 @@ discard block |
||
| 278 | 277 | 'delete', |
| 279 | 278 | api_get_user_id() |
| 280 | 279 | ); |
| 281 | - } |
|
| 282 | - |
|
| 283 | - /** |
|
| 284 | - * Creates a new post in a given blog |
|
| 285 | - * @author Toon Keppens |
|
| 286 | - * @param String $title |
|
| 287 | - * @param String $full_text |
|
| 288 | - * @param Integer $blog_id |
|
| 289 | - */ |
|
| 290 | - public static function create_post($title, $full_text, $file_comment, $blog_id) |
|
| 291 | - { |
|
| 292 | - $_user = api_get_user_info(); |
|
| 293 | - $_course = api_get_course_info(); |
|
| 294 | - $course_id = $_course['real_id']; |
|
| 295 | - |
|
| 296 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 297 | - $upload_ok=true; |
|
| 298 | - $has_attachment=false; |
|
| 299 | - $current_date = api_get_utc_datetime(); |
|
| 300 | - |
|
| 301 | - if (!empty($_FILES['user_upload']['name'])) { |
|
| 302 | - $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 303 | - $has_attachment=true; |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - if ($upload_ok) { |
|
| 307 | - // Table Definitions |
|
| 308 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 309 | - |
|
| 310 | - // Create the post |
|
| 311 | - $sql = "INSERT INTO $tbl_blogs_posts (c_id, title, full_text, date_creation, blog_id, author_id ) |
|
| 280 | + } |
|
| 281 | + |
|
| 282 | + /** |
|
| 283 | + * Creates a new post in a given blog |
|
| 284 | + * @author Toon Keppens |
|
| 285 | + * @param String $title |
|
| 286 | + * @param String $full_text |
|
| 287 | + * @param Integer $blog_id |
|
| 288 | + */ |
|
| 289 | + public static function create_post($title, $full_text, $file_comment, $blog_id) |
|
| 290 | + { |
|
| 291 | + $_user = api_get_user_info(); |
|
| 292 | + $_course = api_get_course_info(); |
|
| 293 | + $course_id = $_course['real_id']; |
|
| 294 | + |
|
| 295 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 296 | + $upload_ok=true; |
|
| 297 | + $has_attachment=false; |
|
| 298 | + $current_date = api_get_utc_datetime(); |
|
| 299 | + |
|
| 300 | + if (!empty($_FILES['user_upload']['name'])) { |
|
| 301 | + $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 302 | + $has_attachment=true; |
|
| 303 | + } |
|
| 304 | + |
|
| 305 | + if ($upload_ok) { |
|
| 306 | + // Table Definitions |
|
| 307 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 308 | + |
|
| 309 | + // Create the post |
|
| 310 | + $sql = "INSERT INTO $tbl_blogs_posts (c_id, title, full_text, date_creation, blog_id, author_id ) |
|
| 312 | 311 | VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int)$blog_id."', '".(int)$_user['user_id']."');"; |
| 313 | 312 | |
| 314 | - Database::query($sql); |
|
| 315 | - $last_post_id = Database::insert_id(); |
|
| 313 | + Database::query($sql); |
|
| 314 | + $last_post_id = Database::insert_id(); |
|
| 316 | 315 | |
| 317 | 316 | if ($last_post_id) { |
| 318 | 317 | $sql = "UPDATE $tbl_blogs_posts SET post_id = iid WHERE iid = $last_post_id"; |
| 319 | 318 | Database::query($sql); |
| 320 | 319 | } |
| 321 | 320 | |
| 322 | - if ($has_attachment) { |
|
| 323 | - $courseDir = $_course['path'].'/upload/blog'; |
|
| 324 | - $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
| 325 | - $updir = $sys_course_path.$courseDir; |
|
| 326 | - |
|
| 327 | - // Try to add an extension to the file if it hasn't one |
|
| 328 | - $new_file_name = add_ext_on_mime(stripslashes($_FILES['user_upload']['name']), $_FILES['user_upload']['type']); |
|
| 329 | - |
|
| 330 | - // user's file name |
|
| 331 | - $file_name = $_FILES['user_upload']['name']; |
|
| 332 | - |
|
| 333 | - if (!filter_extension($new_file_name)) { |
|
| 334 | - Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
| 335 | - } else { |
|
| 336 | - $new_file_name = uniqid(''); |
|
| 337 | - $new_path = $updir.'/'.$new_file_name; |
|
| 338 | - $result = @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
| 339 | - $comment = Database::escape_string($file_comment); |
|
| 340 | - |
|
| 341 | - // Storing the attachments if any |
|
| 342 | - if ($result) { |
|
| 343 | - $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '. |
|
| 344 | - "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )"; |
|
| 345 | - Database::query($sql); |
|
| 321 | + if ($has_attachment) { |
|
| 322 | + $courseDir = $_course['path'].'/upload/blog'; |
|
| 323 | + $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
| 324 | + $updir = $sys_course_path.$courseDir; |
|
| 325 | + |
|
| 326 | + // Try to add an extension to the file if it hasn't one |
|
| 327 | + $new_file_name = add_ext_on_mime(stripslashes($_FILES['user_upload']['name']), $_FILES['user_upload']['type']); |
|
| 328 | + |
|
| 329 | + // user's file name |
|
| 330 | + $file_name = $_FILES['user_upload']['name']; |
|
| 331 | + |
|
| 332 | + if (!filter_extension($new_file_name)) { |
|
| 333 | + Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
| 334 | + } else { |
|
| 335 | + $new_file_name = uniqid(''); |
|
| 336 | + $new_path = $updir.'/'.$new_file_name; |
|
| 337 | + $result = @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
| 338 | + $comment = Database::escape_string($file_comment); |
|
| 339 | + |
|
| 340 | + // Storing the attachments if any |
|
| 341 | + if ($result) { |
|
| 342 | + $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '. |
|
| 343 | + "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )"; |
|
| 344 | + Database::query($sql); |
|
| 346 | 345 | $id = Database::insert_id(); |
| 347 | 346 | if ($id) { |
| 348 | 347 | $sql = "UPDATE $blog_table_attachment SET id = iid WHERE iid = $id"; |
| 349 | 348 | Database::query($sql); |
| 350 | 349 | } |
| 351 | - } |
|
| 352 | - } |
|
| 353 | - } |
|
| 354 | - } else { |
|
| 355 | - Display::display_error_message(get_lang('UplNoFileUploaded')); |
|
| 356 | - } |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * Edits a post in a given blog |
|
| 361 | - * @author Toon Keppens |
|
| 362 | - * @param Integer $blog_id |
|
| 363 | - * @param String $title |
|
| 364 | - * @param String $full_text |
|
| 365 | - * @param Integer $blog_id |
|
| 366 | - */ |
|
| 367 | - public static function edit_post($post_id, $title, $full_text, $blog_id) |
|
| 368 | - { |
|
| 369 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 350 | + } |
|
| 351 | + } |
|
| 352 | + } |
|
| 353 | + } else { |
|
| 354 | + Display::display_error_message(get_lang('UplNoFileUploaded')); |
|
| 355 | + } |
|
| 356 | + } |
|
| 357 | + |
|
| 358 | + /** |
|
| 359 | + * Edits a post in a given blog |
|
| 360 | + * @author Toon Keppens |
|
| 361 | + * @param Integer $blog_id |
|
| 362 | + * @param String $title |
|
| 363 | + * @param String $full_text |
|
| 364 | + * @param Integer $blog_id |
|
| 365 | + */ |
|
| 366 | + public static function edit_post($post_id, $title, $full_text, $blog_id) |
|
| 367 | + { |
|
| 368 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 370 | 369 | $course_id = api_get_course_int_id(); |
| 371 | 370 | |
| 372 | - // Create the post |
|
| 373 | - $sql = "UPDATE $tbl_blogs_posts SET |
|
| 371 | + // Create the post |
|
| 372 | + $sql = "UPDATE $tbl_blogs_posts SET |
|
| 374 | 373 | title = '" . Database::escape_string($title)."', |
| 375 | 374 | full_text = '" . Database::escape_string($full_text)."' |
| 376 | 375 | WHERE c_id = $course_id AND post_id ='".(int)$post_id."' AND blog_id ='".(int)$blog_id."' |
| 377 | 376 | LIMIT 1 "; |
| 378 | - Database::query($sql); |
|
| 379 | - } |
|
| 380 | - |
|
| 381 | - /** |
|
| 382 | - * Deletes an article and it's comments |
|
| 383 | - * @author Toon Keppens |
|
| 384 | - * @param int $blog_id |
|
| 385 | - * @param int $post_id |
|
| 386 | - */ |
|
| 387 | - public static function delete_post($blog_id, $post_id) |
|
| 388 | - { |
|
| 389 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 390 | - $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 391 | - $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 377 | + Database::query($sql); |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * Deletes an article and it's comments |
|
| 382 | + * @author Toon Keppens |
|
| 383 | + * @param int $blog_id |
|
| 384 | + * @param int $post_id |
|
| 385 | + */ |
|
| 386 | + public static function delete_post($blog_id, $post_id) |
|
| 387 | + { |
|
| 388 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 389 | + $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 390 | + $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 392 | 391 | |
| 393 | 392 | $course_id = api_get_course_int_id(); |
| 394 | 393 | |
| 395 | - // Delete ratings on this comment |
|
| 396 | - $sql = "DELETE FROM $tbl_blogs_rating |
|
| 394 | + // Delete ratings on this comment |
|
| 395 | + $sql = "DELETE FROM $tbl_blogs_rating |
|
| 397 | 396 | WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND item_id = '".(int)$post_id."' AND rating_type = 'post'"; |
| 398 | - Database::query($sql); |
|
| 397 | + Database::query($sql); |
|
| 399 | 398 | |
| 400 | - // Delete the post |
|
| 401 | - $sql = "DELETE FROM $tbl_blogs_posts |
|
| 399 | + // Delete the post |
|
| 400 | + $sql = "DELETE FROM $tbl_blogs_posts |
|
| 402 | 401 | WHERE c_id = $course_id AND post_id = '".(int)$post_id."'"; |
| 403 | - Database::query($sql); |
|
| 402 | + Database::query($sql); |
|
| 404 | 403 | |
| 405 | - // Delete the comments |
|
| 406 | - $sql = "DELETE FROM $tbl_blogs_comments |
|
| 404 | + // Delete the comments |
|
| 405 | + $sql = "DELETE FROM $tbl_blogs_comments |
|
| 407 | 406 | WHERE c_id = $course_id AND post_id = '".(int)$post_id."' AND blog_id = '".(int)$blog_id."'"; |
| 408 | - Database::query($sql); |
|
| 409 | - |
|
| 410 | - // Delete posts and attachments |
|
| 411 | - delete_all_blog_attachment($blog_id,$post_id); |
|
| 412 | - } |
|
| 413 | - |
|
| 414 | - /** |
|
| 415 | - * Creates a comment on a post in a given blog |
|
| 416 | - * @author Toon Keppens |
|
| 417 | - * @param String $title |
|
| 418 | - * @param String $full_text |
|
| 419 | - * @param Integer $blog_id |
|
| 420 | - * @param Integer $post_id |
|
| 421 | - * @param Integer $parent_id |
|
| 422 | - */ |
|
| 423 | - public static function create_comment($title, $full_text, $file_comment, $blog_id, $post_id, $parent_id, $task_id = 'NULL') |
|
| 424 | - { |
|
| 425 | - $_user = api_get_user_info(); |
|
| 426 | - $_course = api_get_course_info(); |
|
| 407 | + Database::query($sql); |
|
| 408 | + |
|
| 409 | + // Delete posts and attachments |
|
| 410 | + delete_all_blog_attachment($blog_id,$post_id); |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * Creates a comment on a post in a given blog |
|
| 415 | + * @author Toon Keppens |
|
| 416 | + * @param String $title |
|
| 417 | + * @param String $full_text |
|
| 418 | + * @param Integer $blog_id |
|
| 419 | + * @param Integer $post_id |
|
| 420 | + * @param Integer $parent_id |
|
| 421 | + */ |
|
| 422 | + public static function create_comment($title, $full_text, $file_comment, $blog_id, $post_id, $parent_id, $task_id = 'NULL') |
|
| 423 | + { |
|
| 424 | + $_user = api_get_user_info(); |
|
| 425 | + $_course = api_get_course_info(); |
|
| 427 | 426 | $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
| 428 | 427 | |
| 429 | 428 | $upload_ok = true; |
@@ -431,55 +430,55 @@ discard block |
||
| 431 | 430 | $current_date = api_get_utc_datetime(); |
| 432 | 431 | $course_id = api_get_course_int_id(); |
| 433 | 432 | |
| 434 | - if (!empty($_FILES['user_upload']['name'])) { |
|
| 435 | - $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 436 | - $has_attachment=true; |
|
| 437 | - } |
|
| 433 | + if (!empty($_FILES['user_upload']['name'])) { |
|
| 434 | + $upload_ok = process_uploaded_file($_FILES['user_upload']); |
|
| 435 | + $has_attachment=true; |
|
| 436 | + } |
|
| 438 | 437 | |
| 439 | - if ($upload_ok) { |
|
| 440 | - // Table Definition |
|
| 441 | - $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 438 | + if ($upload_ok) { |
|
| 439 | + // Table Definition |
|
| 440 | + $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 442 | 441 | |
| 443 | - // Create the comment |
|
| 444 | - $sql = "INSERT INTO $tbl_blogs_comments (c_id, title, comment, author_id, date_creation, blog_id, post_id, parent_comment_id, task_id ) |
|
| 442 | + // Create the comment |
|
| 443 | + $sql = "INSERT INTO $tbl_blogs_comments (c_id, title, comment, author_id, date_creation, blog_id, post_id, parent_comment_id, task_id ) |
|
| 445 | 444 | VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int)$_user['user_id']."','".$current_date."', '".(int)$blog_id."', '".(int)$post_id."', '".(int)$parent_id."', '".(int)$task_id."')"; |
| 446 | - Database::query($sql); |
|
| 445 | + Database::query($sql); |
|
| 447 | 446 | |
| 448 | - // Empty post values, or they are shown on the page again |
|
| 449 | - $last_id = Database::insert_id(); |
|
| 447 | + // Empty post values, or they are shown on the page again |
|
| 448 | + $last_id = Database::insert_id(); |
|
| 450 | 449 | |
| 451 | 450 | if ($last_id) { |
| 452 | 451 | $sql = "UPDATE $tbl_blogs_comments SET comment_id = iid WHERE iid = $last_id"; |
| 453 | 452 | Database::query($sql); |
| 454 | 453 | } |
| 455 | 454 | |
| 456 | - if ($has_attachment) { |
|
| 457 | - $courseDir = $_course['path'].'/upload/blog'; |
|
| 458 | - $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
| 459 | - $updir = $sys_course_path.$courseDir; |
|
| 460 | - |
|
| 461 | - // Try to add an extension to the file if it hasn't one |
|
| 462 | - $new_file_name = add_ext_on_mime( |
|
| 463 | - stripslashes($_FILES['user_upload']['name']), |
|
| 464 | - $_FILES['user_upload']['type'] |
|
| 465 | - ); |
|
| 466 | - |
|
| 467 | - // user's file name |
|
| 468 | - $file_name =$_FILES['user_upload']['name']; |
|
| 469 | - |
|
| 470 | - if (!filter_extension($new_file_name)) { |
|
| 471 | - Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
| 472 | - } else { |
|
| 473 | - $new_file_name = uniqid(''); |
|
| 474 | - $new_path=$updir.'/'.$new_file_name; |
|
| 475 | - $result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
| 476 | - $comment = Database::escape_string($file_comment); |
|
| 477 | - |
|
| 478 | - // Storing the attachments if any |
|
| 479 | - if ($result) { |
|
| 480 | - $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
|
| 481 | - "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
|
| 482 | - Database::query($sql); |
|
| 455 | + if ($has_attachment) { |
|
| 456 | + $courseDir = $_course['path'].'/upload/blog'; |
|
| 457 | + $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
| 458 | + $updir = $sys_course_path.$courseDir; |
|
| 459 | + |
|
| 460 | + // Try to add an extension to the file if it hasn't one |
|
| 461 | + $new_file_name = add_ext_on_mime( |
|
| 462 | + stripslashes($_FILES['user_upload']['name']), |
|
| 463 | + $_FILES['user_upload']['type'] |
|
| 464 | + ); |
|
| 465 | + |
|
| 466 | + // user's file name |
|
| 467 | + $file_name =$_FILES['user_upload']['name']; |
|
| 468 | + |
|
| 469 | + if (!filter_extension($new_file_name)) { |
|
| 470 | + Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
|
| 471 | + } else { |
|
| 472 | + $new_file_name = uniqid(''); |
|
| 473 | + $new_path=$updir.'/'.$new_file_name; |
|
| 474 | + $result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
| 475 | + $comment = Database::escape_string($file_comment); |
|
| 476 | + |
|
| 477 | + // Storing the attachments if any |
|
| 478 | + if ($result) { |
|
| 479 | + $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
|
| 480 | + "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
|
| 481 | + Database::query($sql); |
|
| 483 | 482 | |
| 484 | 483 | $id = Database::insert_id(); |
| 485 | 484 | |
@@ -487,92 +486,92 @@ discard block |
||
| 487 | 486 | $sql = "UPDATE $blog_table_attachment SET id = iid WHERE iid = $id"; |
| 488 | 487 | Database::query($sql); |
| 489 | 488 | } |
| 490 | - } |
|
| 491 | - } |
|
| 492 | - } |
|
| 493 | - } |
|
| 494 | - } |
|
| 495 | - |
|
| 496 | - /** |
|
| 497 | - * Deletes a comment from a blogpost |
|
| 498 | - * @author Toon Keppens |
|
| 499 | - * @param int $blog_id |
|
| 500 | - * @param int $comment_id |
|
| 501 | - */ |
|
| 502 | - public static function delete_comment($blog_id, $post_id, $comment_id) |
|
| 503 | - { |
|
| 504 | - $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 505 | - $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 506 | - $blog_id = intval($blog_id); |
|
| 507 | - $post_id = intval($post_id); |
|
| 508 | - $comment_id = intval($comment_id); |
|
| 489 | + } |
|
| 490 | + } |
|
| 491 | + } |
|
| 492 | + } |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + /** |
|
| 496 | + * Deletes a comment from a blogpost |
|
| 497 | + * @author Toon Keppens |
|
| 498 | + * @param int $blog_id |
|
| 499 | + * @param int $comment_id |
|
| 500 | + */ |
|
| 501 | + public static function delete_comment($blog_id, $post_id, $comment_id) |
|
| 502 | + { |
|
| 503 | + $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 504 | + $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 505 | + $blog_id = intval($blog_id); |
|
| 506 | + $post_id = intval($post_id); |
|
| 507 | + $comment_id = intval($comment_id); |
|
| 509 | 508 | $course_id = api_get_course_int_id(); |
| 510 | 509 | |
| 511 | - delete_all_blog_attachment($blog_id, $post_id, $comment_id); |
|
| 510 | + delete_all_blog_attachment($blog_id, $post_id, $comment_id); |
|
| 512 | 511 | |
| 513 | - // Delete ratings on this comment |
|
| 514 | - $sql = "DELETE FROM $tbl_blogs_rating |
|
| 512 | + // Delete ratings on this comment |
|
| 513 | + $sql = "DELETE FROM $tbl_blogs_rating |
|
| 515 | 514 | WHERE |
| 516 | 515 | c_id = $course_id AND |
| 517 | 516 | blog_id = '".$blog_id."' AND |
| 518 | 517 | item_id = '".$comment_id."' AND |
| 519 | 518 | rating_type = 'comment'"; |
| 520 | - Database::query($sql); |
|
| 519 | + Database::query($sql); |
|
| 521 | 520 | |
| 522 | - // select comments that have the selected comment as their parent |
|
| 523 | - $sql = "SELECT comment_id FROM $tbl_blogs_comments |
|
| 521 | + // select comments that have the selected comment as their parent |
|
| 522 | + $sql = "SELECT comment_id FROM $tbl_blogs_comments |
|
| 524 | 523 | WHERE c_id = $course_id AND parent_comment_id = '".$comment_id."'"; |
| 525 | - $result = Database::query($sql); |
|
| 524 | + $result = Database::query($sql); |
|
| 526 | 525 | |
| 527 | - // Delete them recursively |
|
| 528 | - while ($comment = Database::fetch_array($result)) { |
|
| 529 | - Blog::delete_comment($blog_id,$post_id,$comment['comment_id']); |
|
| 530 | - } |
|
| 526 | + // Delete them recursively |
|
| 527 | + while ($comment = Database::fetch_array($result)) { |
|
| 528 | + Blog::delete_comment($blog_id,$post_id,$comment['comment_id']); |
|
| 529 | + } |
|
| 531 | 530 | |
| 532 | - // Finally, delete the selected comment to |
|
| 533 | - $sql = "DELETE FROM $tbl_blogs_comments |
|
| 531 | + // Finally, delete the selected comment to |
|
| 532 | + $sql = "DELETE FROM $tbl_blogs_comments |
|
| 534 | 533 | WHERE c_id = $course_id AND comment_id = '".$comment_id."'"; |
| 535 | - Database::query($sql); |
|
| 536 | - } |
|
| 537 | - |
|
| 538 | - /** |
|
| 539 | - * Creates a new task in a blog |
|
| 540 | - * @author Toon Keppens |
|
| 541 | - * @param Integer $blog_id |
|
| 542 | - * @param String $title |
|
| 543 | - * @param String $description |
|
| 544 | - * @param String $color |
|
| 545 | - */ |
|
| 546 | - public static function create_task($blog_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) |
|
| 547 | - { |
|
| 548 | - // Init |
|
| 549 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 550 | - $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 551 | - |
|
| 552 | - $course_id = api_get_course_int_id(); |
|
| 553 | - |
|
| 554 | - // Create the task |
|
| 555 | - $sql = "INSERT INTO $tbl_blogs_tasks (c_id, blog_id, title, description, color, system_task) |
|
| 534 | + Database::query($sql); |
|
| 535 | + } |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * Creates a new task in a blog |
|
| 539 | + * @author Toon Keppens |
|
| 540 | + * @param Integer $blog_id |
|
| 541 | + * @param String $title |
|
| 542 | + * @param String $description |
|
| 543 | + * @param String $color |
|
| 544 | + */ |
|
| 545 | + public static function create_task($blog_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) |
|
| 546 | + { |
|
| 547 | + // Init |
|
| 548 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 549 | + $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 550 | + |
|
| 551 | + $course_id = api_get_course_int_id(); |
|
| 552 | + |
|
| 553 | + // Create the task |
|
| 554 | + $sql = "INSERT INTO $tbl_blogs_tasks (c_id, blog_id, title, description, color, system_task) |
|
| 556 | 555 | VALUES ($course_id , '".(int)$blog_id."', '" . Database::escape_string($title)."', '" . Database::escape_string($description)."', '" . Database::escape_string($color)."', '0');"; |
| 557 | - Database::query($sql); |
|
| 556 | + Database::query($sql); |
|
| 558 | 557 | |
| 559 | - $task_id = Database::insert_id(); |
|
| 558 | + $task_id = Database::insert_id(); |
|
| 560 | 559 | |
| 561 | 560 | if ($task_id) { |
| 562 | 561 | $sql = "UPDATE $tbl_blogs_tasks SET task_id = iid WHERE iid = $task_id"; |
| 563 | 562 | Database::query($sql); |
| 564 | 563 | } |
| 565 | 564 | |
| 566 | - $tool = 'BLOG_' . $blog_id; |
|
| 565 | + $tool = 'BLOG_' . $blog_id; |
|
| 567 | 566 | |
| 568 | - if ($articleDelete == 'on') { |
|
| 569 | - $sql = " INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
| 567 | + if ($articleDelete == 'on') { |
|
| 568 | + $sql = " INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
| 570 | 569 | '" . (int)$course_id . "', |
| 571 | 570 | '" . (int)$task_id . "', |
| 572 | 571 | '" . Database::escape_string($tool) . "', |
| 573 | 572 | 'article_delete' |
| 574 | 573 | )"; |
| 575 | - Database::query($sql); |
|
| 574 | + Database::query($sql); |
|
| 576 | 575 | |
| 577 | 576 | $id = Database::insert_id(); |
| 578 | 577 | |
@@ -582,172 +581,172 @@ discard block |
||
| 582 | 581 | } |
| 583 | 582 | } |
| 584 | 583 | |
| 585 | - if ($articleEdit == 'on') { |
|
| 586 | - $sql = " |
|
| 584 | + if ($articleEdit == 'on') { |
|
| 585 | + $sql = " |
|
| 587 | 586 | INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES ( |
| 588 | 587 | '" . (int)$course_id . "', |
| 589 | 588 | '" . (int)$task_id . "', |
| 590 | 589 | '" . Database::escape_string($tool) . "', |
| 591 | 590 | 'article_edit' |
| 592 | 591 | )"; |
| 593 | - Database::query($sql); |
|
| 592 | + Database::query($sql); |
|
| 594 | 593 | $id = Database::insert_id(); |
| 595 | 594 | |
| 596 | 595 | if ($id) { |
| 597 | 596 | $sql = "UPDATE $tbl_tasks_permissions SET id = iid WHERE iid = $id"; |
| 598 | 597 | Database::query($sql); |
| 599 | 598 | } |
| 600 | - } |
|
| 599 | + } |
|
| 601 | 600 | |
| 602 | - if ($commentsDelete == 'on') { |
|
| 603 | - $sql = " |
|
| 601 | + if ($commentsDelete == 'on') { |
|
| 602 | + $sql = " |
|
| 604 | 603 | INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES ( |
| 605 | 604 | '" . (int)$course_id . "', |
| 606 | 605 | '" . (int)$task_id . "', |
| 607 | 606 | '" . Database::escape_string($tool) . "', |
| 608 | 607 | 'article_comments_delete' |
| 609 | 608 | )"; |
| 610 | - Database::query($sql); |
|
| 609 | + Database::query($sql); |
|
| 611 | 610 | $id = Database::insert_id(); |
| 612 | 611 | |
| 613 | 612 | if ($id) { |
| 614 | 613 | $sql = "UPDATE $tbl_tasks_permissions SET id = iid WHERE iid = $id"; |
| 615 | 614 | Database::query($sql); |
| 616 | 615 | } |
| 617 | - } |
|
| 618 | - } |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * Edit a task in a blog |
|
| 622 | - * @author Toon Keppens |
|
| 623 | - * @param Integer $task_id |
|
| 624 | - * @param String $title |
|
| 625 | - * @param String $description |
|
| 626 | - * @param String $color |
|
| 627 | - */ |
|
| 628 | - public static function edit_task($blog_id, $task_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) |
|
| 629 | - { |
|
| 630 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 631 | - $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 616 | + } |
|
| 617 | + } |
|
| 618 | + |
|
| 619 | + /** |
|
| 620 | + * Edit a task in a blog |
|
| 621 | + * @author Toon Keppens |
|
| 622 | + * @param Integer $task_id |
|
| 623 | + * @param String $title |
|
| 624 | + * @param String $description |
|
| 625 | + * @param String $color |
|
| 626 | + */ |
|
| 627 | + public static function edit_task($blog_id, $task_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) |
|
| 628 | + { |
|
| 629 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 630 | + $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 632 | 631 | |
| 633 | 632 | $course_id = api_get_course_int_id(); |
| 634 | 633 | |
| 635 | - // Create the task |
|
| 636 | - $sql = "UPDATE $tbl_blogs_tasks SET |
|
| 634 | + // Create the task |
|
| 635 | + $sql = "UPDATE $tbl_blogs_tasks SET |
|
| 637 | 636 | title = '".Database::escape_string($title)."', |
| 638 | 637 | description = '".Database::escape_string($description)."', |
| 639 | 638 | color = '".Database::escape_string($color)."' |
| 640 | 639 | WHERE c_id = $course_id AND task_id ='".(int)$task_id."' LIMIT 1"; |
| 641 | - Database::query($sql); |
|
| 640 | + Database::query($sql); |
|
| 642 | 641 | |
| 643 | - $tool = 'BLOG_' . $blog_id; |
|
| 642 | + $tool = 'BLOG_' . $blog_id; |
|
| 644 | 643 | |
| 645 | - $sql = "DELETE FROM " . $tbl_tasks_permissions . " |
|
| 644 | + $sql = "DELETE FROM " . $tbl_tasks_permissions . " |
|
| 646 | 645 | WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'"; |
| 647 | - Database::query($sql); |
|
| 646 | + Database::query($sql); |
|
| 648 | 647 | |
| 649 | - if ($articleDelete == 'on') { |
|
| 650 | - $sql = "INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
| 648 | + if ($articleDelete == 'on') { |
|
| 649 | + $sql = "INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
| 651 | 650 | '" . (int)$course_id . "', |
| 652 | 651 | '" . (int)$task_id . "', |
| 653 | 652 | '" . Database::escape_string($tool) . "', |
| 654 | 653 | 'article_delete' |
| 655 | 654 | )"; |
| 656 | - Database::query($sql); |
|
| 655 | + Database::query($sql); |
|
| 657 | 656 | $id = Database::insert_id(); |
| 658 | 657 | |
| 659 | 658 | if ($id) { |
| 660 | 659 | $sql = "UPDATE $tbl_tasks_permissions SET id = iid WHERE iid = $id"; |
| 661 | 660 | Database::query($sql); |
| 662 | 661 | } |
| 663 | - } |
|
| 662 | + } |
|
| 664 | 663 | |
| 665 | - if ($articleEdit == 'on') { |
|
| 666 | - $sql = "INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
| 664 | + if ($articleEdit == 'on') { |
|
| 665 | + $sql = "INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
| 667 | 666 | '" . (int)$course_id . "', |
| 668 | 667 | '" . (int)$task_id . "', |
| 669 | 668 | '" . Database::escape_string($tool) . "', |
| 670 | 669 | 'article_edit' |
| 671 | 670 | )"; |
| 672 | - Database::query($sql); |
|
| 671 | + Database::query($sql); |
|
| 673 | 672 | $id = Database::insert_id(); |
| 674 | 673 | |
| 675 | 674 | if ($id) { |
| 676 | 675 | $sql = "UPDATE $tbl_tasks_permissions SET id = iid WHERE iid = $id"; |
| 677 | 676 | Database::query($sql); |
| 678 | 677 | } |
| 679 | - } |
|
| 678 | + } |
|
| 680 | 679 | |
| 681 | - if ($commentsDelete == 'on') { |
|
| 682 | - $sql = " INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
| 680 | + if ($commentsDelete == 'on') { |
|
| 681 | + $sql = " INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
| 683 | 682 | '" . (int)$course_id . "', |
| 684 | 683 | '" . (int)$task_id . "', |
| 685 | 684 | '" . Database::escape_string($tool) . "', |
| 686 | 685 | 'article_comments_delete' |
| 687 | 686 | )"; |
| 688 | - Database::query($sql); |
|
| 687 | + Database::query($sql); |
|
| 689 | 688 | $id = Database::insert_id(); |
| 690 | 689 | |
| 691 | 690 | if ($id) { |
| 692 | 691 | $sql = "UPDATE $tbl_tasks_permissions SET id = iid WHERE iid = $id"; |
| 693 | 692 | Database::query($sql); |
| 694 | 693 | } |
| 695 | - } |
|
| 696 | - } |
|
| 697 | - |
|
| 698 | - /** |
|
| 699 | - * Deletes a task from a blog |
|
| 700 | - * @param Integer $blog_id |
|
| 701 | - * @param Integer $task_id |
|
| 702 | - */ |
|
| 703 | - public static function delete_task($blog_id, $task_id) |
|
| 704 | - { |
|
| 705 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 706 | - $course_id = api_get_course_int_id(); |
|
| 707 | - |
|
| 708 | - // Delete posts |
|
| 709 | - $sql = "DELETE FROM $tbl_blogs_tasks |
|
| 694 | + } |
|
| 695 | + } |
|
| 696 | + |
|
| 697 | + /** |
|
| 698 | + * Deletes a task from a blog |
|
| 699 | + * @param Integer $blog_id |
|
| 700 | + * @param Integer $task_id |
|
| 701 | + */ |
|
| 702 | + public static function delete_task($blog_id, $task_id) |
|
| 703 | + { |
|
| 704 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 705 | + $course_id = api_get_course_int_id(); |
|
| 706 | + |
|
| 707 | + // Delete posts |
|
| 708 | + $sql = "DELETE FROM $tbl_blogs_tasks |
|
| 710 | 709 | WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."'"; |
| 711 | - Database::query($sql); |
|
| 712 | - } |
|
| 713 | - |
|
| 714 | - /** |
|
| 715 | - * Deletes an assigned task from a blog |
|
| 716 | - * @param Integer $blog_id |
|
| 717 | - * @param Integer $assignment_id |
|
| 718 | - */ |
|
| 719 | - public static function delete_assigned_task($blog_id, $task_id, $user_id) |
|
| 720 | - { |
|
| 721 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 710 | + Database::query($sql); |
|
| 711 | + } |
|
| 712 | + |
|
| 713 | + /** |
|
| 714 | + * Deletes an assigned task from a blog |
|
| 715 | + * @param Integer $blog_id |
|
| 716 | + * @param Integer $assignment_id |
|
| 717 | + */ |
|
| 718 | + public static function delete_assigned_task($blog_id, $task_id, $user_id) |
|
| 719 | + { |
|
| 720 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 722 | 721 | $course_id = api_get_course_int_id(); |
| 723 | 722 | |
| 724 | - // Delete posts |
|
| 725 | - $sql = "DELETE FROM $tbl_blogs_tasks_rel_user |
|
| 723 | + // Delete posts |
|
| 724 | + $sql = "DELETE FROM $tbl_blogs_tasks_rel_user |
|
| 726 | 725 | WHERE |
| 727 | 726 | c_id = $course_id AND |
| 728 | 727 | blog_id = '".(int)$blog_id."' AND |
| 729 | 728 | task_id = '".(int)$task_id."' AND |
| 730 | 729 | user_id = '".(int)$user_id."'"; |
| 731 | - Database::query($sql); |
|
| 732 | - } |
|
| 733 | - |
|
| 734 | - /** |
|
| 735 | - * Get personal task list |
|
| 736 | - * @author Toon Keppens |
|
| 737 | - * @return Returns an unsorted list (<ul></ul>) with the users' tasks |
|
| 738 | - */ |
|
| 739 | - public static function get_personal_task_list() |
|
| 740 | - { |
|
| 741 | - $_user = api_get_user_info(); |
|
| 742 | - |
|
| 743 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 744 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 745 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 746 | - |
|
| 747 | - $course_id = api_get_course_int_id(); |
|
| 748 | - |
|
| 749 | - if ($_user['user_id']) { |
|
| 750 | - $sql = "SELECT task_rel_user.*, task.title, blog.blog_name |
|
| 730 | + Database::query($sql); |
|
| 731 | + } |
|
| 732 | + |
|
| 733 | + /** |
|
| 734 | + * Get personal task list |
|
| 735 | + * @author Toon Keppens |
|
| 736 | + * @return Returns an unsorted list (<ul></ul>) with the users' tasks |
|
| 737 | + */ |
|
| 738 | + public static function get_personal_task_list() |
|
| 739 | + { |
|
| 740 | + $_user = api_get_user_info(); |
|
| 741 | + |
|
| 742 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 743 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 744 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 745 | + |
|
| 746 | + $course_id = api_get_course_int_id(); |
|
| 747 | + |
|
| 748 | + if ($_user['user_id']) { |
|
| 749 | + $sql = "SELECT task_rel_user.*, task.title, blog.blog_name |
|
| 751 | 750 | FROM $tbl_blogs_tasks_rel_user task_rel_user |
| 752 | 751 | INNER JOIN $tbl_blogs_tasks task |
| 753 | 752 | ON task_rel_user.task_id = task.task_id |
@@ -761,85 +760,85 @@ discard block |
||
| 761 | 760 | task_rel_user.user_id = ".(int)$_user['user_id']." |
| 762 | 761 | ORDER BY target_date ASC"; |
| 763 | 762 | |
| 764 | - $result = Database::query($sql); |
|
| 765 | - |
|
| 766 | - if (Database::num_rows($result) > 0) { |
|
| 767 | - echo '<ul>'; |
|
| 768 | - while ($mytask = Database::fetch_array($result)) { |
|
| 769 | - echo '<li><a href="blog.php?action=execute_task&blog_id=' . $mytask['blog_id'] . '&task_id='.stripslashes($mytask['task_id']) . '" title="[Blog: '.stripslashes($mytask['blog_name']) . '] ' . get_lang('ExecuteThisTask') . '">'.stripslashes($mytask['title']) . '</a></li>'; |
|
| 770 | - } |
|
| 771 | - echo '<ul>'; |
|
| 772 | - } else { |
|
| 773 | - echo get_lang('NoTasks'); |
|
| 774 | - } |
|
| 775 | - } else { |
|
| 776 | - echo get_lang('NoTasks'); |
|
| 777 | - } |
|
| 778 | - } |
|
| 779 | - |
|
| 780 | - /** |
|
| 781 | - * Changes the visibility of a blog |
|
| 782 | - * @author Toon Keppens |
|
| 783 | - * @param Integer $blog_id |
|
| 784 | - */ |
|
| 785 | - public static function change_blog_visibility($blog_id) |
|
| 786 | - { |
|
| 787 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 788 | - $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); |
|
| 789 | - $course_id = api_get_course_int_id(); |
|
| 790 | - |
|
| 791 | - // Get blog properties |
|
| 792 | - $sql = "SELECT blog_name, visibility FROM $tbl_blogs |
|
| 763 | + $result = Database::query($sql); |
|
| 764 | + |
|
| 765 | + if (Database::num_rows($result) > 0) { |
|
| 766 | + echo '<ul>'; |
|
| 767 | + while ($mytask = Database::fetch_array($result)) { |
|
| 768 | + echo '<li><a href="blog.php?action=execute_task&blog_id=' . $mytask['blog_id'] . '&task_id='.stripslashes($mytask['task_id']) . '" title="[Blog: '.stripslashes($mytask['blog_name']) . '] ' . get_lang('ExecuteThisTask') . '">'.stripslashes($mytask['title']) . '</a></li>'; |
|
| 769 | + } |
|
| 770 | + echo '<ul>'; |
|
| 771 | + } else { |
|
| 772 | + echo get_lang('NoTasks'); |
|
| 773 | + } |
|
| 774 | + } else { |
|
| 775 | + echo get_lang('NoTasks'); |
|
| 776 | + } |
|
| 777 | + } |
|
| 778 | + |
|
| 779 | + /** |
|
| 780 | + * Changes the visibility of a blog |
|
| 781 | + * @author Toon Keppens |
|
| 782 | + * @param Integer $blog_id |
|
| 783 | + */ |
|
| 784 | + public static function change_blog_visibility($blog_id) |
|
| 785 | + { |
|
| 786 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 787 | + $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); |
|
| 788 | + $course_id = api_get_course_int_id(); |
|
| 789 | + |
|
| 790 | + // Get blog properties |
|
| 791 | + $sql = "SELECT blog_name, visibility FROM $tbl_blogs |
|
| 793 | 792 | WHERE c_id = $course_id AND blog_id='".(int)$blog_id."'"; |
| 794 | - $result = Database::query($sql); |
|
| 795 | - $blog = Database::fetch_array($result); |
|
| 796 | - $visibility = $blog['visibility']; |
|
| 797 | - $title = $blog['blog_name']; |
|
| 798 | - |
|
| 799 | - if ($visibility == 1) { |
|
| 800 | - // Change visibility state, remove from course home. |
|
| 801 | - $sql = "UPDATE $tbl_blogs SET visibility = '0' |
|
| 793 | + $result = Database::query($sql); |
|
| 794 | + $blog = Database::fetch_array($result); |
|
| 795 | + $visibility = $blog['visibility']; |
|
| 796 | + $title = $blog['blog_name']; |
|
| 797 | + |
|
| 798 | + if ($visibility == 1) { |
|
| 799 | + // Change visibility state, remove from course home. |
|
| 800 | + $sql = "UPDATE $tbl_blogs SET visibility = '0' |
|
| 802 | 801 | WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1"; |
| 803 | - Database::query($sql); |
|
| 802 | + Database::query($sql); |
|
| 804 | 803 | |
| 805 | - $sql = "DELETE FROM $tbl_tool |
|
| 804 | + $sql = "DELETE FROM $tbl_tool |
|
| 806 | 805 | WHERE c_id = $course_id AND name = '".Database::escape_string($title)."' LIMIT 1"; |
| 807 | - Database::query($sql); |
|
| 808 | - } else { |
|
| 809 | - // Change visibility state, add to course home. |
|
| 810 | - $sql = "UPDATE $tbl_blogs SET visibility = '1' |
|
| 806 | + Database::query($sql); |
|
| 807 | + } else { |
|
| 808 | + // Change visibility state, add to course home. |
|
| 809 | + $sql = "UPDATE $tbl_blogs SET visibility = '1' |
|
| 811 | 810 | WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1"; |
| 812 | - Database::query($sql); |
|
| 811 | + Database::query($sql); |
|
| 813 | 812 | |
| 814 | - $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, target ) |
|
| 813 | + $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, target ) |
|
| 815 | 814 | VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int)$blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')"; |
| 816 | - Database::query($sql); |
|
| 815 | + Database::query($sql); |
|
| 817 | 816 | $id = Database::insert_id(); |
| 818 | 817 | |
| 819 | 818 | if ($id) { |
| 820 | 819 | $sql = "UPDATE $tbl_tool SET id = iid WHERE iid = $id"; |
| 821 | 820 | Database::query($sql); |
| 822 | 821 | } |
| 823 | - } |
|
| 824 | - } |
|
| 825 | - |
|
| 826 | - /** |
|
| 827 | - * Shows the posts of a blog |
|
| 828 | - * @author Toon Keppens |
|
| 829 | - * |
|
| 830 | - * @param Integer $blog_id |
|
| 831 | - */ |
|
| 832 | - public static function display_blog_posts($blog_id, $filter = '1=1', $max_number_of_posts = 20) |
|
| 822 | + } |
|
| 823 | + } |
|
| 824 | + |
|
| 825 | + /** |
|
| 826 | + * Shows the posts of a blog |
|
| 827 | + * @author Toon Keppens |
|
| 828 | + * |
|
| 829 | + * @param Integer $blog_id |
|
| 830 | + */ |
|
| 831 | + public static function display_blog_posts($blog_id, $filter = '1=1', $max_number_of_posts = 20) |
|
| 833 | 832 | { |
| 834 | - // Init |
|
| 835 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 836 | - $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 837 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 833 | + // Init |
|
| 834 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 835 | + $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 836 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 838 | 837 | |
| 839 | - $course_id = api_get_course_int_id(); |
|
| 838 | + $course_id = api_get_course_int_id(); |
|
| 840 | 839 | |
| 841 | - // Get posts and authors |
|
| 842 | - $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
|
| 840 | + // Get posts and authors |
|
| 841 | + $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
|
| 843 | 842 | FROM $tbl_blogs_posts post |
| 844 | 843 | INNER JOIN $tbl_users user |
| 845 | 844 | ON post.author_id = user.user_id |
@@ -847,131 +846,131 @@ discard block |
||
| 847 | 846 | post.c_id = $course_id AND |
| 848 | 847 | $filter |
| 849 | 848 | ORDER BY post_id DESC LIMIT 0,".(int)$max_number_of_posts; |
| 850 | - $result = Database::query($sql); |
|
| 851 | - |
|
| 852 | - // Display |
|
| 853 | - if(Database::num_rows($result) > 0) { |
|
| 854 | - $limit = 200; |
|
| 855 | - while ($blog_post = Database::fetch_array($result)) { |
|
| 856 | - // Get number of comments |
|
| 857 | - $sql = "SELECT COUNT(1) as number_of_comments |
|
| 849 | + $result = Database::query($sql); |
|
| 850 | + |
|
| 851 | + // Display |
|
| 852 | + if(Database::num_rows($result) > 0) { |
|
| 853 | + $limit = 200; |
|
| 854 | + while ($blog_post = Database::fetch_array($result)) { |
|
| 855 | + // Get number of comments |
|
| 856 | + $sql = "SELECT COUNT(1) as number_of_comments |
|
| 858 | 857 | FROM $tbl_blogs_comments |
| 859 | 858 | WHERE |
| 860 | 859 | c_id = $course_id AND |
| 861 | 860 | blog_id = '".(int)$blog_id."' AND |
| 862 | 861 | post_id = '" . (int)$blog_post['post_id']."'"; |
| 863 | - $tmp = Database::query($sql); |
|
| 864 | - $blog_post_comments = Database::fetch_array($tmp); |
|
| 865 | - |
|
| 866 | - // Prepare data |
|
| 867 | - $blog_post_id = $blog_post['post_id']; |
|
| 868 | - $blog_post_text = make_clickable(stripslashes($blog_post['full_text'])); |
|
| 869 | - $blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get()); |
|
| 870 | - |
|
| 871 | - // Create an introduction text (but keep FULL sentences) |
|
| 872 | - $words = 0; |
|
| 873 | - $blog_post_text_cut = cut($blog_post_text, $limit) ; |
|
| 874 | - $words = strlen($blog_post_text); |
|
| 875 | - |
|
| 876 | - if ($words >= $limit) { |
|
| 877 | - $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_' . $blog_post_id . '\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_' . $blog_post_id . '\').style.display=\'none\'">' . get_lang('ReadMore') . '</div>'; |
|
| 878 | - $introduction_text = $blog_post_text_cut; |
|
| 879 | - } else { |
|
| 880 | - $introduction_text = $blog_post_text; |
|
| 881 | - $readMoreLink = ''; |
|
| 882 | - } |
|
| 883 | - |
|
| 884 | - $introduction_text = stripslashes($introduction_text); |
|
| 885 | - |
|
| 886 | - echo '<div class="blogpost">'; |
|
| 887 | - echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
| 888 | - echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . '</a></span>'; |
|
| 889 | - echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">' . $introduction_text.$readMoreLink.'</div>'; |
|
| 890 | - echo '<div class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</div>'; |
|
| 891 | - |
|
| 892 | - $file_name_array = get_blog_attachment($blog_id,$blog_post_id,0); |
|
| 893 | - |
|
| 894 | - if (!empty($file_name_array)) { |
|
| 895 | - echo '<br /><br />'; |
|
| 896 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 897 | - echo '<a href="download.php?file='; |
|
| 898 | - echo $file_name_array['path']; |
|
| 899 | - echo ' "> '.$file_name_array['filename'].' </a><br />'; |
|
| 900 | - echo '</span>'; |
|
| 901 | - } |
|
| 902 | - $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
|
| 903 | - echo '<span class="blogpost_info">' . get_lang('Author') . ': ' . Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)) .' - <a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . get_lang('Comments') . ': ' . $blog_post_comments['number_of_comments'] . '</a></span>'; |
|
| 904 | - echo '</div>'; |
|
| 905 | - } |
|
| 906 | - } else { |
|
| 907 | - if($filter == '1=1') { |
|
| 908 | - echo get_lang('NoArticles'); |
|
| 909 | - } else { |
|
| 910 | - echo get_lang('NoArticleMatches'); |
|
| 911 | - } |
|
| 912 | - } |
|
| 862 | + $tmp = Database::query($sql); |
|
| 863 | + $blog_post_comments = Database::fetch_array($tmp); |
|
| 864 | + |
|
| 865 | + // Prepare data |
|
| 866 | + $blog_post_id = $blog_post['post_id']; |
|
| 867 | + $blog_post_text = make_clickable(stripslashes($blog_post['full_text'])); |
|
| 868 | + $blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get()); |
|
| 869 | + |
|
| 870 | + // Create an introduction text (but keep FULL sentences) |
|
| 871 | + $words = 0; |
|
| 872 | + $blog_post_text_cut = cut($blog_post_text, $limit) ; |
|
| 873 | + $words = strlen($blog_post_text); |
|
| 874 | + |
|
| 875 | + if ($words >= $limit) { |
|
| 876 | + $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_' . $blog_post_id . '\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_' . $blog_post_id . '\').style.display=\'none\'">' . get_lang('ReadMore') . '</div>'; |
|
| 877 | + $introduction_text = $blog_post_text_cut; |
|
| 878 | + } else { |
|
| 879 | + $introduction_text = $blog_post_text; |
|
| 880 | + $readMoreLink = ''; |
|
| 881 | + } |
|
| 882 | + |
|
| 883 | + $introduction_text = stripslashes($introduction_text); |
|
| 884 | + |
|
| 885 | + echo '<div class="blogpost">'; |
|
| 886 | + echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
| 887 | + echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . '</a></span>'; |
|
| 888 | + echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">' . $introduction_text.$readMoreLink.'</div>'; |
|
| 889 | + echo '<div class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</div>'; |
|
| 890 | + |
|
| 891 | + $file_name_array = get_blog_attachment($blog_id,$blog_post_id,0); |
|
| 892 | + |
|
| 893 | + if (!empty($file_name_array)) { |
|
| 894 | + echo '<br /><br />'; |
|
| 895 | + echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 896 | + echo '<a href="download.php?file='; |
|
| 897 | + echo $file_name_array['path']; |
|
| 898 | + echo ' "> '.$file_name_array['filename'].' </a><br />'; |
|
| 899 | + echo '</span>'; |
|
| 900 | + } |
|
| 901 | + $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
|
| 902 | + echo '<span class="blogpost_info">' . get_lang('Author') . ': ' . Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)) .' - <a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . get_lang('Comments') . ': ' . $blog_post_comments['number_of_comments'] . '</a></span>'; |
|
| 903 | + echo '</div>'; |
|
| 904 | + } |
|
| 905 | + } else { |
|
| 906 | + if($filter == '1=1') { |
|
| 907 | + echo get_lang('NoArticles'); |
|
| 908 | + } else { |
|
| 909 | + echo get_lang('NoArticleMatches'); |
|
| 910 | + } |
|
| 911 | + } |
|
| 913 | 912 | } |
| 914 | 913 | |
| 915 | - /** |
|
| 916 | - * Display the search results |
|
| 917 | - * |
|
| 918 | - * @param Integer $blog_id |
|
| 919 | - * @param String $query_string |
|
| 920 | - */ |
|
| 921 | - public static function display_search_results ($blog_id, $query_string) |
|
| 922 | - { |
|
| 923 | - // Init |
|
| 924 | - $query_string = Database::escape_string($query_string); |
|
| 925 | - $query_string_parts = explode(' ',$query_string); |
|
| 926 | - $query_string = array(); |
|
| 927 | - foreach ($query_string_parts as $query_part) { |
|
| 928 | - $query_string[] = " full_text LIKE '%" . $query_part."%' OR title LIKE '%" . $query_part."%' "; |
|
| 929 | - } |
|
| 930 | - $query_string = '('.implode('OR',$query_string) . ')'; |
|
| 931 | - |
|
| 932 | - // Display the posts |
|
| 933 | - echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>'; |
|
| 934 | - Blog::display_blog_posts($blog_id, $query_string); |
|
| 935 | - } |
|
| 936 | - |
|
| 937 | - /** |
|
| 938 | - * Display posts from a certain date |
|
| 939 | - * |
|
| 940 | - * @param Integer $blog_id |
|
| 941 | - * @param String $query_string |
|
| 942 | - */ |
|
| 943 | - public static function display_day_results($blog_id, $query_string) |
|
| 944 | - { |
|
| 945 | - $date_output = $query_string; |
|
| 946 | - $date = explode('-',$query_string); |
|
| 947 | - $query_string = ' DAYOFMONTH(date_creation) =' . intval($date[2]) . ' AND MONTH(date_creation) =' . intval($date[1]) . ' AND YEAR(date_creation) =' . intval($date[0]); |
|
| 948 | - |
|
| 949 | - // Put date in correct output format |
|
| 950 | - $date_output = api_format_date($date_output, DATE_FORMAT_LONG); |
|
| 951 | - |
|
| 952 | - // Display the posts |
|
| 953 | - echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>'; |
|
| 954 | - Blog::display_blog_posts($blog_id, $query_string); |
|
| 955 | - } |
|
| 956 | - |
|
| 957 | - /** |
|
| 958 | - * Displays a post and his comments |
|
| 959 | - * |
|
| 960 | - * @param Integer $blog_id |
|
| 961 | - * @param Integer $post_id |
|
| 962 | - */ |
|
| 963 | - public static function display_post($blog_id, $post_id) |
|
| 964 | - { |
|
| 965 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 966 | - $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 967 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 968 | - |
|
| 969 | - global $charset, $dateFormatLong; |
|
| 970 | - |
|
| 971 | - $course_id = api_get_course_int_id(); |
|
| 972 | - |
|
| 973 | - // Get posts and author |
|
| 974 | - $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
|
| 914 | + /** |
|
| 915 | + * Display the search results |
|
| 916 | + * |
|
| 917 | + * @param Integer $blog_id |
|
| 918 | + * @param String $query_string |
|
| 919 | + */ |
|
| 920 | + public static function display_search_results ($blog_id, $query_string) |
|
| 921 | + { |
|
| 922 | + // Init |
|
| 923 | + $query_string = Database::escape_string($query_string); |
|
| 924 | + $query_string_parts = explode(' ',$query_string); |
|
| 925 | + $query_string = array(); |
|
| 926 | + foreach ($query_string_parts as $query_part) { |
|
| 927 | + $query_string[] = " full_text LIKE '%" . $query_part."%' OR title LIKE '%" . $query_part."%' "; |
|
| 928 | + } |
|
| 929 | + $query_string = '('.implode('OR',$query_string) . ')'; |
|
| 930 | + |
|
| 931 | + // Display the posts |
|
| 932 | + echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>'; |
|
| 933 | + Blog::display_blog_posts($blog_id, $query_string); |
|
| 934 | + } |
|
| 935 | + |
|
| 936 | + /** |
|
| 937 | + * Display posts from a certain date |
|
| 938 | + * |
|
| 939 | + * @param Integer $blog_id |
|
| 940 | + * @param String $query_string |
|
| 941 | + */ |
|
| 942 | + public static function display_day_results($blog_id, $query_string) |
|
| 943 | + { |
|
| 944 | + $date_output = $query_string; |
|
| 945 | + $date = explode('-',$query_string); |
|
| 946 | + $query_string = ' DAYOFMONTH(date_creation) =' . intval($date[2]) . ' AND MONTH(date_creation) =' . intval($date[1]) . ' AND YEAR(date_creation) =' . intval($date[0]); |
|
| 947 | + |
|
| 948 | + // Put date in correct output format |
|
| 949 | + $date_output = api_format_date($date_output, DATE_FORMAT_LONG); |
|
| 950 | + |
|
| 951 | + // Display the posts |
|
| 952 | + echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>'; |
|
| 953 | + Blog::display_blog_posts($blog_id, $query_string); |
|
| 954 | + } |
|
| 955 | + |
|
| 956 | + /** |
|
| 957 | + * Displays a post and his comments |
|
| 958 | + * |
|
| 959 | + * @param Integer $blog_id |
|
| 960 | + * @param Integer $post_id |
|
| 961 | + */ |
|
| 962 | + public static function display_post($blog_id, $post_id) |
|
| 963 | + { |
|
| 964 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 965 | + $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 966 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 967 | + |
|
| 968 | + global $charset, $dateFormatLong; |
|
| 969 | + |
|
| 970 | + $course_id = api_get_course_int_id(); |
|
| 971 | + |
|
| 972 | + // Get posts and author |
|
| 973 | + $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
|
| 975 | 974 | FROM $tbl_blogs_posts post |
| 976 | 975 | INNER JOIN $tbl_users user |
| 977 | 976 | ON post.author_id = user.user_id |
@@ -980,113 +979,113 @@ discard block |
||
| 980 | 979 | post.blog_id = '".(int)$blog_id."' AND |
| 981 | 980 | post.post_id = '".(int)$post_id."' |
| 982 | 981 | ORDER BY post_id DESC"; |
| 983 | - $result = Database::query($sql); |
|
| 984 | - $blog_post = Database::fetch_array($result); |
|
| 982 | + $result = Database::query($sql); |
|
| 983 | + $blog_post = Database::fetch_array($result); |
|
| 985 | 984 | |
| 986 | - // Get number of comments |
|
| 987 | - $sql = "SELECT COUNT(1) as number_of_comments |
|
| 985 | + // Get number of comments |
|
| 986 | + $sql = "SELECT COUNT(1) as number_of_comments |
|
| 988 | 987 | FROM $tbl_blogs_comments |
| 989 | 988 | WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND post_id = '".(int)$post_id."'"; |
| 990 | - $result = Database::query($sql); |
|
| 991 | - $blog_post_comments = Database::fetch_array($result); |
|
| 989 | + $result = Database::query($sql); |
|
| 990 | + $blog_post_comments = Database::fetch_array($result); |
|
| 992 | 991 | |
| 993 | - // Prepare data |
|
| 994 | - $blog_post_text = make_clickable(stripslashes($blog_post['full_text'])); |
|
| 995 | - $blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get()); |
|
| 996 | - $blog_post_actions = ""; |
|
| 992 | + // Prepare data |
|
| 993 | + $blog_post_text = make_clickable(stripslashes($blog_post['full_text'])); |
|
| 994 | + $blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get()); |
|
| 995 | + $blog_post_actions = ""; |
|
| 997 | 996 | |
| 998 | - $task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? intval($_GET['task_id']) : 0; |
|
| 997 | + $task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? intval($_GET['task_id']) : 0; |
|
| 999 | 998 | |
| 1000 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_edit', $task_id)) { |
|
| 1001 | - $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('EditThisPost') . '">'; |
|
| 1002 | - $blog_post_actions .= Display::return_icon('edit.png'); |
|
| 1003 | - $blog_post_actions .= '</a>'; |
|
| 999 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_edit', $task_id)) { |
|
| 1000 | + $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('EditThisPost') . '">'; |
|
| 1001 | + $blog_post_actions .= Display::return_icon('edit.png'); |
|
| 1002 | + $blog_post_actions .= '</a>'; |
|
| 1004 | 1003 | } |
| 1005 | 1004 | |
| 1006 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_delete', $task_id)) { |
|
| 1007 | - $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&do=delete_article&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('DeleteThisArticle') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;">'; |
|
| 1005 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_delete', $task_id)) { |
|
| 1006 | + $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&do=delete_article&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('DeleteThisArticle') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;">'; |
|
| 1008 | 1007 | $blog_post_actions .= Display::return_icon('delete.png'); |
| 1009 | 1008 | $blog_post_actions .= '</a>'; |
| 1010 | 1009 | } |
| 1011 | 1010 | |
| 1012 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) |
|
| 1013 | - $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
| 1011 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) |
|
| 1012 | + $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
| 1014 | 1013 | |
| 1015 | - $blog_post_text=stripslashes($blog_post_text); |
|
| 1014 | + $blog_post_text=stripslashes($blog_post_text); |
|
| 1016 | 1015 | |
| 1017 | - // Display post |
|
| 1018 | - echo '<div class="blogpost">'; |
|
| 1019 | - echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
| 1020 | - echo '<span class="blogpost_date">' . $blog_post_date . '</span>'; |
|
| 1021 | - echo '<span class="blogpost_text">' . $blog_post_text . '</span><br />'; |
|
| 1016 | + // Display post |
|
| 1017 | + echo '<div class="blogpost">'; |
|
| 1018 | + echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
| 1019 | + echo '<span class="blogpost_date">' . $blog_post_date . '</span>'; |
|
| 1020 | + echo '<span class="blogpost_text">' . $blog_post_text . '</span><br />'; |
|
| 1022 | 1021 | |
| 1023 | - $file_name_array = get_blog_attachment($blog_id, $post_id); |
|
| 1022 | + $file_name_array = get_blog_attachment($blog_id, $post_id); |
|
| 1024 | 1023 | |
| 1025 | 1024 | if (!empty($file_name_array)) { |
| 1026 | - echo ' <br />'; |
|
| 1027 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 1028 | - echo '<a href="download.php?file='; |
|
| 1029 | - echo $file_name_array['path']; |
|
| 1030 | - echo ' "> '.$file_name_array['filename'].' </a>'; |
|
| 1031 | - echo '</span>'; |
|
| 1032 | - echo '<span class="attachment_comment">'; |
|
| 1033 | - echo $file_name_array['comment']; |
|
| 1034 | - echo '</span>'; |
|
| 1035 | - echo '<br />'; |
|
| 1036 | - } |
|
| 1025 | + echo ' <br />'; |
|
| 1026 | + echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 1027 | + echo '<a href="download.php?file='; |
|
| 1028 | + echo $file_name_array['path']; |
|
| 1029 | + echo ' "> '.$file_name_array['filename'].' </a>'; |
|
| 1030 | + echo '</span>'; |
|
| 1031 | + echo '<span class="attachment_comment">'; |
|
| 1032 | + echo $file_name_array['comment']; |
|
| 1033 | + echo '</span>'; |
|
| 1034 | + echo '<br />'; |
|
| 1035 | + } |
|
| 1037 | 1036 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
| 1038 | - echo '<span class="blogpost_info">'.get_lang('Author').': ' .Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post',$blog_id,$post_id).$rating_select.'</span>'; |
|
| 1039 | - echo '<span class="blogpost_actions">' . $blog_post_actions . '</span>'; |
|
| 1040 | - echo '</div>'; |
|
| 1041 | - |
|
| 1042 | - // Display comments if there are any |
|
| 1043 | - if($blog_post_comments['number_of_comments'] > 0) { |
|
| 1044 | - echo '<div class="comments">'; |
|
| 1045 | - echo '<span class="blogpost_title">' . get_lang('Comments') . '</span><br />'; |
|
| 1046 | - Blog::get_threaded_comments(0, 0, $blog_id, $post_id, $task_id); |
|
| 1047 | - echo '</div>'; |
|
| 1048 | - } |
|
| 1049 | - |
|
| 1050 | - // Display comment form |
|
| 1051 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_comments_add')) { |
|
| 1052 | - Blog::display_new_comment_form($blog_id, $post_id, $blog_post['title']); |
|
| 1053 | - } |
|
| 1054 | - } |
|
| 1055 | - |
|
| 1056 | - /** |
|
| 1057 | - * Adds rating to a certain post or comment |
|
| 1058 | - * @author Toon Keppens |
|
| 1059 | - * |
|
| 1060 | - * @param String $type |
|
| 1061 | - * @param Integer $blog_id |
|
| 1062 | - * @param Integer $item_id |
|
| 1063 | - * @param Integer $rating |
|
| 1064 | - * |
|
| 1065 | - * @return Boolean success |
|
| 1066 | - */ |
|
| 1067 | - public static function add_rating($type, $blog_id, $item_id, $rating) |
|
| 1068 | - { |
|
| 1069 | - $_user = api_get_user_info(); |
|
| 1070 | - |
|
| 1071 | - // Init |
|
| 1072 | - $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 1073 | - $course_id = api_get_course_int_id(); |
|
| 1074 | - |
|
| 1075 | - // Check if the user has already rated this post/comment |
|
| 1076 | - $sql = "SELECT rating_id FROM $tbl_blogs_rating |
|
| 1037 | + echo '<span class="blogpost_info">'.get_lang('Author').': ' .Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post',$blog_id,$post_id).$rating_select.'</span>'; |
|
| 1038 | + echo '<span class="blogpost_actions">' . $blog_post_actions . '</span>'; |
|
| 1039 | + echo '</div>'; |
|
| 1040 | + |
|
| 1041 | + // Display comments if there are any |
|
| 1042 | + if($blog_post_comments['number_of_comments'] > 0) { |
|
| 1043 | + echo '<div class="comments">'; |
|
| 1044 | + echo '<span class="blogpost_title">' . get_lang('Comments') . '</span><br />'; |
|
| 1045 | + Blog::get_threaded_comments(0, 0, $blog_id, $post_id, $task_id); |
|
| 1046 | + echo '</div>'; |
|
| 1047 | + } |
|
| 1048 | + |
|
| 1049 | + // Display comment form |
|
| 1050 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_comments_add')) { |
|
| 1051 | + Blog::display_new_comment_form($blog_id, $post_id, $blog_post['title']); |
|
| 1052 | + } |
|
| 1053 | + } |
|
| 1054 | + |
|
| 1055 | + /** |
|
| 1056 | + * Adds rating to a certain post or comment |
|
| 1057 | + * @author Toon Keppens |
|
| 1058 | + * |
|
| 1059 | + * @param String $type |
|
| 1060 | + * @param Integer $blog_id |
|
| 1061 | + * @param Integer $item_id |
|
| 1062 | + * @param Integer $rating |
|
| 1063 | + * |
|
| 1064 | + * @return Boolean success |
|
| 1065 | + */ |
|
| 1066 | + public static function add_rating($type, $blog_id, $item_id, $rating) |
|
| 1067 | + { |
|
| 1068 | + $_user = api_get_user_info(); |
|
| 1069 | + |
|
| 1070 | + // Init |
|
| 1071 | + $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 1072 | + $course_id = api_get_course_int_id(); |
|
| 1073 | + |
|
| 1074 | + // Check if the user has already rated this post/comment |
|
| 1075 | + $sql = "SELECT rating_id FROM $tbl_blogs_rating |
|
| 1077 | 1076 | WHERE |
| 1078 | 1077 | c_id = $course_id AND |
| 1079 | 1078 | blog_id = '".(int)$blog_id."' AND |
| 1080 | 1079 | item_id = '".(int)$item_id."' AND |
| 1081 | 1080 | rating_type = '".Database::escape_string($type)."' AND |
| 1082 | 1081 | user_id = '".(int)$_user['user_id']."'"; |
| 1083 | - $result = Database::query($sql); |
|
| 1082 | + $result = Database::query($sql); |
|
| 1084 | 1083 | |
| 1085 | 1084 | // Add rating |
| 1086 | - if (Database::num_rows($result) == 0) { |
|
| 1087 | - $sql = "INSERT INTO $tbl_blogs_rating (c_id, blog_id, rating_type, item_id, user_id, rating ) |
|
| 1085 | + if (Database::num_rows($result) == 0) { |
|
| 1086 | + $sql = "INSERT INTO $tbl_blogs_rating (c_id, blog_id, rating_type, item_id, user_id, rating ) |
|
| 1088 | 1087 | VALUES ($course_id, '".(int)$blog_id."', '".Database::escape_string($type)."', '".(int)$item_id."', '".(int)$_user['user_id']."', '".Database::escape_string($rating)."')"; |
| 1089 | - Database::query($sql); |
|
| 1088 | + Database::query($sql); |
|
| 1090 | 1089 | |
| 1091 | 1090 | $id = Database::insert_id(); |
| 1092 | 1091 | if ($id) { |
@@ -1094,107 +1093,107 @@ discard block |
||
| 1094 | 1093 | Database::query($sql); |
| 1095 | 1094 | } |
| 1096 | 1095 | |
| 1097 | - return true; |
|
| 1096 | + return true; |
|
| 1098 | 1097 | } else { |
| 1099 | - return false; |
|
| 1100 | - } |
|
| 1101 | - } |
|
| 1102 | - |
|
| 1103 | - /** |
|
| 1104 | - * Shows the rating of user |
|
| 1105 | - * |
|
| 1106 | - * @param String $type |
|
| 1107 | - * @param Integer $blog_id |
|
| 1108 | - * @param Integer $item_id |
|
| 1109 | - * |
|
| 1110 | - * @return array() |
|
| 1111 | - */ |
|
| 1112 | - public static function display_rating($type, $blog_id, $item_id) |
|
| 1113 | - { |
|
| 1114 | - $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 1115 | - $course_id = api_get_course_int_id(); |
|
| 1116 | - |
|
| 1117 | - // Calculate rating |
|
| 1118 | - $sql = "SELECT AVG(rating) as rating FROM $tbl_blogs_rating |
|
| 1098 | + return false; |
|
| 1099 | + } |
|
| 1100 | + } |
|
| 1101 | + |
|
| 1102 | + /** |
|
| 1103 | + * Shows the rating of user |
|
| 1104 | + * |
|
| 1105 | + * @param String $type |
|
| 1106 | + * @param Integer $blog_id |
|
| 1107 | + * @param Integer $item_id |
|
| 1108 | + * |
|
| 1109 | + * @return array() |
|
| 1110 | + */ |
|
| 1111 | + public static function display_rating($type, $blog_id, $item_id) |
|
| 1112 | + { |
|
| 1113 | + $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 1114 | + $course_id = api_get_course_int_id(); |
|
| 1115 | + |
|
| 1116 | + // Calculate rating |
|
| 1117 | + $sql = "SELECT AVG(rating) as rating FROM $tbl_blogs_rating |
|
| 1119 | 1118 | WHERE |
| 1120 | 1119 | c_id = $course_id AND |
| 1121 | 1120 | blog_id = '".(int)$blog_id."' AND |
| 1122 | 1121 | item_id = '".(int)$item_id."' AND |
| 1123 | 1122 | rating_type = '".Database::escape_string($type)."' "; |
| 1124 | - $result = Database::query($sql); |
|
| 1125 | - $result = Database::fetch_array($result); |
|
| 1126 | - return round($result['rating'], 2); |
|
| 1127 | - } |
|
| 1128 | - |
|
| 1129 | - /** |
|
| 1130 | - * Shows the rating form if not already rated by that user |
|
| 1131 | - * @author Toon Keppens |
|
| 1132 | - * |
|
| 1133 | - * @param String $type |
|
| 1134 | - * @param Integer $blog_id |
|
| 1135 | - * @param Integer $item_id |
|
| 1136 | - * |
|
| 1137 | - *@return String |
|
| 1138 | - */ |
|
| 1139 | - public static function display_rating_form ($type, $blog_id, $post_id, $comment_id = NULL) |
|
| 1140 | - { |
|
| 1141 | - $_user = api_get_user_info(); |
|
| 1142 | - $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 1123 | + $result = Database::query($sql); |
|
| 1124 | + $result = Database::fetch_array($result); |
|
| 1125 | + return round($result['rating'], 2); |
|
| 1126 | + } |
|
| 1127 | + |
|
| 1128 | + /** |
|
| 1129 | + * Shows the rating form if not already rated by that user |
|
| 1130 | + * @author Toon Keppens |
|
| 1131 | + * |
|
| 1132 | + * @param String $type |
|
| 1133 | + * @param Integer $blog_id |
|
| 1134 | + * @param Integer $item_id |
|
| 1135 | + * |
|
| 1136 | + *@return String |
|
| 1137 | + */ |
|
| 1138 | + public static function display_rating_form ($type, $blog_id, $post_id, $comment_id = NULL) |
|
| 1139 | + { |
|
| 1140 | + $_user = api_get_user_info(); |
|
| 1141 | + $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
|
| 1143 | 1142 | $course_id = api_get_course_int_id(); |
| 1144 | 1143 | |
| 1145 | 1144 | if ($type == 'post') { |
| 1146 | - // Check if the user has already rated this post |
|
| 1147 | - $sql = "SELECT rating_id FROM $tbl_blogs_rating |
|
| 1145 | + // Check if the user has already rated this post |
|
| 1146 | + $sql = "SELECT rating_id FROM $tbl_blogs_rating |
|
| 1148 | 1147 | WHERE c_id = $course_id AND |
| 1149 | 1148 | blog_id = '".(int)$blog_id."' |
| 1150 | 1149 | AND item_id = '".(int)$post_id."' |
| 1151 | 1150 | AND rating_type = '".Database::escape_string($type)."' |
| 1152 | 1151 | AND user_id = '".(int)$_user['user_id']."'"; |
| 1153 | - $result = Database::query($sql); |
|
| 1152 | + $result = Database::query($sql); |
|
| 1154 | 1153 | // Add rating |
| 1155 | 1154 | if (Database::num_rows($result) == 0) { |
| 1156 | - return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $post_id . '" name="frm_rating_' . $type . '_' . $post_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $post_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /></form>'; |
|
| 1155 | + return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $post_id . '" name="frm_rating_' . $type . '_' . $post_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $post_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /></form>'; |
|
| 1157 | 1156 | } else { |
| 1158 | - return ''; |
|
| 1159 | - } |
|
| 1160 | - } |
|
| 1157 | + return ''; |
|
| 1158 | + } |
|
| 1159 | + } |
|
| 1161 | 1160 | |
| 1162 | 1161 | if ($type = 'comment') { |
| 1163 | - // Check if the user has already rated this comment |
|
| 1164 | - $sql = "SELECT rating_id FROM $tbl_blogs_rating |
|
| 1162 | + // Check if the user has already rated this comment |
|
| 1163 | + $sql = "SELECT rating_id FROM $tbl_blogs_rating |
|
| 1165 | 1164 | WHERE c_id = $course_id AND blog_id = '".(int)$blog_id ."' |
| 1166 | 1165 | AND item_id = '".(int)$comment_id."' |
| 1167 | 1166 | AND rating_type = '".Database::escape_string($type)."' |
| 1168 | 1167 | AND user_id = '".(int)$_user['user_id']."'"; |
| 1169 | - $result = Database::query($sql); |
|
| 1168 | + $result = Database::query($sql); |
|
| 1170 | 1169 | |
| 1171 | 1170 | if (Database::num_rows($result) == 0) { |
| 1172 | - return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $comment_id . '" name="frm_rating_' . $type . '_' . $comment_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $comment_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /><input type="hidden" name="comment_id" value="' . $comment_id . '" /></form>'; |
|
| 1171 | + return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $comment_id . '" name="frm_rating_' . $type . '_' . $comment_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $comment_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /><input type="hidden" name="comment_id" value="' . $comment_id . '" /></form>'; |
|
| 1173 | 1172 | } else { |
| 1174 | - return ''; |
|
| 1175 | - } |
|
| 1176 | - } |
|
| 1177 | - } |
|
| 1178 | - |
|
| 1179 | - /** |
|
| 1180 | - * This functions gets all replys to a post, threaded. |
|
| 1181 | - * |
|
| 1182 | - * @param Integer $current |
|
| 1183 | - * @param Integer $current_level |
|
| 1184 | - * @param Integer $blog_id |
|
| 1185 | - * @param Integer $post_id |
|
| 1186 | - */ |
|
| 1187 | - public static function get_threaded_comments($current = 0, $current_level = 0, $blog_id, $post_id, $task_id = 0) |
|
| 1188 | - { |
|
| 1189 | - $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 1190 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1191 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1192 | - global $charset; |
|
| 1193 | - |
|
| 1194 | - $course_id = api_get_course_int_id(); |
|
| 1195 | - |
|
| 1196 | - // Select top level comments |
|
| 1197 | - $next_level = $current_level + 1; |
|
| 1173 | + return ''; |
|
| 1174 | + } |
|
| 1175 | + } |
|
| 1176 | + } |
|
| 1177 | + |
|
| 1178 | + /** |
|
| 1179 | + * This functions gets all replys to a post, threaded. |
|
| 1180 | + * |
|
| 1181 | + * @param Integer $current |
|
| 1182 | + * @param Integer $current_level |
|
| 1183 | + * @param Integer $blog_id |
|
| 1184 | + * @param Integer $post_id |
|
| 1185 | + */ |
|
| 1186 | + public static function get_threaded_comments($current = 0, $current_level = 0, $blog_id, $post_id, $task_id = 0) |
|
| 1187 | + { |
|
| 1188 | + $tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS); |
|
| 1189 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1190 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1191 | + global $charset; |
|
| 1192 | + |
|
| 1193 | + $course_id = api_get_course_int_id(); |
|
| 1194 | + |
|
| 1195 | + // Select top level comments |
|
| 1196 | + $next_level = $current_level + 1; |
|
| 1198 | 1197 | $sql = "SELECT comments.*, user.lastname, user.firstname, user.username, task.color |
| 1199 | 1198 | FROM $tbl_blogs_comments comments |
| 1200 | 1199 | INNER JOIN $tbl_users user |
@@ -1206,11 +1205,11 @@ discard block |
||
| 1206 | 1205 | parent_comment_id = $current AND |
| 1207 | 1206 | comments.blog_id = '".(int)$blog_id."' AND |
| 1208 | 1207 | comments.post_id = '".(int)$post_id."'"; |
| 1209 | - $result = Database::query($sql); |
|
| 1208 | + $result = Database::query($sql); |
|
| 1210 | 1209 | |
| 1211 | - while($comment = Database::fetch_array($result)) { |
|
| 1212 | - // Select the children recursivly |
|
| 1213 | - $tmp = "SELECT comments.*, user.lastname, user.firstname, user.username |
|
| 1210 | + while($comment = Database::fetch_array($result)) { |
|
| 1211 | + // Select the children recursivly |
|
| 1212 | + $tmp = "SELECT comments.*, user.lastname, user.firstname, user.username |
|
| 1214 | 1213 | FROM $tbl_blogs_comments comments |
| 1215 | 1214 | INNER JOIN $tbl_users user |
| 1216 | 1215 | ON comments.author_id = user.user_id |
@@ -1219,15 +1218,15 @@ discard block |
||
| 1219 | 1218 | comment_id = $current |
| 1220 | 1219 | AND blog_id = '".(int)$blog_id."' |
| 1221 | 1220 | AND post_id = '".(int)$post_id."'"; |
| 1222 | - $tmp = Database::query($tmp); |
|
| 1223 | - $tmp = Database::fetch_array($tmp); |
|
| 1224 | - $parent_cat = $tmp['parent_comment_id']; |
|
| 1225 | - $border_color = ''; |
|
| 1226 | - |
|
| 1227 | - // Prepare data |
|
| 1228 | - $comment_text = make_clickable(stripslashes($comment['comment'])); |
|
| 1229 | - $blog_comment_date = api_convert_and_format_date($comment['date_creation'], null, date_default_timezone_get()); |
|
| 1230 | - $blog_comment_actions = ""; |
|
| 1221 | + $tmp = Database::query($tmp); |
|
| 1222 | + $tmp = Database::fetch_array($tmp); |
|
| 1223 | + $parent_cat = $tmp['parent_comment_id']; |
|
| 1224 | + $border_color = ''; |
|
| 1225 | + |
|
| 1226 | + // Prepare data |
|
| 1227 | + $comment_text = make_clickable(stripslashes($comment['comment'])); |
|
| 1228 | + $blog_comment_date = api_convert_and_format_date($comment['date_creation'], null, date_default_timezone_get()); |
|
| 1229 | + $blog_comment_actions = ""; |
|
| 1231 | 1230 | if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
| 1232 | 1231 | $blog_comment_actions .= '<a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=delete_comment&comment_id='.$comment['comment_id'].'&task_id='.$task_id.'" title="'.get_lang( |
| 1233 | 1232 | 'DeleteThisComment' |
@@ -1242,92 +1241,92 @@ discard block |
||
| 1242 | 1241 | $rating_select = Blog::display_rating_form('comment', $blog_id, $post_id, $comment['comment_id']); |
| 1243 | 1242 | } |
| 1244 | 1243 | |
| 1245 | - if (!is_null($comment['task_id'])) { |
|
| 1246 | - $border_color = ' border-left: 3px solid #' . $comment['color']; |
|
| 1247 | - } |
|
| 1248 | - |
|
| 1249 | - $comment_text = stripslashes($comment_text); |
|
| 1250 | - |
|
| 1251 | - // Output... |
|
| 1252 | - $margin = $current_level * 30; |
|
| 1253 | - echo '<div class="blogpost_comment" style="margin-left: ' . $margin . 'px;' . $border_color . '">'; |
|
| 1254 | - echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\'' . $comment['comment_id'] . '\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']) . '\'" title="' . get_lang('ReplyToThisComment') . '" >'.stripslashes($comment['title']) . '</a></span>'; |
|
| 1255 | - echo '<span class="blogpost_comment_date">' . $blog_comment_date . '</span>'; |
|
| 1256 | - echo '<span class="blogpost_text">' . $comment_text . '</span>'; |
|
| 1257 | - |
|
| 1258 | - $file_name_array = get_blog_attachment($blog_id,$post_id, $comment['comment_id']); |
|
| 1259 | - if (!empty($file_name_array)) { |
|
| 1260 | - echo '<br /><br />'; |
|
| 1261 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 1262 | - echo '<a href="download.php?file='; |
|
| 1263 | - echo $file_name_array['path']; |
|
| 1264 | - echo ' "> '.$file_name_array['filename'].' </a>'; |
|
| 1265 | - echo '<span class="attachment_comment">'; |
|
| 1266 | - echo $file_name_array['comment']; |
|
| 1267 | - echo '</span><br />'; |
|
| 1268 | - } |
|
| 1244 | + if (!is_null($comment['task_id'])) { |
|
| 1245 | + $border_color = ' border-left: 3px solid #' . $comment['color']; |
|
| 1246 | + } |
|
| 1247 | + |
|
| 1248 | + $comment_text = stripslashes($comment_text); |
|
| 1249 | + |
|
| 1250 | + // Output... |
|
| 1251 | + $margin = $current_level * 30; |
|
| 1252 | + echo '<div class="blogpost_comment" style="margin-left: ' . $margin . 'px;' . $border_color . '">'; |
|
| 1253 | + echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\'' . $comment['comment_id'] . '\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']) . '\'" title="' . get_lang('ReplyToThisComment') . '" >'.stripslashes($comment['title']) . '</a></span>'; |
|
| 1254 | + echo '<span class="blogpost_comment_date">' . $blog_comment_date . '</span>'; |
|
| 1255 | + echo '<span class="blogpost_text">' . $comment_text . '</span>'; |
|
| 1256 | + |
|
| 1257 | + $file_name_array = get_blog_attachment($blog_id,$post_id, $comment['comment_id']); |
|
| 1258 | + if (!empty($file_name_array)) { |
|
| 1259 | + echo '<br /><br />'; |
|
| 1260 | + echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 1261 | + echo '<a href="download.php?file='; |
|
| 1262 | + echo $file_name_array['path']; |
|
| 1263 | + echo ' "> '.$file_name_array['filename'].' </a>'; |
|
| 1264 | + echo '<span class="attachment_comment">'; |
|
| 1265 | + echo $file_name_array['comment']; |
|
| 1266 | + echo '</span><br />'; |
|
| 1267 | + } |
|
| 1269 | 1268 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $comment['username']), ENT_QUOTES); |
| 1270 | - echo '<span class="blogpost_comment_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($comment['firstname'], $comment['lastname']), array('title'=>$username)).' - '.get_lang('Rating').': '.Blog::display_rating('comment', $blog_id, $comment['comment_id']).$rating_select.'</span>'; |
|
| 1271 | - echo '<span class="blogpost_actions">' . $blog_comment_actions . '</span>'; |
|
| 1272 | - echo '</div>'; |
|
| 1273 | - |
|
| 1274 | - // Go further down the tree. |
|
| 1275 | - Blog::get_threaded_comments($comment['comment_id'], $next_level, $blog_id, $post_id); |
|
| 1276 | - } |
|
| 1277 | - } |
|
| 1278 | - |
|
| 1279 | - /** |
|
| 1280 | - * Displays the form to create a new post |
|
| 1281 | - * @author Toon Keppens |
|
| 1282 | - * |
|
| 1283 | - * @param Integer $blog_id |
|
| 1284 | - */ |
|
| 1285 | - public static function display_form_new_post($blog_id) |
|
| 1286 | - { |
|
| 1287 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
| 1288 | - $form = new FormValidator( |
|
| 1289 | - 'add_post', |
|
| 1290 | - 'post', |
|
| 1291 | - api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq(), |
|
| 1292 | - null, |
|
| 1293 | - array('enctype' => 'multipart/form-data') |
|
| 1294 | - ); |
|
| 1295 | - $form->addHidden('post_title_edited', 'false'); |
|
| 1296 | - $form->addHeader(get_lang('NewPost')); |
|
| 1297 | - $form->addText('title', get_lang('Title')); |
|
| 1298 | - $config = array(); |
|
| 1299 | - if (!api_is_allowed_to_edit()) { |
|
| 1300 | - $config['ToolbarSet'] = 'ProjectStudent'; |
|
| 1301 | - } else { |
|
| 1302 | - $config['ToolbarSet'] = 'Project'; |
|
| 1303 | - } |
|
| 1304 | - $form->addHtmlEditor('full_text', get_lang('Content'), false, false, $config); |
|
| 1305 | - $form->addFile('user_upload', get_lang('AddAnAttachment')); |
|
| 1306 | - $form->addTextarea('post_file_comment', get_lang('FileComment')); |
|
| 1307 | - $form->addHidden('new_post_submit', 'true'); |
|
| 1308 | - $form->addButton('save', get_lang('Save')); |
|
| 1309 | - |
|
| 1310 | - $form->display(); |
|
| 1311 | - } else { |
|
| 1312 | - api_not_allowed(); |
|
| 1313 | - } |
|
| 1314 | - } |
|
| 1315 | - |
|
| 1316 | - /** |
|
| 1317 | - * Displays the form to edit a post |
|
| 1318 | - * @author Toon Keppens |
|
| 1319 | - * |
|
| 1320 | - * @param Integer $blog_id |
|
| 1321 | - */ |
|
| 1322 | - public static function display_form_edit_post($blog_id, $post_id) |
|
| 1323 | - { |
|
| 1324 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 1325 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1326 | - |
|
| 1327 | - $course_id = api_get_course_int_id(); |
|
| 1328 | - |
|
| 1329 | - // Get posts and author |
|
| 1330 | - $sql = "SELECT post.*, user.lastname, user.firstname |
|
| 1269 | + echo '<span class="blogpost_comment_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($comment['firstname'], $comment['lastname']), array('title'=>$username)).' - '.get_lang('Rating').': '.Blog::display_rating('comment', $blog_id, $comment['comment_id']).$rating_select.'</span>'; |
|
| 1270 | + echo '<span class="blogpost_actions">' . $blog_comment_actions . '</span>'; |
|
| 1271 | + echo '</div>'; |
|
| 1272 | + |
|
| 1273 | + // Go further down the tree. |
|
| 1274 | + Blog::get_threaded_comments($comment['comment_id'], $next_level, $blog_id, $post_id); |
|
| 1275 | + } |
|
| 1276 | + } |
|
| 1277 | + |
|
| 1278 | + /** |
|
| 1279 | + * Displays the form to create a new post |
|
| 1280 | + * @author Toon Keppens |
|
| 1281 | + * |
|
| 1282 | + * @param Integer $blog_id |
|
| 1283 | + */ |
|
| 1284 | + public static function display_form_new_post($blog_id) |
|
| 1285 | + { |
|
| 1286 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
| 1287 | + $form = new FormValidator( |
|
| 1288 | + 'add_post', |
|
| 1289 | + 'post', |
|
| 1290 | + api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq(), |
|
| 1291 | + null, |
|
| 1292 | + array('enctype' => 'multipart/form-data') |
|
| 1293 | + ); |
|
| 1294 | + $form->addHidden('post_title_edited', 'false'); |
|
| 1295 | + $form->addHeader(get_lang('NewPost')); |
|
| 1296 | + $form->addText('title', get_lang('Title')); |
|
| 1297 | + $config = array(); |
|
| 1298 | + if (!api_is_allowed_to_edit()) { |
|
| 1299 | + $config['ToolbarSet'] = 'ProjectStudent'; |
|
| 1300 | + } else { |
|
| 1301 | + $config['ToolbarSet'] = 'Project'; |
|
| 1302 | + } |
|
| 1303 | + $form->addHtmlEditor('full_text', get_lang('Content'), false, false, $config); |
|
| 1304 | + $form->addFile('user_upload', get_lang('AddAnAttachment')); |
|
| 1305 | + $form->addTextarea('post_file_comment', get_lang('FileComment')); |
|
| 1306 | + $form->addHidden('new_post_submit', 'true'); |
|
| 1307 | + $form->addButton('save', get_lang('Save')); |
|
| 1308 | + |
|
| 1309 | + $form->display(); |
|
| 1310 | + } else { |
|
| 1311 | + api_not_allowed(); |
|
| 1312 | + } |
|
| 1313 | + } |
|
| 1314 | + |
|
| 1315 | + /** |
|
| 1316 | + * Displays the form to edit a post |
|
| 1317 | + * @author Toon Keppens |
|
| 1318 | + * |
|
| 1319 | + * @param Integer $blog_id |
|
| 1320 | + */ |
|
| 1321 | + public static function display_form_edit_post($blog_id, $post_id) |
|
| 1322 | + { |
|
| 1323 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 1324 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1325 | + |
|
| 1326 | + $course_id = api_get_course_int_id(); |
|
| 1327 | + |
|
| 1328 | + // Get posts and author |
|
| 1329 | + $sql = "SELECT post.*, user.lastname, user.firstname |
|
| 1331 | 1330 | FROM $tbl_blogs_posts post |
| 1332 | 1331 | INNER JOIN $tbl_users user ON post.author_id = user.user_id |
| 1333 | 1332 | WHERE |
@@ -1335,74 +1334,74 @@ discard block |
||
| 1335 | 1334 | post.blog_id = '".(int)$blog_id ."' |
| 1336 | 1335 | AND post.post_id = '".(int)$post_id."' |
| 1337 | 1336 | ORDER BY post_id DESC"; |
| 1338 | - $result = Database::query($sql); |
|
| 1339 | - $blog_post = Database::fetch_array($result); |
|
| 1340 | - |
|
| 1341 | - // Form |
|
| 1342 | - $form = new FormValidator( |
|
| 1343 | - 'edit_post', |
|
| 1344 | - 'post', |
|
| 1345 | - api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id=' . intval($_GET['post_id']) . '&blog_id=' . intval($blog_id) . '&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id']) |
|
| 1346 | - ); |
|
| 1347 | - |
|
| 1348 | - $form->addHeader(get_lang('EditPost')); |
|
| 1349 | - $form->addText('title', get_lang('Title')); |
|
| 1350 | - |
|
| 1351 | - if (!api_is_allowed_to_edit()) { |
|
| 1352 | - $config['ToolbarSet'] = 'ProjectStudent'; |
|
| 1353 | - } else { |
|
| 1354 | - $config['ToolbarSet'] = 'Project'; |
|
| 1355 | - } |
|
| 1356 | - $form->addHtmlEditor('full_text', get_lang('Content'), false, false, $config); |
|
| 1357 | - |
|
| 1358 | - $form->addHidden('action', ''); |
|
| 1359 | - $form->addHidden('edit_post_submit', 'true'); |
|
| 1360 | - $form->addHidden('post_id', intval($_GET['post_id'])); |
|
| 1361 | - $form->addButton('save', get_lang('Save')); |
|
| 1362 | - $form->setDefaults($blog_post); |
|
| 1363 | - $form->display(); |
|
| 1364 | - } |
|
| 1365 | - |
|
| 1366 | - /** |
|
| 1367 | - * Displays a list of tasks in this blog |
|
| 1368 | - * @author Toon Keppens |
|
| 1369 | - * |
|
| 1370 | - * @param Integer $blog_id |
|
| 1371 | - */ |
|
| 1372 | - public static function display_task_list($blog_id) |
|
| 1337 | + $result = Database::query($sql); |
|
| 1338 | + $blog_post = Database::fetch_array($result); |
|
| 1339 | + |
|
| 1340 | + // Form |
|
| 1341 | + $form = new FormValidator( |
|
| 1342 | + 'edit_post', |
|
| 1343 | + 'post', |
|
| 1344 | + api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id=' . intval($_GET['post_id']) . '&blog_id=' . intval($blog_id) . '&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id']) |
|
| 1345 | + ); |
|
| 1346 | + |
|
| 1347 | + $form->addHeader(get_lang('EditPost')); |
|
| 1348 | + $form->addText('title', get_lang('Title')); |
|
| 1349 | + |
|
| 1350 | + if (!api_is_allowed_to_edit()) { |
|
| 1351 | + $config['ToolbarSet'] = 'ProjectStudent'; |
|
| 1352 | + } else { |
|
| 1353 | + $config['ToolbarSet'] = 'Project'; |
|
| 1354 | + } |
|
| 1355 | + $form->addHtmlEditor('full_text', get_lang('Content'), false, false, $config); |
|
| 1356 | + |
|
| 1357 | + $form->addHidden('action', ''); |
|
| 1358 | + $form->addHidden('edit_post_submit', 'true'); |
|
| 1359 | + $form->addHidden('post_id', intval($_GET['post_id'])); |
|
| 1360 | + $form->addButton('save', get_lang('Save')); |
|
| 1361 | + $form->setDefaults($blog_post); |
|
| 1362 | + $form->display(); |
|
| 1363 | + } |
|
| 1364 | + |
|
| 1365 | + /** |
|
| 1366 | + * Displays a list of tasks in this blog |
|
| 1367 | + * @author Toon Keppens |
|
| 1368 | + * |
|
| 1369 | + * @param Integer $blog_id |
|
| 1370 | + */ |
|
| 1371 | + public static function display_task_list($blog_id) |
|
| 1373 | 1372 | { |
| 1374 | - global $charset; |
|
| 1373 | + global $charset; |
|
| 1375 | 1374 | $course_id = api_get_course_int_id(); |
| 1376 | 1375 | |
| 1377 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
| 1378 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1379 | - $counter = 0; |
|
| 1380 | - global $color2; |
|
| 1376 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
| 1377 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1378 | + $counter = 0; |
|
| 1379 | + global $color2; |
|
| 1381 | 1380 | |
| 1382 | - echo '<div class="actions">'; |
|
| 1383 | - echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=add">'; |
|
| 1381 | + echo '<div class="actions">'; |
|
| 1382 | + echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=add">'; |
|
| 1384 | 1383 | echo Display::return_icon('blog_newtasks.gif', get_lang('AddTasks')); |
| 1385 | 1384 | echo get_lang('AddTasks') . '</a> '; |
| 1386 | - echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=assign">'; |
|
| 1385 | + echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=assign">'; |
|
| 1387 | 1386 | echo Display::return_icon('blog_task.gif', get_lang('AssignTasks')); |
| 1388 | 1387 | echo get_lang('AssignTasks') . '</a>'; |
| 1389 | - ?> |
|
| 1388 | + ?> |
|
| 1390 | 1389 | <a href="<?php echo api_get_self(); ?>?action=manage_rights&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageRights') ?>"> |
| 1391 | 1390 | <?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'),'',ICON_SIZE_SMALL). get_lang('RightsManager') ?></a> |
| 1392 | 1391 | <?php |
| 1393 | - echo '</div>'; |
|
| 1392 | + echo '</div>'; |
|
| 1394 | 1393 | |
| 1395 | - echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />'; |
|
| 1396 | - echo "<table class=\"data_table\">"; |
|
| 1397 | - echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
|
| 1398 | - "<th width='240'><b>",get_lang('Title'),"</b></th>\n", |
|
| 1399 | - "<th><b>",get_lang('Description'),"</b></th>\n", |
|
| 1400 | - "<th><b>",get_lang('Color'),"</b></th>\n", |
|
| 1401 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>\n", |
|
| 1402 | - "</tr>\n"; |
|
| 1394 | + echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />'; |
|
| 1395 | + echo "<table class=\"data_table\">"; |
|
| 1396 | + echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
|
| 1397 | + "<th width='240'><b>",get_lang('Title'),"</b></th>\n", |
|
| 1398 | + "<th><b>",get_lang('Description'),"</b></th>\n", |
|
| 1399 | + "<th><b>",get_lang('Color'),"</b></th>\n", |
|
| 1400 | + "<th width='50'><b>",get_lang('Modify'),"</b></th>\n", |
|
| 1401 | + "</tr>\n"; |
|
| 1403 | 1402 | |
| 1404 | 1403 | |
| 1405 | - $sql = " SELECT |
|
| 1404 | + $sql = " SELECT |
|
| 1406 | 1405 | blog_id, |
| 1407 | 1406 | task_id, |
| 1408 | 1407 | blog_id, |
@@ -1413,22 +1412,22 @@ discard block |
||
| 1413 | 1412 | FROM " . $tbl_blogs_tasks . " |
| 1414 | 1413 | WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . " |
| 1415 | 1414 | ORDER BY system_task, title"; |
| 1416 | - $result = Database::query($sql); |
|
| 1417 | - |
|
| 1418 | - |
|
| 1419 | - while($task = Database::fetch_array($result)) { |
|
| 1420 | - $counter++; |
|
| 1421 | - $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even"; |
|
| 1422 | - $delete_icon = ($task['system_task'] == '1') ? "delete_na.gif" : "delete.gif"; |
|
| 1423 | - $delete_title = ($task['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
|
| 1424 | - $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=delete&task_id=' . $task['task_id']; |
|
| 1425 | - $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
| 1426 | - |
|
| 1427 | - echo '<tr class="' . $css_class . '" valign="top">', |
|
| 1428 | - '<td width="240">' . Security::remove_XSS($task['title']) . '</td>', |
|
| 1429 | - '<td>' . Security::remove_XSS($task['description']) . '</td>', |
|
| 1430 | - '<td><span style="background-color: #' . $task['color'] . '"> </span></td>', |
|
| 1431 | - '<td width="50">', |
|
| 1415 | + $result = Database::query($sql); |
|
| 1416 | + |
|
| 1417 | + |
|
| 1418 | + while($task = Database::fetch_array($result)) { |
|
| 1419 | + $counter++; |
|
| 1420 | + $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even"; |
|
| 1421 | + $delete_icon = ($task['system_task'] == '1') ? "delete_na.gif" : "delete.gif"; |
|
| 1422 | + $delete_title = ($task['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
|
| 1423 | + $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=delete&task_id=' . $task['task_id']; |
|
| 1424 | + $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
| 1425 | + |
|
| 1426 | + echo '<tr class="' . $css_class . '" valign="top">', |
|
| 1427 | + '<td width="240">' . Security::remove_XSS($task['title']) . '</td>', |
|
| 1428 | + '<td>' . Security::remove_XSS($task['description']) . '</td>', |
|
| 1429 | + '<td><span style="background-color: #' . $task['color'] . '"> </span></td>', |
|
| 1430 | + '<td width="50">', |
|
| 1432 | 1431 | '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=edit&task_id=' . $task['task_id'] . '">', |
| 1433 | 1432 | '<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />', |
| 1434 | 1433 | "</a>\n", |
@@ -1436,41 +1435,41 @@ discard block |
||
| 1436 | 1435 | $delete_confirm, |
| 1437 | 1436 | '><img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />', |
| 1438 | 1437 | "</a>\n", |
| 1439 | - '</td>', |
|
| 1438 | + '</td>', |
|
| 1440 | 1439 | '</tr>'; |
| 1441 | - } |
|
| 1442 | - echo "</table>"; |
|
| 1443 | - } |
|
| 1444 | - } |
|
| 1445 | - |
|
| 1446 | - /** |
|
| 1447 | - * Displays a list of tasks assigned to a user in this blog |
|
| 1448 | - * @author Toon Keppens |
|
| 1449 | - * |
|
| 1450 | - * @param Integer $blog_id |
|
| 1451 | - */ |
|
| 1452 | - public static function display_assigned_task_list ($blog_id) |
|
| 1440 | + } |
|
| 1441 | + echo "</table>"; |
|
| 1442 | + } |
|
| 1443 | + } |
|
| 1444 | + |
|
| 1445 | + /** |
|
| 1446 | + * Displays a list of tasks assigned to a user in this blog |
|
| 1447 | + * @author Toon Keppens |
|
| 1448 | + * |
|
| 1449 | + * @param Integer $blog_id |
|
| 1450 | + */ |
|
| 1451 | + public static function display_assigned_task_list ($blog_id) |
|
| 1453 | 1452 | { |
| 1454 | - // Init |
|
| 1455 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1456 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1457 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1458 | - $counter = 0; |
|
| 1459 | - global $charset,$color2; |
|
| 1460 | - |
|
| 1461 | - echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />'; |
|
| 1462 | - echo "<table class=\"data_table\">"; |
|
| 1463 | - echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
|
| 1464 | - "<th width='240'><b>",get_lang('Member'),"</b></th>\n", |
|
| 1465 | - "<th><b>",get_lang('Task'),"</b></th>\n", |
|
| 1466 | - "<th><b>",get_lang('Description'),"</b></th>\n", |
|
| 1467 | - "<th><b>",get_lang('TargetDate'),"</b></th>\n", |
|
| 1468 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>\n", |
|
| 1469 | - "</tr>"; |
|
| 1470 | - |
|
| 1471 | - $course_id = api_get_course_int_id(); |
|
| 1472 | - |
|
| 1473 | - $sql = "SELECT task_rel_user.*, task.title, user.firstname, user.lastname, user.username, task.description, task.system_task, task.blog_id, task.task_id |
|
| 1453 | + // Init |
|
| 1454 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1455 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1456 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1457 | + $counter = 0; |
|
| 1458 | + global $charset,$color2; |
|
| 1459 | + |
|
| 1460 | + echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />'; |
|
| 1461 | + echo "<table class=\"data_table\">"; |
|
| 1462 | + echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
|
| 1463 | + "<th width='240'><b>",get_lang('Member'),"</b></th>\n", |
|
| 1464 | + "<th><b>",get_lang('Task'),"</b></th>\n", |
|
| 1465 | + "<th><b>",get_lang('Description'),"</b></th>\n", |
|
| 1466 | + "<th><b>",get_lang('TargetDate'),"</b></th>\n", |
|
| 1467 | + "<th width='50'><b>",get_lang('Modify'),"</b></th>\n", |
|
| 1468 | + "</tr>"; |
|
| 1469 | + |
|
| 1470 | + $course_id = api_get_course_int_id(); |
|
| 1471 | + |
|
| 1472 | + $sql = "SELECT task_rel_user.*, task.title, user.firstname, user.lastname, user.username, task.description, task.system_task, task.blog_id, task.task_id |
|
| 1474 | 1473 | FROM $tbl_blogs_tasks_rel_user task_rel_user |
| 1475 | 1474 | INNER JOIN $tbl_blogs_tasks task ON task_rel_user.task_id = task.task_id |
| 1476 | 1475 | INNER JOIN $tbl_users user ON task_rel_user.user_id = user.user_id |
@@ -1479,45 +1478,45 @@ discard block |
||
| 1479 | 1478 | task.c_id = $course_id AND |
| 1480 | 1479 | task_rel_user.blog_id = '".(int)$blog_id."' |
| 1481 | 1480 | ORDER BY target_date ASC"; |
| 1482 | - $result = Database::query($sql); |
|
| 1481 | + $result = Database::query($sql); |
|
| 1483 | 1482 | |
| 1484 | - while ($assignment = Database::fetch_array($result)) { |
|
| 1485 | - $counter++; |
|
| 1486 | - $css_class = (($counter % 2)==0) ? "row_odd" : "row_even"; |
|
| 1487 | - $delete_icon = ($assignment['system_task'] == '1') ? "delete_na.gif" : "delete.gif"; |
|
| 1488 | - $delete_title = ($assignment['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
|
| 1489 | - $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete&task_id=' . $assignment['task_id']; |
|
| 1490 | - $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
| 1483 | + while ($assignment = Database::fetch_array($result)) { |
|
| 1484 | + $counter++; |
|
| 1485 | + $css_class = (($counter % 2)==0) ? "row_odd" : "row_even"; |
|
| 1486 | + $delete_icon = ($assignment['system_task'] == '1') ? "delete_na.gif" : "delete.gif"; |
|
| 1487 | + $delete_title = ($assignment['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
|
| 1488 | + $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete&task_id=' . $assignment['task_id']; |
|
| 1489 | + $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
| 1491 | 1490 | |
| 1492 | 1491 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $assignment['username']), ENT_QUOTES); |
| 1493 | 1492 | |
| 1494 | - echo '<tr class="' . $css_class . '" valign="top">', |
|
| 1495 | - '<td width="240">' . Display::tag('span', api_get_person_name($assignment['firstname'], $assignment['lastname']), array('title'=>$username)) . '</td>', |
|
| 1496 | - '<td>'.stripslashes($assignment['title']) . '</td>', |
|
| 1497 | - '<td>'.stripslashes($assignment['description']) . '</td>', |
|
| 1498 | - '<td>' . $assignment['target_date'] . '</td>', |
|
| 1499 | - '<td width="50">', |
|
| 1500 | - '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=edit_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '">', |
|
| 1501 | - '<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />', |
|
| 1502 | - "</a>\n", |
|
| 1503 | - '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '" ', |
|
| 1504 | - 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"', |
|
| 1505 | - '<img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />', |
|
| 1506 | - "</a>\n", |
|
| 1507 | - '</td>', |
|
| 1508 | - '</tr>'; |
|
| 1509 | - } |
|
| 1510 | - echo "</table>"; |
|
| 1511 | - } |
|
| 1512 | - |
|
| 1513 | - /** |
|
| 1514 | - * Displays new task form |
|
| 1515 | - * @author Toon Keppens |
|
| 1516 | - * |
|
| 1517 | - */ |
|
| 1518 | - public static function display_new_task_form ($blog_id) |
|
| 1519 | - { |
|
| 1520 | - // Init |
|
| 1493 | + echo '<tr class="' . $css_class . '" valign="top">', |
|
| 1494 | + '<td width="240">' . Display::tag('span', api_get_person_name($assignment['firstname'], $assignment['lastname']), array('title'=>$username)) . '</td>', |
|
| 1495 | + '<td>'.stripslashes($assignment['title']) . '</td>', |
|
| 1496 | + '<td>'.stripslashes($assignment['description']) . '</td>', |
|
| 1497 | + '<td>' . $assignment['target_date'] . '</td>', |
|
| 1498 | + '<td width="50">', |
|
| 1499 | + '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=edit_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '">', |
|
| 1500 | + '<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />', |
|
| 1501 | + "</a>\n", |
|
| 1502 | + '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '" ', |
|
| 1503 | + 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"', |
|
| 1504 | + '<img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />', |
|
| 1505 | + "</a>\n", |
|
| 1506 | + '</td>', |
|
| 1507 | + '</tr>'; |
|
| 1508 | + } |
|
| 1509 | + echo "</table>"; |
|
| 1510 | + } |
|
| 1511 | + |
|
| 1512 | + /** |
|
| 1513 | + * Displays new task form |
|
| 1514 | + * @author Toon Keppens |
|
| 1515 | + * |
|
| 1516 | + */ |
|
| 1517 | + public static function display_new_task_form ($blog_id) |
|
| 1518 | + { |
|
| 1519 | + // Init |
|
| 1521 | 1520 | $colors = array( |
| 1522 | 1521 | 'FFFFFF', |
| 1523 | 1522 | 'FFFF99', |
@@ -1536,14 +1535,14 @@ discard block |
||
| 1536 | 1535 | '000000' |
| 1537 | 1536 | ); |
| 1538 | 1537 | |
| 1539 | - // form |
|
| 1540 | - echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">'; |
|
| 1538 | + // form |
|
| 1539 | + echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">'; |
|
| 1541 | 1540 | |
| 1542 | - // form title |
|
| 1543 | - echo '<legend>'.get_lang('AddTask').'</legend>'; |
|
| 1541 | + // form title |
|
| 1542 | + echo '<legend>'.get_lang('AddTask').'</legend>'; |
|
| 1544 | 1543 | |
| 1545 | - // task title |
|
| 1546 | - echo ' <div class="control-group"> |
|
| 1544 | + // task title |
|
| 1545 | + echo ' <div class="control-group"> |
|
| 1547 | 1546 | <label class="control-label"> |
| 1548 | 1547 | <span class="form_required">*</span>' . get_lang('Title') . ' |
| 1549 | 1548 | </label> |
@@ -1552,8 +1551,8 @@ discard block |
||
| 1552 | 1551 | </div> |
| 1553 | 1552 | </div>'; |
| 1554 | 1553 | |
| 1555 | - // task comment |
|
| 1556 | - echo ' <div class="control-group"> |
|
| 1554 | + // task comment |
|
| 1555 | + echo ' <div class="control-group"> |
|
| 1557 | 1556 | <label class="control-label"> |
| 1558 | 1557 | ' . get_lang('Description') . ' |
| 1559 | 1558 | </label> |
@@ -1562,8 +1561,8 @@ discard block |
||
| 1562 | 1561 | </div> |
| 1563 | 1562 | </div>'; |
| 1564 | 1563 | |
| 1565 | - // task management |
|
| 1566 | - echo ' <div class="control-group"> |
|
| 1564 | + // task management |
|
| 1565 | + echo ' <div class="control-group"> |
|
| 1567 | 1566 | <label class="control-label"> |
| 1568 | 1567 | ' . get_lang('TaskManager') . ' |
| 1569 | 1568 | </label> |
@@ -1584,12 +1583,12 @@ discard block |
||
| 1584 | 1583 | echo '<td style="border:1px dotted #808080; text-align:center;"><input id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>'; |
| 1585 | 1584 | echo '</tr>'; |
| 1586 | 1585 | echo '</table>'; |
| 1587 | - echo ' </div> |
|
| 1586 | + echo ' </div> |
|
| 1588 | 1587 | </div>'; |
| 1589 | 1588 | |
| 1590 | 1589 | |
| 1591 | - // task color |
|
| 1592 | - echo ' <div class="control-group"> |
|
| 1590 | + // task color |
|
| 1591 | + echo ' <div class="control-group"> |
|
| 1593 | 1592 | <label class="control-label"> |
| 1594 | 1593 | ' . get_lang('Color') . ' |
| 1595 | 1594 | </label> |
@@ -1600,40 +1599,40 @@ discard block |
||
| 1600 | 1599 | echo '<option value="' . $color . '" ' . $style . '> </option>'; |
| 1601 | 1600 | } |
| 1602 | 1601 | echo '</select>'; |
| 1603 | - echo ' </div> |
|
| 1602 | + echo ' </div> |
|
| 1604 | 1603 | </div>'; |
| 1605 | 1604 | |
| 1606 | - // submit |
|
| 1607 | - echo ' <div class="control-group"> |
|
| 1605 | + // submit |
|
| 1606 | + echo ' <div class="control-group"> |
|
| 1608 | 1607 | <div class="controls"> |
| 1609 | 1608 | <input type="hidden" name="action" value="" /> |
| 1610 | 1609 | <input type="hidden" name="new_task_submit" value="true" /> |
| 1611 | 1610 | <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button> |
| 1612 | 1611 | </div> |
| 1613 | 1612 | </div>'; |
| 1614 | - echo '</form>'; |
|
| 1613 | + echo '</form>'; |
|
| 1615 | 1614 | |
| 1616 | - echo '<div style="clear:both; margin-bottom: 10px;"></div>'; |
|
| 1617 | - } |
|
| 1615 | + echo '<div style="clear:both; margin-bottom: 10px;"></div>'; |
|
| 1616 | + } |
|
| 1618 | 1617 | |
| 1619 | 1618 | |
| 1620 | - /** |
|
| 1621 | - * Displays edit task form |
|
| 1622 | - * @author Toon Keppens |
|
| 1623 | - * |
|
| 1624 | - */ |
|
| 1625 | - public static function display_edit_task_form ($blog_id, $task_id) { |
|
| 1626 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1619 | + /** |
|
| 1620 | + * Displays edit task form |
|
| 1621 | + * @author Toon Keppens |
|
| 1622 | + * |
|
| 1623 | + */ |
|
| 1624 | + public static function display_edit_task_form ($blog_id, $task_id) { |
|
| 1625 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1627 | 1626 | $course_id = api_get_course_int_id(); |
| 1628 | 1627 | |
| 1629 | - $colors = array('FFFFFF','FFFF99','FFCC99','FF9933','FF6699','CCFF99','CC9966','66FF00', '9966FF', 'CF3F3F', '990033','669933','0033FF','003366','000000'); |
|
| 1628 | + $colors = array('FFFFFF','FFFF99','FFCC99','FF9933','FF6699','CCFF99','CC9966','66FF00', '9966FF', 'CF3F3F', '990033','669933','0033FF','003366','000000'); |
|
| 1630 | 1629 | |
| 1631 | - $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int)$task_id."'"; |
|
| 1632 | - $result = Database::query($sql); |
|
| 1633 | - $task = Database::fetch_array($result); |
|
| 1630 | + $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int)$task_id."'"; |
|
| 1631 | + $result = Database::query($sql); |
|
| 1632 | + $task = Database::fetch_array($result); |
|
| 1634 | 1633 | |
| 1635 | - // Display |
|
| 1636 | - echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '"> |
|
| 1634 | + // Display |
|
| 1635 | + echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '"> |
|
| 1637 | 1636 | <legend>' . get_lang('EditTask') . '</legend> |
| 1638 | 1637 | <table width="100%" border="0" cellspacing="2"> |
| 1639 | 1638 | <tr> |
@@ -1645,42 +1644,42 @@ discard block |
||
| 1645 | 1644 | <td><textarea name="task_description" cols="45">'.Security::remove_XSS($task['description']).'</textarea></td> |
| 1646 | 1645 | </tr>'; |
| 1647 | 1646 | |
| 1648 | - /* edit by Kevin Van Den Haute ([email protected]) */ |
|
| 1649 | - $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 1647 | + /* edit by Kevin Van Den Haute ([email protected]) */ |
|
| 1648 | + $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
| 1650 | 1649 | |
| 1651 | - $sql = " SELECT id, action FROM " . $tbl_tasks_permissions . " |
|
| 1650 | + $sql = " SELECT id, action FROM " . $tbl_tasks_permissions . " |
|
| 1652 | 1651 | WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'"; |
| 1653 | - $result = Database::query($sql); |
|
| 1654 | - |
|
| 1655 | - $arrPermissions = array(); |
|
| 1656 | - |
|
| 1657 | - while ($row = Database::fetch_array($result)) |
|
| 1658 | - $arrPermissions[] = $row['action']; |
|
| 1659 | - |
|
| 1660 | - echo '<tr>'; |
|
| 1661 | - echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ': </td>'; |
|
| 1662 | - echo '<td>'; |
|
| 1663 | - echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">'; |
|
| 1664 | - echo '<tr>'; |
|
| 1665 | - echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>'; |
|
| 1666 | - echo '<th width:223px;>' . get_lang('CommentManager') . '</th>'; |
|
| 1667 | - echo '</tr>'; |
|
| 1668 | - echo '<tr>'; |
|
| 1669 | - echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1670 | - echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>'; |
|
| 1671 | - echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1672 | - echo '</tr>'; |
|
| 1673 | - echo '<tr>'; |
|
| 1674 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_delete', $arrPermissions)) ? 'checked ' : '') . 'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
|
| 1675 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_edit', $arrPermissions)) ? 'checked ' : '') . 'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>'; |
|
| 1676 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '') . 'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>'; |
|
| 1677 | - echo '</tr>'; |
|
| 1678 | - echo '</table>'; |
|
| 1679 | - echo '</td>'; |
|
| 1680 | - echo '</tr>'; |
|
| 1681 | - /* end of edit */ |
|
| 1682 | - |
|
| 1683 | - echo '<tr> |
|
| 1652 | + $result = Database::query($sql); |
|
| 1653 | + |
|
| 1654 | + $arrPermissions = array(); |
|
| 1655 | + |
|
| 1656 | + while ($row = Database::fetch_array($result)) |
|
| 1657 | + $arrPermissions[] = $row['action']; |
|
| 1658 | + |
|
| 1659 | + echo '<tr>'; |
|
| 1660 | + echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ': </td>'; |
|
| 1661 | + echo '<td>'; |
|
| 1662 | + echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">'; |
|
| 1663 | + echo '<tr>'; |
|
| 1664 | + echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>'; |
|
| 1665 | + echo '<th width:223px;>' . get_lang('CommentManager') . '</th>'; |
|
| 1666 | + echo '</tr>'; |
|
| 1667 | + echo '<tr>'; |
|
| 1668 | + echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1669 | + echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>'; |
|
| 1670 | + echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1671 | + echo '</tr>'; |
|
| 1672 | + echo '<tr>'; |
|
| 1673 | + echo '<td style="text-align:center;"><input ' . ((in_array('article_delete', $arrPermissions)) ? 'checked ' : '') . 'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
|
| 1674 | + echo '<td style="text-align:center;"><input ' . ((in_array('article_edit', $arrPermissions)) ? 'checked ' : '') . 'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>'; |
|
| 1675 | + echo '<td style="text-align:center;"><input ' . ((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '') . 'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>'; |
|
| 1676 | + echo '</tr>'; |
|
| 1677 | + echo '</table>'; |
|
| 1678 | + echo '</td>'; |
|
| 1679 | + echo '</tr>'; |
|
| 1680 | + /* end of edit */ |
|
| 1681 | + |
|
| 1682 | + echo '<tr> |
|
| 1684 | 1683 | <td align="right">' . get_lang('Color') . ': </td> |
| 1685 | 1684 | <td> |
| 1686 | 1685 | <select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'] . '" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">'; |
@@ -1689,7 +1688,7 @@ discard block |
||
| 1689 | 1688 | $style = 'style="background-color: #' . $color . '"'; |
| 1690 | 1689 | echo '<option value="' . $color . '" ' . $style . ' ' . $selected . ' > </option>'; |
| 1691 | 1690 | } |
| 1692 | - echo ' </select> |
|
| 1691 | + echo ' </select> |
|
| 1693 | 1692 | </td> |
| 1694 | 1693 | </tr> |
| 1695 | 1694 | <tr> |
@@ -1702,34 +1701,34 @@ discard block |
||
| 1702 | 1701 | </tr> |
| 1703 | 1702 | </table> |
| 1704 | 1703 | </form>'; |
| 1705 | - } |
|
| 1706 | - |
|
| 1707 | - /** |
|
| 1708 | - * @param $blog_id |
|
| 1709 | - * @return FormValidator |
|
| 1710 | - */ |
|
| 1711 | - public static function getTaskForm($blog_id) |
|
| 1712 | - { |
|
| 1713 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1714 | - $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 1715 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1716 | - $course_id = api_get_course_int_id(); |
|
| 1717 | - |
|
| 1718 | - // Get users in this blog / make select list of it |
|
| 1719 | - $sql = "SELECT user.user_id, user.firstname, user.lastname, user.username |
|
| 1704 | + } |
|
| 1705 | + |
|
| 1706 | + /** |
|
| 1707 | + * @param $blog_id |
|
| 1708 | + * @return FormValidator |
|
| 1709 | + */ |
|
| 1710 | + public static function getTaskForm($blog_id) |
|
| 1711 | + { |
|
| 1712 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1713 | + $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 1714 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1715 | + $course_id = api_get_course_int_id(); |
|
| 1716 | + |
|
| 1717 | + // Get users in this blog / make select list of it |
|
| 1718 | + $sql = "SELECT user.user_id, user.firstname, user.lastname, user.username |
|
| 1720 | 1719 | FROM $tbl_users user |
| 1721 | 1720 | INNER JOIN $tbl_blogs_rel_user blogs_rel_user |
| 1722 | 1721 | ON user.user_id = blogs_rel_user.user_id |
| 1723 | 1722 | WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'"; |
| 1724 | - $result = Database::query($sql); |
|
| 1723 | + $result = Database::query($sql); |
|
| 1725 | 1724 | |
| 1726 | - $options = array(); |
|
| 1727 | - while ($user = Database::fetch_array($result)) { |
|
| 1728 | - $options[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); |
|
| 1729 | - } |
|
| 1725 | + $options = array(); |
|
| 1726 | + while ($user = Database::fetch_array($result)) { |
|
| 1727 | + $options[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); |
|
| 1728 | + } |
|
| 1730 | 1729 | |
| 1731 | - // Get tasks in this blog / make select list of it |
|
| 1732 | - $sql = " |
|
| 1730 | + // Get tasks in this blog / make select list of it |
|
| 1731 | + $sql = " |
|
| 1733 | 1732 | SELECT |
| 1734 | 1733 | blog_id, |
| 1735 | 1734 | task_id, |
@@ -1741,97 +1740,97 @@ discard block |
||
| 1741 | 1740 | FROM $tbl_blogs_tasks |
| 1742 | 1741 | WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . " |
| 1743 | 1742 | ORDER BY system_task, title"; |
| 1744 | - $result = Database::query($sql); |
|
| 1745 | - |
|
| 1746 | - $taskOptions = array(); |
|
| 1747 | - while ($task = Database::fetch_array($result)) { |
|
| 1748 | - $taskOptions[$task['task_id']] = stripslashes($task['title']); |
|
| 1749 | - } |
|
| 1750 | - |
|
| 1751 | - $form = new FormValidator( |
|
| 1752 | - 'assign_task', |
|
| 1753 | - 'post', |
|
| 1754 | - api_get_path( |
|
| 1755 | - WEB_CODE_PATH |
|
| 1756 | - ).'blog/blog.php?action=manage_tasks&blog_id='.$blog_id |
|
| 1757 | - ); |
|
| 1758 | - |
|
| 1759 | - $form->addHeader(get_lang('AssignTask')); |
|
| 1760 | - $form->addSelect('task_user_id', get_lang('SelectUser'), $options); |
|
| 1761 | - $form->addSelect('task_task_id', get_lang('SelectTask'), $taskOptions); |
|
| 1762 | - $form->addDatePicker('task_day', get_lang('SelectTargetDate')); |
|
| 1763 | - |
|
| 1764 | - $form->addHidden('action', ''); |
|
| 1765 | - $form->addButtonSave(get_lang('Ok')); |
|
| 1766 | - |
|
| 1767 | - return $form; |
|
| 1768 | - } |
|
| 1769 | - |
|
| 1770 | - /** |
|
| 1771 | - * Displays assign task form |
|
| 1772 | - * @author Toon Keppens |
|
| 1773 | - * |
|
| 1774 | - */ |
|
| 1775 | - public static function display_assign_task_form($blog_id) |
|
| 1776 | - { |
|
| 1777 | - $form = self::getTaskForm($blog_id); |
|
| 1778 | - $form->addHidden('assign_task_submit', 'true'); |
|
| 1779 | - $form->display(); |
|
| 1780 | - echo '<div style="clear: both; margin-bottom:10px;"></div>'; |
|
| 1781 | - } |
|
| 1782 | - |
|
| 1783 | - /** |
|
| 1784 | - * Displays assign task form |
|
| 1785 | - * @author Toon Keppens |
|
| 1786 | - * |
|
| 1787 | - */ |
|
| 1788 | - public static function display_edit_assigned_task_form($blog_id, $task_id, $user_id) |
|
| 1789 | - { |
|
| 1790 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1791 | - |
|
| 1792 | - $course_id = api_get_course_int_id(); |
|
| 1793 | - |
|
| 1794 | - // Get assignd date; |
|
| 1795 | - $sql = " |
|
| 1743 | + $result = Database::query($sql); |
|
| 1744 | + |
|
| 1745 | + $taskOptions = array(); |
|
| 1746 | + while ($task = Database::fetch_array($result)) { |
|
| 1747 | + $taskOptions[$task['task_id']] = stripslashes($task['title']); |
|
| 1748 | + } |
|
| 1749 | + |
|
| 1750 | + $form = new FormValidator( |
|
| 1751 | + 'assign_task', |
|
| 1752 | + 'post', |
|
| 1753 | + api_get_path( |
|
| 1754 | + WEB_CODE_PATH |
|
| 1755 | + ).'blog/blog.php?action=manage_tasks&blog_id='.$blog_id |
|
| 1756 | + ); |
|
| 1757 | + |
|
| 1758 | + $form->addHeader(get_lang('AssignTask')); |
|
| 1759 | + $form->addSelect('task_user_id', get_lang('SelectUser'), $options); |
|
| 1760 | + $form->addSelect('task_task_id', get_lang('SelectTask'), $taskOptions); |
|
| 1761 | + $form->addDatePicker('task_day', get_lang('SelectTargetDate')); |
|
| 1762 | + |
|
| 1763 | + $form->addHidden('action', ''); |
|
| 1764 | + $form->addButtonSave(get_lang('Ok')); |
|
| 1765 | + |
|
| 1766 | + return $form; |
|
| 1767 | + } |
|
| 1768 | + |
|
| 1769 | + /** |
|
| 1770 | + * Displays assign task form |
|
| 1771 | + * @author Toon Keppens |
|
| 1772 | + * |
|
| 1773 | + */ |
|
| 1774 | + public static function display_assign_task_form($blog_id) |
|
| 1775 | + { |
|
| 1776 | + $form = self::getTaskForm($blog_id); |
|
| 1777 | + $form->addHidden('assign_task_submit', 'true'); |
|
| 1778 | + $form->display(); |
|
| 1779 | + echo '<div style="clear: both; margin-bottom:10px;"></div>'; |
|
| 1780 | + } |
|
| 1781 | + |
|
| 1782 | + /** |
|
| 1783 | + * Displays assign task form |
|
| 1784 | + * @author Toon Keppens |
|
| 1785 | + * |
|
| 1786 | + */ |
|
| 1787 | + public static function display_edit_assigned_task_form($blog_id, $task_id, $user_id) |
|
| 1788 | + { |
|
| 1789 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1790 | + |
|
| 1791 | + $course_id = api_get_course_int_id(); |
|
| 1792 | + |
|
| 1793 | + // Get assignd date; |
|
| 1794 | + $sql = " |
|
| 1796 | 1795 | SELECT target_date |
| 1797 | 1796 | FROM $tbl_blogs_tasks_rel_user |
| 1798 | 1797 | WHERE c_id = $course_id AND |
| 1799 | 1798 | blog_id = '".(int)$blog_id."' AND |
| 1800 | 1799 | user_id = '".(int)$user_id."' AND |
| 1801 | 1800 | task_id = '".(int)$task_id."'"; |
| 1802 | - $result = Database::query($sql); |
|
| 1803 | - $row = Database::fetch_assoc($result); |
|
| 1804 | - |
|
| 1805 | - $date = $row['target_date']; |
|
| 1806 | - |
|
| 1807 | - $defaults = [ |
|
| 1808 | - 'task_user_id' => $user_id, |
|
| 1809 | - 'task_task_id' => $task_id, |
|
| 1810 | - 'task_day' => $date |
|
| 1811 | - ]; |
|
| 1812 | - $form = self::getTaskForm($blog_id); |
|
| 1813 | - $form->addHidden('old_task_id', $task_id); |
|
| 1814 | - $form->addHidden('old_user_id', $user_id); |
|
| 1815 | - $form->addHidden('old_target_date', $date); |
|
| 1816 | - $form->addHidden('assign_task_edit_submit', 'true'); |
|
| 1817 | - $form->setDefaults($defaults); |
|
| 1818 | - $form->display(); |
|
| 1819 | - } |
|
| 1820 | - |
|
| 1821 | - /** |
|
| 1822 | - * Assigns a task to a user in a blog |
|
| 1823 | - * |
|
| 1824 | - * @param Integer $blog_id |
|
| 1825 | - * @param Integer $user_id |
|
| 1826 | - * @param Integer $task_id |
|
| 1827 | - * @param Date $target_date |
|
| 1828 | - */ |
|
| 1829 | - public static function assign_task($blog_id, $user_id, $task_id, $target_date) |
|
| 1830 | - { |
|
| 1831 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1832 | - $course_id = api_get_course_int_id(); |
|
| 1833 | - |
|
| 1834 | - $sql = " |
|
| 1801 | + $result = Database::query($sql); |
|
| 1802 | + $row = Database::fetch_assoc($result); |
|
| 1803 | + |
|
| 1804 | + $date = $row['target_date']; |
|
| 1805 | + |
|
| 1806 | + $defaults = [ |
|
| 1807 | + 'task_user_id' => $user_id, |
|
| 1808 | + 'task_task_id' => $task_id, |
|
| 1809 | + 'task_day' => $date |
|
| 1810 | + ]; |
|
| 1811 | + $form = self::getTaskForm($blog_id); |
|
| 1812 | + $form->addHidden('old_task_id', $task_id); |
|
| 1813 | + $form->addHidden('old_user_id', $user_id); |
|
| 1814 | + $form->addHidden('old_target_date', $date); |
|
| 1815 | + $form->addHidden('assign_task_edit_submit', 'true'); |
|
| 1816 | + $form->setDefaults($defaults); |
|
| 1817 | + $form->display(); |
|
| 1818 | + } |
|
| 1819 | + |
|
| 1820 | + /** |
|
| 1821 | + * Assigns a task to a user in a blog |
|
| 1822 | + * |
|
| 1823 | + * @param Integer $blog_id |
|
| 1824 | + * @param Integer $user_id |
|
| 1825 | + * @param Integer $task_id |
|
| 1826 | + * @param Date $target_date |
|
| 1827 | + */ |
|
| 1828 | + public static function assign_task($blog_id, $user_id, $task_id, $target_date) |
|
| 1829 | + { |
|
| 1830 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1831 | + $course_id = api_get_course_int_id(); |
|
| 1832 | + |
|
| 1833 | + $sql = " |
|
| 1835 | 1834 | SELECT COUNT(*) as 'number' |
| 1836 | 1835 | FROM " . $tbl_blogs_tasks_rel_user . " |
| 1837 | 1836 | WHERE c_id = $course_id AND |
@@ -1840,11 +1839,11 @@ discard block |
||
| 1840 | 1839 | AND task_id = " . (int)$task_id . " |
| 1841 | 1840 | "; |
| 1842 | 1841 | |
| 1843 | - $result = Database::query($sql); |
|
| 1844 | - $row = Database::fetch_assoc($result); |
|
| 1842 | + $result = Database::query($sql); |
|
| 1843 | + $row = Database::fetch_assoc($result); |
|
| 1845 | 1844 | |
| 1846 | - if ($row['number'] == 0) { |
|
| 1847 | - $sql = " |
|
| 1845 | + if ($row['number'] == 0) { |
|
| 1846 | + $sql = " |
|
| 1848 | 1847 | INSERT INTO " . $tbl_blogs_tasks_rel_user . " ( |
| 1849 | 1848 | c_id, |
| 1850 | 1849 | blog_id, |
@@ -1859,9 +1858,9 @@ discard block |
||
| 1859 | 1858 | '" . Database::escape_string($target_date) . "' |
| 1860 | 1859 | )"; |
| 1861 | 1860 | |
| 1862 | - Database::query($sql); |
|
| 1863 | - } |
|
| 1864 | - } |
|
| 1861 | + Database::query($sql); |
|
| 1862 | + } |
|
| 1863 | + } |
|
| 1865 | 1864 | |
| 1866 | 1865 | /** |
| 1867 | 1866 | * @param $blog_id |
@@ -1881,11 +1880,11 @@ discard block |
||
| 1881 | 1880 | $old_task_id, |
| 1882 | 1881 | $old_target_date |
| 1883 | 1882 | ) { |
| 1884 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1883 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1885 | 1884 | |
| 1886 | - $course_id = api_get_course_int_id(); |
|
| 1885 | + $course_id = api_get_course_int_id(); |
|
| 1887 | 1886 | |
| 1888 | - $sql = "SELECT COUNT(*) as 'number' |
|
| 1887 | + $sql = "SELECT COUNT(*) as 'number' |
|
| 1889 | 1888 | FROM " . $tbl_blogs_tasks_rel_user . " |
| 1890 | 1889 | WHERE |
| 1891 | 1890 | c_id = $course_id AND |
@@ -1894,11 +1893,11 @@ discard block |
||
| 1894 | 1893 | task_id = " . (int)$task_id . " |
| 1895 | 1894 | "; |
| 1896 | 1895 | |
| 1897 | - $result = Database::query($sql); |
|
| 1898 | - $row = Database::fetch_assoc($result); |
|
| 1896 | + $result = Database::query($sql); |
|
| 1897 | + $row = Database::fetch_assoc($result); |
|
| 1899 | 1898 | |
| 1900 | - if ($row['number'] == 0 || ($row['number'] != 0 && $task_id == $old_task_id && $user_id == $old_user_id)) { |
|
| 1901 | - $sql = " |
|
| 1899 | + if ($row['number'] == 0 || ($row['number'] != 0 && $task_id == $old_task_id && $user_id == $old_user_id)) { |
|
| 1900 | + $sql = " |
|
| 1902 | 1901 | UPDATE " . $tbl_blogs_tasks_rel_user . " |
| 1903 | 1902 | SET |
| 1904 | 1903 | user_id = " . (int)$user_id . ", |
@@ -1911,76 +1910,76 @@ discard block |
||
| 1911 | 1910 | task_id = " . (int)$old_task_id . " AND |
| 1912 | 1911 | target_date = '" . Database::escape_string($old_target_date) . "' |
| 1913 | 1912 | "; |
| 1914 | - Database::query($sql); |
|
| 1915 | - } |
|
| 1916 | - } |
|
| 1917 | - |
|
| 1918 | - /** |
|
| 1919 | - * Displays a list with posts a user can select to execute his task. |
|
| 1920 | - * |
|
| 1921 | - * @param Integer $blog_id |
|
| 1922 | - * @param unknown_type $task_id |
|
| 1923 | - */ |
|
| 1924 | - public static function display_select_task_post($blog_id, $task_id) |
|
| 1913 | + Database::query($sql); |
|
| 1914 | + } |
|
| 1915 | + } |
|
| 1916 | + |
|
| 1917 | + /** |
|
| 1918 | + * Displays a list with posts a user can select to execute his task. |
|
| 1919 | + * |
|
| 1920 | + * @param Integer $blog_id |
|
| 1921 | + * @param unknown_type $task_id |
|
| 1922 | + */ |
|
| 1923 | + public static function display_select_task_post($blog_id, $task_id) |
|
| 1925 | 1924 | { |
| 1926 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1927 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 1928 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1929 | - $course_id = api_get_course_int_id(); |
|
| 1925 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 1926 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 1927 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 1928 | + $course_id = api_get_course_int_id(); |
|
| 1930 | 1929 | |
| 1931 | 1930 | |
| 1932 | - $sql = "SELECT title, description FROM $tbl_blogs_tasks |
|
| 1931 | + $sql = "SELECT title, description FROM $tbl_blogs_tasks |
|
| 1933 | 1932 | WHERE task_id = '".(int)$task_id."' |
| 1934 | 1933 | AND c_id = $course_id"; |
| 1935 | - $result = Database::query($sql); |
|
| 1936 | - $row = Database::fetch_assoc($result); |
|
| 1937 | - // Get posts and authors |
|
| 1938 | - $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
|
| 1934 | + $result = Database::query($sql); |
|
| 1935 | + $row = Database::fetch_assoc($result); |
|
| 1936 | + // Get posts and authors |
|
| 1937 | + $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
|
| 1939 | 1938 | FROM $tbl_blogs_posts post |
| 1940 | 1939 | INNER JOIN $tbl_users user ON post.author_id = user.user_id |
| 1941 | 1940 | WHERE post.blog_id = '".(int)$blog_id."' AND post.c_id = $course_id |
| 1942 | 1941 | ORDER BY post_id DESC |
| 1943 | 1942 | LIMIT 0, 100"; |
| 1944 | - $result = Database::query($sql); |
|
| 1943 | + $result = Database::query($sql); |
|
| 1945 | 1944 | |
| 1946 | - // Display |
|
| 1947 | - echo '<span class="blogpost_title">' . get_lang('SelectTaskArticle') . ' "' . stripslashes($row['title']) . '"</span>'; |
|
| 1948 | - echo '<span style="font-style: italic;"">'.stripslashes($row['description']) . '</span><br><br>'; |
|
| 1945 | + // Display |
|
| 1946 | + echo '<span class="blogpost_title">' . get_lang('SelectTaskArticle') . ' "' . stripslashes($row['title']) . '"</span>'; |
|
| 1947 | + echo '<span style="font-style: italic;"">'.stripslashes($row['description']) . '</span><br><br>'; |
|
| 1949 | 1948 | |
| 1950 | - if (Database::num_rows($result) > 0) { |
|
| 1951 | - while($blog_post = Database::fetch_array($result)) { |
|
| 1952 | - $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
|
| 1953 | - echo '<a href="blog.php?action=execute_task&blog_id=' . $blog_id . '&task_id=' . $task_id . '&post_id=' . $blog_post['post_id'] . '#add_comment">'.stripslashes($blog_post['title']) . '</a>, ' . get_lang('WrittenBy') . ' ' . stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))) . '<br />'; |
|
| 1954 | - } |
|
| 1949 | + if (Database::num_rows($result) > 0) { |
|
| 1950 | + while($blog_post = Database::fetch_array($result)) { |
|
| 1951 | + $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
|
| 1952 | + echo '<a href="blog.php?action=execute_task&blog_id=' . $blog_id . '&task_id=' . $task_id . '&post_id=' . $blog_post['post_id'] . '#add_comment">'.stripslashes($blog_post['title']) . '</a>, ' . get_lang('WrittenBy') . ' ' . stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))) . '<br />'; |
|
| 1953 | + } |
|
| 1955 | 1954 | } else { |
| 1956 | 1955 | echo get_lang('NoArticles'); |
| 1957 | 1956 | } |
| 1958 | - } |
|
| 1959 | - |
|
| 1960 | - /** |
|
| 1961 | - * Subscribes a user to a given blog |
|
| 1962 | - * @author Toon Keppens |
|
| 1963 | - * |
|
| 1964 | - * @param Integer $blog_id |
|
| 1965 | - * @param Integer $user_id |
|
| 1966 | - */ |
|
| 1967 | - public static function set_user_subscribed($blog_id, $user_id) |
|
| 1957 | + } |
|
| 1958 | + |
|
| 1959 | + /** |
|
| 1960 | + * Subscribes a user to a given blog |
|
| 1961 | + * @author Toon Keppens |
|
| 1962 | + * |
|
| 1963 | + * @param Integer $blog_id |
|
| 1964 | + * @param Integer $user_id |
|
| 1965 | + */ |
|
| 1966 | + public static function set_user_subscribed($blog_id, $user_id) |
|
| 1968 | 1967 | { |
| 1969 | - // Init |
|
| 1970 | - $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 1971 | - $tbl_user_permissions = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 1968 | + // Init |
|
| 1969 | + $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 1970 | + $tbl_user_permissions = Database::get_course_table(TABLE_PERMISSION_USER); |
|
| 1972 | 1971 | |
| 1973 | - $course_id = api_get_course_int_id(); |
|
| 1972 | + $course_id = api_get_course_int_id(); |
|
| 1974 | 1973 | |
| 1975 | - // Subscribe the user |
|
| 1976 | - $sql = "INSERT INTO $tbl_blogs_rel_user (c_id, blog_id, user_id ) |
|
| 1974 | + // Subscribe the user |
|
| 1975 | + $sql = "INSERT INTO $tbl_blogs_rel_user (c_id, blog_id, user_id ) |
|
| 1977 | 1976 | VALUES ($course_id, '".(int)$blog_id."', '".(int)$user_id."');"; |
| 1978 | - Database::query($sql); |
|
| 1977 | + Database::query($sql); |
|
| 1979 | 1978 | |
| 1980 | - // Give this user basic rights |
|
| 1981 | - $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
|
| 1979 | + // Give this user basic rights |
|
| 1980 | + $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
|
| 1982 | 1981 | VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_add')"; |
| 1983 | - Database::query($sql); |
|
| 1982 | + Database::query($sql); |
|
| 1984 | 1983 | |
| 1985 | 1984 | $id = Database::insert_id(); |
| 1986 | 1985 | if ($id) { |
@@ -1988,9 +1987,9 @@ discard block |
||
| 1988 | 1987 | Database::query($sql); |
| 1989 | 1988 | } |
| 1990 | 1989 | |
| 1991 | - $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
|
| 1990 | + $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
|
| 1992 | 1991 | VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_comments_add')"; |
| 1993 | - Database::query($sql); |
|
| 1992 | + Database::query($sql); |
|
| 1994 | 1993 | |
| 1995 | 1994 | $id = Database::insert_id(); |
| 1996 | 1995 | if ($id) { |
@@ -1998,197 +1997,197 @@ discard block |
||
| 1998 | 1997 | Database::query($sql); |
| 1999 | 1998 | } |
| 2000 | 1999 | |
| 2001 | - } |
|
| 2000 | + } |
|
| 2002 | 2001 | |
| 2003 | - /** |
|
| 2004 | - * Unsubscribe a user from a given blog |
|
| 2005 | - * @author Toon Keppens |
|
| 2006 | - * |
|
| 2007 | - * @param Integer $blog_id |
|
| 2008 | - * @param Integer $user_id |
|
| 2009 | - */ |
|
| 2010 | - public static function set_user_unsubscribed($blog_id, $user_id) |
|
| 2002 | + /** |
|
| 2003 | + * Unsubscribe a user from a given blog |
|
| 2004 | + * @author Toon Keppens |
|
| 2005 | + * |
|
| 2006 | + * @param Integer $blog_id |
|
| 2007 | + * @param Integer $user_id |
|
| 2008 | + */ |
|
| 2009 | + public static function set_user_unsubscribed($blog_id, $user_id) |
|
| 2011 | 2010 | { |
| 2012 | - // Init |
|
| 2011 | + // Init |
|
| 2013 | 2012 | $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
| 2014 | 2013 | $tbl_user_permissions = Database::get_course_table(TABLE_PERMISSION_USER); |
| 2015 | 2014 | |
| 2016 | - // Unsubscribe the user |
|
| 2017 | - $sql = "DELETE FROM $tbl_blogs_rel_user |
|
| 2015 | + // Unsubscribe the user |
|
| 2016 | + $sql = "DELETE FROM $tbl_blogs_rel_user |
|
| 2018 | 2017 | WHERE blog_id = '".(int)$blog_id."' AND user_id = '".(int)$user_id."'"; |
| 2019 | - Database::query($sql); |
|
| 2018 | + Database::query($sql); |
|
| 2020 | 2019 | |
| 2021 | - // Remove this user's permissions. |
|
| 2022 | - $sql = "DELETE FROM $tbl_user_permissions |
|
| 2020 | + // Remove this user's permissions. |
|
| 2021 | + $sql = "DELETE FROM $tbl_user_permissions |
|
| 2023 | 2022 | WHERE user_id = '".(int)$user_id."'"; |
| 2024 | - Database::query($sql); |
|
| 2025 | - } |
|
| 2026 | - |
|
| 2027 | - /** |
|
| 2028 | - * Displays the form to register users in a blog (in a course) |
|
| 2029 | - * The listed users are users subcribed in the course. |
|
| 2030 | - * @author Toon Keppens |
|
| 2031 | - * |
|
| 2032 | - * @param Integer $blog_id |
|
| 2033 | - * |
|
| 2034 | - * @return Html Form with sortable table with users to subcribe in a blog, in a course. |
|
| 2035 | - */ |
|
| 2036 | - public static function display_form_user_subscribe($blog_id) |
|
| 2037 | - { |
|
| 2038 | - $_course = api_get_course_info(); |
|
| 2039 | - $is_western_name_order = api_is_western_name_order(); |
|
| 2040 | - $session_id = api_get_session_id(); |
|
| 2041 | - $course_id = $_course['real_id']; |
|
| 2042 | - |
|
| 2043 | - $currentCourse = $_course['code']; |
|
| 2044 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2045 | - $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 2046 | - |
|
| 2047 | - echo '<legend>'.get_lang('SubscribeMembers').'</legend>'; |
|
| 2048 | - |
|
| 2049 | - $properties["width"] = "100%"; |
|
| 2050 | - |
|
| 2051 | - // Get blog members' id. |
|
| 2052 | - $sql = "SELECT user.user_id FROM $tbl_users user |
|
| 2023 | + Database::query($sql); |
|
| 2024 | + } |
|
| 2025 | + |
|
| 2026 | + /** |
|
| 2027 | + * Displays the form to register users in a blog (in a course) |
|
| 2028 | + * The listed users are users subcribed in the course. |
|
| 2029 | + * @author Toon Keppens |
|
| 2030 | + * |
|
| 2031 | + * @param Integer $blog_id |
|
| 2032 | + * |
|
| 2033 | + * @return Html Form with sortable table with users to subcribe in a blog, in a course. |
|
| 2034 | + */ |
|
| 2035 | + public static function display_form_user_subscribe($blog_id) |
|
| 2036 | + { |
|
| 2037 | + $_course = api_get_course_info(); |
|
| 2038 | + $is_western_name_order = api_is_western_name_order(); |
|
| 2039 | + $session_id = api_get_session_id(); |
|
| 2040 | + $course_id = $_course['real_id']; |
|
| 2041 | + |
|
| 2042 | + $currentCourse = $_course['code']; |
|
| 2043 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2044 | + $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 2045 | + |
|
| 2046 | + echo '<legend>'.get_lang('SubscribeMembers').'</legend>'; |
|
| 2047 | + |
|
| 2048 | + $properties["width"] = "100%"; |
|
| 2049 | + |
|
| 2050 | + // Get blog members' id. |
|
| 2051 | + $sql = "SELECT user.user_id FROM $tbl_users user |
|
| 2053 | 2052 | INNER JOIN $tbl_blogs_rel_user blogs_rel_user |
| 2054 | 2053 | ON user.user_id = blogs_rel_user.user_id |
| 2055 | 2054 | WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".intval($blog_id)."'"; |
| 2056 | - $result = Database::query($sql); |
|
| 2057 | - |
|
| 2058 | - $blog_member_ids = array(); |
|
| 2059 | - while($user = Database::fetch_array($result)) { |
|
| 2060 | - $blog_member_ids[] = $user['user_id']; |
|
| 2061 | - } |
|
| 2062 | - |
|
| 2063 | - // Set table headers |
|
| 2064 | - $column_header[] = array ('', false, ''); |
|
| 2065 | - if ($is_western_name_order) { |
|
| 2066 | - $column_header[] = array(get_lang('FirstName'), true, ''); |
|
| 2067 | - $column_header[] = array(get_lang('LastName'), true, ''); |
|
| 2068 | - } else { |
|
| 2069 | - $column_header[] = array(get_lang('LastName'), true, ''); |
|
| 2070 | - $column_header[] = array(get_lang('FirstName'), true, ''); |
|
| 2071 | - } |
|
| 2072 | - $column_header[] = array(get_lang('Email'), false, ''); |
|
| 2073 | - $column_header[] = array(get_lang('Register'), false, ''); |
|
| 2055 | + $result = Database::query($sql); |
|
| 2056 | + |
|
| 2057 | + $blog_member_ids = array(); |
|
| 2058 | + while($user = Database::fetch_array($result)) { |
|
| 2059 | + $blog_member_ids[] = $user['user_id']; |
|
| 2060 | + } |
|
| 2061 | + |
|
| 2062 | + // Set table headers |
|
| 2063 | + $column_header[] = array ('', false, ''); |
|
| 2064 | + if ($is_western_name_order) { |
|
| 2065 | + $column_header[] = array(get_lang('FirstName'), true, ''); |
|
| 2066 | + $column_header[] = array(get_lang('LastName'), true, ''); |
|
| 2067 | + } else { |
|
| 2068 | + $column_header[] = array(get_lang('LastName'), true, ''); |
|
| 2069 | + $column_header[] = array(get_lang('FirstName'), true, ''); |
|
| 2070 | + } |
|
| 2071 | + $column_header[] = array(get_lang('Email'), false, ''); |
|
| 2072 | + $column_header[] = array(get_lang('Register'), false, ''); |
|
| 2074 | 2073 | |
| 2075 | 2074 | $student_list = CourseManager:: get_student_list_from_course_code( |
| 2076 | 2075 | $currentCourse, |
| 2077 | 2076 | false, |
| 2078 | 2077 | $session_id |
| 2079 | 2078 | ); |
| 2080 | - $user_data = array(); |
|
| 2081 | - |
|
| 2082 | - // Add users that are not in this blog to the list. |
|
| 2083 | - foreach ($student_list as $key=>$user) { |
|
| 2084 | - if(isset($user['id_user'])) { |
|
| 2085 | - $user['user_id'] = $user['id_user']; |
|
| 2086 | - } |
|
| 2087 | - if(!in_array($user['user_id'],$blog_member_ids)) { |
|
| 2088 | - $a_infosUser = api_get_user_info($user['user_id']); |
|
| 2089 | - $row = array (); |
|
| 2090 | - $row[] = '<input type="checkbox" name="user[]" value="' . $a_infosUser['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '') . '/>'; |
|
| 2091 | - $username = api_htmlentities(sprintf(get_lang('LoginX'), $a_infosUser["username"]), ENT_QUOTES); |
|
| 2092 | - if ($is_western_name_order) { |
|
| 2093 | - $row[] = $a_infosUser["firstname"]; |
|
| 2094 | - $row[] = Display::tag('span', $a_infosUser["lastname"], array('title'=>$username)); |
|
| 2095 | - } else { |
|
| 2096 | - $row[] = Display::tag('span', $a_infosUser["lastname"], array('title'=>$username)); |
|
| 2097 | - $row[] = $a_infosUser["firstname"]; |
|
| 2098 | - } |
|
| 2099 | - $row[] = Display::icon_mailto_link($a_infosUser["email"]); |
|
| 2100 | - |
|
| 2101 | - //Link to register users |
|
| 2102 | - if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']){ |
|
| 2103 | - $row[] = "<a class=\"btn btn-primary \" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id®ister=yes&user_id=" . $a_infosUser["user_id"]."\">" . get_lang('Register')."</a>"; |
|
| 2104 | - } else { |
|
| 2105 | - $row[] = ''; |
|
| 2106 | - } |
|
| 2107 | - $user_data[] = $row; |
|
| 2108 | - } |
|
| 2109 | - } |
|
| 2110 | - |
|
| 2111 | - // Display |
|
| 2112 | - $query_vars['action'] = 'manage_members'; |
|
| 2113 | - $query_vars['blog_id'] = $blog_id; |
|
| 2114 | - echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
| 2115 | - Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
| 2116 | - $link = ''; |
|
| 2117 | - $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']) . '&' : ''; |
|
| 2118 | - $link .= "blog_id=$blog_id&"; |
|
| 2119 | - |
|
| 2120 | - echo '<a href="blog.php?' . $link . 'selectall=subscribe">' . get_lang('SelectAll') . '</a> - '; |
|
| 2121 | - echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
| 2122 | - echo get_lang('WithSelected') . ' : '; |
|
| 2123 | - echo '<select name="action">'; |
|
| 2124 | - echo '<option value="select_subscribe">' . get_lang('Register') . '</option>'; |
|
| 2125 | - echo '</select>'; |
|
| 2126 | - echo '<input type="hidden" name="register" value="true" />'; |
|
| 2127 | - echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
| 2128 | - echo '</form>'; |
|
| 2129 | - } |
|
| 2130 | - |
|
| 2131 | - /** |
|
| 2132 | - * Displays the form to register users in a blog (in a course) |
|
| 2133 | - * The listed users are users subcribed in the course. |
|
| 2134 | - * @author Toon Keppens |
|
| 2135 | - * |
|
| 2136 | - * @param Integer $blog_id |
|
| 2137 | - * |
|
| 2138 | - * @return Html Form with sortable table with users to unsubcribe from a blog. |
|
| 2139 | - */ |
|
| 2140 | - public static function display_form_user_unsubscribe ($blog_id) |
|
| 2141 | - { |
|
| 2142 | - $_user = api_get_user_info(); |
|
| 2143 | - $is_western_name_order = api_is_western_name_order(); |
|
| 2144 | - |
|
| 2145 | - // Init |
|
| 2146 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2147 | - $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 2148 | - |
|
| 2149 | - echo '<legend>'.get_lang('UnsubscribeMembers').'</legend>'; |
|
| 2150 | - |
|
| 2151 | - $properties["width"] = "100%"; |
|
| 2152 | - //table column titles |
|
| 2153 | - $column_header[] = array ('', false, ''); |
|
| 2154 | - if ($is_western_name_order) { |
|
| 2155 | - $column_header[] = array (get_lang('FirstName'), true, ''); |
|
| 2156 | - $column_header[] = array (get_lang('LastName'), true, ''); |
|
| 2157 | - } else { |
|
| 2158 | - $column_header[] = array (get_lang('LastName'), true, ''); |
|
| 2159 | - $column_header[] = array (get_lang('FirstName'), true, ''); |
|
| 2160 | - } |
|
| 2161 | - $column_header[] = array (get_lang('Email'), false, ''); |
|
| 2162 | - $column_header[] = array (get_lang('TaskManager'), true, ''); |
|
| 2163 | - $column_header[] = array (get_lang('UnRegister'), false, ''); |
|
| 2164 | - |
|
| 2165 | - $course_id = api_get_course_int_id(); |
|
| 2166 | - |
|
| 2167 | - $sql = "SELECT user.user_id, user.lastname, user.firstname, user.email, user.username |
|
| 2079 | + $user_data = array(); |
|
| 2080 | + |
|
| 2081 | + // Add users that are not in this blog to the list. |
|
| 2082 | + foreach ($student_list as $key=>$user) { |
|
| 2083 | + if(isset($user['id_user'])) { |
|
| 2084 | + $user['user_id'] = $user['id_user']; |
|
| 2085 | + } |
|
| 2086 | + if(!in_array($user['user_id'],$blog_member_ids)) { |
|
| 2087 | + $a_infosUser = api_get_user_info($user['user_id']); |
|
| 2088 | + $row = array (); |
|
| 2089 | + $row[] = '<input type="checkbox" name="user[]" value="' . $a_infosUser['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '') . '/>'; |
|
| 2090 | + $username = api_htmlentities(sprintf(get_lang('LoginX'), $a_infosUser["username"]), ENT_QUOTES); |
|
| 2091 | + if ($is_western_name_order) { |
|
| 2092 | + $row[] = $a_infosUser["firstname"]; |
|
| 2093 | + $row[] = Display::tag('span', $a_infosUser["lastname"], array('title'=>$username)); |
|
| 2094 | + } else { |
|
| 2095 | + $row[] = Display::tag('span', $a_infosUser["lastname"], array('title'=>$username)); |
|
| 2096 | + $row[] = $a_infosUser["firstname"]; |
|
| 2097 | + } |
|
| 2098 | + $row[] = Display::icon_mailto_link($a_infosUser["email"]); |
|
| 2099 | + |
|
| 2100 | + //Link to register users |
|
| 2101 | + if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']){ |
|
| 2102 | + $row[] = "<a class=\"btn btn-primary \" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id®ister=yes&user_id=" . $a_infosUser["user_id"]."\">" . get_lang('Register')."</a>"; |
|
| 2103 | + } else { |
|
| 2104 | + $row[] = ''; |
|
| 2105 | + } |
|
| 2106 | + $user_data[] = $row; |
|
| 2107 | + } |
|
| 2108 | + } |
|
| 2109 | + |
|
| 2110 | + // Display |
|
| 2111 | + $query_vars['action'] = 'manage_members'; |
|
| 2112 | + $query_vars['blog_id'] = $blog_id; |
|
| 2113 | + echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
| 2114 | + Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
| 2115 | + $link = ''; |
|
| 2116 | + $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']) . '&' : ''; |
|
| 2117 | + $link .= "blog_id=$blog_id&"; |
|
| 2118 | + |
|
| 2119 | + echo '<a href="blog.php?' . $link . 'selectall=subscribe">' . get_lang('SelectAll') . '</a> - '; |
|
| 2120 | + echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
| 2121 | + echo get_lang('WithSelected') . ' : '; |
|
| 2122 | + echo '<select name="action">'; |
|
| 2123 | + echo '<option value="select_subscribe">' . get_lang('Register') . '</option>'; |
|
| 2124 | + echo '</select>'; |
|
| 2125 | + echo '<input type="hidden" name="register" value="true" />'; |
|
| 2126 | + echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
| 2127 | + echo '</form>'; |
|
| 2128 | + } |
|
| 2129 | + |
|
| 2130 | + /** |
|
| 2131 | + * Displays the form to register users in a blog (in a course) |
|
| 2132 | + * The listed users are users subcribed in the course. |
|
| 2133 | + * @author Toon Keppens |
|
| 2134 | + * |
|
| 2135 | + * @param Integer $blog_id |
|
| 2136 | + * |
|
| 2137 | + * @return Html Form with sortable table with users to unsubcribe from a blog. |
|
| 2138 | + */ |
|
| 2139 | + public static function display_form_user_unsubscribe ($blog_id) |
|
| 2140 | + { |
|
| 2141 | + $_user = api_get_user_info(); |
|
| 2142 | + $is_western_name_order = api_is_western_name_order(); |
|
| 2143 | + |
|
| 2144 | + // Init |
|
| 2145 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2146 | + $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
|
| 2147 | + |
|
| 2148 | + echo '<legend>'.get_lang('UnsubscribeMembers').'</legend>'; |
|
| 2149 | + |
|
| 2150 | + $properties["width"] = "100%"; |
|
| 2151 | + //table column titles |
|
| 2152 | + $column_header[] = array ('', false, ''); |
|
| 2153 | + if ($is_western_name_order) { |
|
| 2154 | + $column_header[] = array (get_lang('FirstName'), true, ''); |
|
| 2155 | + $column_header[] = array (get_lang('LastName'), true, ''); |
|
| 2156 | + } else { |
|
| 2157 | + $column_header[] = array (get_lang('LastName'), true, ''); |
|
| 2158 | + $column_header[] = array (get_lang('FirstName'), true, ''); |
|
| 2159 | + } |
|
| 2160 | + $column_header[] = array (get_lang('Email'), false, ''); |
|
| 2161 | + $column_header[] = array (get_lang('TaskManager'), true, ''); |
|
| 2162 | + $column_header[] = array (get_lang('UnRegister'), false, ''); |
|
| 2163 | + |
|
| 2164 | + $course_id = api_get_course_int_id(); |
|
| 2165 | + |
|
| 2166 | + $sql = "SELECT user.user_id, user.lastname, user.firstname, user.email, user.username |
|
| 2168 | 2167 | FROM $tbl_users user INNER JOIN $tbl_blogs_rel_user blogs_rel_user |
| 2169 | 2168 | ON user.user_id = blogs_rel_user.user_id |
| 2170 | 2169 | WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'"; |
| 2171 | 2170 | |
| 2172 | - if (!($sql_result = Database::query($sql))) { |
|
| 2173 | - return false; |
|
| 2174 | - } |
|
| 2175 | - |
|
| 2176 | - $user_data = array (); |
|
| 2177 | - |
|
| 2178 | - while ($myrow = Database::fetch_array($sql_result)) { |
|
| 2179 | - $row = array (); |
|
| 2180 | - $row[] = '<input type="checkbox" name="user[]" value="' . $myrow['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '') . '/>'; |
|
| 2181 | - $username = api_htmlentities(sprintf(get_lang('LoginX'), $myrow["username"]), ENT_QUOTES); |
|
| 2182 | - if ($is_western_name_order) { |
|
| 2183 | - $row[] = $myrow["firstname"]; |
|
| 2184 | - $row[] = Display::tag('span', $myrow["lastname"], array('title'=>$username)); |
|
| 2185 | - } else { |
|
| 2186 | - $row[] = Display::tag('span', $myrow["lastname"], array('title'=>$username)); |
|
| 2187 | - $row[] = $myrow["firstname"]; |
|
| 2188 | - } |
|
| 2189 | - $row[] = Display::icon_mailto_link($myrow["email"]); |
|
| 2190 | - |
|
| 2191 | - $sql = "SELECT bt.title task |
|
| 2171 | + if (!($sql_result = Database::query($sql))) { |
|
| 2172 | + return false; |
|
| 2173 | + } |
|
| 2174 | + |
|
| 2175 | + $user_data = array (); |
|
| 2176 | + |
|
| 2177 | + while ($myrow = Database::fetch_array($sql_result)) { |
|
| 2178 | + $row = array (); |
|
| 2179 | + $row[] = '<input type="checkbox" name="user[]" value="' . $myrow['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '') . '/>'; |
|
| 2180 | + $username = api_htmlentities(sprintf(get_lang('LoginX'), $myrow["username"]), ENT_QUOTES); |
|
| 2181 | + if ($is_western_name_order) { |
|
| 2182 | + $row[] = $myrow["firstname"]; |
|
| 2183 | + $row[] = Display::tag('span', $myrow["lastname"], array('title'=>$username)); |
|
| 2184 | + } else { |
|
| 2185 | + $row[] = Display::tag('span', $myrow["lastname"], array('title'=>$username)); |
|
| 2186 | + $row[] = $myrow["firstname"]; |
|
| 2187 | + } |
|
| 2188 | + $row[] = Display::icon_mailto_link($myrow["email"]); |
|
| 2189 | + |
|
| 2190 | + $sql = "SELECT bt.title task |
|
| 2192 | 2191 | FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " btu |
| 2193 | 2192 | INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS) . " bt |
| 2194 | 2193 | ON btu.task_id = bt.task_id |
@@ -2196,158 +2195,158 @@ discard block |
||
| 2196 | 2195 | bt.c_id = $course_id AND |
| 2197 | 2196 | btu.blog_id = $blog_id AND |
| 2198 | 2197 | btu.user_id = " . $myrow['user_id']; |
| 2199 | - $sql_res = Database::query($sql); |
|
| 2200 | - |
|
| 2201 | - $task = ''; |
|
| 2202 | - |
|
| 2203 | - while($r = Database::fetch_array($sql_res)) { |
|
| 2204 | - $task .= stripslashes($r['task']) . ', '; |
|
| 2205 | - } |
|
| 2206 | - //echo $task; |
|
| 2207 | - $task = (api_strlen(trim($task)) != 0) ? api_substr($task, 0, api_strlen($task) - 2) : get_lang('Reader'); |
|
| 2208 | - $row[] = $task; |
|
| 2209 | - //Link to register users |
|
| 2210 | - |
|
| 2211 | - if ($myrow["user_id"] != $_user['user_id']) { |
|
| 2212 | - $row[] = "<a class=\"btn btn-primary\" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=" . $myrow['user_id']."\">" . get_lang('UnRegister')."</a>"; |
|
| 2213 | - } else { |
|
| 2214 | - $row[] = ''; |
|
| 2215 | - } |
|
| 2216 | - |
|
| 2217 | - $user_data[] = $row; |
|
| 2218 | - } |
|
| 2219 | - |
|
| 2220 | - $query_vars['action'] = 'manage_members'; |
|
| 2221 | - $query_vars['blog_id'] = $blog_id; |
|
| 2222 | - echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
| 2223 | - Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
| 2224 | - $link = ''; |
|
| 2225 | - $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']). '&' : ''; |
|
| 2226 | - $link .= "blog_id=$blog_id&"; |
|
| 2227 | - |
|
| 2228 | - echo '<a href="blog.php?' . $link . 'selectall=unsubscribe">' . get_lang('SelectAll') . '</a> - '; |
|
| 2229 | - echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
| 2230 | - echo get_lang('WithSelected') . ' : '; |
|
| 2231 | - echo '<select name="action">'; |
|
| 2232 | - echo '<option value="select_unsubscribe">' . get_lang('UnRegister') . '</option>'; |
|
| 2233 | - echo '</select>'; |
|
| 2234 | - echo '<input type="hidden" name="unregister" value="true" />'; |
|
| 2235 | - echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
| 2236 | - echo '</form>'; |
|
| 2237 | - } |
|
| 2238 | - |
|
| 2239 | - /** |
|
| 2240 | - * Displays a matrix with selectboxes. On the left: users, on top: possible rights. |
|
| 2241 | - * The blog admin can thus select what a certain user can do in the current blog |
|
| 2242 | - * |
|
| 2243 | - * @param Integer $blog_id |
|
| 2244 | - */ |
|
| 2245 | - public static function display_form_user_rights ($blog_id) |
|
| 2198 | + $sql_res = Database::query($sql); |
|
| 2199 | + |
|
| 2200 | + $task = ''; |
|
| 2201 | + |
|
| 2202 | + while($r = Database::fetch_array($sql_res)) { |
|
| 2203 | + $task .= stripslashes($r['task']) . ', '; |
|
| 2204 | + } |
|
| 2205 | + //echo $task; |
|
| 2206 | + $task = (api_strlen(trim($task)) != 0) ? api_substr($task, 0, api_strlen($task) - 2) : get_lang('Reader'); |
|
| 2207 | + $row[] = $task; |
|
| 2208 | + //Link to register users |
|
| 2209 | + |
|
| 2210 | + if ($myrow["user_id"] != $_user['user_id']) { |
|
| 2211 | + $row[] = "<a class=\"btn btn-primary\" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=" . $myrow['user_id']."\">" . get_lang('UnRegister')."</a>"; |
|
| 2212 | + } else { |
|
| 2213 | + $row[] = ''; |
|
| 2214 | + } |
|
| 2215 | + |
|
| 2216 | + $user_data[] = $row; |
|
| 2217 | + } |
|
| 2218 | + |
|
| 2219 | + $query_vars['action'] = 'manage_members'; |
|
| 2220 | + $query_vars['blog_id'] = $blog_id; |
|
| 2221 | + echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
| 2222 | + Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
| 2223 | + $link = ''; |
|
| 2224 | + $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']). '&' : ''; |
|
| 2225 | + $link .= "blog_id=$blog_id&"; |
|
| 2226 | + |
|
| 2227 | + echo '<a href="blog.php?' . $link . 'selectall=unsubscribe">' . get_lang('SelectAll') . '</a> - '; |
|
| 2228 | + echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
| 2229 | + echo get_lang('WithSelected') . ' : '; |
|
| 2230 | + echo '<select name="action">'; |
|
| 2231 | + echo '<option value="select_unsubscribe">' . get_lang('UnRegister') . '</option>'; |
|
| 2232 | + echo '</select>'; |
|
| 2233 | + echo '<input type="hidden" name="unregister" value="true" />'; |
|
| 2234 | + echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
| 2235 | + echo '</form>'; |
|
| 2236 | + } |
|
| 2237 | + |
|
| 2238 | + /** |
|
| 2239 | + * Displays a matrix with selectboxes. On the left: users, on top: possible rights. |
|
| 2240 | + * The blog admin can thus select what a certain user can do in the current blog |
|
| 2241 | + * |
|
| 2242 | + * @param Integer $blog_id |
|
| 2243 | + */ |
|
| 2244 | + public static function display_form_user_rights ($blog_id) |
|
| 2245 | + { |
|
| 2246 | + echo '<legend>'.get_lang('RightsManager').'</legend>'; |
|
| 2247 | + echo '<br />'; |
|
| 2248 | + |
|
| 2249 | + // Integration of patricks permissions system. |
|
| 2250 | + require_once api_get_path(SYS_CODE_PATH).'permissions/blog_permissions.inc.php'; |
|
| 2251 | + } |
|
| 2252 | + |
|
| 2253 | + /** |
|
| 2254 | + * Displays the form to create a new post |
|
| 2255 | + * @author Toon Keppens |
|
| 2256 | + * |
|
| 2257 | + * @param Integer $blog_id |
|
| 2258 | + */ |
|
| 2259 | + public static function display_new_comment_form($blog_id, $post_id, $title) |
|
| 2260 | + { |
|
| 2261 | + $form = new FormValidator( |
|
| 2262 | + 'add_post', |
|
| 2263 | + 'post', |
|
| 2264 | + api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=" . intval($blog_id) . "&post_id=".intval($post_id)."&".api_get_cidreq(), |
|
| 2265 | + null, |
|
| 2266 | + array('enctype' => 'multipart/form-data') |
|
| 2267 | + ); |
|
| 2268 | + |
|
| 2269 | + $header = get_lang('AddNewComment'); |
|
| 2270 | + if (isset($_GET['task_id'])) { |
|
| 2271 | + $header = get_lang('ExecuteThisTask'); |
|
| 2272 | + } |
|
| 2273 | + $form->addHeader($header); |
|
| 2274 | + $form->addText('title', get_lang('Title')); |
|
| 2275 | + |
|
| 2276 | + $config = array(); |
|
| 2277 | + if (!api_is_allowed_to_edit()) { |
|
| 2278 | + $config['ToolbarSet'] = 'ProjectComment'; |
|
| 2279 | + } else { |
|
| 2280 | + $config['ToolbarSet'] = 'ProjectCommentStudent'; |
|
| 2281 | + } |
|
| 2282 | + $form->addHtmlEditor('comment', get_lang('Comment'), false, false, $config); |
|
| 2283 | + $form->addFile('user_upload', get_lang('AddAnAttachment')); |
|
| 2284 | + |
|
| 2285 | + $form->addTextarea('post_file_comment', get_lang('FileComment')); |
|
| 2286 | + |
|
| 2287 | + $form->addHidden('action', null); |
|
| 2288 | + $form->addHidden('comment_parent_id', 0); |
|
| 2289 | + |
|
| 2290 | + if (isset($_GET['task_id'])) { |
|
| 2291 | + $form->addHidden('new_task_execution_submit', 'true'); |
|
| 2292 | + $form->addHidden('task_id', intval($_GET['task_id'])); |
|
| 2293 | + } else { |
|
| 2294 | + $form->addHidden('new_comment_submit', 'true'); |
|
| 2295 | + } |
|
| 2296 | + $form->addButton('save', get_lang('Save')); |
|
| 2297 | + $form->display(); |
|
| 2298 | + } |
|
| 2299 | + |
|
| 2300 | + |
|
| 2301 | + /** |
|
| 2302 | + * show the calender of the given month |
|
| 2303 | + * @author Patrick Cool |
|
| 2304 | + * @author Toon Keppens |
|
| 2305 | + * |
|
| 2306 | + * @param Array $blogitems an array containing all the blog items for the given month |
|
| 2307 | + * @param Integer $month: the integer value of the month we are viewing |
|
| 2308 | + * @param Integer $year: the 4-digit year indication e.g. 2005 |
|
| 2309 | + * @param String $monthName: the language variable for the mont name |
|
| 2310 | + * |
|
| 2311 | + * @return html code |
|
| 2312 | + */ |
|
| 2313 | + public static function display_minimonthcalendar($month, $year, $blog_id) |
|
| 2246 | 2314 | { |
| 2247 | - echo '<legend>'.get_lang('RightsManager').'</legend>'; |
|
| 2248 | - echo '<br />'; |
|
| 2249 | - |
|
| 2250 | - // Integration of patricks permissions system. |
|
| 2251 | - require_once api_get_path(SYS_CODE_PATH).'permissions/blog_permissions.inc.php'; |
|
| 2252 | - } |
|
| 2253 | - |
|
| 2254 | - /** |
|
| 2255 | - * Displays the form to create a new post |
|
| 2256 | - * @author Toon Keppens |
|
| 2257 | - * |
|
| 2258 | - * @param Integer $blog_id |
|
| 2259 | - */ |
|
| 2260 | - public static function display_new_comment_form($blog_id, $post_id, $title) |
|
| 2261 | - { |
|
| 2262 | - $form = new FormValidator( |
|
| 2263 | - 'add_post', |
|
| 2264 | - 'post', |
|
| 2265 | - api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=" . intval($blog_id) . "&post_id=".intval($post_id)."&".api_get_cidreq(), |
|
| 2266 | - null, |
|
| 2267 | - array('enctype' => 'multipart/form-data') |
|
| 2268 | - ); |
|
| 2269 | - |
|
| 2270 | - $header = get_lang('AddNewComment'); |
|
| 2271 | - if (isset($_GET['task_id'])) { |
|
| 2272 | - $header = get_lang('ExecuteThisTask'); |
|
| 2273 | - } |
|
| 2274 | - $form->addHeader($header); |
|
| 2275 | - $form->addText('title', get_lang('Title')); |
|
| 2276 | - |
|
| 2277 | - $config = array(); |
|
| 2278 | - if (!api_is_allowed_to_edit()) { |
|
| 2279 | - $config['ToolbarSet'] = 'ProjectComment'; |
|
| 2280 | - } else { |
|
| 2281 | - $config['ToolbarSet'] = 'ProjectCommentStudent'; |
|
| 2282 | - } |
|
| 2283 | - $form->addHtmlEditor('comment', get_lang('Comment'), false, false, $config); |
|
| 2284 | - $form->addFile('user_upload', get_lang('AddAnAttachment')); |
|
| 2285 | - |
|
| 2286 | - $form->addTextarea('post_file_comment', get_lang('FileComment')); |
|
| 2287 | - |
|
| 2288 | - $form->addHidden('action', null); |
|
| 2289 | - $form->addHidden('comment_parent_id', 0); |
|
| 2290 | - |
|
| 2291 | - if (isset($_GET['task_id'])) { |
|
| 2292 | - $form->addHidden('new_task_execution_submit', 'true'); |
|
| 2293 | - $form->addHidden('task_id', intval($_GET['task_id'])); |
|
| 2294 | - } else { |
|
| 2295 | - $form->addHidden('new_comment_submit', 'true'); |
|
| 2296 | - } |
|
| 2297 | - $form->addButton('save', get_lang('Save')); |
|
| 2298 | - $form->display(); |
|
| 2299 | - } |
|
| 2300 | - |
|
| 2301 | - |
|
| 2302 | - /** |
|
| 2303 | - * show the calender of the given month |
|
| 2304 | - * @author Patrick Cool |
|
| 2305 | - * @author Toon Keppens |
|
| 2306 | - * |
|
| 2307 | - * @param Array $blogitems an array containing all the blog items for the given month |
|
| 2308 | - * @param Integer $month: the integer value of the month we are viewing |
|
| 2309 | - * @param Integer $year: the 4-digit year indication e.g. 2005 |
|
| 2310 | - * @param String $monthName: the language variable for the mont name |
|
| 2311 | - * |
|
| 2312 | - * @return html code |
|
| 2313 | - */ |
|
| 2314 | - public static function display_minimonthcalendar($month, $year, $blog_id) |
|
| 2315 | - { |
|
| 2316 | - // Init |
|
| 2317 | - $_user = api_get_user_info(); |
|
| 2318 | - global $DaysShort; |
|
| 2319 | - global $MonthsLong; |
|
| 2320 | - |
|
| 2321 | - $posts = array(); |
|
| 2322 | - $tasks = array(); |
|
| 2323 | - |
|
| 2324 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2325 | - $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 2326 | - $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 2327 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 2328 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2329 | - |
|
| 2330 | - $course_id = api_get_course_int_id(); |
|
| 2331 | - |
|
| 2332 | - //Handle leap year |
|
| 2333 | - $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
| 2334 | - |
|
| 2335 | - if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
| 2336 | - $numberofdays[2] = 29; |
|
| 2337 | - |
|
| 2338 | - //Get the first day of the month |
|
| 2339 | - $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
|
| 2340 | - $monthName = $MonthsLong[$month-1]; |
|
| 2341 | - |
|
| 2342 | - //Start the week on monday |
|
| 2343 | - $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6; |
|
| 2344 | - $blogId = isset($_GET['blog_id']) ? intval($_GET['blog_id']) : null; |
|
| 2345 | - $filter = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null; |
|
| 2346 | - $backwardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year); |
|
| 2347 | - $forewardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year); |
|
| 2348 | - |
|
| 2349 | - // Get posts for this month |
|
| 2350 | - $sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname |
|
| 2315 | + // Init |
|
| 2316 | + $_user = api_get_user_info(); |
|
| 2317 | + global $DaysShort; |
|
| 2318 | + global $MonthsLong; |
|
| 2319 | + |
|
| 2320 | + $posts = array(); |
|
| 2321 | + $tasks = array(); |
|
| 2322 | + |
|
| 2323 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2324 | + $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 2325 | + $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
|
| 2326 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 2327 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2328 | + |
|
| 2329 | + $course_id = api_get_course_int_id(); |
|
| 2330 | + |
|
| 2331 | + //Handle leap year |
|
| 2332 | + $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
| 2333 | + |
|
| 2334 | + if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
| 2335 | + $numberofdays[2] = 29; |
|
| 2336 | + |
|
| 2337 | + //Get the first day of the month |
|
| 2338 | + $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
|
| 2339 | + $monthName = $MonthsLong[$month-1]; |
|
| 2340 | + |
|
| 2341 | + //Start the week on monday |
|
| 2342 | + $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6; |
|
| 2343 | + $blogId = isset($_GET['blog_id']) ? intval($_GET['blog_id']) : null; |
|
| 2344 | + $filter = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null; |
|
| 2345 | + $backwardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year); |
|
| 2346 | + $forewardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year); |
|
| 2347 | + |
|
| 2348 | + // Get posts for this month |
|
| 2349 | + $sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname |
|
| 2351 | 2350 | FROM $tbl_blogs_posts post |
| 2352 | 2351 | INNER JOIN $tbl_users user |
| 2353 | 2352 | ON post.author_id = user.user_id |
@@ -2357,20 +2356,20 @@ discard block |
||
| 2357 | 2356 | MONTH(date_creation) = '".(int)$month."' AND |
| 2358 | 2357 | YEAR(date_creation) = '".(int)$year."' |
| 2359 | 2358 | ORDER BY date_creation"; |
| 2360 | - $result = Database::query($sql); |
|
| 2361 | - |
|
| 2362 | - // We will create an array of days on which there are posts. |
|
| 2363 | - if( Database::num_rows($result) > 0) { |
|
| 2364 | - while($blog_post = Database::fetch_array($result)) { |
|
| 2365 | - // If the day of this post is not yet in the array, add it. |
|
| 2366 | - if (!in_array($blog_post['post_day'], $posts)) |
|
| 2367 | - $posts[] = $blog_post['post_day']; |
|
| 2368 | - } |
|
| 2369 | - } |
|
| 2370 | - |
|
| 2371 | - // Get tasks for this month |
|
| 2372 | - if ($_user['user_id']) { |
|
| 2373 | - $sql = " SELECT task_rel_user.*, DAYOFMONTH(target_date) as task_day, task.title, blog.blog_name |
|
| 2359 | + $result = Database::query($sql); |
|
| 2360 | + |
|
| 2361 | + // We will create an array of days on which there are posts. |
|
| 2362 | + if( Database::num_rows($result) > 0) { |
|
| 2363 | + while($blog_post = Database::fetch_array($result)) { |
|
| 2364 | + // If the day of this post is not yet in the array, add it. |
|
| 2365 | + if (!in_array($blog_post['post_day'], $posts)) |
|
| 2366 | + $posts[] = $blog_post['post_day']; |
|
| 2367 | + } |
|
| 2368 | + } |
|
| 2369 | + |
|
| 2370 | + // Get tasks for this month |
|
| 2371 | + if ($_user['user_id']) { |
|
| 2372 | + $sql = " SELECT task_rel_user.*, DAYOFMONTH(target_date) as task_day, task.title, blog.blog_name |
|
| 2374 | 2373 | FROM $tbl_blogs_tasks_rel_user task_rel_user |
| 2375 | 2374 | INNER JOIN $tbl_blogs_tasks task ON task_rel_user.task_id = task.task_id |
| 2376 | 2375 | INNER JOIN $tbl_blogs blog ON task_rel_user.blog_id = blog.blog_id |
@@ -2382,84 +2381,84 @@ discard block |
||
| 2382 | 2381 | MONTH(target_date) = '".(int)$month."' AND |
| 2383 | 2382 | YEAR(target_date) = '".(int)$year."' |
| 2384 | 2383 | ORDER BY target_date ASC"; |
| 2385 | - $result = Database::query($sql); |
|
| 2386 | - |
|
| 2387 | - if (Database::num_rows($result) > 0) { |
|
| 2388 | - while ($mytask = Database::fetch_array($result)) { |
|
| 2389 | - $tasks[$mytask['task_day']][$mytask['task_id']]['task_id'] = $mytask['task_id']; |
|
| 2390 | - $tasks[$mytask['task_day']][$mytask['task_id']]['title'] = $mytask['title']; |
|
| 2391 | - $tasks[$mytask['task_day']][$mytask['task_id']]['blog_id'] = $mytask['blog_id']; |
|
| 2392 | - $tasks[$mytask['task_day']][$mytask['task_id']]['blog_name'] = $mytask['blog_name']; |
|
| 2393 | - $tasks[$mytask['task_day']][$mytask['task_id']]['day'] = $mytask['task_day']; |
|
| 2394 | - } |
|
| 2395 | - } |
|
| 2396 | - } |
|
| 2397 | - |
|
| 2398 | - echo '<table id="smallcalendar" class="table table-responsive">', |
|
| 2399 | - "<tr id=\"title\">\n", |
|
| 2400 | - "<th width=\"10%\"><a href=\"", $backwardsURL, "\">«</a></th>\n", |
|
| 2401 | - "<th align=\"center\" width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</th>\n", |
|
| 2402 | - "<th width=\"10%\" align=\"right\"><a href=\"", $forewardsURL, "\">»</a></th>\n", "</tr>"; |
|
| 2403 | - |
|
| 2404 | - echo "<tr>\n"; |
|
| 2405 | - |
|
| 2406 | - for($ii = 1; $ii < 8; $ii ++) |
|
| 2407 | - echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
| 2408 | - |
|
| 2409 | - echo "</tr>"; |
|
| 2410 | - |
|
| 2411 | - $curday = -1; |
|
| 2412 | - $today = getdate(); |
|
| 2413 | - |
|
| 2414 | - while ($curday <= $numberofdays[$month]) { |
|
| 2415 | - echo "<tr>"; |
|
| 2416 | - for ($ii = 0; $ii < 7; $ii ++) { |
|
| 2417 | - if (($curday == -1) && ($ii == $startdayofweek)) |
|
| 2418 | - $curday = 1; |
|
| 2419 | - |
|
| 2420 | - if (($curday > 0) && ($curday <= $numberofdays[$month])) { |
|
| 2421 | - $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\""; |
|
| 2422 | - $dayheader = "$curday"; |
|
| 2423 | - |
|
| 2424 | - if(($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { |
|
| 2425 | - $dayheader = "$curday"; |
|
| 2426 | - $class = "class=\"days_today\""; |
|
| 2427 | - } |
|
| 2428 | - |
|
| 2429 | - echo "<td " . $class.">"; |
|
| 2430 | - |
|
| 2431 | - // If there are posts on this day, create a filter link. |
|
| 2432 | - if(in_array($curday, $posts)) |
|
| 2433 | - echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
| 2434 | - else |
|
| 2435 | - echo $dayheader; |
|
| 2436 | - |
|
| 2437 | - if (count($tasks) > 0) { |
|
| 2438 | - if (isset($tasks[$curday]) && is_array($tasks[$curday])) { |
|
| 2439 | - // Add tasks to calendar |
|
| 2440 | - foreach ($tasks[$curday] as $task) { |
|
| 2441 | - echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '"> |
|
| 2384 | + $result = Database::query($sql); |
|
| 2385 | + |
|
| 2386 | + if (Database::num_rows($result) > 0) { |
|
| 2387 | + while ($mytask = Database::fetch_array($result)) { |
|
| 2388 | + $tasks[$mytask['task_day']][$mytask['task_id']]['task_id'] = $mytask['task_id']; |
|
| 2389 | + $tasks[$mytask['task_day']][$mytask['task_id']]['title'] = $mytask['title']; |
|
| 2390 | + $tasks[$mytask['task_day']][$mytask['task_id']]['blog_id'] = $mytask['blog_id']; |
|
| 2391 | + $tasks[$mytask['task_day']][$mytask['task_id']]['blog_name'] = $mytask['blog_name']; |
|
| 2392 | + $tasks[$mytask['task_day']][$mytask['task_id']]['day'] = $mytask['task_day']; |
|
| 2393 | + } |
|
| 2394 | + } |
|
| 2395 | + } |
|
| 2396 | + |
|
| 2397 | + echo '<table id="smallcalendar" class="table table-responsive">', |
|
| 2398 | + "<tr id=\"title\">\n", |
|
| 2399 | + "<th width=\"10%\"><a href=\"", $backwardsURL, "\">«</a></th>\n", |
|
| 2400 | + "<th align=\"center\" width=\"80%\" colspan=\"5\">", $monthName, " ", $year, "</th>\n", |
|
| 2401 | + "<th width=\"10%\" align=\"right\"><a href=\"", $forewardsURL, "\">»</a></th>\n", "</tr>"; |
|
| 2402 | + |
|
| 2403 | + echo "<tr>\n"; |
|
| 2404 | + |
|
| 2405 | + for($ii = 1; $ii < 8; $ii ++) |
|
| 2406 | + echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
| 2407 | + |
|
| 2408 | + echo "</tr>"; |
|
| 2409 | + |
|
| 2410 | + $curday = -1; |
|
| 2411 | + $today = getdate(); |
|
| 2412 | + |
|
| 2413 | + while ($curday <= $numberofdays[$month]) { |
|
| 2414 | + echo "<tr>"; |
|
| 2415 | + for ($ii = 0; $ii < 7; $ii ++) { |
|
| 2416 | + if (($curday == -1) && ($ii == $startdayofweek)) |
|
| 2417 | + $curday = 1; |
|
| 2418 | + |
|
| 2419 | + if (($curday > 0) && ($curday <= $numberofdays[$month])) { |
|
| 2420 | + $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\""; |
|
| 2421 | + $dayheader = "$curday"; |
|
| 2422 | + |
|
| 2423 | + if(($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { |
|
| 2424 | + $dayheader = "$curday"; |
|
| 2425 | + $class = "class=\"days_today\""; |
|
| 2426 | + } |
|
| 2427 | + |
|
| 2428 | + echo "<td " . $class.">"; |
|
| 2429 | + |
|
| 2430 | + // If there are posts on this day, create a filter link. |
|
| 2431 | + if(in_array($curday, $posts)) |
|
| 2432 | + echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
| 2433 | + else |
|
| 2434 | + echo $dayheader; |
|
| 2435 | + |
|
| 2436 | + if (count($tasks) > 0) { |
|
| 2437 | + if (isset($tasks[$curday]) && is_array($tasks[$curday])) { |
|
| 2438 | + // Add tasks to calendar |
|
| 2439 | + foreach ($tasks[$curday] as $task) { |
|
| 2440 | + echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '"> |
|
| 2442 | 2441 | <img src="../img/blog_task.gif" alt="Task" title="' . get_lang('ExecuteThisTask') . '" /></a>'; |
| 2443 | - } |
|
| 2444 | - } |
|
| 2445 | - } |
|
| 2446 | - |
|
| 2447 | - echo "</td>"; |
|
| 2448 | - $curday ++; |
|
| 2449 | - } else |
|
| 2450 | - echo "<td> </td>"; |
|
| 2451 | - } |
|
| 2452 | - echo "</tr>"; |
|
| 2453 | - } |
|
| 2454 | - echo "</table>"; |
|
| 2455 | - } |
|
| 2456 | - |
|
| 2457 | - /** |
|
| 2458 | - * Blog admin | Display the form to add a new blog. |
|
| 2459 | - * |
|
| 2460 | - */ |
|
| 2461 | - public static function display_new_blog_form() |
|
| 2462 | - { |
|
| 2442 | + } |
|
| 2443 | + } |
|
| 2444 | + } |
|
| 2445 | + |
|
| 2446 | + echo "</td>"; |
|
| 2447 | + $curday ++; |
|
| 2448 | + } else |
|
| 2449 | + echo "<td> </td>"; |
|
| 2450 | + } |
|
| 2451 | + echo "</tr>"; |
|
| 2452 | + } |
|
| 2453 | + echo "</table>"; |
|
| 2454 | + } |
|
| 2455 | + |
|
| 2456 | + /** |
|
| 2457 | + * Blog admin | Display the form to add a new blog. |
|
| 2458 | + * |
|
| 2459 | + */ |
|
| 2460 | + public static function display_new_blog_form() |
|
| 2461 | + { |
|
| 2463 | 2462 | $form = new FormValidator('add_blog', 'post', 'blog_admin.php?action=add'); |
| 2464 | 2463 | $form->addElement('header', get_lang('AddBlog')); |
| 2465 | 2464 | $form->addElement('text', 'blog_name', get_lang('Title')); |
@@ -2469,34 +2468,34 @@ discard block |
||
| 2469 | 2468 | $form->addButtonSave(get_lang('SaveProject')); |
| 2470 | 2469 | |
| 2471 | 2470 | $defaults = array( |
| 2472 | - 'blog_name' => isset($_POST['blog_name']) ? Security::remove_XSS($_POST['blog_name']) : null, |
|
| 2473 | - 'blog_subtitle' => isset($_POST['blog_subtitle']) ? Security::remove_XSS($_POST['blog_subtitle']) : null |
|
| 2474 | - ); |
|
| 2471 | + 'blog_name' => isset($_POST['blog_name']) ? Security::remove_XSS($_POST['blog_name']) : null, |
|
| 2472 | + 'blog_subtitle' => isset($_POST['blog_subtitle']) ? Security::remove_XSS($_POST['blog_subtitle']) : null |
|
| 2473 | + ); |
|
| 2475 | 2474 | $form->setDefaults($defaults); |
| 2476 | 2475 | $form->display(); |
| 2477 | - } |
|
| 2478 | - |
|
| 2479 | - /** |
|
| 2480 | - * Blog admin | Display the form to edit a blog. |
|
| 2481 | - * |
|
| 2482 | - */ |
|
| 2483 | - public static function display_edit_blog_form($blog_id) |
|
| 2484 | - { |
|
| 2485 | - $course_id = api_get_course_int_id(); |
|
| 2486 | - $blog_id= intval($blog_id); |
|
| 2487 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2488 | - |
|
| 2489 | - $sql = "SELECT blog_id, blog_name, blog_subtitle |
|
| 2476 | + } |
|
| 2477 | + |
|
| 2478 | + /** |
|
| 2479 | + * Blog admin | Display the form to edit a blog. |
|
| 2480 | + * |
|
| 2481 | + */ |
|
| 2482 | + public static function display_edit_blog_form($blog_id) |
|
| 2483 | + { |
|
| 2484 | + $course_id = api_get_course_int_id(); |
|
| 2485 | + $blog_id= intval($blog_id); |
|
| 2486 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2487 | + |
|
| 2488 | + $sql = "SELECT blog_id, blog_name, blog_subtitle |
|
| 2490 | 2489 | FROM $tbl_blogs |
| 2491 | 2490 | WHERE c_id = $course_id AND blog_id = '".$blog_id."'"; |
| 2492 | - $result = Database::query($sql); |
|
| 2493 | - $blog = Database::fetch_array($result); |
|
| 2491 | + $result = Database::query($sql); |
|
| 2492 | + $blog = Database::fetch_array($result); |
|
| 2494 | 2493 | |
| 2495 | - // the form contained errors but we do not want to lose the changes the user already did |
|
| 2496 | - if ($_POST) { |
|
| 2497 | - $blog['blog_name'] = Security::remove_XSS($_POST['blog_name']); |
|
| 2498 | - $blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']); |
|
| 2499 | - } |
|
| 2494 | + // the form contained errors but we do not want to lose the changes the user already did |
|
| 2495 | + if ($_POST) { |
|
| 2496 | + $blog['blog_name'] = Security::remove_XSS($_POST['blog_name']); |
|
| 2497 | + $blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']); |
|
| 2498 | + } |
|
| 2500 | 2499 | |
| 2501 | 2500 | $form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id'])); |
| 2502 | 2501 | $form->addElement('header', get_lang('EditBlog')); |
@@ -2512,82 +2511,82 @@ discard block |
||
| 2512 | 2511 | $defaults['blog_subtitle'] = $blog['blog_subtitle']; |
| 2513 | 2512 | $form->setDefaults($defaults); |
| 2514 | 2513 | $form->display(); |
| 2515 | - } |
|
| 2514 | + } |
|
| 2516 | 2515 | |
| 2517 | - /** |
|
| 2518 | - * Blog admin | Returns table with blogs in this course |
|
| 2519 | - */ |
|
| 2520 | - public static function display_blog_list() |
|
| 2516 | + /** |
|
| 2517 | + * Blog admin | Returns table with blogs in this course |
|
| 2518 | + */ |
|
| 2519 | + public static function display_blog_list() |
|
| 2521 | 2520 | { |
| 2522 | - global $charset; |
|
| 2523 | - $_user = api_get_user_info(); |
|
| 2521 | + global $charset; |
|
| 2522 | + $_user = api_get_user_info(); |
|
| 2524 | 2523 | $course_id = api_get_course_int_id(); |
| 2525 | 2524 | |
| 2526 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2525 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2527 | 2526 | |
| 2528 | - //condition for the session |
|
| 2529 | - $session_id = api_get_session_id(); |
|
| 2530 | - $condition_session = api_get_session_condition($session_id, false); |
|
| 2527 | + //condition for the session |
|
| 2528 | + $session_id = api_get_session_id(); |
|
| 2529 | + $condition_session = api_get_session_condition($session_id, false); |
|
| 2531 | 2530 | |
| 2532 | - $sql = "SELECT blog_name, blog_subtitle, visibility, blog_id, session_id |
|
| 2531 | + $sql = "SELECT blog_name, blog_subtitle, visibility, blog_id, session_id |
|
| 2533 | 2532 | FROM $tbl_blogs WHERE c_id = $course_id |
| 2534 | 2533 | ORDER BY date_creation DESC"; |
| 2535 | - $result = Database::query($sql); |
|
| 2536 | - $list_info = array(); |
|
| 2537 | - if (Database::num_rows($result)) { |
|
| 2538 | - while ($row_project=Database::fetch_row($result)) { |
|
| 2539 | - $list_info[]=$row_project; |
|
| 2540 | - } |
|
| 2541 | - } |
|
| 2542 | - |
|
| 2543 | - $list_content_blog = array(); |
|
| 2544 | - $list_body_blog = array(); |
|
| 2545 | - |
|
| 2546 | - if (is_array($list_info)) { |
|
| 2547 | - foreach ($list_info as $key => $info_log) { |
|
| 2548 | - // Validation when belongs to a session |
|
| 2549 | - $session_img = api_get_session_image($info_log[4], $_user['status']); |
|
| 2550 | - |
|
| 2551 | - $url_start_blog = 'blog.php' ."?". "blog_id=".$info_log[3]. "&".api_get_cidreq(); |
|
| 2552 | - $title = $info_log[0]; |
|
| 2534 | + $result = Database::query($sql); |
|
| 2535 | + $list_info = array(); |
|
| 2536 | + if (Database::num_rows($result)) { |
|
| 2537 | + while ($row_project=Database::fetch_row($result)) { |
|
| 2538 | + $list_info[]=$row_project; |
|
| 2539 | + } |
|
| 2540 | + } |
|
| 2541 | + |
|
| 2542 | + $list_content_blog = array(); |
|
| 2543 | + $list_body_blog = array(); |
|
| 2544 | + |
|
| 2545 | + if (is_array($list_info)) { |
|
| 2546 | + foreach ($list_info as $key => $info_log) { |
|
| 2547 | + // Validation when belongs to a session |
|
| 2548 | + $session_img = api_get_session_image($info_log[4], $_user['status']); |
|
| 2549 | + |
|
| 2550 | + $url_start_blog = 'blog.php' ."?". "blog_id=".$info_log[3]. "&".api_get_cidreq(); |
|
| 2551 | + $title = $info_log[0]; |
|
| 2553 | 2552 | $image = Display::return_icon('blog.png', $title); |
| 2554 | - $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">' . $image . '</a></div><a href="'.$url_start_blog.'">' .$title. '</a>' . $session_img; |
|
| 2553 | + $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">' . $image . '</a></div><a href="'.$url_start_blog.'">' .$title. '</a>' . $session_img; |
|
| 2555 | 2554 | |
| 2556 | - $list_body_blog[] = $list_name; |
|
| 2557 | - $list_body_blog[] = $info_log[1]; |
|
| 2555 | + $list_body_blog[] = $list_name; |
|
| 2556 | + $list_body_blog[] = $info_log[1]; |
|
| 2558 | 2557 | |
| 2559 | - $visibility_icon=($info_log[2]==0) ? 'invisible' : 'visible'; |
|
| 2560 | - $visibility_info=($info_log[2]==0) ? 'Visible' : 'Invisible'; |
|
| 2561 | - $my_image = '<a href="' .api_get_self(). '?action=edit&blog_id=' . $info_log[3] . '">'; |
|
| 2558 | + $visibility_icon=($info_log[2]==0) ? 'invisible' : 'visible'; |
|
| 2559 | + $visibility_info=($info_log[2]==0) ? 'Visible' : 'Invisible'; |
|
| 2560 | + $my_image = '<a href="' .api_get_self(). '?action=edit&blog_id=' . $info_log[3] . '">'; |
|
| 2562 | 2561 | $my_image.= Display::return_icon('edit.png', get_lang('EditBlog')); |
| 2563 | 2562 | |
| 2564 | - $my_image.= "</a>\n"; |
|
| 2565 | - $my_image.= '<a href="' .api_get_self(). '?action=delete&blog_id=' . $info_log[3] . '" '; |
|
| 2566 | - $my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >'; |
|
| 2563 | + $my_image.= "</a>\n"; |
|
| 2564 | + $my_image.= '<a href="' .api_get_self(). '?action=delete&blog_id=' . $info_log[3] . '" '; |
|
| 2565 | + $my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >'; |
|
| 2567 | 2566 | $my_image.= Display::return_icon('delete.png', get_lang('DeleteBlog')); |
| 2568 | 2567 | |
| 2569 | - $my_image.= "</a>\n"; |
|
| 2570 | - $my_image.= '<a href="' .api_get_self(). '?action=visibility&blog_id=' . $info_log[3] . '">'; |
|
| 2568 | + $my_image.= "</a>\n"; |
|
| 2569 | + $my_image.= '<a href="' .api_get_self(). '?action=visibility&blog_id=' . $info_log[3] . '">'; |
|
| 2571 | 2570 | $my_image.= Display::return_icon($visibility_icon . '.gif', get_lang($visibility_info)); |
| 2572 | 2571 | |
| 2573 | - $my_image.= "</a>\n"; |
|
| 2572 | + $my_image.= "</a>\n"; |
|
| 2574 | 2573 | |
| 2575 | - $list_body_blog[]=$my_image; |
|
| 2574 | + $list_body_blog[]=$my_image; |
|
| 2576 | 2575 | |
| 2577 | - $list_content_blog[]=$list_body_blog; |
|
| 2578 | - $list_body_blog = array(); |
|
| 2576 | + $list_content_blog[]=$list_body_blog; |
|
| 2577 | + $list_body_blog = array(); |
|
| 2579 | 2578 | |
| 2580 | - } |
|
| 2581 | - $parameters=''; |
|
| 2582 | - //$parameters=array('action'=>Security::remove_XSS($_GET['action'])); |
|
| 2583 | - $table = new SortableTableFromArrayConfig($list_content_blog, 1,20,'project'); |
|
| 2584 | - //$table->set_additional_parameters($parameters); |
|
| 2585 | - $table->set_header(0, get_lang('Title')); |
|
| 2586 | - $table->set_header(1, get_lang('SubTitle')); |
|
| 2587 | - $table->set_header(2, get_lang('Modify')); |
|
| 2588 | - $table->display(); |
|
| 2589 | - } |
|
| 2590 | - } |
|
| 2579 | + } |
|
| 2580 | + $parameters=''; |
|
| 2581 | + //$parameters=array('action'=>Security::remove_XSS($_GET['action'])); |
|
| 2582 | + $table = new SortableTableFromArrayConfig($list_content_blog, 1,20,'project'); |
|
| 2583 | + //$table->set_additional_parameters($parameters); |
|
| 2584 | + $table->set_header(0, get_lang('Title')); |
|
| 2585 | + $table->set_header(1, get_lang('SubTitle')); |
|
| 2586 | + $table->set_header(2, get_lang('Modify')); |
|
| 2587 | + $table->display(); |
|
| 2588 | + } |
|
| 2589 | + } |
|
| 2591 | 2590 | } |
| 2592 | 2591 | |
| 2593 | 2592 | /** |
@@ -2607,34 +2606,34 @@ discard block |
||
| 2607 | 2606 | */ |
| 2608 | 2607 | function get_blog_attachment($blog_id, $post_id=null,$comment_id=null) |
| 2609 | 2608 | { |
| 2610 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 2611 | - |
|
| 2612 | - $blog_id = intval($blog_id); |
|
| 2613 | - $comment_id = intval($comment_id); |
|
| 2614 | - $post_id = intval($post_id); |
|
| 2615 | - $row=array(); |
|
| 2616 | - $where=''; |
|
| 2617 | - if (!empty ($post_id) && is_numeric($post_id)) { |
|
| 2618 | - $where.=' AND post_id ="'.$post_id.'" '; |
|
| 2619 | - } |
|
| 2620 | - |
|
| 2621 | - if (!empty ($comment_id) && is_numeric($comment_id)) { |
|
| 2622 | - if (!empty ($post_id)) { |
|
| 2623 | - $where.= ' AND '; |
|
| 2624 | - } |
|
| 2625 | - $where.=' comment_id ="'.$comment_id.'" '; |
|
| 2626 | - } |
|
| 2609 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 2610 | + |
|
| 2611 | + $blog_id = intval($blog_id); |
|
| 2612 | + $comment_id = intval($comment_id); |
|
| 2613 | + $post_id = intval($post_id); |
|
| 2614 | + $row=array(); |
|
| 2615 | + $where=''; |
|
| 2616 | + if (!empty ($post_id) && is_numeric($post_id)) { |
|
| 2617 | + $where.=' AND post_id ="'.$post_id.'" '; |
|
| 2618 | + } |
|
| 2619 | + |
|
| 2620 | + if (!empty ($comment_id) && is_numeric($comment_id)) { |
|
| 2621 | + if (!empty ($post_id)) { |
|
| 2622 | + $where.= ' AND '; |
|
| 2623 | + } |
|
| 2624 | + $where.=' comment_id ="'.$comment_id.'" '; |
|
| 2625 | + } |
|
| 2627 | 2626 | |
| 2628 | 2627 | $course_id = api_get_course_int_id(); |
| 2629 | 2628 | |
| 2630 | - $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
| 2629 | + $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
| 2631 | 2630 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
| 2632 | 2631 | |
| 2633 | - $result=Database::query($sql); |
|
| 2634 | - if (Database::num_rows($result)!=0) { |
|
| 2635 | - $row=Database::fetch_array($result); |
|
| 2636 | - } |
|
| 2637 | - return $row; |
|
| 2632 | + $result=Database::query($sql); |
|
| 2633 | + if (Database::num_rows($result)!=0) { |
|
| 2634 | + $row=Database::fetch_array($result); |
|
| 2635 | + } |
|
| 2636 | + return $row; |
|
| 2638 | 2637 | } |
| 2639 | 2638 | |
| 2640 | 2639 | /** |
@@ -2648,16 +2647,16 @@ discard block |
||
| 2648 | 2647 | |
| 2649 | 2648 | function delete_all_blog_attachment($blog_id,$post_id=null,$comment_id=null) |
| 2650 | 2649 | { |
| 2651 | - $_course = api_get_course_info(); |
|
| 2652 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 2653 | - $blog_id = intval($blog_id); |
|
| 2654 | - $comment_id = intval($comment_id); |
|
| 2655 | - $post_id = intval($post_id); |
|
| 2650 | + $_course = api_get_course_info(); |
|
| 2651 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 2652 | + $blog_id = intval($blog_id); |
|
| 2653 | + $comment_id = intval($comment_id); |
|
| 2654 | + $post_id = intval($post_id); |
|
| 2656 | 2655 | |
| 2657 | 2656 | $course_id = api_get_course_int_id(); |
| 2658 | - $where = null; |
|
| 2657 | + $where = null; |
|
| 2659 | 2658 | |
| 2660 | - // delete files in DB |
|
| 2659 | + // delete files in DB |
|
| 2661 | 2660 | if (!empty ($post_id) && is_numeric($post_id)) { |
| 2662 | 2661 | $where .= ' AND post_id ="'.$post_id.'" '; |
| 2663 | 2662 | } |
@@ -2669,25 +2668,25 @@ discard block |
||
| 2669 | 2668 | $where .= ' comment_id ="'.$comment_id.'" '; |
| 2670 | 2669 | } |
| 2671 | 2670 | |
| 2672 | - // delete all files in directory |
|
| 2673 | - $courseDir = $_course['path'].'/upload/blog'; |
|
| 2674 | - $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
| 2675 | - $updir = $sys_course_path.$courseDir; |
|
| 2671 | + // delete all files in directory |
|
| 2672 | + $courseDir = $_course['path'].'/upload/blog'; |
|
| 2673 | + $sys_course_path = api_get_path(SYS_COURSE_PATH); |
|
| 2674 | + $updir = $sys_course_path.$courseDir; |
|
| 2676 | 2675 | |
| 2677 | - $sql = 'SELECT path FROM '.$blog_table_attachment.' |
|
| 2676 | + $sql = 'SELECT path FROM '.$blog_table_attachment.' |
|
| 2678 | 2677 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
| 2679 | - $result=Database::query($sql); |
|
| 2680 | - |
|
| 2681 | - while ($row=Database::fetch_row($result)) { |
|
| 2682 | - $file=$updir.'/'.$row[0]; |
|
| 2683 | - if (Security::check_abs_path($file,$updir) ) |
|
| 2684 | - { |
|
| 2685 | - @ unlink($file); |
|
| 2686 | - } |
|
| 2687 | - } |
|
| 2688 | - $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
| 2678 | + $result=Database::query($sql); |
|
| 2679 | + |
|
| 2680 | + while ($row=Database::fetch_row($result)) { |
|
| 2681 | + $file=$updir.'/'.$row[0]; |
|
| 2682 | + if (Security::check_abs_path($file,$updir) ) |
|
| 2683 | + { |
|
| 2684 | + @ unlink($file); |
|
| 2685 | + } |
|
| 2686 | + } |
|
| 2687 | + $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
| 2689 | 2688 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
| 2690 | - Database::query($sql); |
|
| 2689 | + Database::query($sql); |
|
| 2691 | 2690 | } |
| 2692 | 2691 | |
| 2693 | 2692 | /** |
@@ -2697,12 +2696,12 @@ discard block |
||
| 2697 | 2696 | */ |
| 2698 | 2697 | function get_blog_post_from_user($course_code, $user_id) |
| 2699 | 2698 | { |
| 2700 | - $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2701 | - $tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 2702 | - $course_info = api_get_course_info($course_code); |
|
| 2703 | - $course_id = $course_info['real_id']; |
|
| 2699 | + $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
|
| 2700 | + $tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 2701 | + $course_info = api_get_course_info($course_code); |
|
| 2702 | + $course_id = $course_info['real_id']; |
|
| 2704 | 2703 | |
| 2705 | - $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation |
|
| 2704 | + $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation |
|
| 2706 | 2705 | FROM $tbl_blogs blog |
| 2707 | 2706 | INNER JOIN $tbl_blog_post post |
| 2708 | 2707 | ON (blog.blog_id = post.blog_id) |
@@ -2711,19 +2710,19 @@ discard block |
||
| 2711 | 2710 | post.c_id = $course_id AND |
| 2712 | 2711 | author_id = $user_id AND visibility = 1 |
| 2713 | 2712 | ORDER BY post.date_creation DESC "; |
| 2714 | - $result = Database::query($sql); |
|
| 2715 | - $return_data = ''; |
|
| 2716 | - |
|
| 2717 | - if (Database::num_rows($result)!=0) { |
|
| 2718 | - while ($row=Database::fetch_array($result)) { |
|
| 2719 | - $return_data.= '<div class="clear"></div><br />'; |
|
| 2720 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2721 | - $return_data.= '<br / >'; |
|
| 2722 | - $return_data.= $row['full_text']; |
|
| 2723 | - $return_data.= '<br /><br />'; |
|
| 2724 | - } |
|
| 2725 | - } |
|
| 2726 | - return $return_data; |
|
| 2713 | + $result = Database::query($sql); |
|
| 2714 | + $return_data = ''; |
|
| 2715 | + |
|
| 2716 | + if (Database::num_rows($result)!=0) { |
|
| 2717 | + while ($row=Database::fetch_array($result)) { |
|
| 2718 | + $return_data.= '<div class="clear"></div><br />'; |
|
| 2719 | + $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2720 | + $return_data.= '<br / >'; |
|
| 2721 | + $return_data.= $row['full_text']; |
|
| 2722 | + $return_data.= '<br /><br />'; |
|
| 2723 | + } |
|
| 2724 | + } |
|
| 2725 | + return $return_data; |
|
| 2727 | 2726 | } |
| 2728 | 2727 | |
| 2729 | 2728 | /** |
@@ -2740,7 +2739,7 @@ discard block |
||
| 2740 | 2739 | $course_info = api_get_course_info($course_code); |
| 2741 | 2740 | $course_id = $course_info['real_id']; |
| 2742 | 2741 | |
| 2743 | - $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation |
|
| 2742 | + $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation |
|
| 2744 | 2743 | FROM $tbl_blogs blog INNER JOIN $tbl_blog_comment comment |
| 2745 | 2744 | ON (blog.blog_id = comment.blog_id) |
| 2746 | 2745 | WHERE blog.c_id = $course_id AND |
@@ -2748,18 +2747,18 @@ discard block |
||
| 2748 | 2747 | author_id = $user_id AND |
| 2749 | 2748 | visibility = 1 |
| 2750 | 2749 | ORDER BY blog_name"; |
| 2751 | - $result = Database::query($sql); |
|
| 2752 | - $return_data = ''; |
|
| 2753 | - if (Database::num_rows($result)!=0) { |
|
| 2754 | - while ($row=Database::fetch_array($result)) { |
|
| 2755 | - $return_data.= '<div class="clear"></div><br />'; |
|
| 2756 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2757 | - $return_data.= '<br / >'; |
|
| 2758 | - //$return_data.= '<strong>'.$row['title'].'</strong>'; echo '<br>';*/ |
|
| 2759 | - $return_data.= $row['comment']; |
|
| 2760 | - $return_data.= '<br />'; |
|
| 2761 | - } |
|
| 2762 | - } |
|
| 2763 | - return $return_data; |
|
| 2750 | + $result = Database::query($sql); |
|
| 2751 | + $return_data = ''; |
|
| 2752 | + if (Database::num_rows($result)!=0) { |
|
| 2753 | + while ($row=Database::fetch_array($result)) { |
|
| 2754 | + $return_data.= '<div class="clear"></div><br />'; |
|
| 2755 | + $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2756 | + $return_data.= '<br / >'; |
|
| 2757 | + //$return_data.= '<strong>'.$row['title'].'</strong>'; echo '<br>';*/ |
|
| 2758 | + $return_data.= $row['comment']; |
|
| 2759 | + $return_data.= '<br />'; |
|
| 2760 | + } |
|
| 2761 | + } |
|
| 2762 | + return $return_data; |
|
| 2764 | 2763 | } |
| 2765 | 2764 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return String Blog Title |
| 23 | 23 | */ |
| 24 | - public static function get_blog_title ($blog_id) |
|
| 24 | + public static function get_blog_title($blog_id) |
|
| 25 | 25 | { |
| 26 | 26 | $course_id = api_get_course_int_id(); |
| 27 | 27 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
| 31 | 31 | |
| 32 | 32 | $sql = "SELECT blog_name |
| 33 | - FROM " . $tbl_blogs . " |
|
| 34 | - WHERE c_id = $course_id AND blog_id = " . intval($blog_id); |
|
| 33 | + FROM " . $tbl_blogs." |
|
| 34 | + WHERE c_id = $course_id AND blog_id = ".intval($blog_id); |
|
| 35 | 35 | |
| 36 | 36 | $result = Database::query($sql); |
| 37 | 37 | $blog = Database::fetch_array($result); |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | // Get blog members |
| 80 | 80 | $sql = "SELECT user.user_id, user.firstname, user.lastname |
| 81 | - FROM " . $tbl_blogs_rel_user . " blogs_rel_user |
|
| 82 | - INNER JOIN " . $tbl_users . " user |
|
| 81 | + FROM " . $tbl_blogs_rel_user." blogs_rel_user |
|
| 82 | + INNER JOIN " . $tbl_users." user |
|
| 83 | 83 | ON blogs_rel_user.user_id = user.user_id |
| 84 | 84 | WHERE |
| 85 | 85 | blogs_rel_user.c_id = $course_id AND |
| 86 | - blogs_rel_user.blog_id = '" . (int)$blog_id."'"; |
|
| 86 | + blogs_rel_user.blog_id = '".(int) $blog_id."'"; |
|
| 87 | 87 | $result = Database::query($sql); |
| 88 | - $blog_members = array (); |
|
| 89 | - while($user = Database::fetch_array($result)) { |
|
| 88 | + $blog_members = array(); |
|
| 89 | + while ($user = Database::fetch_array($result)) { |
|
| 90 | 90 | $blog_members[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $_user = api_get_user_info(); |
| 106 | 106 | $course_id = api_get_course_int_id(); |
| 107 | 107 | |
| 108 | - $current_date=date('Y-m-d H:i:s',time()); |
|
| 108 | + $current_date = date('Y-m-d H:i:s', time()); |
|
| 109 | 109 | $session_id = api_get_session_id(); |
| 110 | 110 | // Tabel definitions |
| 111 | 111 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | 'blog_name' => $title, |
| 131 | 131 | 'blog_subtitle' => $subtitle, |
| 132 | 132 | 'date_creation' => $current_date, |
| 133 | - 'visibility' => 1 , |
|
| 133 | + 'visibility' => 1, |
|
| 134 | 134 | 'session_id' => $session_id, |
| 135 | 135 | ]; |
| 136 | 136 | $this_blog_id = Database::insert($tbl_blogs, $params); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | // Put it on course homepage |
| 171 | 171 | $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, session_id) |
| 172 | - VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int)$this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id')"; |
|
| 172 | + VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int) $this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id')"; |
|
| 173 | 173 | Database::query($sql); |
| 174 | 174 | |
| 175 | 175 | $toolId = Database::insert_id(); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | blog_subtitle = '".Database::escape_string($subtitle)."' |
| 205 | 205 | WHERE |
| 206 | 206 | c_id = $course_id AND |
| 207 | - blog_id ='".Database::escape_string((int)$blog_id)."' |
|
| 207 | + blog_id ='".Database::escape_string((int) $blog_id)."' |
|
| 208 | 208 | LIMIT 1"; |
| 209 | 209 | Database::query($sql); |
| 210 | 210 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | // Update course homepage link |
| 221 | 221 | $sql = "UPDATE $tbl_tool SET |
| 222 | 222 | name = '".Database::escape_string($title)."' |
| 223 | - WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int)$blog_id."' LIMIT 1"; |
|
| 223 | + WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int) $blog_id."' LIMIT 1"; |
|
| 224 | 224 | Database::query($sql); |
| 225 | 225 | } |
| 226 | 226 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | Database::query($sql); |
| 264 | 264 | |
| 265 | 265 | // Delete blog |
| 266 | - $sql ="DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 266 | + $sql = "DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'"; |
|
| 267 | 267 | Database::query($sql); |
| 268 | 268 | |
| 269 | 269 | // Delete from course homepage |
@@ -294,13 +294,13 @@ discard block |
||
| 294 | 294 | $course_id = $_course['real_id']; |
| 295 | 295 | |
| 296 | 296 | $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
| 297 | - $upload_ok=true; |
|
| 298 | - $has_attachment=false; |
|
| 297 | + $upload_ok = true; |
|
| 298 | + $has_attachment = false; |
|
| 299 | 299 | $current_date = api_get_utc_datetime(); |
| 300 | 300 | |
| 301 | 301 | if (!empty($_FILES['user_upload']['name'])) { |
| 302 | 302 | $upload_ok = process_uploaded_file($_FILES['user_upload']); |
| 303 | - $has_attachment=true; |
|
| 303 | + $has_attachment = true; |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | if ($upload_ok) { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | // Create the post |
| 311 | 311 | $sql = "INSERT INTO $tbl_blogs_posts (c_id, title, full_text, date_creation, blog_id, author_id ) |
| 312 | - VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int)$blog_id."', '".(int)$_user['user_id']."');"; |
|
| 312 | + VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int) $blog_id."', '".(int) $_user['user_id']."');"; |
|
| 313 | 313 | |
| 314 | 314 | Database::query($sql); |
| 315 | 315 | $last_post_id = Database::insert_id(); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | if ($has_attachment) { |
| 323 | - $courseDir = $_course['path'].'/upload/blog'; |
|
| 323 | + $courseDir = $_course['path'].'/upload/blog'; |
|
| 324 | 324 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 325 | 325 | $updir = $sys_course_path.$courseDir; |
| 326 | 326 | |
@@ -371,9 +371,9 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | // Create the post |
| 373 | 373 | $sql = "UPDATE $tbl_blogs_posts SET |
| 374 | - title = '" . Database::escape_string($title)."', |
|
| 374 | + title = '".Database::escape_string($title)."', |
|
| 375 | 375 | full_text = '" . Database::escape_string($full_text)."' |
| 376 | - WHERE c_id = $course_id AND post_id ='".(int)$post_id."' AND blog_id ='".(int)$blog_id."' |
|
| 376 | + WHERE c_id = $course_id AND post_id ='".(int) $post_id."' AND blog_id ='".(int) $blog_id."' |
|
| 377 | 377 | LIMIT 1 "; |
| 378 | 378 | Database::query($sql); |
| 379 | 379 | } |
@@ -394,21 +394,21 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | // Delete ratings on this comment |
| 396 | 396 | $sql = "DELETE FROM $tbl_blogs_rating |
| 397 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND item_id = '".(int)$post_id."' AND rating_type = 'post'"; |
|
| 397 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND item_id = '".(int) $post_id."' AND rating_type = 'post'"; |
|
| 398 | 398 | Database::query($sql); |
| 399 | 399 | |
| 400 | 400 | // Delete the post |
| 401 | 401 | $sql = "DELETE FROM $tbl_blogs_posts |
| 402 | - WHERE c_id = $course_id AND post_id = '".(int)$post_id."'"; |
|
| 402 | + WHERE c_id = $course_id AND post_id = '".(int) $post_id."'"; |
|
| 403 | 403 | Database::query($sql); |
| 404 | 404 | |
| 405 | 405 | // Delete the comments |
| 406 | 406 | $sql = "DELETE FROM $tbl_blogs_comments |
| 407 | - WHERE c_id = $course_id AND post_id = '".(int)$post_id."' AND blog_id = '".(int)$blog_id."'"; |
|
| 407 | + WHERE c_id = $course_id AND post_id = '".(int) $post_id."' AND blog_id = '".(int) $blog_id."'"; |
|
| 408 | 408 | Database::query($sql); |
| 409 | 409 | |
| 410 | 410 | // Delete posts and attachments |
| 411 | - delete_all_blog_attachment($blog_id,$post_id); |
|
| 411 | + delete_all_blog_attachment($blog_id, $post_id); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | { |
| 425 | 425 | $_user = api_get_user_info(); |
| 426 | 426 | $_course = api_get_course_info(); |
| 427 | - $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 427 | + $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 428 | 428 | |
| 429 | 429 | $upload_ok = true; |
| 430 | 430 | $has_attachment = false; |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | if (!empty($_FILES['user_upload']['name'])) { |
| 435 | 435 | $upload_ok = process_uploaded_file($_FILES['user_upload']); |
| 436 | - $has_attachment=true; |
|
| 436 | + $has_attachment = true; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | if ($upload_ok) { |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | // Create the comment |
| 444 | 444 | $sql = "INSERT INTO $tbl_blogs_comments (c_id, title, comment, author_id, date_creation, blog_id, post_id, parent_comment_id, task_id ) |
| 445 | - VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int)$_user['user_id']."','".$current_date."', '".(int)$blog_id."', '".(int)$post_id."', '".(int)$parent_id."', '".(int)$task_id."')"; |
|
| 445 | + VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int) $_user['user_id']."','".$current_date."', '".(int) $blog_id."', '".(int) $post_id."', '".(int) $parent_id."', '".(int) $task_id."')"; |
|
| 446 | 446 | Database::query($sql); |
| 447 | 447 | |
| 448 | 448 | // Empty post values, or they are shown on the page again |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | if ($has_attachment) { |
| 457 | - $courseDir = $_course['path'].'/upload/blog'; |
|
| 457 | + $courseDir = $_course['path'].'/upload/blog'; |
|
| 458 | 458 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 459 | 459 | $updir = $sys_course_path.$courseDir; |
| 460 | 460 | |
@@ -465,19 +465,19 @@ discard block |
||
| 465 | 465 | ); |
| 466 | 466 | |
| 467 | 467 | // user's file name |
| 468 | - $file_name =$_FILES['user_upload']['name']; |
|
| 468 | + $file_name = $_FILES['user_upload']['name']; |
|
| 469 | 469 | |
| 470 | 470 | if (!filter_extension($new_file_name)) { |
| 471 | 471 | Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')); |
| 472 | 472 | } else { |
| 473 | 473 | $new_file_name = uniqid(''); |
| 474 | - $new_path=$updir.'/'.$new_file_name; |
|
| 475 | - $result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
| 474 | + $new_path = $updir.'/'.$new_file_name; |
|
| 475 | + $result = @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path); |
|
| 476 | 476 | $comment = Database::escape_string($file_comment); |
| 477 | 477 | |
| 478 | 478 | // Storing the attachments if any |
| 479 | 479 | if ($result) { |
| 480 | - $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
|
| 480 | + $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '. |
|
| 481 | 481 | "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )"; |
| 482 | 482 | Database::query($sql); |
| 483 | 483 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | // Delete them recursively |
| 528 | 528 | while ($comment = Database::fetch_array($result)) { |
| 529 | - Blog::delete_comment($blog_id,$post_id,$comment['comment_id']); |
|
| 529 | + Blog::delete_comment($blog_id, $post_id, $comment['comment_id']); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | // Finally, delete the selected comment to |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | // Create the task |
| 555 | 555 | $sql = "INSERT INTO $tbl_blogs_tasks (c_id, blog_id, title, description, color, system_task) |
| 556 | - VALUES ($course_id , '".(int)$blog_id."', '" . Database::escape_string($title)."', '" . Database::escape_string($description)."', '" . Database::escape_string($color)."', '0');"; |
|
| 556 | + VALUES ($course_id , '".(int) $blog_id."', '".Database::escape_string($title)."', '".Database::escape_string($description)."', '".Database::escape_string($color)."', '0');"; |
|
| 557 | 557 | Database::query($sql); |
| 558 | 558 | |
| 559 | 559 | $task_id = Database::insert_id(); |
@@ -563,13 +563,13 @@ discard block |
||
| 563 | 563 | Database::query($sql); |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - $tool = 'BLOG_' . $blog_id; |
|
| 566 | + $tool = 'BLOG_'.$blog_id; |
|
| 567 | 567 | |
| 568 | 568 | if ($articleDelete == 'on') { |
| 569 | - $sql = " INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
| 570 | - '" . (int)$course_id . "', |
|
| 571 | - '" . (int)$task_id . "', |
|
| 572 | - '" . Database::escape_string($tool) . "', |
|
| 569 | + $sql = " INSERT INTO ".$tbl_tasks_permissions." ( c_id, task_id, tool, action) VALUES ( |
|
| 570 | + '" . (int) $course_id."', |
|
| 571 | + '" . (int) $task_id."', |
|
| 572 | + '" . Database::escape_string($tool)."', |
|
| 573 | 573 | 'article_delete' |
| 574 | 574 | )"; |
| 575 | 575 | Database::query($sql); |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | if ($articleEdit == 'on') { |
| 586 | 586 | $sql = " |
| 587 | - INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES ( |
|
| 588 | - '" . (int)$course_id . "', |
|
| 589 | - '" . (int)$task_id . "', |
|
| 590 | - '" . Database::escape_string($tool) . "', |
|
| 587 | + INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES ( |
|
| 588 | + '" . (int) $course_id."', |
|
| 589 | + '" . (int) $task_id."', |
|
| 590 | + '" . Database::escape_string($tool)."', |
|
| 591 | 591 | 'article_edit' |
| 592 | 592 | )"; |
| 593 | 593 | Database::query($sql); |
@@ -601,10 +601,10 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | if ($commentsDelete == 'on') { |
| 603 | 603 | $sql = " |
| 604 | - INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES ( |
|
| 605 | - '" . (int)$course_id . "', |
|
| 606 | - '" . (int)$task_id . "', |
|
| 607 | - '" . Database::escape_string($tool) . "', |
|
| 604 | + INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES ( |
|
| 605 | + '" . (int) $course_id."', |
|
| 606 | + '" . (int) $task_id."', |
|
| 607 | + '" . Database::escape_string($tool)."', |
|
| 608 | 608 | 'article_comments_delete' |
| 609 | 609 | )"; |
| 610 | 610 | Database::query($sql); |
@@ -637,20 +637,20 @@ discard block |
||
| 637 | 637 | title = '".Database::escape_string($title)."', |
| 638 | 638 | description = '".Database::escape_string($description)."', |
| 639 | 639 | color = '".Database::escape_string($color)."' |
| 640 | - WHERE c_id = $course_id AND task_id ='".(int)$task_id."' LIMIT 1"; |
|
| 640 | + WHERE c_id = $course_id AND task_id ='".(int) $task_id."' LIMIT 1"; |
|
| 641 | 641 | Database::query($sql); |
| 642 | 642 | |
| 643 | - $tool = 'BLOG_' . $blog_id; |
|
| 643 | + $tool = 'BLOG_'.$blog_id; |
|
| 644 | 644 | |
| 645 | - $sql = "DELETE FROM " . $tbl_tasks_permissions . " |
|
| 646 | - WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'"; |
|
| 645 | + $sql = "DELETE FROM ".$tbl_tasks_permissions." |
|
| 646 | + WHERE c_id = $course_id AND task_id = '".(int) $task_id."'"; |
|
| 647 | 647 | Database::query($sql); |
| 648 | 648 | |
| 649 | 649 | if ($articleDelete == 'on') { |
| 650 | - $sql = "INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES ( |
|
| 651 | - '" . (int)$course_id . "', |
|
| 652 | - '" . (int)$task_id . "', |
|
| 653 | - '" . Database::escape_string($tool) . "', |
|
| 650 | + $sql = "INSERT INTO ".$tbl_tasks_permissions." ( c_id, task_id, tool, action) VALUES ( |
|
| 651 | + '" . (int) $course_id."', |
|
| 652 | + '" . (int) $task_id."', |
|
| 653 | + '" . Database::escape_string($tool)."', |
|
| 654 | 654 | 'article_delete' |
| 655 | 655 | )"; |
| 656 | 656 | Database::query($sql); |
@@ -663,10 +663,10 @@ discard block |
||
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | if ($articleEdit == 'on') { |
| 666 | - $sql = "INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
| 667 | - '" . (int)$course_id . "', |
|
| 668 | - '" . (int)$task_id . "', |
|
| 669 | - '" . Database::escape_string($tool) . "', |
|
| 666 | + $sql = "INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES ( |
|
| 667 | + '" . (int) $course_id."', |
|
| 668 | + '" . (int) $task_id."', |
|
| 669 | + '" . Database::escape_string($tool)."', |
|
| 670 | 670 | 'article_edit' |
| 671 | 671 | )"; |
| 672 | 672 | Database::query($sql); |
@@ -679,10 +679,10 @@ discard block |
||
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | if ($commentsDelete == 'on') { |
| 682 | - $sql = " INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES ( |
|
| 683 | - '" . (int)$course_id . "', |
|
| 684 | - '" . (int)$task_id . "', |
|
| 685 | - '" . Database::escape_string($tool) . "', |
|
| 682 | + $sql = " INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES ( |
|
| 683 | + '" . (int) $course_id."', |
|
| 684 | + '" . (int) $task_id."', |
|
| 685 | + '" . Database::escape_string($tool)."', |
|
| 686 | 686 | 'article_comments_delete' |
| 687 | 687 | )"; |
| 688 | 688 | Database::query($sql); |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | |
| 708 | 708 | // Delete posts |
| 709 | 709 | $sql = "DELETE FROM $tbl_blogs_tasks |
| 710 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."'"; |
|
| 710 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND task_id = '".(int) $task_id."'"; |
|
| 711 | 711 | Database::query($sql); |
| 712 | 712 | } |
| 713 | 713 | |
@@ -725,9 +725,9 @@ discard block |
||
| 725 | 725 | $sql = "DELETE FROM $tbl_blogs_tasks_rel_user |
| 726 | 726 | WHERE |
| 727 | 727 | c_id = $course_id AND |
| 728 | - blog_id = '".(int)$blog_id."' AND |
|
| 729 | - task_id = '".(int)$task_id."' AND |
|
| 730 | - user_id = '".(int)$user_id."'"; |
|
| 728 | + blog_id = '".(int) $blog_id."' AND |
|
| 729 | + task_id = '".(int) $task_id."' AND |
|
| 730 | + user_id = '".(int) $user_id."'"; |
|
| 731 | 731 | Database::query($sql); |
| 732 | 732 | } |
| 733 | 733 | |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | $_user = api_get_user_info(); |
| 742 | 742 | |
| 743 | 743 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
| 744 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 744 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 745 | 745 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
| 746 | 746 | |
| 747 | 747 | $course_id = api_get_course_int_id(); |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | task.c_id = $course_id AND |
| 759 | 759 | blog.c_id = $course_id AND |
| 760 | 760 | task_rel_user.c_id = $course_id AND |
| 761 | - task_rel_user.user_id = ".(int)$_user['user_id']." |
|
| 761 | + task_rel_user.user_id = ".(int) $_user['user_id']." |
|
| 762 | 762 | ORDER BY target_date ASC"; |
| 763 | 763 | |
| 764 | 764 | $result = Database::query($sql); |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | if (Database::num_rows($result) > 0) { |
| 767 | 767 | echo '<ul>'; |
| 768 | 768 | while ($mytask = Database::fetch_array($result)) { |
| 769 | - echo '<li><a href="blog.php?action=execute_task&blog_id=' . $mytask['blog_id'] . '&task_id='.stripslashes($mytask['task_id']) . '" title="[Blog: '.stripslashes($mytask['blog_name']) . '] ' . get_lang('ExecuteThisTask') . '">'.stripslashes($mytask['title']) . '</a></li>'; |
|
| 769 | + echo '<li><a href="blog.php?action=execute_task&blog_id='.$mytask['blog_id'].'&task_id='.stripslashes($mytask['task_id']).'" title="[Blog: '.stripslashes($mytask['blog_name']).'] '.get_lang('ExecuteThisTask').'">'.stripslashes($mytask['title']).'</a></li>'; |
|
| 770 | 770 | } |
| 771 | 771 | echo '<ul>'; |
| 772 | 772 | } else { |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | |
| 791 | 791 | // Get blog properties |
| 792 | 792 | $sql = "SELECT blog_name, visibility FROM $tbl_blogs |
| 793 | - WHERE c_id = $course_id AND blog_id='".(int)$blog_id."'"; |
|
| 793 | + WHERE c_id = $course_id AND blog_id='".(int) $blog_id."'"; |
|
| 794 | 794 | $result = Database::query($sql); |
| 795 | 795 | $blog = Database::fetch_array($result); |
| 796 | 796 | $visibility = $blog['visibility']; |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | if ($visibility == 1) { |
| 800 | 800 | // Change visibility state, remove from course home. |
| 801 | 801 | $sql = "UPDATE $tbl_blogs SET visibility = '0' |
| 802 | - WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1"; |
|
| 802 | + WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1"; |
|
| 803 | 803 | Database::query($sql); |
| 804 | 804 | |
| 805 | 805 | $sql = "DELETE FROM $tbl_tool |
@@ -808,11 +808,11 @@ discard block |
||
| 808 | 808 | } else { |
| 809 | 809 | // Change visibility state, add to course home. |
| 810 | 810 | $sql = "UPDATE $tbl_blogs SET visibility = '1' |
| 811 | - WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1"; |
|
| 811 | + WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1"; |
|
| 812 | 812 | Database::query($sql); |
| 813 | 813 | |
| 814 | 814 | $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, target ) |
| 815 | - VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int)$blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')"; |
|
| 815 | + VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int) $blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')"; |
|
| 816 | 816 | Database::query($sql); |
| 817 | 817 | $id = Database::insert_id(); |
| 818 | 818 | |
@@ -843,14 +843,14 @@ discard block |
||
| 843 | 843 | FROM $tbl_blogs_posts post |
| 844 | 844 | INNER JOIN $tbl_users user |
| 845 | 845 | ON post.author_id = user.user_id |
| 846 | - WHERE post.blog_id = '".(int)$blog_id."' AND |
|
| 846 | + WHERE post.blog_id = '".(int) $blog_id."' AND |
|
| 847 | 847 | post.c_id = $course_id AND |
| 848 | 848 | $filter |
| 849 | - ORDER BY post_id DESC LIMIT 0,".(int)$max_number_of_posts; |
|
| 849 | + ORDER BY post_id DESC LIMIT 0,".(int) $max_number_of_posts; |
|
| 850 | 850 | $result = Database::query($sql); |
| 851 | 851 | |
| 852 | 852 | // Display |
| 853 | - if(Database::num_rows($result) > 0) { |
|
| 853 | + if (Database::num_rows($result) > 0) { |
|
| 854 | 854 | $limit = 200; |
| 855 | 855 | while ($blog_post = Database::fetch_array($result)) { |
| 856 | 856 | // Get number of comments |
@@ -858,8 +858,8 @@ discard block |
||
| 858 | 858 | FROM $tbl_blogs_comments |
| 859 | 859 | WHERE |
| 860 | 860 | c_id = $course_id AND |
| 861 | - blog_id = '".(int)$blog_id."' AND |
|
| 862 | - post_id = '" . (int)$blog_post['post_id']."'"; |
|
| 861 | + blog_id = '".(int) $blog_id."' AND |
|
| 862 | + post_id = '" . (int) $blog_post['post_id']."'"; |
|
| 863 | 863 | $tmp = Database::query($sql); |
| 864 | 864 | $blog_post_comments = Database::fetch_array($tmp); |
| 865 | 865 | |
@@ -870,11 +870,11 @@ discard block |
||
| 870 | 870 | |
| 871 | 871 | // Create an introduction text (but keep FULL sentences) |
| 872 | 872 | $words = 0; |
| 873 | - $blog_post_text_cut = cut($blog_post_text, $limit) ; |
|
| 873 | + $blog_post_text_cut = cut($blog_post_text, $limit); |
|
| 874 | 874 | $words = strlen($blog_post_text); |
| 875 | 875 | |
| 876 | 876 | if ($words >= $limit) { |
| 877 | - $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_' . $blog_post_id . '\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_' . $blog_post_id . '\').style.display=\'none\'">' . get_lang('ReadMore') . '</div>'; |
|
| 877 | + $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_'.$blog_post_id.'\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_'.$blog_post_id.'\').style.display=\'none\'">'.get_lang('ReadMore').'</div>'; |
|
| 878 | 878 | $introduction_text = $blog_post_text_cut; |
| 879 | 879 | } else { |
| 880 | 880 | $introduction_text = $blog_post_text; |
@@ -884,27 +884,27 @@ discard block |
||
| 884 | 884 | $introduction_text = stripslashes($introduction_text); |
| 885 | 885 | |
| 886 | 886 | echo '<div class="blogpost">'; |
| 887 | - echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
| 888 | - echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . '</a></span>'; |
|
| 889 | - echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">' . $introduction_text.$readMoreLink.'</div>'; |
|
| 890 | - echo '<div class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</div>'; |
|
| 887 | + echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>'; |
|
| 888 | + echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.$blog_post_date.'</a></span>'; |
|
| 889 | + echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">'.$introduction_text.$readMoreLink.'</div>'; |
|
| 890 | + echo '<div class="blogpost_text" id="blogpost_text_'.$blog_post_id.'" style="display: none">'.$blog_post_text.'</div>'; |
|
| 891 | 891 | |
| 892 | - $file_name_array = get_blog_attachment($blog_id,$blog_post_id,0); |
|
| 892 | + $file_name_array = get_blog_attachment($blog_id, $blog_post_id, 0); |
|
| 893 | 893 | |
| 894 | 894 | if (!empty($file_name_array)) { |
| 895 | 895 | echo '<br /><br />'; |
| 896 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 896 | + echo Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
| 897 | 897 | echo '<a href="download.php?file='; |
| 898 | 898 | echo $file_name_array['path']; |
| 899 | 899 | echo ' "> '.$file_name_array['filename'].' </a><br />'; |
| 900 | 900 | echo '</span>'; |
| 901 | 901 | } |
| 902 | 902 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
| 903 | - echo '<span class="blogpost_info">' . get_lang('Author') . ': ' . Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)) .' - <a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . get_lang('Comments') . ': ' . $blog_post_comments['number_of_comments'] . '</a></span>'; |
|
| 903 | + echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - <a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].'</a></span>'; |
|
| 904 | 904 | echo '</div>'; |
| 905 | 905 | } |
| 906 | 906 | } else { |
| 907 | - if($filter == '1=1') { |
|
| 907 | + if ($filter == '1=1') { |
|
| 908 | 908 | echo get_lang('NoArticles'); |
| 909 | 909 | } else { |
| 910 | 910 | echo get_lang('NoArticleMatches'); |
@@ -918,19 +918,19 @@ discard block |
||
| 918 | 918 | * @param Integer $blog_id |
| 919 | 919 | * @param String $query_string |
| 920 | 920 | */ |
| 921 | - public static function display_search_results ($blog_id, $query_string) |
|
| 921 | + public static function display_search_results($blog_id, $query_string) |
|
| 922 | 922 | { |
| 923 | 923 | // Init |
| 924 | 924 | $query_string = Database::escape_string($query_string); |
| 925 | - $query_string_parts = explode(' ',$query_string); |
|
| 925 | + $query_string_parts = explode(' ', $query_string); |
|
| 926 | 926 | $query_string = array(); |
| 927 | 927 | foreach ($query_string_parts as $query_part) { |
| 928 | - $query_string[] = " full_text LIKE '%" . $query_part."%' OR title LIKE '%" . $query_part."%' "; |
|
| 928 | + $query_string[] = " full_text LIKE '%".$query_part."%' OR title LIKE '%".$query_part."%' "; |
|
| 929 | 929 | } |
| 930 | - $query_string = '('.implode('OR',$query_string) . ')'; |
|
| 930 | + $query_string = '('.implode('OR', $query_string).')'; |
|
| 931 | 931 | |
| 932 | 932 | // Display the posts |
| 933 | - echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>'; |
|
| 933 | + echo '<span class="blogpost_title">'.get_lang('SearchResults').'</span>'; |
|
| 934 | 934 | Blog::display_blog_posts($blog_id, $query_string); |
| 935 | 935 | } |
| 936 | 936 | |
@@ -943,14 +943,14 @@ discard block |
||
| 943 | 943 | public static function display_day_results($blog_id, $query_string) |
| 944 | 944 | { |
| 945 | 945 | $date_output = $query_string; |
| 946 | - $date = explode('-',$query_string); |
|
| 947 | - $query_string = ' DAYOFMONTH(date_creation) =' . intval($date[2]) . ' AND MONTH(date_creation) =' . intval($date[1]) . ' AND YEAR(date_creation) =' . intval($date[0]); |
|
| 946 | + $date = explode('-', $query_string); |
|
| 947 | + $query_string = ' DAYOFMONTH(date_creation) ='.intval($date[2]).' AND MONTH(date_creation) ='.intval($date[1]).' AND YEAR(date_creation) ='.intval($date[0]); |
|
| 948 | 948 | |
| 949 | 949 | // Put date in correct output format |
| 950 | 950 | $date_output = api_format_date($date_output, DATE_FORMAT_LONG); |
| 951 | 951 | |
| 952 | 952 | // Display the posts |
| 953 | - echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>'; |
|
| 953 | + echo '<span class="blogpost_title">'.get_lang('PostsOf').': '.$date_output.'</span>'; |
|
| 954 | 954 | Blog::display_blog_posts($blog_id, $query_string); |
| 955 | 955 | } |
| 956 | 956 | |
@@ -977,8 +977,8 @@ discard block |
||
| 977 | 977 | ON post.author_id = user.user_id |
| 978 | 978 | WHERE |
| 979 | 979 | post.c_id = $course_id AND |
| 980 | - post.blog_id = '".(int)$blog_id."' AND |
|
| 981 | - post.post_id = '".(int)$post_id."' |
|
| 980 | + post.blog_id = '".(int) $blog_id."' AND |
|
| 981 | + post.post_id = '".(int) $post_id."' |
|
| 982 | 982 | ORDER BY post_id DESC"; |
| 983 | 983 | $result = Database::query($sql); |
| 984 | 984 | $blog_post = Database::fetch_array($result); |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | // Get number of comments |
| 987 | 987 | $sql = "SELECT COUNT(1) as number_of_comments |
| 988 | 988 | FROM $tbl_blogs_comments |
| 989 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND post_id = '".(int)$post_id."'"; |
|
| 989 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND post_id = '".(int) $post_id."'"; |
|
| 990 | 990 | $result = Database::query($sql); |
| 991 | 991 | $blog_post_comments = Database::fetch_array($result); |
| 992 | 992 | |
@@ -997,34 +997,34 @@ discard block |
||
| 997 | 997 | |
| 998 | 998 | $task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? intval($_GET['task_id']) : 0; |
| 999 | 999 | |
| 1000 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_edit', $task_id)) { |
|
| 1001 | - $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('EditThisPost') . '">'; |
|
| 1002 | - $blog_post_actions .= Display::return_icon('edit.png'); |
|
| 1000 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
| 1001 | + $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id='.$blog_id.'&post_id='.$post_id.'&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('EditThisPost').'">'; |
|
| 1002 | + $blog_post_actions .= Display::return_icon('edit.png'); |
|
| 1003 | 1003 | $blog_post_actions .= '</a>'; |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_delete', $task_id)) { |
|
| 1007 | - $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&do=delete_article&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('DeleteThisArticle') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;">'; |
|
| 1006 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
| 1007 | + $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=delete_article&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('DeleteThisArticle').'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;">'; |
|
| 1008 | 1008 | $blog_post_actions .= Display::return_icon('delete.png'); |
| 1009 | 1009 | $blog_post_actions .= '</a>'; |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) |
|
| 1013 | - $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
| 1012 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) |
|
| 1013 | + $rating_select = Blog::display_rating_form('post', $blog_id, $post_id); |
|
| 1014 | 1014 | |
| 1015 | - $blog_post_text=stripslashes($blog_post_text); |
|
| 1015 | + $blog_post_text = stripslashes($blog_post_text); |
|
| 1016 | 1016 | |
| 1017 | 1017 | // Display post |
| 1018 | 1018 | echo '<div class="blogpost">'; |
| 1019 | - echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>'; |
|
| 1020 | - echo '<span class="blogpost_date">' . $blog_post_date . '</span>'; |
|
| 1021 | - echo '<span class="blogpost_text">' . $blog_post_text . '</span><br />'; |
|
| 1019 | + echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>'; |
|
| 1020 | + echo '<span class="blogpost_date">'.$blog_post_date.'</span>'; |
|
| 1021 | + echo '<span class="blogpost_text">'.$blog_post_text.'</span><br />'; |
|
| 1022 | 1022 | |
| 1023 | 1023 | $file_name_array = get_blog_attachment($blog_id, $post_id); |
| 1024 | 1024 | |
| 1025 | 1025 | if (!empty($file_name_array)) { |
| 1026 | 1026 | echo ' <br />'; |
| 1027 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 1027 | + echo Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
| 1028 | 1028 | echo '<a href="download.php?file='; |
| 1029 | 1029 | echo $file_name_array['path']; |
| 1030 | 1030 | echo ' "> '.$file_name_array['filename'].' </a>'; |
@@ -1035,20 +1035,20 @@ discard block |
||
| 1035 | 1035 | echo '<br />'; |
| 1036 | 1036 | } |
| 1037 | 1037 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
| 1038 | - echo '<span class="blogpost_info">'.get_lang('Author').': ' .Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post',$blog_id,$post_id).$rating_select.'</span>'; |
|
| 1039 | - echo '<span class="blogpost_actions">' . $blog_post_actions . '</span>'; |
|
| 1038 | + echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post', $blog_id, $post_id).$rating_select.'</span>'; |
|
| 1039 | + echo '<span class="blogpost_actions">'.$blog_post_actions.'</span>'; |
|
| 1040 | 1040 | echo '</div>'; |
| 1041 | 1041 | |
| 1042 | 1042 | // Display comments if there are any |
| 1043 | - if($blog_post_comments['number_of_comments'] > 0) { |
|
| 1043 | + if ($blog_post_comments['number_of_comments'] > 0) { |
|
| 1044 | 1044 | echo '<div class="comments">'; |
| 1045 | - echo '<span class="blogpost_title">' . get_lang('Comments') . '</span><br />'; |
|
| 1045 | + echo '<span class="blogpost_title">'.get_lang('Comments').'</span><br />'; |
|
| 1046 | 1046 | Blog::get_threaded_comments(0, 0, $blog_id, $post_id, $task_id); |
| 1047 | 1047 | echo '</div>'; |
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | // Display comment form |
| 1051 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_comments_add')) { |
|
| 1051 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
| 1052 | 1052 | Blog::display_new_comment_form($blog_id, $post_id, $blog_post['title']); |
| 1053 | 1053 | } |
| 1054 | 1054 | } |
@@ -1076,16 +1076,16 @@ discard block |
||
| 1076 | 1076 | $sql = "SELECT rating_id FROM $tbl_blogs_rating |
| 1077 | 1077 | WHERE |
| 1078 | 1078 | c_id = $course_id AND |
| 1079 | - blog_id = '".(int)$blog_id."' AND |
|
| 1080 | - item_id = '".(int)$item_id."' AND |
|
| 1079 | + blog_id = '".(int) $blog_id."' AND |
|
| 1080 | + item_id = '".(int) $item_id."' AND |
|
| 1081 | 1081 | rating_type = '".Database::escape_string($type)."' AND |
| 1082 | - user_id = '".(int)$_user['user_id']."'"; |
|
| 1082 | + user_id = '".(int) $_user['user_id']."'"; |
|
| 1083 | 1083 | $result = Database::query($sql); |
| 1084 | 1084 | |
| 1085 | 1085 | // Add rating |
| 1086 | 1086 | if (Database::num_rows($result) == 0) { |
| 1087 | 1087 | $sql = "INSERT INTO $tbl_blogs_rating (c_id, blog_id, rating_type, item_id, user_id, rating ) |
| 1088 | - VALUES ($course_id, '".(int)$blog_id."', '".Database::escape_string($type)."', '".(int)$item_id."', '".(int)$_user['user_id']."', '".Database::escape_string($rating)."')"; |
|
| 1088 | + VALUES ($course_id, '".(int) $blog_id."', '".Database::escape_string($type)."', '".(int) $item_id."', '".(int) $_user['user_id']."', '".Database::escape_string($rating)."')"; |
|
| 1089 | 1089 | Database::query($sql); |
| 1090 | 1090 | |
| 1091 | 1091 | $id = Database::insert_id(); |
@@ -1118,8 +1118,8 @@ discard block |
||
| 1118 | 1118 | $sql = "SELECT AVG(rating) as rating FROM $tbl_blogs_rating |
| 1119 | 1119 | WHERE |
| 1120 | 1120 | c_id = $course_id AND |
| 1121 | - blog_id = '".(int)$blog_id."' AND |
|
| 1122 | - item_id = '".(int)$item_id."' AND |
|
| 1121 | + blog_id = '".(int) $blog_id."' AND |
|
| 1122 | + item_id = '".(int) $item_id."' AND |
|
| 1123 | 1123 | rating_type = '".Database::escape_string($type)."' "; |
| 1124 | 1124 | $result = Database::query($sql); |
| 1125 | 1125 | $result = Database::fetch_array($result); |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | * |
| 1137 | 1137 | *@return String |
| 1138 | 1138 | */ |
| 1139 | - public static function display_rating_form ($type, $blog_id, $post_id, $comment_id = NULL) |
|
| 1139 | + public static function display_rating_form($type, $blog_id, $post_id, $comment_id = NULL) |
|
| 1140 | 1140 | { |
| 1141 | 1141 | $_user = api_get_user_info(); |
| 1142 | 1142 | $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
@@ -1146,14 +1146,14 @@ discard block |
||
| 1146 | 1146 | // Check if the user has already rated this post |
| 1147 | 1147 | $sql = "SELECT rating_id FROM $tbl_blogs_rating |
| 1148 | 1148 | WHERE c_id = $course_id AND |
| 1149 | - blog_id = '".(int)$blog_id."' |
|
| 1150 | - AND item_id = '".(int)$post_id."' |
|
| 1149 | + blog_id = '".(int) $blog_id."' |
|
| 1150 | + AND item_id = '".(int) $post_id."' |
|
| 1151 | 1151 | AND rating_type = '".Database::escape_string($type)."' |
| 1152 | - AND user_id = '".(int)$_user['user_id']."'"; |
|
| 1152 | + AND user_id = '".(int) $_user['user_id']."'"; |
|
| 1153 | 1153 | $result = Database::query($sql); |
| 1154 | 1154 | // Add rating |
| 1155 | 1155 | if (Database::num_rows($result) == 0) { |
| 1156 | - return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $post_id . '" name="frm_rating_' . $type . '_' . $post_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $post_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /></form>'; |
|
| 1156 | + return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$post_id.'" name="frm_rating_'.$type.'_'.$post_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$post_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /></form>'; |
|
| 1157 | 1157 | } else { |
| 1158 | 1158 | return ''; |
| 1159 | 1159 | } |
@@ -1162,14 +1162,14 @@ discard block |
||
| 1162 | 1162 | if ($type = 'comment') { |
| 1163 | 1163 | // Check if the user has already rated this comment |
| 1164 | 1164 | $sql = "SELECT rating_id FROM $tbl_blogs_rating |
| 1165 | - WHERE c_id = $course_id AND blog_id = '".(int)$blog_id ."' |
|
| 1166 | - AND item_id = '".(int)$comment_id."' |
|
| 1165 | + WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' |
|
| 1166 | + AND item_id = '".(int) $comment_id."' |
|
| 1167 | 1167 | AND rating_type = '".Database::escape_string($type)."' |
| 1168 | - AND user_id = '".(int)$_user['user_id']."'"; |
|
| 1168 | + AND user_id = '".(int) $_user['user_id']."'"; |
|
| 1169 | 1169 | $result = Database::query($sql); |
| 1170 | 1170 | |
| 1171 | 1171 | if (Database::num_rows($result) == 0) { |
| 1172 | - return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $comment_id . '" name="frm_rating_' . $type . '_' . $comment_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $comment_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /><input type="hidden" name="comment_id" value="' . $comment_id . '" /></form>'; |
|
| 1172 | + return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$comment_id.'" name="frm_rating_'.$type.'_'.$comment_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$comment_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /><input type="hidden" name="comment_id" value="'.$comment_id.'" /></form>'; |
|
| 1173 | 1173 | } else { |
| 1174 | 1174 | return ''; |
| 1175 | 1175 | } |
@@ -1204,11 +1204,11 @@ discard block |
||
| 1204 | 1204 | WHERE |
| 1205 | 1205 | comments.c_id = $course_id AND |
| 1206 | 1206 | parent_comment_id = $current AND |
| 1207 | - comments.blog_id = '".(int)$blog_id."' AND |
|
| 1208 | - comments.post_id = '".(int)$post_id."'"; |
|
| 1207 | + comments.blog_id = '".(int) $blog_id."' AND |
|
| 1208 | + comments.post_id = '".(int) $post_id."'"; |
|
| 1209 | 1209 | $result = Database::query($sql); |
| 1210 | 1210 | |
| 1211 | - while($comment = Database::fetch_array($result)) { |
|
| 1211 | + while ($comment = Database::fetch_array($result)) { |
|
| 1212 | 1212 | // Select the children recursivly |
| 1213 | 1213 | $tmp = "SELECT comments.*, user.lastname, user.firstname, user.username |
| 1214 | 1214 | FROM $tbl_blogs_comments comments |
@@ -1217,8 +1217,8 @@ discard block |
||
| 1217 | 1217 | WHERE |
| 1218 | 1218 | comments.c_id = $course_id AND |
| 1219 | 1219 | comment_id = $current |
| 1220 | - AND blog_id = '".(int)$blog_id."' |
|
| 1221 | - AND post_id = '".(int)$post_id."'"; |
|
| 1220 | + AND blog_id = '".(int) $blog_id."' |
|
| 1221 | + AND post_id = '".(int) $post_id."'"; |
|
| 1222 | 1222 | $tmp = Database::query($tmp); |
| 1223 | 1223 | $tmp = Database::fetch_array($tmp); |
| 1224 | 1224 | $parent_cat = $tmp['parent_comment_id']; |
@@ -1243,22 +1243,22 @@ discard block |
||
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | if (!is_null($comment['task_id'])) { |
| 1246 | - $border_color = ' border-left: 3px solid #' . $comment['color']; |
|
| 1246 | + $border_color = ' border-left: 3px solid #'.$comment['color']; |
|
| 1247 | 1247 | } |
| 1248 | 1248 | |
| 1249 | 1249 | $comment_text = stripslashes($comment_text); |
| 1250 | 1250 | |
| 1251 | 1251 | // Output... |
| 1252 | 1252 | $margin = $current_level * 30; |
| 1253 | - echo '<div class="blogpost_comment" style="margin-left: ' . $margin . 'px;' . $border_color . '">'; |
|
| 1254 | - echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\'' . $comment['comment_id'] . '\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']) . '\'" title="' . get_lang('ReplyToThisComment') . '" >'.stripslashes($comment['title']) . '</a></span>'; |
|
| 1255 | - echo '<span class="blogpost_comment_date">' . $blog_comment_date . '</span>'; |
|
| 1256 | - echo '<span class="blogpost_text">' . $comment_text . '</span>'; |
|
| 1253 | + echo '<div class="blogpost_comment" style="margin-left: '.$margin.'px;'.$border_color.'">'; |
|
| 1254 | + echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\''.$comment['comment_id'].'\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']).'\'" title="'.get_lang('ReplyToThisComment').'" >'.stripslashes($comment['title']).'</a></span>'; |
|
| 1255 | + echo '<span class="blogpost_comment_date">'.$blog_comment_date.'</span>'; |
|
| 1256 | + echo '<span class="blogpost_text">'.$comment_text.'</span>'; |
|
| 1257 | 1257 | |
| 1258 | - $file_name_array = get_blog_attachment($blog_id,$post_id, $comment['comment_id']); |
|
| 1258 | + $file_name_array = get_blog_attachment($blog_id, $post_id, $comment['comment_id']); |
|
| 1259 | 1259 | if (!empty($file_name_array)) { |
| 1260 | 1260 | echo '<br /><br />'; |
| 1261 | - echo Display::return_icon('attachment.gif',get_lang('Attachment')); |
|
| 1261 | + echo Display::return_icon('attachment.gif', get_lang('Attachment')); |
|
| 1262 | 1262 | echo '<a href="download.php?file='; |
| 1263 | 1263 | echo $file_name_array['path']; |
| 1264 | 1264 | echo ' "> '.$file_name_array['filename'].' </a>'; |
@@ -1268,7 +1268,7 @@ discard block |
||
| 1268 | 1268 | } |
| 1269 | 1269 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $comment['username']), ENT_QUOTES); |
| 1270 | 1270 | echo '<span class="blogpost_comment_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($comment['firstname'], $comment['lastname']), array('title'=>$username)).' - '.get_lang('Rating').': '.Blog::display_rating('comment', $blog_id, $comment['comment_id']).$rating_select.'</span>'; |
| 1271 | - echo '<span class="blogpost_actions">' . $blog_comment_actions . '</span>'; |
|
| 1271 | + echo '<span class="blogpost_actions">'.$blog_comment_actions.'</span>'; |
|
| 1272 | 1272 | echo '</div>'; |
| 1273 | 1273 | |
| 1274 | 1274 | // Go further down the tree. |
@@ -1284,11 +1284,11 @@ discard block |
||
| 1284 | 1284 | */ |
| 1285 | 1285 | public static function display_form_new_post($blog_id) |
| 1286 | 1286 | { |
| 1287 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
| 1287 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { |
|
| 1288 | 1288 | $form = new FormValidator( |
| 1289 | 1289 | 'add_post', |
| 1290 | 1290 | 'post', |
| 1291 | - api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq(), |
|
| 1291 | + api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=".$blog_id."&".api_get_cidreq(), |
|
| 1292 | 1292 | null, |
| 1293 | 1293 | array('enctype' => 'multipart/form-data') |
| 1294 | 1294 | ); |
@@ -1332,8 +1332,8 @@ discard block |
||
| 1332 | 1332 | INNER JOIN $tbl_users user ON post.author_id = user.user_id |
| 1333 | 1333 | WHERE |
| 1334 | 1334 | post.c_id = $course_id AND |
| 1335 | - post.blog_id = '".(int)$blog_id ."' |
|
| 1336 | - AND post.post_id = '".(int)$post_id."' |
|
| 1335 | + post.blog_id = '".(int) $blog_id."' |
|
| 1336 | + AND post.post_id = '".(int) $post_id."' |
|
| 1337 | 1337 | ORDER BY post_id DESC"; |
| 1338 | 1338 | $result = Database::query($sql); |
| 1339 | 1339 | $blog_post = Database::fetch_array($result); |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | $form = new FormValidator( |
| 1343 | 1343 | 'edit_post', |
| 1344 | 1344 | 'post', |
| 1345 | - api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id=' . intval($_GET['post_id']) . '&blog_id=' . intval($blog_id) . '&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id']) |
|
| 1345 | + api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id='.intval($_GET['post_id']).'&blog_id='.intval($blog_id).'&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id']) |
|
| 1346 | 1346 | ); |
| 1347 | 1347 | |
| 1348 | 1348 | $form->addHeader(get_lang('EditPost')); |
@@ -1374,31 +1374,31 @@ discard block |
||
| 1374 | 1374 | global $charset; |
| 1375 | 1375 | $course_id = api_get_course_int_id(); |
| 1376 | 1376 | |
| 1377 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) { |
|
| 1377 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { |
|
| 1378 | 1378 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
| 1379 | 1379 | $counter = 0; |
| 1380 | 1380 | global $color2; |
| 1381 | 1381 | |
| 1382 | 1382 | echo '<div class="actions">'; |
| 1383 | - echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=add">'; |
|
| 1383 | + echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=add">'; |
|
| 1384 | 1384 | echo Display::return_icon('blog_newtasks.gif', get_lang('AddTasks')); |
| 1385 | - echo get_lang('AddTasks') . '</a> '; |
|
| 1386 | - echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=assign">'; |
|
| 1385 | + echo get_lang('AddTasks').'</a> '; |
|
| 1386 | + echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=assign">'; |
|
| 1387 | 1387 | echo Display::return_icon('blog_task.gif', get_lang('AssignTasks')); |
| 1388 | - echo get_lang('AssignTasks') . '</a>'; |
|
| 1388 | + echo get_lang('AssignTasks').'</a>'; |
|
| 1389 | 1389 | ?> |
| 1390 | 1390 | <a href="<?php echo api_get_self(); ?>?action=manage_rights&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageRights') ?>"> |
| 1391 | - <?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'),'',ICON_SIZE_SMALL). get_lang('RightsManager') ?></a> |
|
| 1391 | + <?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'), '', ICON_SIZE_SMALL).get_lang('RightsManager') ?></a> |
|
| 1392 | 1392 | <?php |
| 1393 | 1393 | echo '</div>'; |
| 1394 | 1394 | |
| 1395 | - echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />'; |
|
| 1395 | + echo '<span class="blogpost_title">'.get_lang('TaskList').'</span><br />'; |
|
| 1396 | 1396 | echo "<table class=\"data_table\">"; |
| 1397 | 1397 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
| 1398 | - "<th width='240'><b>",get_lang('Title'),"</b></th>\n", |
|
| 1399 | - "<th><b>",get_lang('Description'),"</b></th>\n", |
|
| 1400 | - "<th><b>",get_lang('Color'),"</b></th>\n", |
|
| 1401 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>\n", |
|
| 1398 | + "<th width='240'><b>", get_lang('Title'), "</b></th>\n", |
|
| 1399 | + "<th><b>", get_lang('Description'), "</b></th>\n", |
|
| 1400 | + "<th><b>", get_lang('Color'), "</b></th>\n", |
|
| 1401 | + "<th width='50'><b>", get_lang('Modify'), "</b></th>\n", |
|
| 1402 | 1402 | "</tr>\n"; |
| 1403 | 1403 | |
| 1404 | 1404 | |
@@ -1410,31 +1410,31 @@ discard block |
||
| 1410 | 1410 | description, |
| 1411 | 1411 | color, |
| 1412 | 1412 | system_task |
| 1413 | - FROM " . $tbl_blogs_tasks . " |
|
| 1414 | - WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . " |
|
| 1413 | + FROM " . $tbl_blogs_tasks." |
|
| 1414 | + WHERE c_id = $course_id AND blog_id = ".(int) $blog_id." |
|
| 1415 | 1415 | ORDER BY system_task, title"; |
| 1416 | 1416 | $result = Database::query($sql); |
| 1417 | 1417 | |
| 1418 | 1418 | |
| 1419 | - while($task = Database::fetch_array($result)) { |
|
| 1419 | + while ($task = Database::fetch_array($result)) { |
|
| 1420 | 1420 | $counter++; |
| 1421 | 1421 | $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even"; |
| 1422 | 1422 | $delete_icon = ($task['system_task'] == '1') ? "delete_na.gif" : "delete.gif"; |
| 1423 | 1423 | $delete_title = ($task['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
| 1424 | - $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=delete&task_id=' . $task['task_id']; |
|
| 1425 | - $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
| 1424 | + $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=delete&task_id='.$task['task_id']; |
|
| 1425 | + $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"'; |
|
| 1426 | 1426 | |
| 1427 | - echo '<tr class="' . $css_class . '" valign="top">', |
|
| 1428 | - '<td width="240">' . Security::remove_XSS($task['title']) . '</td>', |
|
| 1429 | - '<td>' . Security::remove_XSS($task['description']) . '</td>', |
|
| 1430 | - '<td><span style="background-color: #' . $task['color'] . '"> </span></td>', |
|
| 1427 | + echo '<tr class="'.$css_class.'" valign="top">', |
|
| 1428 | + '<td width="240">'.Security::remove_XSS($task['title']).'</td>', |
|
| 1429 | + '<td>'.Security::remove_XSS($task['description']).'</td>', |
|
| 1430 | + '<td><span style="background-color: #'.$task['color'].'"> </span></td>', |
|
| 1431 | 1431 | '<td width="50">', |
| 1432 | - '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=edit&task_id=' . $task['task_id'] . '">', |
|
| 1433 | - '<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />', |
|
| 1432 | + '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=edit&task_id='.$task['task_id'].'">', |
|
| 1433 | + '<img src="../img/edit.gif" border="0" title="'.get_lang('EditTask').'" />', |
|
| 1434 | 1434 | "</a>\n", |
| 1435 | - '<a href="' . $delete_link . '"', |
|
| 1435 | + '<a href="'.$delete_link.'"', |
|
| 1436 | 1436 | $delete_confirm, |
| 1437 | - '><img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />', |
|
| 1437 | + '><img src="../img/'.$delete_icon.'" border="0" title="'.$delete_title.'" />', |
|
| 1438 | 1438 | "</a>\n", |
| 1439 | 1439 | '</td>', |
| 1440 | 1440 | '</tr>'; |
@@ -1449,23 +1449,23 @@ discard block |
||
| 1449 | 1449 | * |
| 1450 | 1450 | * @param Integer $blog_id |
| 1451 | 1451 | */ |
| 1452 | - public static function display_assigned_task_list ($blog_id) |
|
| 1452 | + public static function display_assigned_task_list($blog_id) |
|
| 1453 | 1453 | { |
| 1454 | 1454 | // Init |
| 1455 | 1455 | $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
| 1456 | 1456 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
| 1457 | 1457 | $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
| 1458 | 1458 | $counter = 0; |
| 1459 | - global $charset,$color2; |
|
| 1459 | + global $charset, $color2; |
|
| 1460 | 1460 | |
| 1461 | - echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />'; |
|
| 1461 | + echo '<span class="blogpost_title">'.get_lang('AssignedTasks').'</span><br />'; |
|
| 1462 | 1462 | echo "<table class=\"data_table\">"; |
| 1463 | 1463 | echo "<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">", |
| 1464 | - "<th width='240'><b>",get_lang('Member'),"</b></th>\n", |
|
| 1465 | - "<th><b>",get_lang('Task'),"</b></th>\n", |
|
| 1466 | - "<th><b>",get_lang('Description'),"</b></th>\n", |
|
| 1467 | - "<th><b>",get_lang('TargetDate'),"</b></th>\n", |
|
| 1468 | - "<th width='50'><b>",get_lang('Modify'),"</b></th>\n", |
|
| 1464 | + "<th width='240'><b>", get_lang('Member'), "</b></th>\n", |
|
| 1465 | + "<th><b>", get_lang('Task'), "</b></th>\n", |
|
| 1466 | + "<th><b>", get_lang('Description'), "</b></th>\n", |
|
| 1467 | + "<th><b>", get_lang('TargetDate'), "</b></th>\n", |
|
| 1468 | + "<th width='50'><b>", get_lang('Modify'), "</b></th>\n", |
|
| 1469 | 1469 | "</tr>"; |
| 1470 | 1470 | |
| 1471 | 1471 | $course_id = api_get_course_int_id(); |
@@ -1477,32 +1477,32 @@ discard block |
||
| 1477 | 1477 | WHERE |
| 1478 | 1478 | task_rel_user.c_id = $course_id AND |
| 1479 | 1479 | task.c_id = $course_id AND |
| 1480 | - task_rel_user.blog_id = '".(int)$blog_id."' |
|
| 1480 | + task_rel_user.blog_id = '".(int) $blog_id."' |
|
| 1481 | 1481 | ORDER BY target_date ASC"; |
| 1482 | 1482 | $result = Database::query($sql); |
| 1483 | 1483 | |
| 1484 | 1484 | while ($assignment = Database::fetch_array($result)) { |
| 1485 | 1485 | $counter++; |
| 1486 | - $css_class = (($counter % 2)==0) ? "row_odd" : "row_even"; |
|
| 1486 | + $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even"; |
|
| 1487 | 1487 | $delete_icon = ($assignment['system_task'] == '1') ? "delete_na.gif" : "delete.gif"; |
| 1488 | 1488 | $delete_title = ($assignment['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask'); |
| 1489 | - $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete&task_id=' . $assignment['task_id']; |
|
| 1490 | - $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"'; |
|
| 1489 | + $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=delete&task_id='.$assignment['task_id']; |
|
| 1490 | + $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"'; |
|
| 1491 | 1491 | |
| 1492 | 1492 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $assignment['username']), ENT_QUOTES); |
| 1493 | 1493 | |
| 1494 | - echo '<tr class="' . $css_class . '" valign="top">', |
|
| 1495 | - '<td width="240">' . Display::tag('span', api_get_person_name($assignment['firstname'], $assignment['lastname']), array('title'=>$username)) . '</td>', |
|
| 1496 | - '<td>'.stripslashes($assignment['title']) . '</td>', |
|
| 1497 | - '<td>'.stripslashes($assignment['description']) . '</td>', |
|
| 1498 | - '<td>' . $assignment['target_date'] . '</td>', |
|
| 1494 | + echo '<tr class="'.$css_class.'" valign="top">', |
|
| 1495 | + '<td width="240">'.Display::tag('span', api_get_person_name($assignment['firstname'], $assignment['lastname']), array('title'=>$username)).'</td>', |
|
| 1496 | + '<td>'.stripslashes($assignment['title']).'</td>', |
|
| 1497 | + '<td>'.stripslashes($assignment['description']).'</td>', |
|
| 1498 | + '<td>'.$assignment['target_date'].'</td>', |
|
| 1499 | 1499 | '<td width="50">', |
| 1500 | - '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=edit_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '">', |
|
| 1501 | - '<img src="../img/edit.gif" border="0" title="' . get_lang('EditTask') . '" />', |
|
| 1500 | + '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=edit_assignment&task_id='.$assignment['task_id'].'&user_id='.$assignment['user_id'].'">', |
|
| 1501 | + '<img src="../img/edit.gif" border="0" title="'.get_lang('EditTask').'" />', |
|
| 1502 | 1502 | "</a>\n", |
| 1503 | - '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete_assignment&task_id=' . $assignment['task_id'] . '&user_id=' . $assignment['user_id'] . '" ', |
|
| 1504 | - 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"', |
|
| 1505 | - '<img src="../img/' . $delete_icon . '" border="0" title="' . $delete_title . '" />', |
|
| 1503 | + '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=delete_assignment&task_id='.$assignment['task_id'].'&user_id='.$assignment['user_id'].'" ', |
|
| 1504 | + 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"', |
|
| 1505 | + '<img src="../img/'.$delete_icon.'" border="0" title="'.$delete_title.'" />', |
|
| 1506 | 1506 | "</a>\n", |
| 1507 | 1507 | '</td>', |
| 1508 | 1508 | '</tr>'; |
@@ -1515,7 +1515,7 @@ discard block |
||
| 1515 | 1515 | * @author Toon Keppens |
| 1516 | 1516 | * |
| 1517 | 1517 | */ |
| 1518 | - public static function display_new_task_form ($blog_id) |
|
| 1518 | + public static function display_new_task_form($blog_id) |
|
| 1519 | 1519 | { |
| 1520 | 1520 | // Init |
| 1521 | 1521 | $colors = array( |
@@ -1537,7 +1537,7 @@ discard block |
||
| 1537 | 1537 | ); |
| 1538 | 1538 | |
| 1539 | 1539 | // form |
| 1540 | - echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">'; |
|
| 1540 | + echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'">'; |
|
| 1541 | 1541 | |
| 1542 | 1542 | // form title |
| 1543 | 1543 | echo '<legend>'.get_lang('AddTask').'</legend>'; |
@@ -1545,7 +1545,7 @@ discard block |
||
| 1545 | 1545 | // task title |
| 1546 | 1546 | echo ' <div class="control-group"> |
| 1547 | 1547 | <label class="control-label"> |
| 1548 | - <span class="form_required">*</span>' . get_lang('Title') . ' |
|
| 1548 | + <span class="form_required">*</span>' . get_lang('Title').' |
|
| 1549 | 1549 | </label> |
| 1550 | 1550 | <div class="controls"> |
| 1551 | 1551 | <input name="task_name" type="text" size="70" /> |
@@ -1555,7 +1555,7 @@ discard block |
||
| 1555 | 1555 | // task comment |
| 1556 | 1556 | echo ' <div class="control-group"> |
| 1557 | 1557 | <label class="control-label"> |
| 1558 | - ' . get_lang('Description') . ' |
|
| 1558 | + ' . get_lang('Description').' |
|
| 1559 | 1559 | </label> |
| 1560 | 1560 | <div class="controls"> |
| 1561 | 1561 | <textarea name="task_description" cols="45"></textarea> |
@@ -1565,18 +1565,18 @@ discard block |
||
| 1565 | 1565 | // task management |
| 1566 | 1566 | echo ' <div class="control-group"> |
| 1567 | 1567 | <label class="control-label"> |
| 1568 | - ' . get_lang('TaskManager') . ' |
|
| 1568 | + ' . get_lang('TaskManager').' |
|
| 1569 | 1569 | </label> |
| 1570 | 1570 | <div class="controls">'; |
| 1571 | 1571 | echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">'; |
| 1572 | 1572 | echo '<tr>'; |
| 1573 | - echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>'; |
|
| 1574 | - echo '<th width:223px;>' . get_lang('CommentManager') . '</th>'; |
|
| 1573 | + echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>'; |
|
| 1574 | + echo '<th width:223px;>'.get_lang('CommentManager').'</th>'; |
|
| 1575 | 1575 | echo '</tr>'; |
| 1576 | 1576 | echo '<tr>'; |
| 1577 | - echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1578 | - echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>'; |
|
| 1579 | - echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1577 | + echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>'; |
|
| 1578 | + echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>'; |
|
| 1579 | + echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>'; |
|
| 1580 | 1580 | echo '</tr>'; |
| 1581 | 1581 | echo '<tr>'; |
| 1582 | 1582 | echo '<td style="text-align:center;"><input id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
@@ -1591,13 +1591,13 @@ discard block |
||
| 1591 | 1591 | // task color |
| 1592 | 1592 | echo ' <div class="control-group"> |
| 1593 | 1593 | <label class="control-label"> |
| 1594 | - ' . get_lang('Color') . ' |
|
| 1594 | + ' . get_lang('Color').' |
|
| 1595 | 1595 | </label> |
| 1596 | 1596 | <div class="controls">'; |
| 1597 | 1597 | echo '<select name="task_color" id="color" style="width: 150px; background-color: #eeeeee" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">'; |
| 1598 | 1598 | foreach ($colors as $color) { |
| 1599 | - $style = 'style="background-color: #' . $color . '"'; |
|
| 1600 | - echo '<option value="' . $color . '" ' . $style . '> </option>'; |
|
| 1599 | + $style = 'style="background-color: #'.$color.'"'; |
|
| 1600 | + echo '<option value="'.$color.'" '.$style.'> </option>'; |
|
| 1601 | 1601 | } |
| 1602 | 1602 | echo '</select>'; |
| 1603 | 1603 | echo ' </div> |
@@ -1608,7 +1608,7 @@ discard block |
||
| 1608 | 1608 | <div class="controls"> |
| 1609 | 1609 | <input type="hidden" name="action" value="" /> |
| 1610 | 1610 | <input type="hidden" name="new_task_submit" value="true" /> |
| 1611 | - <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button> |
|
| 1611 | + <button class="save" type="submit" name="Submit">' . get_lang('Save').'</button> |
|
| 1612 | 1612 | </div> |
| 1613 | 1613 | </div>'; |
| 1614 | 1614 | echo '</form>'; |
@@ -1622,34 +1622,34 @@ discard block |
||
| 1622 | 1622 | * @author Toon Keppens |
| 1623 | 1623 | * |
| 1624 | 1624 | */ |
| 1625 | - public static function display_edit_task_form ($blog_id, $task_id) { |
|
| 1625 | + public static function display_edit_task_form($blog_id, $task_id) { |
|
| 1626 | 1626 | $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS); |
| 1627 | 1627 | $course_id = api_get_course_int_id(); |
| 1628 | 1628 | |
| 1629 | - $colors = array('FFFFFF','FFFF99','FFCC99','FF9933','FF6699','CCFF99','CC9966','66FF00', '9966FF', 'CF3F3F', '990033','669933','0033FF','003366','000000'); |
|
| 1629 | + $colors = array('FFFFFF', 'FFFF99', 'FFCC99', 'FF9933', 'FF6699', 'CCFF99', 'CC9966', '66FF00', '9966FF', 'CF3F3F', '990033', '669933', '0033FF', '003366', '000000'); |
|
| 1630 | 1630 | |
| 1631 | - $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int)$task_id."'"; |
|
| 1631 | + $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int) $task_id."'"; |
|
| 1632 | 1632 | $result = Database::query($sql); |
| 1633 | 1633 | $task = Database::fetch_array($result); |
| 1634 | 1634 | |
| 1635 | 1635 | // Display |
| 1636 | - echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '"> |
|
| 1637 | - <legend>' . get_lang('EditTask') . '</legend> |
|
| 1636 | + echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'"> |
|
| 1637 | + <legend>' . get_lang('EditTask').'</legend> |
|
| 1638 | 1638 | <table width="100%" border="0" cellspacing="2"> |
| 1639 | 1639 | <tr> |
| 1640 | - <td align="right">' . get_lang('Title') . ': </td> |
|
| 1641 | - <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']) . '" /></td> |
|
| 1640 | + <td align="right">' . get_lang('Title').': </td> |
|
| 1641 | + <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']).'" /></td> |
|
| 1642 | 1642 | </tr> |
| 1643 | 1643 | <tr> |
| 1644 | - <td align="right">' . get_lang('Description') . ': </td> |
|
| 1644 | + <td align="right">' . get_lang('Description').': </td> |
|
| 1645 | 1645 | <td><textarea name="task_description" cols="45">'.Security::remove_XSS($task['description']).'</textarea></td> |
| 1646 | 1646 | </tr>'; |
| 1647 | 1647 | |
| 1648 | 1648 | /* edit by Kevin Van Den Haute ([email protected]) */ |
| 1649 | 1649 | $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
| 1650 | 1650 | |
| 1651 | - $sql = " SELECT id, action FROM " . $tbl_tasks_permissions . " |
|
| 1652 | - WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'"; |
|
| 1651 | + $sql = " SELECT id, action FROM ".$tbl_tasks_permissions." |
|
| 1652 | + WHERE c_id = $course_id AND task_id = '".(int) $task_id."'"; |
|
| 1653 | 1653 | $result = Database::query($sql); |
| 1654 | 1654 | |
| 1655 | 1655 | $arrPermissions = array(); |
@@ -1658,22 +1658,22 @@ discard block |
||
| 1658 | 1658 | $arrPermissions[] = $row['action']; |
| 1659 | 1659 | |
| 1660 | 1660 | echo '<tr>'; |
| 1661 | - echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ': </td>'; |
|
| 1661 | + echo '<td style="text-align:right; vertical-align:top;">'.get_lang('TaskManager').': </td>'; |
|
| 1662 | 1662 | echo '<td>'; |
| 1663 | 1663 | echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">'; |
| 1664 | 1664 | echo '<tr>'; |
| 1665 | - echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>'; |
|
| 1666 | - echo '<th width:223px;>' . get_lang('CommentManager') . '</th>'; |
|
| 1665 | + echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>'; |
|
| 1666 | + echo '<th width:223px;>'.get_lang('CommentManager').'</th>'; |
|
| 1667 | 1667 | echo '</tr>'; |
| 1668 | 1668 | echo '<tr>'; |
| 1669 | - echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1670 | - echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>'; |
|
| 1671 | - echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>'; |
|
| 1669 | + echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>'; |
|
| 1670 | + echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>'; |
|
| 1671 | + echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>'; |
|
| 1672 | 1672 | echo '</tr>'; |
| 1673 | 1673 | echo '<tr>'; |
| 1674 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_delete', $arrPermissions)) ? 'checked ' : '') . 'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
|
| 1675 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_edit', $arrPermissions)) ? 'checked ' : '') . 'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>'; |
|
| 1676 | - echo '<td style="text-align:center;"><input ' . ((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '') . 'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>'; |
|
| 1674 | + echo '<td style="text-align:center;"><input '.((in_array('article_delete', $arrPermissions)) ? 'checked ' : '').'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>'; |
|
| 1675 | + echo '<td style="text-align:center;"><input '.((in_array('article_edit', $arrPermissions)) ? 'checked ' : '').'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>'; |
|
| 1676 | + echo '<td style="text-align:center;"><input '.((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '').'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>'; |
|
| 1677 | 1677 | echo '</tr>'; |
| 1678 | 1678 | echo '</table>'; |
| 1679 | 1679 | echo '</td>'; |
@@ -1681,13 +1681,13 @@ discard block |
||
| 1681 | 1681 | /* end of edit */ |
| 1682 | 1682 | |
| 1683 | 1683 | echo '<tr> |
| 1684 | - <td align="right">' . get_lang('Color') . ': </td> |
|
| 1684 | + <td align="right">' . get_lang('Color').': </td> |
|
| 1685 | 1685 | <td> |
| 1686 | - <select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'] . '" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">'; |
|
| 1686 | + <select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'].'" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">'; |
|
| 1687 | 1687 | foreach ($colors as $color) { |
| 1688 | 1688 | $selected = ($color == $task['color']) ? ' selected' : ''; |
| 1689 | - $style = 'style="background-color: #' . $color . '"'; |
|
| 1690 | - echo '<option value="' . $color . '" ' . $style . ' ' . $selected . ' > </option>'; |
|
| 1689 | + $style = 'style="background-color: #'.$color.'"'; |
|
| 1690 | + echo '<option value="'.$color.'" '.$style.' '.$selected.' > </option>'; |
|
| 1691 | 1691 | } |
| 1692 | 1692 | echo ' </select> |
| 1693 | 1693 | </td> |
@@ -1696,9 +1696,9 @@ discard block |
||
| 1696 | 1696 | <td align="right"> </td> |
| 1697 | 1697 | <td><br /><input type="hidden" name="action" value="" /> |
| 1698 | 1698 | <input type="hidden" name="edit_task_submit" value="true" /> |
| 1699 | - <input type="hidden" name="task_id" value="' . $task['task_id'] . '" /> |
|
| 1700 | - <input type="hidden" name="blog_id" value="' . $task['blog_id'] . '" /> |
|
| 1701 | - <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button></td> |
|
| 1699 | + <input type="hidden" name="task_id" value="' . $task['task_id'].'" /> |
|
| 1700 | + <input type="hidden" name="blog_id" value="' . $task['blog_id'].'" /> |
|
| 1701 | + <button class="save" type="submit" name="Submit">' . get_lang('Save').'</button></td> |
|
| 1702 | 1702 | </tr> |
| 1703 | 1703 | </table> |
| 1704 | 1704 | </form>'; |
@@ -1720,7 +1720,7 @@ discard block |
||
| 1720 | 1720 | FROM $tbl_users user |
| 1721 | 1721 | INNER JOIN $tbl_blogs_rel_user blogs_rel_user |
| 1722 | 1722 | ON user.user_id = blogs_rel_user.user_id |
| 1723 | - WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'"; |
|
| 1723 | + WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int) $blog_id."'"; |
|
| 1724 | 1724 | $result = Database::query($sql); |
| 1725 | 1725 | |
| 1726 | 1726 | $options = array(); |
@@ -1739,7 +1739,7 @@ discard block |
||
| 1739 | 1739 | color, |
| 1740 | 1740 | system_task |
| 1741 | 1741 | FROM $tbl_blogs_tasks |
| 1742 | - WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . " |
|
| 1742 | + WHERE c_id = $course_id AND blog_id = ".(int) $blog_id." |
|
| 1743 | 1743 | ORDER BY system_task, title"; |
| 1744 | 1744 | $result = Database::query($sql); |
| 1745 | 1745 | |
@@ -1787,7 +1787,7 @@ discard block |
||
| 1787 | 1787 | */ |
| 1788 | 1788 | public static function display_edit_assigned_task_form($blog_id, $task_id, $user_id) |
| 1789 | 1789 | { |
| 1790 | - $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1790 | + $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 1791 | 1791 | |
| 1792 | 1792 | $course_id = api_get_course_int_id(); |
| 1793 | 1793 | |
@@ -1796,9 +1796,9 @@ discard block |
||
| 1796 | 1796 | SELECT target_date |
| 1797 | 1797 | FROM $tbl_blogs_tasks_rel_user |
| 1798 | 1798 | WHERE c_id = $course_id AND |
| 1799 | - blog_id = '".(int)$blog_id."' AND |
|
| 1800 | - user_id = '".(int)$user_id."' AND |
|
| 1801 | - task_id = '".(int)$task_id."'"; |
|
| 1799 | + blog_id = '".(int) $blog_id."' AND |
|
| 1800 | + user_id = '".(int) $user_id."' AND |
|
| 1801 | + task_id = '".(int) $task_id."'"; |
|
| 1802 | 1802 | $result = Database::query($sql); |
| 1803 | 1803 | $row = Database::fetch_assoc($result); |
| 1804 | 1804 | |
@@ -1833,11 +1833,11 @@ discard block |
||
| 1833 | 1833 | |
| 1834 | 1834 | $sql = " |
| 1835 | 1835 | SELECT COUNT(*) as 'number' |
| 1836 | - FROM " . $tbl_blogs_tasks_rel_user . " |
|
| 1836 | + FROM " . $tbl_blogs_tasks_rel_user." |
|
| 1837 | 1837 | WHERE c_id = $course_id AND |
| 1838 | - blog_id = " . (int)$blog_id . " |
|
| 1839 | - AND user_id = " . (int)$user_id . " |
|
| 1840 | - AND task_id = " . (int)$task_id . " |
|
| 1838 | + blog_id = ".(int) $blog_id." |
|
| 1839 | + AND user_id = " . (int) $user_id." |
|
| 1840 | + AND task_id = " . (int) $task_id." |
|
| 1841 | 1841 | "; |
| 1842 | 1842 | |
| 1843 | 1843 | $result = Database::query($sql); |
@@ -1845,18 +1845,18 @@ discard block |
||
| 1845 | 1845 | |
| 1846 | 1846 | if ($row['number'] == 0) { |
| 1847 | 1847 | $sql = " |
| 1848 | - INSERT INTO " . $tbl_blogs_tasks_rel_user . " ( |
|
| 1848 | + INSERT INTO " . $tbl_blogs_tasks_rel_user." ( |
|
| 1849 | 1849 | c_id, |
| 1850 | 1850 | blog_id, |
| 1851 | 1851 | user_id, |
| 1852 | 1852 | task_id, |
| 1853 | 1853 | target_date |
| 1854 | 1854 | ) VALUES ( |
| 1855 | - '" . (int)$course_id . "', |
|
| 1856 | - '" . (int)$blog_id . "', |
|
| 1857 | - '" . (int)$user_id . "', |
|
| 1858 | - '" . (int)$task_id . "', |
|
| 1859 | - '" . Database::escape_string($target_date) . "' |
|
| 1855 | + '" . (int) $course_id."', |
|
| 1856 | + '" . (int) $blog_id."', |
|
| 1857 | + '" . (int) $user_id."', |
|
| 1858 | + '" . (int) $task_id."', |
|
| 1859 | + '" . Database::escape_string($target_date)."' |
|
| 1860 | 1860 | )"; |
| 1861 | 1861 | |
| 1862 | 1862 | Database::query($sql); |
@@ -1886,12 +1886,12 @@ discard block |
||
| 1886 | 1886 | $course_id = api_get_course_int_id(); |
| 1887 | 1887 | |
| 1888 | 1888 | $sql = "SELECT COUNT(*) as 'number' |
| 1889 | - FROM " . $tbl_blogs_tasks_rel_user . " |
|
| 1889 | + FROM " . $tbl_blogs_tasks_rel_user." |
|
| 1890 | 1890 | WHERE |
| 1891 | 1891 | c_id = $course_id AND |
| 1892 | - blog_id = " . (int)$blog_id . " AND |
|
| 1893 | - user_id = " . (int)$user_id . " AND |
|
| 1894 | - task_id = " . (int)$task_id . " |
|
| 1892 | + blog_id = ".(int) $blog_id." AND |
|
| 1893 | + user_id = " . (int) $user_id." AND |
|
| 1894 | + task_id = " . (int) $task_id." |
|
| 1895 | 1895 | "; |
| 1896 | 1896 | |
| 1897 | 1897 | $result = Database::query($sql); |
@@ -1899,17 +1899,17 @@ discard block |
||
| 1899 | 1899 | |
| 1900 | 1900 | if ($row['number'] == 0 || ($row['number'] != 0 && $task_id == $old_task_id && $user_id == $old_user_id)) { |
| 1901 | 1901 | $sql = " |
| 1902 | - UPDATE " . $tbl_blogs_tasks_rel_user . " |
|
| 1902 | + UPDATE " . $tbl_blogs_tasks_rel_user." |
|
| 1903 | 1903 | SET |
| 1904 | - user_id = " . (int)$user_id . ", |
|
| 1905 | - task_id = " . (int)$task_id . ", |
|
| 1906 | - target_date = '" . Database::escape_string($target_date) . "' |
|
| 1904 | + user_id = " . (int) $user_id.", |
|
| 1905 | + task_id = " . (int) $task_id.", |
|
| 1906 | + target_date = '" . Database::escape_string($target_date)."' |
|
| 1907 | 1907 | WHERE |
| 1908 | 1908 | c_id = $course_id AND |
| 1909 | - blog_id = " . (int)$blog_id . " AND |
|
| 1910 | - user_id = " . (int)$old_user_id . " AND |
|
| 1911 | - task_id = " . (int)$old_task_id . " AND |
|
| 1912 | - target_date = '" . Database::escape_string($old_target_date) . "' |
|
| 1909 | + blog_id = ".(int) $blog_id." AND |
|
| 1910 | + user_id = " . (int) $old_user_id." AND |
|
| 1911 | + task_id = " . (int) $old_task_id." AND |
|
| 1912 | + target_date = '" . Database::escape_string($old_target_date)."' |
|
| 1913 | 1913 | "; |
| 1914 | 1914 | Database::query($sql); |
| 1915 | 1915 | } |
@@ -1930,7 +1930,7 @@ discard block |
||
| 1930 | 1930 | |
| 1931 | 1931 | |
| 1932 | 1932 | $sql = "SELECT title, description FROM $tbl_blogs_tasks |
| 1933 | - WHERE task_id = '".(int)$task_id."' |
|
| 1933 | + WHERE task_id = '".(int) $task_id."' |
|
| 1934 | 1934 | AND c_id = $course_id"; |
| 1935 | 1935 | $result = Database::query($sql); |
| 1936 | 1936 | $row = Database::fetch_assoc($result); |
@@ -1938,19 +1938,19 @@ discard block |
||
| 1938 | 1938 | $sql = "SELECT post.*, user.lastname, user.firstname, user.username |
| 1939 | 1939 | FROM $tbl_blogs_posts post |
| 1940 | 1940 | INNER JOIN $tbl_users user ON post.author_id = user.user_id |
| 1941 | - WHERE post.blog_id = '".(int)$blog_id."' AND post.c_id = $course_id |
|
| 1941 | + WHERE post.blog_id = '".(int) $blog_id."' AND post.c_id = $course_id |
|
| 1942 | 1942 | ORDER BY post_id DESC |
| 1943 | 1943 | LIMIT 0, 100"; |
| 1944 | 1944 | $result = Database::query($sql); |
| 1945 | 1945 | |
| 1946 | 1946 | // Display |
| 1947 | - echo '<span class="blogpost_title">' . get_lang('SelectTaskArticle') . ' "' . stripslashes($row['title']) . '"</span>'; |
|
| 1948 | - echo '<span style="font-style: italic;"">'.stripslashes($row['description']) . '</span><br><br>'; |
|
| 1947 | + echo '<span class="blogpost_title">'.get_lang('SelectTaskArticle').' "'.stripslashes($row['title']).'"</span>'; |
|
| 1948 | + echo '<span style="font-style: italic;"">'.stripslashes($row['description']).'</span><br><br>'; |
|
| 1949 | 1949 | |
| 1950 | 1950 | if (Database::num_rows($result) > 0) { |
| 1951 | - while($blog_post = Database::fetch_array($result)) { |
|
| 1951 | + while ($blog_post = Database::fetch_array($result)) { |
|
| 1952 | 1952 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES); |
| 1953 | - echo '<a href="blog.php?action=execute_task&blog_id=' . $blog_id . '&task_id=' . $task_id . '&post_id=' . $blog_post['post_id'] . '#add_comment">'.stripslashes($blog_post['title']) . '</a>, ' . get_lang('WrittenBy') . ' ' . stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))) . '<br />'; |
|
| 1953 | + echo '<a href="blog.php?action=execute_task&blog_id='.$blog_id.'&task_id='.$task_id.'&post_id='.$blog_post['post_id'].'#add_comment">'.stripslashes($blog_post['title']).'</a>, '.get_lang('WrittenBy').' '.stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))).'<br />'; |
|
| 1954 | 1954 | } |
| 1955 | 1955 | } else { |
| 1956 | 1956 | echo get_lang('NoArticles'); |
@@ -1974,12 +1974,12 @@ discard block |
||
| 1974 | 1974 | |
| 1975 | 1975 | // Subscribe the user |
| 1976 | 1976 | $sql = "INSERT INTO $tbl_blogs_rel_user (c_id, blog_id, user_id ) |
| 1977 | - VALUES ($course_id, '".(int)$blog_id."', '".(int)$user_id."');"; |
|
| 1977 | + VALUES ($course_id, '".(int) $blog_id."', '".(int) $user_id."');"; |
|
| 1978 | 1978 | Database::query($sql); |
| 1979 | 1979 | |
| 1980 | 1980 | // Give this user basic rights |
| 1981 | 1981 | $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
| 1982 | - VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_add')"; |
|
| 1982 | + VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_add')"; |
|
| 1983 | 1983 | Database::query($sql); |
| 1984 | 1984 | |
| 1985 | 1985 | $id = Database::insert_id(); |
@@ -1989,7 +1989,7 @@ discard block |
||
| 1989 | 1989 | } |
| 1990 | 1990 | |
| 1991 | 1991 | $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action) |
| 1992 | - VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_comments_add')"; |
|
| 1992 | + VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_comments_add')"; |
|
| 1993 | 1993 | Database::query($sql); |
| 1994 | 1994 | |
| 1995 | 1995 | $id = Database::insert_id(); |
@@ -2015,12 +2015,12 @@ discard block |
||
| 2015 | 2015 | |
| 2016 | 2016 | // Unsubscribe the user |
| 2017 | 2017 | $sql = "DELETE FROM $tbl_blogs_rel_user |
| 2018 | - WHERE blog_id = '".(int)$blog_id."' AND user_id = '".(int)$user_id."'"; |
|
| 2018 | + WHERE blog_id = '".(int) $blog_id."' AND user_id = '".(int) $user_id."'"; |
|
| 2019 | 2019 | Database::query($sql); |
| 2020 | 2020 | |
| 2021 | 2021 | // Remove this user's permissions. |
| 2022 | 2022 | $sql = "DELETE FROM $tbl_user_permissions |
| 2023 | - WHERE user_id = '".(int)$user_id."'"; |
|
| 2023 | + WHERE user_id = '".(int) $user_id."'"; |
|
| 2024 | 2024 | Database::query($sql); |
| 2025 | 2025 | } |
| 2026 | 2026 | |
@@ -2041,7 +2041,7 @@ discard block |
||
| 2041 | 2041 | $course_id = $_course['real_id']; |
| 2042 | 2042 | |
| 2043 | 2043 | $currentCourse = $_course['code']; |
| 2044 | - $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2044 | + $tbl_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2045 | 2045 | $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER); |
| 2046 | 2046 | |
| 2047 | 2047 | echo '<legend>'.get_lang('SubscribeMembers').'</legend>'; |
@@ -2056,12 +2056,12 @@ discard block |
||
| 2056 | 2056 | $result = Database::query($sql); |
| 2057 | 2057 | |
| 2058 | 2058 | $blog_member_ids = array(); |
| 2059 | - while($user = Database::fetch_array($result)) { |
|
| 2059 | + while ($user = Database::fetch_array($result)) { |
|
| 2060 | 2060 | $blog_member_ids[] = $user['user_id']; |
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 2063 | 2063 | // Set table headers |
| 2064 | - $column_header[] = array ('', false, ''); |
|
| 2064 | + $column_header[] = array('', false, ''); |
|
| 2065 | 2065 | if ($is_western_name_order) { |
| 2066 | 2066 | $column_header[] = array(get_lang('FirstName'), true, ''); |
| 2067 | 2067 | $column_header[] = array(get_lang('LastName'), true, ''); |
@@ -2081,13 +2081,13 @@ discard block |
||
| 2081 | 2081 | |
| 2082 | 2082 | // Add users that are not in this blog to the list. |
| 2083 | 2083 | foreach ($student_list as $key=>$user) { |
| 2084 | - if(isset($user['id_user'])) { |
|
| 2084 | + if (isset($user['id_user'])) { |
|
| 2085 | 2085 | $user['user_id'] = $user['id_user']; |
| 2086 | 2086 | } |
| 2087 | - if(!in_array($user['user_id'],$blog_member_ids)) { |
|
| 2087 | + if (!in_array($user['user_id'], $blog_member_ids)) { |
|
| 2088 | 2088 | $a_infosUser = api_get_user_info($user['user_id']); |
| 2089 | - $row = array (); |
|
| 2090 | - $row[] = '<input type="checkbox" name="user[]" value="' . $a_infosUser['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '') . '/>'; |
|
| 2089 | + $row = array(); |
|
| 2090 | + $row[] = '<input type="checkbox" name="user[]" value="'.$a_infosUser['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '').'/>'; |
|
| 2091 | 2091 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $a_infosUser["username"]), ENT_QUOTES); |
| 2092 | 2092 | if ($is_western_name_order) { |
| 2093 | 2093 | $row[] = $a_infosUser["firstname"]; |
@@ -2099,8 +2099,8 @@ discard block |
||
| 2099 | 2099 | $row[] = Display::icon_mailto_link($a_infosUser["email"]); |
| 2100 | 2100 | |
| 2101 | 2101 | //Link to register users |
| 2102 | - if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']){ |
|
| 2103 | - $row[] = "<a class=\"btn btn-primary \" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id®ister=yes&user_id=" . $a_infosUser["user_id"]."\">" . get_lang('Register')."</a>"; |
|
| 2102 | + if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']) { |
|
| 2103 | + $row[] = "<a class=\"btn btn-primary \" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id®ister=yes&user_id=".$a_infosUser["user_id"]."\">".get_lang('Register')."</a>"; |
|
| 2104 | 2104 | } else { |
| 2105 | 2105 | $row[] = ''; |
| 2106 | 2106 | } |
@@ -2111,20 +2111,20 @@ discard block |
||
| 2111 | 2111 | // Display |
| 2112 | 2112 | $query_vars['action'] = 'manage_members'; |
| 2113 | 2113 | $query_vars['blog_id'] = $blog_id; |
| 2114 | - echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
| 2115 | - Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
| 2114 | + echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">'; |
|
| 2115 | + Display::display_sortable_table($column_header, $user_data, null, null, $query_vars); |
|
| 2116 | 2116 | $link = ''; |
| 2117 | - $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']) . '&' : ''; |
|
| 2117 | + $link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : ''; |
|
| 2118 | 2118 | $link .= "blog_id=$blog_id&"; |
| 2119 | 2119 | |
| 2120 | - echo '<a href="blog.php?' . $link . 'selectall=subscribe">' . get_lang('SelectAll') . '</a> - '; |
|
| 2121 | - echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
| 2122 | - echo get_lang('WithSelected') . ' : '; |
|
| 2120 | + echo '<a href="blog.php?'.$link.'selectall=subscribe">'.get_lang('SelectAll').'</a> - '; |
|
| 2121 | + echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> '; |
|
| 2122 | + echo get_lang('WithSelected').' : '; |
|
| 2123 | 2123 | echo '<select name="action">'; |
| 2124 | - echo '<option value="select_subscribe">' . get_lang('Register') . '</option>'; |
|
| 2124 | + echo '<option value="select_subscribe">'.get_lang('Register').'</option>'; |
|
| 2125 | 2125 | echo '</select>'; |
| 2126 | 2126 | echo '<input type="hidden" name="register" value="true" />'; |
| 2127 | - echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
| 2127 | + echo '<button class="save" type="submit">'.get_lang('Ok').'</button>'; |
|
| 2128 | 2128 | echo '</form>'; |
| 2129 | 2129 | } |
| 2130 | 2130 | |
@@ -2137,7 +2137,7 @@ discard block |
||
| 2137 | 2137 | * |
| 2138 | 2138 | * @return Html Form with sortable table with users to unsubcribe from a blog. |
| 2139 | 2139 | */ |
| 2140 | - public static function display_form_user_unsubscribe ($blog_id) |
|
| 2140 | + public static function display_form_user_unsubscribe($blog_id) |
|
| 2141 | 2141 | { |
| 2142 | 2142 | $_user = api_get_user_info(); |
| 2143 | 2143 | $is_western_name_order = api_is_western_name_order(); |
@@ -2150,34 +2150,34 @@ discard block |
||
| 2150 | 2150 | |
| 2151 | 2151 | $properties["width"] = "100%"; |
| 2152 | 2152 | //table column titles |
| 2153 | - $column_header[] = array ('', false, ''); |
|
| 2153 | + $column_header[] = array('', false, ''); |
|
| 2154 | 2154 | if ($is_western_name_order) { |
| 2155 | - $column_header[] = array (get_lang('FirstName'), true, ''); |
|
| 2156 | - $column_header[] = array (get_lang('LastName'), true, ''); |
|
| 2155 | + $column_header[] = array(get_lang('FirstName'), true, ''); |
|
| 2156 | + $column_header[] = array(get_lang('LastName'), true, ''); |
|
| 2157 | 2157 | } else { |
| 2158 | - $column_header[] = array (get_lang('LastName'), true, ''); |
|
| 2159 | - $column_header[] = array (get_lang('FirstName'), true, ''); |
|
| 2158 | + $column_header[] = array(get_lang('LastName'), true, ''); |
|
| 2159 | + $column_header[] = array(get_lang('FirstName'), true, ''); |
|
| 2160 | 2160 | } |
| 2161 | - $column_header[] = array (get_lang('Email'), false, ''); |
|
| 2162 | - $column_header[] = array (get_lang('TaskManager'), true, ''); |
|
| 2163 | - $column_header[] = array (get_lang('UnRegister'), false, ''); |
|
| 2161 | + $column_header[] = array(get_lang('Email'), false, ''); |
|
| 2162 | + $column_header[] = array(get_lang('TaskManager'), true, ''); |
|
| 2163 | + $column_header[] = array(get_lang('UnRegister'), false, ''); |
|
| 2164 | 2164 | |
| 2165 | 2165 | $course_id = api_get_course_int_id(); |
| 2166 | 2166 | |
| 2167 | 2167 | $sql = "SELECT user.user_id, user.lastname, user.firstname, user.email, user.username |
| 2168 | 2168 | FROM $tbl_users user INNER JOIN $tbl_blogs_rel_user blogs_rel_user |
| 2169 | 2169 | ON user.user_id = blogs_rel_user.user_id |
| 2170 | - WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'"; |
|
| 2170 | + WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int) $blog_id."'"; |
|
| 2171 | 2171 | |
| 2172 | 2172 | if (!($sql_result = Database::query($sql))) { |
| 2173 | 2173 | return false; |
| 2174 | 2174 | } |
| 2175 | 2175 | |
| 2176 | - $user_data = array (); |
|
| 2176 | + $user_data = array(); |
|
| 2177 | 2177 | |
| 2178 | 2178 | while ($myrow = Database::fetch_array($sql_result)) { |
| 2179 | - $row = array (); |
|
| 2180 | - $row[] = '<input type="checkbox" name="user[]" value="' . $myrow['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '') . '/>'; |
|
| 2179 | + $row = array(); |
|
| 2180 | + $row[] = '<input type="checkbox" name="user[]" value="'.$myrow['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '').'/>'; |
|
| 2181 | 2181 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $myrow["username"]), ENT_QUOTES); |
| 2182 | 2182 | if ($is_western_name_order) { |
| 2183 | 2183 | $row[] = $myrow["firstname"]; |
@@ -2189,19 +2189,19 @@ discard block |
||
| 2189 | 2189 | $row[] = Display::icon_mailto_link($myrow["email"]); |
| 2190 | 2190 | |
| 2191 | 2191 | $sql = "SELECT bt.title task |
| 2192 | - FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " btu |
|
| 2193 | - INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS) . " bt |
|
| 2192 | + FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." btu |
|
| 2193 | + INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS)." bt |
|
| 2194 | 2194 | ON btu.task_id = bt.task_id |
| 2195 | 2195 | WHERE btu.c_id = $course_id AND |
| 2196 | 2196 | bt.c_id = $course_id AND |
| 2197 | 2197 | btu.blog_id = $blog_id AND |
| 2198 | - btu.user_id = " . $myrow['user_id']; |
|
| 2198 | + btu.user_id = ".$myrow['user_id']; |
|
| 2199 | 2199 | $sql_res = Database::query($sql); |
| 2200 | 2200 | |
| 2201 | 2201 | $task = ''; |
| 2202 | 2202 | |
| 2203 | - while($r = Database::fetch_array($sql_res)) { |
|
| 2204 | - $task .= stripslashes($r['task']) . ', '; |
|
| 2203 | + while ($r = Database::fetch_array($sql_res)) { |
|
| 2204 | + $task .= stripslashes($r['task']).', '; |
|
| 2205 | 2205 | } |
| 2206 | 2206 | //echo $task; |
| 2207 | 2207 | $task = (api_strlen(trim($task)) != 0) ? api_substr($task, 0, api_strlen($task) - 2) : get_lang('Reader'); |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | //Link to register users |
| 2210 | 2210 | |
| 2211 | 2211 | if ($myrow["user_id"] != $_user['user_id']) { |
| 2212 | - $row[] = "<a class=\"btn btn-primary\" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=" . $myrow['user_id']."\">" . get_lang('UnRegister')."</a>"; |
|
| 2212 | + $row[] = "<a class=\"btn btn-primary\" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=".$myrow['user_id']."\">".get_lang('UnRegister')."</a>"; |
|
| 2213 | 2213 | } else { |
| 2214 | 2214 | $row[] = ''; |
| 2215 | 2215 | } |
@@ -2219,20 +2219,20 @@ discard block |
||
| 2219 | 2219 | |
| 2220 | 2220 | $query_vars['action'] = 'manage_members'; |
| 2221 | 2221 | $query_vars['blog_id'] = $blog_id; |
| 2222 | - echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">'; |
|
| 2223 | - Display::display_sortable_table($column_header, $user_data,null,null,$query_vars); |
|
| 2222 | + echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">'; |
|
| 2223 | + Display::display_sortable_table($column_header, $user_data, null, null, $query_vars); |
|
| 2224 | 2224 | $link = ''; |
| 2225 | - $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']). '&' : ''; |
|
| 2225 | + $link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : ''; |
|
| 2226 | 2226 | $link .= "blog_id=$blog_id&"; |
| 2227 | 2227 | |
| 2228 | - echo '<a href="blog.php?' . $link . 'selectall=unsubscribe">' . get_lang('SelectAll') . '</a> - '; |
|
| 2229 | - echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> '; |
|
| 2230 | - echo get_lang('WithSelected') . ' : '; |
|
| 2228 | + echo '<a href="blog.php?'.$link.'selectall=unsubscribe">'.get_lang('SelectAll').'</a> - '; |
|
| 2229 | + echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> '; |
|
| 2230 | + echo get_lang('WithSelected').' : '; |
|
| 2231 | 2231 | echo '<select name="action">'; |
| 2232 | - echo '<option value="select_unsubscribe">' . get_lang('UnRegister') . '</option>'; |
|
| 2232 | + echo '<option value="select_unsubscribe">'.get_lang('UnRegister').'</option>'; |
|
| 2233 | 2233 | echo '</select>'; |
| 2234 | 2234 | echo '<input type="hidden" name="unregister" value="true" />'; |
| 2235 | - echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>'; |
|
| 2235 | + echo '<button class="save" type="submit">'.get_lang('Ok').'</button>'; |
|
| 2236 | 2236 | echo '</form>'; |
| 2237 | 2237 | } |
| 2238 | 2238 | |
@@ -2242,7 +2242,7 @@ discard block |
||
| 2242 | 2242 | * |
| 2243 | 2243 | * @param Integer $blog_id |
| 2244 | 2244 | */ |
| 2245 | - public static function display_form_user_rights ($blog_id) |
|
| 2245 | + public static function display_form_user_rights($blog_id) |
|
| 2246 | 2246 | { |
| 2247 | 2247 | echo '<legend>'.get_lang('RightsManager').'</legend>'; |
| 2248 | 2248 | echo '<br />'; |
@@ -2262,7 +2262,7 @@ discard block |
||
| 2262 | 2262 | $form = new FormValidator( |
| 2263 | 2263 | 'add_post', |
| 2264 | 2264 | 'post', |
| 2265 | - api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=" . intval($blog_id) . "&post_id=".intval($post_id)."&".api_get_cidreq(), |
|
| 2265 | + api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=".intval($blog_id)."&post_id=".intval($post_id)."&".api_get_cidreq(), |
|
| 2266 | 2266 | null, |
| 2267 | 2267 | array('enctype' => 'multipart/form-data') |
| 2268 | 2268 | ); |
@@ -2330,21 +2330,21 @@ discard block |
||
| 2330 | 2330 | $course_id = api_get_course_int_id(); |
| 2331 | 2331 | |
| 2332 | 2332 | //Handle leap year |
| 2333 | - $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
| 2333 | + $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
|
| 2334 | 2334 | |
| 2335 | - if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
| 2335 | + if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
| 2336 | 2336 | $numberofdays[2] = 29; |
| 2337 | 2337 | |
| 2338 | 2338 | //Get the first day of the month |
| 2339 | 2339 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
| 2340 | - $monthName = $MonthsLong[$month-1]; |
|
| 2340 | + $monthName = $MonthsLong[$month - 1]; |
|
| 2341 | 2341 | |
| 2342 | 2342 | //Start the week on monday |
| 2343 | 2343 | $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6; |
| 2344 | 2344 | $blogId = isset($_GET['blog_id']) ? intval($_GET['blog_id']) : null; |
| 2345 | 2345 | $filter = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null; |
| 2346 | - $backwardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year); |
|
| 2347 | - $forewardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year); |
|
| 2346 | + $backwardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 1 ? 12 : $month - 1)."&year=".($month == 1 ? $year - 1 : $year); |
|
| 2347 | + $forewardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 12 ? 1 : $month + 1)."&year=".($month == 12 ? $year + 1 : $year); |
|
| 2348 | 2348 | |
| 2349 | 2349 | // Get posts for this month |
| 2350 | 2350 | $sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname |
@@ -2353,15 +2353,15 @@ discard block |
||
| 2353 | 2353 | ON post.author_id = user.user_id |
| 2354 | 2354 | WHERE |
| 2355 | 2355 | post.c_id = $course_id AND |
| 2356 | - post.blog_id = '".(int)$blog_id."' AND |
|
| 2357 | - MONTH(date_creation) = '".(int)$month."' AND |
|
| 2358 | - YEAR(date_creation) = '".(int)$year."' |
|
| 2356 | + post.blog_id = '".(int) $blog_id."' AND |
|
| 2357 | + MONTH(date_creation) = '".(int) $month."' AND |
|
| 2358 | + YEAR(date_creation) = '".(int) $year."' |
|
| 2359 | 2359 | ORDER BY date_creation"; |
| 2360 | 2360 | $result = Database::query($sql); |
| 2361 | 2361 | |
| 2362 | 2362 | // We will create an array of days on which there are posts. |
| 2363 | - if( Database::num_rows($result) > 0) { |
|
| 2364 | - while($blog_post = Database::fetch_array($result)) { |
|
| 2363 | + if (Database::num_rows($result) > 0) { |
|
| 2364 | + while ($blog_post = Database::fetch_array($result)) { |
|
| 2365 | 2365 | // If the day of this post is not yet in the array, add it. |
| 2366 | 2366 | if (!in_array($blog_post['post_day'], $posts)) |
| 2367 | 2367 | $posts[] = $blog_post['post_day']; |
@@ -2378,9 +2378,9 @@ discard block |
||
| 2378 | 2378 | task_rel_user.c_id = $course_id AND |
| 2379 | 2379 | task.c_id = $course_id AND |
| 2380 | 2380 | blog.c_id = $course_id AND |
| 2381 | - task_rel_user.user_id = '".(int)$_user['user_id']."' AND |
|
| 2382 | - MONTH(target_date) = '".(int)$month."' AND |
|
| 2383 | - YEAR(target_date) = '".(int)$year."' |
|
| 2381 | + task_rel_user.user_id = '".(int) $_user['user_id']."' AND |
|
| 2382 | + MONTH(target_date) = '".(int) $month."' AND |
|
| 2383 | + YEAR(target_date) = '".(int) $year."' |
|
| 2384 | 2384 | ORDER BY target_date ASC"; |
| 2385 | 2385 | $result = Database::query($sql); |
| 2386 | 2386 | |
@@ -2403,7 +2403,7 @@ discard block |
||
| 2403 | 2403 | |
| 2404 | 2404 | echo "<tr>\n"; |
| 2405 | 2405 | |
| 2406 | - for($ii = 1; $ii < 8; $ii ++) |
|
| 2406 | + for ($ii = 1; $ii < 8; $ii++) |
|
| 2407 | 2407 | echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
| 2408 | 2408 | |
| 2409 | 2409 | echo "</tr>"; |
@@ -2413,24 +2413,24 @@ discard block |
||
| 2413 | 2413 | |
| 2414 | 2414 | while ($curday <= $numberofdays[$month]) { |
| 2415 | 2415 | echo "<tr>"; |
| 2416 | - for ($ii = 0; $ii < 7; $ii ++) { |
|
| 2416 | + for ($ii = 0; $ii < 7; $ii++) { |
|
| 2417 | 2417 | if (($curday == -1) && ($ii == $startdayofweek)) |
| 2418 | 2418 | $curday = 1; |
| 2419 | 2419 | |
| 2420 | 2420 | if (($curday > 0) && ($curday <= $numberofdays[$month])) { |
| 2421 | - $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\""; |
|
| 2421 | + $bgcolor = $ii < 5 ? $class = "class=\"days_week\"" : $class = "class=\"days_weekend\""; |
|
| 2422 | 2422 | $dayheader = "$curday"; |
| 2423 | 2423 | |
| 2424 | - if(($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { |
|
| 2424 | + if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) { |
|
| 2425 | 2425 | $dayheader = "$curday"; |
| 2426 | 2426 | $class = "class=\"days_today\""; |
| 2427 | 2427 | } |
| 2428 | 2428 | |
| 2429 | - echo "<td " . $class.">"; |
|
| 2429 | + echo "<td ".$class.">"; |
|
| 2430 | 2430 | |
| 2431 | 2431 | // If there are posts on this day, create a filter link. |
| 2432 | - if(in_array($curday, $posts)) |
|
| 2433 | - echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
| 2432 | + if (in_array($curday, $posts)) |
|
| 2433 | + echo '<a href="blog.php?blog_id='.$blog_id.'&filter='.$year.'-'.$month.'-'.$curday.'&month='.$month.'&year='.$year.'" title="'.get_lang('ViewPostsOfThisDay').'">'.$curday.'</a>'; |
|
| 2434 | 2434 | else |
| 2435 | 2435 | echo $dayheader; |
| 2436 | 2436 | |
@@ -2438,14 +2438,14 @@ discard block |
||
| 2438 | 2438 | if (isset($tasks[$curday]) && is_array($tasks[$curday])) { |
| 2439 | 2439 | // Add tasks to calendar |
| 2440 | 2440 | foreach ($tasks[$curday] as $task) { |
| 2441 | - echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '"> |
|
| 2442 | - <img src="../img/blog_task.gif" alt="Task" title="' . get_lang('ExecuteThisTask') . '" /></a>'; |
|
| 2441 | + echo '<a href="blog.php?action=execute_task&blog_id='.$task['blog_id'].'&task_id='.stripslashes($task['task_id']).'" title="'.$task['title'].' : '.get_lang('InBlog').' : '.$task['blog_name'].' - '.get_lang('ExecuteThisTask').'"> |
|
| 2442 | + <img src="../img/blog_task.gif" alt="Task" title="' . get_lang('ExecuteThisTask').'" /></a>'; |
|
| 2443 | 2443 | } |
| 2444 | 2444 | } |
| 2445 | 2445 | } |
| 2446 | 2446 | |
| 2447 | 2447 | echo "</td>"; |
| 2448 | - $curday ++; |
|
| 2448 | + $curday++; |
|
| 2449 | 2449 | } else |
| 2450 | 2450 | echo "<td> </td>"; |
| 2451 | 2451 | } |
@@ -2483,7 +2483,7 @@ discard block |
||
| 2483 | 2483 | public static function display_edit_blog_form($blog_id) |
| 2484 | 2484 | { |
| 2485 | 2485 | $course_id = api_get_course_int_id(); |
| 2486 | - $blog_id= intval($blog_id); |
|
| 2486 | + $blog_id = intval($blog_id); |
|
| 2487 | 2487 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
| 2488 | 2488 | |
| 2489 | 2489 | $sql = "SELECT blog_id, blog_name, blog_subtitle |
@@ -2498,7 +2498,7 @@ discard block |
||
| 2498 | 2498 | $blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']); |
| 2499 | 2499 | } |
| 2500 | 2500 | |
| 2501 | - $form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id'])); |
|
| 2501 | + $form = new FormValidator('edit_blog', 'post', 'blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id'])); |
|
| 2502 | 2502 | $form->addElement('header', get_lang('EditBlog')); |
| 2503 | 2503 | $form->addElement('text', 'blog_name', get_lang('Title')); |
| 2504 | 2504 | $form->addElement('textarea', 'blog_subtitle', get_lang('SubTitle')); |
@@ -2535,8 +2535,8 @@ discard block |
||
| 2535 | 2535 | $result = Database::query($sql); |
| 2536 | 2536 | $list_info = array(); |
| 2537 | 2537 | if (Database::num_rows($result)) { |
| 2538 | - while ($row_project=Database::fetch_row($result)) { |
|
| 2539 | - $list_info[]=$row_project; |
|
| 2538 | + while ($row_project = Database::fetch_row($result)) { |
|
| 2539 | + $list_info[] = $row_project; |
|
| 2540 | 2540 | } |
| 2541 | 2541 | } |
| 2542 | 2542 | |
@@ -2548,39 +2548,39 @@ discard block |
||
| 2548 | 2548 | // Validation when belongs to a session |
| 2549 | 2549 | $session_img = api_get_session_image($info_log[4], $_user['status']); |
| 2550 | 2550 | |
| 2551 | - $url_start_blog = 'blog.php' ."?". "blog_id=".$info_log[3]. "&".api_get_cidreq(); |
|
| 2551 | + $url_start_blog = 'blog.php'."?"."blog_id=".$info_log[3]."&".api_get_cidreq(); |
|
| 2552 | 2552 | $title = $info_log[0]; |
| 2553 | 2553 | $image = Display::return_icon('blog.png', $title); |
| 2554 | - $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">' . $image . '</a></div><a href="'.$url_start_blog.'">' .$title. '</a>' . $session_img; |
|
| 2554 | + $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">'.$image.'</a></div><a href="'.$url_start_blog.'">'.$title.'</a>'.$session_img; |
|
| 2555 | 2555 | |
| 2556 | 2556 | $list_body_blog[] = $list_name; |
| 2557 | 2557 | $list_body_blog[] = $info_log[1]; |
| 2558 | 2558 | |
| 2559 | - $visibility_icon=($info_log[2]==0) ? 'invisible' : 'visible'; |
|
| 2560 | - $visibility_info=($info_log[2]==0) ? 'Visible' : 'Invisible'; |
|
| 2561 | - $my_image = '<a href="' .api_get_self(). '?action=edit&blog_id=' . $info_log[3] . '">'; |
|
| 2562 | - $my_image.= Display::return_icon('edit.png', get_lang('EditBlog')); |
|
| 2559 | + $visibility_icon = ($info_log[2] == 0) ? 'invisible' : 'visible'; |
|
| 2560 | + $visibility_info = ($info_log[2] == 0) ? 'Visible' : 'Invisible'; |
|
| 2561 | + $my_image = '<a href="'.api_get_self().'?action=edit&blog_id='.$info_log[3].'">'; |
|
| 2562 | + $my_image .= Display::return_icon('edit.png', get_lang('EditBlog')); |
|
| 2563 | 2563 | |
| 2564 | - $my_image.= "</a>\n"; |
|
| 2565 | - $my_image.= '<a href="' .api_get_self(). '?action=delete&blog_id=' . $info_log[3] . '" '; |
|
| 2566 | - $my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >'; |
|
| 2567 | - $my_image.= Display::return_icon('delete.png', get_lang('DeleteBlog')); |
|
| 2564 | + $my_image .= "</a>\n"; |
|
| 2565 | + $my_image .= '<a href="'.api_get_self().'?action=delete&blog_id='.$info_log[3].'" '; |
|
| 2566 | + $my_image .= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;" >'; |
|
| 2567 | + $my_image .= Display::return_icon('delete.png', get_lang('DeleteBlog')); |
|
| 2568 | 2568 | |
| 2569 | - $my_image.= "</a>\n"; |
|
| 2570 | - $my_image.= '<a href="' .api_get_self(). '?action=visibility&blog_id=' . $info_log[3] . '">'; |
|
| 2571 | - $my_image.= Display::return_icon($visibility_icon . '.gif', get_lang($visibility_info)); |
|
| 2569 | + $my_image .= "</a>\n"; |
|
| 2570 | + $my_image .= '<a href="'.api_get_self().'?action=visibility&blog_id='.$info_log[3].'">'; |
|
| 2571 | + $my_image .= Display::return_icon($visibility_icon.'.gif', get_lang($visibility_info)); |
|
| 2572 | 2572 | |
| 2573 | - $my_image.= "</a>\n"; |
|
| 2573 | + $my_image .= "</a>\n"; |
|
| 2574 | 2574 | |
| 2575 | - $list_body_blog[]=$my_image; |
|
| 2575 | + $list_body_blog[] = $my_image; |
|
| 2576 | 2576 | |
| 2577 | - $list_content_blog[]=$list_body_blog; |
|
| 2577 | + $list_content_blog[] = $list_body_blog; |
|
| 2578 | 2578 | $list_body_blog = array(); |
| 2579 | 2579 | |
| 2580 | 2580 | } |
| 2581 | - $parameters=''; |
|
| 2581 | + $parameters = ''; |
|
| 2582 | 2582 | //$parameters=array('action'=>Security::remove_XSS($_GET['action'])); |
| 2583 | - $table = new SortableTableFromArrayConfig($list_content_blog, 1,20,'project'); |
|
| 2583 | + $table = new SortableTableFromArrayConfig($list_content_blog, 1, 20, 'project'); |
|
| 2584 | 2584 | //$table->set_additional_parameters($parameters); |
| 2585 | 2585 | $table->set_header(0, get_lang('Title')); |
| 2586 | 2586 | $table->set_header(1, get_lang('SubTitle')); |
@@ -2605,34 +2605,34 @@ discard block |
||
| 2605 | 2605 | * @author Julio Montoya Dokeos |
| 2606 | 2606 | * @version avril 2008, dokeos 1.8.5 |
| 2607 | 2607 | */ |
| 2608 | -function get_blog_attachment($blog_id, $post_id=null,$comment_id=null) |
|
| 2608 | +function get_blog_attachment($blog_id, $post_id = null, $comment_id = null) |
|
| 2609 | 2609 | { |
| 2610 | 2610 | $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
| 2611 | 2611 | |
| 2612 | 2612 | $blog_id = intval($blog_id); |
| 2613 | 2613 | $comment_id = intval($comment_id); |
| 2614 | 2614 | $post_id = intval($post_id); |
| 2615 | - $row=array(); |
|
| 2616 | - $where=''; |
|
| 2615 | + $row = array(); |
|
| 2616 | + $where = ''; |
|
| 2617 | 2617 | if (!empty ($post_id) && is_numeric($post_id)) { |
| 2618 | - $where.=' AND post_id ="'.$post_id.'" '; |
|
| 2618 | + $where .= ' AND post_id ="'.$post_id.'" '; |
|
| 2619 | 2619 | } |
| 2620 | 2620 | |
| 2621 | 2621 | if (!empty ($comment_id) && is_numeric($comment_id)) { |
| 2622 | 2622 | if (!empty ($post_id)) { |
| 2623 | - $where.= ' AND '; |
|
| 2623 | + $where .= ' AND '; |
|
| 2624 | 2624 | } |
| 2625 | - $where.=' comment_id ="'.$comment_id.'" '; |
|
| 2625 | + $where .= ' comment_id ="'.$comment_id.'" '; |
|
| 2626 | 2626 | } |
| 2627 | 2627 | |
| 2628 | 2628 | $course_id = api_get_course_int_id(); |
| 2629 | 2629 | |
| 2630 | - $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' |
|
| 2630 | + $sql = 'SELECT path, filename, comment FROM '.$blog_table_attachment.' |
|
| 2631 | 2631 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
| 2632 | 2632 | |
| 2633 | - $result=Database::query($sql); |
|
| 2634 | - if (Database::num_rows($result)!=0) { |
|
| 2635 | - $row=Database::fetch_array($result); |
|
| 2633 | + $result = Database::query($sql); |
|
| 2634 | + if (Database::num_rows($result) != 0) { |
|
| 2635 | + $row = Database::fetch_array($result); |
|
| 2636 | 2636 | } |
| 2637 | 2637 | return $row; |
| 2638 | 2638 | } |
@@ -2646,7 +2646,7 @@ discard block |
||
| 2646 | 2646 | * @version avril 2008, dokeos 1.8.5 |
| 2647 | 2647 | */ |
| 2648 | 2648 | |
| 2649 | -function delete_all_blog_attachment($blog_id,$post_id=null,$comment_id=null) |
|
| 2649 | +function delete_all_blog_attachment($blog_id, $post_id = null, $comment_id = null) |
|
| 2650 | 2650 | { |
| 2651 | 2651 | $_course = api_get_course_info(); |
| 2652 | 2652 | $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
@@ -2670,22 +2670,22 @@ discard block |
||
| 2670 | 2670 | } |
| 2671 | 2671 | |
| 2672 | 2672 | // delete all files in directory |
| 2673 | - $courseDir = $_course['path'].'/upload/blog'; |
|
| 2673 | + $courseDir = $_course['path'].'/upload/blog'; |
|
| 2674 | 2674 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 2675 | 2675 | $updir = $sys_course_path.$courseDir; |
| 2676 | 2676 | |
| 2677 | 2677 | $sql = 'SELECT path FROM '.$blog_table_attachment.' |
| 2678 | 2678 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
| 2679 | - $result=Database::query($sql); |
|
| 2679 | + $result = Database::query($sql); |
|
| 2680 | 2680 | |
| 2681 | - while ($row=Database::fetch_row($result)) { |
|
| 2682 | - $file=$updir.'/'.$row[0]; |
|
| 2683 | - if (Security::check_abs_path($file,$updir) ) |
|
| 2681 | + while ($row = Database::fetch_row($result)) { |
|
| 2682 | + $file = $updir.'/'.$row[0]; |
|
| 2683 | + if (Security::check_abs_path($file, $updir)) |
|
| 2684 | 2684 | { |
| 2685 | 2685 | @ unlink($file); |
| 2686 | 2686 | } |
| 2687 | 2687 | } |
| 2688 | - $sql = 'DELETE FROM '. $blog_table_attachment.' |
|
| 2688 | + $sql = 'DELETE FROM '.$blog_table_attachment.' |
|
| 2689 | 2689 | WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'" '.$where; |
| 2690 | 2690 | Database::query($sql); |
| 2691 | 2691 | } |
@@ -2698,8 +2698,8 @@ discard block |
||
| 2698 | 2698 | function get_blog_post_from_user($course_code, $user_id) |
| 2699 | 2699 | { |
| 2700 | 2700 | $tbl_blogs = Database::get_course_table(TABLE_BLOGS); |
| 2701 | - $tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 2702 | - $course_info = api_get_course_info($course_code); |
|
| 2701 | + $tbl_blog_post = Database::get_course_table(TABLE_BLOGS_POSTS); |
|
| 2702 | + $course_info = api_get_course_info($course_code); |
|
| 2703 | 2703 | $course_id = $course_info['real_id']; |
| 2704 | 2704 | |
| 2705 | 2705 | $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation |
@@ -2714,13 +2714,13 @@ discard block |
||
| 2714 | 2714 | $result = Database::query($sql); |
| 2715 | 2715 | $return_data = ''; |
| 2716 | 2716 | |
| 2717 | - if (Database::num_rows($result)!=0) { |
|
| 2718 | - while ($row=Database::fetch_array($result)) { |
|
| 2719 | - $return_data.= '<div class="clear"></div><br />'; |
|
| 2720 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2721 | - $return_data.= '<br / >'; |
|
| 2722 | - $return_data.= $row['full_text']; |
|
| 2723 | - $return_data.= '<br /><br />'; |
|
| 2717 | + if (Database::num_rows($result) != 0) { |
|
| 2718 | + while ($row = Database::fetch_array($result)) { |
|
| 2719 | + $return_data .= '<div class="clear"></div><br />'; |
|
| 2720 | + $return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png', get_lang('BlogPosts')).' '.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2721 | + $return_data .= '<br / >'; |
|
| 2722 | + $return_data .= $row['full_text']; |
|
| 2723 | + $return_data .= '<br /><br />'; |
|
| 2724 | 2724 | } |
| 2725 | 2725 | } |
| 2726 | 2726 | return $return_data; |
@@ -2750,14 +2750,14 @@ discard block |
||
| 2750 | 2750 | ORDER BY blog_name"; |
| 2751 | 2751 | $result = Database::query($sql); |
| 2752 | 2752 | $return_data = ''; |
| 2753 | - if (Database::num_rows($result)!=0) { |
|
| 2754 | - while ($row=Database::fetch_array($result)) { |
|
| 2755 | - $return_data.= '<div class="clear"></div><br />'; |
|
| 2756 | - $return_data.= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2757 | - $return_data.= '<br / >'; |
|
| 2753 | + if (Database::num_rows($result) != 0) { |
|
| 2754 | + while ($row = Database::fetch_array($result)) { |
|
| 2755 | + $return_data .= '<div class="clear"></div><br />'; |
|
| 2756 | + $return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].' <div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>'; |
|
| 2757 | + $return_data .= '<br / >'; |
|
| 2758 | 2758 | //$return_data.= '<strong>'.$row['title'].'</strong>'; echo '<br>';*/ |
| 2759 | - $return_data.= $row['comment']; |
|
| 2760 | - $return_data.= '<br />'; |
|
| 2759 | + $return_data .= $row['comment']; |
|
| 2760 | + $return_data .= '<br />'; |
|
| 2761 | 2761 | } |
| 2762 | 2762 | } |
| 2763 | 2763 | return $return_data; |
@@ -1009,8 +1009,9 @@ discard block |
||
| 1009 | 1009 | $blog_post_actions .= '</a>'; |
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | - if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) |
|
| 1013 | - $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
| 1012 | + if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) { |
|
| 1013 | + $rating_select = Blog::display_rating_form('post',$blog_id,$post_id); |
|
| 1014 | + } |
|
| 1014 | 1015 | |
| 1015 | 1016 | $blog_post_text=stripslashes($blog_post_text); |
| 1016 | 1017 | |
@@ -1654,8 +1655,9 @@ discard block |
||
| 1654 | 1655 | |
| 1655 | 1656 | $arrPermissions = array(); |
| 1656 | 1657 | |
| 1657 | - while ($row = Database::fetch_array($result)) |
|
| 1658 | - $arrPermissions[] = $row['action']; |
|
| 1658 | + while ($row = Database::fetch_array($result)) { |
|
| 1659 | + $arrPermissions[] = $row['action']; |
|
| 1660 | + } |
|
| 1659 | 1661 | |
| 1660 | 1662 | echo '<tr>'; |
| 1661 | 1663 | echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ': </td>'; |
@@ -2332,8 +2334,9 @@ discard block |
||
| 2332 | 2334 | //Handle leap year |
| 2333 | 2335 | $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); |
| 2334 | 2336 | |
| 2335 | - if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) |
|
| 2336 | - $numberofdays[2] = 29; |
|
| 2337 | + if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) { |
|
| 2338 | + $numberofdays[2] = 29; |
|
| 2339 | + } |
|
| 2337 | 2340 | |
| 2338 | 2341 | //Get the first day of the month |
| 2339 | 2342 | $dayone = getdate(mktime(0, 0, 0, $month, 1, $year)); |
@@ -2363,8 +2366,9 @@ discard block |
||
| 2363 | 2366 | if( Database::num_rows($result) > 0) { |
| 2364 | 2367 | while($blog_post = Database::fetch_array($result)) { |
| 2365 | 2368 | // If the day of this post is not yet in the array, add it. |
| 2366 | - if (!in_array($blog_post['post_day'], $posts)) |
|
| 2367 | - $posts[] = $blog_post['post_day']; |
|
| 2369 | + if (!in_array($blog_post['post_day'], $posts)) { |
|
| 2370 | + $posts[] = $blog_post['post_day']; |
|
| 2371 | + } |
|
| 2368 | 2372 | } |
| 2369 | 2373 | } |
| 2370 | 2374 | |
@@ -2403,8 +2407,9 @@ discard block |
||
| 2403 | 2407 | |
| 2404 | 2408 | echo "<tr>\n"; |
| 2405 | 2409 | |
| 2406 | - for($ii = 1; $ii < 8; $ii ++) |
|
| 2407 | - echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
| 2410 | + for($ii = 1; $ii < 8; $ii ++) { |
|
| 2411 | + echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>"; |
|
| 2412 | + } |
|
| 2408 | 2413 | |
| 2409 | 2414 | echo "</tr>"; |
| 2410 | 2415 | |
@@ -2414,8 +2419,9 @@ discard block |
||
| 2414 | 2419 | while ($curday <= $numberofdays[$month]) { |
| 2415 | 2420 | echo "<tr>"; |
| 2416 | 2421 | for ($ii = 0; $ii < 7; $ii ++) { |
| 2417 | - if (($curday == -1) && ($ii == $startdayofweek)) |
|
| 2418 | - $curday = 1; |
|
| 2422 | + if (($curday == -1) && ($ii == $startdayofweek)) { |
|
| 2423 | + $curday = 1; |
|
| 2424 | + } |
|
| 2419 | 2425 | |
| 2420 | 2426 | if (($curday > 0) && ($curday <= $numberofdays[$month])) { |
| 2421 | 2427 | $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\""; |
@@ -2429,10 +2435,11 @@ discard block |
||
| 2429 | 2435 | echo "<td " . $class.">"; |
| 2430 | 2436 | |
| 2431 | 2437 | // If there are posts on this day, create a filter link. |
| 2432 | - if(in_array($curday, $posts)) |
|
| 2433 | - echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
| 2434 | - else |
|
| 2435 | - echo $dayheader; |
|
| 2438 | + if(in_array($curday, $posts)) { |
|
| 2439 | + echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>'; |
|
| 2440 | + } else { |
|
| 2441 | + echo $dayheader; |
|
| 2442 | + } |
|
| 2436 | 2443 | |
| 2437 | 2444 | if (count($tasks) > 0) { |
| 2438 | 2445 | if (isset($tasks[$curday]) && is_array($tasks[$curday])) { |
@@ -2446,8 +2453,9 @@ discard block |
||
| 2446 | 2453 | |
| 2447 | 2454 | echo "</td>"; |
| 2448 | 2455 | $curday ++; |
| 2449 | - } else |
|
| 2450 | - echo "<td> </td>"; |
|
| 2456 | + } else { |
|
| 2457 | + echo "<td> </td>"; |
|
| 2458 | + } |
|
| 2451 | 2459 | } |
| 2452 | 2460 | echo "</tr>"; |
| 2453 | 2461 | } |