setQuery("SELECT * FROM #__menu WHERE link LIKE '%option=com_poll%' and published <> '-2'"); $menus = $database->loadObjectList(); if (count($menus)) { // test to make sure option is com_poll and not something like com_pollextended $uri = new mosUriHelper(); $testIds = array(); foreach ($menus as $menu) { $uri->setUri($menu->link); if ( $uri->get('option') == 'com_poll' ) $testIds[] = $menu->id; } if ( count($testIds) ) $menuId = $testIds[0]; } } $query1 = "SELECT p.id, p.title" ."\nFROM #__polls AS p, #__poll_menu AS pm" ."\nWHERE (pm.menuid='$Itemid' OR pm.menuid='0') AND p.id=pm.pollid" ."\nAND p.published=1"; $database->setQuery( $query1 ); $polls = $database->loadObjectList(); // Scrub the Itemid if it isnt an existing polls menu item $Itemid = $menuId ? $menuId : '0'; if($database->getErrorNum()) { echo "MB ".$database->stderr(true); return; } if ($polls) foreach ($polls as $poll) { if ($poll->id && $poll->title) { $query = "SELECT id, text FROM #__poll_data" . "\nWHERE pollid='$poll->id' AND text <> ''" . "\nORDER BY id"; $database->setQuery($query); if(!($options = $database->loadObjectList())) { echo "MD ".$database->stderr(true); return; } poll_vote_form_html( $poll, $options, $Itemid ); } } } function poll_vote_form_html( &$poll, &$options, $Itemid ) { $tabclass_arr=array("sectiontableentry2","sectiontableentry1"); $tabcnt = 0; $ItemidStr = ($Itemid?"&Itemid=$Itemid":''); ?>
id{$ItemidStr}"); ?>">
title; ?>
   id{$ItemidStr}"); ?>';" />