public function __construct($db) { parent::__construct(); $this->db = $db; $this->user = new DatabaseObject_User($db); $this->universities = DatabaseObject_StaticUtility::loadUniversities($db); }
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 function loadLiveObject($user_id, $url) { $query = DatabaseObject_StaticUtility::loadLiveObjects($this->_db, $user_id, $url, $this->_table, $this->getSelectFields(), self::EVENT_STATUS_LIVE); //echo $query; //echo "here"; return $this->_load($query); }
public function setImageOrder($order) { $this->getImages(); DatabaseObject_StaticUtility::setImageOrder($this->_db, 'products_images', $order, $this->images); }
public function process(Zend_Controller_Request_Abstract $request) { if (!isset($_FILES['image']) || !is_array($_FILES['image'])) { $this->addError('image', 'Invalid upload data'); return false; } $file = $_FILES['image']; switch ($file['error']) { case UPLOAD_ERR_OK: //echo "upload okay"; break; case UPLOAD_ERR_FORM_SIZE: //only used if max_file_size specified in fomr //only used if max_file_size specified in fomr case UPLOAD_ERR_PARTIAL: $this->addError('image', 'The uploaded file was too large'); break; case UPLOAD_ERR_NO_FILE: $this->addError('image', 'No file was uploaded'); break; case UPLOAD_ERR_NO_TMP_DIR: $this->addError('image', 'Temporary folder not found'); break; case UPLOAD_ERR_CANT_WRITE: $this->addError('image', 'Unable to write file'); break; case UPLOAD_ERR_EXTENSION: $this->addError('image', 'Invalid file extension'); break; default: $this->addError('image', 'Unkonw error code'); } if ($this->hasError()) { return false; } //echo "<br/> at after hasError"; $info = getImageSize($file['tmp_name']); if (!$info) { $this->addError('type', 'Uploaded file was not an image'); return false; } //echo $info[2]; switch ($info[2]) { case IMAGETYPE_PNG: case IMAGETYPE_GIF: case IMAGETYPE_JPEG: case IMAGETYPE_JPG: break; default: $this->addError('type', 'Invalid image type uploaded'); return fase; } //if no errors hav eoccurred save the image if (!$this->hasError()) { $attribute_name = $request->getParam('attribute_name'); $image_name = DatabaseObject_StaticUtility::replaceSpaceWithDash($request->getParam('image_name')); $price_adjustment = $request->getParam('price_adjustment'); $this->image->setSaveFilePath($this->product->username, $this->product->product_type, $this->product->getId(), $attribute_name); echo $this->product->username; $this->image->image_name = $image_name; echo '<br />image product type table is: ' . $this->image->product_type_table . '<br />'; echo '<br />Product username is: ' . $this->product->username . '<br />'; $this->image->price_adjustment = $price_adjustment; $this->image->uploadFile($file['tmp_name']); $this->image->filename = basename($file['name']); $this->image->save(); //this is the place to create all the neccessary thumbnails for the website. $this->image->createThumbnail(80, 0, $attribute_name . 'Attribute_' . $image_name); $this->image->createThumbnail(150, 0, $attribute_name . 'Attribute_' . $image_name); } return !$this->hasError(); }
public function getTeaser($length) { echo "<br/>here at teaser"; return DatabaseObject_StaticUtility::GetTeaser($this->profile->content, $length); }
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; } }
public function getTeaser($length) { return DatabaseObject_StaticUtility::GetTeaser($this->profile->club_description, $length); }