Changeset 1269
- Timestamp:
- 08/04/09 14:42:23 (15 years ago)
- Location:
- trunk/workflow
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/inc/class.bo_userinterface.inc.php
r1266 r1269 1038 1038 return array( 'error' => 'Localidade não encontrada.' ); 1039 1039 1040 //usort( $employees['employees'], create_function( '$a,$b', 'return strcasecmp($a[\'cn\'],$b[\'cn\']);' ) ); 1040 return $employees; 1041 } 1042 1043 /** 1044 * Return the list of employees in alphabetical order 1045 * @access public 1046 * @return array array of employees 1047 */ 1048 function getAlphabeticalEmployees( ) 1049 { 1050 /* check for access */ 1051 if ( ( $checkWarnings = $this -> checkOrgchartAccess( ) ) !== true ) 1052 return $checkWarnings; 1053 1054 $employees = $this -> so -> getAlphabeticalEmployees( $this -> organizationInfo[ 'organizacao_id' ] ); 1055 1056 if ( $employees === false ) 1057 return array( 'error' => 'Localidade não encontrada.' ); 1041 1058 1042 1059 return $employees; -
trunk/workflow/inc/class.so_userinterface.inc.php
r1266 r1269 512 512 . " WHERE (f.area_id = a.area_id)" 513 513 . " AND (f.funcionario_status_id = s.funcionario_status_id)" 514 . " AND (f.organizacao_id = ?)" 514 515 . " AND (f.localidade_id = ?)" 515 516 . " AND (s.exibir = ?)"; 516 517 517 $result = $this -> db -> query( $query, array( $ locationID, 'S' ) );518 $result = $this -> db -> query( $query, array( $organizationID, $locationID, 'S' ) ); 518 519 519 520 $employees = $result -> GetArray( -1 ); … … 566 567 return $output; 567 568 } 569 570 /** 571 * Return the list of employees in alphabetical order 572 * @param int $organizationID The organization ID 573 * @return array The list o employees 574 * @access public 575 */ 576 function getAlphabeticalEmployees( $organizationID ) 577 { 578 $organizationID = ( int ) $organizationID; 579 580 // load the employees from the location 581 $query = "SELECT f.funcionario_id, f.organizacao_id, f.area_id, a.sigla AS area," 582 . " COALESCE(f.funcionario_categoria_id, 0) AS funcionario_categoria_id" 583 . " FROM funcionario f, funcionario_status s, area a" 584 . " WHERE (f.area_id = a.area_id)" 585 . " AND (f.funcionario_status_id = s.funcionario_status_id)" 586 . " AND (f.organizacao_id = ?)" 587 . " AND (s.exibir = ?)"; 588 589 $result = $this -> db -> query( $query, array( $organizationID, 'S' ) ); 590 591 $employees = $result -> GetArray( -1 ); 592 $cachedLDAP = $GLOBALS[ 'workflow' ][ 'factory' ] -> newInstance( 'CachedLDAP' ); 593 $cachedLDAP -> setOperationMode( $cachedLDAP -> OPERATION_MODE_LDAP_DATABASE ); 594 595 $categoriesCount = array( ); 596 for ( $i = 0; $i < count( $employees ); $i++ ) 597 { 598 // remove numeric fields 599 for ( $j = 0; $j < $result -> _numOfFields; $j++ ) 600 unset( $employees[ $i ][ $j ] ); 601 602 $employees[ $i ][ 'cn' ] = ''; 603 $employees[ $i ][ 'telephoneNumber' ] = ''; 604 605 // try to find the telephone number 606 $entry = $cachedLDAP -> getEntryByID( $employees[ $i ][ 'funcionario_id' ] ); 607 if ( $entry ) 608 { 609 $employees[ $i ][ 'telephoneNumber' ] = is_null( $entry[ 'telephonenumber' ] ) ? '' : $entry[ 'telephonenumber' ]; 610 $employees[ $i ][ 'cn' ] = is_null( $entry[ 'cn' ] ) ? '' : $entry[ 'cn' ]; 611 $employees[ $i ][ 'removed' ] = is_null( $entry[ 'last_update' ] ); 612 } 613 614 // count the number of employees in each category 615 $categoryID = $employees[ $i ][ 'funcionario_categoria_id' ]; 616 if ( isset( $categoriesCount[ $categoryID ] ) ) 617 $categoriesCount[ $categoryID ]++; 618 else 619 $categoriesCount[ $categoryID ] = 1; 620 } 621 622 $usedCategories = array_keys( $categoriesCount ); 623 $availableCategories = $this -> getCategoriesList( $organizationID ); 624 $output = array( ); 625 $output[ 'employees' ] = $employees; 626 $output[ 'categories' ] = array( ); 627 foreach ( $availableCategories as $category ) 628 { 629 if ( ! in_array( $category[ 'funcionario_categoria_id' ], $usedCategories ) ) 630 continue; 631 632 $category[ 'contagem' ] = $categoriesCount[ $category[ 'funcionario_categoria_id' ] ]; 633 $output[ 'categories' ][ ] = $category; 634 } 635 636 usort( $output[ 'employees' ], create_function( '$a,$b', 'return strcasecmp($a[\'cn\'],$b[\'cn\']);' ) ); 637 638 return $output; 639 } 568 640 } 569 641 ?> -
trunk/workflow/js/userinterface/orgchart.js
r1266 r1269 36 36 content += '<li style="margin: 5px 5px 0 5px">Visualizar : <select>' 37 37 content += '<option>-- Selecione uma opção de visualização --</option>' 38 content += '<option onclick=" ">Alfabética</option>'38 content += '<option onclick="getAlphabeticalEmployees( )">Alfabética</option>' 39 39 content += '<option onclick="getHierarchicalArea( );">Áreas</option>' 40 40 content += '<option onclick="getManning( )">Lotação</option>' … … 45 45 content += '</select></li>'; 46 46 content += '<li><a href="#" onclick="window.open(\'' + enderecoImagem + '\', \'extwindow\'); return false;"><img src="templateFile.php?file=images/Process.gif"> Gráfico</a></li>'; 47 //content += '<li><a href="#" onclick="getCostCenters(); return false;"><img src="templateFile.php?file=images/coins.png"> Centros de Custo</a></li>';48 //content += '<li><a href="#" onclick="getHierarchicalArea(); return false;"><img src="templateFile.php?file=images/orgchart_tree.png">Lista Hierárquica</a></li>';49 //content += '<li><a href="#" onclick="getAreaList(); return false;"><img src="templateFile.php?file=images/orgchart_list.png"> Lista Alfabética</a></li>';50 //content += '<li><a href="#" onclick="getCategoriesList(); return false;"><img src="templateFile.php?file=images/folder_green.png"> Listar Vínculos</a></li>';51 47 content += '<li><a href="#" onclick="printArea(); return false;"><img src="templateFile.php?file=images/imprimir.png" width="16"> Imprimir</a></li>'; 52 48 content += '<li><a><input type="text" name="search_term" id="search_term" onkeypress="if (((event.which) ? event.which : event.keyCode) == 13) $(\'search_span\').onclick(); return true;" /><span id="search_span" style="cursor: pointer;" onclick="tmp = $$(\'div#orgchartAreas a.destaque\'); if (tmp[0]) tmp[0].removeClassName(\'destaque\'); orgchartSearchEmployee($F(\'search_term\')); return false;"> busca</span></a></li>'; … … 374 370 } 375 371 372 function getAlphabeticalEmployees( ) 373 { 374 workflowUserInterfaceCurrentAreaID = 0; 375 cExecute('$this.bo_userinterface.getAlphabeticalEmployees', printEmployeesHandler); 376 } 377 376 378 function orgchartSearchEmployee(searchTerm) 377 379 {
Note: See TracChangeset
for help on using the changeset viewer.