public function __construct($personId) { $employees = new Rp_Db_View_Employees(); $companies = new Rp_Db_View_Companies(); $departments = new Rp_Db_View_Departments(); $employee = $employees->findByPersonId($personId)->current(); $person = $employee->getPerson(); // если ID компании и ID отдела совпадают, то в поле отдел пишем знак '-', так как люди привязаны к юр. лицу напрямую $dep_name = "-"; if ($employee->department_id != '-') { $dep_name = current($departments->fetchNames($employee->department_id)); } $redundant = ''; if ($employee->isRedundant()) { $redundant = '(уволен ' . date('d.m.Y', strtotime($employee->dismissal_date)) . ')'; } $this->_data['fullname'] = $person->fullname; $this->_data['date_birth'] = date('d.m.Y', strtotime($person->date_birth)); $this->_data['company'] = current($companies->fetchNames($employee->company_id)); $this->_data['department'] = $dep_name; $this->_data['redundant'] = $redundant; $attribs = $employee->getAttribs(); if (!empty($attribs)) { $this->_data += $attribs->toArray(); } }
public function achievsHeader(Rp_Db_View_Row_Employee $emp) { $persons = new Rp_Db_View_Persons(); $companies = new Rp_Db_View_Companies(); $departments = new Rp_Db_View_Departments(); $appointments = new Rp_Db_View_Appointments(); $category = $emp->isManager() ? 'Руководитель' : 'Сотрудник'; $managersIds = $emp->getManagers()->getCol('person_id'); $managers = implode('<br />', $persons->fetchFullnames($managersIds)); $is_integrate = ""; // if ($emp->person_id >= 90000000) switch ($emp->persg) { case 2: case 3: case 7: case 8: case 'S': $is_integrate = "<span style='color: blue; font-size: 12px;'>(совместитель)</span>"; break; } $is_testperiod = ''; if ($emp->endtest_date >= date('Y-m-d')) { $is_testperiod = '<span style="color: green; font-size: 12px;"> (испытательный срок)</span>'; } // если ID компании и ID отдела совпадают, то в поле отдел пишем знак '-', так как люди привязаны к юр. лицу напрямую $dep_name = "-"; if ($emp->department_id != '-') { $dep_name = current($departments->fetchNames($emp->department_id)); } return ' <table class="header" cellspacing="5"> <tbody> <tr> <td class="header-field-name">Сотрудник<div>Employee</div></td> <td class="header-field-value"> <div>' . $emp->getPerson()->fullname . '</div> <input type="hidden" id="employee_fio" value="' . $emp->getPerson()->fullname . '" /> </td> <td class="header-field-name">Категория<div>Category</div></td> <td class="header-field-value"><div>' . $category . '</div></td> <td class="header-field-name">Руководитель<div>Manager</div></td> <td class="header-field-value"><div>' . $managers . '</div></td> <td class="header-field-empty"></td> </tr> <tr> <td class="header-field-name">Компания<div>Company</div></td> <td class="header-field-value"> <div>' . current($companies->fetchNames($emp->company_id)) . '</div></td> <td class="header-field-name">Отдел<div>Department</div></td> <td class="header-field-value"> <div>' . $dep_name . '</div></td> <td class="header-field-name">Должность<div>Position</div></td> <td class="header-field-value"> <div>' . current($appointments->fetchNames($emp->appointment_id)) . $is_integrate . $is_testperiod . '</div></td> </tr> </tbody> </table> '; }
public function integratedBlock() { $xhtml = array(); $user = Rp_User::getInstance(); $user_id = $user->getPersonId(); $companies = new Rp_Db_View_Companies(); $departments = new Rp_Db_View_Departments(); $employees = new Rp_Db_View_Employees(); $appointments = new Rp_Db_View_Appointments(); $integrated = new Rp_Db_View_IntegratedPersons(); $integrate_note = ""; $kol = 0; $xhtml[] = "<div class='caption_int'>Совмещенные должности</div>\r\n\r\n\t\t\t\t\t\t\t<table class='integrate_table'>\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t<td width='30px' align='center'><b>№</b></td>\r\n\t\t\t\t\t\t\t\t\t<td align='center'><b>Компания</b></td>\r\n\t\t\t\t\t\t\t\t\t<td align='center'><b>Полный путь</b></td>\r\n\t\t\t\t\t\t\t\t\t<td align='center'><b>Должность</b></td>\r\n\t\t\t\t\t\t\t\t</tr>"; // if ($user_id < 90000000) switch ($user->persg) { case 2: case 3: case 7: case 8: case 'S': $person_id = $integrated->fetchPersonID($user_id); $refer_id = $integrated->fetchRefID($person_id[0]); $employee = $employees->findByPersonId($person_id[0])->current(); $company = current($companies->fetchNames($employee->company_id)); $department = current($departments->fetchNames($employee->department_id)); $appointment = current($appointments->fetchNames($employee->appointment_id)); $full_path = $employee->getPerson()->FullPath; $integrate_note = "<div class='integrate_note'>* основное место работы</div>"; $xhtml[] = "<tr style='color: blue;'>\r\n\t\t\t\t\t\t\t\t\t<td align='center'>" . ++$kol . "*</td>\r\n\t\t\t\t\t\t\t\t\t<td><a href='#' style='color: blue;' onclick='forwardIntegratePerson(" . $person_id[0] . ")'>" . $company . "</a></td>\r\n\t\t\t\t\t\t\t\t\t<td><a href='#' style='color: blue;' onclick='forwardIntegratePerson(" . $person_id[0] . ")'>" . $full_path . "</a></td>\r\n\t\t\t\t\t\t\t\t\t<td><a href='#' style='color: blue;' onclick='forwardIntegratePerson(" . $person_id[0] . ")'>" . $appointment . "</a></td>\r\n\t\t\t\t\t\t\t</tr>"; break; default: $refer_id = $integrated->fetchRefID($user_id); break; } foreach ($refer_id as $item) { if ($user_id == $item) { continue; } else { $employee = $employees->findByPersonId($item)->current(); $company = current($companies->fetchNames($employee->company_id)); $department = current($departments->fetchNames($employee->department_id)); $appointment = current($appointments->fetchNames($employee->appointment_id)); $full_path = $employee->getPerson()->FullPath; $xhtml[] = "<tr>\r\n\t\t\t\t\t\t\t\t<td align='center'>" . ++$kol . "</td>\r\n\t\t\t\t\t\t\t\t<td><a style='color: black;' href='#' onclick='forwardIntegratePerson(" . $item . ")'>" . $company . "</a></td>\r\n\t\t\t\t\t\t\t\t<td><a style='color: black;' href='#' onclick='forwardIntegratePerson(" . $item . ")'>" . $full_path . "</a></td>\r\n\t\t\t\t\t\t\t\t<td><a style='color: black;' href='#' onclick='forwardIntegratePerson(" . $item . ")'>" . $appointment . "</a></td>\r\n\t\t\t\t\t\t\t</tr>"; } } $xhtml[] = "</table>" . $integrate_note . "<br><br>"; return implode($xhtml); }