[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/content/vote/tmpl/ -> vote.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Content.vote
   6   *
   7   * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\HTML\HTMLHelper;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\Uri\Uri;
  16  
  17  /**
  18   * Layout variables
  19   * -----------------
  20   * @var   string   $context  The context of the content being passed to the plugin
  21   * @var   object   &$row     The article object
  22   * @var   object   &$params  The article params
  23   * @var   integer  $page     The 'page' number
  24   * @var   array    $parts    The context segments
  25   * @var   string   $path     Path to this file
  26   */
  27  
  28  $uri = clone Uri::getInstance();
  29  $uri->setVar('hitcount', '0');
  30  
  31  // Create option list for voting select box
  32  $options = array();
  33  
  34  for ($i = 1; $i < 6; $i++) {
  35      $options[] = HTMLHelper::_('select.option', $i, Text::sprintf('PLG_VOTE_VOTE', $i));
  36  }
  37  
  38  ?>
  39  <form method="post" action="<?php echo htmlspecialchars($uri->toString(), ENT_COMPAT, 'UTF-8'); ?>" class="form-inline mb-2">
  40      <span class="content_vote">
  41          <label class="visually-hidden" for="content_vote_<?php echo (int) $row->id; ?>"><?php echo Text::_('PLG_VOTE_LABEL'); ?></label>
  42          <?php echo HTMLHelper::_('select.genericlist', $options, 'user_rating', 'class="form-select form-select-sm w-auto"', 'value', 'text', '5', 'content_vote_' . (int) $row->id); ?>
  43          <input class="btn btn-sm btn-primary" type="submit" name="submit_vote" value="<?php echo Text::_('PLG_VOTE_RATE'); ?>">
  44          <input type="hidden" name="task" value="article.vote">
  45          <input type="hidden" name="hitcount" value="0">
  46          <input type="hidden" name="url" value="<?php echo htmlspecialchars($uri->toString(), ENT_COMPAT, 'UTF-8'); ?>">
  47          <?php echo HTMLHelper::_('form.token'); ?>
  48      </span>
  49  </form>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer