XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
poll.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class poll extends ModuleObject
9 {
13  function moduleInstall()
14  {
16 
17  $config = new stdClass;
18  $config->skin = 'default';
19  $config->colorset = 'normal';
20  $oModuleController->insertModuleConfig('poll', $config);
21  // 2007.10.17 When deleting posts/comments delete the poll as well
22  $oModuleController->insertTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after');
23  $oModuleController->insertTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after');
24  $oModuleController->insertTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after');
25  $oModuleController->insertTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after');
26  $oModuleController->insertTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after');
27  $oModuleController->insertTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after');
28 
29  return new BaseObject();
30  }
31 
35  function checkUpdate()
36  {
37  $oModuleModel = getModel('module');
39  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
40  if($oModuleModel->needUpdate($version_update_id))
41  {
42  // 2007.10.17 When deleting posts/comments delete the poll as well
43  if(!$oModuleModel->getTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after')) return true;
44  if(!$oModuleModel->getTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after')) return true;
45  if(!$oModuleModel->getTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after')) return true;
46  if(!$oModuleModel->getTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after')) return true;
47  if(!$oModuleModel->getTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after')) return true;
48  if(!$oModuleModel->getTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after')) return true;
49 
50  $oModuleController->insertUpdatedLog($version_update_id);
51  }
52 
53  return false;
54  }
55 
59  function moduleUpdate()
60  {
61  $oModuleModel = getModel('module');
63  $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
64  if($oModuleModel->needUpdate($version_update_id))
65  {
66  // 2007.10.17 When deleting posts/comments delete the poll as well
67  if(!$oModuleModel->getTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after'))
68  $oModuleController->insertTrigger('document.deleteDocument', 'poll', 'controller', 'triggerDeleteDocumentPoll', 'after');
69  if(!$oModuleModel->getTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after'))
70  $oModuleController->insertTrigger('comment.deleteComment', 'poll', 'controller', 'triggerDeleteCommentPoll', 'after');
71  // 2008.04.22 A poll connection to add posts/comments
72  if(!$oModuleModel->getTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after'))
73  $oModuleController->insertTrigger('document.insertDocument', 'poll', 'controller', 'triggerInsertDocumentPoll', 'after');
74  if(!$oModuleModel->getTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after'))
75  $oModuleController->insertTrigger('comment.insertComment', 'poll', 'controller', 'triggerInsertCommentPoll', 'after');
76  if(!$oModuleModel->getTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after'))
77  $oModuleController->insertTrigger('document.updateDocument', 'poll', 'controller', 'triggerUpdateDocumentPoll', 'after');
78  if(!$oModuleModel->getTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after'))
79  $oModuleController->insertTrigger('comment.updateComment', 'poll', 'controller', 'triggerUpdateCommentPoll', 'after');
80 
81  $oModuleController->insertUpdatedLog($version_update_id);
82  }
83 
84  return new BaseObject(0, 'success_updated');
85  }
86 
90  function recompileCache()
91  {
92  }
93 }
94 /* End of file poll.class.php */
95 /* Location: ./modules/poll/poll.class.php */
$oModuleModel
Definition: ko.install.php:236
getController($module_name)
Definition: func.inc.php:90
const __XE_VERSION__
Definition: config.inc.php:32
recompileCache()
Re-generate the cache file.
Definition: poll.class.php:90
moduleUpdate()
Execute update.
Definition: poll.class.php:59
checkUpdate()
A method to check if the installation has been successful.
Definition: poll.class.php:35
getModel($module_name)
Definition: func.inc.php:145
moduleInstall()
Additional tasks required to accomplish during the installation.
Definition: poll.class.php:13
$oModuleController
Definition: ko.install.php:287
The parent class of the poll module.
Definition: poll.class.php:8