Files
dolibarr/htdocs/core/ajax/getnews.php
lamrani abdelwadoud 5fcca27fc4 NEW display when click on NEWS templateDrop down for model (#30332)
* New update for templateMail by creating files

* New updating for get php content

* Update html.formmail.class.php

* Fix updating content news

* Fix CTI Errors

* edit html file for news

* NEW display for news with option

* replace file in ajax folder

* fix multiselect news

* Fix phan errors and remove part of useless css

* Fix brakets needed in script

* Fix Phan errors

* Fix display multiselect and fix security injection

* cancel removing part of code for classe modelMail

* Fix phstan errors

* Fix space line

* Fix error phpStan

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-09-17 15:37:34 +02:00

49 lines
1.1 KiB
PHP

<?php
// Just for display errors in editor
ini_set('display_errors', 1);
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
top_httphead();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && GETPOSTISSET('selectedIds')) {
$selectedIds = json_decode(GETPOST('selectedIds'), true);
$websitepage = new WebsitePage($db);
$selectedPosts = array();
foreach ($selectedIds as $id) {
$blog = new WebsitePage($db);
$blog->fetch($id);
$selectedPosts[] = array(
'id' => $blog->id,
'title' => $blog->title,
'description' => $blog->description,
'date_creation' => $blog->date_creation,
'image' => $blog->image,
);
}
print json_encode($selectedPosts);
} else {
print json_encode(array('error' => 'Invalid request'));
}