-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
local
committed
Jun 18, 2017
0 parents
commit 3ad1136
Showing
5 changed files
with
1,867 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<? | ||
|
||
/** | ||
* This module contains functions that will return content to PHP fields in | ||
* views | ||
* | ||
*/ | ||
|
||
/** | ||
* @param $row - a row field for a view result from the view | ||
* airings_missing_show_content and shows_producer_dashboard/ | ||
* @return $field | ||
*/ | ||
function pcm_show_producer_dashboard_shows_premiere_date_field($row) { | ||
$show = isset($row->nid) ? node_load($row->nid) : NULL; | ||
$airing = pcm_show_get_premiere_airing($row->nid); | ||
if ($airing) { | ||
$airing_start_date = | ||
($airing->field_data_field_airing_date_field_airing_date_value); | ||
|
||
if (isset($airing_start_date) && $airing_start_date) { | ||
$premiere_object = | ||
new DateTime($airing_start_date, | ||
new DateTimeZone('UTC')); | ||
$premiere_object->setTimeZone(new DateTimeZone('America/Los_Angeles')); | ||
|
||
|
||
$premiere_date = $premiere_object->format('m/d/Y h:ia'); | ||
} | ||
|
||
$field = $premiere_date; | ||
} | ||
else { | ||
$field = "Not Scheduled"; | ||
} | ||
return $field; | ||
} | ||
|
||
|
||
/** | ||
* @param $row - a row for a view result from the view | ||
* shows_producer_dashboard | ||
* @return boolean - TRUE remove row; FALSE do not remove row | ||
*/ | ||
/** USING A CONTEXTUAL FILTER INSTEAD | ||
function pcm_show_producer_dashboard_shows_is_next_season_field( | ||
$row, $view, $handler) { | ||
//if ($row->field_tv_guide_title == 14699) { | ||
// dpm($view, 'view'); | ||
// dpm($handler, 'handler'); | ||
//} | ||
$airing = pcm_show_get_premiere_airing($row->nid); | ||
$airing_start_date = $airing ? | ||
$airing->field_data_field_airing_date_field_airing_date_value : | ||
NULL; | ||
if (isset($airing_start_date) && $airing_start_date) { | ||
$premiere_object = | ||
new DateTime($airing_start_date, | ||
new DateTimeZone('UTC')); | ||
$premiere_object->setTimeZone(new DateTimeZone('America/Los_Angeles')); | ||
$premiere_date = $premiere_object->format('Y-m-d H:i:s'); | ||
} | ||
// Fetch season | ||
$next_season = timespan_next(CM_SERIES_REQUEST_SEASON_TIMESPAN_NAME); | ||
$is_next_season = strtotime($premiere_date) >= strtotime($next_season['start']) ? | ||
TRUE : FALSE; | ||
$roles = | ||
array(CM_SERIES_REQUEST_PROGRAMMING_STAFF_ROLE, | ||
CM_SERIES_REQUEST_SYS_ADMIN_ROLE, | ||
CM_SERIES_REQUEST_SITE_ADMIN_ROLE, | ||
CM_SERIES_REQUEST_SERIES_RENEWED_ROLE, | ||
); | ||
$is_staff = cm_series_request_user_has_role($roles) ? | ||
TRUE : FALSE; | ||
$is_staff = false; | ||
$display = variable_get(CM_SERIES_REQUEST_UPCOMING_AIRINGS_STATUS); | ||
if (!$display && $is_next_season && !$is_staff) { | ||
return TRUE; // remove | ||
} | ||
return FALSE; // do not remove | ||
} | ||
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name = pcm_show | ||
description = Module providing custom show support for PCM, includes form_alter, presave, and view hooks. | ||
core = 7.x | ||
|
||
package = Open Signal PCM Community Media Advanced | ||
version = 7.x-1.0 | ||
project = "pcm_show" | ||
project_status_url = https://github.com/cm-advanced/pcm_show | ||
|
||
dependencies[] = aspera | ||
dependencies[] = cm_show | ||
scripts[] = pcm_show.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
function pcm_show_install() { | ||
db_query("UPDATE {system} SET weight = -1 | ||
WHERE type = 'module' | ||
AND name = 'pcm_show'"); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
(function ($) { | ||
Drupal.behaviors.pcmShow = { | ||
attach: function (context, settings) { | ||
//////////////////////////////////////////////////////////////////////// | ||
//ON READY FUNCTION | ||
$(document).ready(function() { | ||
var show_nid = $("#pcm_show_nid_div_cache").text(); | ||
var episode_number = $("#pcm_episode_number_div_cache").text(); | ||
var special_and_hidden = | ||
$("#pcm_show_is_special_and_hidden_div_cache").text(); | ||
|
||
$("#edit-field-episode-number-und-0-value").val(episode_number); | ||
|
||
$("#pcm_show_nid_div_cache").hide(); | ||
$("#pcm_episode_number_div_cache").hide(); | ||
|
||
$("#edit-field-show-is-special-und").parent(). | ||
append($("#pcm_airing_wrapper")); | ||
if ($("#edit-field-show-is-special-und").is(":checked")) { | ||
$("#pcm_airing_wrapper").hide(); | ||
} | ||
else { | ||
$("#pcm_airing_wrapper").show(); | ||
} | ||
if (special_and_hidden == 'yes') { | ||
$("#edit-field-episode-number").hide(); | ||
} | ||
if ($("#edit-field-show-is-special-und").is(":checked")) { | ||
$('#node_cm_show_form_group_show_playback_preferences').show(); | ||
} | ||
else { | ||
//$('#node_cm_show_form_group_show_playback_preferences').hide(); | ||
} | ||
|
||
var is_series = $("#pcm_show_is_series_div_cache").text(); | ||
|
||
if ($("#pcm_show_is_series_div_cache").text() == 'yes') { | ||
console.log('yee'); | ||
$('#node_cm_show_form_group_show_playback_preferences').hide(); | ||
} | ||
|
||
$(".field-name-field-show-is-special"). | ||
not('.field-widget-options-onoff').hide(); | ||
|
||
//display field | ||
//field field-name-field-show-is-special field-type-list-boolean field-label-inline clearfix | ||
|
||
//edit field | ||
//field-type-list-boolean field-name-field-show-is-special field-widget-options-onoff form-wrapper | ||
}); | ||
|
||
//////////////////////////////////////////////////////////////////////// | ||
//ON CHANGE FUNCTION FOR THE is-special FIELD | ||
$("#edit-field-show-is-special-und", context).change(function() { | ||
var show_nid = $("#pcm_show_nid_div_cache").text(); | ||
var episode_number = $("#pcm_episode_number_div_cache").text(); | ||
|
||
if ($("#edit-field-show-is-special-und").is(":checked")) { | ||
$("#pcm_airing_wrapper").hide(); | ||
$("#edit-field-episode-number-und-0-value").val(""); | ||
$('#node_cm_show_form_group_show_playback_preferences').show(); | ||
} | ||
else { | ||
$("#pcm_airing_wrapper").show(); | ||
$("#edit-field-episode-number-und-0-value").val(episode_number); | ||
$('#node_cm_show_form_group_show_playback_preferences').hide(); | ||
} | ||
}); | ||
}}; | ||
}) (jQuery); |
Oops, something went wrong.