From e58fcb3517aeaac364f2768594c5f792173c517d Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Mon, 22 Sep 2008 15:51:27 +0000 Subject: [PATCH] MDL-15680 Began implementing a simple YUI treeview of the grade items in their categories. Will tweak this to become a form with weights in input fields, and possible drag and drop also --- grade/edit/weights/ajax.php | 60 +++++++++++++ grade/edit/weights/img/lm.gif | Bin 0 -> 666 bytes grade/edit/weights/img/lmh.gif | Bin 0 -> 677 bytes grade/edit/weights/img/ln.gif | Bin 0 -> 142 bytes grade/edit/weights/img/loading.gif | Bin 0 -> 2673 bytes grade/edit/weights/img/lp.gif | Bin 0 -> 641 bytes grade/edit/weights/img/lph.gif | Bin 0 -> 651 bytes grade/edit/weights/img/tm.gif | Bin 0 -> 1281 bytes grade/edit/weights/img/tmh.gif | Bin 0 -> 1295 bytes grade/edit/weights/img/tn.gif | Bin 0 -> 504 bytes grade/edit/weights/img/tp.gif | Bin 0 -> 1243 bytes grade/edit/weights/img/tph.gif | Bin 0 -> 1263 bytes grade/edit/weights/img/vline.gif | Bin 0 -> 503 bytes grade/edit/weights/index.php | 120 +++++++++++++++++++++++++ grade/edit/weights/tree.css | 136 +++++++++++++++++++++++++++++ grade/lib.php | 16 +++- 16 files changed, 328 insertions(+), 4 deletions(-) create mode 100755 grade/edit/weights/ajax.php create mode 100644 grade/edit/weights/img/lm.gif create mode 100644 grade/edit/weights/img/lmh.gif create mode 100644 grade/edit/weights/img/ln.gif create mode 100644 grade/edit/weights/img/loading.gif create mode 100644 grade/edit/weights/img/lp.gif create mode 100644 grade/edit/weights/img/lph.gif create mode 100644 grade/edit/weights/img/tm.gif create mode 100644 grade/edit/weights/img/tmh.gif create mode 100644 grade/edit/weights/img/tn.gif create mode 100644 grade/edit/weights/img/tp.gif create mode 100644 grade/edit/weights/img/tph.gif create mode 100644 grade/edit/weights/img/vline.gif create mode 100755 grade/edit/weights/index.php create mode 100644 grade/edit/weights/tree.css diff --git a/grade/edit/weights/ajax.php b/grade/edit/weights/ajax.php new file mode 100755 index 00000000000..393a48fba62 --- /dev/null +++ b/grade/edit/weights/ajax.php @@ -0,0 +1,60 @@ + diff --git a/grade/edit/weights/img/lm.gif b/grade/edit/weights/img/lm.gif new file mode 100644 index 0000000000000000000000000000000000000000..b5623002a654745049da926cd3c0f8f1cded2a43 GIT binary patch literal 666 zcmdUs&1(}u0L90+Npyp<*4FQ|(*)B>s*aFDr9G?=@`0B<8U@)>u!$CZK>4{;Dd1Yu45FZ>;TyyJVkcrw;|av%Wq zfG+?z4H#w2V2nDOlx z;NPf*{|h>QbM96U2R+TU%};>$7mkmlRc$n*YmwV`#_z_#MDG41(8u(AF?UY`K}z>d zJxE8Mmr7btaJjZ{p|&YCQhb;WZGFvge0TUm7(IG6r-j@Gx83(?ZE@nwvfAx_4#>auF!nVb-p1_?dcQL-&j)(e^W~9mo}iy!^R*{xVj!d4ocu98Xw}8^Pz$=k zXfSr<)GTW|`&o{9+`9q^icY9}$Dw2G$&WLZZ$~{E`zbtDd4K=YYX`W>Vy0C*S0xs6;fB3g&~9pLX!Z?#N%XSx-#onl$*-={{EYn;!?ZF9iqq*9Y$)O zL^O2v!n4m`zwv*pfBDbZ{abJW5C{7=JU5yEAII@TGL_C`^=$p^{GGc=d9*NgU(V|9rG+*(e{gU0+I6d|Gx1!`9TJ*==jShv&v)>c{bf0^;&mA-U=kdF zlDu{*bz%^V`S*5R1NB$@hb0x?ing7c`V(qWJW|H9xdqi;ttGsT9i74MGp}Jf{G)g1 zqSlr1Zt8q-V_z?Nm#>qrztQ1683lZcElVAIHLA F4FFl;B{Tp4 literal 0 HcmV?d00001 diff --git a/grade/edit/weights/img/loading.gif b/grade/edit/weights/img/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..0bbf3bc0c0e5e635553e8d1bf9ceddefbc402396 GIT binary patch literal 2673 zcmchY_gj;P7RTSb83YJ1>=8y5ONL=ZcEgk+C?FydumNNz8c=c6`n&|fmMu_HHG%^w zNLVjHyfy)hAgHK_Kxkz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z14}4q0y6`s8DL?uo-~*R@5tnFsC1DR#BGxT8fA20u_o?`0iDNI6lf;^$@AkR1dPTz z>XF1ZAqNjU95c@Vn59Wo;Z6b(YG+L$xy3(?j2I*vQ>PmzMEdh`yw3=)E}JYMDG|*x mDkGVJ;D)fXhxDI?kcM(ish)oQ276#A;7`m!-0gEGiQEyv0*|-fq{m?^~?J| z>~JV3NKgVJ6fewKQ9S#346#RcN;lm1p|3K9N0UsVr*w7&G;Y7jz4;vmVFt{*5 zV8en54|W7NSQs=^6#RcMK|w*_!v=>BI|2$40{-7<*wCPGV1~l~7YjaINZ7Dq!UdoM zfD!=?2?+rYHW)0J(D30vz=sbT{@(x^xL`qr!nco4KAcGSaG~JA3Im|q9xPC}dgy&i(lS!fIo{IEaOaL=_X9`6^9K}JOtdUitn5@zIG(!S`qsa)!YWd0 zRwy&DOLJ-PdVNrCXP2;QSm03jh=om>*=2>u6b6@OaXmW?frkrL1hQLC)`~r~W##4N K0fMYd4AuY$xzKt5 literal 0 HcmV?d00001 diff --git a/grade/edit/weights/img/lph.gif b/grade/edit/weights/img/lph.gif new file mode 100644 index 0000000000000000000000000000000000000000..f663714f4944a2b046d7c413e0aea5240132ec0e GIT binary patch literal 651 zcmZ?wbhEHbRACTfc;>{gVZnq26B_=1*q|UF@c+Ys4J#)6f6(yZM8f|U3;w?VvM2n% zQSjkFKtn^rhYJM{Rv3KP5%2*>e%SEgLc)dyfe$Y>I9M1MXej)@P@tdyG-1Jm8443R z3N|z-eAwX7P>^t7hQfy(4ht$2J{(ARu)yH;%f}5B1s4`5Bm@Lpzr6p!0)@R(1TIVv zn9$KMbLPws4;FlQFyY(BCkY7w1qBHK4h|1C7(Cb!Frh%VVPuHSjez`*eT|9>Dk6oKMT7DfgJCk7pm<3Vx4!2Y7asj0c8wXMCQowu{6 zx37OfQ}@Iv{f4YFW~ffIpF3|}E2}6IlaK*}<^+3(HESL0TNyTO-o&_VyJh?8HI8dH zv@oz7Vp+n$$z?5Jr!2o~?c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N_|DFy}>wiJWI>x@T3PhNPU z)$dbDn98yu3%zOUW#kD+icOx-F->;x?5M+JY)9c2YrP#J7lrXHLK}@ablYRmKefSg zOS9hS?YNoR?&}pmmmcAP|K U-ZKv*d~KX^p5GT`Wd<<*0~01CaR2}S literal 0 HcmV?d00001 diff --git a/grade/edit/weights/img/tmh.gif b/grade/edit/weights/img/tmh.gif new file mode 100644 index 0000000000000000000000000000000000000000..e42349e406a7e23e8d6620821680628d6e0712e4 GIT binary patch literal 1295 zcmd6ki&s(y0Ee#-N}7}Oq@*pckJ2{Vm>nOB7NkAIc21m~j<41Z*~FG&=t^9gUEYvo zS5gsZbyHJTazQ&2vvQ<`<;YSK`I5euyH$t z*&qi(gUUD%pN-qtG!X3X>$d6H>@+4)2Eq`BLZPT61@F4vCH&79;aTDZ04yNxz32N+ z03RG;iNq4AOsC^6M)# z8}r;X?ex)}272zi{APjmH%-N!za$SfBnD`|$X*aWWt1|sl`$Uu3*9I~ef&7Cbi}NL zyaJOOgfeo2T2vR&fQXe_(#YZtR)bC&lA9L63oeRP%RBce)UrrX)@o&JY1Y(d5@&Yo~oz+sqlX=!2EAGu`)e5@RGve~z z@tE@C+o`eV#M(@!M5!`6!PDI2nOgbcxU)$8s($v6&UPPqkU*dTjOo3daj~>V|QWYz1&bk%cGJU zL+hAGYtTPdO&ET9(in3CZ{+(kqz9!IT)ti2fsz(rj1Z(I%uk_Z1$dUHLJCFC+@t*{rh7DQ$tg6bPOd)Ib9R>WJIOY zC1?7iG(~*cW?M%k^nH`*-V=i`xtK z>l-Y#TUe}i?3nDfEc#3uZ90uwt$NLx?Ya%yEz9_=8%|Cu4t!3WF5E0v&bw~>jvTK% z&s^_(54|tlPyNqYKx_lG736l%TS9Q=7LIEO5uQVI6V+8@m(N{9de0Z-ZN%5n-ba2T z{gniGQeaAgD-E_p_)=j^h7xB!tcjDOO^Q1$_QV)c-%pP@K@JsJlw?wqOHnpe`IKc; zms4R@m3ft>&a5}LdNsJN672wB*X9FPF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psL(MoR8$0IdX(?zH2%Hg>`-ccp8Jxl5wmiB;#`T*~W0< znaT0nzdmc`x@1}eckrIK6%W^bmr&dk$>w3NON(e^`pfR9b^VYcttCtww}oq_rmMmq zr&tL*m1S{@%|b_)0{U~((m1p?x>wnixKb|h6AUxEljFx^j;*9pB6C?#lY>gXQER~sqEX35bbegB4}YF^IdrZK;M znl`#LDXZ=|8q)iiRsK;<(pLKZud5_)mN!+nha$ zWNrBQ-{wyo4|n3P$E-?ncO=hO33T~thkU_L{i%-0sZ zd2{S+4(o(`QOHbPsXKG{Rrp&hHBccwUlM$Fj+$|jVz-oXx;xDEX4pQl>($7h=S#`a z<7BrxvDZS~G7lxC-xtTHb}WM_`nm7(E|%KK;xbB~$>Oiq+Q@m?t)cP+!J|9!3x(6q z1~avUd~h#e#S9o_7?V7N4yM rAJu+hrOyL~{R^MggEV{Jw!@4_--m(0mA>u4kuQ8ZP9_jTL4ffes3;L^ literal 0 HcmV?d00001 diff --git a/grade/edit/weights/img/vline.gif b/grade/edit/weights/img/vline.gif new file mode 100644 index 0000000000000000000000000000000000000000..1fb0de8bb2911a51ff29f91fe7d231c0a5529091 GIT binary patch literal 503 zcmV^fYPpKps`<(p>p2TrD|$=1D3^=ctGbK# zdo|2eJQh57td{J!4A)HgY!_`h&36sRSk21q>J1AnD^5#pYmSSqyUot4?)whhE*wu> zZ+wqDubj`k@7xdCKWPD}4YXDeTS9H_4t8_+4PrQn<0zK1cn)Jajn3;DdZfn@UPyT# z`Hi%95?@MvB>}GV*OK5%fiV%zG+6Ut&WJlF_N@5xV$h63Hx}&(@~B9qB$GNd$rNQ& zl~Y+hby*eWRhe07ZnfDJ=U1I$d6xBg7HC?bYl*fs`W7kFxJ&6aor@Q%U8#Gi_O+Uq z>tC&b!4CFXm~3LRi_tb#`$+IcfwtO2i=-iumcis&gwQteGNf$RAoON>7%V9T{{hW3I06UMq^ke`4 literal 0 HcmV?d00001 diff --git a/grade/edit/weights/index.php b/grade/edit/weights/index.php new file mode 100755 index 00000000000..6a1ec1143f8 --- /dev/null +++ b/grade/edit/weights/index.php @@ -0,0 +1,120 @@ +dirroot.'/grade/lib.php'; +require_once $CFG->dirroot.'/grade/report/lib.php'; // for preferences + +$courseid = required_param('id', PARAM_INT); +$action = optional_param('action', 0, PARAM_ALPHA); +$eid = optional_param('eid', 0, PARAM_ALPHANUM); + +require_js(array('yui_yahoo', 'yui_dom', 'yui_event', 'yui_json', 'yui_connection', 'yui_dragdrop', 'yui_treeview')); + +/// Make sure they can even access this course + +if (!$course = $DB->get_record('course', array('id' => $courseid))) { + print_error('nocourseid'); +} + +require_login($course); +$context = get_context_instance(CONTEXT_COURSE, $course->id); +require_capability('moodle/grade:manage', $context); + +/// return tracking object +$gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'weight', 'courseid'=>$courseid)); +$returnurl = $gpr->get_return_url(null); + +//first make sure we have proper final grades - we need it for locking changes +grade_regrade_final_grades($courseid); + +// get the grading tree object +// note: total must be first for moving to work correctly, if you want it last moving code must be rewritten! +$gtree = new grade_tree($courseid, false, false); + +$switch = grade_get_setting($course->id, 'aggregationposition', $CFG->grade_aggregationposition); + +$strgrades = get_string('grades'); +$strgraderreport = get_string('graderreport', 'grades'); +$strcategoriesedit = get_string('categoriesedit', 'grades'); +$strcategoriesanditems = get_string('categoriesanditems', 'grades'); + +$navigation = grade_build_nav(__FILE__, $strcategoriesanditems, array('courseid' => $courseid)); +$moving = false; + +switch ($action) { + default: + break; +} + +$CFG->stylesheets[] = $CFG->wwwroot.'/grade/edit/weights/tree.css'; +print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcategoriesedit, $navigation, '', '', true, '', navmenu($course)); + +/// Print the plugin selector at the top +print_grade_plugin_selector($courseid, 'edit', 'tree'); + +print_heading(get_string('categoriesedit', 'grades')); +$tree_json = json_encode(get_tree_json($gtree, $gtree->top_element)); + +require_once('ajax.php'); + +print_box_start('gradetreebox generalbox'); + +echo ' '; + +echo '
'; +echo '
'; + +// print_grade_tree($gtree, $gtree->top_element, $gpr, $switch); +// +echo '
'; +echo '
'; +print_box_end(); + +print_footer($course); +die; + +function get_tree_json(&$gtree, $element) { + + $return_array = array(); + + $object = $element['object']; + $eid = $element['eid']; + $object->name = $gtree->get_element_header($element, false, false, false); + + $return_array['item'] = $object; + + if ($element['type'] == 'category') { + foreach($element['children'] as $child_el) { + $return_array['children'][] = get_tree_json($gtree, $child_el); + } + } + + return $return_array; +} +?> diff --git a/grade/edit/weights/tree.css b/grade/edit/weights/tree.css new file mode 100644 index 00000000000..d70421942fc --- /dev/null +++ b/grade/edit/weights/tree.css @@ -0,0 +1,136 @@ +/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ + +/* first or middle sibling, no children */ +.ygtvtn { + background: url(img/tn.gif) 0 0 no-repeat; + width:17px; + height:22px; +} + +/* first or middle sibling, collapsable */ +.ygtvtm { + background: url(img/tm.gif) 0 0 no-repeat; + width:34px; + height:22px; cursor:pointer +} + +/* first or middle sibling, collapsable, hover */ +.ygtvtmh { + background: url(img/tmh.gif) 0 0 no-repeat; + width:34px; + height:22px; + cursor:pointer +} + +/* first or middle sibling, expandable */ +.ygtvtp { + background: url(img/tp.gif) 0 0 no-repeat; + width:34px; + height:22px; + cursor:pointer +} + +/* first or middle sibling, expandable, hover */ +.ygtvtph { + background: url(img/tph.gif) 0 0 no-repeat; + width:34px; + height:22px; + cursor:pointer +} + +/* last sibling, no children */ +.ygtvln { + background: url(img/ln.gif) 0 0 no-repeat; + width:17px; + height:22px; +} + +/* Last sibling, collapsable */ +.ygtvlm { + background: url(img/lm.gif) 0 0 no-repeat; + + width:34px; + height:22px; + cursor:pointer +} + +/* Last sibling, collapsable, hover */ +.ygtvlmh { + background: url(img/lmh.gif) 0 0 no-repeat; + width:34px; + height:22px; + cursor:pointer +} + +/* Last sibling, expandable */ +.ygtvlp { + background: url(img/lp.gif) 0 0 no-repeat; + width:34px; + height:22px; + cursor:pointer +} + +/* Last sibling, expandable, hover */ +.ygtvlph { + background: url(img/lph.gif) 0 0 no-repeat; + width:34px; + height:22px; + cursor:pointer +} + +/* Loading icon */ +.ygtvloading { + background: url(img/loading.gif) 0 0 no-repeat; + width:16px; + height:22px; +} + +/* the style for the empty cells that are used for rendering the depth + * of the node */ +.ygtvdepthcell { + background: url(img/vline.gif) 0 0 no-repeat; + width:17px; + height:22px; +} + +.ygtvblankdepthcell { + width:17px; + height:22px; +} + +/* the style of the div around each node */ +.ygtvitem { } + +.ygtvitem table{ + margin-bottom:0; +} +.ygtvitem td { + border:none;padding:0; +} + + + +/* the style of the div around each node's collection of children */ +.ygtvchildren { } +* html .ygtvchildren { + height:1%; +} + +/* the style of the text label in ygTextNode */ +.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { + margin-left:2px; + text-decoration: none; +} + +#expandcontractdiv { + border:1px dotted #dedede; + background-color:#EBE4F2; + margin:0 0 .5em 0; + padding:0.4em; +} + +#weightstree { + background: #fff; + padding:1em; + margin-top:1em; +} diff --git a/grade/lib.php b/grade/lib.php index 21234a35881..319b49aa1a2 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -79,15 +79,15 @@ class graded_users_iterator { return false; } - list($gradebookroles_sql, $params) = $DB->get_in_or_equal(explode(',', $CFG->gradebookroles)); + list($gradebookroles_sql, $params) = $DB->get_in_or_equal(explode(',', $CFG->gradebookroles), SQL_PARAMS_NAMED, 'grbr0'); $relatedcontexts = get_related_contexts_string(get_context_instance(CONTEXT_COURSE, $this->course->id)); if ($this->groupid) { $groupsql = "INNER JOIN {groups_members} gm ON gm.userid = u.id"; - $groupwheresql = "AND gm.groupid = ?"; + $groupwheresql = "AND gm.groupid = :groupid"; // $params contents: gradebookroles - $params[] = $this->groupid; + $params['groupid'] = $this->groupid; } else { $groupsql = ""; $groupwheresql = ""; @@ -126,7 +126,7 @@ class graded_users_iterator { if (!empty($this->grade_items)) { $itemids = array_keys($this->grade_items); - list($itemidsql, $grades_params) = $DB->get_in_or_equal($itemids); + list($itemidsql, $grades_params) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED, 'items0'); $params = array_merge($params, $grades_params); // $params contents: gradebookroles, groupid (for $groupwheresql) and itemids @@ -453,6 +453,14 @@ function print_grade_plugin_selector($courseid, $active_type, $active_plugin, $r $count++; } + if (has_capability('moodle/grade:manage', $context)) { + $url = 'edit/weights/index.php?id='.$courseid; + if ($active_type == 'edit' and $active_plugin == 'weights' ) { + $active = $url; + } + $menu[$url] = get_string('weights', 'grades'); + $count++; + } } /// finally print/return the popup form