| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/administrator/components/com_jlexreview/models/fields/ |
Upload File : |
<?php
/**
* @package JLex Review
* @version 4.2.3
* @copyright Copyright (c) 2013-2018 JLexArt. All rights reserved
* @license GNU General Public License version 2 or later;
* @author www.jlexart.com
*/
defined('_JEXEC') or die;
class JFormFieldModal_JReview extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Modal_JReview';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*
* @since 1.6
*/
protected function getInput()
{
// Build the script.
$script = array();
// Select button script
$script[] = 'function jSelectJReviewRating_' . $this->id . '(id, title) {';
$script[] = 'document.getElementById("' . $this->id . '_id").value = id;';
$script[] = 'document.getElementById("' . $this->id . '_name").value = title;';
$script[] = 'jQuery("#' . $this->id . '_clear").removeClass("hidden");';
$script[] = 'jQuery("#modalJReviewRating' . $this->id . '").modal("hide");';
$script[] = '}';
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = 'index.php?option=com_jlexreview&view=reviews&layout=modal&tmpl=component&function=jSelectJReviewRating_' . $this->id;
if ((int) $this->value > 0)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__jlexreview'))
->where($db->quoteName('id') . ' = ' . (int) $this->value);
$db->setQuery($query);
$title = $db->loadResult();
if (!$title)
{
$title = "Review not selected.";
} else {
$title = substr ($title, 0, 20) . "...";
}
}
if (empty($title))
{
$title = "Select a review";
}
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The active article id field.
if (0 == (int) $this->value)
{
$value = '';
} else {
$value = (int) $this->value;
}
// The current article display field.
$html[] = JE_JVERSION=="J4"?'<div class="input-group">':'<span class="input-append">';
$html[] = '<input type="text" class="input-medium form-control" id="' . $this->id . '_name" value="' . $title . '" disabled="disabled" size="35" />';
$html[] = JHtml::_(
'bootstrap.renderModal',
'modalJReviewRating' . $this->id,
array(
'url' => $link,
'title' => "Select a review",
'width' => '800px',
'height' => '400px',
'footer' => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
)
);
if(JE_JVERSION=="J4")
{
$html[] = '<span class="input-group-append">';
$html[] = '<a href="#modalJReviewRating' . $this->id . '" class="btn btn-primary button-select" role="button" data-bs-toggle="modal" data-toggle="modal">'
. JText::_('JSELECT') . '</a>';
$html[] = '</span>';
} else {
$html[] = '<a href="#modalJReviewRating' . $this->id . '" class="btn hasTooltip" role="button" data-toggle="modal" title="'
. JHtml::tooltipText("Select a review") . '">'
. '<span class="icon-file"></span> '
. JText::_('JSELECT') . '</a>';
}
$html[] = JE_JVERSION=="J4"?'</div>':'</span>';
$html[] = '<input type="hidden" id="' . $this->id . '_id" name="' . $this->name . '" value="' . $value . '" />';
return implode("\n", $html);
}
/**
* Method to get the field label markup.
*
* @return string The field label markup.
*
* @since 3.4
*/
protected function getLabel()
{
return str_replace($this->id, $this->id . '_id', parent::getLabel());
}
}