Changeset 6477


Ignore:
Timestamp:
06/13/12 14:12:51 (12 years ago)
Author:
leticiabohnert
Message:

Ticket #2851 - Alterado para aparecer cargo e vinculo no org. quando usuário possui permissão.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/workflow/js/userinterface/orgchartPrint.js

    r3167 r6477  
    99                $('tr.employees').hide(); 
    1010} 
     11 
    1112 
    1213/** 
     
    5556} 
    5657 
     58 
     59/** 
     60* Show / Hide all photo employees 
     61*/ 
     62function togglePhotoVisibility() 
     63{ 
     64        $('#employee_table').remove(); 
     65 
     66        if ($('#groupByArea').attr('checked')) 
     67                showGroupedByArea(); 
     68        else 
     69                showUngrouped(); 
     70} 
     71 
    5772/** 
    5873* Centralize the creation of table rows for employees. 
    5974* 'showAreaColumn' specifies whether the second column will be shown 
    6075*/ 
    61 function createEmployeeRow(area_id, user_id, showAreaColumn) 
     76function createEmployeeRow(area_id, user_id, showAreaColumn, showUserPhoto) 
    6277{ 
    6378        /* set a special 'class' if the employee is a supervisor one */ 
     
    6782 
    6883        /* creating the row. */ 
    69         element = $('<tr></tr>') 
    70                                 /* name: first column */ 
    71                                 .append( 
    72                                                 $('<td></td>') 
    73                                                         .append( 
    74                                                                 $('<span></span>') 
    75                                                                         .addClass(class_name) 
    76                                                                         .append(areas[area_id].employees[user_id].cn) 
    77                                                         ) 
    78                                                         .css('width', '70%') 
    79                                                 ); 
     84        element = $('<tr></tr>'); 
     85 
     86 
     87        /* photo: zero (optional) column */ 
     88        if (showUserPhoto){ 
     89                var content = '<img src="workflow/showUserPicture.php?userID=' + areas[area_id].employees[user_id].funcionario_id + '"/>'; 
     90                element.append($('<td>' + content + '</td>').css('width', '8%')); 
     91        } 
     92 
     93        /* name: first column */ 
     94        element.append( 
     95                                $('<td></td>') 
     96                                        .append( 
     97                                                $('<span></span>') 
     98                                                        .addClass(class_name) 
     99                                                        .append(areas[area_id].employees[user_id].cn) 
     100                                                ) 
     101                                                        .css('width', '30%') 
     102                        ); 
    80103 
    81104        /* area: second (optional) column */ 
     
    83106                element.append( 
    84107                                                $('<td>' + areas[area_id].sigla + '</td>') 
    85                                                         .css('width', '15%') 
     108                                                        .css('width', '10%') 
    86109                                        ); 
    87110 
     111        /* login: show uid attribute */ 
     112        element.append( 
     113                                        $('<td>' + areas[area_id].employees[user_id].uid + '</td>') 
     114                                                .css('width', '15%') 
     115                                        ) 
     116                                         
     117         
    88118        /* telephone: last column */ 
    89119        element.append( 
    90120                                        $('<td>' + areas[area_id].employees[user_id].telephoneNumber + '</td>') 
    91                                                 .css('width', '20%') 
    92                                         ) 
     121                                                .css('width', '15%') 
     122                                        ) 
     123                                         
     124        /* Vínculo: show cargo vínculo */ 
     125        element.append( 
     126                                        $('<td>' + areas[area_id].employees[user_id].vinculo + '</td>') 
     127                                                .css('width', '15%') 
     128                                        ) 
     129 
     130        /* Cargo: show cargo attribute */ 
     131        element.append( 
     132                                        $('<td>' + areas[area_id].employees[user_id].cargo + '</td>') 
     133                                                .css('width', '15%') 
     134                                        ) 
     135 
    93136                                .addClass('employees'); 
    94137 
     
    102145{ 
    103146        var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 
    104         var i, j; 
     147        var i, j, photo; 
     148 
     149        if ($('#photoVisibility').attr('checked')) 
     150           photo = true; 
     151        else 
     152           photo = false; 
    105153 
    106154        /* iterating over areas */ 
     
    111159                                $('<tr></tr>') 
    112160                                .append( 
    113                                         $('<th></th>') 
     161                                        $('<td colspan="2"></td>') 
     162                                                .css('font-weight', 'bold') 
    114163                                                .css('text-align', 'left') 
    115164                                                .css('height', '30') 
     
    125174                /* creating employee rows */ 
    126175                for (j=0; j < areas[i].employees.length; j++) 
    127                         table.append(createEmployeeRow(i, j)); 
     176                        table.append(createEmployeeRow(i, j, false, photo)); 
    128177        } 
    129178        $('#areas_content').append(table); 
     
    139188{ 
    140189        var table = $('<table></table>').css('width', '90%').attr('id', 'employee_table'); 
    141         var i, less, end; 
     190        var i, less, end, photo; 
     191 
     192        if ($('#photoVisibility').attr('checked')) 
     193           photo = true; 
     194        else 
     195           photo = false; 
    142196 
    143197        /* creating and reseting indexes */ 
     
    172226 
    173227                /* inserting the row */ 
    174                 table.append(createEmployeeRow(less, areas[less].index, true)); 
     228                table.append(createEmployeeRow(less, areas[less].index, true, photo)); 
    175229                areas[less].index++; 
    176230        } 
     
    192246{ 
    193247        $('#employeesVisibility').click(toggleEmployeesVisibility); 
     248        $('#photoVisibility').click(togglePhotoVisibility); 
    194249        $('#groupByArea').click(toggleGroupByArea); 
    195250        $('#highlightSupervisor').click(toggleHighlightSupervisor); 
     
    201256{ 
    202257        toggleGroupByArea(); 
     258        togglePhotoVisibility(); 
    203259        toggleEmployeesVisibility(); 
    204260        toggleHighlightSupervisor(); 
  • trunk/workflow/inc/class.so_userinterface.inc.php

    r5242 r6477  
    1313         */ 
    1414        var $db; 
    15  
     15        /** 
     16         * @var bool True se o usuário for administrador do expresso. 
     17         * @access private 
     18         */ 
     19        private $isAdmin; 
     20 
     21        /** 
     22         * @var int ID do usuário logado no Expresso 
     23         * @access private 
     24         */ 
     25        private $userID; 
     26 
     27        /** 
     28         * @var object Link para a ACL do Workflow. 
     29         * @access private 
     30         */ 
     31        private $acl; 
     32         
     33        /** 
     34         * @var bool indicando se o usuário possui ou não acesso aos dados restritos. 
     35         * @access private 
     36         */ 
     37        private $authorized; 
     38         
    1639        /** 
    1740         * Constructor 
     
    2144        function so_userinterface() 
    2245        { 
     46                $this->authorized= false; 
     47                $this->userID = $_SESSION['phpgw_info']['workflow']['account_id']; 
     48                $this->isAdmin = $_SESSION['phpgw_info']['workflow']['user_is_admin']; 
     49                $this->acl = Factory::getInstance('workflow_acl'); 
    2350                $this->db =& Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 
    2451                $this->db->SetFetchMode(ADODB_FETCH_ASSOC); 
     
    218245 
    219246                return $output; 
     247        }        
     248 
     249        /** 
     250         * Checa se o usuário possui permissão para visualizar informações restritas. 
     251         * @param int $organizationID O ID da organização do Orgranograma. 
     252         * @return void 
     253         * @access public 
     254         */ 
     255        public function _checkAccess($organizationID = null) 
     256        { 
     257                /* the user is an administrator */ 
     258                if ($this->isAdmin) 
     259                        $this->$authorized=true; 
     260 
     261                if (!is_numeric($organizationID)) 
     262                        $this->authorized = false; 
     263                else 
     264                        $this->authorized = $this->acl->checkUserAccessToResource('ORG', $this->userID, (int) $organizationID, 1); 
     265                 
    220266        } 
    221267 
     
    232278                $areaID = (int) $areaID; 
    233279 
     280                require_once dirname(__FILE__) . '/local/classes/class.wf_orgchart.php'; 
     281                $orgchart = new wf_orgchart(); 
     282                 
    234283                /* gather some info from the area */ 
    235284                $areaInfo = $this->db->query('SELECT COALESCE(a.titular_funcionario_id, -1) AS titular_funcionario_id, COALESCE(s.funcionario_id, -1) AS substituto_funcionario_id FROM area a LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) WHERE (a.organizacao_id = ?) AND (a.area_id = ?)', array($organizationID, $areaID))->GetArray(-1); 
     
    252301                        for ($j = 0; $j < $result->_numOfFields; $j++) 
    253302                                unset($employees[$i][$j]); 
    254  
     303                         
    255304                        $employees[$i]['cn'] = ''; 
    256305                        $employees[$i]['telephoneNumber'] = ''; 
     
    268317                                $employees[$i]['removed'] = is_null($entry['last_update']); 
    269318                        } 
     319                         
     320                        /*busca o cargo do funcionario*/ 
     321                        $employeeInfo = $orgchart->getEmployee($employees[$i]['funcionario_id']); 
     322 
     323                        $cargo = ''; 
     324 
     325                        if ($this->authorized && !empty($employeeInfo['cargo_id'])) 
     326                        { 
     327                                $jobTitleInfo = $orgchart->getJobTitle($employeeInfo['cargo_id']); 
     328                                $cargo = $jobTitleInfo['descricao']; 
     329                        } 
     330                        $employees[$i]['cargo'] = utf8_encode($cargo);   
     331                         
     332                        /*busca o vínculo do funcionario*/ 
     333                        $vinculo = ''; 
     334                        if ($this->authorized && !empty($employeeInfo['funcionario_categoria_id'])) 
     335                        { 
     336                                $categoryInfo = $orgchart->getEmployeeCategory($employeeInfo['funcionario_categoria_id']); 
     337                                $vinculo=$categoryInfo['descricao']; 
     338                        }                        
     339                        $employees[$i]['vinculo'] = utf8_encode($vinculo); 
    270340 
    271341                        /* count the number of employees in each category */ 
     
    274344                                $categoriesCount[$categoryID]++; 
    275345                        else 
    276                                 $categoriesCount[$categoryID] = 1; 
     346                                $categoriesCount[$categoryID] = 1;                                       
    277347                } 
    278348                $usedCategories = array_keys($categoriesCount); 
  • trunk/workflow/inc/class.ui_userinterface.inc.php

    r3167 r6477  
    170170                } 
    171171 
     172                //Verifica a permissão do usuário 
     173                $so->_checkAccess($organizationID); 
     174 
    172175                /* make the array flat (for a simpler handling) */ 
    173176                $flatAreas = array(); 
     
    184187                        } 
    185188                        unset($currentArea['children']); 
    186  
     189                         
    187190                        $employees = $so->getAreaEmployees($currentArea['area_id'], $organizationID); 
    188191                        if (is_array($employees)) 
  • trunk/workflow/js/adminaccess/main.js

    r3255 r6477  
    3434permissionListORG[0]['name'] = "Administrar Organograma"; 
    3535permissionListORG[0]['value'] = 0; 
    36 permissionListORG[1]['name'] = "Visualizar Telefones Pessoais"; 
     36permissionListORG[1]['name'] = "Visualizar Informações Restritas"; 
    3737permissionListORG[1]['value'] = 1; 
    3838 
Note: See TracChangeset for help on using the changeset viewer.