Send alert from the calendar

Hi,

I Need to send an alert notificaci?n by email from the calendar application, then I add 2 fieles in the calendar table, email_alert varchar(100) and alert int (uses as flag, 1 for send alert and 0 for Not send)

Now, how can I send the notificaci?n when the event comes Or Bear from the date and time event?

Can I do this with ScriptCase? Or Need a cronjob?

Please, I Need your advices!

Eduardo Cazares

Re: Send alert from the calendar

I had the same problem. not with the Calendar but I needed a guard dog that is running at certain times something that is not by the event scheduler of mysql or perform an cron job was

Search for something (www.google.com) I found: http://keith-wood.name/countdown.html

a very fine tool with which you can do a lot.
Here is the source code of my guard dog (a prototype of a Blank App):


/* Macro sc_lookup */
#sc_include("imex.inc.php","grp");
# impex_options_load();
# Liste mit zu ?berwachenden Servern erstellen
# $ftp_svrs = impex_ftp_servers_watched();
# var_dump($ftp_svrs);
# impex_ftp_srv_filedownload();
{expire_url} = $this->Ini->server . sc_make_link(central_data_wizard);
{expire_url} = substr({expire_url},0,strpos({expire_url},'.php')).'.htm';
{download_url} = $this->Ini->server . sc_make_link(import_ftp);
{download_url} = substr({download_url},0,strpos({download_url},'.php')).'.htm';
 $dt = date("i");
 $dt = intval($dt);
 # ECHO $dt;
 
 
sc_lookup(ds, "SELECT sds_cda.next_scheduled_seconds()");

/* Error in Lookup */
if (FALSE === {ds}) 
 {
  {next_scheduled_time} = ''; 
 }
elseif (empty({ds})) 
 { 
  {next_scheduled_time} = '';
 }
else 
 {
  $seconds = $ds[0][0];
//  {next_scheduled_time} = date("d/m/Y h:i:s",time() + $seconds);//date('Y-m-d', $nextWeek)
  {next_scheduled_time} = $seconds;
 }
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<?
if ({next_scheduled_time}==0)
 {
  ECHO "<meta http-equiv=refresh content=300>
"; 
 }
else
 {
  ECHO "<meta http-equiv=refresh content=900>
";
 } 
?>  

<title>jQuery Countdown</title>
<style type="text/css">@import "<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/countdown/jquery.countdown.css";

#defaultCountdown { width: 100%; height: 50px; }
.highlight { color: #f00; }
</style>
<script type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/countdown/jquery.countdown.js"></script>
<script type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/flightboard/jquery.flightboard.js"></script>
<script type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/popup/jquery.popupWindow.js"></script>

<script type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/analogclock/excanvas.js"></script>
 
<script type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/analogclock/coolclock.js"></script> 
<script type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/analogclock/moreskins.js"></script> 
<script type="text/javascript">
$(function() {
	$('#defaultCountdown').countdown({ <?php 
	                  IF ({next_scheduled_time}<0)
	                  {
	                  ECHO ("since:". {next_scheduled_time});
	                  }
	                  else
	                  {
	                  ECHO ("until:". {next_scheduled_time}); 
	                  }
	                  ECHO ("
");
	                  ?>
	                 ,compact: false
	                 ,labels: ['J', 'M', 'W', 'T', 'Std', 'Min', 'Sek']
		             ,labels1: ['J', 'M', 'W', 'T', 'Std', 'Min', 'Sek']
		             ,compactLabels: ['J', 'M', 'W', 'T']
	                 ,onExpiry: liftoff
	                 ,onTick: check_scheduler 
	                 <?
	                 IF ({next_scheduled_time}<0)
	                  {
	                  ECHO (",tickInterval: 60");
	                  }
	                  else
	                  {
	                  ECHO (",tickInterval: 300"); 
	                  }
	                  ECHO ("
");
	                 ?>
	                 
	                 });
	                
	                
	
    function liftoff(){
     var windowFeatures =  'height=768' + 
 				',width=1200' + 
     			',toolbar=0' + 
				',scrollbars=0' + 
				',status=0' + 
				',resizable=0' + 
				',location=0' + 
				',menuBar=0';
     var centeredY,centeredX;
	 centeredY = window.screenY + (((window.outerHeight/2) - (768/2)));
	 centeredX = window.screenX + (((window.outerWidth/2) - (1024/2)));
	
	window.open('<?ECHO ({expire_url});?>','CDA', windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
    location.reload();
    }         

    function files_download()
    {
    var windowFeatures =  'height=50' + 
 				',width=650' + 
     			',toolbar=0' + 
				',scrollbars=0' + 
				',status=0' + 
				',resizable=0' + 
				',location=0' + 
				',menuBar=0';
     var centeredY,centeredX;
	 centeredY = window.screenY + (((window.outerHeight/2) - (50/2)));
	 centeredX = window.screenX + (((window.outerWidth/2) - (650/2)));
	
	window.open('<?ECHO ({download_url});?>','FTP-Download', windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
    
    }
    
    function check_scheduler(periods)
    {
    var rest;
    <?
    if ($dt>=5 && $dt<=21 ) 
     {
     if ($dt % 5 ==0) { ECHO "files_download();";}
     }
    #if ($dt % 5 ==0) { ECHO "location.reload();";}
    ?>
    }


}); 


</script>
</head>
<body onload="CoolClock.findAndCreateClocks()">
<center>  
   <table border ="0" width=100% cellspacing=0 cellpading=0 align="center">
          
      <tr>
        <td align="center"><canvas id="clockid" class="CoolClock:sds:40 "></canvas></td>
      </tr>
      <tr>
      <span id="monitor"></span></p>
      </tr>
      <tr>
        <td align="center"><div id="defaultCountdown"></div></td>
        
      </tr>
      <tr>
       
        <td align="center"><p><a href="<?ECHO ({expire_url});?>" title="CDA" class="popup">Erfassen</a>  <a href="<?ECHO ({download_url});?>" title="FTP-Download" class="popup">Import</a></p> </td>
       
      </tr>
      
   </table>
  </center> 




<script type="text/javascript"> 
$('.popup').popupWindow({
 height:768
,width:1200
,centerScreen:1 
}); 
</script>


<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4715900-1");
check_scheduler();
pageTracker._initData();
pageTracker._trackPageview();

</script>
</body>

</html>
<?php


Important:
I put the source code for the countdown countdowns script in case / prod / third / jquery-plugin /. There, he belongs to the folder structure of script case also points.
If you deploy in the production environment can create the scripts are all in the zip file.
Only the update of the updater script case deletes directories of netmake unfortunately all … So make a backup!!

I miss the possibility to register their own jquery, so they are available in any app …

1 Like

Re: Send alert from the calendar

Thanks Chopper66,

Let me try in your way!!!

Eduardo Cazares