enable.sql 6.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. SET @sName = 'bx_charts';
  2. -- SETTINGS
  3. SET @iTypeOrder = (SELECT IFNULL(MAX(`order`), 0) + 1 FROM `sys_options_types` WHERE `group` = 'modules');
  4. INSERT INTO `sys_options_types` (`group`, `name`, `caption`, `icon`, `order`)
  5. VALUES('modules', @sName, '_bx_charts_adm_stg_cpt_type', 'bx_charts@modules/boonex/charts/|std-icon.svg', IF(ISNULL(@iTypeOrder), 1, @iTypeOrder + 1));
  6. SET @iTypeId = LAST_INSERT_ID();
  7. INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `hidden`, `order`) VALUES(@iTypeId, 'bx_charts_chart1', '_bx_charts_adm_stg_cpt_category_chart_top_contents_by_likes', 0, 1);
  8. SET @iCategoryId = LAST_INSERT_ID();
  9. INSERT INTO `sys_options` (`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_params`, `check_error`, `order`) VALUES
  10. (@iCategoryId, 'bx_charts_chart_top_contents_by_likes_modules_disabled', '_bx_charts_adm_stg_cpt_chart_top_contents_by_likes_modules_enabled', '', 'rlist', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:16:"get_text_modules";}', '', '', '', 1),
  11. (@iCategoryId, 'bx_charts_chart_top_contents_by_likes_count', '_bx_charts_adm_stg_cpt_chart_top_contents_by_likes_count', '4', 'digit', '', '', '', '', 2),
  12. (@iCategoryId, 'bx_charts_chart_top_contents_by_likes_interval_day', '_bx_charts_adm_stg_cpt_chart_top_contents_by_likes_interval_day', '7', 'digit', '', '', '', '', 3);
  13. INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `hidden`, `order`) VALUES(@iTypeId, 'bx_charts_chart_most_active_profiles', '_bx_charts_adm_stg_cpt_category_chart_most_active_profiles', 0, 2);
  14. SET @iCategoryId = LAST_INSERT_ID();
  15. INSERT INTO `sys_options` (`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_params`, `check_error`, `order`) VALUES
  16. (@iCategoryId, 'bx_charts_chart_most_active_profiles_modules_disabled', '_bx_charts_adm_stg_cpt_chart_most_active_profiles_modules_enabled', '', 'rlist', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:19:"get_profile_modules";}', '', '', '', 1),
  17. (@iCategoryId, 'bx_charts_chart_most_active_profiles_posts_for_module_disabled', '_bx_charts_adm_stg_cpt_chart_most_active_profiles_posts_for_module', '', 'rlist', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:16:"get_text_modules";}', '', '', '', 2),
  18. (@iCategoryId, 'bx_charts_chart_most_active_profiles_count', '_bx_charts_adm_stg_cpt_chart_most_active_profiles_count', '4', 'digit', '', '', '', '', 3),
  19. (@iCategoryId, 'bx_charts_chart_most_active_profiles_interval_day', '_bx_charts_adm_stg_cpt_chart_most_active_profiles_interval_day', '7', 'digit', '', '', '', '', 4);
  20. INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `hidden`, `order`) VALUES(@iTypeId, 'bx_charts_chart_most_followed_profiles', '_bx_charts_adm_stg_cpt_category_chart_most_followed_profiles', 0, 3);
  21. SET @iCategoryId = LAST_INSERT_ID();
  22. INSERT INTO `sys_options` (`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_params`, `check_error`, `order`) VALUES
  23. (@iCategoryId, 'bx_charts_chart_most_followed_profiles_modules_disabled', '_bx_charts_adm_stg_cpt_chart_most_followed_profiles_modules_enabled', '', 'rlist', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:19:"get_profile_modules";}', '', '', '', 1),
  24. (@iCategoryId, 'bx_charts_chart_most_followed_profiles_count', '_bx_charts_adm_stg_cpt_chart_most_followed_profiles_count', '4', 'digit', '', '', '', '', 2),
  25. (@iCategoryId, 'bx_charts_chart_most_followed_profiles_interval_day', '_bx_charts_adm_stg_cpt_chart_most_followed_profiles_interval_day', '7', 'digit', '', '', '', '', 3);
  26. INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `hidden`, `order`) VALUES(@iTypeId, 'bx_charts_chart_chart_growth', '_bx_charts_adm_stg_cpt_category_chart_growth', 0, 4);
  27. SET @iCategoryId = LAST_INSERT_ID();
  28. INSERT INTO `sys_options` (`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_params`, `check_error`, `order`) VALUES
  29. (@iCategoryId, 'bx_charts_chart_growth_modules', '_bx_charts_adm_stg_cpt_chart_growth_modules_enabled', '', 'rlist', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:11:"get_modules";}', '', '', '', 1),
  30. (@iCategoryId, 'bx_charts_chart_growth_interval_day', '_bx_charts_adm_stg_cpt_chart_growth_interval_day', '30', 'digit', '', '', '', '', 2),
  31. (@iCategoryId, 'bx_charts_chart_growth_group_by', '_bx_charts_adm_stg_cpt_chart_growth_group_by', 'date', 'select', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:19:"get_growth_group_by";}', '', '', '', 3);
  32. -- PAGES: add page block on dashboard
  33. SET @iPBCellDashboard = 2;
  34. SET @iPBOrderDashboard = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_blocks` WHERE `object` = 'sys_dashboard' AND `cell_id` = @iPBCellDashboard LIMIT 1);
  35. INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
  36. ('sys_dashboard', @iPBCellDashboard, @sName, '_bx_charts_page_block_title_system_chart_top_contents_by_likes', '_bx_charts_page_block_title_chart_top_contents_by_likes', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:31:"get_chart_top_contents_by_likes";}', 0, 1, 1, @iPBOrderDashboard),
  37. ('sys_dashboard', @iPBCellDashboard, @sName, '_bx_charts_page_block_title_system_chart_most_active_profiles', '_bx_charts_page_block_title_chart_most_active_profiles', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:30:"get_chart_most_active_profiles";}', 0, 1, 1, @iPBOrderDashboard + 1),
  38. ('sys_dashboard', @iPBCellDashboard, @sName, '_bx_charts_page_block_title_system_chart_most_followed_profiles', '_bx_charts_page_block_title_chart_most_followed_profiles', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:32:"get_chart_most_followed_profiles";}', 0, 1, 1, @iPBOrderDashboard + 2),
  39. ('sys_dashboard', @iPBCellDashboard, @sName, '_bx_charts_page_block_title_system_chart_content_by_modules', '_bx_charts_page_block_title_chart_content_by_modules', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:28:"get_chart_content_by_modules";}', 0, 1, 1, @iPBOrderDashboard + 3),
  40. ('sys_dashboard', @iPBCellDashboard, @sName, '_bx_charts_page_block_title_system_chart_growth_by_modules', '_bx_charts_page_block_title_chart_growth_by_modules', 11, 192, 'service', 'a:2:{s:6:"module";s:9:"bx_charts";s:6:"method";s:27:"get_chart_growth_by_modules";}', 0, 1, 1, @iPBOrderDashboard + 4);
  41. -- CRON
  42. INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
  43. ('bx_charts_cron', '0 1 * * *', 'BxChartsCron', 'modules/boonex/charts/classes/BxChartsCron.php', '');
  44. -- ALERTS
  45. INSERT INTO `sys_alerts_handlers` (`name`, `class`, `file`, `service_call`) VALUES
  46. (@sName, 'BxChartsAlertsResponse', 'modules/boonex/charts/classes/BxChartsAlertsResponse.php', '');
  47. SET @iHandler := LAST_INSERT_ID();
  48. INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
  49. ('system', 'save_setting', @iHandler);