Exemplo n.º 1
0
<?php

// autoloader code
// loads classes as needed, eliminates the need for a long list of includes at the top
spl_autoload_register(function ($className) {
    $possibilities = array('../controllers' . DIRECTORY_SEPARATOR . $className . '.php', '../back_end' . DIRECTORY_SEPARATOR . $className . '.php', '../views' . DIRECTORY_SEPARATOR . $className . '.php', $className . '.php');
    foreach ($possibilities as $file) {
        if (file_exists($file)) {
            require_once $file;
            return true;
        }
    }
    return false;
});
$api = new roboSISAPI();
//print_r($api->getCheckIns("12rohits");
//$jk = 1399924;
//$di = 1;
//$api->inputCheckIn($jk,"12rohits");
//print_r($api->getUserID("12rohits"));
//$api->getAllEmails();
//$api->getUserType("12rohits");
$api->getMentorsEmail();
 /**
  * description: Emails the mentor when an order is Pending Mentor Approval.
  * 
  * @param orderID: The ID of the order which the notification is about.
  * @param vendorname: The name of the vendor of the given order.
  * @param submittinguser: The user who submitted the order.
  * @return boolean: true if mail was sent successfuly, false otherwise.
  */
 public function notifyMentorOfPending($orderID, $vendorname, $submittinguser)
 {
     $to = parent::getMentorsEmail();
     $subject = "Robotics PO System: OrderID #{$orderID} is awaiting your approval";
     $message = "Hello, \n\nThe purchase order with OrderID #{$orderID} and vendor \"{$vendorname}\" has been submitted by {$submittinguser} for your approval. You can approve or reject the order at {$this->_serverURL}/views/mentorvieworder.php?id={$orderID}. \n\n - The Robotics 1072 Web Team";
     $header = "From: harker1072@gmail.com";
     //print_r($to);
     //print_r($subject);
     //print_r($message);
     //print_r($header);
     $result = mail($to, $subject, $message, $header);
     // returns true on delivery
     return $result;
 }