summaryrefslogtreecommitdiffstats
path: root/election_vote/election_vote.rules_defaults.inc
blob: f8e2b78c3780f402f5baa5840b4f1a57811a3b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
 * @file
 * Default Rules for the Election Vote module.
 */

/**
 * Implements hook_default_rules_configuration().
 */
function election_vote_default_rules_configuration() {

  $items = array();

  // Display a message to notify the user after abstaining.
  $items['election_vote_notify_abstainer'] = entity_import('rules_config', '{ "election_vote_notify_abstainer" : {
    "LABEL" : "Notify user after abstaining",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "election" ],
    "REQUIRES" : [ "rules", "election_vote" ],
    "ON" : [ "election_vote_abstain" ],
    "DO" : [
      { "drupal_message" : { "message" : "You have abstained from voting ([election:type:post-name]: \u0027\u003Ca href=\u0022[post:url]\u0022\u003E[post:title]\u003C\/a\u003E\u0027)." } }
    ]
  }
}');

  // Display a message to notify the user after voting.
  $items['election_vote_notify_voter'] = entity_import('rules_config', '{ "election_vote_notify_voter" : {
    "LABEL" : "Notify user after voting",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "election" ],
    "REQUIRES" : [ "rules", "election_vote" ],
    "ON" : [ "election_vote_vote" ],
    "DO" : [
      { "drupal_message" : { "message" : "Thank you for voting ([election:type:post-name]: \u0027\u003Ca href=\u0022[post:url]\u0022\u003E[post:title]\u003C\/a\u003E\u0027)." } }
    ]
  }
}');

  // Prompt the user to share the election on Facebook or Twitter after voting.
  $items['election_vote_share'] = entity_import('rules_config', '{ "election_vote_share" : {
    "LABEL" : "Prompt user to share the election on Facebook or Twitter after voting",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "election" ],
    "WEIGHT" : "1",
    "ACTIVE" : false,
    "REQUIRES" : [ "rules", "election_vote" ],
    "ON" : [ "election_vote_vote" ],
    "DO" : [
      { "drupal_message" : {
          "message" : "You can share this [election:type:name] on \u003Ca href=\u0022http:\/\/www.facebook.com\/sharer\/sharer.php?u=https:\/\/[site:url-brief][election:url]\u0022 target=\u0022_blank\u0022\u003EFacebook\u003C\/a\u003E or \u003Ca href=\u0022http:\/\/twitter.com\/share?text=I%20voted%20in%20[election:title]%20-%20https:\/\/[site:url-brief]%20([site:name])\u0022 target=\u0022_blank\u0022\u003ETwitter\u003C\/a\u003E.",
          "repeat" : 0
        }
      }
    ]
  }
}');

  // Email the user after voting.
  $items['election_vote_email_voter'] = entity_import('rules_config', '{ "election_vote_email_voter" : {
    "LABEL" : "Email user after voting",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "2",
    "ACTIVE" : false,
    "TAGS" : [ "election" ],
    "REQUIRES" : [ "rules", "election_vote" ],
    "ON" : [ "election_vote_vote" ],
    "DO" : [
      { "mail" : {
          "to" : "[account:name] \u003C[account:mail]\u003E",
          "subject" : "Thank you for voting",
          "message" : "You successfully cast a vote, using the system at: [site:url]\r\n\r\n    [election:type:name-ucfirst]: [election:title]\r\n    [election:type:post-name-ucfirst]: [post:title]\r\n    Time of vote: [site:current-date:long]\r\n\r\n(for security reasons further details are not displayed)\r\n\r\nIf you have any queries relating to this information, please contact us.",
          "language" : [ "" ]
        }
      }
    ]
  }
}');

  return $items;
}