public function get_id_view() { $dbc = $this->connection; $settings = $this->config->get('PLUGIN_SETTINGS'); $dbc->selectDB($settings['TimesheetDatabase']); $model = new TimesheetEmployeesModel($dbc); $model->timesheetEmployeeID($this->id); if (!$model->load()) { return '<div class="alert alert-danger">Employee does not exist</div>'; } $ret = '<h3>Employee #' . $this->id . '</h3> <form method="post"> <input type="hidden" name="id" value="' . $this->id . '" />'; $ret .= sprintf(' <div class="form-group"> <label>First Name</label> <input type="text" class="form-control" name="firstName" value="%s" /> </div>', $model->firstName()); $ret .= sprintf(' <div class="form-group"> <label>Last Name</label> <input type="text" class="form-control" name="lastName" value="%s" /> </div>', $model->lastName()); $ret .= '<div class="form-group"> <label>Active</label> <select name="active" class="form-control"> <option ' . ($model->active() ? 'selected' : '') . ' value="1">Yes</option> <option ' . (!$model->active() ? 'selected' : '') . ' value="0">No</option> </select> </div>'; $ret .= sprintf(' <div class="form-group"> <label>Hire Date</label> <input type="text" class="form-control date-field" name="hireDate" value="%s" /> </div>', $model->hireDate()); $ret .= '<div class="form-group"> <label>Timesheet Department</label> <select name="timesheetDepartmentID" class="form-control">'; $depts = new TimesheetDepartmentsModel($dbc); $ret .= $depts->toOptions($model->timesheetDepartmentID()); $ret .= '</select></div>'; $ret .= '<div class="form-group"> <label>Primary Job Position</label> <select name="primaryShiftID" class="form-control">'; $depts = new ShiftsModel($dbc); $ret .= $depts->toOptions($model->primaryShiftID()); $ret .= '</select></div>'; $ret .= sprintf(' <div class="form-group"> <label>Wage</label> <input type="text" class="form-control" name="wage" value="%.2f" /> </div>', $model->wage()); $ret .= sprintf(' <div class="form-group"> <label>Office Username</label> <input type="text" class="form-control" name="username" value="%s" /> </div>', $model->username()); $ret .= sprintf(' <div class="form-group"> <label>POS Member ID</label> <input type="text" class="form-control" name="posMemberID" value="%s" /> </div>', $model->posMemberID()); $ret .= sprintf(' <div class="form-group"> <label>Payroll Provider ID</label> <input type="text" class="form-control" name="payrollProviderID" value="%s" /> </div>', $model->payrollProviderID()); $ret .= sprintf(' <div class="form-group"> <label>Timeclock Token</label> <input type="text" class="form-control" name="timeclockToken" value="%s" /> </div>', $model->timeclockToken()); $ret .= '<p> <button type="submit" class="btn btn-default">Save Changes</button> <a href="' . $_SERVER['PHP_SELF'] . '" class="btn btn-default">All Employees</a> </p> </form>'; return $ret; }