You are here

function _votingapi_load_action_sets_from_db in Voting API 5

3 calls to _votingapi_load_action_sets_from_db()
votingapi_actions_admin_delete_page_submit in ./votingapi_actions_ui.inc
votingapi_actions_admin_page in ./votingapi_actions_ui.inc
votingapi_rebuild_action_cache in ./votingapi_actions.module
Utility functions that manage the raw voting actions data..

File

./votingapi_actions.module, line 245

Code

function _votingapi_load_action_sets_from_db($parent = 0) {
  $sets = array();
  $result = db_query("SELECT * FROM {votingapi_action_set} WHERE parent = %d ORDER BY weight, name ASC", $parent);
  while ($set = db_fetch_array($result)) {
    $condition_result = db_query("SELECT * FROM {votingapi_action_condition} WHERE vasid = %d ORDER BY weight ASC", $set['vasid']);
    while ($condition = db_fetch_array($condition_result)) {
      $condition['data'] = unserialize($condition['data']);
      $set['conditions'][] = $condition;
    }
    $action_result = db_query("SELECT * FROM {votingapi_action} WHERE vasid = %d ORDER BY aid ASC", $set['vasid']);
    while ($action = db_fetch_array($action_result)) {
      $set['actions'][] = $action['aid'];
    }
    $set->subsets = _votingapi_load_action_sets_from_db($vasid);
    $sets[] = $set;
  }
  return $sets;
}