You are here

ajax_webform.module in Ajax 6

File

plugins/webform/ajax_webform.module
View source
<?php

/**
 * AJAX Webform Plugin
 *
 * @see http://drupal.org/project/ajax
 * @see irc://freenode.net/#drupy
 * @depends Drupal 6
 * @author brendoncrawford
 * @note This file uses a 79 character width limit.
 *
 */

/**
 * Get webform types
 *
 * @param $types Assoc
 * @return Bool
 */
function ajax_webform_ajax_types(&$types) {
  $webform_node_types = variable_get('webform_node_types', array(
    'webform',
  ));
  $placeholders = implode(', ', array_fill(0, count($webform_node_types), "'%s'"));
  $q = 'SELECT ' . '  n.nid, ' . '  n.title ' . 'FROM {node} n ' . 'WHERE n.type IN (' . $placeholders . ')';
  $res = db_query($q, $webform_node_types);
  while ($row = db_fetch_array($res)) {
    $id = 'webform_client_form_' . (int) $row['nid'];
    $types[$id] = t('Webform: ' . $row['title']);
  }
  return TRUE;
}

Functions

Namesort descending Description
ajax_webform_ajax_types Get webform types