Changeset 1143
- Timestamp:
- 04/27/10 00:06:59 (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
common/db/task.php (modified) (1 diff)
-
www/macros/macro_taskparam.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/db/task.php
r1142 r1143 347 347 } 348 348 349 // Returns the score a user got on a task in the archive. 350 // Optionally, a different round parameter can be specified. 351 function task_get_user_score($task_id, $user_id, $round_id = 'arhiva') { 352 // Validate 353 if (!is_round_id($round_id)) { 354 log_error("Invalid round id"); 355 } 356 if (!is_task_id($task_id)) { 357 log_error("Invalid task id"); 358 } 359 if (!is_user_id($user_id)) { 360 log_error("Invalid user id"); 361 } 362 363 $query = sprintf( 364 "SELECT `score` FROM ia_score_user_round_task 365 WHERE round_id = %s AND task_id = %s AND user_id = %s", 366 db_quote($round_id), db_quote($task_id), db_quote($user_id)); 367 $res = db_fetch($query); 368 369 return getattr($res, "score", null); 370 } 371 349 372 ?> -
trunk/www/macros/macro_taskparam.php
r1095 r1143 6 6 require_once(IA_ROOT_DIR . "common/cache.php"); 7 7 require_once(IA_ROOT_DIR . "www/format/format.php"); 8 require_once(IA_ROOT_DIR . "www/macros/macro_stars.php"); 8 9 9 10 // Displays a task field, be it a hard-coded field such as task author or a grader parameter such as `timelimit`. … … 83 84 $user['rating_cache']); 84 85 86 case 'difficulty': 87 if (is_null($task['rating'])) { 88 return 'N/A'; 89 } 90 $star_args = array('rating' => $task['rating'], 91 'scale' => 5, 92 'type' => 'normal'); 93 return macro_stars($star_args); 94 95 case 'archivescore': 96 $user = identity_get_user(); 97 if (is_null($user)) { 98 return 'N/A'; 99 } else { 100 $score = task_get_user_score($task['id'], $user['id']); 101 if (is_null($score)) { 102 return 'N/A'; 103 } else { 104 return intval($score) . " puncte"; 105 } 106 } 107 85 108 default: 86 109 $params = task_get_parameters($task_id);
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)