@@ -126,6 +126,7 @@ discard block |
||
| 126 | 126 | * Returns a temporary url to download files and/or folders. |
| 127 | 127 | * |
| 128 | 128 | * @param string|array $ids |
| 129 | + * @param string $tool |
|
| 129 | 130 | * @return string |
| 130 | 131 | */ |
| 131 | 132 | public static function download_url($ids, $tool) |
@@ -293,7 +294,7 @@ discard block |
||
| 293 | 294 | /** |
| 294 | 295 | * The name of the porfolio where to send. |
| 295 | 296 | * |
| 296 | - * @return type |
|
| 297 | + * @return string |
|
| 297 | 298 | */ |
| 298 | 299 | function get_portfolio() |
| 299 | 300 | { |
@@ -391,7 +392,6 @@ discard block |
||
| 391 | 392 | * Create a "send to portfolio" button |
| 392 | 393 | * |
| 393 | 394 | * @param string $tool The name of the tool: document, work. |
| 394 | - * @param int $c_id The id of the course |
|
| 395 | 395 | * @param int $id The id of the object |
| 396 | 396 | * @param array $attributes Html attributes |
| 397 | 397 | * @return \PortfolioShare |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | /** |
| 406 | 406 | * Returns the current secuirty token. Used to avoid see surfing attacks. |
| 407 | 407 | * |
| 408 | - * @return type |
|
| 408 | + * @return string |
|
| 409 | 409 | */ |
| 410 | 410 | static function security_token() |
| 411 | 411 | { |
@@ -420,6 +420,10 @@ discard block |
||
| 420 | 420 | protected $attributes = array(); |
| 421 | 421 | protected $tool = ''; |
| 422 | 422 | |
| 423 | + /** |
|
| 424 | + * @param string $tool |
|
| 425 | + * @param integer $id |
|
| 426 | + */ |
|
| 423 | 427 | function __construct($tool, $id, $attributes = array()) |
| 424 | 428 | { |
| 425 | 429 | $this->tool = $tool; |
@@ -482,14 +482,14 @@ discard block |
||
| 482 | 482 | $attributes['z-index'] = 100000; |
| 483 | 483 | $s = ' '; |
| 484 | 484 | foreach ($attributes as $key => $value) { |
| 485 | - $s .= $key . '="' . $value . '" '; |
|
| 485 | + $s .= $key.'="'.$value.'" '; |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | $result = array(); |
| 489 | - $result[] = '<span ' . $s . ' >'; |
|
| 489 | + $result[] = '<span '.$s.' >'; |
|
| 490 | 490 | $result[] = '<span class="dropdown" >'; |
| 491 | 491 | $result[] = '<a href="#" data-toggle="dropdown" class="dropdown-toggle">'; |
| 492 | - $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL) . '<b class="caret"></b>'; |
|
| 492 | + $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL).'<b class="caret"></b>'; |
|
| 493 | 493 | $result[] = '</a>'; |
| 494 | 494 | $result[] = '<ul class="dropdown-menu">'; |
| 495 | 495 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | $parameters[PortfolioController::PARAM_TOOL] = $tool; |
| 506 | 506 | $url = api_get_path(WEB_CODE_PATH).'portfolio/share.php?'; |
| 507 | 507 | $result[] = '<li>'; |
| 508 | - $result[] = '<a href="' . $url . '">' . $portfolio->get_title() . '</a>'; |
|
| 508 | + $result[] = '<a href="'.$url.'">'.$portfolio->get_title().'</a>'; |
|
| 509 | 509 | $result[] = '</li>'; |
| 510 | 510 | } |
| 511 | 511 | $result[] = '</ul>'; |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | */ |
| 565 | 565 | public function __construct($portfolio) |
| 566 | 566 | { |
| 567 | - $this->name = md5(__CLASS__) . '_' . $portfolio->get_name(); |
|
| 568 | - $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo') . ' ' . $portfolio->get_name(); |
|
| 567 | + $this->name = md5(__CLASS__).'_'.$portfolio->get_name(); |
|
| 568 | + $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo').' '.$portfolio->get_name(); |
|
| 569 | 569 | $this->portfolio = $portfolio; |
| 570 | 570 | } |
| 571 | 571 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * @return array |
|
| 132 | + * @return string[] |
|
| 133 | 133 | */ |
| 134 | 134 | public function get_status_list() |
| 135 | 135 | { |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | /** |
| 273 | 273 | * @param int $id |
| 274 | 274 | * |
| 275 | - * @return bool |
|
| 275 | + * @return null|false |
|
| 276 | 276 | */ |
| 277 | 277 | public function delete($id) |
| 278 | 278 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | case 'updated_at': |
| 64 | 64 | break; |
| 65 | 65 | case 'name': |
| 66 | - $val .= ' ' . get_lang('CopyLabelSuffix'); |
|
| 66 | + $val .= ' '.get_lang('CopyLabelSuffix'); |
|
| 67 | 67 | $new[$key] = $val; |
| 68 | 68 | break; |
| 69 | 69 | case 'created_at': |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | break; |
| 73 | 73 | case 'career_id': |
| 74 | 74 | if (!empty($career_id)) { |
| 75 | - $val = (int)$career_id; |
|
| 75 | + $val = (int) $career_id; |
|
| 76 | 76 | } |
| 77 | 77 | $new[$key] = $val; |
| 78 | 78 | break; |
@@ -160,22 +160,22 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | // Action links |
| 162 | 162 | echo '<div class="actions" style="margin-bottom:20px">'; |
| 163 | - echo '<a href="career_dashboard.php">' . Display::return_icon('back.png', |
|
| 164 | - get_lang('Back'), '', '32') . '</a>'; |
|
| 165 | - echo '<a href="' . api_get_self() . '?action=add">' . |
|
| 163 | + echo '<a href="career_dashboard.php">'.Display::return_icon('back.png', |
|
| 164 | + get_lang('Back'), '', '32').'</a>'; |
|
| 165 | + echo '<a href="'.api_get_self().'?action=add">'. |
|
| 166 | 166 | Display::return_icon( |
| 167 | 167 | 'new_promotion.png', |
| 168 | 168 | get_lang('Add'), |
| 169 | 169 | '', |
| 170 | 170 | '32' |
| 171 | - ) . '</a>'; |
|
| 172 | - echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'session/session_add.php">' . |
|
| 171 | + ).'</a>'; |
|
| 172 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'. |
|
| 173 | 173 | Display::return_icon( |
| 174 | 174 | 'new_session.png', |
| 175 | 175 | get_lang('AddSession'), |
| 176 | 176 | '', |
| 177 | 177 | '32' |
| 178 | - ) . '</a>'; |
|
| 178 | + ).'</a>'; |
|
| 179 | 179 | echo '</div>'; |
| 180 | 180 | echo Display::grid_html('promotions'); |
| 181 | 181 | } |
@@ -15,6 +15,10 @@ |
||
| 15 | 15 | |
| 16 | 16 | // warning the goal of this function is to enforce rights managment in Chamilo |
| 17 | 17 | // thus default return value is always true |
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * @param string $handler |
|
| 21 | + */ |
|
| 18 | 22 | public static function hasRight($handler) { |
| 19 | 23 | if (array_key_exists($handler, self::$rights_cache)) |
| 20 | 24 | return self::$rights_cache[$handler]; |
@@ -5,42 +5,42 @@ |
||
| 5 | 5 | * @deprecated Don't use this class |
| 6 | 6 | */ |
| 7 | 7 | class Rights { |
| 8 | - private static $rights_cache = array(); |
|
| 9 | - private static $rights = array ( |
|
| 10 | - 'show_tabs:reports' => |
|
| 11 | - array ( |
|
| 12 | - 'type' => 'const', |
|
| 13 | - 'const' => 'true' ) |
|
| 14 | - ); |
|
| 8 | + private static $rights_cache = array(); |
|
| 9 | + private static $rights = array ( |
|
| 10 | + 'show_tabs:reports' => |
|
| 11 | + array ( |
|
| 12 | + 'type' => 'const', |
|
| 13 | + 'const' => 'true' ) |
|
| 14 | + ); |
|
| 15 | 15 | |
| 16 | - // warning the goal of this function is to enforce rights managment in Chamilo |
|
| 17 | - // thus default return value is always true |
|
| 18 | - public static function hasRight($handler) { |
|
| 19 | - if (array_key_exists($handler, self::$rights_cache)) |
|
| 20 | - return self::$rights_cache[$handler]; |
|
| 16 | + // warning the goal of this function is to enforce rights managment in Chamilo |
|
| 17 | + // thus default return value is always true |
|
| 18 | + public static function hasRight($handler) { |
|
| 19 | + if (array_key_exists($handler, self::$rights_cache)) |
|
| 20 | + return self::$rights_cache[$handler]; |
|
| 21 | 21 | |
| 22 | - if (!array_key_exists($handler, self::$rights)) |
|
| 23 | - return true; // handler does not exists |
|
| 22 | + if (!array_key_exists($handler, self::$rights)) |
|
| 23 | + return true; // handler does not exists |
|
| 24 | 24 | |
| 25 | - if (self::$rights[$handler]['type'] == 'sql') { |
|
| 26 | - $result = Database::query(self::$rights[$handler]['sql']); |
|
| 27 | - if (Database::num_rows($result) > 0) |
|
| 28 | - $result = true; |
|
| 29 | - else |
|
| 30 | - $result = false; |
|
| 31 | - } else if (self::$rights[$handler]['type'] == 'const') |
|
| 32 | - $result = self::$rights[$handler]['const']; |
|
| 33 | - else if (self::$rights[$handler]['type'] == 'func') |
|
| 34 | - $result = self::$rights[$handler]['func'](); |
|
| 35 | - else // handler type not implemented |
|
| 36 | - return true; |
|
| 37 | - self::$rights_cache[$handler] = $result; |
|
| 38 | - return $result; |
|
| 39 | - } |
|
| 25 | + if (self::$rights[$handler]['type'] == 'sql') { |
|
| 26 | + $result = Database::query(self::$rights[$handler]['sql']); |
|
| 27 | + if (Database::num_rows($result) > 0) |
|
| 28 | + $result = true; |
|
| 29 | + else |
|
| 30 | + $result = false; |
|
| 31 | + } else if (self::$rights[$handler]['type'] == 'const') |
|
| 32 | + $result = self::$rights[$handler]['const']; |
|
| 33 | + else if (self::$rights[$handler]['type'] == 'func') |
|
| 34 | + $result = self::$rights[$handler]['func'](); |
|
| 35 | + else // handler type not implemented |
|
| 36 | + return true; |
|
| 37 | + self::$rights_cache[$handler] = $result; |
|
| 38 | + return $result; |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public static function hasRightClosePageWithError($handler) { |
|
| 42 | - if (hasRight($handler) == false) |
|
| 43 | - die("You are not allowed here"); //FIXME |
|
| 44 | - } |
|
| 41 | + public static function hasRightClosePageWithError($handler) { |
|
| 42 | + if (hasRight($handler) == false) |
|
| 43 | + die("You are not allowed here"); //FIXME |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | } |
@@ -6,9 +6,9 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class Rights { |
| 8 | 8 | private static $rights_cache = array(); |
| 9 | - private static $rights = array ( |
|
| 9 | + private static $rights = array( |
|
| 10 | 10 | 'show_tabs:reports' => |
| 11 | - array ( |
|
| 11 | + array( |
|
| 12 | 12 | 'type' => 'const', |
| 13 | 13 | 'const' => 'true' ) |
| 14 | 14 | ); |
@@ -16,31 +16,39 @@ |
||
| 16 | 16 | // warning the goal of this function is to enforce rights managment in Chamilo |
| 17 | 17 | // thus default return value is always true |
| 18 | 18 | public static function hasRight($handler) { |
| 19 | - if (array_key_exists($handler, self::$rights_cache)) |
|
| 20 | - return self::$rights_cache[$handler]; |
|
| 19 | + if (array_key_exists($handler, self::$rights_cache)) { |
|
| 20 | + return self::$rights_cache[$handler]; |
|
| 21 | + } |
|
| 21 | 22 | |
| 22 | - if (!array_key_exists($handler, self::$rights)) |
|
| 23 | - return true; // handler does not exists |
|
| 23 | + if (!array_key_exists($handler, self::$rights)) { |
|
| 24 | + return true; |
|
| 25 | + } |
|
| 26 | + // handler does not exists |
|
| 24 | 27 | |
| 25 | 28 | if (self::$rights[$handler]['type'] == 'sql') { |
| 26 | 29 | $result = Database::query(self::$rights[$handler]['sql']); |
| 27 | - if (Database::num_rows($result) > 0) |
|
| 28 | - $result = true; |
|
| 29 | - else |
|
| 30 | - $result = false; |
|
| 31 | - } else if (self::$rights[$handler]['type'] == 'const') |
|
| 32 | - $result = self::$rights[$handler]['const']; |
|
| 33 | - else if (self::$rights[$handler]['type'] == 'func') |
|
| 34 | - $result = self::$rights[$handler]['func'](); |
|
| 35 | - else // handler type not implemented |
|
| 30 | + if (Database::num_rows($result) > 0) { |
|
| 31 | + $result = true; |
|
| 32 | + } else { |
|
| 33 | + $result = false; |
|
| 34 | + } |
|
| 35 | + } else if (self::$rights[$handler]['type'] == 'const') { |
|
| 36 | + $result = self::$rights[$handler]['const']; |
|
| 37 | + } else if (self::$rights[$handler]['type'] == 'func') { |
|
| 38 | + $result = self::$rights[$handler]['func'](); |
|
| 39 | + } else { |
|
| 40 | + // handler type not implemented |
|
| 36 | 41 | return true; |
| 42 | + } |
|
| 37 | 43 | self::$rights_cache[$handler] = $result; |
| 38 | 44 | return $result; |
| 39 | 45 | } |
| 40 | 46 | |
| 41 | 47 | public static function hasRightClosePageWithError($handler) { |
| 42 | - if (hasRight($handler) == false) |
|
| 43 | - die("You are not allowed here"); //FIXME |
|
| 48 | + if (hasRight($handler) == false) { |
|
| 49 | + die("You are not allowed here"); |
|
| 50 | + } |
|
| 51 | + //FIXME |
|
| 44 | 52 | } |
| 45 | 53 | |
| 46 | 54 | } |
@@ -71,6 +71,10 @@ |
||
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * Get the terms stored at database |
| 74 | + * @param string $prefix |
|
| 75 | + * @param string $course_code |
|
| 76 | + * @param string $tool_id |
|
| 77 | + * @param integer $ref_id |
|
| 74 | 78 | * @return array Array of terms |
| 75 | 79 | */ |
| 76 | 80 | function get_terms_on_db($prefix, $course_code, $tool_id, $ref_id) { |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * code |
| 9 | 9 | */ |
| 10 | -require_once dirname(__FILE__) . '/../../global.inc.php'; |
|
| 10 | +require_once dirname(__FILE__).'/../../global.inc.php'; |
|
| 11 | 11 | include_once 'xapian/XapianIndexer.class.php'; |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
| 40 | 40 | return FALSE; |
| 41 | 41 | |
| 42 | - require_once api_get_path(LIBRARY_PATH) . 'search/xapian/XapianQuery.php'; |
|
| 42 | + require_once api_get_path(LIBRARY_PATH).'search/xapian/XapianQuery.php'; |
|
| 43 | 43 | |
| 44 | 44 | // compare terms |
| 45 | 45 | $doc = $this->get_document($search_did); |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | // save it to search engine |
| 57 | 57 | foreach ($missing_terms as $term) { |
| 58 | - $this->add_term_to_doc($prefix . $term, $doc); |
|
| 58 | + $this->add_term_to_doc($prefix.$term, $doc); |
|
| 59 | 59 | } |
| 60 | 60 | foreach ($deprecated_terms as $term) { |
| 61 | - $this->remove_term_from_doc($prefix . $term, $doc); |
|
| 61 | + $this->remove_term_from_doc($prefix.$term, $doc); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // don't do anything if no change |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @return array Array of terms |
| 75 | 75 | */ |
| 76 | 76 | function get_terms_on_db($prefix, $course_code, $tool_id, $ref_id) { |
| 77 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 77 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 78 | 78 | $terms = get_specific_field_values_list_by_prefix($prefix, $course_code, $tool_id, $ref_id); |
| 79 | 79 | $prefix_terms = array(); |
| 80 | 80 | foreach ($terms as $term) { |
@@ -36,8 +36,9 @@ discard block |
||
| 36 | 36 | $stored_terms = $this->get_terms_on_db($prefix, $course_code, $tool_id, $ref_id_high_level); |
| 37 | 37 | |
| 38 | 38 | // don't do anything if no change, verify only at DB, not the search engine |
| 39 | - if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) |
|
| 40 | - return FALSE; |
|
| 39 | + if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) { |
|
| 40 | + return FALSE; |
|
| 41 | + } |
|
| 41 | 42 | |
| 42 | 43 | require_once api_get_path(LIBRARY_PATH) . 'search/xapian/XapianQuery.php'; |
| 43 | 44 | |
@@ -45,8 +46,9 @@ discard block |
||
| 45 | 46 | $doc = $this->get_document($search_did); |
| 46 | 47 | $xapian_terms = xapian_get_doc_terms($doc, $prefix); |
| 47 | 48 | $xterms = array(); |
| 48 | - foreach ($xapian_terms as $xapian_term) |
|
| 49 | - $xterms[] = substr($xapian_term['name'], 1); |
|
| 49 | + foreach ($xapian_terms as $xapian_term) { |
|
| 50 | + $xterms[] = substr($xapian_term['name'], 1); |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | $dterms = $terms; |
| 52 | 54 | |
@@ -23,6 +23,9 @@ discard block |
||
| 23 | 23 | return chamilo_preprocess_results($results); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | +/** |
|
| 27 | + * @param string $query_string |
|
| 28 | + */ |
|
| 26 | 29 | function chamilo_query_simple_query($query_string, $offset=0, $length=10, $extra=NULL) { |
| 27 | 30 | return xapian_query($query_string, NULL, $offset, $length, $extra); |
| 28 | 31 | } |
@@ -30,7 +33,7 @@ discard block |
||
| 30 | 33 | /** |
| 31 | 34 | * Wrapper for getting boolean queries |
| 32 | 35 | * |
| 33 | - * @param string $query_string The term string |
|
| 36 | + * @param string $term |
|
| 34 | 37 | */ |
| 35 | 38 | function chamilo_get_boolean_query($term) { |
| 36 | 39 | return xapian_get_boolean_query($term); |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | * @param array extra Extra queries to join with. Optional |
| 19 | 19 | * @return array |
| 20 | 20 | */ |
| 21 | -function chamilo_query_query($query_string, $offset=0, $length=10, $extra=NULL) { |
|
| 21 | +function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
| 22 | 22 | list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra); |
| 23 | 23 | return chamilo_preprocess_results($results); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -function chamilo_query_simple_query($query_string, $offset=0, $length=10, $extra=NULL) { |
|
| 26 | +function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) { |
|
| 27 | 27 | return xapian_query($query_string, NULL, $offset, $length, $extra); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | function chamilo_preprocess_results($results) { |
| 43 | 43 | // group by toolid |
| 44 | 44 | $results_by_tool = array(); |
| 45 | - if (count($results)>0) { |
|
| 45 | + if (count($results) > 0) { |
|
| 46 | 46 | |
| 47 | 47 | foreach ($results as $key => $row) { |
| 48 | 48 | $results_by_tool[$row['toolid']][] = $row; |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $processed_results = array(); |
| 52 | 52 | foreach ($results_by_tool as $toolid => $rows) { |
| 53 | - $tool_processor_class = $toolid .'_processor'; |
|
| 54 | - $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php'; |
|
| 53 | + $tool_processor_class = $toolid.'_processor'; |
|
| 54 | + $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php'; |
|
| 55 | 55 | if (file_exists($tool_processor_path)) { |
| 56 | 56 | require_once($tool_processor_path); |
| 57 | 57 | $tool_processor = new $tool_processor_class($rows); |
@@ -71,6 +71,6 @@ discard block |
||
| 71 | 71 | * @param string $op |
| 72 | 72 | * @return XapianQuery query joined |
| 73 | 73 | */ |
| 74 | -function chamilo_join_queries($query1, $query2=NULL, $op='or') { |
|
| 74 | +function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') { |
|
| 75 | 75 | return xapian_join_queries($query1, $query2, $op); |
| 76 | 76 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param string $query_string The term string |
| 34 | 34 | */ |
| 35 | 35 | function chamilo_get_boolean_query($term) { |
| 36 | - return xapian_get_boolean_query($term); |
|
| 36 | + return xapian_get_boolean_query($term); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -44,22 +44,22 @@ discard block |
||
| 44 | 44 | $results_by_tool = array(); |
| 45 | 45 | if (count($results)>0) { |
| 46 | 46 | |
| 47 | - foreach ($results as $key => $row) { |
|
| 48 | - $results_by_tool[$row['toolid']][] = $row; |
|
| 49 | - } |
|
| 47 | + foreach ($results as $key => $row) { |
|
| 48 | + $results_by_tool[$row['toolid']][] = $row; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $processed_results = array(); |
|
| 52 | - foreach ($results_by_tool as $toolid => $rows) { |
|
| 53 | - $tool_processor_class = $toolid .'_processor'; |
|
| 54 | - $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php'; |
|
| 55 | - if (file_exists($tool_processor_path)) { |
|
| 56 | - require_once($tool_processor_path); |
|
| 57 | - $tool_processor = new $tool_processor_class($rows); |
|
| 58 | - $processed_results = array_merge($tool_processor->process(), $processed_results); |
|
| 59 | - } |
|
| 60 | - } |
|
| 51 | + $processed_results = array(); |
|
| 52 | + foreach ($results_by_tool as $toolid => $rows) { |
|
| 53 | + $tool_processor_class = $toolid .'_processor'; |
|
| 54 | + $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php'; |
|
| 55 | + if (file_exists($tool_processor_path)) { |
|
| 56 | + require_once($tool_processor_path); |
|
| 57 | + $tool_processor = new $tool_processor_class($rows); |
|
| 58 | + $processed_results = array_merge($tool_processor->process(), $processed_results); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - return array(count($processed_results), $processed_results); |
|
| 62 | + return array(count($processed_results), $processed_results); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
@@ -72,5 +72,5 @@ discard block |
||
| 72 | 72 | * @return XapianQuery query joined |
| 73 | 73 | */ |
| 74 | 74 | function chamilo_join_queries($query1, $query2=NULL, $op='or') { |
| 75 | - return xapian_join_queries($query1, $query2, $op); |
|
| 75 | + return xapian_join_queries($query1, $query2, $op); |
|
| 76 | 76 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Simple getter for the db attribute |
| 101 | - * @return object The db attribute |
|
| 101 | + * @return null|XapianWritableDatabase The db attribute |
|
| 102 | 102 | */ |
| 103 | 103 | function getDb() |
| 104 | 104 | { |
@@ -108,6 +108,7 @@ discard block |
||
| 108 | 108 | /** |
| 109 | 109 | * Add this chunk to the chunk array attribute |
| 110 | 110 | * @param string Chunk of text |
| 111 | + * @param IndexableChunk $chunk |
|
| 111 | 112 | * @return void |
| 112 | 113 | */ |
| 113 | 114 | function addChunk($chunk) |
@@ -179,7 +180,7 @@ discard block |
||
| 179 | 180 | * Get document data on a xapian document |
| 180 | 181 | * |
| 181 | 182 | * @param XapianDocument $doc xapian document to push into the db |
| 182 | - * @return mixed xapian document data or FALSE if error |
|
| 183 | + * @return string xapian document data or FALSE if error |
|
| 183 | 184 | */ |
| 184 | 185 | function get_document_data($doc) |
| 185 | 186 | { |
@@ -286,7 +287,7 @@ discard block |
||
| 286 | 287 | * Replace a document in the actual db |
| 287 | 288 | * |
| 288 | 289 | * @param XapianDocument $doc xapian document to push into the db |
| 289 | - * @param Xapian::docid $did xapian document id of the document to replace |
|
| 290 | + * @param integer $did xapian document id of the document to replace |
|
| 290 | 291 | */ |
| 291 | 292 | function replace_document($doc, $did) |
| 292 | 293 | { |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | require_once 'xapian.php'; |
| 9 | -require_once dirname(__FILE__) . '/../IndexableChunk.class.php'; |
|
| 9 | +require_once dirname(__FILE__).'/../IndexableChunk.class.php'; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Abstract helper class |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | if (!empty($chunk->terms)) { |
| 131 | 131 | foreach ($chunk->terms as $term) { |
| 132 | 132 | /* FIXME: think of getting weight */ |
| 133 | - $doc->add_term($term['flag'] . $term['name'], 1); |
|
| 133 | + $doc->add_term($term['flag'].$term['name'], 1); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $doc->clear_terms(); |
| 216 | 216 | foreach ($terms as $term) { |
| 217 | 217 | //add directly |
| 218 | - $doc->add_term($prefix . $term, 1); |
|
| 218 | + $doc->add_term($prefix.$term, 1); |
|
| 219 | 219 | } |
| 220 | 220 | $this->db->replace_document($did, $doc); |
| 221 | 221 | $this->db->flush(); |
@@ -70,13 +70,16 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | function connectDb($path = null, $dbMode = null, $lang = 'english') |
| 72 | 72 | { |
| 73 | - if ($this->db != null) |
|
| 74 | - return $this->db; |
|
| 75 | - if ($dbMode == null) |
|
| 76 | - $dbMode = Xapian::DB_CREATE_OR_OPEN; |
|
| 73 | + if ($this->db != null) { |
|
| 74 | + return $this->db; |
|
| 75 | + } |
|
| 76 | + if ($dbMode == null) { |
|
| 77 | + $dbMode = Xapian::DB_CREATE_OR_OPEN; |
|
| 78 | + } |
|
| 77 | 79 | |
| 78 | - if ($path == null) |
|
| 79 | - $path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/'; |
|
| 80 | + if ($path == null) { |
|
| 81 | + $path = api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/'; |
|
| 82 | + } |
|
| 80 | 83 | |
| 81 | 84 | try { |
| 82 | 85 | $this->db = new XapianWritableDatabase($path, $dbMode); |
@@ -30,6 +30,9 @@ |
||
| 30 | 30 | $this->center_x = intval($offset_x + $this->canvas_x/2 - $this->block_size/2); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $class |
|
| 35 | + */ |
|
| 33 | 36 | function prepare_skill_box($skill, $position, $class) |
| 34 | 37 | { |
| 35 | 38 | $block_id = $skill['id']; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->skills = $skills; |
| 29 | 29 | $this->type = $type; |
| 30 | - $this->center_x = intval($offset_x + $this->canvas_x/2 - $this->block_size/2); |
|
| 30 | + $this->center_x = intval($offset_x + $this->canvas_x / 2 - $this->block_size / 2); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | function prepare_skill_box($skill, $position, $class) |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | $extra_class = 'second_window'; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.' '.$class.'" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">'; |
|
| 42 | + $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.' '.$class.'" style = "top:'.$position['y'].'px; left:'.$position['x'].'px;">'; |
|
| 43 | 43 | |
| 44 | - $content = $skill['name']; |
|
| 44 | + $content = $skill['name']; |
|
| 45 | 45 | $content .= '<div class="btn-group">'; |
| 46 | 46 | $content .= Display::url(get_lang('Edit'), '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn')); |
| 47 | 47 | $content .= Display::url('+', '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn')); |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | //default_arrow_color |
| 89 | 89 | |
| 90 | - $this->js .= 'var e'.$block_id.' = prepare("block_' . $block_id.'", '.$end_point.');'."\n"; |
|
| 91 | - $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_' . $skill['parent_id'].'", '.$end_point.');'."\n"; |
|
| 92 | - $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n";; |
|
| 90 | + $this->js .= 'var e'.$block_id.' = prepare("block_'.$block_id.'", '.$end_point.');'."\n"; |
|
| 91 | + $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_'.$skill['parent_id'].'", '.$end_point.');'."\n"; |
|
| 92 | + $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n"; ; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | $brothers = array(); |
| 126 | 126 | |
| 127 | 127 | foreach ($this->skills as &$skill) { |
| 128 | - if (!in_array($skill['parent_id'], array(0,1))) { |
|
| 128 | + if (!in_array($skill['parent_id'], array(0, 1))) { |
|
| 129 | 129 | continue; |
| 130 | 130 | } |
| 131 | - $childs = isset($skill['children']) ? count($skill['children']) : 0 ; |
|
| 131 | + $childs = isset($skill['children']) ? count($skill['children']) : 0; |
|
| 132 | 132 | |
| 133 | 133 | //$x = round($this->offsetX * sin(deg2rad($corner * $count))); |
| 134 | 134 | //$y = round($this->offsetY * cos(deg2rad($corner * $count))); |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | if ($skill['parent_id'] == 0) { |
| 145 | 145 | //$x = 130*$childs/2; |
| 146 | 146 | //$x = $this->space_between_blocks_x*$childs/2; |
| 147 | - $x = $this->canvas_x/2 - $this->block_size/2; |
|
| 147 | + $x = $this->canvas_x / 2 - $this->block_size / 2; |
|
| 148 | 148 | } else { |
| 149 | 149 | $max = isset($this->skills[$skill['parent_id']]['children']) ? count($this->skills[$skill['parent_id']]['children']) : 0; |
| 150 | - foreach($this->skills[$skill['parent_id']]['children'] as $id => $sk) { |
|
| 150 | + foreach ($this->skills[$skill['parent_id']]['children'] as $id => $sk) { |
|
| 151 | 151 | if ($skill['id'] == $sk['id']) { |
| 152 | 152 | break; |
| 153 | 153 | } |
@@ -155,17 +155,17 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | $parent_x = isset($this->skills[$skill['parent_id']]['x']) ? $this->skills[$skill['parent_id']]['x'] : 0; |
| 157 | 157 | //$x = $my_count*$this->space_between_blocks_x + $parent_x + $this->block_size - ($this->space_between_blocks_x*$max/2) ; |
| 158 | - $x = $my_count*$this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x/2 ) ; |
|
| 158 | + $x = $my_count * $this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x / 2); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $y = $skill['level']*$this->space_between_blocks_y; |
|
| 161 | + $y = $skill['level'] * $this->space_between_blocks_y; |
|
| 162 | 162 | |
| 163 | 163 | $skill['x'] = $x; |
| 164 | 164 | $skill['y'] = $y; |
| 165 | 165 | |
| 166 | 166 | //$skill['description'] = "{$brothers[$skill['parent_id']]} $x - $y"; |
| 167 | 167 | //$skill['name'] = $skill['name']." | $x = $my_count * 150 + $parent_x - (150* $max/2) - 10*$childs "; |
| 168 | - $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y +$y)); |
|
| 168 | + $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y + $y)); |
|
| 169 | 169 | } |
| 170 | 170 | return $this->get_html(); |
| 171 | 171 | } |
@@ -443,6 +443,7 @@ |
||
| 443 | 443 | * @param bool hide navigation optionally |
| 444 | 444 | * @param int content per page when show navigation (optional) |
| 445 | 445 | * @param bool sort data optionally |
| 446 | + * @param boolean $visibility_options |
|
| 446 | 447 | * @return string grid html |
| 447 | 448 | */ |
| 448 | 449 | public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 20, $sort_data = true, $grid_class = array()) |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $params['spacesBeforeSeparator'] = ''; |
| 216 | 216 | $params['spacesAfterSeparator'] = ''; |
| 217 | 217 | $query_vars = array_keys($_GET); |
| 218 | - $query_vars_needed = array ($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page'); |
|
| 218 | + $query_vars_needed = array($this->param_prefix.'column', $this->param_prefix.'direction', $this->param_prefix.'per_page'); |
|
| 219 | 219 | if (count($this->additional_parameters) > 0) { |
| 220 | 220 | $query_vars_needed = array_merge($query_vars_needed, array_keys($this->additional_parameters)); |
| 221 | 221 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | if (!$empty_table) { |
| 287 | 287 | if (!empty($this->additional_parameters)) { |
| 288 | - foreach($this->additional_parameters as $key => $value) { |
|
| 288 | + foreach ($this->additional_parameters as $key => $value) { |
|
| 289 | 289 | $html .= '<input type="hidden" name ="'.Security::remove_XSS($key).'" value ="'.Security::remove_XSS($value).'" />'; |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $html .= '<li><a data-action ="'.$action.'" href="#" onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a></li>'; |
| 311 | 311 | } |
| 312 | 312 | $html .= '</ul>'; |
| 313 | - $html .= '</div>';//btn-group |
|
| 313 | + $html .= '</div>'; //btn-group |
|
| 314 | 314 | $html .= '</div>'; //toolbar |
| 315 | 315 | } else { |
| 316 | 316 | $html .= $form; |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - return '<div class="table-responsive">' . $html . '</div>'; |
|
| 337 | + return '<div class="table-responsive">'.$html.'</div>'; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $html .= '<div class="clear"></div>'; |
| 390 | 390 | if (count($this->form_actions) > 0) { |
| 391 | - $script= '<script> |
|
| 391 | + $script = '<script> |
|
| 392 | 392 | /*<![CDATA[*/ |
| 393 | 393 | function setCheckbox(value) { |
| 394 | 394 | d = document.form_'.$this->table_name.'; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | // Getting the items of the table |
| 413 | - $items = $this->get_clean_html(false); //no sort |
|
| 413 | + $items = $this->get_clean_html(false); //no sort |
|
| 414 | 414 | |
| 415 | 415 | // Generation of style classes must be improved. Maybe we need a a table name to create style on the fly: |
| 416 | 416 | // i.e: .whoisonline_table_grid_container instead of .grid_container |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | $html .= '<div class="clear"></div>'; |
| 480 | 480 | if (count($this->form_actions) > 0) { |
| 481 | - $script= '<script> |
|
| 481 | + $script = '<script> |
|
| 482 | 482 | /*<![CDATA[*/ |
| 483 | 483 | function setCheckbox(value) { |
| 484 | 484 | d = document.form_'.$this->table_name.'; |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $counter = 0; |
| 587 | 587 | foreach ($row as $index => $rowInfo) { |
| 588 | 588 | if (!isset($this->columnsToHide[$index])) { |
| 589 | - $newRow[$counter] = $rowInfo ; |
|
| 589 | + $newRow[$counter] = $rowInfo; |
|
| 590 | 590 | $counter++; |
| 591 | 591 | } |
| 592 | 592 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | if ($this->odd_even_rows_enabled == true) { |
| 604 | - $this->altRowAttributes(0, array ('class' => 'row_odd'), array ('class' => 'row_even'), true); |
|
| 604 | + $this->altRowAttributes(0, array('class' => 'row_odd'), array('class' => 'row_even'), true); |
|
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | foreach ($this->th_attributes as $column => $attributes) { |
@@ -663,11 +663,11 @@ discard block |
||
| 663 | 663 | } |
| 664 | 664 | $result[] = '<select name="'.$this->param_prefix.'per_page" onchange="javascript: this.form.submit();">'; |
| 665 | 665 | for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) { |
| 666 | - $result[] = '<option value="'.$nr.'" '. ($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>'; |
|
| 666 | + $result[] = '<option value="'.$nr.'" '.($nr == $this->per_page ? 'selected="selected"' : '').'>'.$nr.'</option>'; |
|
| 667 | 667 | } |
| 668 | 668 | // @todo no limits |
| 669 | 669 | //if ($total_number_of_items < 500) { |
| 670 | - $result[] = '<option value="'.$total_number_of_items.'" '. ($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>'; |
|
| 670 | + $result[] = '<option value="'.$total_number_of_items.'" '.($total_number_of_items == $this->per_page ? 'selected="selected"' : '').'>'.api_ucfirst(get_lang('All')).'</option>'; |
|
| 671 | 671 | //} |
| 672 | 672 | $result[] = '</select>'; |
| 673 | 673 | $result[] = '<noscript>'; |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | */ |
| 786 | 786 | public function get_additional_url_paramstring() |
| 787 | 787 | { |
| 788 | - $param_string_parts = array (); |
|
| 788 | + $param_string_parts = array(); |
|
| 789 | 789 | if (is_array($this->additional_parameters) && count($this->additional_parameters) > 0) { |
| 790 | 790 | foreach ($this->additional_parameters as $key => & $value) { |
| 791 | 791 | $param_string_parts[] = urlencode($key).'='.urlencode($value); |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; |
| 799 | 799 | $my_get_direction = $_GET[$tablename.'_direction']; |
| 800 | 800 | if (!in_array($my_get_direction, array('ASC', 'DESC'))) { |
| 801 | - $param[$tablename.'_direction'] = 'ASC'; |
|
| 801 | + $param[$tablename.'_direction'] = 'ASC'; |
|
| 802 | 802 | } else { |
| 803 | 803 | $param[$tablename.'_direction'] = $my_get_direction; |
| 804 | 804 | } |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | if (isset($_GET[$tablename.'_column'])) { |
| 813 | 813 | $param[$tablename.'_column'] = intval($_GET[$tablename.'_column']); |
| 814 | 814 | } |
| 815 | - $param_string_parts = array (); |
|
| 815 | + $param_string_parts = array(); |
|
| 816 | 816 | foreach ($param as $key => & $value) { |
| 817 | 817 | $param_string_parts[] = urlencode($key).'='.urlencode($value); |
| 818 | 818 | } |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | $param[$this->param_prefix.'page_nr'] = $this->page_nr; |
| 834 | 834 | $param[$this->param_prefix.'per_page'] = $this->per_page; |
| 835 | 835 | $param[$this->param_prefix.'column'] = $this->column; |
| 836 | - $param_string_parts = array (); |
|
| 836 | + $param_string_parts = array(); |
|
| 837 | 837 | foreach ($param as $key => & $value) { |
| 838 | 838 | $param_string_parts[] = urlencode($key).'='.urlencode($value); |
| 839 | 839 | } |
@@ -340,9 +340,9 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | - * This function shows the content of a table in a grid. |
|
| 344 | - * Should not be use to edit information (edit/delete rows) only. |
|
| 345 | - **/ |
|
| 343 | + * This function shows the content of a table in a grid. |
|
| 344 | + * Should not be use to edit information (edit/delete rows) only. |
|
| 345 | + **/ |
|
| 346 | 346 | public function display_grid() |
| 347 | 347 | { |
| 348 | 348 | $empty_table = false; |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | //$param[$tablename.'_direction'] = $_GET[$tablename.'_direction']; |
| 801 | 801 | $my_get_direction = $_GET[$tablename.'_direction']; |
| 802 | 802 | if (!in_array($my_get_direction, array('ASC', 'DESC'))) { |
| 803 | - $param[$tablename.'_direction'] = 'ASC'; |
|
| 803 | + $param[$tablename.'_direction'] = 'ASC'; |
|
| 804 | 804 | } else { |
| 805 | 805 | $param[$tablename.'_direction'] = $my_get_direction; |
| 806 | 806 | } |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | if (is_array($row)) { |
| 930 | 930 | foreach ($row as & $value) { |
| 931 | 931 | if (empty($value)) { |
| 932 | - $value = '-'; |
|
| 932 | + $value = '-'; |
|
| 933 | 933 | } |
| 934 | 934 | } |
| 935 | 935 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | 102 | * @param array $conditions a list of condition (exemple : status=>STUDENT) |
| 103 | - * @param array $order_by a list of fields on which sort |
|
| 103 | + * @param string[] $order_by a list of fields on which sort |
|
| 104 | 104 | * @return array An array with all users of the platform. |
| 105 | 105 | */ |
| 106 | 106 | function get_specific_field_values_list( |
@@ -235,6 +235,7 @@ discard block |
||
| 235 | 235 | * @param string Course code |
| 236 | 236 | * @param string Tool ID |
| 237 | 237 | * @param int Internal ID used in specific tool table |
| 238 | + * @param string $tool_id |
|
| 238 | 239 | */ |
| 239 | 240 | function delete_all_values_for_item($course_id, $tool_id, $ref_id) { |
| 240 | 241 | $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
@@ -248,6 +249,7 @@ discard block |
||
| 248 | 249 | * Defaults to the first letter of the name, otherwise iterate through available |
| 249 | 250 | * letters |
| 250 | 251 | * @param string Name |
| 252 | + * @param string $name |
|
| 251 | 253 | * @return string One-letter code, upper-case |
| 252 | 254 | */ |
| 253 | 255 | function get_specific_field_code_from_name($name) { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | function delete_specific_field($id) |
| 43 | 43 | { |
| 44 | 44 | $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); |
| 45 | - $id = (int)$id; |
|
| 45 | + $id = (int) $id; |
|
| 46 | 46 | if (!is_numeric($id)) { |
| 47 | 47 | return false; |
| 48 | 48 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | function edit_specific_field($id, $name) |
| 61 | 61 | { |
| 62 | 62 | $table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); |
| 63 | - $id = (int)$id; |
|
| 63 | + $id = (int) $id; |
|
| 64 | 64 | if (!is_numeric($id)) { |
| 65 | 65 | return false; |
| 66 | 66 | } |
@@ -237,10 +237,10 @@ |
||
| 237 | 237 | * @param int Internal ID used in specific tool table |
| 238 | 238 | */ |
| 239 | 239 | function delete_all_values_for_item($course_id, $tool_id, $ref_id) { |
| 240 | - $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
| 241 | - $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
| 242 | - $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
| 243 | - Database::query($sql); |
|
| 240 | + $table_sf_values = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); |
|
| 241 | + $sql = 'DELETE FROM %s WHERE course_code = \'%s\' AND tool_id = \'%s\' AND ref_id = %s'; |
|
| 242 | + $sql = sprintf($sql, $table_sf_values, $course_id, $tool_id, $ref_id); |
|
| 243 | + Database::query($sql); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |