function display($tpl = null) { $this->mainframe = JFactory::getApplication(); $this->option = JRequest::getCmd('option'); $filter_order = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order', 'filter_order', 'm.title', 'string'); $filter_order_Dir = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $this->mainframe->getUserStateFromRequest($this->option . '.polls.search', 'search', '', 'string'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; JHTML::_('behavior.tooltip'); if (MijopollsHelper::is15()) { $params = $this->mainframe->getParams(); } else { $menu = JSite::getMenu()->getActive(); $menu_params = new JRegistry($menu->params); $params = clone $this->mainframe->getParams(); $params->merge($menu_params); } $this->lists = $lists; $this->params = $params; $this->items = $this->get('Data'); $this->pagination = $this->get('Pagination'); if (MijopollsHelper::is30()) { $tpl = '30'; } parent::display($tpl); }
function getItemid($poll_id) { $component = JComponentHelper::getComponent('com_mijopolls'); $menus = JApplication::getMenu('site', array()); if (MijopollsHelper::is15()) { $items = $menus->getItems('componentid', $component->id); } else { $items = $menus->getItems('component_id', $component->id); } $match = false; $item_id = ''; if (isset($items)) { foreach ($items as $item) { if (@$item->query['view'] == 'poll' && @$item->query['id'] == $poll_id) { $itemid = $item->id; $match = true; break; } } } if ($match) { $item_id = '&Itemid=' . $itemid; } return $item_id; }
function display($tpl = null) { $document = JFactory::getDocument(); $document->addStyleSheet('components/com_mijopolls/assets/css/mijopolls.css'); $cid = JRequest::getVar('cid', array(0), '', 'array'); $edit = JRequest::getVar('edit', true); $text = $edit ? JText::_('Edit') : JText::_('New'); JToolBarHelper::title(JText::_('COM_MIJOPOLLS_POLL') . ': <small><small>[ ' . $text . ' ]</small></small>', 'mijopolls'); JToolBarHelper::Preview('index.php?option=com_mijopolls&cid[]=' . $cid[0]); JToolBarHelper::save(); JToolBarHelper::apply(); JToolBarHelper::cancel(); $this->mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $row = $this->get('ItemData'); // fail if checked out not by 'me' if ($row->isCheckedOut($user->get('id'))) { $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('COM_MIJOPOLLS_THE_POLL'), $row->title); $this->setRedirect('index.php?option=com_mijopolls', $msg); } if ($row->id == 0) { $row->published = 1; } $options = array(); $ordering = array(); if ($edit) { $options = $row->getOptions($row->id); } else { $row->lag = 24 * 60; } //default colors for slices $colors = array("ff0000", "ffff99", "00ccff", "66ff99", "ffcc00", "d7ebff", "ccffcc", "cccccc", "ffff00", "006699", "660000", "ffddee"); $task = JRequest::getCmd('task'); if (MijopollsHelper::is15()) { $tpl .= '15'; $params = new JParameter($row->params, JPATH_COMPONENT . '/views/poll/poll.xml'); $this->params = $params; } else { if (MijopollsHelper::is30()) { $tpl = '30'; $this->params = $this->get('Form'); } else { if ($task != 'preview') { $tpl = '25'; $this->params = $this->get('Form'); } } } $this->row = $row; $this->options = $options; $this->color = $colors; $this->edit = $edit; parent::display($tpl); }
function display($tpl = null) { // Get data from the model require_once JPATH_COMPONENT . '/models/ajaxvote.php'; $model = new MijopollsModelAjaxvote(); $vote = $model->getVoted(); $data = $model->getData(); $total = $model->getTotal(); $poll_id = JRequest::getInt('id', 0, 'post'); if (MijopollsHelper::is15()) { // create root node $xml = new JSimpleXMLElement('poll', array('id' => $poll_id)); //get total votes $sum = 0; foreach ($data as $row) { $sum += $row->votes; } $number_voters = 0; $options = $xml->addChild('options'); for ($i = 0; $i < $total; $i++) { $option = $options->addChild('option', array('id' => $data[$i]->id, 'percentage' => self::_toPercent($data[$i]->votes, $sum), 'votes' => $data[$i]->votes, 'color' => $data[$i]->color)); $text = $option->addChild('text'); $text->setData($data[$i]->text); $number_voters += $data[$i]->votes; } $voters = $xml->addChild('voters'); $voters->setData($number_voters); $this->assign('xml', $xml->toString()); } else { // create root node $xml = new JXMLElement('<poll></poll>'); $xml->addAttribute('id', $poll_id); //get total votes $sum = 0; foreach ($data as $row) { $sum += $row->votes; } $number_voters = 0; $options = $xml->addChild('options'); for ($i = 0; $i < $total; $i++) { $option = $options->addChild('option'); $option->addAttribute('id', $data[$i]->id); $option->addAttribute('percentage', self::_toPercent($data[$i]->votes, $sum)); $option->addAttribute('color', $data[$i]->color); $option->addChild('text', $data[$i]->text); $number_voters += $data[$i]->votes; } $xml->addChild('voters', $number_voters); $this->assign('xml', $xml->asFormattedXML()); } $this->setLayout('raw'); parent::display($tpl); }
function bind($array, $ignore = '') { if (MijopollsHelper::is15()) { if (key_exists('params', $array) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = $registry->toString(); } } else { if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } } return parent::bind($array, $ignore); }
function getVoted() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $mainframe = JFactory::getApplication(); $poll_id = JRequest::getInt('id', 0); $option_id = JRequest::getInt('voteid', 0); $poll = JTable::getInstance('Poll', 'Table'); if (!$poll->load($poll_id) || $poll->published != 1) { $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH')); //JError::raiseWarning(404, JText::_('ALERTNOTAUTH')); return; } require_once JPATH_COMPONENT . '/models/poll.php'; $model = new MijopollsModelPoll(); if (MijopollsHelper::is15()) { $params = new JParameter($poll->params); $cookieName = JUtility::getHash($mainframe->getName() . 'poll' . $poll_id); } else { $params = new JRegistry($poll->params); $cookieName = JApplication::getHash($mainframe->getName() . 'poll' . $poll_id); } $voted_cookie = JRequest::getVar($cookieName, '0', 'COOKIE', 'INT'); $voted_ip = $model->ipVoted($poll, $poll_id); if ($params->get('ip_check') and ($voted_cookie or $voted_ip or !$option_id)) { if ($voted_cookie || $voted_ip) { $msg = JText::_('COM_MIJOPOLLS_ALREADY_VOTED'); $tom = "error"; } if (!$option_id) { $msg = JText::_('COM_MIJOPOLLS_NO_SELECTED'); $tom = "error"; } $this->_voted = 0; } else { if ($model->vote($poll_id, $option_id)) { $this->_voted = 1; //Set cookie showing that user has voted setcookie($cookieName, '1', time() + 60 * $poll->lag); } else { $this->_voted = 0; } } return $this->_voted = 1; }
public function ipVoted($poll, $poll_id) { if (MijopollsHelper::is15()) { $params = new JParameter($poll->params); } else { $params = new JRegistry($poll->params); } if ($params->get('ip_check') == 0) { return false; } $db = JFactory::getDBO(); $poll_id = (int) $poll_id; $ip = ip2long($_SERVER['REMOTE_ADDR']); $db->setQuery("SELECT poll_id FROM #__mijopolls_votes WHERE poll_id = '{$poll_id}' AND ip = '{$ip}'"); $res = $db->loadResult(); if (!empty($res)) { return true; } else { return false; } }
function __construct() { parent::__construct(); $this->mainframe = JFactory::getApplication(); $this->option = JRequest::getWord('option'); // Get the pagination request variables $config = JFactory::getConfig(); if (MijopollsHelper::is15()) { $config_list_limit = $config->getValue('config.list_limit'); } else { $config_list_limit = $config->get('config.list_limit'); } // Get the pagination request variables $this->setState('limit', $this->mainframe->getUserStateFromRequest('limit', 'limit', $config_list_limit, 'int')); $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int')); // In case limit has been changed, adjust limitstart accordingly $this->setState('limitstart', $this->getState('limit') != 0 ? floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit') : 0); // Get the filter request variables $this->setState('filter_order', JRequest::getCmd('filter_order', 'ordering')); $this->setState('filter_order_dir', JRequest::getCmd('filter_order_Dir', 'ASC')); }
function display($tpl = null) { $document = JFactory::getDocument(); $document->addStyleSheet('components/com_mijopolls/assets/css/mijopolls.css'); JToolBarHelper::title(JText::_('COM_MIJOPOLLS_POLLS'), 'mijopolls'); JToolBarHelper::addNew(); JToolBarHelper::editList(); JToolBarHelper::deleteList(); JToolBarHelper::divider(); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::divider(); JToolBarHelper::custom('resetVotes', 'cancel.png', 'cancel.png', JText::_('COM_MIJOPOLLS_RESET_VOTES'), true, false); JToolBarHelper::preferences('com_mijopolls', 500); $this->mainframe = JFactory::getApplication(); $this->option = JRequest::getWord('option'); $filter_order = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order', 'filter_order', 'm.title', 'string'); $filter_order_Dir = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_state = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_state', 'filter_state', '', 'word'); $search = $this->mainframe->getUserStateFromRequest($this->option . '.polls.search', 'search', '', 'string'); JHTML::_('behavior.tooltip'); // state filter $lists['state'] = JHTML::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $this->user = JFactory::getUser(); $this->lists = $lists; $this->items = $this->get('Data'); $this->pagination = $this->get('Pagination'); if (MijopollsHelper::is30()) { $tpl = '30'; } parent::display($tpl); }
function MijopollsParseRoute($segments) { $vars = array(); //Get the active menu item if there is a menu link to polls view $menu =& JSite::getMenu(); $item =& $menu->getActive(); // Count route segments $count = count($segments); //if item is not set, there is no menu linking to this view - poll if (!isset($item)) { $vars['view'] = 'poll'; $vars['id'] = $segments[$count - 1]; return $vars; } //if there is a menu to polls view -> $vars['view'] = 'poll'; $vars['id'] = $segments[$count - 1]; if (MijopollsHelper::is30()) { JRequest::set($vars, 'get'); } return $vars; }
function display($tpl = null) { $this->mainframe = JFactory::getApplication(); $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $date =& JFactory::getDate(); $document =& JFactory::getDocument(); $pathway =& $this->mainframe->getPathway(); $poll_id = JRequest::getInt('id', 0); $poll =& JTable::getInstance('Poll', 'Table'); $poll->load($poll_id); // if id value is passed and poll not published then exit if ($poll->id > 0 && $poll->published != 1) { JError::raiseError(403, JText::_('Access Forbidden')); return; } if (MijopollsHelper::is15()) { // Adds parameter handling $params =& $this->mainframe->getParams(); $pollParams = new JParameter($poll->params); $params->merge($pollParams, $params); //Set page title information $menus =& JSite::getMenu(); $menu = $menus->getActive(); // because the application sets a default page title, we need to get it // right from the menu item itself if (is_object($menu)) { $menu_params = new JParameter($menu->params); if (!$menu_params->get('page_title')) { $params->set('page_title', $poll->title); } } else { $params->set('page_title', $poll->title); } } else { // Adds parameter handling $temp = new JRegistry($poll->params); $params = clone $this->mainframe->getParams(); $params->merge($temp); //Set page title information $menu = JSite::getMenu()->getActive(); // because the application sets a default page title, we need to get it // right from the menu item itself if (is_object($menu)) { $menu_params = new JRegistry($menu->params); if (!$menu_params->get('page_title')) { $params->set('page_title', $poll->title); } else { $params->set('page_title', $menu_params->get('page_title')); } } else { $params->set('page_title', $poll->title); } } $document->setTitle($params->get('page_title')); //Set pathway information $pathway->addItem($poll->title, ''); $params->def('show_page_title', 1); $params->def('page_title', $poll->title); // Check if there is a poll corresponding to id and if poll is published if ($poll->id > 0) { if (empty($poll->title)) { $poll->id = 0; $poll->title = JText::_('COM_MIJOPOLLS_SELECT_POLL'); } //get the array of options $options =& $this->get('Options'); } else { $options = array(); } // list of polls for dropdown selection $pList = $this->get('Polls'); foreach ($pList as $k => $p) { $pList[$k]->url = JRoute::_('index.php?option=com_mijopolls&view=poll&id=' . $p->slug); } array_unshift($pList, JHTML::_('select.option', '', JText::_('COM_MIJOPOLLS_SELECT_POLL'), 'url', 'title')); // dropdown output $lists = array(); $lists['polls'] = JHTML::_('select.genericlist', $pList, 'id', 'class="inputbox" size="1" style="width:400px" onchange="if (this.options[selectedIndex].value != \'\') {document.location.href=this.options[selectedIndex].value}"', 'url', 'title', JRoute::_('index.php?option=com_mijopolls&view=poll&id=' . $poll->id . ':' . $poll->alias)); //get the number of voters $voters = isset($options[0]) ? $options[0]->voters : 0; $num_of_options = count($options); for ($i = 0; $i < $num_of_options; $i++) { $vote =& $options[$i]; //assign pie color to colors array $colors[$i] = $vote->color; //$links[$i]=$vote->link; if ($voters > 0) { $vote->percent = round(100 * $vote->hits / $voters, 1); } else { //if nobody has voted yet if ($params->get('show_what') == 1) { $vote->percent = round(100 / $num_of_options, 1); } else { $vote->percent = 0; } } } // show_what==1 because 1=show pie, 0=joomla default, 3 may be something else later //Pie chart // pass in two arrays, one of data, the other data labels $title_lenght = $params->get('title_lenght'); foreach ($options as $vote_array) { //if show hits is true if ($params->get('show_hits')) { $hits = " (" . $vote_array->hits . ")"; } else { $hits = ''; } //if show options with zero votes is true if ($params->get('show_zero_votes')) { $text = JString::substr(html_entity_decode($vote_array->text, ENT_QUOTES, "utf-8"), 0, $title_lenght) . $hits; //$values[] = array("value" => $vote_array->percent, "label" => $text, "text" => $text); $values[] = ' "value":' . $vote_array->percent . ', "label":"' . addslashes($text) . '", "text":"' . addslashes($text) . '" '; } else { //show only options that have hits if ($vote_array->percent) { $text = JString::substr(html_entity_decode($vote_array->text, ENT_QUOTES, "utf-8"), 0, $title_lenght) . $hits; //$values[] = array("value" => $vote_array->percent, "label" => $text, "text" => $text); $values[] = ' "value":' . $vote_array->percent . ', "label":"' . addslashes($text) . '", "text":"' . addslashes($text) . '" '; } } } // prepare the javascript for the pie //colors and values array to json //TODO use json_encode some day $json_colors = '["' . implode('", "', $colors) . '"]'; $json_values = '[{' . implode('}, {', $values) . '}]'; $js = ' function ofc_ready() {} function open_flash_chart_data() { return JSON.stringify(data); } var data = { "title":{ "text" : "", "style" : "font-size: 14px; font-family: Verdana; text-align: center;" }, "bg_colour" : "#' . $params->get("bg_color") . '", "elements" : [{ "type" : "pie", "tip" : "#label# \\n#val#%", "colours" : ' . $json_colors . ', "alpha" : ' . $params->get("opacity") . ', "start-angle" : ' . $params->get("start_angle") . ', "radius" : ' . $params->get("radius") . ', "no-labels" : ' . $params->get("no_labels") . ', "values" : ' . $json_values . ', "gradient-fill" : ' . $params->get("gradient") . ', "font-size" : ' . $params->get("font_size") . ', "label-colour" : "#' . $params->get("font_color") . '", "animate":[{ "distance" : ' . $params->get("bounce_dinstance") . ', "type" : "' . $params->get("animation_type") . '" }] }] }; '; //Check if the user has voted if (MijopollsHelper::is15()) { $cookieName = JUtility::getHash($this->mainframe->getName() . 'poll' . $poll_id); } else { $cookieName = JApplication::getHash($this->mainframe->getName() . 'poll' . $poll_id); } $cookieVoted = JRequest::getVar($cookieName, '0', 'COOKIE', 'INT'); $query = "SELECT date FROM #__mijopolls_votes WHERE poll_id=" . (int) $poll_id . " AND user_id=" . (int) $user->id; $db->setQuery($query); $userVoted = $db->loadResult() ? 1 : 0; $ip = ip2long($_SERVER['REMOTE_ADDR']); $query = "SELECT ip FROM #__mijopolls_votes WHERE poll_id=" . (int) $poll_id . " AND ip = '" . $ip . "'"; $db->setQuery($query); $ipVoted = $db->loadResult() ? 1 : 0; //$date->setOffset($this->mainframe->getCfg('offset')); if (MijopollsHelper::is15()) { $now = $date->toFormat(); } else { $now = $date->toSql(); } //Algorithm for shoiwing or not the poll in the component if ($params->get('allow_voting')) { if ($now > $poll->publish_up && $now < $poll->publish_down) { if ($params->get('only_registered')) { if (!$user->guest) { if ($params->get('one_vote_per_user')) { if ($userVoted) { $allowToVote = 0; $msg = JText::_('COM_MIJOPOLLS_ALREADY_VOTED'); } else { $allowToVote = 1; } } else { if ($cookieVoted) { $allowToVote = 0; $msg = JText::_('COM_MIJOPOLLS_ALREADY_VOTED'); } else { $allowToVote = 1; } } } else { $allowToVote = 0; $return = JRequest::getURI(); $return = base64_encode($return); $user_option = MijopollsHelper::is15() ? 'com_user' : 'com_users'; $link = 'index.php?option=' . $user_option . '&view=login&return=' . $return; $msg = JText::sprintf('COM_MIJOPOLLS_REGISTER_TO_VOTE', '<a href="' . $link . '">', '</a>'); } } else { if ($cookieVoted) { $allowToVote = 0; $msg = JText::_('COM_MIJOPOLLS_ALREADY_VOTED'); } else { if ($params->get('ip_check')) { if ($ipVoted) { $allowToVote = 0; $msg = JText::_('COM_MIJOPOLLS_ALREADY_VOTED'); } else { $allowToVote = 1; } } else { $allowToVote = 1; } } } } else { $allowToVote = 0; } if ($now < $poll->publish_up) { $msg = JText::_('COM_MIJOPOLLS_VOTE_NOT_STARTED'); } if ($now > $poll->publish_down) { $msg = JText::_('COM_MIJOPOLLS_VOTE_ENDED'); } } else { $allowToVote = 0; } $this->lists = $lists; $this->params = $params; $this->poll = $poll; $this->options = $options; $this->allowToVote = $allowToVote; $this->msg = $msg; $this->js = $js; if (MijopollsHelper::is30()) { $tpl = '30'; } parent::display($tpl); }
} $updateValue = ''; $poll_bars_color = $params->get('poll_bars_color'); for ($i = 0; $i < count($results); $i++) { if ($params->get('only_one_color')) { $background_color = $poll_bars_color; } else { $background_color = "' + options.item({$i}).attributes[2].nodeValue + '"; } $updateValue .= "<div style=\"width:100%\"><div style=\"padding: 3px;\">' + text.item({$i}).firstChild.nodeValue + ' - ' + options.item({$i}).attributes[1].nodeValue + '%</div><div class=\"poll_module_bar_holder\" id=\"poll_module_bar_holder" . $i . "\" style=\"width: 98%; padding:1px; border:1px solid #" . $params->get('poll_bars_border_color') . ";\"><div id=\"poll_module_bar'+options.item({$i}).attributes[0].nodeValue+'\" style=\"background:#{$background_color}; width:' + options.item({$i}).attributes[1].nodeValue + '%; height:10px;\"></div></div></div>"; } if ($params->get('show_total')) { $updateValue .= "<br /><b>" . JText::_('MOD_MIJOPOLLS_TOTAL_VOTES') . "</b>: ' + voters.item(0).firstChild.nodeValue + '"; } $js = "\n/* <![CDATA[ */\nwindow.addEvent('load', function()\n {\n\t\t\$('poll_vote_" . $poll->id . "').addEvent('submit', function(e) {\n\t\t\t\t// Prevent the submit event\n\t\t\t e.stop();\n\n\t\t\t\tvar options = \$('poll_vote_" . $poll->id . "').getElements('input[name=voteid]');\n\n\t\t\t\tvar nothing_selected = 1;\n\t\t\t\t\n\t\t\t\toptions.each(function(item, index){\n\t\t\t\t\tif(item.checked==1) {\n\t\t\t\t\t\tnothing_selected = 0;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tif (nothing_selected) {\n\t\t\t\t\talert('" . JText::_('Please select an option') . "');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t\$('submit_vote_" . $poll->id . "').disabled = 1;\n\t\t\t\t\t\$('poll_loading_" . $poll->id . "').setStyle('display', '');\n\t\t\t\t\t\n\t\t\t\t\t// Update the page\n\t\t\t\t\tthis.set('send', {\n\t\t\t\t\tonComplete: function(response, responseXML)\n\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\t// get the XML nodes\n\t\t\t\t\t\tvar root = responseXML.documentElement;\n\t\t\t\t\t\tvar options = root.getElementsByTagName('option');\n\t\t\t\t\t\tvar text = root.getElementsByTagName('text');\n\t\t\t\t\t\tvar voters = root.getElementsByTagName('voters');\n\t\t\t\t\t\t\n\t\t\t\t\t\t// update the page element\n\t\t\t\t\t\t"; if (MijopollsHelper::is30()) { $js .= "jQuery('polldiv_" . $poll->id . "').hide();"; } else { $js .= "var slide = new Fx.Slide('polldiv_" . $poll->id . "').hide();"; } $js .= "\$('polldiv_" . $poll->id . "').innerHTML = '" . $updateValue . "';\n\t\t\t\t\t\tslide.slideIn();\n\t\t\t\t\t}\n\t\t\t\t\t}).send();\n\t\t\t\t}\n }); \n });/* ]]> */"; $document->addScriptDeclaration($js); } //If user has voted } else { foreach ($results as $row) { $percent = $row->votes ? round(100 * $row->hits / $row->votes, 1) : 0; $width = $percent ? $percent : 2; if ($params->get('only_one_color')) { $background_color = $params->get('poll_bars_color'); } else {
//if user has not voted } else { //display the poll $display_poll = 1; $display_submit = 1; $msg = ""; } } //if the user has not logged in } else { //display message please log in $display_poll = 1; $display_submit = 0; $return = JRequest::getURI(); $return = base64_encode($return); $user_option = MijopollsHelper::is15() ? 'com_user' : 'com_users'; $link = 'index.php?option=' . $user_option . '&view=login&return=' . $return; $msg = JText::sprintf('MOD_MIJOPOLLS_PLEASE_REGISTER_TO_VOTE', '<a href="' . $link . '">', '</a>'); } // if anybody can vote } else { //if user has voted, according to the cookie check if ($voted) { //display the poll with disabled options or the results $display_poll = 0; $display_submit = 0; $msg = JText::_("MOD_MIJOPOLLS_ALREADY_VOTED"); $details = JText::sprintf("MOD_MIJOPOLLS_ONLY_ONE_VOTE_PER_HOUR", $poll->lag / 60); //if user has not voted according to the cookie } else { //hm check the ip please but only if allowed to do that
</td><?php } ?> </tr> </thead> <tbody> <?php $k = 0; $n = count($this->items); for ($i = 0; $i < $n; $i++) { $row =& $this->items[$i]; //find the Itemid that correspondents to the link if any. $component =& JComponentHelper::getComponent('com_mijopolls'); $menus =& JApplication::getMenu('site', array()); if (MijopollsHelper::is15()) { $menu_items = $menus->getItems('componentid', $component->id); } else { $menu_items = $menus->getItems('component_id', $component->id); } $itemid = null; if (isset($menu_items)) { foreach ($menu_items as $item) { if (@$item->query['view'] == 'poll' && @$item->query['id'] == $row->id) { $itemid = '&Itemid=' . $item->id; break; } } } $link = JRoute::_('index.php?option=com_mijopolls&view=poll&id=' . $row->slug . $itemid); ?>