/** * @access protected * @global array $registry * @return render Add Employee Template & Add Employee */ protected function add() { global $registry; if (isset($_GET['name']) && isset($_GET['email'])) { $employee = array('name' => $_GET['name'], 'email' => $_GET['email']); $this->registry['template']->data('employee', $employee); $validate = new Form(); $set_name = $validate->validateText($employee['name']); $set_email = $validate->validateEmail($employee['email']); if (!$set_name) { $this->registry['template']->data('set_name', $set_name); } if (!$set_email) { $this->registry['template']->data('set_email', $set_email); } if ($set_name && $set_email) { $employee_object = new Employees(); if ($employee_object->insertEmployee($_GET['name'], $_GET['email'])) { return $this->added($_GET['name']); } else { return $this->failed(); } } } $this->registry['template']->data('title', 'Add Employee'); $this->registry['template']->render('header'); $this->registry['template']->data('action', 'Add'); $this->registry['template']->render('employee/edit'); $this->registry['template']->render('footer'); }
/** * @access public * @return type */ public function edit() { die('edit'); $employee_object = new Employees(); $employee = $employee_object->getEmployee($_GET['employee_id']); if (!$employee) { return $this->failed(); } if (isset($_GET['name']) && $_GET['email']) { $employee = array('name' => $_GET['name'], 'email' => $_GET['email']); $validate = new Form(); $set_name = $validate->validateText($employee['name']); $set_email = $validate->validateEmail($employee['email']); if (!$set_name) { $this->registry['template']->data('set_name', $set_name); } if (!$set_email) { $this->registry['template']->data('set_email', $set_email); } if ($set_name && $set_email) { if ($employee_object->updateEmployee($_GET['employee_id'], $_GET['name'], $_GET['email'])) { return $this->changed($_GET['name']); } else { return $this->failed(); } } } $this->registry['template']->data('title', 'Employee ' . $employee['name']); $this->registry['template']->render('header'); $this->registry['template']->render('header'); $this->registry['template']->data('employee', $employee); $this->registry['template']->data('action', 'Edit'); $this->registry['template']->render('schedule/edit'); }
public function addMember() { $json = array(); $json['name'] = Form::validateText($_POST['uname']); $json['email'] = Form::validateEmail($_POST['email']); $json['exists_email'] = $this->isEmailExistsInMembersAtCurrentCalendar($_POST['email'], $_POST['calendarname']); $json['phone'] = Form::validateText($_POST['phone'], 10, 30); if (in_array(FALSE, $json)) { echo json_encode($json); die; } if (isset($_POST['scheduleid'])) { $datetime = $this->getAppointmentDateTimeByID($_POST['scheduleid']); $json['date'] = $datetime[0]['date']; $json['time'] = $datetime[0]['time']; $_POST['dateformat'] = $datetime[0]['date']; $_POST['timeformat'] = $datetime[0]['time']; } $this->addRegisterInDB($_POST); $this->emailCustomerHtml($_POST); $this->emailAdminHtml($_POST); $json['calendarname'] = $_POST['calendarname']; $json['success'] = TRUE; echo json_encode($json); die; }