Bonjour,
j'utilise le module wfdownloads et j'ai installé koivi pour la description des catégories, des fichiers, et des revues.
Tout est en html dans mes description (j'ai rajouté des 1)sauf pour la page des revue. Je ne voit pas ce qu'il faut changer pour avoir du html a la place du texte.
Auriez-vous une idée ?
review.php :
<?php
/**
* $Id: review.php,v 1.10 2007/09/30 12:52:44 m0nty_ Exp $
* Module: WF-Downloads
* Version: v2.0.5a
* Release Date: 26 july 2004
* Author: WF-Sections
* Licence: GNU
*/
include 'header.php';
include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
global $xoopsModuleConfig, $myts, $xoopsUser;
$gperm_handler =& xoops_gethandler('groupperm');
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
$cid = isset($_REQUEST['cid']) ? intval($_REQUEST['cid']) : 0;
$mid = intval($xoopsModule->getVar('mid'));
if (!$gperm_handler->checkRight("WFDownCatPerm", $cid, $groups, $mid)) {
redirect_header(WFDOWNLOADS_URL.'index.php',3, _NOPERM);
}
$op = '';
switch (isset($_REQUEST['op']) && !empty($_REQUEST['op']))
{
case "list";
$cid = isset($_GET['cid']) ? intval($_GET['cid']) : 0;
$lid = isset($_GET['lid']) ? intval($_GET['lid']) : 0;
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$download_handler = xoops_getmodulehandler('download');
$download = $download_handler->get($lid);
if ($download->getVar('published') == 0 || $download->getVar('published') > time() || $download->getVar('offline') == 1 || ($download->getVar('expired') != 0 && $download->getVar('expired') < time()) || $download->getVar('status') == 0) {
//Download not published, expired or taken offline - redirect
redirect_header(WFDOWNLOADS_URL.'index.php', 3, _MD_WFD_NODOWNLOAD);
}
$xoopsOption['template_main'] = 'wfdownloads_reviews.html';
include XOOPS_ROOT_PATH . '/header.php';
$xoTheme->addStylesheet(WFDOWNLOADS_URL.'module.css');
$xoTheme->addStylesheet(WFDOWNLOADS_URL.'thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL);
$sql = "SELECT * FROM " . $xoopsDB->prefix('wfdownloads_indexpage') . " ";
$head_arr = $xoopsDB->fetchArray($xoopsDB->query($sql));
$catarray['imageheader'] = wfd_imageheader();
$catarray['letters'] = wfd_letters();
$catarray['toolbar'] = wfd_toolbar();
$xoopsTpl->assign('catarray', $catarray);
$category_handler = xoops_getmodulehandler('category');
$category = $category_handler->get($cid);
$pathstring = $category_handler->getNicePath($cid);
$xoopsTpl->assign('category_path', $pathstring);
$xoopsTpl->assign('category_id', $cid);
$review_handler = xoops_getmodulehandler('review');
$criteria = new CriteriaCompo(new Criteria("lid", $lid));
$criteria->add(new Criteria("submit", 1));
$review_amount = $review_handler->getCount($criteria);
$criteria->setSort("date");
$criteria->setLimit(5);
$criteria->setStart($start);
$reviews = $review_handler->getObjects($criteria);
$down_arr = $download->toArray();
$xoopsTpl->assign('down_arr', $down_arr);
foreach (array_keys($reviews) as $i)
{
$down_review = $reviews[$i]->toArray();
$down_review['date'] = formatTimestamp($down_review['date'], $xoopsModuleConfig['dateformat']);
$down_review['submitter'] = xoops_getLinkedUnameFromId(intval($down_review['uid']));
$review_rating = round(number_format($down_review['rated'], 0) / 2);
$rateimg = "rate$review_rating.gif";
$down_review['rated_img'] = $rateimg;
$xoopsTpl->append('down_review', $down_review);
}
$xoopsTpl->assign('lang_review_found', sprintf(_MD_WFD_REVIEWTOTAL, $review_amount));
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
$pagenav = new XoopsPageNav($review_amount, 5 , $start, 'start', 'op=list&cid=' . $cid . '&lid=' . $lid . '', 1);
$navbar['navbar'] = $pagenav->renderNav();
$xoopsTpl->assign('navbar', $navbar);
include 'footer.php';
break;
case "default";
default:
if (!is_object($xoopsUser) && !$xoopsModuleConfig['rev_anonpost'])
{
redirect_header(XOOPS_URL . '/user.php', 1, _MD_WFD_MUSTREGFIRST);
exit();
}
if (!empty($_POST['submit']))
{
$uid = !empty($xoopsUser) ? intval($xoopsUser->getVar('uid')) : 0;
$review_handler = xoops_getmodulehandler('review');
$review = $review_handler->create();
$review->setVar('title', trim($_POST["title"]));
$review->setVar('review', trim($_POST["review"]));
$review->setVar('lid', intval($_POST["lid"]));
$review->setVar('rated', intval($_POST["rated"]));
$review->setVar('date', time());
$review->setVar('uid', $uid);
$submit = ($xoopsModuleConfig['rev_approve']) ? 1 : 0 ;
$review->setVar('submit', $submit);
if (!$review_handler->insert($review))
{
redirect_header(WFDOWNLOADS_URL.'index.php', 3, _MD_WFD_ERROR_CREATEREVIEW);
}
else
{
$database_mess = ($xoopsModuleConfig['rev_approve']) ? _MD_WFD_ISAPPROVED : _MD_WFD_ISNOTAPPROVED;
redirect_header(WFDOWNLOADS_URL.'index.php', 2, $database_mess);
}
}
else
{
include XOOPS_ROOT_PATH . '/header.php';
$xoTheme->addStylesheet(WFDOWNLOADS_URL.'module.css');
$xoTheme->addStylesheet(WFDOWNLOADS_URL.'thickbox.css');
$xoopsTpl->assign('wfdownloads_url', WFDOWNLOADS_URL);
include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$uid = !empty($xoopsUser) ? intval($xoopsUser->getVar('uid')) : 0;
echo "
<div align='center'>" . wfd_imageheader() . "</div><br />\n
<div>" . _MD_WFD_REV_SNEWMNAMEDESC . "</div>\n";
$sform = new XoopsThemeForm(_MD_WFD_REV_SUBMITREV, "reviewform", xoops_getenv('PHP_SELF'));
$sform->addElement(new XoopsFormText(_MD_WFD_REV_TITLE, 'title', 50, 255), true);
$rating_select = new XoopsFormSelect(_MD_WFD_REV_RATING, "rated", '10');
$rating_select->addOptionArray(array('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, '10' => 10));
$sform->addElement($rating_select);
$sform->addElement(new XoopsFormDhtmlTextArea(_MD_WFD_REV_DESCRIPTION, 'review', '', 15, 60), true);
$sform->addElement(new XoopsFormHidden("lid", intval($_GET['lid'])));
$sform->addElement(new XoopsFormHidden("uid", $uid));
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$sform->addElement($button_tray);
$sform->display();
include 'footer.php';
}
}
?>
class/review.php :
<?php
// $Id: review.php,v 1.6 2007/09/30 13:47:53 m0nty_ Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <
http://www.xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// URL:
http://www.xoops.org/ //
// Project: The XOOPS Project //
// -------------------------------------------------------------------------//
if (!class_exists("XoopsPersistableObjectHandler")) {
include_once XOOPS_ROOT_PATH."/modules/wfdownloads/class/object.php";
}
class WfdownloadsReview extends XoopsObject {
function WfdownloadsReview() {
$this->initVar('review_id', XOBJ_DTYPE_INT);
$this->initVar('lid', XOBJ_DTYPE_INT);
$this->initVar('title', XOBJ_DTYPE_TXTBOX);
$this->initVar('review', XOBJ_DTYPE_TXTAREA);
$this->initVar('submit', XOBJ_DTYPE_INT);
$this->initVar('date', XOBJ_DTYPE_INT);
$this->initVar('uid', XOBJ_DTYPE_INT);
$this->initVar('rated', XOBJ_DTYPE_INT);
}
function getForm() {
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
$uid = !empty($xoopsUser) ? intval($xoopsUser->getVar('uid')) : 0;
$sform = new XoopsThemeForm(_AM_WFD_REV_SNEWMNAMEDESC, "reviewform", $_SERVER['REQUEST_URI']);
$sform -> addElement(new XoopsFormText(_AM_WFD_REV_FTITLE, 'title', 30, 40, $this->getVar('title', 'e')), true);
$rating_select = new XoopsFormSelect(_AM_WFD_REV_FRATING, "rated", $this->getVar('rated'));
$rating_select -> addOptionArray(array('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9, '10' => 10));
$sform -> addElement($rating_select);
$sform -> addElement(new XoopsFormDhtmlTextArea(_AM_WFD_REV_FDESCRIPTION, 'review', $this->getVar('review', 'e'), 15, 60), true);
$approved = ($this->getVar('submit') == 0) ? 0 : 1;
$approve_checkbox = new XoopsFormCheckBox(_AM_WFD_REV_FAPPROVE, "approve", $approved);
$approve_checkbox -> addOption(1, " ");
$sform -> addElement($approve_checkbox);
$sform -> addElement(new XoopsFormHidden("lid", intval($this->getVar('lid'))));
$sform -> addElement(new XoopsFormHidden("uid", $uid));
$sform -> addElement(new XoopsFormHidden("review_id", intval($this->getVar('review_id'))));
$sform -> addElement(new XoopsFormHidden("confirm", 1));
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'save');
$button_tray -> addElement($hidden);
if ($this->isNew())
{
$butt_create = new XoopsFormButton('', '', _AM_WFD_BSAVE, 'submit');
$butt_create -> setExtra('onclick="this.form.elements.op.value=\'edit_review\'"');
$button_tray -> addElement($butt_create);
$butt_clear = new XoopsFormButton('', '', _AM_WFD_BRESET, 'reset');
$button_tray -> addElement($butt_clear);
$butt_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
$butt_cancel -> setExtra('onclick="history.go(-1)"');
$button_tray -> addElement($butt_cancel);
}
else
{
$butt_create = new XoopsFormButton('', '', _AM_WFD_BSAVE, 'submit');
$butt_create -> setExtra('onclick="this.form.elements.op.value=\'edit_review\'"');
$button_tray -> addElement($butt_create);
$butt_delete = new XoopsFormButton('', '', _AM_WFD_BDELETE, 'submit');
$butt_delete -> setExtra('onclick="this.form.elements.op.value=\'del_review\'"');
$button_tray -> addElement($butt_delete);
$butt_cancel = new XoopsFormButton('', '', _AM_WFD_BCANCEL, 'button');
$butt_cancel -> setExtra('onclick="history.go(-1)"');
$button_tray -> addElement($butt_cancel);
}
$sform -> addElement($button_tray);
return $sform;
}
/**
* Returns an array representation of the object
*
* @return array
*/
function toArray() {
$ret = array();
$vars = $this->getVars();
foreach (array_keys($vars) as $i) {
$ret[$i] = $this->getVar($i);
}
return $ret;
}
}
class WfdownloadsReviewHandler extends XoopsPersistableObjectHandler {
function WfdownloadsReviewHandler($db) {
$this->XoopsPersistableObjectHandler($db, 'wfdownloads_reviews', 'WfdownloadsReview', 'review_id', 'title');
}
}
?>