Cheetah
ChEventsExport.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbExport');
9 ch_import('ChWsbInstallerUtils');
10 
12 {
13  protected function __construct($aSystem)
14  {
15  parent::__construct($aSystem);
16  $this->_aTables = array(
17  'ch_events_admins' => '`id_profile` = {profile_id}',
18  'ch_events_cmts' => '`cmt_author_id` = {profile_id}',
19  'ch_events_cmts_track' => '`cmt_rate_author_id` = {profile_id}',
20  'ch_events_files' => array(
21  'query' => "SELECT `f`.* FROM `ch_events_files` AS `f` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `f`.`entry_id`) WHERE `m`.`ResponsibleID` = {profile_id}"),
22  'ch_events_images' => array(
23  'query' => "SELECT `f`.* FROM `ch_events_images` AS `f` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `f`.`entry_id`) WHERE `m`.`ResponsibleID` = {profile_id}"),
24  'ch_events_main' => '`ResponsibleID` = {profile_id}',
25  'ch_events_participants' => '`id_profile` = {profile_id}',
26  'ch_events_rating' => array(
27  'query' => "SELECT `f`.* FROM `ch_events_rating` AS `f` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `f`.`gal_id`) WHERE `m`.`ResponsibleID` = {profile_id}"),
28  'ch_events_rating_track' => array(
29  'query' => "SELECT `t`.`gal_id`, 0, `t`.`gal_date` FROM `ch_events_rating_track` AS `t` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `t`.`gal_id`) WHERE `m`.`ResponsibleID` = {profile_id}"), // anonymize some data
30  'ch_events_shoutbox' => '`OwnerID` = {profile_id}',
31  'ch_events_sounds' => array(
32  'query' => "SELECT `f`.* FROM `ch_events_sounds` AS `f` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `f`.`entry_id`) WHERE `m`.`ResponsibleID` = {profile_id}"),
33  'ch_events_videos' => array(
34  'query' => "SELECT `f`.* FROM `ch_events_videos` AS `f` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `f`.`entry_id`) WHERE `m`.`ResponsibleID` = {profile_id}"),
35  'ch_events_views_track' => array(
36  'query' => "SELECT `t`.`id`, IF(`t`.`viewer` = {profile_id}, `t`.`viewer`, 0), IF(`t`.`viewer` = {profile_id}, `t`.`ip`, 0), `t`.`ts` FROM `ch_events_views_track` AS `t` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `t`.`id`) WHERE `m`.`ResponsibleID` = {profile_id} OR `t`.`viewer` = {profile_id}"), // anonymize some data
37 
38  // events forum
39  'ch_events_forum' => array(
40  'query' => "SELECT `f`.* FROM `ch_events_forum` AS `f` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `f`.`entry_id`) WHERE `m`.`ResponsibleID` = {profile_id}"),
41  'ch_events_forum_actions_log' => array(
42  'query' => "SELECT `f`.* FROM `ch_events_forum_actions_log` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user_name`) WHERE `p`.`ID` = {profile_id}"),
43  'ch_events_forum_attachments' => array(
44  'query' => "SELECT `f`.* FROM `ch_events_forum_attachments` AS `f` INNER JOIN `ch_events_forum_post` AS `m` ON (`m`.`post_id` = `f`.`post_id`) INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `m`.`user`) WHERE `p`.`ID` = {profile_id}"),
45  'ch_events_forum_flag' => array(
46  'query' => "SELECT `f`.* FROM `ch_events_forum_flag` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
47  'ch_events_forum_post' => array(
48  'query' => "SELECT `f`.* FROM `ch_events_forum_post` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
49  'ch_events_forum_signatures' => array(
50  'query' => "SELECT `f`.* FROM `ch_events_forum_signatures` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
51  'ch_events_forum_topic' => array(
52  'query' => "SELECT `f`.* FROM `ch_events_forum_topic` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`first_post_user`) WHERE `p`.`ID` = {profile_id}"),
53  'ch_events_forum_user_activity' => array(
54  'query' => "SELECT `f`.* FROM `ch_events_forum_user_activity` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
55  'ch_events_forum_user_stat' => array(
56  'query' => "SELECT `f`.* FROM `ch_events_forum_user_stat` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
57  'ch_events_forum_vote' => array(
58  'query' => "SELECT `f`.* FROM `ch_events_forum_vote` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user_name`) WHERE `p`.`ID` = {profile_id}"),
59  );
60  $this->_sFilesBaseDir = 'modules/cheetah/forum/data/attachments/';
61  $this->_aTablesWithFiles = array(
62  'ch_events_forum_attachments' => array( // table name
63  'att_hash' => array ( // field name
64  '', // prefixes & extensions
65  ),
66  ),
67  );
68 
70  $this->_aTables['ch_wmap_locations'] = array(
71  'query' => "SELECT `t`.* FROM `ch_wmap_locations` AS `t` INNER JOIN `ch_events_main` AS `m` ON (`m`.`ID` = `t`.`id`) WHERE `m`.`ResponsibleID` = {profile_id} AND `part` = 'events'");
72  }
73  }
74 
75  protected function _getFilePath($sTableName, $sField, $sFileName, $sPrefix, $sExt)
76  {
77  $s = $sFileName;
78  return $this->_sFilesBaseDir . substr($s, 0, 1) . '/' . substr($s, 0, 2) . '/' . substr($s, 0, 3) . '/' . $s;
79  }
80 }
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbExport
Definition: ChWsbExport.php:29
php
ChEventsExport\__construct
__construct($aSystem)
Definition: ChEventsExport.php:13
$sExt
$sExt
Definition: get_file.php:14
ChEventsExport\_getFilePath
_getFilePath($sTableName, $sField, $sFileName, $sPrefix, $sExt)
Definition: ChEventsExport.php:75
ChEventsExport
Definition: ChEventsExport.php:12
$s
$s
Definition: embed.php:13
ChWsbInstallerUtils\isModuleInstalled
static isModuleInstalled($sUri)
Definition: ChWsbInstallerUtils.php:38