|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* TDMDownload |
|
4
|
|
|
* |
|
5
|
|
|
* You may not change or alter any portion of this comment or credits |
|
6
|
|
|
* of supporting developers from this source code or any supporting source code |
|
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
8
|
|
|
* This program is distributed in the hope that it will be useful, |
|
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
11
|
|
|
* |
|
12
|
|
|
* @copyright Gregory Mage (Aka Mage) |
|
13
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
14
|
|
|
* @author Gregory Mage (Aka Mage) |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
if (!defined("XOOPS_ROOT_PATH")) { |
|
18
|
|
|
die("XOOPS root path not defined"); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
class TDMDownloads_votedata extends XoopsObject |
|
22
|
|
|
{ |
|
23
|
|
|
// constructor |
|
24
|
|
|
public function __construct() |
|
25
|
|
|
{ |
|
26
|
|
|
$this->initVar("ratingid",XOBJ_DTYPE_INT,null,false,11); |
|
27
|
|
|
$this->initVar("lid",XOBJ_DTYPE_INT,null,false,11); |
|
28
|
|
|
$this->initVar("ratinguser",XOBJ_DTYPE_INT,null,false,11); |
|
29
|
|
|
$this->initVar("rating",XOBJ_DTYPE_OTHER,null,false,3); |
|
30
|
|
|
$this->initVar("ratinghostname",XOBJ_DTYPE_TXTBOX, null, false); |
|
31
|
|
|
$this->initVar("ratingtimestamp",XOBJ_DTYPE_INT,null,false,10); |
|
32
|
|
|
} |
|
33
|
|
|
public function TDMDownloads_votedata() |
|
34
|
|
|
{ |
|
35
|
|
|
$this->__construct(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function getForm($lid, $action = false) |
|
39
|
|
|
{ |
|
40
|
|
|
global $xoopsDB, $xoopsModule, $xoopsModuleConfig; |
|
41
|
|
|
if ($action === false) { |
|
42
|
|
|
$action = $_SERVER['REQUEST_URI']; |
|
|
|
|
|
|
43
|
|
|
} |
|
44
|
|
|
if (!$this->isNew()) { |
|
45
|
|
|
$rating = 11; |
|
46
|
|
|
} else { |
|
47
|
|
|
$rating = $this->getVar('rating'); |
|
48
|
|
|
} |
|
49
|
|
|
$form = new XoopsThemeForm(_MD_TDMDOWNLOADS_SINGLEFILE_RATHFILE, 'rateform', 'ratefile.php', 'post'); |
|
50
|
|
|
$form->setExtra('enctype="multipart/form-data"'); |
|
51
|
|
|
$rating = new XoopsFormSelect(_MD_TDMDOWNLOADS_RATEFILE_VOTE, 'rating', $rating); |
|
52
|
|
|
$options = array('11' => '--', '10' => '10', '9' => '9','8' => '8','7' => '7','6' => '6','5' => '5','4' => '4','3' => '3','2' => '2','1' => '1','0' => '0'); |
|
53
|
|
|
$rating->addOptionArray($options); |
|
54
|
|
|
$form->addElement($rating, true); |
|
55
|
|
|
$form->addElement(new XoopsFormCaptcha(), true); |
|
56
|
|
|
$form->addElement(new XoopsFormHidden('op', 'save')); |
|
57
|
|
|
$form->addElement(new XoopsFormHidden('lid', $lid)); |
|
58
|
|
|
// Submit button |
|
59
|
|
|
$button_tray = new XoopsFormElementTray('' ,''); |
|
60
|
|
|
$button_tray->addElement(new XoopsFormButton('', 'post', _MD_TDMDOWNLOADS_RATEFILE_RATE, 'submit')); |
|
61
|
|
|
$form->addElement($button_tray); |
|
62
|
|
|
|
|
63
|
|
|
return $form; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
class TDMDownloadstdmdownloads_votedataHandler extends XoopsPersistableObjectHandler |
|
68
|
|
|
{ |
|
69
|
|
|
public function __construct(&$db) |
|
70
|
|
|
{ |
|
71
|
|
|
parent::__construct($db, "tdmdownloads_votedata", 'tdmdownloads_votedata', 'ratingid', 'lid'); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|