comments.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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`, `Name`, `TableCmts`, `TableTrack`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Nl2br`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `BaseUrl`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldTitle`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
  16. (1, 'sample', 'sample_cmts', 'sample_cmts_track', 1, 5000, 1000, 1, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'samples/comments.php', 'sample_cmts_trigger', 'id', 'title', 'comments', '', '');
  17. CREATE TABLE IF NOT EXISTS `sample_cmts` (
  18. `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
  19. `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
  20. `cmt_vparent_id` int(11) NOT NULL DEFAULT '0',
  21. `cmt_object_id` int(11) NOT NULL DEFAULT '0',
  22. `cmt_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  23. `cmt_level` int(11) NOT NULL DEFAULT '0',
  24. `cmt_text` text NOT NULL,
  25. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  26. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  27. `cmt_time` int(11) unsigned NOT NULL DEFAULT '0',
  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 `sample_cmts_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. CREATE TABLE IF NOT EXISTS `sample_cmts_trigger` (
  42. `id` int(11) NOT NULL AUTO_INCREMENT,
  43. `title` varchar(64) NOT NULL DEFAULT '0',
  44. `comments` int(11) NOT NULL DEFAULT '0',
  45. PRIMARY KEY (`id`)
  46. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  47. INSERT INTO `sample_cmts_trigger` (`id`, `title`, `comments`) VALUES
  48. (1, 'Sample Comments', 0);
  49. */
  50. $aPathInfo = pathinfo(__FILE__);
  51. require_once ($aPathInfo['dirname'] . '/../inc/header.inc.php');
  52. require_once(BX_DIRECTORY_PATH_INC . "params.inc.php");
  53. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  54. bx_import('BxDolAcl');
  55. bx_import('BxDolLanguages');
  56. bx_import('BxTemplFunctions');
  57. $oTemplate = BxDolTemplate::getInstance();
  58. $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
  59. $oTemplate->setPageHeader ('Comments');
  60. $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
  61. $oTemplate->getPageCode();
  62. /**
  63. * page code function
  64. */
  65. function PageCompMainCode() {
  66. $iObjectId = 1;
  67. bx_import('BxTemplCmtsView');
  68. $oCmts = new BxTemplCmtsView('sample', $iObjectId);
  69. if(!$oCmts->isEnabled())
  70. return '';
  71. return DesignBoxContent("Comments", $oCmts->getCommentsBlock(), BX_DB_PADDING_DEF);
  72. }
  73. /** @} */