Changeset 6477
- Timestamp:
- 06/13/12 14:12:51 (12 years ago)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/workflow/js/userinterface/orgchartPrint.js
r3167 r6477 9 9 $('tr.employees').hide(); 10 10 } 11 11 12 12 13 /** … … 55 56 } 56 57 58 59 /** 60 * Show / Hide all photo employees 61 */ 62 function togglePhotoVisibility() 63 { 64 $('#employee_table').remove(); 65 66 if ($('#groupByArea').attr('checked')) 67 showGroupedByArea(); 68 else 69 showUngrouped(); 70 } 71 57 72 /** 58 73 * Centralize the creation of table rows for employees. 59 74 * 'showAreaColumn' specifies whether the second column will be shown 60 75 */ 61 function createEmployeeRow(area_id, user_id, showAreaColumn )76 function createEmployeeRow(area_id, user_id, showAreaColumn, showUserPhoto) 62 77 { 63 78 /* set a special 'class' if the employee is a supervisor one */ … … 67 82 68 83 /* 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 ); 80 103 81 104 /* area: second (optional) column */ … … 83 106 element.append( 84 107 $('<td>' + areas[area_id].sigla + '</td>') 85 .css('width', '1 5%')108 .css('width', '10%') 86 109 ); 87 110 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 88 118 /* telephone: last column */ 89 119 element.append( 90 120 $('<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 93 136 .addClass('employees'); 94 137 … … 102 145 { 103 146 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; 105 153 106 154 /* iterating over areas */ … … 111 159 $('<tr></tr>') 112 160 .append( 113 $('<th></th>') 161 $('<td colspan="2"></td>') 162 .css('font-weight', 'bold') 114 163 .css('text-align', 'left') 115 164 .css('height', '30') … … 125 174 /* creating employee rows */ 126 175 for (j=0; j < areas[i].employees.length; j++) 127 table.append(createEmployeeRow(i, j ));176 table.append(createEmployeeRow(i, j, false, photo)); 128 177 } 129 178 $('#areas_content').append(table); … … 139 188 { 140 189 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; 142 196 143 197 /* creating and reseting indexes */ … … 172 226 173 227 /* inserting the row */ 174 table.append(createEmployeeRow(less, areas[less].index, true ));228 table.append(createEmployeeRow(less, areas[less].index, true, photo)); 175 229 areas[less].index++; 176 230 } … … 192 246 { 193 247 $('#employeesVisibility').click(toggleEmployeesVisibility); 248 $('#photoVisibility').click(togglePhotoVisibility); 194 249 $('#groupByArea').click(toggleGroupByArea); 195 250 $('#highlightSupervisor').click(toggleHighlightSupervisor); … … 201 256 { 202 257 toggleGroupByArea(); 258 togglePhotoVisibility(); 203 259 toggleEmployeesVisibility(); 204 260 toggleHighlightSupervisor(); -
trunk/workflow/inc/class.so_userinterface.inc.php
r5242 r6477 13 13 */ 14 14 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 16 39 /** 17 40 * Constructor … … 21 44 function so_userinterface() 22 45 { 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'); 23 50 $this->db =& Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 24 51 $this->db->SetFetchMode(ADODB_FETCH_ASSOC); … … 218 245 219 246 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 220 266 } 221 267 … … 232 278 $areaID = (int) $areaID; 233 279 280 require_once dirname(__FILE__) . '/local/classes/class.wf_orgchart.php'; 281 $orgchart = new wf_orgchart(); 282 234 283 /* gather some info from the area */ 235 284 $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); … … 252 301 for ($j = 0; $j < $result->_numOfFields; $j++) 253 302 unset($employees[$i][$j]); 254 303 255 304 $employees[$i]['cn'] = ''; 256 305 $employees[$i]['telephoneNumber'] = ''; … … 268 317 $employees[$i]['removed'] = is_null($entry['last_update']); 269 318 } 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); 270 340 271 341 /* count the number of employees in each category */ … … 274 344 $categoriesCount[$categoryID]++; 275 345 else 276 $categoriesCount[$categoryID] = 1; 346 $categoriesCount[$categoryID] = 1; 277 347 } 278 348 $usedCategories = array_keys($categoriesCount); -
trunk/workflow/inc/class.ui_userinterface.inc.php
r3167 r6477 170 170 } 171 171 172 //Verifica a permissão do usuário 173 $so->_checkAccess($organizationID); 174 172 175 /* make the array flat (for a simpler handling) */ 173 176 $flatAreas = array(); … … 184 187 } 185 188 unset($currentArea['children']); 186 189 187 190 $employees = $so->getAreaEmployees($currentArea['area_id'], $organizationID); 188 191 if (is_array($employees)) -
trunk/workflow/js/adminaccess/main.js
r3255 r6477 34 34 permissionListORG[0]['name'] = "Administrar Organograma"; 35 35 permissionListORG[0]['value'] = 0; 36 permissionListORG[1]['name'] = "Visualizar Telefones Pessoais";36 permissionListORG[1]['name'] = "Visualizar Informações Restritas"; 37 37 permissionListORG[1]['value'] = 1; 38 38
Note: See TracChangeset
for help on using the changeset viewer.