Changeset 1276


Ignore:
Timestamp:
08/05/09 16:53:15 (15 years ago)
Author:
rodsouza
Message:

Ticket #589 - Adicionando paginacao para a listagem alfabetica

Location:
trunk/workflow
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/class.so_userinterface.inc.php

    r1269 r1276  
    590590 
    591591                $employees = $result -> GetArray( -1 ); 
     592 
    592593                $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 
    593594                $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_LDAP_DATABASE ); 
     
    612613                        } 
    613614 
    614                         // count the number of employees in each category 
     615                } 
     616 
     617                usort( $employees, create_function( '$a,$b', 'return strcasecmp($a[\'cn\'],$b[\'cn\']);' ) ); 
     618 
     619                $paging = $GLOBALS['workflow']['factory']->newInstance('Paging', 100, $_POST); 
     620                $employees = $paging->restrictItems( $employees ); 
     621 
     622                // count the number of employees in each category 
     623                for ( $i = 0; $i < count( $employees ); $i++ ) 
     624                { 
    615625                        $categoryID = $employees[ $i ][ 'funcionario_categoria_id' ]; 
    616626                        if ( isset( $categoriesCount[ $categoryID ] ) ) 
     
    623633                $availableCategories = $this -> getCategoriesList( $organizationID ); 
    624634                $output = array( ); 
    625                 $output[ 'employees' ] = $employees; 
    626                 $output[ 'categories' ] = array( ); 
     635 
     636                $output['employees'] = $employees; 
     637                $output['categories'] = array( ); 
     638                $output['paging_links'] = $paging -> commonLinks(); 
     639 
    627640                foreach ( $availableCategories as $category ) 
    628641                { 
     
    634647                } 
    635648 
    636                 usort( $output[ 'employees' ], create_function( '$a,$b', 'return strcasecmp($a[\'cn\'],$b[\'cn\']);' ) ); 
    637  
    638649                return $output; 
    639650        } 
  • trunk/workflow/js/userinterface/orgchart.js

    r1269 r1276  
    3535        var content = '<ul class="horizontalMenu">'; 
    3636        content += '<li style="margin: 5px 5px 0 5px">Visualizar : <select>' 
    37         content += '<option>-- Selecione uma opção de visualização --</option>' 
    3837        content += '<option onclick="getAlphabeticalEmployees( )">Alfabética</option>' 
    39         content += '<option onclick="getHierarchicalArea( );">Áreas</option>' 
     38        content += '<option onclick="getHierarchicalArea( );" selected="true">Áreas</option>' 
     39        content += '<option onclick="getCostCenters( );">Centros de Custo</option>' 
    4040        content += '<option onclick="getManning( )">Lotação</option>' 
     41        content += '<option onclick="getAreaWithSubtituteBoss( )">Substituição de Chefia</option>' 
    4142        content += '<option onclick="getUsefulPhones( );">Telefones Úteis</option>' 
    42         content += '<option onclick="getAreaWithSubtituteBoss( )">Substituição de Chefia</option>' 
    43         content += '<option onclick="getCostCenters( );">Centros de Custo</option>' 
    4443        content += '<option onclick="getCategoriesList( )">Vínculos</option>' 
    4544        content += '</select></li>'; 
     
    133132        } 
    134133 
    135         var content = '<center><h3>TELEFONES ÚTEIS</strong></h3>'; 
     134        var content = ''; 
    136135        content += '<table class="employeeList">'; 
    137136        content += '<tr><th>Localidade</th><th>Número</th></tr>'; 
     
    162161        } 
    163162 
    164         var content = '<center><h3>Áreas com Substituição de Chefia</strong></h3>'; 
     163        var content = ''; 
    165164        content += '<table class="employeeList">'; 
    166165        content += '<tr><th>Área</th><th>Titular</th><th>Substituto</th></tr>'; 
     
    251250                var content = '<center><strong>Lotalidades</strong></center>'; 
    252251                for ( var i = 0; i < data.length; i++ ) 
    253                         content += '<br/>' + '&nbsp; &nbsp; &nbsp; &nbsp;<a href="javascript:void(0)" id="localidade_' + data[i]['localidade_id'] + '" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); this.addClassName(\'destaque\');loadManningEmployees(' + data[i]['localidade_id'] + ')">' + data[i]['descricao'] + '</a>'; 
     252                        content += '<br/>' + '&nbsp;<a href="javascript:void(0)" id="localidade_' + data[i]['localidade_id'] + '" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); this.addClassName(\'destaque\');loadManningEmployees(' + data[i]['localidade_id'] + ')">' + data[i]['descricao'] + '</a>'; 
    254253 
    255254                content += '<br/><br/>'; 
     
    373372{ 
    374373        workflowUserInterfaceCurrentAreaID = 0; 
    375         cExecute('$this.bo_userinterface.getAlphabeticalEmployees', printEmployeesHandler); 
     374 
     375        var div = $('orgchartEmployees'); 
     376        div.innerHTML = ''; 
     377 
     378        var p_page = 0; 
     379        if ( arguments.length ) 
     380        { 
     381                p_page = parseInt(arguments[ 0 ]); 
     382                if ( isNaN( p_page ) ) 
     383                        p_page = 0; 
     384        } 
     385        cExecute('$this.bo_userinterface.getAlphabeticalEmployees', function( data ) 
     386        { 
     387                var pagingData = data['paging_links']; 
     388                var output = ''; 
     389                if (pagingData) 
     390                { 
     391                        var pagingSize = pagingData.length; 
     392                        for (var i = 0; i < pagingSize; i++) 
     393                        { 
     394                                if (pagingData[i].do_link == true) 
     395                                        output += '<a style="font-size: medium" href="#" onclick="getAlphabeticalEmployees(' + pagingData[i].p_page + ');">' + pagingData[i].name + '</a>&nbsp;'; 
     396                                else 
     397                                        output += '<strong style="font-size: large">' + pagingData[i].name + '</strong>&nbsp;'; 
     398                        } 
     399                } 
     400 
     401                printEmployeesHandler( data ); 
     402 
     403                div.innerHTML += '<br /><center>' + output + '</center>'; 
     404        }, 'p_page='+p_page); 
    376405} 
    377406 
Note: See TracChangeset for help on using the changeset viewer.