Event calendar with popups

After building an event calendar (see this page), you might want a balloon / popup / tooltip to appear when hovering over a date. This tooltip would display the node titles of all events on that date. This is not very straightforward to implement in Drupal. I puzzled for 2 days to get this done.

I have written a module for this to make this process easier. You can find it at http://drupal.org/project/calendar_tooltips. It requires beautytips.

If you would like to know how it works or how to do it manually, read on.

There are many tooltip modules for Drupal out there. I use beautytips. Download it and install it. For Explorer you also need to download excanvas_r3, and unzip it in a new directory excanvas_r3 in the sites/all/modules/beautytips/other_libs directory.

The content of a tooltip (the text appearing on the balloon) can come from:

  1. an HTML element's attribute, by default the title attribute
  2. the content of an HTML element
  3. another (external) HTML document.

We won't be using the first method, because I had trouble including HTML markup in the title attribute of an HTML element. The third method, referring to another HTML document, is cumbersome to implement. I went for the second method. Say, for example, we have a date 25 (like in december 25). Normally the following HTML code is produced:

<div class="month mini-day-on"><a href="...">25</a></div>

The class "mini-day-on" is added when there are events on that date. If there are no events on that date, then the class "mini-day-off" is added.

What we are trying to achieve is placing the following HTML code after the hyperlink "25":

<span style="display:none">Christmas day</span>

The text "Christmas day" will not display on the calendar (because of the "display:none" style), but later on when we are done, it should display on the tooltip when you hover over "25" on the calendar. When there are multiple events on that date, it may be useful to list the events in an unordered list. This will look something like this:

<span style="display:none"><ul><li>Christmas day</li><li>Richie's birthday</li></ul></span>

In order to tell Beautytips where to get the content we need to override the calendar module's calendar-mini.tpl.php. Copy sites/all/modules/calendar/theme/calendar-mini.tpl.php to your theme's directory. Add the following code at the beginnning of the month-view div:

<?php
   $bt_options['mini-calendar'] = array(
      "area" => ".mini-day-on a",
      "contentSelector" => '$(this).next().html()'
   );
   beautytips_add_beautytips($bt_options);
?>

The area is a CSS selector that selects every hyperlink (eg. every date) on the mini calendar. The contentSelector is jQuery code which specifies the HTML code  of the hyperlink's first sibling (in our case the span element) as the tooltip's content.

Now we need to write some PHP code that produces the span element with the relevant event data. This is the difficult part. Look for the function called template_preprocess_calendar_datebox in sites/all/modules/calendar/theme/theme.inc. Copy this function to your theme's template.php. Replace the text "template" by the name of your theme. Insert the following code after this line:

$vars['class'] = 'mini-day-on';

Here is the code:

$bt_text = "<ul>";
foreach ($vars['items'][$date] as $time => $results_at_that_time)
   foreach ($results_at_that_time as $num => $result)
      $bt_text .= "<li>" . $result->raw->node_title . "</li>";
$bt_text .= "</ul>";
$bt_text = "<span style=\"display:none\">" . $bt_text . "</span>";
$vars['link'] = l($vars['day'], $vars['url']) . $bt_text;

What this does is aggregating all event data of that day and put it in an HTML unordered list, which is parented in a span element, which, on its turn, is placed next to the hyperlink.

That's it!

Good article, temukan cara

Good article, temukan cara perawatan jantung koroner yang simple dan membantu kesembuhan sakit jantung kunjungi blog regard pengobatan infeksi usus yang aman dan ampuh thanks.

Acne

I am very glad to read such a great blog and thank you for sharing this good info with us Cara Menghilangkan Jerawat Cara Menghilangkan Jerawat Secara Alami Cara Menghilangkan Bekas Jerawat

Eye Care Softgel Green World

first one position google Cara Mengobati Kista Di Rahang succes thank information Pengobatan Tumor Jinak Pada Payudara seo good job

trac

You're looking for Trachoma Eye medicine? Now it is already present Trachoma Herbal Medicine Eye Eye Care softgel.Obat Trachoma

json79345

So luck to come across your excellent blog. Your blog brings me a great deal of fun.. Good luck with the site. facebook

Obat Kolesterol Daun Sirsak

Expand the ears than your mouth. Because you have two hands and one mouth so you listen more than talk. Obat Kolesterol Daun Sirsak.

ret

You're looking for Retinoblastoma Eye medicine? Now it is already present Retinoblastoma Herbal Medicine Eye Eye Care softgel. Obat Retinoblastoma

boy25875

What a good blog you have here. Please update it more often. This topics is my interest. Thank you. . . contest design

