public function __construct($db, $userID, $event_id = 0) { parent::__construct(); $this->db = $db; $this->user = new DatabaseObject_User($db); $this->user->load($userID); //load everything about the user. $this->event = new DatabaseObject_Event($db); $databaseColumn = 'event_id'; DatabaseObject_StaticUtility::loadObjectForUser($this->event, $this->user->getId(), $event_id, $databaseColumn); if ($this->event->isSaved()) { //echo "<br/>post at is saved."; $this->name = $this->event->profile->name; $this->content = $this->event->profile->content; $this->ts_created = $this->event->ts_created; $this->ts_end = $this->event->ts_end; } else { //echo "<br/>post user_id is getId(): ".$this->user->getId(); $this->event->user_id = $this->user->getId(); //$this->user_id at blogPost object came from this. } }
public static function verifiyShoppingInput($db, $username, $productID, $databaseColumn, $productType) { $user = new DatabaseObject_User($db); if (!$user->loadByUsername($username, 'clubAdmin', 'L')) { echo "no such club"; return false; } echo "you are at after loadbyusername"; echo "<br/>userID is: " . $user->getID(); if ($productType == 'product') { $product = new DatabaseObject_Product($db); } elseif ($productType == 'event') { $product = new DatabaseObject_Event($db); } elseif ($productType == 'due') { $product = new DatabaseObject_UniversalDue($db); } elseif ($productType == 'individualDue') { $product = new DatabaseObject_IndividualDue($db); } if (!DatabaseObject_StaticUtility::loadObjectForUser($product, $user->getId(), $productID, $databaseColumn)) { //echo "no such product exist"; return false; } if (empty($_SESSION['shoppingClubID'])) { return $product; } elseif (!empty($_SESSION['shoppingClubID']) && $product->user_id == $_SESSION['shoppingClubID']) { return $product; } else { return false; } }