| |
|
1 |
ad_page_contract { |
| |
|
2 |
|
| |
|
3 |
evaluations chunk to be displayed in the index page |
| |
|
4 |
|
| |
|
5 |
} |
| |
|
6 |
|
| |
|
7 |
set package_id [ad_conn package_id] |
| |
|
8 |
set user_id [ad_verify_and_get_user_id] |
| |
|
9 |
set admin_p [permission::permission_p -party_id $user_id -object_id $package_id -privilege admin] |
| |
|
10 |
|
| |
|
11 |
set base_url [ad_conn package_url] |
| |
|
12 |
|
| |
|
13 |
db_1row get_grade_info { *SQL* } |
| |
|
14 |
|
| |
|
15 |
set elements [list task_name \ |
| |
|
16 |
[list label "Name" \ |
| |
|
17 |
link_url_col task_url \ |
| |
|
18 |
orderby_asc {task_name asc} \ |
| |
|
19 |
orderby_desc {task_name desc}] \ |
| |
|
20 |
] |
| |
|
21 |
if { $admin_p } { |
| |
|
22 |
#admin |
| |
|
23 |
lappend elements task_weight \ |
| |
|
24 |
[list label "Weight" \ |
| |
|
25 |
display_template { <center>@grade_tasks_admin.task_weight@%</center> } \ |
| |
|
26 |
orderby_asc {task_weight asc} \ |
| |
|
27 |
orderby_desc {task_weight desc}] |
| |
|
28 |
set multirow_name grade_tasks_admin |
| |
|
29 |
set actions [list "Edit grades distribution of $grade_plural_name" [export_vars -base "${base_url}evaluation/admin/grades/distribution-edit" { grade_id }]] |
| |
|
30 |
} else { |
| |
|
31 |
#student |
| |
|
32 |
lappend elements grade \ |
| |
|
33 |
[list label "Grade over 100" \ |
| |
|
34 |
display_template { <center>@grade_tasks.grade@</center> } \ |
| |
|
35 |
orderby_asc {grade asc} \ |
| |
|
36 |
orderby_desc {grade desc}] |
| |
|
37 |
lappend elements comments \ |
| |
|
38 |
[list label "Comments" \ |
| |
|
39 |
link_url_col comments_url \ |
| |
|
40 |
link_html { title "View evaluation comments" }] |
| |
|
41 |
lappend elements task_weight \ |
| |
|
42 |
[list label "Net Value" \ |
| |
|
43 |
display_template { <center>@grade_tasks.task_weight@</center> } \ |
| |
|
44 |
orderby_asc {task_weight asc} \ |
| |
|
45 |
orderby_desc {task_weight desc}] |
| |
|
46 |
lappend elements answer \ |
| |
|
47 |
[list label "" \ |
| |
|
48 |
link_url_col answer_url \ |
| |
|
49 |
link_html { title "View my answer" }] |
| |
|
50 |
set multirow_name grade_tasks |
| |
|
51 |
set actions "" |
| |
|
52 |
} |
| |
|
53 |
|
| |
|
54 |
set total_grade 0.00 |
| |
|
55 |
set max_grade 0.00 |
| |
|
56 |
set category_weight 0 |
| |
|
57 |
|
| |
|
58 |
template::list::create \ |
| |
|
59 |
-name grade_tasks \ |
| |
|
60 |
-multirow $multirow_name \ |
| |
|
61 |
-actions $actions \ |
| |
|
62 |
-key task_id \ |
| |
|
63 |
-pass_properties { return_url mode base_url } \ |
| |
|
64 |
-filters { grade_id } \ |
| |
|
65 |
-elements $elements \ |
| |
|
66 |
-orderby_name evaluations_orderby \ |
| |
|
67 |
-orderby { default_value task_name } |
| |
|
68 |
|
| |
|
69 |
set evaluations_orderby [template::list::orderby_clause -orderby -name grade_tasks] |
| |
|
70 |
|
| |
|
71 |
if { [string equal $evaluations_orderby ""] } { |
| |
|
72 |
set evaluations_orderby " order by task_name asc" |
| |
|
73 |
} |
| |
|
74 |
|
| |
|
75 |
if { $admin_p } { |
| |
|
76 |
#admin |
| |
|
77 |
db_multirow -extend { task_url } grade_tasks_admin get_tasks_admin { *SQL* } { |
| |
|
78 |
set task_url [export_vars -base "${base_url}evaluation/admin/evaluations/student-list" { task_id grade_id }] |
| |
|
79 |
set category_weight [expr $category_weight + $task_weight] |
| |
|
80 |
} |
| |
|
81 |
} else { |
| |
|
82 |
|
| |
|
83 |
db_multirow -extend { comments comments_url answer answer_url } grade_tasks get_grade_tasks { *SQL* } { |
| |
|
84 |
|
| |
|
85 |
if { ![empty_string_p $comments] } { |
| |
|
86 |
set comments "View comments" |
| |
|
87 |
set comments_url evaluation_view |
| |
|
88 |
} |
| |
|
89 |
|
| |
|
90 |
set over_weight "" |
| |
|
91 |
if { ![empty_string_p $show_student_p] && $show_student_p } { |
| |
|
92 |
|
| |
|
93 |
if { ![empty_string_p $grade] } { |
| |
|
94 |
set grade [format %.2f $grade] |
| |
|
95 |
set over_weight "[format %.2f $task_grade]/" |
| |
|
96 |
set total_grade [expr $total_grade + $task_grade] |
| |
|
97 |
} else { |
| |
|
98 |
set grade "Not evaluated" |
| |
|
99 |
} |
| |
|
100 |
|
| |
|
101 |
set max_grade [expr $task_weight + $max_grade] |
| |
|
102 |
|
| |
|
103 |
} else { |
| |
|
104 |
set grade "Not available" |
| |
|
105 |
} |
| |
|
106 |
set task_weight "${over_weight}[format %.2f $task_weight]" |
| |
|
107 |
|
| |
|
108 |
# working with answer stuff (if it has a file/url attached) |
| |
|
109 |
if { [empty_string_p $answer_data] } { |
| |
|
110 |
set answer_url "" |
| |
|
111 |
set answer "" |
| |
|
112 |
} elseif { [regexp "http://" $answer_data] } { |
| |
|
113 |
set answer_url "[export_vars -base "$answer_data" { }]" |
| |
|
114 |
set answer "View my answer" |
| |
|
115 |
} else { |
| |
|
116 |
# we assume it's a file |
| |
|
117 |
set answer_url "[export_vars -base "${base_url}evaluation/view/$answer_title" { }]" |
| |
|
118 |
set answer "View my answer" |
| |
|
119 |
} |
| |
|
120 |
|
| |
|
121 |
if { $number_of_members > 1 && [string eq [db_string get_group_id { *SQL* }] 0] } { |
| |
|
122 |
set answer "" |
| |
|
123 |
set answer_url "" |
| |
|
124 |
set grade "No group for task" |
| |
|
125 |
} |
| |
|
126 |
|
| |
|
127 |
} |
| |
|
128 |
} |
| |
|
129 |
|
| |
|
130 |
if { $admin_p } { |
| |
|
131 |
set bottom_line "<small>Weight used in ${grade_plural_name}: ${category_weight}% (over 100% of $grade_plural_name) <br /> |
| |
|
132 |
$grade_plural_name represents ${grade_weight}% of the 100% of the class</small>" |
| |
|
133 |
} else { |
| |
|
134 |
set bottom_line "<small>Total points in this category: ${total_grade}/${max_grade}<br /> |
| |
|
135 |
This grade category represents the ${grade_weight}% of the 100% of the class</small>" |
| |
|
136 |
} |