/** * description: * * @param orderID: * @return void: */ public function incrementPrintCounter($orderID) { $order = $this->getOrder($orderID); $count = intval($order[0]["PrintCounter"]); $count = $count + 1; $arr_vals = array("PrintCounter" => $count); $arr_vals = parent::sanitizeArray($arr_vals); $this->_dbConnection->updateTable("OrdersTable", "OrdersTable", "OrderID", $orderID, "OrderID", $arr_vals, "OrderID = {$orderID}"); }
<?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; }); $controller = new notificationsController(); $username = "******"; $result = $controller->emailUser($username); print_r($result);
/** * Returns a 2D array in JSON format of all the past orders the given user has placed, with most recent order on top. First array is orders, second array is orderslists, with sub-arrays being individual orders or lists(arrays) of parts per order. * UPDATED: Returns a PHP array of the users orders only, no lists. Keys are DB column names. Note: Encoding to JSON causes problems, therefore array is returned as a simple PHP array. */ public function getUsersOrders($username) { $id = parent::getUserID($username); $resourceid = $this->_dbConnection->selectFromTableDesc("OrdersTable", "UserID", $id, "NumericDateSubmitted"); // orders in most recently edited/submitted $arr = $this->_dbConnection->formatQueryResults($resourceid, "OrderID"); // holds list of all the OrderIDs of the orders that the given user has placed $orders = array(); // will be an array of arrays, each contained array being an order for ($i = 0; $i < count($arr); $i++) { $orders[$i] = $this->getOrder($arr[$i]); // gets a single order and adds it to orders array $orders[$i] = $orders[$i][0]; } //$lists = array(); //for ($i=0; $i < count($orders); $i++) //{ // $lists[$i] = $this->getOrdersList($orders[$i][0]["OrderID"]); // gets the list of orderlist entries with given orderID as an array and stores it into one element of the lists array //} //$users_orders = array($orders, $lists); // puts into a 2D array //$users_orders[] = $this->getOrder($arr[2]); // gets a single order return $orders; //return json_encode($users_orders); //return json_encode($orders); }