bheffron Posted March 5, 2010 Share Posted March 5, 2010 Hi everyone. I am working on a real estate project for a client that includes using Open Realty (an open source real estate listing framework). I am in the process of modifying it to display .mov files instead of pictures using the built in virtual tour feature. Admittedly, PHP is not my strong point and I seem to only know enough that I know how to break everything. So far, I have the movies working, however they require a "view virtual tour" button to be clicked on the listing page itself. The movie then opens in a separate window. I am looking to eliminate this step completely and have the actual movie embedded into the listing page, but I am not sure how this should be done. Could anyone point me in the right direction? It doesn't look like it should be too hard, I just don't know where to start. function qtvr_install_addon() { $current_version = ".1"; global $conn, $config; require_once($config['basepath'].'/include/misc.inc.php'); $misc = new Misc(); //$config["allowed_upload_extensions"] //$config["allowed_upload_types"] //mov, video/quicktime $ext = $config['allowed_upload_extensions'].",mov"; $type = $config['allowed_upload_types'].",video/quicktime"; //Check Current Installed Version $sql = 'SELECT addons_version FROM '.$config['table_prefix_no_lang'].'addons WHERE addons_name = \'qtvr\''; $recordSet = $conn->Execute($sql); $version = $recordSet->fields[0]; if ($version == '') { // Preform a new install. Create any needed databases etc, and insert version number into addon table. $sql = 'INSERT INTO '.$config['table_prefix_no_lang'].'addons (addons_version, addons_name) VALUES (\'1\',\'qtvr\')'; $recordSet = $conn->Execute($sql); $sql = "UPDATE " . $config['table_prefix_no_lang'] . "controlpanel SET controlpanel_allowed_upload_extensions = '$ext' , controlpanel_allowed_upload_types = '$type'"; $recordSet = $conn->Execute($sql); return TRUE; } elseif ($version != $current_version) { //Preform Updates to database based on previous installed version. switch($version) { case '1'; break; } // switch return TRUE; } return FALSE; } /** * show_admin_icons() * This function should return an array of the html links that should be shown on the administrative page. * @return array should return each link that shoudl be shown in the admin section. Should return a string if it is a single link, or an array for multiple links. **/ function qtvr_show_admin_icons() { $admin_link = 'QTVR VTour Addon'; return $admin_link; } /** * load_template() * This should return an array with all the template tags for open-realty's template engine to parse * @return array List of template_fields **/ function qtvr_load_template() { $template_array = array('addon_qtvr_link'); return $template_array; } /** * run_action_user_template() * This function handles user $_GET[] actions related to the addon. Function must be named using this method: addon_addonname_description. * @return string Should return all contents that should be displayed when an addon specific $_GET['action'] is called. **/ function qtvr_run_action_user_template() { switch ($_GET['action']) { case 'addon_qtvr_showvtour': $data = addon_qtvr_showvtour(); break; default: $data = ''; break; } // End switch ($_GET['action']) return $data; } /** * run_action_admin_template() * This function handles administrative $_GET[] actions related to the addon. Function must be named using this method: addon_addonname_description. * @return string Should return all contents that should be displayed when a addon specific $_GET['action'] is called. **/ function qtvr_run_action_admin_template() { } /** * run_template_user_fields() * This function handles all the replacement of {template_tags} with the actual content. All tags setup here must also be added to teh load_template function in order for open-realty to parse them. * @param string $tag * @return string Should return all contents that should be displayed when a addon specific $tag is called. **/ function qtvr_run_template_user_fields($tag = '') { switch ($tag) { case 'addon_qtvr_link': $data = qtvr_link($_GET['listingID']); break; default: $data = ''; break; } // End switch ($_GET['action']) return $data; } /************************************* * Addon Specific Functions * *************************************/ //Addon Specific Function function listingid_display() { global $current_ID; if ($current_ID != '') { $_GET['listingID'] = $current_ID; } if (isset($_GET['listingID'])) { $listingID = $_GET['listingID']; } return $display; } //Addon Specific Function function qtvr_link($listingID,$use_small_image = FALSE) { // shows the images connected to a given image global $config,$lang,$conn,$current_ID; if ($current_ID != '') { $_GET['listingID'] = $current_ID; } if (isset($_GET['listingID'])) { $listingID = $_GET['listingID']; } require_once($config['basepath'].'/include/misc.inc.php'); $misc = new misc(); // grab the images $listingID_sql = $misc->make_db_extra_safe($listingID); $output=''; $sql = "SELECT vtourimages_file_name FROM " . $config['table_prefix'] . "vtourimages WHERE (listingsdb_id = $listingID_sql) ORDER BY vtourimages_rank"; $recordSet = $conn->Execute($sql); if ($recordSet === false) { $misc->log_error($sql); } $num_images = $recordSet->RecordCount(); if ($num_images > 0) { while (!$recordSet->EOF) { $file_name = $misc->make_db_unsafe ($recordSet->fields['vtourimages_file_name']); $ext = substr(strrchr($file_name, '.'), 1); $recordSet->MoveNext(); } // end while if ($ext == 'mov') //if it's a mov file then use Quicktime for QTVR Display { if ($use_small_image === TRUE) { $image = 'vtourbuttonsmall.jpg'; } else { $image = 'vtourbutton.jpg'; } if(file_exists($config['template_path'].'/images/'.$image)) { $output .= '<a href="index.php?action=addon_qtvr_showvtour&popup=yes&listingID='.$listingID.'" onclick="window.open(\'index.php?action=addon_qtvr_showvtour&popup=yes&listingID='.$listingID.'\',\'\',\'width=500,height=400\');return false;"><img src="'.$config['template_url'].'/images/'.$image.'" alt="'.$lang['click_here_for_vtour'].'" /></a>'; } else { $output = '<a href="index.php?action=addon_qtvr_showvtour&popup=yes&listingID='.$listingID.'" onclick="window.open(\'index.php?action=addon_qtvr_showvtour&popup=yes&listingID='.$listingID.'\',\'\',\'width=410,height=375\');return false;">'.$lang['click_here_for_vtour'].'</a>'; } } //end if it's a mov extention } // end if ($num_images > 0) return $output; } // end function rendervtourlink // Addon Specific Function function addon_qtvr_showvtour() { global $lang, $conn, $config, $current_ID; require_once($config['basepath'].'/include/misc.inc.php'); $misc = new misc(); // Get the current id or listing id.. make sure whichever one we have gets set as the $listingID if ($current_ID != '') { $_GET['listingID'] = $current_ID; } if (isset($_GET['listingID'])) { $listingID = $_GET['listingID']; } // Get the image ID so we know which image to display if (!isset($_GET['imageid'])) { $imageid = 0; } else { $imageid = $_GET['imageid']; } // If a listing ID isn't set.. let them know something is wrong if ($listingID == '') { $display = 'No Listing ID'; return $display; } // Setup our count variable $a $a = 0; $links = ''; $listingID = $misc->make_db_extra_safe($listingID); $sql = "SELECT vtourimages_caption, vtourimages_description, vtourimages_file_name FROM " . $config['table_prefix'] . "vtourimages WHERE (listingsdb_id = $listingID) ORDER BY vtourimages_rank"; $recordSet = $conn->Execute($sql); if ($recordSet === false) { $misc->log_error($sql); } $num_images = $recordSet->RecordCount(); if ($num_images > 0) { while (!$recordSet->EOF) { $caption = $misc->make_db_unsafe ($recordSet->fields['vtourimages_caption']); $description = $conn->qstr($misc->make_db_unsafe($recordSet->fields['vtourimages_description'])); $file_name[$a] = $misc->make_db_unsafe ($recordSet->fields['vtourimages_file_name']); if ($caption == '') { $caption = 'Virtual Tour Image '.$a; } //$scenes .= "scenes[$a]=\"$file_name\"; titles[$a]=\"$caption\"; \n"; if ($imageid == $a) { $links .= ''.$caption.'<br />'; } else { $links .= '<a href = "' . $config[baseurl] . '/index.php?action=addon_qtvr_showvtour&popup=yes&listingID='.$_GET['listingID'].'&imageid='.$a.'">'.$caption.'</a><br />'; } $vtopts .= "<option value=\"$a\">$caption</option> \n"; $vtparams .= "<param name=\"pano$a\" value=\"{file=$config[vtour_view_images_path]/$file_name}{auto=0.1}{pan=-45}{fov=180}\" /> \n"; $a++; $ext = substr(strrchr($file_name, '.'), 1); $recordSet->MoveNext(); } // end while $currentimage = $file_name[$imageid]; } // end if ($num_images > 0) //if ($ext == 'mov') //if it's a mov file then use Quicktime for QTVR Display //{ $display = '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >' . "\r\n"; $display .= '<head>' . "\r\n"; $display .= '<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />' . "\r\n"; $display .= '<title>Virtual Tour</title>' . "\r\n"; $display .= '<style type="text/css">' . "\r\n"; $display .= 'body,table{background-color:#000080;font-family: Tahoma, Verdana, Arial; font-size: 8pt;}' . "\r\n"; $display .= '#desc{overflow:auto; width:95%; height:50px; border: 1px inset;}' . "\r\n"; $display .= '</style>' . "\r\n"; $display .= '<head>' . "\r\n"; $display .= '<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />' . "\r\n"; $display .= '<title>Virtual Tour</title>' . "\r\n"; $display .= '<style type="text/css">' . "\r\n"; $display .= 'body,table{background-color:#000080;font-family: Tahoma, Verdana, Arial; font-size: 8pt;}' . "\r\n"; $display .= '#desc{overflow:auto; width:95%; height:50px; border: 1px inset;}' . "\r\n"; $display .= '</style>' . "\r\n"; $display .= '</head>' . "\r\n"; $display .= '<body>' . "\r\n"; $display .= '<div>' . "\r\n"; $display .= '<table width="384" cellpadding="0" cellspacing="0" border="0">' . "\r\n"; $display .= '<tr>' . "\r\n"; $display .= '<td align="center">' . "\r\n"; $display .= '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH="450" HEIGHT="260">' . "\r\n"; $display .= '<PARAM name="qtsrc" value="' . $config[vtour_view_images_path] . '/' .$currentimage . '" />' . "\r\n"; $display .= '<PARAM name="src" value="' . $config[vtour_view_images_path] . '/' . $currentimage . '" />' . "\r\n"; $display .= '<PARAM name="type" value="image/x-quicktime" />' . "\r\n"; $display .= '<PARAM name="pluginspage" value="http://www.apple.com/quicktime/download/" />' . "\r\n"; $display .= '<PARAM name="name" value="viewer" />' . "\r\n"; $display .= '<PARAM name="AUTOPLAY" value="false" />' . "\r\n"; $display .= '<PARAM name="CONTROLLER" value="true" />' . "\r\n"; $display .= '<EMBED qtsrc="' . $config[vtour_view_images_path] . '/' . $currentimage . '" src="' . $config[vtour_view_images_path] . '/' . $currentimage . '" pluginspage="http://www.apple.com/quicktime/download/" HEIGHT=260 WIDTH=450 AUTOPLAY=false CONTROLLER=true /></EMBED>' . "\r\n"; $display .= '</OBJECT>' . "\r\n"; $display .= '</td>' . "\r\n"; $display .= '</tr>' . "\r\n"; $display .= '</table>' . "\r\n"; $display .= '</div>' . "\r\n"; $display .= $links; $display .= '</body>' . "\r\n"; $display .= '</html>' . "\r\n"; return $display; //} // end if it's a mov /* else //if it's not a .mov let them know it's not supported. { $display = '<html>'."\r\n"; $display .= '<head>'."\r\n"; $display .= '<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />'."\r\n"; $display .= '<title>Virtual Tour</title>'."\r\n"; $display .= '<style type="text/css">'."\r\n"; $display .= 'body,table{font-family: Tahoma, Verdana, Arial; font-size: 8pt;}'."\r\n"; $display .= '#desc{overflow:auto; width:95%; height:50px; border: 1px inset;}'."\r\n"; $display .= '</style>'."\r\n"; $display .= '</head>'."\r\n"; $display .= '<body>'."\r\n"; $display .= '<div>'."\r\n"; $display .= '<table width="384" cellpadding="0" cellspacing="0" border="0">'."\r\n"; $display .= '<tr>'."\r\n"; $display .= '<td align="center">'."\r\n"; $display .= $lang['unsupported_vtour']; $display .= '</td>'."\r\n"; $display .= '</tr>'."\r\n"; $display .= '</table>'."\r\n"; $display .= '</div>'."\r\n"; $display .= '</body>'."\r\n"; $display .= '</html>'."\r\n"; return $display; } //end if $ext = egg */ } // end function showvtour ?> Quote Link to comment Share on other sites More sharing options...
schilly Posted March 5, 2010 Share Posted March 5, 2010 so you just need to know how to embed a quicktime video? Quote Link to comment Share on other sites More sharing options...
bheffron Posted March 5, 2010 Author Share Posted March 5, 2010 Thanks for responding schilly. It will probably be easier if I showed you the listing page itself. I have the movie successfully embedded, but I want it to show on the actual listing page and not require the "click here to watch..." button. See here for what I'm talking about... http://www.shiftedmarketing.com/hdhomes/index.php?option=com_cmsrealty&Itemid=54&action=listingview&listingID=2&cmsrealty=user The code below was the addon php code written to allow the quicktime movie to embed and works perfectly. All I need to do is have the movie show on the page and not in the popup and I'm clueless, Thanks again! Quote Link to comment Share on other sites More sharing options...
schilly Posted March 5, 2010 Share Posted March 5, 2010 can't you just call whatever that popup calls in the current page? Quote Link to comment Share on other sites More sharing options...
bheffron Posted March 8, 2010 Author Share Posted March 8, 2010 I suppose I could, if I knew what to change. Quote Link to comment Share on other sites More sharing options...
schilly Posted March 8, 2010 Share Posted March 8, 2010 oh so you didn't write any of this? Quote Link to comment Share on other sites More sharing options...
bheffron Posted March 8, 2010 Author Share Posted March 8, 2010 that's correct, unfortunately. :-\ It is an addon that was written for Open Realty, the original coder went MIA so coming here is really a last chance effort haha. Quote Link to comment Share on other sites More sharing options...
schilly Posted March 8, 2010 Share Posted March 8, 2010 ah i see. ya that's gonna be tough with joomla. can you just input the standard qtvr code in one of the docs? something like this: <object CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="256" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="src" value="sample.mov"> <param name="autoplay" value="true"> <param name="controller" value="true"> <embed src="sample.mov" width="320" height="256" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/"></embed> </object> Apple embed attributes: http://www.apple.com/quicktime/tutorials/embed2.html but if you're hoping for the client to take this over afterwards you can't really ask them to input this code into every listing =( Quote Link to comment Share on other sites More sharing options...
bheffron Posted March 8, 2010 Author Share Posted March 8, 2010 right, it really doesn't have much to do with Joomla. OR is integrated but I am able to administer everything for it independently, and it has it's own listing pages etc. Like I said, I have the movies working perfectly using the addon above. What this addon does is allow .mov files to be uploaded in the Open Reality back end admin, and then display the link on the listing page by adding {addon_qtvr_link} to the listing page template. What I need to do is modify the addon to call to the movie itself, and ad that to the listing page template. Quote Link to comment Share on other sites More sharing options...
schilly Posted March 8, 2010 Share Posted March 8, 2010 ya i guess find the file in that component which outputs the pop-up image link then replace it with the proper video call. Quote Link to comment Share on other sites More sharing options...
bheffron Posted March 9, 2010 Author Share Posted March 9, 2010 ok I will try it out...thanks for the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.