From e6fc393767abdbc76bf63aa65bc41ae4d1113571 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 21 Dec 2011 13:49:04 +0100 Subject: [PATCH] Adding some fixes in the Gradebook skills UI + adding lang variables --- main/admin/index.php | 2 +- main/admin/skills_gradebook.php | 23 +++++++++++++-------- main/img/icons/22/add_na.png | Bin 0 -> 742 bytes main/img/icons/22/warning.png | Bin 0 -> 884 bytes main/inc/ajax/model.ajax.php | 22 ++++++++++++++++---- main/inc/lib/model.lib.php | 2 +- main/inc/lib/userportal.lib.php | 15 ++------------ main/template/default/skill/skill_tree.tpl | 14 ++++++------- 8 files changed, 43 insertions(+), 35 deletions(-) create mode 100644 main/img/icons/22/add_na.png create mode 100644 main/img/icons/22/warning.png diff --git a/main/admin/index.php b/main/admin/index.php index 18469e492f..09b67f675f 100644 --- a/main/admin/index.php +++ b/main/admin/index.php @@ -249,7 +249,7 @@ if (api_is_platform_admin()) { $items = array(); $items[] = array('url'=>'skills.php', 'label' => get_lang('SkillsTree')); $items[] = array('url'=>'skills_profile.php', 'label' => get_lang('SkillsProfile')); - $items[] = array('url'=>'skills_gradebook.php', 'label' => get_lang('SkillsGradebook')); + $items[] = array('url'=>'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks')); $blocks['skills']['items'] = $items; diff --git a/main/admin/skills_gradebook.php b/main/admin/skills_gradebook.php index 184c329cfa..fddf3f0ee5 100644 --- a/main/admin/skills_gradebook.php +++ b/main/admin/skills_gradebook.php @@ -24,10 +24,10 @@ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'display'; // setting breadcrumbs -$tool_name = get_lang('SkillGradebook'); +$tool_name = get_lang('SkillsAndGradebooks'); $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); if ($action == 'add_skill') { - $interbreadcrumb[]=array('url' => 'skills_gradebook.php','name' => get_lang('SkillGradebook')); + $interbreadcrumb[]=array('url' => 'skills_gradebook.php','name' => get_lang('SkillsAndGradebooks')); $tool_name = get_lang('Add'); } @@ -42,13 +42,14 @@ Display::display_header($tool_name); $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_gradebooks'; //The order is important you need to check the the $column variable in the model.ajax.php file -$columns = array(get_lang('Name'), get_lang('Skills'), get_lang('Actions')); +$columns = array(get_lang('Name'), get_lang('CertificatesFiles'), get_lang('Skills'), get_lang('Actions')); //Column config $column_model = array( - array('name'=>'name', 'index'=>'name', 'width'=>'200', 'align'=>'left'), - array('name'=>'skills', 'index'=>'skills', 'width'=>'300', 'align'=>'left','sortable'=>'false'), - array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false') + array('name'=>'name', 'index'=>'name', 'width'=>'150', 'align'=>'left'), + array('name'=>'certificate', 'index'=>'certificate', 'width'=>'25', 'align'=>'left', 'sortable'=>'false'), + array('name'=>'skills', 'index'=>'skills', 'width'=>'300', 'align'=>'left', 'sortable'=>'false'), + array('name'=>'actions', 'index'=>'actions', 'width'=>'30', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false') ); //Autowidth $extra_params['autowidth'] = 'true'; @@ -57,15 +58,19 @@ $extra_params['height'] = 'auto'; //With this function we can add actions to the jgrid (edit, delete, etc) $action_links = 'function action_formatter(cellvalue, options, rowObject) { - return \''.Display::return_icon('addd.gif', get_lang('AddSkill'),'',22).''. - '\'; + //certificates + if (rowObject[4] == 1) { + return \''.Display::return_icon('add.png', get_lang('AddSkill'),'',22).''.'\'; + } else { + return \''.Display::return_icon('add_na.png', get_lang('YourGradebookFirstNeedsACertificateInOrderToBeLinkedToASkill'),'',22).''.'\'; + } }'; ?> diff --git a/main/img/icons/22/add_na.png b/main/img/icons/22/add_na.png new file mode 100644 index 0000000000000000000000000000000000000000..3aff6e1820d7ebf3f32fd03894cc1112aa0eb7b9 GIT binary patch literal 742 zcmVPx#0%A)?L;(MXkIcUS000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipu43>_JS z2QgRx00L@BL_t(2&ux-TNR&|&hM#l4JLBJES~_4>8Y-105#cU_uw4rwXwjk+f@mQ` zE?NY+t4*tRgFAO3AqBOGf_5z`MH?|jGyl;1{~eu~@0;(m@N+Wh+|7MC?>*-|@43Q( zxK~qrIr7B0sQ4)EQ2M!kd-;>Y(F?T4`ciS7(j|XRC-sN_L1WsLdKiP(0ZaDjk5hN@ zs&z@GSR@NrN+@GqM`S7eB0ootbHzRyy;~d6Az8*jf(nWfp+Ms@Gv0UpomY>63$*uN zuPx%UY>G>IG9fFZaWN?Q{|MNRd^Crx;Nl_} z*4PL}ivZhX0a(L9Q53MA=dq4OS>+R;9OEi5z$yYb7#wzR@jNpIA@b!05CZWVHRaGF+6MVx;tlBp)jBuGQlwcwU8BN=b9)2IsfLtuP=7d%N}0V5lSl>TG|TgR6%5S>|@XT2y1NpZ?j+sQ$!d6lnhBS_V!Z literal 0 HcmV?d00001 diff --git a/main/img/icons/22/warning.png b/main/img/icons/22/warning.png new file mode 100644 index 0000000000000000000000000000000000000000..5c328432cc94691601a0b1af5d1946d2755c6218 GIT binary patch literal 884 zcmV-)1B?8LP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2ipu4 z3?UL=CXp`y00Q($L_t(I%hi?5Yt%;^#y{Wr%}jRl+il$}?3>BD?u+i0WCOd1NudNJ z#Zn1rd;u%1w;W6GBIYb!dXUy0@&{DfQ*x*mDQzKWL1@~86cHLJwl!)}Q`e2eY?7TG zLdCSYzV+h3z%b7|&pZtCeZKIj4SAMBlOL74wxwRb0&sn<_QrwFF8}^Cj&21y=MWJR zvB>H2zP=E^%2$_81Bd>>UPxF(m^iwl8q04xXl{J%ph+y-b8zD5j;e_K*ov!Kfn$S7 zzmkhi=PPl?{RQFv9m!Xdu9AyRj}0dM7Z%>LJ#?gec*N)0Ih-{(Yv9^B%7;h%J=;S^ zT5-K60Ur!>hThv({VvgQ)5y|qGW|!2Uu&$kFMrDN#Y~=NTL@Xa>e4;&;Amg$!gD>v)M#-iT`BbX?eorgo?r}tHbWrb zA===?6Tf}lr7MNrsnO!lGYMC_LaMWn8c**^2@A6#x(&3(T7xkbv_?!DEX+!JS4uhy zsqt!8NIg~f#BgpXUEbQSZqGQh51s+fVvNNa3)*h%X&-fa#-+9OV&U6o#6!qB+XOCPT z2x!*UJWytH5Y*@B9xkcHx!M`v(0{($C+`=t{d;p0k@y4URvU1K?=^sN@=jtP>R4J8jCpLh9(cFDv2F&zJtoz}Nn#-Cu6%oAFYvJj_+@Ej z>eko~tLy8|$x9@=h{#${eFGptt5|L{LqPa{Y931gqw23*%j0h_$HyQGE`Lt|0000< KMNUMnLSTZnI-Mr~ literal 0 HcmV?d00001 diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php index 90e25116bb..f11a5746f7 100644 --- a/main/inc/ajax/model.ajax.php +++ b/main/inc/ajax/model.ajax.php @@ -3,6 +3,8 @@ //@todo this could be integrated in the inc/lib/model.lib.php + try to clean this file +$language_file = array('admin'); + require_once '../global.inc.php'; api_protect_admin_script(true); @@ -149,7 +151,7 @@ switch ($action) { $result = SessionManager::get_sessions_admin(array('where'=> $where_condition, 'order'=>"$sidx $sord", 'limit'=> "$start , $limit")); break; case 'get_gradebooks': - $columns = array('name', 'skills', 'actions'); + $columns = array('name', 'certificates','skills', 'actions', 'has_certificates'); if (!in_array($sidx, $columns)) { $sidx = 'name'; } @@ -160,21 +162,33 @@ switch ($action) { continue; } $skills = $obj->get_skills_by_gradebook($item['id']); + //Fixes bug when gradebook doesn't have names if (empty($item['name'])) { $item['name'] = $item['course_code']; + } else { + //$item['name'] = $item['name'].' ['.$item['course_code'].']'; } + + $item['name'] = Display::url($item['name'], api_get_path(WEB_CODE_PATH).'gradebook/index.php?id_session=0&cidReq='.$item['course_code']); + if (!empty($item['certif_min_score']) && !empty($item['document_id'])) { - $item['name'] .= '* (with_certificate)'; + $item['certificates'] = Display::return_icon('accept.png', get_lang('WithCertificate'), array(), 22); + $item['has_certificates'] = '1'; } else { - $item['name'] .= ' (No certificate)'; + $item['certificates'] = Display::return_icon('warning.png', get_lang('NoCertificate'), array(), 22); + $item['has_certificates'] = '0'; } + $skills_string = ''; if (!empty($skills)) { foreach($skills as $skill) { $item['skills'] .= Display::span($skill['name'], array('class' => 'label_tag skill')); } - } + } + + + $new_result[] = $item; } $result = $new_result; diff --git a/main/inc/lib/model.lib.php b/main/inc/lib/model.lib.php index 83a53589b3..1b4c393526 100644 --- a/main/inc/lib/model.lib.php +++ b/main/inc/lib/model.lib.php @@ -84,7 +84,7 @@ class Model { * Get the count of elements */ public function get_count() { - $row = Database::select('count(*) as count', $this->table, array(),'first'); + $row = Database::select('count(*) as count', $this->table, array('where' => array('parent_id = ?' => '0')),'first'); return $row['count']; } diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 8946ebafaa..d405ea6e65 100644 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -391,20 +391,9 @@ class IndexManager { } function return_skills_links() { - $content = ''; $html = self::show_right_block(get_lang("Skills"), $content); return $html; } diff --git a/main/template/default/skill/skill_tree.tpl b/main/template/default/skill/skill_tree.tpl index fe2868ec94..c40f2ea563 100644 --- a/main/template/default/skill/skill_tree.tpl +++ b/main/template/default/skill/skill_tree.tpl @@ -349,8 +349,8 @@ $(document).ready( function() {
-

Skills

-{"Add item"|get_lang} +

{'Skills'|get_lang}

+{'AddSkill'|get_lang}
{$html} @@ -360,7 +360,7 @@ $(document).ready( function() {
- +
@@ -368,7 +368,7 @@ $(document).ready( function() {
- +
- Gradebook Description + {'WithCertificate'|get_lang}
- +