1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Mastopgo2; |
4
|
|
|
|
5
|
|
|
### ============================================================= |
6
|
|
|
### Mastop InfoDigital - Paixão por Internet |
7
|
|
|
### ============================================================= |
8
|
|
|
### Classe para Manipulação de Seções |
9
|
|
|
### ============================================================= |
10
|
|
|
### Developer: Fernando Santos (topet05), [email protected] |
11
|
|
|
### Copyright: Mastop InfoDigital © 2003-2007 |
12
|
|
|
### ------------------------------------------------------------- |
13
|
|
|
### www.mastop.com.br |
14
|
|
|
### ============================================================= |
15
|
|
|
### |
16
|
|
|
### ============================================================= |
17
|
|
|
|
18
|
|
|
use XoopsModules\Mastopgo2; |
19
|
|
|
|
20
|
|
|
//require_once XOOPS_ROOT_PATH . '/modules/' . MGO_MOD_DIR . '/class/mastopgeral.class.php'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Class Section |
24
|
|
|
*/ |
25
|
|
|
class Section extends Mastop |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* Section constructor. |
29
|
|
|
* @param null $id |
|
|
|
|
30
|
|
|
*/ |
31
|
|
|
public function __construct($id = null) |
32
|
|
|
{ |
33
|
|
|
$this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
34
|
|
|
$this->tabela = $this->db->prefix(MGO_MOD_TABELA0); |
35
|
|
|
$this->id = 'sec_10_id'; |
36
|
|
|
$this->initVar('sec_10_id', XOBJ_DTYPE_INT, 0); |
37
|
|
|
$this->initVar('sec_30_nome', XOBJ_DTYPE_TXTBOX); |
38
|
|
|
if (!empty($id)) { |
39
|
|
|
if (is_array($id)) { |
40
|
|
|
$this->assignVars($id); |
41
|
|
|
} else { |
42
|
|
|
$this->load((int)$id); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param null $sec_10_id |
|
|
|
|
49
|
|
|
* |
50
|
|
|
* @return int |
51
|
|
|
*/ |
52
|
|
|
public function contaDestaques($sec_10_id = null) |
53
|
|
|
{ |
54
|
|
|
$id = empty($sec_10_id) ? $this->getVar($this->id) : $sec_10_id; |
55
|
|
|
$sec_dstac_query = $this->db->query('SELECT count(*) AS count FROM ' . $this->db->prefix(MGO_MOD_TABELA1) . ' WHERE sec_10_id = ' . $id); |
56
|
|
|
$sec_query = $this->db->fetchArray($sec_dstac_query); |
57
|
|
|
|
58
|
|
|
return (int)$sec_query['count']; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @param $altura |
63
|
|
|
* @param int $section |
64
|
|
|
* @param int $setas |
65
|
|
|
* @param int $barra |
66
|
|
|
* @param int $delay |
67
|
|
|
* @param int $transp |
68
|
|
|
* @param string $largura |
69
|
|
|
* @return bool|string |
70
|
|
|
*/ |
71
|
|
|
public function montaGaleria($altura, $section = 0, $setas = 1, $barra = 1, $delay = 6, $transp = 50, $largura = '100%') |
72
|
|
|
{ |
73
|
|
|
if (0 == $section) { |
74
|
|
|
$criterio = new \CriteriaCompo(new \Criteria('go2_12_ativo', 1)); |
75
|
|
|
} else { |
76
|
|
|
$criterio = new \CriteriaCompo(new \Criteria('sec_10_id', $section)); |
77
|
|
|
$criterio->add(new \Criteria('go2_12_ativo', 1)); |
78
|
|
|
} |
79
|
|
|
// $go2_classe = mgo_getClass(MGO_MOD_TABELA1); |
80
|
|
|
$go2_classe = new \XoopsModules\Mastopgo2\Go2(); |
81
|
|
|
$dstacs = $go2_classe->pegaTudo($criterio); |
82
|
|
|
if (is_int($largura)) { |
|
|
|
|
83
|
|
|
$largura .= 'px'; |
84
|
|
|
} |
85
|
|
|
if ($dstacs) { |
86
|
|
|
$ret = ' |
87
|
|
|
<script src="' . XOOPS_URL . '/modules/' . MGO_MOD_DIR . '/assets/js/galeria/scripts/mootools.js" type="text/javascript"></script> |
88
|
|
|
<script src="' . XOOPS_URL . '/modules/' . MGO_MOD_DIR . '/assets/js/galeria/scripts/jd.js" type="text/javascript"></script> |
89
|
|
|
<link rel="stylesheet" href="' . XOOPS_URL . '/modules/' . MGO_MOD_DIR . '/assets/js/galeria/css/jd.css" type="text/css" media="screen"> |
90
|
|
|
<style type="text/css"> |
91
|
|
|
#dstacs_' . $section . ' |
92
|
|
|
{ |
93
|
|
|
width: ' . $largura . ' !important; |
94
|
|
|
height: ' . $altura . 'px !important; |
95
|
|
|
z-index:5; |
96
|
|
|
display: none; |
97
|
|
|
border: 0; |
98
|
|
|
} |
99
|
|
|
</style> |
100
|
|
|
<script type="text/javascript"> |
101
|
|
|
function start_dstacs_' . $section . '() { |
102
|
|
|
var dstacs_' . $section . ' = new gallery($("dstacs_' . $section . '"), { |
103
|
|
|
timed: ' . ((count($dstacs) > 1) ? 'true' : 'false') . ', |
104
|
|
|
showArrows: ' . ((1 == $setas) ? 'true' : 'false') . ', |
105
|
|
|
showInfopane: ' . ((1 == $barra) ? 'true' : 'false') . ', |
106
|
|
|
delay: ' . ($delay * 1000) . ', |
107
|
|
|
slideInfoZoneOpacity: ' . (($transp > 0) ? '0.' . (int)((100 - $transp) / 10) : '1') . ', |
108
|
|
|
embedLinks: true, |
109
|
|
|
randomize: true |
110
|
|
|
}); |
111
|
|
|
} |
112
|
|
|
window.onDomReady(start_dstacs_' . $section . '); |
113
|
|
|
</script> |
114
|
|
|
<!-- Mastop Go2 - http://www.mastop.com.br/produtos/go2/ --> |
115
|
|
|
'; |
116
|
|
|
$ret .= '<div align="center"><div id="dstacs_' . $section . '">'; |
117
|
|
|
foreach ($dstacs as $v) { |
118
|
|
|
if (0 == $v->getVar('go2_11_target')) { |
119
|
|
|
$target = ''; |
120
|
|
|
} else { |
121
|
|
|
$target = "target='_blank'"; |
122
|
|
|
} |
123
|
|
|
$ret .= '<div class="imageElement">'; |
124
|
|
|
$ret .= ('' != $v->getVar('go2_30_nome')) ? '<h3><a href="' . $v->pegaLink(false, false) . '" title="' . $v->getVar('go2_30_nome') . '" ' . $target . ' class="open">' . $v->getVar('go2_30_nome') . '</a></h3>' : '<h3> </h3>'; |
125
|
|
|
$ret .= '<p></p>'; |
126
|
|
|
$ret .= $v->pegaLink(true); |
127
|
|
|
$ret .= '</div>'; |
128
|
|
|
} |
129
|
|
|
$ret .= '</div></div>'; |
130
|
|
|
|
131
|
|
|
return $ret; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
return false; |
135
|
|
|
} |
136
|
|
|
} |
137
|
|
|
|