Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Libkuman committed Dec 15, 2019
0 parents commit 3697192
Show file tree
Hide file tree
Showing 6 changed files with 1,664 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
README file for the cma_airing_report module for Drupal 7.x.

This module upon installation will create a view, airing_distribution_report, with 3 displays:

1. Distribution Report
This view has a custom header that will show distribution reports that filter by the views exposed date filter.

2. Data Export
This display allows the results from teh Distribuation report to be downloaded. Note: I wouldn't recommend downloading more than 6 months at a time.

3. Refresh Show Runtimes
This view will allow one to refresh the runtime for a Show via a Bulk Operations. If a show has multiple airing results, the show will only be resaved once.

This module also provides a menu page: admin/airings/manage/reports that has links to both the Distribution Report and the Refresh Show Runtimes page.
9 changes: 9 additions & 0 deletions cma_airing_report.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = Community Media Advanced Airing Report
package = Community Media Advanced
description = "Helper functions for airing reports"
version 7.x-1.0

core = 7.x

dependencies[] = cm_airing

8 changes: 8 additions & 0 deletions cma_airing_report.info~
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = Community Media Advanced Airing Report
package = Community Media Advanced
description = "Helper functions for airing reports"

core = 7.x

dependencies[] = cm_airing

91 changes: 91 additions & 0 deletions cma_airing_report.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php


/**
* @file
* reservations Installer / Uninstaller
*/

/**
* Implements hook_install().
*/
function cma_airing_report_install() {

$args = array();

$args[] = array('table_name' => 'reservations_resource_node',
'index_name' => 'rateperhour',
'fields' => array('reservations_rate_per_hour'));

$args[] = array('table_name' => 'reservations_reservation',
'index_name' => 'status',
'fields' => array('reservations_reservation_status'));

$args[] = array('table_name' => 'reservations_reservation_detail',
'index_name' => 'vidnid',
'fields' => array("vid","nid"));

$args[] = array('table_name' => 'reservations_resource_node',
'index_name' => 'vidrateperhour',
'fields' => array('vid','reservations_rate_per_hour'));

foreach ($args as $index) {
$sql = "show index from {" . $index['table_name'].
"} where Key_name = :index_name";

$query_args = array(':index_name' => $index['index_name']);

$results = db_query($sql, $query_args);

$index_exists = FALSE;
while ($result = $results->fetchObject()) {
$index_exists = TRUE;
break;
}
if ($index_exists) {
continue;
}
$sql = "ALTER TABLE {" . $index['table_name']."} ADD INDEX " .
$index['index_name'] ." (";

$is_first = TRUE;
$counter = 0;
$query_args = array();
foreach($index['fields'] as $field) {
if ($is_first) {
$is_first= FALSE;
}
else {
$sql .= ",";
}
$counter ++;
$sql .= $field;
}
$sql .= ")";
db_query($sql);

}
}

/**
* Implements hook_uninstall().
*/
function cma_airing_report_uninstall() {
/*
$sql = "ALTER TABLE reservations_resource_node ADD INDEX rateperhour
(reservations_rate_per_hour)";
db_query($sql);

$sql = "ALTER TABLE reservations_reservation ADD INDEX status
(reservations_reservation_status)";
db_query($sql);

$sql = "ALTER TABLE reservations_reservation_detail ADD INDEX vidnid
(vid,nid)";
db_query($sql);

$sql = "ALTER TABLE reservations_resource_node ADD INDEX vidrateperhour
(vid,reservations_rate_per_hour)";

*/
}
Loading

0 comments on commit 3697192

Please sign in to comment.