| 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/controllers/ |
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 JLexReviewControllerSection extends JControllerLegacy
{
public function display($cachable = false, $urlparams = array())
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$view = $this->getView("section", "html");
$model = $this->getModel("section");
$layout = $app->getInput()->getCmd("layout", "default");
if($layout=="form")
{
$id = $app->getInput()->getString("id", "");
$doc->setTitle( JText::_("JR_SECTION_FORM") );
$form = $model->getForm();
if($id>0)
{
$item = $model->getSection($id);
if(!$item)
{
throw new Exception("Page Not Found!", 404);
return;
}
$form->bind($item);
}
$view->set("form", $form);
} else {
$doc->setTitle(JText::_("JR_SECTIONS"));
// filters & sorting
$q = $app->getUserStateFromRequest("jr.section.query", "q", "");
if(!preg_match("/^\s*$/", $q)) $model->set("q", $q);
$sort_field = $app->getUserStateFromRequest("jr.section.filter_order", "filter_order", "section.created");
$sort_dir = $app->getUserStateFromRequest("jr.section.filter_order_Dir", "filter_order_Dir", "DESC");
$model->set("sort", $sort_field." ".$sort_dir);
// pagination
$offset = $app->getUserStateFromRequest("jr.section.limitstart", "limitstart", 0, "int");
if($offset>0) $model->set("limitstart", $offset);
$sections = $model->getSections();
$page = $model->getPagaNav();
$view->set("sections", $sections);
$view->set("page", $page);
}
$view->setLayout($layout);
$view->display();
}
public function add()
{
$url = JUri::base(true)."/index.php?option=com_jlexreview&view=section&layout=form";
$this->setRedirect($url);
}
public function cancel()
{
$url = JUri::base(true)."/index.php?option=com_jlexreview&view=section";
$this->setRedirect($url);
}
public function save()
{
$app = JFactory::getApplication();
$model = $this->getModel("section");
$id = $app->getInput()->getInt("id", 0);
$return = $model->save();
$url = JUri::base(true)."/index.php?option=com_jlexreview&view=section";
if($return===false)
{
$errors = $model->getErrors();
foreach($errors as $error)
{
if($error instanceof Exception)
{
$app->enqueueMessage($error->getMessage(), "error");
} else {
$app->enqueueMessage($error, "error");
}
}
$url.='&layout=form';
if($id>0) $url.="&id=".$id;
}
$this->setRedirect($url);
}
public function remove()
{
$url = JUri::base(true)."/index.php?option=com_jlexreview&view=section";
$model = $this->getModel("section");
$result = $model->remove();
if($result)
{
$this->setRedirect($url, JText::_('JR_ADMIN_SECTION_DELETED'));
} else {
$this->setRedirect($url, $model->getError(), 'error');
}
}
}