Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
P
print
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
print
Commits
c6366c9b
Commit
c6366c9b
authored
May 23, 2012
by
jcnventura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1299150
: Views integration for all fields in the module tables.
parent
ab193f75
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
410 additions
and
34 deletions
+410
-34
print.info
print.info
+2
-0
print.module
print.module
+10
-0
print.views.inc
print.views.inc
+114
-0
print_join_page_counter.inc
print_join_page_counter.inc
+16
-0
print_mail/print_mail.info
print_mail/print_mail.info
+1
-0
print_mail/print_mail.module
print_mail/print_mail.module
+0
-16
print_mail/print_mail.views.inc
print_mail/print_mail.views.inc
+142
-0
print_mail/views_handler_sort_print_mail_sentcount.inc
print_mail/views_handler_sort_print_mail_sentcount.inc
+0
-18
print_pdf/print_pdf.info
print_pdf/print_pdf.info
+1
-0
print_pdf/print_pdf.module
print_pdf/print_pdf.module
+10
-0
print_pdf/print_pdf.views.inc
print_pdf/print_pdf.views.inc
+114
-0
No files found.
print.info
View file @
c6366c9b
...
...
@@ -6,4 +6,6 @@ files[] = print.module
files
[]
=
print
.
admin
.
inc
files
[]
=
print
.
pages
.
inc
files
[]
=
print
.
install
files
[]
=
print
.
views
.
inc
files
[]
=
print_join_page_counter
.
inc
configure
=
admin
/
config
/
user
-
interface
/
print
print.module
View file @
c6366c9b
...
...
@@ -328,3 +328,13 @@ function _print_scan_libs($lib, $mask) {
return
array_unique
(
$tools
);
}
/**
* Implements hook_views_api().
*/
function
print_views_api
()
{
return
array
(
'api'
=>
2.0
,
'path'
=>
drupal_get_path
(
'module'
,
'print'
),
);
}
print.views.inc
0 → 100644
View file @
c6366c9b
<?php
/**
* Implements hook_views_data().
*/
function
print_views_data
()
{
// The 'group' index will be used as a prefix in the UI for any of this
// table's fields, sort criteria, etc. so it's easy to tell where they came
// from.
$data
[
'print_node_conf'
][
'table'
][
'group'
]
=
t
(
'Printer-friendly version'
);
$data
[
'print_page_counter'
][
'table'
][
'group'
]
=
t
(
'Printer-friendly version'
);
// This table references the {node} table. The declaration below creates an
// 'implicit' relationship to the node table, so that when 'node' is the base
// table, the fields are automatically available.
$data
[
'print_node_conf'
][
'table'
][
'join'
][
'node'
]
=
array
(
// 'left_field' is the primary key in the referenced table.
// 'field' is the foreign key in this table.
'left_field'
=>
'nid'
,
'field'
=>
'nid'
,
// 'type' => 'INNER',
);
$data
[
'print_page_counter'
][
'table'
][
'join'
][
'node'
]
=
array
(
// 'left_field' is the primary key in the referenced table.
// 'field' is the foreign key in this table.
'left_field'
=>
'nid'
,
'field'
=>
'path'
,
// 'type' => 'INNER',
'handler'
=>
'print_join_page_counter'
,
);
// print_node_conf fields
$data
[
'print_node_conf'
][
'link'
]
=
array
(
'title'
=>
t
(
'Web: Show link'
),
'help'
=>
t
(
'Whether to show the printer-friendly version link.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
$data
[
'print_node_conf'
][
'comments'
]
=
array
(
'title'
=>
t
(
'Web: Show link in individual comments'
),
'help'
=>
t
(
'Whether to show the printer-friendly version link in individual comments.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
$data
[
'print_node_conf'
][
'url_list'
]
=
array
(
'title'
=>
t
(
'Web: Show Printer-friendly URLs list'
),
'help'
=>
t
(
'Whether to show the URL list.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
// print_page_counter fields
$data
[
'print_page_counter'
][
'totalcount'
]
=
array
(
'title'
=>
t
(
'Web: Number of page accesses'
),
'help'
=>
t
(
'Counter of accesses to the printer-friendly version for this node.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_numeric'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_numeric'
,
),
);
$data
[
'print_page_counter'
][
'timestamp'
]
=
array
(
'title'
=>
t
(
'Web: Last access'
),
'help'
=>
t
(
"The date of the last access to the node's printer-friendly version."
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_date'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort_date'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_date'
,
),
);
return
$data
;
}
print_join_page_counter.inc
0 → 100644
View file @
c6366c9b
<?php
class
print_join_page_counter
extends
views_join
{
// PHP 4 doesn't call constructors of the base class automatically from a
// constructor of a derived class. It is your responsibility to propagate
// the call to constructors upstream where appropriate.
function
construct
(
$table
,
$left_table
,
$left_field
,
$field
,
$extra
=
array
(),
$type
=
'LEFT'
)
{
parent
::
construct
(
$table
,
$left_table
,
$left_field
,
$field
,
$extra
,
$type
);
}
function
build_join
(
$select_query
,
$table
,
$view_query
)
{
$this
->
left_field
=
"CONCAT('node/', "
.
$this
->
left_table
.
'.'
.
$this
->
left_field
.
')'
;
$this
->
left_table
=
NULL
;
parent
::
build_join
(
$select_query
,
$table
,
$view_query
);
}
}
?>
print_mail/print_mail.info
View file @
c6366c9b
...
...
@@ -7,4 +7,5 @@ files[] = print_mail.module
files
[]
=
print_mail
.
inc
files
[]
=
print_mail
.
admin
.
inc
files
[]
=
print_mail
.
install
files
[]
=
print_mail
.
views
.
inc
configure
=
admin
/
config
/
user
-
interface
/
print
/
email
print_mail/print_mail.module
View file @
c6366c9b
...
...
@@ -364,22 +364,6 @@ function print_mail_views_api() {
);
}
/**
* Implements hook_views_data_alter().
*
* Provide a new option the views sorts for the number of times
* a node has been emailed.
*/
function
print_mail_views_data_alter
(
&
$data
)
{
$data
[
'node'
][
'print_mail_sentcount'
]
=
array
(
'title'
=>
t
(
'Number of times emailed'
),
'help'
=>
t
(
"The total number of times the node has been sent through print module's send by email feature."
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort_print_mail_sentcount'
,
),
);
}
/**
* Implements hook_rules_action_info().
*
...
...
print_mail/print_mail.views.inc
0 → 100644
View file @
c6366c9b
<?php
/**
* Implements hook_views_data().
*/
function
print_mail_views_data
()
{
// The 'group' index will be used as a prefix in the UI for any of this
// table's fields, sort criteria, etc. so it's easy to tell where they came
// from.
$data
[
'print_mail_node_conf'
][
'table'
][
'group'
]
=
t
(
'Printer-friendly version'
);
$data
[
'print_mail_page_counter'
][
'table'
][
'group'
]
=
t
(
'Printer-friendly version'
);
// This table references the {node} table. The declaration below creates an
// 'implicit' relationship to the node table, so that when 'node' is the base
// table, the fields are automatically available.
$data
[
'print_mail_node_conf'
][
'table'
][
'join'
][
'node'
]
=
array
(
// 'left_field' is the primary key in the referenced table.
// 'field' is the foreign key in this table.
'left_field'
=>
'nid'
,
'field'
=>
'nid'
,
// 'type' => 'INNER',
);
$data
[
'print_mail_page_counter'
][
'table'
][
'join'
][
'node'
]
=
array
(
// 'left_field' is the primary key in the referenced table.
// 'field' is the foreign key in this table.
'left_field'
=>
'nid'
,
'field'
=>
'path'
,
// 'type' => 'INNER',
'handler'
=>
'print_join_page_counter'
,
);
// print_mail_node_conf fields
$data
[
'print_mail_node_conf'
][
'link'
]
=
array
(
'title'
=>
t
(
'Email: Show link'
),
'help'
=>
t
(
'Whether to show the send by email link.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
$data
[
'print_mail_node_conf'
][
'comments'
]
=
array
(
'title'
=>
t
(
'Email: Show link in individual comments'
),
'help'
=>
t
(
'Whether to show the send by email link in individual comments.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
$data
[
'print_mail_node_conf'
][
'url_list'
]
=
array
(
'title'
=>
t
(
'Email: Show Printer-friendly URLs list'
),
'help'
=>
t
(
'Whether to show the URL list.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
// print_mail_page_counter fields
$data
[
'print_mail_page_counter'
][
'totalcount'
]
=
array
(
'title'
=>
t
(
'Email: Number of page accesses'
),
'help'
=>
t
(
'Counter of accesses to the send by email form for this node.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_numeric'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_numeric'
,
),
);
$data
[
'print_mail_page_counter'
][
'timestamp'
]
=
array
(
'title'
=>
t
(
'Email: Last access'
),
'help'
=>
t
(
"The date of the last access to the node's send by email form."
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_date'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort_date'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_date'
,
),
);
$data
[
'print_mail_page_counter'
][
'sentcount'
]
=
array
(
'title'
=>
t
(
'Email: Number of sent emails'
),
'help'
=>
t
(
'Counter of emails sent for this node.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_numeric'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_numeric'
,
),
);
$data
[
'print_mail_page_counter'
][
'sent_timestamp'
]
=
array
(
'title'
=>
t
(
'Email: Last email sent'
),
'help'
=>
t
(
'The date when the node was last sent by email.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_date'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort_date'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_date'
,
),
);
return
$data
;
}
print_mail/views_handler_sort_print_mail_sentcount.inc
deleted
100644 → 0
View file @
ab193f75
<?php
/**
* @file
* Views sort handler for the print_mail module
*
* Extend the default sort handler.
* Add a relationship with custom join to print's emailed counter
*/
class
views_handler_sort_print_mail_sentcount
extends
views_handler_sort
{
function
query
()
{
$table
=
'print_mail_page_counter'
;
$join
=
new
views_join
;
$join
->
construct
(
$table
,
NULL
,
"CONCAT('node/', node.nid)"
,
'path'
,
NULL
,
'LEFT'
);
$alias
=
$this
->
query
->
add_relationship
(
$table
,
$join
,
'node'
);
$this
->
query
->
add_orderby
(
$table
,
'sentcount'
,
$this
->
options
[
'order'
]);
}
}
print_pdf/print_pdf.info
View file @
c6366c9b
...
...
@@ -7,4 +7,5 @@ files[] = print_pdf.module
files
[]
=
print_pdf
.
admin
.
inc
files
[]
=
print_pdf
.
pages
.
inc
files
[]
=
print_pdf
.
install
files
[]
=
print_pdf
.
views
.
inc
configure
=
admin
/
config
/
user
-
interface
/
print
/
pdf
print_pdf/print_pdf.module
View file @
c6366c9b
...
...
@@ -235,3 +235,13 @@ function print_pdf_generate_html($html, $meta, $filename = NULL) {
return
NULL
;
}
/**
* Implements hook_views_api().
*/
function
print_pdf_views_api
()
{
return
array
(
'api'
=>
2.0
,
'path'
=>
drupal_get_path
(
'module'
,
'print_pdf'
),
);
}
print_pdf/print_pdf.views.inc
0 → 100644
View file @
c6366c9b
<?php
/**
* Implements hook_views_data().
*/
function
print_pdf_views_data
()
{
// The 'group' index will be used as a prefix in the UI for any of this
// table's fields, sort criteria, etc. so it's easy to tell where they came
// from.
$data
[
'print_pdf_node_conf'
][
'table'
][
'group'
]
=
t
(
'Printer-friendly version'
);
$data
[
'print_pdf_page_counter'
][
'table'
][
'group'
]
=
t
(
'Printer-friendly version'
);
// This table references the {node} table. The declaration below creates an
// 'implicit' relationship to the node table, so that when 'node' is the base
// table, the fields are automatically available.
$data
[
'print_pdf_node_conf'
][
'table'
][
'join'
][
'node'
]
=
array
(
// 'left_field' is the primary key in the referenced table.
// 'field' is the foreign key in this table.
'left_field'
=>
'nid'
,
'field'
=>
'nid'
,
// 'type' => 'INNER',
);
$data
[
'print_pdf_page_counter'
][
'table'
][
'join'
][
'node'
]
=
array
(
// 'left_field' is the primary key in the referenced table.
// 'field' is the foreign key in this table.
'left_field'
=>
'nid'
,
'field'
=>
'path'
,
// 'type' => 'INNER',
'handler'
=>
'print_pdf_join_page_counter'
,
);
// print_pdf_node_conf fields
$data
[
'print_pdf_node_conf'
][
'link'
]
=
array
(
'title'
=>
t
(
'PDF: Show link'
),
'help'
=>
t
(
'Whether to show the PDF version link.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
$data
[
'print_pdf_node_conf'
][
'comments'
]
=
array
(
'title'
=>
t
(
'PDF: Show link in individual comments'
),
'help'
=>
t
(
'Whether to show the PDF version link in individual comments.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
$data
[
'print_pdf_node_conf'
][
'url_list'
]
=
array
(
'title'
=>
t
(
'PDF: Show Printer-friendly URLs list'
),
'help'
=>
t
(
'Whether to show the URL list.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_boolean'
,
'click sortable'
=>
TRUE
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_boolean_operator'
,
'label'
=>
t
(
'Active'
),
'type'
=>
'yes-no'
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
);
// print_pdf_page_counter fields
$data
[
'print_pdf_page_counter'
][
'totalcount'
]
=
array
(
'title'
=>
t
(
'PDF: Number of page accesses'
),
'help'
=>
t
(
'Counter of accesses to the PDF version for this node.'
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_numeric'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_numeric'
,
),
);
$data
[
'print_pdf_page_counter'
][
'timestamp'
]
=
array
(
'title'
=>
t
(
'PDF: Last access'
),
'help'
=>
t
(
"The date of the last access to the node's PDF version."
),
'field'
=>
array
(
'handler'
=>
'views_handler_field_date'
,
'click sortable'
=>
TRUE
,
),
'sort'
=>
array
(
'handler'
=>
'views_handler_sort_date'
,
),
'filter'
=>
array
(
'handler'
=>
'views_handler_filter_date'
,
),
);
return
$data
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment