Projet

Général

Profil

Révision 62e0cc08

Ajouté par Assos Assos il y a plus de 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/calendar/includes/calendar_plugin_row.inc
398 398
      $this->title = entity_label($this->entity_type, $entity);
399 399
      $uri = entity_uri($this->entity_type, $entity);
400 400
      $uri['options']['absolute'] = TRUE;
401
      $this->url = url($uri['path'], $uri['options']);
401
      $this->url = '';
402
      if (isset($uri['path'])) {
403
        $this->url = url($uri['path'], $uri['options']);
404
      }
402 405

  
403 406
      // Retrieve the field value(s) that matched our query from the cached node.
404 407
      // Find the date and set it to the right timezone.
......
416 419
        $date_delta = 'date_delta_' . $field_name;
417 420
        if (isset($row->$date_id)) {
418 421
          $delta = $row->$date_delta;
419
          $entity->date_id = array('calendar.' . $row->$date_id . '.' . $field_name. '.' . $delta);
422
          $entity->date_id = array('calendar-' . $row->$date_id . '-' . $field_name. '-' . $delta);
420 423
          $delta_field = $date_delta;
421 424
        }
422 425
        else {
423 426
          $delta = isset($row->$delta_field) ? $row->$delta_field : 0;
424
          $entity->date_id = array('calendar.' . $id . '.' . $field_name . '.' . $delta);
427
          $entity->date_id = array('calendar-' . $id . '-' . $field_name . '-' . $delta);
425 428
        }
426 429

  
427 430
        $items = field_get_items($this->entity_type, $entity, $field_name, $this->language);
......
430 433
        $to_zone = date_get_timezone($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
431 434
        if (isset($item['value'])) {
432 435
          $item_start_date = new dateObject($item['value'], $db_tz);
433
          $item_end_date   = array_key_exists('value2', $item) ? new dateObject($item['value2'], $db_tz) : $item_start_date;
436
          $item_end_date   = (array_key_exists('value2', $item) && !empty($item['value2'])) ? new dateObject($item['value2'], $db_tz) : $item_start_date;
434 437
        }
435 438

  
436 439
        $cck_field = field_info_field($field_name);
437 440
        $instance = field_info_instance($this->entity_type, $field_name, $this->type);
438 441
        $granularity = date_granularity_precision($cck_field['settings']['granularity']);
439
        $increment = $instance['widget']['settings']['increment'];
440

  
442
        if ($instance) {
443
          $increment = $instance['widget']['settings']['increment'];
444
        }
441 445
      }
442 446
      elseif (!empty($entity->$field_name)) {
443 447
        $item = $entity->$field_name;
......
445 449
        $to_zone = date_get_timezone($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
446 450
        $item_start_date = new dateObject($item, $db_tz);
447 451
        $item_end_date   = $item_start_date;
448
        $entity->date_id = array('calendar.' . $id . '.' . $field_name . '.0');
452
        $entity->date_id = array('calendar-' . $id . '-' . $field_name);
449 453
      }
450 454

  
451 455
      // If we don't have a date value, go no further.
......
491 495
      ));
492 496

  
493 497
      $entities = $this->explode_values($event);
498
      $date_info = $this->date_argument->view->date_info;
499
      $from = $date_info->date_range[0];
500
      $to = $date_info->date_range[1];
494 501
      foreach ($entities as $entity) {
502
        if(($entity->date_start < $from && $entity->date_end < $from) || ($entity->date_start > $to && $entity->date_end > $to)) continue;
495 503
        switch ($this->options['colors']['legend']) {
496 504
          case 'type':
497 505
            $this->calendar_node_type_stripe($entity);
......
555 563

  
556 564
      // Get intersection of current day and the node value's duration (as strings in $to_zone timezone).
557 565
      $entity->calendar_start = $item_start < $start ? $start : $item_start;
558
      $entity->calendar_end = !empty($item_end) ? ($item_end > $end ? $end : $item_end) : $node->calendar_start;
566
      $entity->calendar_end = !empty($item_end) ? ($item_end > $end ? $end : $item_end) : $entity->calendar_start;
559 567

  
560 568
      // Make date objects
561 569
      $entity->calendar_start_date = date_create($entity->calendar_start, timezone_open($to_zone));
......
626 634
      return;
627 635
    }
628 636

  
629
    $entity = $result->entity;
630
    $term_field_name = $this->options['colors']['taxonomy_field'];
631
    if ($terms_for_entity = field_get_items($this->view->base_table, $entity, $term_field_name)) {
632
      foreach ($terms_for_entity as $delta => $item) {
633
        $term_for_entity = taxonomy_term_load($item['tid']);
634
        if (!array_key_exists($term_for_entity->tid, $colors) || $colors[$term_for_entity->tid] == CALENDAR_EMPTY_STRIPE) {
635
          continue;
636
        }
637
        $result->stripe[] = $colors[$term_for_entity->tid];
638
        $result->stripe_label[] = $term_for_entity->name;
637
    $term_field_name = 'field_' . $this->options['colors']['taxonomy_field'];
638
    $terms = $result->row->{$term_field_name};
639
    foreach ($terms as $term_key => $term_value) {
640
      $term = $term_value['raw']['taxonomy_term'];
641
      if (!array_key_exists($term->tid, $colors) || $colors[$term->tid] == CALENDAR_EMPTY_STRIPE) {
642
        continue;
639 643
      }
644
      $result->stripe[] = $colors[$term->tid];
645
      $result->stripe_label[] = $term->name;
640 646
    }
641 647

  
642 648
    return;

Formats disponibles : Unified diff