Browse Source

Creation a new block skills in the admin/index.php see #1791

Julio Montoya 13 years ago
parent
commit
e6293cfda6

+ 19 - 2
main/admin/index.php

@@ -154,7 +154,7 @@ if (api_is_platform_admin()) {
 
 /* Sessions */
 
-if (api_get_setting('use_session_mode') == 'true') { 
+if (api_get_setting('use_session_mode') == 'true') {
 	
 	$blocks['sessions']['icon']  = Display::return_icon('session.png', get_lang('Sessions'), array(), 22);
 	$blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
@@ -239,9 +239,23 @@ if (api_is_platform_admin()) {
 	$items[] = array('url'=>'configure_extensions.php?display=serverstats', 	'label' => get_lang('ServerStatistics'));
 	$items[] = array('url'=>'configure_extensions.php?display=bandwidthstats', 	'label' => get_lang('BandWidthStatistics'));	
 	$blocks['extensions']['items'] = $items;	
+    
+    
+    //Skills
+    
+    $blocks['skills']['icon']  = Display::return_icon('logo.gif', get_lang('Skills'));
+    $blocks['skills']['label'] = get_lang('Skills');
+    
+    $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'));   
+    
+    $blocks['skills']['items'] = $items;
+    
 
 	
-	/* Extensions */
+	/* Chamilo.org */
 	
 	$blocks['chamilo']['icon']  = Display::return_icon('logo.gif', 'Chamilo.org');
 	$blocks['chamilo']['label'] = 'Chamilo.org';
@@ -258,6 +272,9 @@ if (api_is_platform_admin()) {
 	$items[] = array('url'=>'http://www.chamilo.org/extensions', 	'label' => get_lang('ChamiloExtensions'));	
 	
 	$blocks['chamilo']['items'] = $items;
+    
+    
+    
 	
 	// Try to display a maximum before we check the chamilo version and all that.
 	//session_write_close(); //close session to avoid blocking concurrent access

+ 14 - 3
main/admin/skills_gradebook.php

@@ -19,11 +19,22 @@ api_protect_admin_script();
 //Adds the JS needed to use the jqgrid
 $htmlHeadXtra[] = api_get_jquery_ui_js(true);
 
-Display::display_header();
+$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'display';
+
 
 // setting breadcrumbs
+
+$tool_name = get_lang('SkillGradebook');
 $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[]=array('url' => 'career_dashboard.php','name' => get_lang('CareersAndPromotions'));
+if ($action == 'add_skill') {
+    $interbreadcrumb[]=array('url' => 'skills_gradebook.php','name' => get_lang('SkillGradebook'));
+    $tool_name = get_lang('Add');    
+}
+
+
+Display::display_header($tool_name);
+
+
 
 
 //jqgrid will use this URL to do the selects
@@ -60,7 +71,7 @@ $(function() {
 </script>
 <?php
 $gradebook = new Gradebook();
-$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'display'; 
+ 
 switch($action) {
     case 'display':
         $gradebook->display();

+ 3 - 4
main/admin/skills_profile.php

@@ -17,28 +17,27 @@ api_protect_admin_script();
 
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
 $htmlHeadXtra[] = '<link  href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
-
 $htmlHeadXtra[] = api_get_jquery_ui_js();
 
+$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
+
 $skill           = new Skill();
 $skill_profile   = new SkillProfile();
 $skill_rel_user  = new SkillRelUser();
 
 $url  = api_get_path(WEB_AJAX_PATH).'skill.ajax.php';
 
-$tpl = new Template();
+$tpl = new Template(get_lang('Skills'));
 
 $form = new FormValidator('profile_search');
 
 $form->addElement('select', 'skills', null, null, array('id'=>'skills'));
 $form->addElement('style_submit_button', 'submit', get_lang('Search'), 'class="a_button blue "');
 
-
 $profiles = $skill_profile->get_all();
 
 $tpl->assign('profiles', $profiles);
 
-
 $total_skills_to_search = array();
 
 if ($form->validate()) {

+ 3 - 0
main/inc/ajax/model.ajax.php

@@ -83,6 +83,9 @@ switch ($action) {
         $result     = Database::select('*', $obj->table, array('order'=>"$sidx $sord", 'LIMIT'=> "$start , $limit"));
         $new_result = array();
         foreach($result as $item) {
+            if ($item['parent_id'] != 0) {
+                continue;
+            }
             $skills = $obj->get_skills_by_gradebook($item['id']);
             //Fixes bug when gradebook doesn't have names
             if (empty($item['name'])) {

+ 5 - 4
main/inc/ajax/skill.ajax.php

@@ -37,19 +37,20 @@ switch ($action) {
         break;
     case 'get_gradebooks':
         $gradebooks = $gradebook_list = $gradebook->get_all();
-        /*$gradebook_list = array();
+        $gradebook_list = array();
+        //only course gradebook
         if (!empty($gradebooks)) {
             foreach($gradebooks as $gradebook) {
                 if ($gradebook['parent_id'] == 0) {
-                    $gradebook['name'] = $gradebook['name'];
+                    //$gradebook['name'] = $gradebook['name'];
                     $gradebook_list[]  = $gradebook;
                 } else {
                   //  $gradebook['name'] = $gradebook_list[$gradebook['parent_id']]['name'].' > '.$gradebook['name'];
-                    $gradebook_list[]  = $gradebook;
+                    //$gradebook_list[]  = $gradebook;
                 }
                
             }
-        }*/
+        }
         echo json_encode($gradebook_list);
         break;    
     case 'get_skills':

+ 2 - 0
main/inc/lib/gradebook.lib.php

@@ -129,10 +129,12 @@ class Gradebook extends Model {
      */
     public function display() {
         // action links
+        /*
         echo '<div class="actions" style="margin-bottom:20px">';
         echo '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';        
       //  echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('new_career.png',get_lang('Add'),'','32').'</a>';                      
         echo '</div>';   
+        */
         echo Display::grid_html('gradebooks');  
     }
     

+ 2 - 2
main/inc/lib/userportal.lib.php

@@ -393,12 +393,12 @@ 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('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 .= Display::tag('li', Display::url(get_lang('MySkills'), api_get_path(WEB_CODE_PATH).'social/skills_tree.php'));
         
         

+ 13 - 13
main/template/default/skill/profile.tpl

@@ -152,32 +152,32 @@ function checkLength( o, n, min, max ) {
     {foreach $order_user_list as $count => $user_list}
         <h2> {"Matches"|get_lang} {$count}/{$total_search_skills} </h2>
         {foreach $user_list as $user}
-            <div class="ui-widget">
+            <div class="ui-widget" style="width:400px">
                 <div class="ui-widget-header">                    
                     <h3>
                         <img src="{$user['user'].avatar_small}" /> {$user['user'].complete_name} ({$user['user'].username})
                     </h3>
                 </div>
                 <div class="ui-widget-content ">
-                    <h4>Skills</h4>
+                    <h4>Skills {$user.total_found_skills} / {$total_search_skills}</h4>
                     <ul>    
-                        {$user.total_found_skills} / {$total_search_skills}                
-                    {foreach $user['skills'] as $skill_data}                 
-                        <li>
-                            <span class="label_tag skill">{$skill_list[$skill_data.skill_id].name}</span>
-                            {if $skill_data.found}
-                                 * I have this skill * 
-                            {/if} 
-                            
-                        </li>                    
-                    {/foreach}
+                                        
+                        {foreach $user['skills'] as $skill_data}                 
+                            <li>
+                                <span class="label_tag skill">{$skill_list[$skill_data.skill_id].name}</span>
+                                {if $skill_data.found}
+                                     * I have this skill * 
+                                {/if} 
+                                
+                            </li>                    
+                        {/foreach}
                     </ul>
                 </div>    
             </div>  
         {/foreach}
     {/foreach}        
 {else}
-    {"No results"|get_lang}
+    <div class="warning-message">{"No results"|get_lang}</div>
 {/if}
 
 

+ 2 - 1
main/template/default/skill/skill_tree.tpl

@@ -322,7 +322,8 @@ $(document).ready( function() {
 
 </script>
 
-<a class="a_button gray" id="add_item_link" href="#">Add item</a>
+    <h2>Skills</h2>    
+    <a class="a_button gray" id="add_item_link" href="#">Add item</a>
 
 {$html}