Fork me on GitHub

Rapport de message :*
 

Re: Mise en forme Block ramdom pour WFDownloads

Titre du sujet : Re: Mise en forme Block ramdom pour WFDownloads
par nendo sur 07/07/2013 19:12:58

Je pense que c'est celui-là --> wfdownloads_top.php qui se trouve dans le dossier Block

<?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();
    
$type_block $options[0];

    
$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' );
switch (
$type_block
    {    
// pour le bloc: dernier fichier 
        
case "published"
            
$criteria->setSort('published'); 
            
$criteria->setOrder('DESC'); 
        break; 
        
// pour le bloc: plus téléchargé 
        
case "hits"
            
$criteria->setSort('hits'); 
            
$criteria->setOrder('DESC'); 
        break;
        
// pour le bloc: Fichiers mis à jour
        
case "date"
            
$criteria->setSort('date'); 
            
$criteria->setOrder('DESC');  
        break;
        
// pour le bloc: aléatoire 
        
case "random"
            
$criteria->setSort('RAND()'); 
        break; 
    } 
$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']);
        }
        
//Modification pour afficher la date des mises à jour *************************************
        
else
        {
            
$download['date'] = formatTimestamp($download['date'], $wfModuleConfig['dateformat']);
        }
        
// Fin Modification pour afficher la date des mises à jour ********************************
        
$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";
// Modification pour les mises à jour ******************************************************************************************
    if (
$options[0] == "date") $form .= "date";
    if (
$options[0] == "hits") $form .= "hits";
    if (
$options[0] == "rating") $form .= "rating";
    if (
$options[0] == "random") $form .= "random";
    
$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
 }
?>

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

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