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
switch(skus.length) { | |
case 4: | |
jQuery(skus[skus.length-1]).css('left', '217px').css('position','relative'); | |
break; | |
case 5: | |
jQuery(skus[skus.length-1]).css('left', '109px').css('position','relative'); | |
jQuery(skus[skus.length-2]).css('left', '109px').css('position','relative'); | |
break; | |
default: | |
break; |
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
<?php | |
$_full = TRUE; | |
if(!$this->drupal_bootstraped) { | |
$api_path = getcwd(); | |
define('DRUPAL_ROOT', $this->drupal_root); | |
chdir($this->drupal_root); | |
//D7 is going to have GlobalRedirect interfere, set POST value to disabled it. | |
require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; | |
$_POST['X-MEDIQ_GLOBAL_REDIRECT_DISABLE'] = 'TRUE'; | |
if ($_full) { |
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
<?php | |
/** | |
* Get count of holidays in a given month | |
* Holidays are a content type with a date field | |
* | |
* @param int $month The month | |
* @param int $year The year | |
*/ | |
function cela_reports__working_hours__holidays_month($month, $year) { | |
$holidays = db_select('field_revision_field_event_dates', 'f') |
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
<?php | |
/** | |
* @file | |
* Functions to build working hours | |
* @ | |
*/ | |
define('WORKING_REPORTS_MONTH_YEAR_START', 7); // July | |
define('WORKING_REPORTS_MONTH_YEAR_END', 6); // June | |
define('WORKING_REPORTS_HOURS_IN_DAY', 8); |
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
<?php | |
function _array_column($input, $column_key, $index_key = NULL) { | |
if (function_exists('array_column')) { | |
return array_column($input, $column_key, $index_key); | |
} | |
$result = []; | |
array_walk($input, function($item) use (&$result, $column_key, $index_key) { | |
if (!array_key_exists($column_key, $item)) { | |
return; |
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
<?php | |
/** | |
* Room Report | |
* @see cela_reports.room_utilization.inc | |
*/ | |
function cela_reports__report_tables__rooms($type = ['phs_event', 'stp_event']) { | |
$working_hours = cela_reports__working_hours__monthly_report(); | |
$used_rooms = cela_reports__room_utilization__get_rooms([$type], cela_reports__utilization__report_dates()); | |
$event_rooms = cela_reports__room_utilization__get_event_data($used_rooms); | |
$data = cela_reports__room_utilization__get_room_utilization($event_rooms); |
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
/** | |
* Use | |
* | |
* $header['row1'][] => ['data' => 'header-1-1', 'colspan' => 2]; | |
* $header['row1'][] => ['data' => 'header-1-2', 'colspan' => 2]; | |
* $header['row2'] => ['Total', 'Avg', 'Total', 'Avg']; | |
* // add in some colgroups for targeted styling | |
* $colgroups = array_fill(0, 2, ['attributes' => ['span' => 2]]); | |
* $rows = array_fill(0, 4, '10'); | |
* |
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
<?php | |
/** | |
* Implements hook_field_extra_fields(). | |
* Add the code to Registration enabled entities | |
*/ | |
function my_module_field_extra_fields() { | |
$extra = []; | |
foreach (entity_get_info() as $entity_type => $entity_info) { | |
foreach (array_keys($entity_info['bundles']) as $bundle) { |
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
<?php | |
/** | |
* Two hooks are necessary for adding an extra field to an entity display | |
*/ | |
/** | |
* Implements hook_entity_view(). | |
* Define the content that should be shown | |
*/ | |
function hook_entity_view($entity, $type, $view_mode, $langcode) { |
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
<?php | |
namespace Drupal\mymodule\Plugin\Field\FieldWidget; | |
use Drupal\telephone\Plugin\Field\FieldWidget\TelephoneDefaultWidget; | |
/** | |
* Plugin implementation of the 'telephone_input_mask' widget. | |
* | |
* @FieldWidget( |