Results 1 to 3 of 3

Thread: Reminder Popuup across module

  1. #1
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default Persistant Alert/Reminder

    Hey All,
    In OS 4.0.1f, I would like to implement a reminder that will pop-up regardless of which module the user happens to be browsing at any given moment, but not at all sure how to go about it. javascript?, echo div? I have the "reminder" period worked out, and was thinking of something like the following:

    PHP Code:
    $period $marketingCycle[1];
    $reminder date('Y-m-d'strtotime($period ' -1 days')); 

    if (
    $today == $reminder){
      
    $check_emailman " select * from emailman ";
        
    $result = @mysql_query ($check_emailman); // Run the query.
            
    $numresults=mysql_query($check_emailman);
            
    $numrows=mysql_num_rows($numresults);
    // If we have  no results...echo reminder or launch popup
    if ($numrows == 0)
        {echo 
    "<P align='center'> TIME TO SEND CANVAS EMAIL<br>
            <input type='button' value='OK'></p>"
    ;
    }} 
    Last edited by tj@estreet.com; 2006-11-22 at 11:01 AM. Reason: better title

  2. #2
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default Re: Reminder Popuup across module

    Seems like adding the following to jsAlerts.php should do the trick, but I get no alert. Anyone???
    PHP Code:
    // Prep Campaign Reminder & Query 
    $reminder date('Y-m-d');
    $today date('Y-m-d');

    if ((
    $db->dbType == 'mysql')&&($today == $reminder)) {
        
    $user_campaign " SELECT id FROM campaigns WHERE campaign.assigned_user_id ='".$current_user->id."' ";
            global 
    $db;
            
    $result $db->query($user_campaign);
                while(
    $row $db->fetchByAssoc($result)){
            
    $campaignID $row["id"]; 
         } 

        
    $check_emailman =" select emailman.id, emailman.deleted from emailman where emailman.id !='' and emailman.deleted !='1'";
            
    $result $db->query(check_emailman);
            
    $numresults=$db->query(check_emailman);
            
    $numrows=mysql_num_rows($numresults);
    // If we have no results, return alert
        
    while ($numrows !== 0){   
        
    $this->addAlert('Time to Send Canvas Email''index.php?action=DetailView&module=Campaigns&record= $campaignID');
        }


  3. #3
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default here is my persistant alert hack.

    //Prep CANVAS query
    // using "if ($today == date ('Y-m-d')){ " (if water is wet, sky is blue..) to test

    1. Added alert function in sugar_3.js
    HTML Code:
    function periodAlert(){
      var r=confirm("Time to Send Canvas Email")
      if (r==true)
        {
    	window.location = 'index.php?action=DetailView&module=Campaigns&action=index'
        }
      }
    2. Added function in jsAlerts.php below addAlerts
    PHP Code:
        function periodAlert(){
            
    $this->script .= 'periodAlert()' "\n";
        } 
    3. Added "//Prep MyQuery between // Prep Meetings Query & // Prep Calls Query (also jsAlerts.php)
    PHP Code:
    if ($today == date ('Y-m-d')){ 
    $period_time_end $timedate->handle_offset(date("Y-m-d H:"), $timedate->dbDayFormatfalse); 
                
    $select_emailman " SELECT id, deleted FROM emailman WHERE id !='' AND deleted !=1 "
                
    $result mysql_query($select_emailman)or die ("Query failed - select_emailman"); // Run the query. 
                
    $numresults=mysql_query($select_emailman); 
                
    $numrows=mysql_num_rows($numresults); 
        
    // If we have no results, periodAlert 
    if (!isset($_SESSION['alertTime'])) 
      
    $_SESSION['alertTime'] = 0
         
    if (
    $numrows == && time()  > ($_SESSION['alertTime'] + (5*60))){ 
                
    $this->periodAlert();            $_SESSION['alertTime'] = time(); 
        } 

    When the end of our marketing periods roll around, we now get an alert every five minutes reminding us to Send Canvas Email Campaign if there are no current emails queud in emailman.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •