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(); } }
/** * Возвращает объект строки сотрудника. * * @return Rp_Db_View_Row_Employee */ public function getEmployee() { if (empty($this->_employee)) { $employees = new Rp_Db_View_Employees(); $this->_employee = $employees->findByPersonId($this->person_id)->current(); } return $this->_employee; }
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); }
public function indexAction() { $request = $this->getRequest(); $id = $request->getParam('id', null); Rp_User::setInstance($id); $user = Rp_User::getInstance(); $employees = new Rp_Db_View_Employees(); $employee_first = $employees->findByPersonId($_SESSION['user_id'])->current(); $person_first = $employee_first->getPerson(); $employee = $employees->findByPersonId($id)->current(); $person = $employee->getPerson(); if ($person_first->fullname != $person->fullname) { $this->_forward('error', 'error'); return; } $this->_forward('index', 'index'); return; }
/** * Возвращает объект сотрудника. * * @return Rp_Db_View_Row_Employee * @throws Exception */ public function getEmployee() { if (empty(self::$_employee)) { $employees = new Rp_Db_View_Employees(); $employee = $employees->findByPersonId($this->_personId)->current(); if (empty($employee)) { throw new Exception('Объект сотрудника не установлен.'); } self::$_employee = $employee; } return self::$_employee; }