$action = $req[1]; $id = $req[2]; $review = $req[3]; $user_id = $session->get_user_id(); switch ($action) { case "change_password": include_once "change_pass_page.php"; break; case "delete_account": include_once "delete_account.php"; break; case "update_email": include_once "update_email_page.php"; break; default: $user = Employee::find_by_id($user_id); $id = $user->id; $email = $user->email_address; $username = $user->username; $_SESSION['account']['title'] = $title = $user->title; $fname = $user->fname; $sname = $user->sname; $address = $user->address; $address2 = $user->address2; $_SESSION['loc']['citycode'] = $city = $user->city; $_SESSION['loc']['countycode'] = $county = $user->county; $_SESSION['loc']['stateprovince'] = $state_province = $user->state_province; $_SESSION['loc']['country'] = $country = $user->country; $post_code = $user->post_code; $phone_number = $user->phone_number; $fk_career_degree_id = $user->fk_career_degree_id;
<div class="row"> <div class="large-12 columns"> <div class="large-4 columns"><h5>Contact Person</h5></div> <div class="large-8 columns"><p> <?php echo $this->myworksheet->contact_person; ?> </p></div> </div> </div> <div class="row"> <div class="large-12 columns"> <div class="large-4 columns"><h5>Customer Support Engineer</h5></div> <div class="large-8 columns"><p> <?php $emp = Employee::find_by_id($this->myworksheet->cse_emp_id); $empname = $emp->emp_lname . " " . $emp->emp_fname; ?> </p></div> </div> </div> <div class="row"> <div class="large-12 columns"> <div class="large-4 columns"><h5>Problem (Terminal Status)</h5></div> <div class="large-8 columns"><p> <?php echo $this->myworksheet->problem;
public function createSchedule() { if (!empty($_POST['taskdate']) && !empty($_POST['cid']) && !empty($_POST['empid'])) { $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['cid'])); $thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['empid'])); $thisSchedule = new Schedule(); $thisSchedule->emp_id = $_POST['empid']; $thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname; $thisSchedule->client_id = " "; $thisSchedule->prod_id = $_POST['cid']; $thisSchedule->prod_name = $thisclientproduct->prod_name; $thisSchedule->s_date = $_POST['taskdate']; //$thisSchedule->s_time_in ; //$thisSchedule->s_time_out; $thisSchedule->issue = $_POST["tissue"]; $thisSchedule->datecreated = date("Y-m-d H:i:s"); $thisSchedule->maint_type = $_POST['mtype']; $msg = "Maintenance task alert for {$thisclientproduct->prod_name} at"; $msg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch; $msg .= "\r\n issue:" . $_POST["tissue"]; if ($thisSchedule->create()) { sendSms($thisemployee->emp_phone, $msg); return true; } else { return false; } } }
/** * this section is required * to update employee role */ public function UpdateEmpRole() { $rEmployee = Employee::find_by_id($_POST['empid']); $rEmployee->emp_post = $_POST['emppost']; $rEmployee->emp_dept = $_POST['empdept']; if ($rEmployee->update()) { return true; } else { return false; } }
/** * method to close a ticket * */ public function closeTicket() { if (isset($_POST['id']) && !empty($_POST["id"])) { $partTicket = Ticket::find_by_id($_POST["id"]); $partTicket->status = "Closed"; $theUser = Employee::find_by_id($_SESSION['emp_ident']); $cemail = !empty($_POST['cemail']) ? explode(",", $_POST['cemail']) : ""; // print_r($partTicket); array_push($cemail, $partTicket->contact_email, $theUser->emp_email); $client = Client::find_by_id($partTicket->client_id); array_push($cemail, $client->email); $partTicket->datemodified = date("Y-m-d H:i:s"); $msg = "Your Complaint ticket status has been closed<br />"; $subject = "Robert Johnson Holdings(Technical Support) Ticket #'" . $partTicket->id . "' Close"; //print_r($cemail); //mail("*****@*****.**","Robert Johnson Holdings, Technical Support" , "all good"); if ($partTicket->update()) { // $this->sendMail("Customer",$subject ,$msg,$cemail); return true; } else { return false; } } }
$employee->username = $username[0]; $employee->email_address = $email; $employee->passwd = $pass; $employee->confirm_passwd = $pass; $employee->fname = $first_name; $employee->sname = $last_name; $employee->country = "UK"; $employee->employee_status = "active"; $employee->is_active = "Y"; $employee->extra_id = "facebook_" . $id; if ($employee->save()) { $user_id = $db->insert_id(); $employee->id = $user_id; //$employee->active_user(); $employee->approved_account(); $user_found = Employee::find_by_id($user_id); $access = "User"; //session_start(); //$_SESSION['user_id'] = $user_id; //$_SESSION['username'] = $employee->username ; //$_SESSION['access_level'] = $access; //die; global $session; $session = new Session(); $session->login($user_found, $access); } else { $message = "<div class='error'> \r\n\t\t\t\t\t\t\t" . get_lang('following_errors') . "\r\n\t\t\t\t\t\t<ul> <li />"; $message .= join(" <li /> ", $employee->errors); $message .= " </ul> \r\n\t\t\t\t\t\t\t</div>"; $session->message($message); $smarty->assign('message', $message);
public function getEmployee($id) { return Employee::find_by_id($id); }
$smarty->assign('has_next_page', $pagination->has_next_page()); $smarty->assign('next_page', $pagination->next_page()); $offset = $pagination->offset(); $smarty->assign('offset', $offset); $smarty->assign('per_page', $per_page); $limit = " LIMIT {$per_page} OFFSET {$offset}"; //get result $sql = $select . $from . $where . $group_by . $order . $limit; //echo $sql; $result = $db->query($sql); $num_rows = $db->num_rows($result); if ($num_rows > 0) { $manage_list = array(); $i = 1; while ($rows = $db->fetch_object($result)) { $employee = Employee::find_by_id($rows->fk_employee_id); $manage_list[$i]['id'] = $rows->id; $manage_list[$i]['employee_name'] = $employee->full_name(); $manage_list[$i]['employee_id'] = $rows->fk_employee_id; $manage_list[$i]['cv_title'] = $rows->cv_title; $manage_list[$i]['look_job_title'] = $rows->look_job_title; $manage_list[$i]['look_job_title2'] = $rows->look_job_title2; $status = JobStatus::find_by_id($rows->look_job_status); $status_name = $status->status_name; $manage_list[$i]['look_job_status'] = $status_name; $manage_list[$i]['recent_job_title'] = $rows->recent_job_title; //$manage_list[$i]['city']= $rows->city; $manage_list[$i]['modified_at'] = strftime(DATE_FORMAT, strtotime($rows->modified_at)); //locations //country $country_arry = Country::find_by_code($rows->country);
public function createSchedule_Detail($id = "") { header('Content-Type: application/json'); $data = json_decode(stripslashes($_POST['data'])); foreach ($data as $d => $value) { $cntdata[] = $d; } if (!empty($data->taskdate) && !empty($data->cid) && !empty($data->empid)) { $issuefield = get_object_vars($data); // get the properties of an object into an array $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->cid)); $thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->empid)); $thisSchedule = new Schedule(); $thisSchedule->emp_id = $issuefield['empid']; $thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname; $thisSchedule->client_id = $thisclientproduct->client_id; $thisClient = Client::find_by_id($thisclientproduct->client_id); //print_r($thisclientproduct); //print_r($thisClient); //print_r($thisemployee); $thisSchedule->prod_id = $issuefield['cid']; $thisSchedule->prod_name = $thisclientproduct->prod_name; /** * this is to check if ticket * is in existence */ //print_r($theUser); global $session; //$partTicket = ($id!="") ? Ticket::find_by_id($id) : ""; // get the ticket to get details needed for sending mail $theUser = Employee::find_by_id($_SESSION["emp_ident"]); // get cse detail to retrieve email $thisSchedule->s_date = $data->taskdate; /** * section to configure and setup sms and email message */ $issue = array(); $objIssue = Issue::find_all(); // creating the issue log object $message_issue = ""; //$thisemployee->emp_phone foreach ($objIssue as $objI) { foreach ($issuefield as $key => $value) { if ($key == $objI->issue_accronym) { $message_issue .= $objI->issue_name . ", "; } } } $cemail = array(); $cemail = isset($_POST['cemail']) && !empty($_POST['cemail']) ? explode(",", $_POST['cemail']) : array('*****@*****.**'); array_push($cemail, $thisemployee->emp_email, is_array($partTicket) ? $partTicket->contact_email : "", $theUser->emp_email, $thisClient->email); //print_r($cemail); $thisSchedule->status = "Open"; $thisSchedule->issue = $message_issue; $thisSchedule->datecreated = date("Y-m-d H:i:s"); $thisSchedule->maint_type = $_POST['mtype']; $subject = "Maintenance Alert"; $smsmsg = "Maintenance alert for {$thisclientproduct->prod_name} at"; $smsmsg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch; $smsmsg .= "\r\n Issue:" . $message_issue . "\r\n"; $smsmsg .= "\r\n Comment:" . $issuefield["tissue"] . "\r\n"; $msg = "<h3>Maintenance Detail</h3> <hr />"; $msg .= "<p><strong>Machine: </strong>{$thisclientproduct->prod_name} </p>"; $msg .= "<p><strong>Client: </strong> {$thisClient->name}</p>"; $msg .= "<p><strong>Location: </strong>{$thisclientproduct->install_location} {$thisclientproduct->branch} {$thisclientproduct->install_city} </p>"; $msg .= "<p><strong>Issues: </strong>" . $message_issue . "</p>"; $msg .= "<p><strong>Comment: </strong>" . $issuefield["tissue"] . "</p>"; $msg .= "<br /><br /> <h4>Technician Details</h4> <hr />"; $msg .= "<p><strong>Name: </strong>" . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "</p>"; $msg .= "<p><strong>Email: </strong>" . $thisemployee->emp_email . "</p>"; $msg .= "<p><strong>Telephone: </strong>" . $thisemployee->emp_phone . "</p>"; $msg .= "<br /><br /><h4>Scheduled Date</h4> <hr />"; $msg .= "<p><strong>{$thisSchedule->s_date}</strong></p><br /><br /><br /><br />"; /** * the transaction log is created * to ensure that the product already * has history and cannot be deleted */ $Tlog2 = new Transaction(); $Tlog2->com_id = $thisclientproduct->main_id; $Tlog2->trans_type = "TASK ASSIGNMENT"; $Tlog2->trans_description = $issuefield["mtype"] . " task assigned to " . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . ""; $Tlog2->datecreated = date("Y-m-d H:i:s"); $Tlog2->user_id = $_SESSION['emp_ident']; // print_r($msg); if ($thisSchedule->create()) { $Tlog2->create(); /** * this section is needed * to post issues to database table * issuelog for statistical analysis on * issues */ //$thisemployee->emp_phone foreach ($objIssue as $objI) { foreach ($issuefield as $key => $value) { if ($key == $objI->issue_accronym) { $issueLog = new Issuelog(); $issueLog->ticket_id = 0; $issueLog->issue_id = $objI->id; $issueLog->issue_accronym = $objI->issue_accronym; $issueLog->issue_name = $objI->issue_name; $issueLog->prod_id = $issuefield['cid']; $issueLog->datecreated = date("Y-m-d H:i:s"); //$ddticket->subject .= $_POST[$objI->issue_accronym]. ", "; $issueLog->create(); } } } sendSms($thisemployee->emp_phone, $smsmsg); //method in function.php in the library folder helps to send sms $this->sendMail($thisSchedule->emp_name, $subject, $msg, $cemail); // sends email to employee return 1; } else { return 2; } } }
<table width='100%'> <thead><tr> <th>S/N</th><th>Product/Machine</th><th>Issue</th><th>Status</th><th>Technician</th><th>Date Generated </th><th>Expenses</th><th></th><th></th><th></th> </tr> </thead> <tbody> <?php if ($this->worksheet) { $x = 1; foreach ($this->worksheet as $worksheet) { $worksheetlisting .= "<tr>\n \t<td>{$x}</td><td>"; $cprod = Cproduct::find_by_id($worksheet->prod_id); $worksheetlisting .= $cprod->prod_name . " " . $cprod->install_address . " " . $cprod->install_city; //print_r($worksheet->cse_emp_id); $worksheetlisting .= "</td><td>{$worksheet->problem}</td><td>{$worksheet->status} </td><td>"; $emp = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $worksheet->cse_emp_id)); //print_r($cprod); $worksheetlisting .= $emp->emp_fname . " " . $emp->emp_lname; $worksheetlisting .= "</td><td>" . date_format(new DateTime($worksheet->sheet_date), "M d Y H:i:s") . "</td><td>" . Worksheet::getExpensesById($worksheet->id) . "</td>"; /** * section to set grant and\ * previledge */ global $session; $worksheetlisting .= ""; $worksheetlisting .= "</tr>"; $x++; } } else { $worksheetlisting .= "<tr><td colspan='9'>No record to display</td></tr>"; }
echo $prod->install_address . ", " . $prod->install_city; } else { echo $pending->location; } echo " </td>"; echo "<td>"; //$pending->client_name $myclient = Client::find_by_id($pending->client_id); if ($myclient) { echo $myclient->name; } echo "</td><td>"; $schedule = Schedule::find_by_ticket_id($pending->id); //print_r($schedule); if ($schedule) { $myengineer = Employee::find_by_id($schedule->emp_id); echo $myengineer ? $myengineer->emp_lname . " " . $myengineer->emp_fname : ""; } echo " </td><td>{$pending->issue}</td><td>"; if ($pending->status == 'Open') { echo "<span class='label bg-red' style='padding:5px'>{$pending->status}"; } else { echo "<span class='label bg-blue' style='padding:5px'>Pending"; } echo "</td><td>{$pending->datemodified} </td><td><a href='" . $uri->link("support/detail/" . $pending->id . "") . "'>View</a></td><td>\n <select sid='{$pending->id}' class='cschedule2'><option values=''>--Select--</option><option values='0'>Open</option><option values='1'>Closed</option><option values='2'>In Progress</option></select></td></tr>"; } } ?> </tbody>
public function update() { if (!empty($_POST['lname']) && !empty($_POST['empid'])) { $applicant = Employee::find_by_id($_POST['empid']); if (isset($_FILES['fupload']) && $_FILES['fupload']['error'] == 0) { //if file upload is set move_uploaded_file($_FILES['fupload']['tmp_name'], "public/uploads/" . basename($_FILES['fupload']['name'])); $image = new Imageresize(); // an instance of image resize object $image->load("public/uploads/" . basename($_FILES['fupload']['name'])); //$image->image =; $image->resize(400, 400); $image->save("public/uploads/" . basename($_FILES['fupload']['name'])); //this section is needed to get the extension for image type in renaming the image if ($_FILES['fupload']['type'] == "image/gif") { $ext = ".gif"; } if ($_FILES['fupload']['type'] == "image/png") { $ext = ".png"; } if ($_FILES['fupload']['type'] == "image/jpeg") { $ext = ".jpeg"; } if ($_FILES['fupload']['type'] == "image/pjpeg") { $ext = ".jpeg"; } if ($_FILES['fupload']['type'] == "image/gif") { $ext = ".gif"; } if ($_FILES['fupload']['type'] == "image/jpg") { $ext = ".jpg"; } $new_name = uniqid() . "_" . time() . $ext; //new name for the image rename("public/uploads/" . basename($_FILES['fupload']['name']), "public/uploads/" . $new_name); $photo = $new_name; $applicant->img_url = $photo; } else { //$applicant->img_url = $_POST['imgvalue']; } $applicant->emp_lname = $_POST['lname']; $applicant->emp_fname = $_POST['fname']; $applicant->emp_mname = $_POST['mname']; $applicant->emp_sex = $_POST['gender']; $applicant->emp_mstatus = $_POST['mstatus']; $applicant->emp_religion = $_POST['religion']; $applicant->emp_dob = $_POST['dob']; $applicant->emp_nationality = $_POST['nationality']; $applicant->emp_soo = $_POST['soo']; $applicant->emp_lga = $_POST['lga']; $applicant->emp_address = $_POST['address']; $applicant->emp_email = $_POST['email']; $applicant->emp_phone = $_POST['phone']; $applicant->emp_uname = $_POST['email']; //$pass = Employee::generatePassword(8,2); //$applicant->emp_pword = crypt($pass,'$2a$07$usesomesillystringforsalt$'); //$applicant->emp_id = Employee::getID2("RJH/S/","tblemp", $applicant->emp_fname. " ". $applicant->emp_lname); $applicant->datemodified = date("Y-m-d H:i:s"); if ($applicant->update()) { //$this->sendMail($applicant->fname,$applicant->lname,$applicant->emp_mname,$pass ,$applicant->emp_uname,$applicant->emp_email ); return 1; //returns 1 on success } else { return 2; // returns 2 on insert error } } else { return 3; //returns 3 if requiered input field is not supplied } }