You are here

multiform_log.module in Multiple forms 7.2

File

multiform_log/multiform_log.module
View source
<?php

// @todo: Move links into admin/config.
// Load devel files when required without enabling.

/**
 * Implements hook_menu().
 */
function multiform_log_menu() {
  $items['multiform/log'] = array(
    'title' => 'Multiform log',
    'page callback' => 'multiform_log_list_page',
    'access callback' => 'multiform_log_access',
    'file' => 'multiform_log.admin.inc',
  );
  $items['multiform/log/%'] = array(
    'title' => 'Multiform log',
    'page callback' => 'multiform_log_entry_page',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'multiform_log_access',
    'file' => 'multiform_log.admin.inc',
  );
  $items['multiform/log/search'] = array(
    'title' => 'Multiform log search',
    'page callback' => 'multiform_log_search',
    'access callback' => 'multiform_log_access',
    'file' => 'multiform_log.admin.inc',
  );
  return $items;
}

/**
 * Access callback.
 *
 * @todo:
 * Check if devel is enabled and check permissions.
 */
function multiform_log_access() {
  global $user;
  return function_exists('kpr') && $user->uid == 1;
}

/**
 * Save log entry into database.
 */
function multiform_log_create_entry($entry_data) {
  $entry_data['timestamp'] = !empty($entry_data['timestamp']) ? $entry_data['timestamp'] : time();

  // Log _POST data.
  $id = db_insert('multiform_log')
    ->fields(array(
    'multiform_id' => $entry_data['multiform_id'],
    'timestamp' => $entry_data['timestamp'],
    'post_array' => serialize($entry_data['post_array']),
    'context_data' => serialize($entry_data['context_data']),
  ))
    ->execute();
  return $id;
}

Functions

Namesort descending Description
multiform_log_access Access callback.
multiform_log_create_entry Save log entry into database.
multiform_log_menu Implements hook_menu().