How to make a "Notify me when on a certain date!

Permalink
Hi

Need to build a blok "Notify me when on a certain date"! i want a reminder to popup on acertain date i choose.

Thanks

/Mike

mikefatty
 
Mainio replied on at Permalink Reply
Mainio
Hi,

Could you drop in a little more detailed information so that people can help you out:
- Are you building this yourself and you need some tips on how to do it?
- Do you need someone else to do it for you?
- What specifically you need. A block that you can add to a page that would be otherwise empty but AFTER dd/mm/2011 it would display some message?
- Is the message for example user-specific so every user should have their own message there?
- Should users be able to add/edit these notifications themselves?

So basically what I'm getting into with these questions is that are you looking for a "calendar-like", user-specific functionality that would be editable by your users for your users (themselves). Or alternatively, are you just looking for a block that would display e.g. on Obama's page "Happy birthday Obama" on the date of his birth?

Checked out the marketplace and for the latter, I found this one that might serve your needs with some customization:http://www.concrete5.org/marketplace/addons/mailmonkey/...

If you're looking more like the calendar-like functionality, I'm not sure what to use on that or develop your own add-on. There are bunch of calendar add-ons available at the marketplace that might be extendable to serve this need:
http://www.concrete5.org/marketplace/addons/-/view/?submit_search=1...

Br,
Antti / Mainio
mikefatty replied on at Permalink Reply
mikefatty
Sorry for the lack of quistion. here is a little more description

It has to be like a News feature where you can set such a date and time. When the date is near the "News block" will be visible on the website. Just like when going on holiday and your not near any computer so you can put the news feature to launch itself.

Thanks in advanced :-)

Mike
Mainio replied on at Permalink Best Answer Reply 1 Attachment
Mainio
Hi,

Actually you can set up publishing dates for the pages. This way you can also achieve the desired functionality. You just need to do a little override in the Page List block's controller.

Copy this file:
/concrete/blocks/page_list/controller.php
to here:
/blocks/page_list/controller.php

Open that file and find the method getPages(). Under this you find this row (line 48 of the file):
$pl = new PageList();


Add one row below it so that it looks like this:
$pl = new PageList();
$pl->filter('cvDatePublic', date('Y-m-d'), '<=');


EDIT: Actually there is even an own function for this purpose, so this does 100% the same what I wrote above:
$pl->filterByPublicDate(date('Y-m-d H:i:s'), '<=');


Also, it might be good idea to include also the time in the filter so that it works also for the time of the public date. This is also included in the second example.

After this you can control when your pages get published by setting the "public date/time" from your page properties. Please see the attached file for where to find that field.
mikefatty replied on at Permalink Reply
mikefatty
Hi awesome description! ill test it right away when i get home from Work! Again thx for using ur time to answering me.
mikefatty replied on at Permalink Reply
mikefatty
Yeah Mainio ! that did the trick! that small code and good description from you did it! its like Christmas morning! :-)thx again

is there away to import that code in the a block? say if i made a costume block with the add-on "designer content" see here:http://www.skp-gulstue.dk

can i also place the $pl->filterByPublicDate(date('Y-m-d H:i:s'), '<='); in the controller? to get the block to be visible a a certain date.?

my project/website is for my students so when the have exam on a certain date, it will popup a month before. (then i can keep track on the students and they exams)
actinium replied on at Permalink Reply
actinium
You could use the PHP block extension and set the code up something like this. Not going to code it all out though
<?php
    //set the timezone, I would use a script to dynamically get it though
    date_default_timezone_set('UTC');
      $current_date = getDate(params);
      $alert_date = *your date*
       if ($alert_date == TRUE){
              //DO THIS
       } else {
             //nothing
       }


That is just a guess. Not a for sure thing though.
mikefatty replied on at Permalink Reply
mikefatty
Hi actinium!
where shut i connect the script to the block?
actinium replied on at Permalink Reply
actinium
Here is the link to the add on that I was referring to. You just add it like another block. That is a way to do it from the front end. There is a way to do it from the back end as well. Just click add block and select PHP block. You then treat it like the HTML block. Just add your code.

http://www.concrete5.org/marketplace/addons/simple-php-block/...
mkly replied on at Permalink Reply
mkly
You might want to set a cookie while doing this or it's going to "pop up" every time the same user views a new page on your site as opposed to the first time. I would get pretty annoyed pretty fast if that happened.
actinium replied on at Permalink Reply
actinium
Cookies are the way to go but why would it keep popping up if you have it set to only go off on a certain date? Shouldn't only happen on the page where the block is? I guess I am confused on what you are saying.
mkly replied on at Permalink Reply
mkly
I meant if you visited that page multiple times on that date.
actinium replied on at Permalink Reply
actinium
Okay. That makes sense. If its an actual "alert' then I see what you are saying. I see how you goth that from my code. Poor var on my part. Lets try... "$item_date"
mkly replied on at Permalink Reply
mkly
I hope I didn't come across as rude. I'm apologize if I did. My comment was about the original posting of "I want a reminder to popup on a certain date I choose". I was more thinking that it was going to be a modal popup window or something. Sorry about that.
actinium replied on at Permalink Reply
actinium
Oh of course not! I agree with you. I am not offended. Its the only way that we can become better developers!
Mainio replied on at Permalink Reply
Mainio
Actually what I got from his description is that he just wants to have a page list block with news "popping up" when their publish date has passed.

Maybe the popup term wasn't correct in this context...
actinium replied on at Permalink Reply
actinium
Yeah, that is what I thought.

PS mikefatty if you want to call the script in the block and not put it in the block. I would go the back way of rendering it or I don't know if this would would but in the block you could try this:

<?php include('this_script.php') ?>


Worth a shot. Not sure if it would work. Haven't tried it.
mikefatty replied on at Permalink Reply
mikefatty
Hi actinium thanks for your, you have been very helpfully. Its good to know there are some good developers it this forum! save me a lot of time! thx again!
actinium replied on at Permalink Reply
actinium
Of course! Thats what we do here!