예제 #1
0
 /**
  * Insert access log
  *
  * @param  int  $companyID,
  * @return bool Insertion successful or not
  */
 public function insertAccessLog($username, $activityType, $additionalInfo = "")
 {
     $data = array(Username => $username, ActivityType => $activityType, IpAddress => Admin_View_Helper_AccessLog::getClientIp(), LoginDateTime => Site_View_Helper_Date::formatDate(), AdditionalInfo => $additionalInfo);
     return Admin_View_Helper_DB::save(new Admin_Resource_AccessLog(), $data);
 }
예제 #2
0
 /**
  * Insert contact log
  *
  * @param  array $postData
  * @return array Status and message
  */
 public function insertContactLog($postData)
 {
     if ($postData['Name'] == '') {
         return [status => 0, message => 'Please fill in your name'];
     }
     if ($postData['PhoneNr'] == null && $postData['Email'] == null) {
         return [status => 0, message => 'Please enter at least one way to contact you'];
     }
     if ($postData['ServiceRequired'] == 0 || $postData['ServiceRequired'] == null) {
         return [status => 0, message => 'Please select required service'];
     }
     if ($postData['Text'] == '') {
         return [status => 0, message => 'Please enter your comments'];
     }
     // Send email
     $emailSubject = '[' . $postData['ServiceRequiredText'] . '] Form submitted on www.beyourlight.co.uk';
     $emailFrom = $postData['Email'];
     $emailText = 'Hello,<br/><br/>' . 'contact form has been submitted on www.beyourlight.co.uk<br/><br/>' . 'Here are the details:<br/>' . '<b>Name</b>: ' . $postData['Name'] . '<b>Email</b>: ' . $postData['Email'] . '<b>PhoneNr</b>: ' . $postData['PhoneNr'] . '<b>Service</b>: ' . $postData['ServiceRequiredText'] . '<b>Text</b>: ' . $postData['Text'];
     $emailTo = $this->getContactsByID()->Email;
     $emailSent = Site_View_Helper_Mailer::sendEmail($emailTo, $emailSubject, $emailText, $postData['Name'], EMAIL_USERNAME);
     // Insert log in DB
     $data = [ContactDateTime => Site_View_Helper_Date::formatDate(), Name => $postData['Name'], Email => $postData['Email'], PhoneNr => $postData['PhoneNr'], ServiceID => $postData['ServiceRequired'], Text => $postData['Text'], IpAddress => Admin_View_Helper_AccessLog::getClientIp(), EmailSent => $emailSent['Sent'], ErrorMessage => $emailSent['Message']];
     Admin_View_Helper_DB::save(new Admin_Resource_ContactLog(), $data);
     return [status => 1, message => 'Your request has been submitted successfully'];
 }