人人商城

module.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class VideoModule extends WeModule {
  8. public $tablename = 'video_reply';
  9. public function fieldsFormDisplay($rid = 0) {
  10. global $_W;
  11. load()->func('tpl');
  12. if (!empty($rid)) {
  13. $replies = pdo_fetch("SELECT * FROM ".tablename($this->tablename)." WHERE rid = :rid", array(':rid' => $rid));
  14. $replies = istripslashes($replies);
  15. }
  16. include $this->template('form');
  17. }
  18. public function fieldsFormValidate($rid = 0) {
  19. global $_GPC;
  20. if(empty($_GPC['title'])) {
  21. return '必须填写有效的视频标题.';
  22. }
  23. if (empty($_GPC['mediaid'])) {
  24. return '必须上传有效的视频.';
  25. }
  26. $this->replies['title'] = $_GPC['title'];
  27. $this->replies['mediaid'] = $_GPC['mediaid'];
  28. $this->replies['description'] = $_GPC['description'];
  29. $this->replies['createtime'] = time();
  30. return '';
  31. }
  32. public function fieldsFormSubmit($rid = 0) {
  33. global $_GPC, $_W;
  34. pdo_delete($this->tablename, array('rid' => $rid));
  35. $this->replies['rid'] = $rid;
  36. pdo_insert($this->tablename, $this->replies);
  37. return true;
  38. }
  39. public function ruleDeleted($rid = 0) {
  40. global $_W;
  41. $replies = pdo_fetchall("SELECT id FROM ".tablename($this->tablename)." WHERE rid = '$rid'");
  42. $deleteid = array();
  43. if (!empty($replies)) {
  44. foreach ($replies as $index => $row) {
  45. $deleteid[] = $row['id'];
  46. }
  47. }
  48. pdo_delete($this->tablename, "id IN ('".implode("','", $deleteid)."')");
  49. return true;
  50. }
  51. }