You're looking for presbiopi

You're looking for presbiopi Eye medicine? Now it is already present presbiopi Herbal Medicine Eye Eye Care softgel. Obat Presbiopi

obat herbal alami penyakit

obat herbal alami penyakit rematik pengobatan rematik sendi dengan herbal tradisional problem asam urat tinggi temukan solusinya disini obat rematik tanpa efek samping

Curhat

Almost all women expect tomorrow will produce an average. Not Few people think that with the birth of many, it has been completely female. Keunggulan Ibu Hamil Melahirkan Secara Normal

Obat Bronkitis Kronis

Obat Bronkitis Kronis Obat herbal untuk mengobati bronkitis kronis adalah dengan mengkonsumsi QnC Jelly Gamat sesuai aturan maka dalam jangka waktu yang efektif akan menyembuhkan penyakit bronkitis kronis Anda.

Obat Ayan Untuk Anak

Obat Ayan Untuk Anak Obat ayan untuk anak QnC Jelly Gamat merupakan produk obat herbal ternama dan paling unggul saat ini yang terbuat dari bahan herbal alami, terbukti aman dan tanpa efek samping. Obat Ayan Epilepsi QnC Jelly Gamat terbuat dari bahan-bahan herbal dan alami yang mengutamakan keunggulan ekstrak teripang emas/gamat emas asli Indonesia.

Obat Ayan Untuk Anak

Obat Ayan Untuk Anak Obat Ayan Untuk Anak Dan Dewasa Ampuh, aman dan tanpa efek samping dengan QnC Jelly Gamat bisa Anda dapatkan dengan memesan kepada kami sekarang juga

Ramuan Tradisional Untuk Asam Lambung Tinggi

Continue to pray and believe, without complaining, always grateful. It will be wonderful all you can Ramuan Tradisional Untuk Asam Lambung Tinggi. Obat Wasir. obat kulit cantik. obat tbc paru untuk anak. obat batuk pilek yang aman untuk anak.

mata

Eye Care Softgel a natural eye nerve medicine made from blueberries one of the world green home products that have exceptional khsiat in preventing and curing many diseases of the eye. Obat Mata Astigmatisma

Obat Aborsi | Obat Penggugur Kandungan | Obat Telat Bulan

Cara menggugurkan kandungan & Obat penggugur kandungan paling baik dan aman dalam dunia kedokteran pasti kita selalu mendapatkan pertanyaan apakah bisa menggugurkan kandungan janin..?? obat telat bulan // Obat Aborsi // Jual obat kuat viagra di jakarta // Obat Misoprostol Cytotec // Obat Penggugur Kandungan // Obat Aborsi Jos

pengobatan wasir

Hemorrhoids / piles in The English called the Hemorrhoid is a state where the bearing anus decline caused by many things, these bearings consists of mucosa, smooth muscle jarinag anus, loose connective tissue and vascular tissue. Tips Mengatasi Wasir Pengobatan Wasir

Great

For First Packers and Movers

For Superlative Packers and

linuxpc

Do you need your website to be successful to maintain your business? Obat QnC Jelly Gamat obat tradisional asam lambung dan maag Kesehatan Anak

obat herbal

The wise man will let his past to make him better not bitter Obat Herbal untuk BAB Berdarah Pada anak

Bagi anda yang sedang

Bagi anda yang sedang membutuhkan cara pengobatan herbal alami gagal ginjal yang sudah cuci darah maupun yang belum lihat produk kami obat alami dengan metode tradisional yang tentunya tanpa efek samping karena menggunakan bahan dari alam yaitu obat herbal sakit ginjal yang sudah cuci darah sangat aman untuk penyembuhan gangguan ginjal, kini telah tersedia ektrak teripang jelly gamat luxor asli produk kesehatan berkualitas membantu penyembuhan berbagi jenis penyakit kronis tersedia dengan harga murah di pusat penjualan silahkan lihat penawaran kami disini. Apakah anda saat ini sedang mengalami penyakit anemia aplastik sekarang telah tersedia makanan alami dari ganggang laut khasiat spirulina obat anemia aplastik dan untuk keterangan lengkap manfaatnya bagi kesehatan silahkan lihat videonya. Kista ovarium dan mioma rahim adalah penyakit yang menggangu sistem reproduksi pada wanita ada salah satu cara menghilangkan kista miom tanpa operasi yaitu dengan menggunakan obat kista ovarium herbal tanpa efek samping banyak wanita sembuh karena terbukti dapat membantu mengobati penyakit ini untuk lebih jelasnya silahkan anda bisa simak baca penjelasan lengkapnya

