multiform_log.module in Multiple forms 7.2
File
multiform_log/multiform_log.module
View source
<?php
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;
}
function multiform_log_access() {
global $user;
return function_exists('kpr') && $user->uid == 1;
}
function multiform_log_create_entry($entry_data) {
$entry_data['timestamp'] = !empty($entry_data['timestamp']) ? $entry_data['timestamp'] : time();
$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;
}