人人商城

module.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 CustomModule extends WeModule {
  8. public $tablename = 'custom_reply';
  9. private $replies = '';
  10. public function fieldsFormDisplay($rid = 0) {
  11. if(!empty($rid) && $rid > 0) {
  12. $isexists = pdo_fetch("SELECT id FROM ".tablename('rule')." WHERE id = :id", array(':id' => $rid));
  13. }
  14. if(!empty($isexists)) {
  15. $replies = pdo_fetch("SELECT * FROM ".tablename($this->tablename)." WHERE rid = :rid ORDER BY `id`", array(':rid' => $rid));
  16. }
  17. include $this->template('display');
  18. }
  19. public function fieldsFormValidate($rid = 0) {
  20. global $_GPC;
  21. if($_GPC['start1'] == '-1' && $_GPC['end1'] == '-1' && $_GPC['start2'] == '-1' && $_GPC['end2'] == '-1') {
  22. return '没有选择有效的接入时间段';
  23. }
  24. if($_GPC['start2'] != '-1' && ($_GPC['end1'] > $_GPC['start2'])) {
  25. return '第一个时间段的结束日期大于第二个时间段的开始时间.';
  26. }
  27. return '';
  28. }
  29. public function fieldsFormSubmit($rid = 0) {
  30. global $_GPC;
  31. pdo_delete($this->tablename, array('rid' => $rid));
  32. pdo_insert($this->tablename, array('rid' => $rid, 'start1' => $_GPC['start1'], 'end1' => $_GPC['end1'], 'start2' => $_GPC['start2'], 'end2' => $_GPC['end2']));
  33. return true;
  34. }
  35. public function ruleDeleted($rid = 0) {
  36. pdo_delete($this->tablename, array('rid' => $rid));
  37. }
  38. }