Obat Daging Jadi Di Belakang Telinga

I was born not to menyakitimu Tapi kudigariskan unhappy life Obat Kencing Nanah Yang Sudah Parah Obat Maag Paling Ampuh Di Apotik harga jelly gamat di apotik Let the rain watered the mistake I regret I ini Biarlah moon shining star ini Biarlah enjoy ini biarlah all the pain I witness, I experienced

Obat Aborsi | Obat Penggugur Kandungan | Obat Telat Bulan

Cara menggugurkan kandungan & Obat penggugur kandungan paling baik dan aman dalam dunia kedokteran pasti kita selalu mendapatkan pertanyaan apakah bisa menggugurkan kandungan janin..?? telat bulan // Obat Pelancar Haid // Obat telat bulan // Obat Telat Bulan Misoprostol Cytotec // Cara Menggugurkan // Obat Aborsi

obat herbal gagal ginjal anak dan dewasa

Ace Maxs best solution as Herbal Medicines For Kidney Failure Children & Adults were able to help treat kidney failure are powerful and effective. For those patients with renal disease, maxs ace can be the best solution for you. http://membergreenworldindonesia.com/obat-herbal-gagal-ginjal-untuk-anak...

nutrisi penting

Lung merupak important organs for humans to survive. The lungs will supply "fuel" for the human form of oksige. Later this oxygen to be transported around the body so that each cell can work well. Without oxygen humans would not be alive "Machine" this one does not turn back if the fuel is already exhausted. http://nutrisipenting.com/nutrisi-untuk-penyakit-paru-paru/

think the combination of lots

think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Kutil Kelamin De Nature Asli, Ampuh, dan Tradisional I loved the tassel details on the dresses and on the ties for the bikinis. If I need a birthday gift for little girl, I am going to purchase one of those sundresses, they were too cute Obat Hepatitis B Terbaru, Paling Ampuh, dan Tradisional

wish great. and having fun

wish great. and having fun I've gone down the path of tracking down Obat Hepatitis B Paling Ampuh as much expired slide film as I can get my hands on. Obat Hepatitis B TradisionalUsually buying film after its expiry date means you can get it for half price or less... and usually without being able to notice any difference between it and non-expired film since you're essentially using Obat Radang Lambung dan Maag Lambung Paling Ampuh hink the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Hepatitis B Terbaru think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came

epilepsi

Diseases Epilepsy is a chronic neurological disease that causes seizures periodically. Seizures will occur when the electrical impulses in the brain blast past the normal limit. Obat Epilepsi Anak

Obat Kolesterol Di Apotik

thank for information succes one first position google Obat Luka Diabetes Basah Obat Tradisional Penyakit Luka Diabetes obat ejakulasi dini thanks

wasir

Inadequate intake of foods containing fiber, prolonged sitting, heavy lifting or straining during defecation is a factor that can cause hemorrhoid disease. Khasiat daun sirih merah

in all the shades of the

in all the shades of the rainbow.Obat Hepatitis B think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Kutil Kelamin De Nature think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all

the shades of the

the shades of the rainbow.Obat Kutil Kelamin think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Kutil Kelamin Ampuh think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Kutil Kelamin Tradisional think the combination of lots of bright colors and accents made the kids line super marketable.

The sundresses for kids were

The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Radang Lambung think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Radang Lambung Paling Ampuh think the combination of lots of bright colors and accents made the kids line super marketable. cara menghilangkan bekas eksim The sundresses for

The sundresses for kids were

The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Radang Lambung think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Radang Lambung Paling Ampuh think the combination of lots of bright colors and accents made the kids line super marketable. cara menghilangkan bekas eksim The sundresses for

kids were perfect. Like the

kids were perfect. Like the bikini's they came in all the shades of the rainbow.Obat Maag Lambung think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow. Obat Maag Lambung Paling Ampuh think the combination of lots of bright colors and accents made the kids line super marketable. The sundresses for kids were perfect. Like the bikini's they came in all the shades of the rainbow.

Obat Aborsi | Obat Penggugur Kandungan | Obat Telat Bulan

Cara menggugurkan kandungan paling baik dan aman dalam dunia kedokteran pasti kita selalu mendapatkan pertanyaan apakah bisa menggugurkan kandungan janin..??Disini kita akan membahas dengan jelas tentang prosedur yang sudah ada. Cara menggugurkan kandungan obat penggugur janin Cara Menggugurkan Kandungan Ampuh Obat Penggugur Kandungan Herbal Obat Aborsi Alami