Esempio n. 1
0
function dt_block_tags($options)
{
    global $db, $xoopsModule;
    if ($xoopsModule && $xoopsModule->dirname() == 'dtransport') {
        global $xoopsModuleConfig;
        $mc =& $xoopsModuleConfig;
    } else {
        $util =& RMUtils::getInstance();
        $mc =& $util->moduleConfig('dtransport');
    }
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dttag.class.php';
    $sql = "SELECT MAX(hits) FROM " . $db->prefix('dtrans_tags');
    list($maxhit) = $db->fetchRow($db->query($sql));
    $sql = "SELECT * FROM " . $db->prefix('dtrans_tags');
    if ($options[2] < 1) {
        $sql .= " WHERE hits>0";
    }
    $sql .= " LIMIT 0,{$options['0']}";
    $result = $db->query($sql);
    $sz = $options[1] / $maxhit;
    $block = array();
    while ($row = $db->fetchArray($result)) {
        $tag = new DTTag();
        $tag->assignVars($row);
        $link = XOOPS_URL . "/modules/dtransport/" . ($mc['urlmode'] ? "tag/" . $tag->tag() : "tags.php?id=" . $tag->tag());
        $size = intval($tag->hit() * $sz);
        if ($size < $options[3]) {
            $size = $options[3];
        }
        $rtn = array();
        $rtn['id'] = $tag->id();
        $rtn['tag'] = $tag->tag();
        $rtn['hits'] = $tag->hit();
        $rtn['link'] = $link;
        $rtn['size'] = $size;
        $block['tags'][] = $rtn;
    }
    $block['font'] = $options[4];
    return $block;
}
 /**
  * @desc Obtiene las etiquestas a las que pertenece el software
  * @param bool True devuelve como objetos
  * @return array
  **/
 public function tags($asobj = false)
 {
     $tbl1 = $this->db->prefix("dtrans_softtag");
     $tbl2 = $this->db->prefix("dtrans_tags");
     if (empty($this->_tags) || $asobj && !is_a($this->_tags[0], 'DTTag')) {
         $this->_tags = array();
         $sql = "SELECT b.* FROM {$tbl1} a, {$tbl2} b WHERE a.id_soft='" . $this->id() . "' AND b.id_tag=a.id_tag";
         $result = $this->db->queryF($sql);
         while ($rows = $this->db->fetchArray($result)) {
             if ($asobj) {
                 $tmp = new DTTag();
                 $tmp->assignVars($rows);
             } else {
                 $tmp = $rows['id_tag'];
             }
             $this->_tags[] = $tmp;
         }
     }
     return $this->_tags;
 }
Esempio n. 3
0
}
// Imágenes de la Descarga
$imgs = $item->screens(true);
$xoopsTpl->assign('screens_count', $item->getVar('screens'));
$data['screens'] = array();
foreach ($imgs as $img) {
    $data['screens'][] = array('id' => $img->id(), 'title' => $img->title(), 'image' => $img->url(), 'ths' => $img->url('ths'));
}
unset($imgs, $img);
//Etiquetas
$tags = $item->tags(false);
$relatedTags = array();
$data['tags'] = array();
foreach ($tags as $tag) {
    $otag = new DTTag();
    $otag->assignVars($tag);
    $data['tags'][] = array('id' => $tag['id_tag'], 'name' => $tag['tag'], 'link' => $otag->permalink());
    $relatedTags[] = $tag['id_tag'];
}
unset($tags, $otag, $tag);
// Categories
$cats = $item->categories(true);
$data['categories'] = array();
foreach ($cats as $ocat) {
    $data['categories'][] = array('id' => $ocat->id(), 'name' => $ocat->name(), 'link' => $ocat->permalink());
}
unset($ocat, $cats, $cat);
// Características
$chars = $item->features(true);
$data['features'] = array();
foreach ($chars as $feature) {