如何在应用程序的任何页面上显示提醒窗口


How to display a reminder window on any page of application

在我的web应用程序中,用户将能够为即将到来的任务和事件设置提醒。我正在使用CodeIgniter (PHP)与模型-视图-控制器基础开发应用程序。我设置了提醒所需的数据库表。我将运行我的提醒控制器与作业服务器。我的困惑从这里开始。这个控制器将调用视图文件,它是一个弹出窗口。但我需要显示这个提醒弹出窗口的页面上的用户是在。如何在另一个视图上显示一个视图?或者你有什么建议吗?

我相信你指的是模态窗口。如果是这种情况,您需要使用JS/jQuery或/and CSS。你可以谷歌一下,找到很多关于情态动词的教程。如果没有,请继续提问。

您应该创建另一个PHP文件,并将该文件包含在每个需要提醒窗口的文件中。

  1. 在公共文件中应该有一些函数,如"setInterval"然后通过js或jquery调用modal

2。也许它有帮助(两者都在同一个文件中)

JS

setInterval(tick, 30000); function tick() { 
   //get the mins of the current time 
   var mins = new Date().getMinutes();
   if(mins == "18"|| mins == "19" || mins == "20"||mins == "21" || mins == "22" || mins == "23"){
      $('#reminder').modal('show'); 
     beep(); 
   } 
}

HTML (Bootstrap modal)

<div id="reminder" class="modal fade bd-example-modal-lg" > 
        <div class="modal-dialog modal-lg" style=" margin-top: 150px; ">
            <div class="modal-content"> 
               <div class="modal-header"> 
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;
                   </button> 
                   <h4 class="modal-title" style="color:red;">
                       Reminder
                   </h4>
               </div> 
               <div class="modal-body" id="reminder_body"> 
               <script> 
                   load_reminder();
               </script>  
              </div> 
         <div class="modal-footer"> 
              <button type="submit" class="btn btn-primary" data-dismiss="modal" >
                    Ok
             </button> 
       </div>