Fork me on GitHub

Rapport de message :*
 

Re: Augmenter le nombre de caractére dans un bloc du module WFDownloads

Titre du sujet : Re: Augmenter le nombre de caractére dans un bloc du module WFDownloads
par nendo sur 03/06/2013 23:34:27

Voici le code du fichier wfdownloads_top qui se trouve dans le dossier blocks du module wfdownloads

<?php
/**
 * $Id: wfdownloads_top.php,v 1.5 2007/05/13 19:38:07 m0nty_ Exp $
 * Module: WF-Downloads
 * Version: v2.0.5a
 * Release Date: 26 july 2004
 * Author: WF-Sections
 * Licence: GNU
 */

/**
 * Function: b_mydownloads_top_show
 * Input   : $options[0] = date for the most recent downloads
 *                     hits for the most popular downloads
 *            $block['content'] = The optional above content
 *            $options[1]   = How many downloads are displayes
 * Output  : Returns the most recent or most popular downloads
 */
include_once XOOPS_ROOT_PATH '/class/xoopsform/grouppermform.php';

function 
b_wfdownloads_top_show($options)
{
    global 
$xoopsUser;

    
$block = array();

    
$modhandler xoops_gethandler('module');
    
$wfModule $modhandler->getByDirname("wfdownloads");
    
$config_handler xoops_gethandler('config');
    
$wf_mid intval($wfModule->getVar('mid'));
    
$wfModuleConfig $config_handler->getConfigsByCat(0$wf_mid);

    
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : array(0=>XOOPS_GROUP_ANONYMOUS);
    
$gperm_handler = &xoops_gethandler('groupperm');
    
$allowed_cats $gperm_handler->getItemIds("WFDownCatPerm"$groups$wf_mid);

$criteria = new CriteriaCompo();
$criteria->add( new Criteria('cid''(' implode(','$allowed_cats) . ')''IN') );
$criteria->add( new Criteria('offline'0), 'AND' );
$criteria->add( new Criteria('status',0,'!='), 'AND' );
$criteria->setSort($options[0]);
$criteria->setOrder('DESC');
$criteria->setLimit($options[1]);

$download_handler xoops_getmodulehandler('download''wfdownloads');
$downloads $download_handler->getObjects($criteria);


    foreach (
array_keys($downloads) as $i) {
        
$download $downloads[$i]->toArray();
        if (!
in_array(intval($download['cid']), $allowed_cats))
        {
            continue;
        }
        
$download['title'] =  xoops_substr($download['title'], 0, ($options[2] -1));
        
$download['id'] = intval($download['lid']);
        if (
$options[0] == "published")
        {
            
$download['date'] = formatTimestamp($download['published'], $wfModuleConfig['dateformat']);
        }
        else
        {
            
$download['date'] = formatTimestamp($download['date'], $wfModuleConfig['dateformat']);
        }
        
$download['dirname'] = $wfModule->dirname();
        
$block['downloads'][] = $download;
    }
    return 
$block;
}

function 
b_wfdownloads_top_edit($options)
{
    
$form "" _MB_WFD_DISP "&nbsp;";
    
$form .= "<input type='hidden' name='options[]' value='";
    if (
$options[0] == "published")
    {
        
$form .= "published'";
} else{    
    if (
$options[0] == "date"$form .= "date'";
    if (
$options[0] == "hits"$form .= "hits'";
    
$form .= " />";
    
$form .= "<input type='text' name='options[]' value='" $options[1] . "' />&nbsp;" _MB_WFD_FILES "";
    
$form .= "&nbsp;<br />" _MB_WFD_CHARS "&nbsp;<input type='text' name='options[]' value='" $options[2] . "' />&nbsp;" _MB_WFD_LENGTH "";
    return 
$form;
 }
}
?>


merci
Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

65 Personne(s) en ligne (51 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 65 | Plus ...