You are here

nr_rules.module in Node registration 7

File

submodules/nr_rules/nr_rules.module
View source
<?php

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

  /**
   * RULES
   */
  $items['rules_default_nr_unverified'] = entity_import('rules_config', '{ "rules_default_nr_unverified" : {
      "LABEL" : "Save new NR as unverified",
      "PLUGIN" : "reaction rule",
      "OWNER" : "rules",
      "TAGS" : [ "node_registration" ],
      "REQUIRES" : [ "rules", "node_registration" ],
      "ON" : { "node_registration_presave" : [] },
      "IF" : [ { "entity_is_new" : { "entity" : [ "node-registration" ] } } ],
      "DO" : [
        { "data_set" : { "data" : [ "node-registration:verified" ], "value" : 0 } }
      ]
    }
  }');

  /**
   * COMPONENTS
   */
  $items['rules_nr_attended'] = entity_import('rules_config', '{ "rules_nr_attended" : {
      "LABEL" : "NR attended",
      "PLUGIN" : "and",
      "OWNER" : "rules",
      "REQUIRES" : [ "rules" ],
      "USES VARIABLES" : {
        "registration" : { "label" : "Registration", "type" : "node_registration" },
        "original_registration" : { "label" : "Original registration", "type" : "node_registration" }
      },
      "AND" : [
        { "data_is" : { "data" : [ "original-registration:attended" ], "value" : 0 } },
        { "data_is" : { "data" : [ "registration:attended" ], "value" : 1 } }
      ]
    }
  }');
  $items['rules_nr_unattended'] = entity_import('rules_config', '{ "rules_nr_unattended" : {
      "LABEL" : "NR unattended",
      "PLUGIN" : "and",
      "OWNER" : "rules",
      "REQUIRES" : [ "rules" ],
      "USES VARIABLES" : {
        "registration" : { "label" : "Registration", "type" : "node_registration" },
        "original_registration" : { "label" : "Original registration", "type" : "node_registration" }
      },
      "AND" : [
        { "data_is" : { "data" : [ "original-registration:attended" ], "value" : "1" } },
        { "data_is" : { "data" : [ "registration:attended" ], "value" : "0" } }
      ]
    }
  }');
  $items['rules_nr_cancelled'] = entity_import('rules_config', '{ "rules_nr_cancelled" : {
      "LABEL" : "NR cancelled",
      "PLUGIN" : "and",
      "OWNER" : "rules",
      "REQUIRES" : [ "rules" ],
      "USES VARIABLES" : {
        "registration" : { "label" : "Registration", "type" : "node_registration" },
        "original_registration" : { "label" : "Original registration", "type" : "node_registration" }
      },
      "AND" : [
        { "data_is" : { "data" : [ "original-registration:cancelled" ], "value" : 0 } },
        { "data_is" : { "data" : [ "registration:cancelled" ], "value" : 1 } }
      ]
    }
  }');
  $items['rules_nr_verified'] = entity_import('rules_config', '{ "rules_nr_verified" : {
      "LABEL" : "NR verified",
      "PLUGIN" : "and",
      "OWNER" : "rules",
      "REQUIRES" : [ "rules" ],
      "USES VARIABLES" : {
        "registration" : { "label" : "Registration", "type" : "node_registration" },
        "original_registration" : { "label" : "Original registration", "type" : "node_registration" }
      },
      "AND" : [
        { "data_is" : { "data" : [ "original-registration:verified" ], "value" : 0 } },
        { "data_is" : { "data" : [ "registration:verified" ], "value" : 1 } }
      ]
    }
  }');
  $items['rules_nr_unverified'] = entity_import('rules_config', '{ "rules_nr_unverified" : {
      "LABEL" : "NR unverified",
      "PLUGIN" : "and",
      "OWNER" : "rules",
      "REQUIRES" : [ "rules" ],
      "USES VARIABLES" : {
        "registration" : { "label" : "Registration", "type" : "node_registration" },
        "original_registration" : { "label" : "Original registration", "type" : "node_registration" }
      },
      "AND" : [
        { "data_is" : { "data" : [ "original-registration:verified" ], "value" : "1" } },
        { "data_is" : { "data" : [ "registration:verified" ], "value" : "0" } }
      ]
    }
  }');
  return $items;
}