3. ABOUT ME / US
Keenan
Holloway
::
Developer
FORUM
ONE
::
forumone.com
Monday, July 30, 2012
4. THIS SESSION WILL COVER:
An
overview
of
the
Data
module
-‐
What
it
does,
Strengths,
Weaknesses
Various
valuable
uses
-‐
CreaHng/Defining
Data
-‐
ManipulaHng
Data
through
custom
Forms
module,
Direct
database
insert,
and
Views
-‐
InteracHng
with
data
through
Views
and
Panels
Monday, July 30, 2012
5. WHAT IT DOES
Helps
you
model,
manage
and
query
custom
tables.
Offers
an
administra@on
interface
and
a
low
level
API
for
manipula@ng
tables
and
accessing
their
contents.
Provides
Views
integra@on.
Monday, July 30, 2012
6. STRENGTHS
Great
for
flat
simple
data
sets.
Great
for
data
that
is
frequently
updated.
Great
for
custom
module
interac@on.
Simplis@c
table
design.
Built
on
en@ty
framework.
Integrates
with
views.
Monday, July 30, 2012
7. WEAKNESSES
Quite
a
few
bugs
present
most
likely
as
a
result
of
updated
support
modules.
Coding
required
for
complex
table
rela@onships.
Search
and
Feeds
integra@on
are
a
liLle
buggy
and
require
numerous
patches.
Monday, July 30, 2012
17. sites/all/modules/contrib/bikes/bikes.module
<?php
/**
*
Implements
hook_menu().
*/
func/on
bikes_menu()
{
//
Add
menu
item
callback
for
custom
form
$items['bikes/add']
=
array(
'type'
=>
MENU_CALLBACK,
'page
callback'
=>
'drupal_get_form',
'page
arguments'
=>
array('bikes_myform'),
//
Returns
our
custom
form
item
'access
arguments'
=>
array('access
content'),
//
Sets
access
to
see
this
form
);
return
$items;
}
Monday, July 30, 2012
18. sites/all/modules/contrib/bikes/bikes.module
(Con@nued...)
/*
*
Defines
the
custom
input
form
*/
func/on
bikes_myform()
{
//
Define
form
input
field
for
Bike
ID
$form['id']
=
array(
'#type'
=>
'tex]ield',
'#/tle'
=>
t('Bike
ID'),
'#size'
=>
30,
'#maxlength'
=>
64,
'#descrip/on'
=>
t('Enter
the
ID
of
the
bike.'),
);
//
Define
form
input
field
for
Sta/on
ID
$form['sta/on_id']
=
array(
'#type'
=>
'tex]ield',
'#/tle'
=>
t('Sta/on
ID'),
'#size'
=>
30,
'#maxlength'
=>
64,
'#descrip/on'
=>
t('Enter
the
sta/on
ID
of
the
bike.'),
);
//
Define
form
submit
bucon
$form['submit']
=
array('#type'
=>
'submit',
'#value'
=>
t('Save'));
return
$form;
}
Monday, July 30, 2012
19. sites/all/modules/contrib/bikes/bikes.module
(Con@nued...)
/*
*
Defines
submit
opera/ons
*/
func/on
bikes_myform_submit($form,
&$form_state)
{
//
On
submit,
insert
the
Bike
ID
and
Sta/on
ID
fields
into
the
'bikes'
table
db_insert('bikes')
-‐>fields(array(
'bikeid'
=>
$form_state['values']['id'],
'sta/onid'
=>
$form_state['values']['sta/on_id'],
))
-‐>execute();
//
Set
the
confirma/on
message
drupal_set_message(t('Your
form
has
been
saved.'));
}
Monday, July 30, 2012
20. WHAT WE COVERED:
An
overview
of
the
Data
module
-‐
What
it
does,
Strengths,
Weaknesses
Various
valuable
uses
-‐
CreaHng/Defining
Data
-‐
ManipulaHng
Data
through
custom
Forms
module,
Direct
database
insert,
and
Views
-‐
InteracHng
with
data
through
Views
and
Panels
Monday, July 30, 2012
21. THANKS!
QUESTIONS AND ANSWERS
21
Monday, July 30, 2012