/** * Special Listing types * */ protected function new_two_type_fields($path = null) { //initializing variables $type = $this->_record->type(); $class_path = EBOOK_EVERY . DS . 'webpage_types' . DS . $type . '.php'; $class = ucfirst(strtolower($type)) . 'Webpage'; //reasons to fail if (!file_exists($class_path)) { return false; } if (is_null($path)) { return false; } //loading resources $user = eFactory::getUser(); require_once $class_path; $obj = new $class(); foreach ($obj as $property => $value) { //initializing variables $name = ucwords(strtolower(str_replace("_", " ", $property))); if (isset($GLOBALS['dropdowns']['name_mapping'][$property])) { $name = $GLOBALS['dropdowns']['name_mapping'][$property]; } //initializing variables $value = $this->_record->{$property}(); require $path; } }
/** * All Listings * */ protected function listing_item($path = null) { //initializing variables $path = substr($path, 0, strlen($path) - 4); //loading resources $user =& eFactory::getUser(); $records = $this->getList(); //reasons to fail if (empty($records) || !$records) { return false; } foreach ($records as $id => $record) { //initializing variables $last_bid = $record->last_bid(); $tags = $record->getOneToMany('byrdlist_tags'); if (!is_array($tags)) { $tags = array(); } //GET THE THUMBNAIL if ($thumbnail = $record->thumbnail()) { $thumbnail = $thumbnail->file(); } //IS THIS THE OWNER? $this->is_owner = false; if ($record->author_id() == $user->id()) { $this->is_owner = true; } //WHAT TYPE OF LISTING TEMPLATE? if ($record->type() != 'auction' && file_exists($path . '_' . $record->type() . '.php')) { $tmp_path = $path . '_' . $record->type(); } else { $tmp_path = $path; } //loading resources require $tmp_path . '.php'; } return true; }
/** * Joomla! 1.5 component reservation * * @version $Id: view.html.php 2010-06-02 12:34:25 svn $ * @author * @package Joomla * @subpackage reservation * @license Copyright (c) 2010 - All Rights Reserved * * * */ // no direct access defined('_JEXEC') or die('Restricted access'); //loading resources $user =& eFactory::getUser(); ?> <script type="text/javascript" src="components/com_community/assets/jquery-1.2.6.pack.js"></script> <script type="text/javascript" src="components/com_community/assets/window-1.0.js"></script> <script type="text/javascript" src="components/com_community/assets/script-1.2.js"></script> <div id="componentarea"><div id="community-wrap"><div id="cToolbarNav"> <div id="cToolbarNavInner"> <ul id="cToolbarNavList"> <li id="toolbar-item-frontpage"> <a href="/index.php?option=com_community&view=profile&Itemid=14"> Home</a> </li> <li id="toolbar-item-profile" class=""> <a href="/index.php?option=com_community&Itemid=14&view=profile&userid=62&Itemid=14" onmouseover="joms.toolbar.open('m1')" onmouseout="joms.toolbar.closetime()">Profile</a>
/** * Mark this listing as watched * */ protected function markWatched() { //initializing variables static $once; //reasons to return if (isset($once)) { return false; } if (!isset($once)) { $once = true; } //initializing variables $this_id = JRequest::getVar('watched', false); JRequest::setVar('watched', false); //reasons to return if (!$this_id) { return false; } if ($this_id != $this->id()) { return false; } //populating object properties $user =& eFactory::getUser(); $this->_watched_id = $user->id(); //NO DUPLICATES $this->countRelationships('watched', $ids); if (in_array($user->id(), $ids)) { return false; } //save $this->saveRelationship('watched'); return true; }
/** * Saves the record on submit */ protected function default_unpublish() { //if (!JRequest::checkToken()) return false; $user =& eFactory::getUser(); if (!$user->isSpecial()) { return false; } //loading resources $this->_record =& JTable::getInstance('listings', 'Table'); $this->_record->load(JRequest::getVar('edit')); $this->_record->published = 0; $this->_record->store(); $this->id = $this->_record->id; return true; }
/** * Set this as awarded * * Unsets any others and then sets itself * */ public function setAwarded() { //loading resources $listing =& $this->getOneToOne('byrdlist_listings'); $awarded =& $listing->getAwarded(); $owner = eFactory::getUser($listing->author_id()); $author = eFactory::getUser($this->author_id()); if ($awarded && !$awarded->isNew()) { $awarded->awarded = 0; $awarded->store(); } $this->awarded = 1; $this->store(); require_once EBOOK_HELPERS . DS . 'mailer.php'; if ($listing->type() == 'donation') { BMailer::donationAwarded_Owner($owner, $listing, $author); BMailer::donationAwarded_Requester($author, $listing); } else { BMailer::needAwarded_Owner($owner, $listing, $author); BMailer::needAwarded_Requester($author, $listing); } return true; }
/** * Inserts a new row if id is zero or updates an existing row in the database table * * Can be overloaded/supplemented by the child class * * @access public * @param boolean If false, null object variables are not updated * @return null|string null if successful otherwise returns and error message */ function store($updateNulls = false) { $k = $this->_tbl_key; if ($this->{$k}) { $ret = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls); } else { //loading libraries $properties = $this->getProperties(); //loading resources $user =& eFactory::getUser(); //initializing object properties $this->_juser_id = $user->id; $this->{$k} = create_guid(); if (array_key_exists('created_on', $properties)) { $this->created_on = date('Y-m-d H:i:s', time()); } if ($ret = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key)) { $this->saveRelationship('juser'); } } if (!$ret) { $this->setError(get_class($this) . '::store failed - ' . $this->_db->getErrorMsg()); return false; } else { return true; } }
/** * Send email * */ protected function recommend_send() { //loading resources $user =& eFactory::getUser(); //initializing variables $data = JRequest::get('post'); //loading resources $mailSender =& JFactory::getMailer(); $mailSender->addRecipient($data['email']); $mailSender->setSender(array($user->email(), $user->name())); $mailSender->setSubject($data['name']); $mailSender->setBody($data['description']); //reasons to fail if (!$mailSender->Send()) { return false; } $this->_listings->addRecommend(); return true; }
/** * Set the Payment to be Published * * Other responsibilities come with this transaction. * This is only set to published if a properly validated paypal amount comes back. */ public function setPublished($num = null) { //reasons to fail if (is_null($num)) { return false; } if ($num < 1) { return false; } //loading resources require_once EBOOK_HELPERS . DS . 'mailer.php'; $listings =& $this->getOneToMany('byrdlist_listings'); //reasons to fail if (!$listings) { return false; } if (empty($listings)) { return false; } foreach ($listings as $listing) { //reasons to fail if ($listing->type() != 'auction') { continue; } //loading resources $payments = $listing->getOneToMany('byrdlist_payments'); //reasons to fail if (empty($payments)) { break; } //initializing variables $total = $this->amount(); foreach ($payments as $id => $payment) { if (!$payment->published()) { continue; } $total = $total + $payment->amount(); } //loading resources $lastbid =& $listing->last_bid(); $bidauthor =& eFactory::getUser($lastbid->author_id()); $author =& eFactory::getUser($listing->author_id()); //more reasons to fail if ($total < $lastbid->amount()) { break; } BMailer::auctionPaidInFull($bidauthor, $listing); BMailer::notifyListingOwnerAuctionPaidInFull($author, $listing); } $this->published = 1; $this->store(); return true; }
/** * Joomla! 1.5 component reservation * * @version $Id: view.html.php 2010-06-02 12:34:25 svn $ * @author * @package Joomla * @subpackage Listings * @license Copyright (c) 2010 - All Rights Reserved * * * */ // no direct access defined('_JEXEC') or die('Restricted access'); //loading resources $author = eFactory::getUser($this->_record->author_id()); $winner = $this->_record->getWinner(); $document =& JFactory::getDocument(); $pdf =& $document->_engine; // set font $pdf->SetFont('freesans', '', 12); $pdf->SetFillColor(255, 255, 255); $pdf->SetTextColor(0, 0, 0); $pdf->setLanguageArray($l); // add a page $pdf->AddPage(); $pdf->Ln(5); // create columns content $left_column = $author->name() . "\r\n" . ucwords(strtolower($this->_record->primary_street())) . "\r\n" . ucwords(strtolower($this->_record->primary_city())) . ", " . $this->_record->primary_state() . $this->_record->primary_postal_code(); $right_column = $winner->name() . "\r\n" . ucwords(strtolower($winner->primary_street())) . "\r\n" . ucwords(strtolower($winner->primary_city())) . ", " . $winner->primary_state() . $winner->primary_postal_code(); $desc = "<br/><br/><br/><br/><b>" . $this->_record->name() . "</b><br/><br/>" . $this->_record->description(500) . "<br/><br/>";