Menu

#1300 Display custom field in day view

None
open
nobody
None
1
2017-08-24
2017-08-24
Jonas
No

Hi,

I'm trying to add a custom field to my day view, I have found how to add the full description, but I can't get my head around how to add a custom field.

I did the following in functions_table_inc, I assume I have to call my database before I can add the line, but how/where can I find this (Still a beginner :))

 else                 // if it is booked then show the booking
      {
        $html .= "<div data-id=\"$id\" data-type=\"$color\" class=\"celldiv slots" .
                 (($times_along_top) ? "1" : $slots) .
                 "\">\n";
        $html .= "<a href=\"view_entry.php?id=$id&amp;". $query_strings['booking'] . "\" title=\"$long_descr\">";
        $html .= "<a href=\"view_entry.php?id=$id&amp;". $query_strings['booking'] . "\" title=\"$sleutel\">"; // I added this aswell (I actually copied every line which stated 'long_descr' and copied it under that line and replaced it with 'sleutel' (sleutel is my custom field)
        $html .= ($is_repeat) ? "<img class=\"repeat_symbol $c\" src=\"images/repeat.png\" alt=\"" . get_vocab("series") . "\" title=\"" . get_vocab("series") . "\" width=\"10\" height=\"10\">" : '';
        $html .= "$descr</a>\n";
        $html .= "$long_descr</a>\n";
        $html .= "$sleutel</a>\n"; // Simply adding this doesn't work, that's why I assume I have to collect the data somewhere from the database?
        $html .= "</div>\n";
      }
      $html .= "</td>\n";
    }
  }

  return $html;
}  // end function draw_cell

Related

Support Requests: #1300

Discussion

  • Campbell Morrison

    The easiest thing to is to modify the function map_add_booking() in functions_table.inc and modify $entry['name'], eg

    $entry['name'] = $entry['your_custom_field']
    
     

    Last edit: Campbell Morrison 2022-11-15
    • Jonas

      Jonas - 2017-08-24

      Hi,

      When I edit the field all my entries disappear.
      In the attachment you can find what I tried to edit, not sure if I did entirely what you meant.

      Regards,

      Jonas Dekeyser

      Op 24 aug. 2017, om 12:18 heeft Campbell Morrison het volgende geschreven:

      The easirst thing to is to modify the function $map_add_booking() in functions_table.inc and modify $entry['name'], eg

      $entry['name'] = $entry['your_custom_field']
      [support-requests:#1300] https://sourceforge.net/p/mrbs/support-requests/1300/ Display custom field in day view

      Status: open
      Group:
      Created: Thu Aug 24, 2017 10:01 AM UTC by Jonas Dekeyser
      Last Updated: Thu Aug 24, 2017 10:01 AM UTC
      Owner: nobody

      Hi,

      I'm trying to add a custom field to my day view, I have found how to add the full description, but I can't get my head around how to add a custom field.

      I did the following in functions_table_inc, I assume I have to call my database before I can add the line, but how/where can I find this (Still a beginner :))

      else // if it is booked then show the booking
      {
      $html .= "

      \n";
      $html .= "['booking'] . "\" title=\"$long_descr\">";
      $html .= " https://sourceforge.net///%22view_entry.php?id=$id&%22.['booking'] . "\" title=\"$sleutel\">"; // I added this aswell (I actually copied every line which stated 'long_descr' and copied it under that line and replaced it with 'sleutel' (sleutel is my custom field)
      $html .= ($is_repeat) ? "" : '';
      $html .= "$descr https://sourceforge.net///%22view_entry.php?id=$id&%22.\n";
      $html .= "$long_descr\n";
      $html .= "$sleutel\n"; // Simply adding this doesn't work, that's why I assume I have to collect the data somewhere from the database?
      $html .= "
      \n";
      }
      $html .= "\n";
      }
      }

      return $html;
      } // end function draw_cell

       

      Related

      Support Requests: #1300


      Last edit: Campbell Morrison 2017-08-24
      • Jonas

        Jonas - 2017-08-24

        Hi,

        First of all, sorry for the spam :).
        In addition to my previous mail (below this one)
        I typed something wrong and that’s why my entries disappeared…

        Can you add more then 2 lines (data and long_descr are already showing)
        But I’d like to add a third and maybe a fourth line (data coming from custom fields)

        So, I’d like to display
        - Short description (bold)
        - Long description
        - Custom field one
        - Custom field two

        Kind regards,

        Jonas Dekeyser

        Op 24 aug. 2017, om 13:30 heeft Jonas Dekeyser het volgende geschreven:

        <When I="" edit="" the="" name="" in="" red="" to="" my="" custom="" field.pdf="">
        Hi,

        When I edit the field all my entries disappear.
        In the attachment you can find what I tried to edit, not sure if I did entirely what you meant.

        Kind regards,

        Jonas Dekeyser

         

        Last edit: Campbell Morrison 2017-08-24
  • Campbell Morrison

    Something like:

    $entry['name'] = $entry['name'] . $entry['description'] . $entry['field1'] . $entry['field2'];
    
     
    • Jonas

      Jonas - 2017-08-24

      You’re my hero!
      Thanks for the help mate ;)

      I did add . “\n” . to create a new line, but that doesn't work :p

      Kind regards,

      Jonas

       

      Last edit: Campbell Morrison 2017-08-24