From 9cb67db66b91c2c7ff707f23116427d575cc4f70 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Thu, 16 Oct 2008 06:54:29 +0000 Subject: [PATCH] MDL-15680 emoving weights interface (now in contrib). --- grade/edit/weights/ajax.php | 71 ------- grade/edit/weights/img/lm.gif | Bin 666 -> 0 bytes grade/edit/weights/img/lmh.gif | Bin 677 -> 0 bytes grade/edit/weights/img/ln.gif | Bin 142 -> 0 bytes grade/edit/weights/img/loading.gif | Bin 2673 -> 0 bytes grade/edit/weights/img/lp.gif | Bin 641 -> 0 bytes grade/edit/weights/img/lph.gif | Bin 651 -> 0 bytes grade/edit/weights/img/tm.gif | Bin 1281 -> 0 bytes grade/edit/weights/img/tmh.gif | Bin 1295 -> 0 bytes grade/edit/weights/img/tn.gif | Bin 504 -> 0 bytes grade/edit/weights/img/tp.gif | Bin 1243 -> 0 bytes grade/edit/weights/img/tph.gif | Bin 1263 -> 0 bytes grade/edit/weights/img/vline.gif | Bin 503 -> 0 bytes grade/edit/weights/index.php | 293 --------------------------- grade/edit/weights/lib.php | 315 ----------------------------- grade/edit/weights/tree.css | 56 ----- 16 files changed, 735 deletions(-) delete mode 100755 grade/edit/weights/ajax.php delete mode 100644 grade/edit/weights/img/lm.gif delete mode 100644 grade/edit/weights/img/lmh.gif delete mode 100644 grade/edit/weights/img/ln.gif delete mode 100644 grade/edit/weights/img/loading.gif delete mode 100644 grade/edit/weights/img/lp.gif delete mode 100644 grade/edit/weights/img/lph.gif delete mode 100644 grade/edit/weights/img/tm.gif delete mode 100644 grade/edit/weights/img/tmh.gif delete mode 100644 grade/edit/weights/img/tn.gif delete mode 100644 grade/edit/weights/img/tp.gif delete mode 100644 grade/edit/weights/img/tph.gif delete mode 100644 grade/edit/weights/img/vline.gif delete mode 100755 grade/edit/weights/index.php delete mode 100644 grade/edit/weights/lib.php delete mode 100644 grade/edit/weights/tree.css diff --git a/grade/edit/weights/ajax.php b/grade/edit/weights/ajax.php deleted file mode 100755 index 5dff7f66c9..0000000000 --- a/grade/edit/weights/ajax.php +++ /dev/null @@ -1,71 +0,0 @@ - diff --git a/grade/edit/weights/img/lm.gif b/grade/edit/weights/img/lm.gif deleted file mode 100644 index b5623002a654745049da926cd3c0f8f1cded2a43..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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 diff --git a/grade/edit/weights/img/loading.gif b/grade/edit/weights/img/loading.gif deleted file mode 100644 index 0bbf3bc0c0e5e635553e8d1bf9ceddefbc402396..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2673 zcmchY_gj;P7RTSb83YJ1>=8y5ONL=ZcEgk+C?FydumNNz8c=c6`n&|fmMu_HHG%^w zNLVjHyfy)hAgHK_Kxkz+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14}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 diff --git a/grade/edit/weights/img/lph.gif b/grade/edit/weights/img/lph.gif deleted file mode 100644 index f663714f4944a2b046d7c413e0aea5240132ec0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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~?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VN_|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 diff --git a/grade/edit/weights/img/tmh.gif b/grade/edit/weights/img/tmh.gif deleted file mode 100644 index e42349e406a7e23e8d6620821680628d6e0712e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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*X9F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o)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^ diff --git a/grade/edit/weights/img/vline.gif b/grade/edit/weights/img/vline.gif deleted file mode 100644 index 1fb0de8bb2911a51ff29f91fe7d231c0a5529091..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 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 diff --git a/grade/edit/weights/index.php b/grade/edit/weights/index.php deleted file mode 100755 index 5fb49be4b1..0000000000 --- a/grade/edit/weights/index.php +++ /dev/null @@ -1,293 +0,0 @@ -dirroot.'/grade/lib.php'; -require_once $CFG->dirroot.'/grade/report/lib.php'; // for preferences -require_once $CFG->dirroot.'/grade/edit/weights/lib.php'; - -require_js(array('yui_yahoo', 'yui_dom', 'yui_event', 'yui_json', 'yui_connection', 'yui_dragdrop', 'yui_treeview')); - -$courseid = required_param('id', PARAM_INT); -$action = optional_param('action', 0, PARAM_ALPHA); -$eid = optional_param('eid', 0, PARAM_ALPHANUM); -$category = optional_param('category', null, PARAM_INT); -$aggregationtype = optional_param('aggregationtype', null, PARAM_INT); -$showadvanced = optional_param('showadvanced', false, PARAM_BOOL); - -/// 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'=>'weights', 'courseid'=>$courseid)); -$returnurl = $gpr->get_return_url(null); - -// Change category aggregation if requested -if (!is_null($category) && !is_null($aggregationtype)) { - if (!$grade_category = grade_category::fetch(array('id'=>$category, 'courseid'=>$courseid))) { - error('Incorrect category id!'); - } - $data->aggregation = $aggregationtype; - grade_category::set_properties($grade_category, $data); - $grade_category->update(); -} - -//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); - -if (empty($eid)) { - $element = null; - $object = null; - -} else { - if (!$element = $gtree->locate_element($eid)) { - print_error('invalidelementid', '', $returnurl); - } - $object = $element['object']; -} - -$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) { - case 'delete': - if ($eid) { - if (!element_deletable($element)) { - // no deleting of external activities - they would be recreated anyway! - // exception is activity without grading or misconfigured activities - break; - } - $confirm = optional_param('confirm', 0, PARAM_BOOL); - - if ($confirm and confirm_sesskey()) { - $object->delete('grade/report/grader/category'); - redirect($returnurl); - - } else { - print_header_simple($strgrades . ': ' . $strgraderreport, ': ' . $strcategoriesedit, $navigation, '', '', true, '', navmenu($course)); - $strdeletecheckfull = get_string('deletecheck', '', $object->get_name()); - $optionsyes = array('eid'=>$eid, 'confirm'=>1, 'sesskey'=>sesskey(), 'id'=>$course->id, 'action'=>'delete'); - $optionsno = array('id'=>$course->id); - notice_yesno($strdeletecheckfull, 'index.php', 'index.php', $optionsyes, $optionsno, 'post', 'get'); - print_footer($course); - die; - } - } - break; - - case 'autosort': - //TODO: implement autosorting based on order of mods on course page, categories first, manual items last - break; - - case 'synclegacy': - grade_grab_legacy_grades($course->id); - redirect($returnurl); - - case 'move': - if ($eid and confirm_sesskey()) { - $moveafter = required_param('moveafter', PARAM_ALPHANUM); - if(!$after_el = $gtree->locate_element($moveafter)) { - print_error('invalidelementid', '', $returnurl); - } - $after = $after_el['object']; - $parent = $after->get_parent_category(); - $sortorder = $after->get_sortorder(); - - $object->set_parent($parent->id); - $object->move_after_sortorder($sortorder); - - redirect($returnurl); - } - break; - - case 'moveselect': - if ($eid and confirm_sesskey()) { - $moving = $eid; - } - break; - - default: - break; -} - -// Hide advanced columns if moving -if ($moving) { - $showadvanced = false; -} - -$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('weightsedit', 'grades')); - -$form_key = optional_param('sesskey', null, PARAM_ALPHANUM); - -if ($form_key && $data = data_submitted()) { - - foreach ($data as $key => $value) { - // Grade category text inputs - if (preg_match('/(aggregation|droplow|keephigh)_([0-9]*)/', $key, $matches)) { - $value = required_param($matches[0], PARAM_INT); - $param = $matches[1]; - $a->id = $matches[2]; - - if (!$DB->update_record('grade_categories', array('id' => $matches[2], $param => $value))) { - print_error('errorupdatinggradecategoryaggregation', 'grades', $a); - } - - // Grade item text inputs - } elseif (preg_match('/(aggregationcoef|multfactor|plusfactor)_([0-9]*)/', $key, $matches)) { - $value = required_param($matches[0], PARAM_NUMBER); - $param = $matches[1]; - $a->id = $matches[2]; - - if (!$DB->update_record('grade_items', array('id' => $matches[2], $param => $value))) { - print_error('errorupdatinggradeitemaggregationcoef', 'grades', $a); - } - - // Grade item checkbox inputs - } elseif (preg_match('/extracredit_original_([0-9]*)/', $key, $matches)) { // Sum extra credit checkbox - $extracredit = optional_param("extracredit_{$matches[1]}", null, PARAM_BOOL); - $original_value = required_param($matches[0], PARAM_BOOL); - $a->id = $matches[1]; - $newvalue = null; - - if ($original_value == 1 && is_null($extracredit)) { - $newvalue = 0; - } elseif ($original_value == 0 && $extracredit == 1) { - $newvalue = 1; - } else { - continue; - } - - if (!$DB->update_record('grade_items', array('id' => $matches[1], 'aggregationcoef' => $newvalue))) { - print_error('errorupdatinggradeitemaggregationcoef', 'grades', $a); - } - - // Grade category checkbox inputs - } elseif (preg_match('/aggregate(onlygraded|subcats|outcomes)_original_([0-9]*)/', $key, $matches)) { - $setting = optional_param('aggregate'.$matches[1].'_'.$matches[2], null, PARAM_BOOL); - $original_value = required_param($matches[0], PARAM_BOOL); - $a->id = $matches[2]; - - $newvalue = null; - if ($original_value == 1 && is_null($setting)) { - $newvalue = 0; - } elseif ($original_value == 0 && $setting == 1) { - $newvalue = 1; - } else { - continue; - } - - if (!$DB->update_record('grade_categories', array('id' => $matches[2], 'aggregate'.$matches[1] => $newvalue))) { - print_error('errorupdatinggradecategoryaggregate'.$matches[1], 'grades', $a); - } - } - } -} - -// echo ' '; - -print_box_start('gradetreebox generalbox'); - -echo '
'; -echo '
'; -echo ''; -echo build_html_tree(get_tree_json($gtree, $gtree->top_element, 0, $gpr), null, $returnurl, $moving, $eid); - -if ($showadvanced && !$moving) { - echo ''; -} - -echo '
-
'; - -print_box_end(); - -echo '
'; -if ($moving) { - print_single_button('index.php', array('id'=>$course->id), get_string('cancel'), 'get'); -} else { - $strshowhideadvanced = get_string('showadvancedcolumns', 'grades'); - - if ($showadvanced) { - $strshowhideadvanced = get_string('hideadvancedcolumns', 'grades'); - } - - print_single_button('index.php', array('id'=>$course->id, 'showadvanced' => !$showadvanced), $strshowhideadvanced, 'get'); - print_single_button('category.php', array('courseid'=>$course->id), get_string('addcategory', 'grades'), 'get'); - print_single_button('item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get'); - - if (!empty($CFG->enableoutcomes)) { - print_single_button('outcomeitem.php', array('courseid'=>$course->id), get_string('addoutcomeitem', 'grades'), 'get'); - } - - //print_single_button('index.php', array('id'=>$course->id, 'action'=>'autosort'), get_string('autosort', 'grades'), 'get'); - print_single_button('index.php', array('id'=>$course->id, 'action'=>'synclegacy'), get_string('synclegacygrades', 'grades'), 'get'); -} -echo '
'; - -echo ' -'; - -print_footer($course); -die; - -?> diff --git a/grade/edit/weights/lib.php b/grade/edit/weights/lib.php deleted file mode 100644 index 871f4c6d8a..0000000000 --- a/grade/edit/weights/lib.php +++ /dev/null @@ -1,315 +0,0 @@ -name = $gtree->get_element_header($element, false, false, false); - - $return_array['item'] = $object; - - $return_array['item']->actions = $gtree->get_edit_icon($element, $gpr); - $return_array['item']->actions .= $gtree->get_calculation_icon($element, $gpr); - - if ($element['type'] == 'item' or ($element['type'] == 'category' and $element['depth'] > 1)) { - if (element_deletable($element)) { - $return_array['item']->actions .= ''
-                     . get_string('delete').''; - } - $return_array['item']->actions .= ''
-                 . get_string('move').''; - } - - $return_array['item']->actions .= $gtree->get_hiding_icon($element, $gpr); - $return_array['item']->actions .= $gtree->get_locking_icon($element, $gpr); - $return_array['item']->eid = $element['eid']; - $return_array['item']->type = $element['type']; - - if ($element['type'] == 'category') { - foreach($element['children'] as $child_el) { - if (!empty($child_el['object']->itemtype) && ($child_el['object']->itemtype == 'course' || $child_el['object']->itemtype == 'category') && !$totals) { - continue; - } - $return_array['children'][] = get_tree_json($gtree, $child_el, $totals, $gpr); - } - } - - return $return_array; -} - -function build_html_tree($tree, $element=null, $level=0, $moving=false, $eid) { - global $CFG, $COURSE; - - $showadvanced = optional_param('showadvanced', false, PARAM_BOOL); - $advclass = ($showadvanced) ? 'shown' : 'hidden'; - - $options = array(GRADE_AGGREGATE_MEAN => get_string('aggregatemean', 'grades'), - GRADE_AGGREGATE_WEIGHTED_MEAN => get_string('aggregateweightedmean', 'grades'), - GRADE_AGGREGATE_WEIGHTED_MEAN2 => get_string('aggregateweightedmean2', 'grades'), - GRADE_AGGREGATE_EXTRACREDIT_MEAN => get_string('aggregateextracreditmean', 'grades'), - GRADE_AGGREGATE_MEDIAN => get_string('aggregatemedian', 'grades'), - GRADE_AGGREGATE_MIN => get_string('aggregatemin', 'grades'), - GRADE_AGGREGATE_MAX => get_string('aggregatemax', 'grades'), - GRADE_AGGREGATE_MODE => get_string('aggregatemode', 'grades'), - GRADE_AGGREGATE_SUM => get_string('aggregatesum', 'grades')); - - $html = ''; - $root = false; - - if (is_null($element)) { - $html .= ' - - '; - if (!$moving) { - $html .= ' - - - - - - - - - - - - '; - } - - $html .= ''; - $element = $tree; - $root = true; - } - - - $id = required_param('id', PARAM_INT); - - /// prepare move target if needed - $last = ''; - $moveto = ''; - - if ($moving) { - $strmove = get_string('move'); - $strmovehere = get_string('movehere'); - $element['item']->actions = ''; // no action icons when moving - $moveto = ''; - } - - /// print the list items now - if ($moving == $element['item']->eid) { - - // do not diplay children - return ''; - - } - - if (!empty($element['children'])) { // Grade category - $category = grade_category::fetch(array('id' => $element['item']->id)); - $item = $category->get_grade_item(); - - $script = "window.location='index.php?id=$id&category={$category->id}&aggregationtype='+this.value"; - $aggregation = choose_from_menu($options, 'aggregation_'.$category->id, $category->aggregation, get_string('choose'), $script, 0, true); - - $onlygradedcheck = ($category->aggregateonlygraded == 1) ? 'checked="checked"' : ''; - $subcatscheck = ($category->aggregatesubcats == 1) ? 'checked="checked"' : ''; - $outcomescheck = ($category->aggregateoutcomes == 1) ? 'checked="checked"' : ''; - - $aggregateonlygraded =''; - $aggregatesubcats = ''; - $aggregateoutcomes = ''; - - $droplow = ''; - $keephigh = ''; - - $hidden = ''; - $hidden .= ''; - $hidden .= ''; - - // Add aggregation coef input if not a course item and if parent category has correct aggregation type - $aggcoef_input = get_weight_input($item); - $dimmed = ($item->hidden) ? " dimmed " : ""; - - $html .= ' - - '; - - if (!$moving) { - $html .= ' - - - - - - - - - - - '; - } - - $html .= ' - - '.$moveto; - - foreach ($element['children'] as $child) { - $html .= build_html_tree($tree, $child, $level+1, $moving, $eid); - } - - } else { // Dealing with a grade item - - $item = grade_item::fetch(array('id' => $element['item']->id)); - $element['type'] = 'item'; - $element['object'] = $item; - - $element['item']->name = grade_structure::get_element_icon($element). $element['item']->name; - - if (!empty($item->itemmodule) && $cm = get_coursemodule_from_instance($item->itemmodule, $item->iteminstance, $item->courseid)) { - - $dir = $CFG->dirroot.'/mod/'.$item->itemmodule; - - if (file_exists($dir.'/grade.php')) { - $url = $CFG->wwwroot.'/mod/'.$item->itemmodule.'/grade.php?id='.$cm->id; - } else { - $url = $CFG->wwwroot.'/mod/'.$item->itemmodule.'/view.php?id='.$cm->id; - } - - $element['item']->name = ''.$element['item']->name.''; - } - - // Determine aggregation coef element - $aggcoef_input = get_weight_input($item); - $multfactor = ''; - $plusfactor = ''; - - $dimmed = ($item->hidden) ? " dimmed_text " : ""; - $html .= ' - - '; - - if (!$moving) { - $html .= ' - - - - - - - - - - - '; - } - - $html .= ' - - '.$moveto; - } - - - if ($root) { - $html .= "
'.get_string('name').''.get_string('aggregation', 'grades').''.get_string('weightorextracredit', 'grades').''.get_string('range', 'grades').''.get_string('aggregateonlygraded', 'grades').''.get_string('aggregatesubcats', 'grades').''.get_string('aggregateoutcomes', 'grades').''.get_string('droplow', 'grades').''.get_string('keephigh', 'grades').''.get_string('multfactor', 'grades').''.get_string('plusfactor', 'grades').''.get_string('actions').'
'
-                . $strmovehere.'
'.$element['item']->name.' ('.get_string('move').')
' . $element['item']->name . $hidden . '' . $aggregation . '' . $aggcoef_input . '' . $item->get_formatted_range() . '' . $aggregateonlygraded . '' . $aggregatesubcats . '' . $aggregateoutcomes . '' . $droplow . '' . $keephigh . ' - - ' . $element['item']->actions . '
' . $element['item']->name . ' - ' . $aggcoef_input . '' . $item->get_formatted_range() . ' - - - - - '.$multfactor.''.$plusfactor.'' . $element['item']->actions . '
\n"; - } - - return $html; -} - -/** - * Given a grade_item object, returns a labelled input if an aggregation coefficient (weight or extra credit) applies to it. - * @param grade_item $item - * @return string HTML - */ -function get_weight_input($item) { - if ($item->is_course_item()) { - return ''; - } - - $parent_category = $item->get_parent_category(); - - if ($item->is_category_item()) { - $parent_category = $parent_category->get_parent_category(); - } - - $parent_category->apply_forced_settings(); - - if ($parent_category->is_aggregationcoef_used()) { - $aggcoef = ''; - - if ($parent_category->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN) { - $aggcoef = 'aggregationcoefweight'; - } elseif ($parent_category->aggregation == GRADE_AGGREGATE_EXTRACREDIT_MEAN) { - $aggcoef = 'aggregationcoefextra'; - } elseif ($parent_category->aggregation == GRADE_AGGREGATE_SUM) { - $aggcoef = 'aggregationcoefextrasum'; - } - - if ($aggcoef == 'aggregationcoefweight' || $aggcoef == 'aggregationcoefextra') { - return ''; - } elseif ($aggcoef == 'aggregationcoefextrasum' ) { - $checked = ($item->aggregationcoef > 0) ? 'checked="checked"' : ''; - $extracredit = ($item->aggregationcoef > 0) ? 1 : 0; - - return '\n" - . ''; - } else { - return ''; - } - } -} - -function element_deletable($element) { - global $COURSE; - - if ($element['type'] != 'item') { - return true; - } - - $grade_item = $element['object']; - - if ($grade_item->itemtype != 'mod' or $grade_item->is_outcome_item() or $grade_item->gradetype == GRADE_TYPE_NONE) { - return true; - } - - $modinfo = get_fast_modinfo($COURSE); - if (!isset($modinfo->instances[$grade_item->itemmodule][$grade_item->iteminstance])) { - // module does not exist - return true; - } - - return false; -} - -?> diff --git a/grade/edit/weights/tree.css b/grade/edit/weights/tree.css deleted file mode 100644 index 24c750965b..0000000000 --- a/grade/edit/weights/tree.css +++ /dev/null @@ -1,56 +0,0 @@ -.gradetreebox tr.category td { - background-color: #DDDDDD; -} - -.gradetreebox .category td.name { - font-weight: bold; -} - -.gradetreebox td.name { - -} - -.gradetreebox th.actions { - width: 80px; -} - -.child { - background-image: url(img/ln.gif); -} - -.hidden { - display: none; -} -.shown { -} - -img.iconsmall { - margin-left: 4px; -} - -img.icon { - margin-right: 5px; -} - -.gradetreebox { - margin-left: auto; - margin-right: auto; - margin-top: 10px; - padding-bottom: 15px; -} - -.gradetreebox table { - margin-left: auto; - margin-right: auto; -} - -.buttons { - margin: 20px; - text-align: center; - width: 100%; -} - -.buttons .singlebutton { - display: inline; - padding: 5px; -} -- 2.39.5