Browse Source

Adding lang variables

Julio Montoya 13 years ago
parent
commit
1010374191
3 changed files with 23 additions and 48 deletions
  1. 4 5
      main/admin/skills_profile.php
  2. 2 2
      main/inc/lib/skill.lib.php
  3. 17 41
      main/template/default/skill/profile.tpl

+ 4 - 5
main/admin/skills_profile.php

@@ -65,7 +65,7 @@ $user_list = array();
 $count_skills = count($skills);
 
 $users  = $skill_rel_user->get_user_by_skills($skills);
-    
+
 if (!empty($users)) {
     foreach($users as $user) {            
         $user_info = api_get_user_info($user['user_id']);
@@ -74,6 +74,7 @@ if (!empty($users)) {
         $user_skills = array();
         $found_counts = 0 ;
         foreach($my_user_skills as $my_skill) {
+            
             $found = false;
             if (in_array($my_skill['skill_id'], $skills)) {
                 $found = true;
@@ -94,7 +95,7 @@ if (!empty($users)) {
     }
 }
 
-//var_dump($user_list);
+
 
 //$tpl->assign('user_list', $user_list);
 $tpl->assign('order_user_list', $ordered_user_list);
@@ -116,12 +117,10 @@ if (!empty($skills)) {
 
 $total_skills_to_search = $skill->get_skills_info($total_skills_to_search);
 $skill_list = array();
-foreach($total_skills_to_search as &$skill_info) {
+foreach($total_skills_to_search as $skill_info) {
     $skill_list[$skill_info['id']] = $skill_info;        
 }
 
-
-
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
 $id     = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
 

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

@@ -331,6 +331,7 @@ class Skill extends Model {
         $sql = "SELECT id, name, description, parent_id, relation_type 
                 FROM {$this->table} s INNER JOIN {$this->table_skill_rel_skill} ss ON (s.id = ss.skill_id) 
                 $id_condition";
+                
         $result = Database::query($sql);
         $skills = array();        
         
@@ -507,11 +508,10 @@ class Skill extends Model {
    
     public function get_user_skills($user_id, $get_skill_data = false) {
         $user_id = intval($user_id);        
-        //$sql = 'SELECT skill.*, user.* FROM '.$this->table_skill_rel_user.' user INNER JOIN '.$this->table_skill.' skill
-        
         $sql = 'SELECT DISTINCT s.id, s.name FROM '.$this->table_skill_rel_user.' u INNER JOIN '.$this->table.' s 
                 ON u.skill_id = s.id
                 WHERE user_id = '.$user_id;
+                
         $result = Database::query($sql);
         $skills = Database::store_result($result, 'ASSOC');
         $clean_skill = array();        

+ 17 - 41
main/template/default/skill/profile.tpl

@@ -37,25 +37,7 @@ $(document).ready( function() {
                       
                 $.ajax({
                     url: '{$url}?a=save_profile&'+params,
-                    success:function(data) {
-                             
-                        /*jsPlumb.connect({
-                            source : "block_2", 
-                            target : "block_1",
-                            overlays : overlays            
-                        });*/
-                        
-                        /*
-                        calEvent.title          = $("#name").val();
-                        calEvent.start          = calEvent.start;
-                        calEvent.end            = calEvent.end;
-                        calEvent.allDay         = calEvent.allDay;
-                        calEvent.description    = $("#content").val();                              
-                        calendar.fullCalendar('updateEvent', 
-                                calEvent,
-                                true // make the event "stick"
-                        );*/
-                        
+                    success:function(data) {    
                         $("#dialog-form").dialog("close");                                      
                     }                           
                 });
@@ -67,16 +49,11 @@ $(document).ready( function() {
         }
     });
 
-    $("#add_profile").click(function() { 
-        
+    $("#add_profile").click(function() {
         $("#name").attr('value', '');
-        $("#description").attr('value', '');
-            
+        $("#description").attr('value', '');            
         $("#dialog-form").dialog("open");
-                      
-    });  
-    
-    
+    });
 });
 
 function check_skills() {
@@ -147,7 +124,6 @@ function checkLength( o, n, min, max ) {
     </ul>    
 {/if}
 
-
 {if !empty($order_user_list) }
     {foreach $order_user_list as $count => $user_list}
         <h2> {"Matches"|get_lang} {$count}/{$total_search_skills} </h2>
@@ -159,16 +135,18 @@ function checkLength( o, n, min, max ) {
                     </h3>
                 </div>
                 <div class="ui-widget-content ">
-                    <h4>Skills {$user.total_found_skills} / {$total_search_skills}</h4>
-                    <ul>    
-                                        
+                    <h4>{"Skills"|get_lang} {$user.total_found_skills} / {$total_search_skills}</h4>
+                    <ul>                
                         {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} 
-                                
+                                {if !empty({$skill_list[$skill_data.skill_id].name})}
+                                    <span class="label_tag skill">{$skill_list[$skill_data.skill_id].name}</span>
+                                {else}
+                                    {"SkillNotFound"|get_lang}
+                                {/if}
+                                {if $skill_data.found}                                     
+                                     *{"IHaveThisSkill"|get_lang}*
+                                {/if}
                             </li>                    
                         {/foreach}
                     </ul>
@@ -177,15 +155,13 @@ function checkLength( o, n, min, max ) {
         {/foreach}
     {/foreach}        
 {else}
-    <div class="warning-message">{"No results"|get_lang}</div>
+    <div class="warning-message">{"NoResults"|get_lang}</div>
 {/if}
-
-
 <div id="dialog-form" style="display:none;">    
     <form id="save_profile_form" name="form">        
         <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" />             
@@ -193,7 +169,7 @@ function checkLength( o, n, min, max ) {
         </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>