comments.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Samples
  7. * @{
  8. */
  9. /**
  10. * @page samples
  11. * @section comments Comments
  12. */
  13. /**
  14. * DB Queries.
  15. INSERT INTO `sys_objects_cmts` (`ID`, `ObjectName`, `TableCmts`, `TableTrack`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Nl2br`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
  16. (1, 'profile', 'sys_cmts_sample', 'sys_cmts_sample_track', 3, 2048, 100, 1, 5, 3, 'tail', 1, 'both', 1, 1, 1, -3, 1, 'cmt', '', '', '', '', '');
  17. CREATE TABLE IF NOT EXISTS `sys_cmts_sample` (
  18. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  19. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  20. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  21. `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  22. `cmt_level` int(11) NOT NULL DEFAULT '0',
  23. `cmt_text` text NOT NULL,
  24. `cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
  25. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  26. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  27. `cmt_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  28. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  29. PRIMARY KEY (`cmt_id`),
  30. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
  31. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  32. CREATE TABLE IF NOT EXISTS `sys_cmts_sample_track` (
  33. `cmt_system_id` int(11) NOT NULL DEFAULT '0',
  34. `cmt_id` int(11) NOT NULL DEFAULT '0',
  35. `cmt_rate` tinyint(4) NOT NULL DEFAULT '0',
  36. `cmt_rate_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  37. `cmt_rate_author_nip` int(11) unsigned NOT NULL DEFAULT '0',
  38. `cmt_rate_ts` int(11) NOT NULL DEFAULT '0',
  39. PRIMARY KEY (`cmt_system_id`,`cmt_id`,`cmt_rate_author_nip`)
  40. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  41. */
  42. $aPathInfo = pathinfo(__FILE__);
  43. require_once ($aPathInfo['dirname'] . '/../inc/header.inc.php');
  44. require_once(BX_DIRECTORY_PATH_INC . "params.inc.php");
  45. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  46. bx_import('BxDolAcl');
  47. bx_import('BxDolLanguages');
  48. bx_import('BxTemplFunctions');
  49. $oTemplate = BxDolTemplate::getInstance();
  50. $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
  51. $oTemplate->setPageHeader ("Comments");
  52. $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
  53. $oTemplate->getPageCode();
  54. /**
  55. * page code function
  56. */
  57. function PageCompMainCode() {
  58. $iAccountId = getLoggedId();
  59. bx_import('BxTemplCmtsView');
  60. $oCmts = new BxTemplCmtsView('profile', (int)$iAccountId);
  61. if(!$oCmts->isEnabled())
  62. return '';
  63. return DesignBoxContent("Comments", $oCmts->getCommentsBlock(), BX_DB_PADDING_DEF);
  64. }
  65. /** @} */