Adding some fixes in the Gradebook skills UI + adding lang variables

skala
Julio Montoya 14 years ago
parent d8da4f6588
commit e6fc393767
  1. 2
      main/admin/index.php
  2. 23
      main/admin/skills_gradebook.php
  3. BIN
      main/img/icons/22/add_na.png
  4. BIN
      main/img/icons/22/warning.png
  5. 22
      main/inc/ajax/model.ajax.php
  6. 2
      main/inc/lib/model.lib.php
  7. 15
      main/inc/lib/userportal.lib.php
  8. 14
      main/template/default/skill/skill_tree.tpl

@ -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;

@ -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 \'<a href="?action=add_skill&id=\'+options.rowId+\'">'.Display::return_icon('addd.gif', get_lang('AddSkill'),'',22).'</a>'.
'\';
//certificates
if (rowObject[4] == 1) {
return \'<a href="?action=add_skill&id=\'+options.rowId+\'">'.Display::return_icon('add.png', get_lang('AddSkill'),'',22).'</a>'.'\';
} else {
return \''.Display::return_icon('add_na.png', get_lang('YourGradebookFirstNeedsACertificateInOrderToBeLinkedToASkill'),'',22).''.'\';
}
}';
?>
<script>
$(function() {
<?php
// grid definition see the $career->display() function
echo Display::grid_js('gradebooks', $url,$columns,$column_model,$extra_params, array(), $action_links,true);
echo Display::grid_js('gradebooks', $url, $columns, $column_model, $extra_params, array(), $action_links,true);
?>
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

@ -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;

@ -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'];
}

@ -391,20 +391,9 @@ class IndexManager {
}
function return_skills_links() {
$content = '<ul class="menulist">';
/* $content .= Display::tag('li', Display::url(get_lang('SkillsTree'), api_get_path(WEB_CODE_PATH).'admin/skills.php'));
$content .= Display::tag('li', Display::url(get_lang('SkillsProfile'), api_get_path(WEB_CODE_PATH).'admin/skills_profile.php'));
$content .= Display::tag('li', Display::url(get_lang('SkillsGradebook'), api_get_path(WEB_CODE_PATH).'admin/skills_gradebook.php'));
*/
$content = '<ul class="menulist">';
$content .= Display::tag('li', Display::url(get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/skills_tree.php'));
$content .= '</ul>';
$content .= '</ul>';
$html = self::show_right_block(get_lang("Skills"), $content);
return $html;
}

@ -349,8 +349,8 @@ $(document).ready( function() {
</script>
<div style="z-index: 1000;position: absolute;">
<h2>Skills</h2>
<a style="z-index: 1000"class="a_button gray" id="add_item_link" href="#">{"Add item"|get_lang}</a>
<h3>{'Skills'|get_lang}</h3>
<a style="z-index: 1000"class="a_button gray medium" id="add_item_link" href="#">{'AddSkill'|get_lang}</a>
</div>
{$html}
@ -360,7 +360,7 @@ $(document).ready( function() {
<input type="hidden" name="id" id="id"/>
<div class="row">
<div class="label">
<label for="name">Name</label>
<label for="name">{'Name'|get_lang}</label>
</div>
<div class="formw">
<input type="text" name="name" id="name" size="40" />
@ -368,7 +368,7 @@ $(document).ready( function() {
</div>
<div class="row">
<div class="label">
<label for="name">Parent</label>
<label for="name">{'Parent'|get_lang}</label>
</div>
<div class="formw">
<select id="parent_id" name="parent_id" />
@ -377,19 +377,19 @@ $(document).ready( function() {
</div>
<div class="row">
<div class="label">
<label for="name">Gradebook</label>
<label for="name">{'Gradebook'|get_lang}</label>
</div>
<div class="formw">
<select id="gradebook_id" name="gradebook_id[]" multiple="multiple"/>
</select>
<span class="help-block">
Gradebook Description
{'WithCertificate'|get_lang}
</span>
</div>
</div>
<div class="row">
<div class="label">
<label for="name">Description</label>
<label for="name">{'Description'|get_lang}</label>
</div>
<div class="formw">
<textarea name="description" id="description" cols="40" rows="7"></textarea>

Loading…
Cancel
Save