| 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_JComment extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
protected $type = 'Modal_JComment';
/**
* 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 jSelectJReviewComment_' . $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("#modalJReviewComment' . $this->id . '").modal("hide");';
$script[] = '}';
// Clear button script
static $scriptClear;
if (!$scriptClear)
{
$scriptClear = true;
$script[] = 'function jClearJReviewComment(id) {';
$script[] = ' document.getElementById(id + "_id").value = "";';
$script[] = ' document.getElementById(id + "_name").value = "' .
htmlspecialchars( "No parent comment", ENT_COMPAT, 'UTF-8') . '";';
$script[] = ' jQuery("#"+id + "_clear").addClass("hidden");';
$script[] = ' if (document.getElementById(id + "_edit")) {';
$script[] = ' jQuery("#"+id + "_edit").addClass("hidden");';
$script[] = ' }';
$script[] = ' return false;';
$script[] = '}';
}
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Setup variables for display.
$id = JFactory::getApplication()->getInput()->getInt("id", 0);
$html = array();
$link = 'index.php?option=com_jlexreview&view=cm&layout=modal&tmpl=component&function=jSelectJReviewComment_' . $this->id;
if ($id>0)
{
$link.= '&except_cm=' . $id;
}
if ((int) $this->value > 0)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('comment'))
->from($db->quoteName('#__jlexreview_cm'))
->where($db->quoteName('id') . ' = ' . (int) $this->value);
$db->setQuery($query);
$title = $db->loadResult();
if (!$title) {
$title = "Comment not found.";
} else {
$title = substr ($title, 0, 20) . "...";
}
}
if (empty($title))
{
$title = "No parent comment";
}
$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',
'modalJReviewComment' . $this->id,
array(
'url' => $link,
'title' => "Select parent comment",
'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[] = '<a href="#modalJReviewComment' . $this->id . '" class="btn btn-primary button-select" role="button" data-toggle="modal" data-bs-toggle="modal" title="'
. JHtml::tooltipText("Add parent comment") . '">'
. JText::_('JSELECT') . '</a>';
} else {
$html[] = '<a href="#modalJReviewComment' . $this->id . '" class="btn hasTooltip" role="button" data-toggle="modal" title="'
. JHtml::tooltipText("Add parent comment") . '">'
. '<span class="icon-file"></span> '
. JText::_('JSELECT') . '</a>';
}
// Clear article button
$html[] = '<button id="' . $this->id . '_clear" class="btn' . ($value ? '' : ' hidden') . '" onclick="return jClearJReviewComment(\'' .
$this->id . '\')"><span class="icon-remove"></span>' . JText::_('JCLEAR') . '</button>';
$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());
}
}