comments.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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` (`ObjectName`, `TableCmts`, `TableTrack`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Nl2br`, `PerView`, `PerViewReplies`, `NumberOfLevels`, `IsLevelsSwitch`, `Show`, `IsShowSwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
  16. ('profile', 'sys_cmts_profile', 'sys_cmts_track', 3, 2048, 100, 1, 5, 3, 0, 0, 'tail', 0, 1, -3, 1, 'cmt', '', '', '', '', '');
  17. CREATE TABLE IF NOT EXISTS `sys_cmts_profile` (
  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_text` text NOT NULL,
  23. `cmt_mood` tinyint(4) NOT NULL DEFAULT '0',
  24. `cmt_rate` int(11) NOT NULL DEFAULT '0',
  25. `cmt_rate_count` int(11) NOT NULL DEFAULT '0',
  26. `cmt_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  27. `cmt_replies` int(11) NOT NULL DEFAULT '0',
  28. PRIMARY KEY (`cmt_id`),
  29. KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
  30. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  31. CREATE TABLE IF NOT EXISTS `sys_cmts_track` (
  32. `cmt_system_id` int(11) NOT NULL DEFAULT '0',
  33. `cmt_id` int(11) NOT NULL DEFAULT '0',
  34. `cmt_rate` tinyint(4) NOT NULL DEFAULT '0',
  35. `cmt_rate_author_id` int(10) unsigned NOT NULL DEFAULT '0',
  36. `cmt_rate_author_nip` int(11) unsigned NOT NULL DEFAULT '0',
  37. `cmt_rate_ts` int(11) NOT NULL DEFAULT '0',
  38. PRIMARY KEY (`cmt_system_id`,`cmt_id`,`cmt_rate_author_nip`)
  39. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  40. */
  41. $aPathInfo = pathinfo(__FILE__);
  42. require_once ($aPathInfo['dirname'] . '/../inc/header.inc.php');
  43. require_once(BX_DIRECTORY_PATH_INC . "params.inc.php");
  44. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  45. bx_import('BxDolAcl');
  46. bx_import('BxDolLanguages');
  47. bx_import('BxTemplFunctions');
  48. $oTemplate = BxDolTemplate::getInstance();
  49. $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
  50. $oTemplate->setPageHeader ("Comments");
  51. $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
  52. $oTemplate->getPageCode();
  53. /**
  54. * page code function
  55. */
  56. function PageCompMainCode() {
  57. $iAccountId = getLoggedId();
  58. bx_import('BxTemplCmtsView');
  59. $oCmts = new BxTemplCmtsView('profile', (int)$iAccountId);
  60. if(!$oCmts->isEnabled())
  61. return '';
  62. return DesignBoxContent("Comments", $oCmts->getCommentsFirst(), BX_DB_PADDING_DEF);
  63. }
  64. /** @} */