Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Notifications/prompt to other user page using PHP?

    I've originally posted this inquiry in the javascript forum and was said that it was impossible since "javascript is strictly client-side" and was advised to look into PHP scripting. I'm currently researching about it but so far it has not yielded good results any additional info is greatly appreciated.

    My inquiry is that my group is working on a basic document management system that includes four users. staff member, department director, division chief and clerk. The programming language that we used is PHP.

    when staff member logs-in on his homepage and uploads a file he must choose reviewer from a dropdown menu that consists of dep. director and div. chief.

    When he clicks the upload button the homepage of who he chose as reviewer should receive a prompt/alert box upon log-in saying "you have a document to review".

    For example:
    if he chose division chief as the reviewer when the person logs-in on his homepage a prompt/alert should display that he has something to review.

    The code for uploading file is already up and working. We are looking for advice on how to integrate javascript in this system. Especially in the prompt part. thanks for your ideas.

    Can you point in some directions or topics that I can look at? Because I'm sincerely lost. Thanks for your helping hand
    Last edited by fireflight; 11-20-2010 at 06:40 PM. Reason: corrections to paragraph/statement six. Any ideas/methods/approach on how to notify another user upon upload of document

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Two methods spring to mind. Send the recipient an e-mail or use AJAX to poll the server. Second method generates unnecessary network traffic.

  • #3
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    This is not really difficult with PHP, even if you have to use a separate form for the reviewer choice. Make separate small .php files for the reviewers, this would only hold the name of the uploader, the name of the file uploaded and a variable set as a flag value. When the reviewer logs in his file would be read and this data would be echoed into the javascript block. Even better would be to integrate it into a data base, where you could handle several entries at a time.

  • #4
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    I'd overlooked the 'upon login' bit. In that case, sod the JS and just add a message block to the page to notify them of new uploads when they log in. That can be done within the server scripting language. No need for using JS.

  • #5
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    Quote Originally Posted by MattF View Post
    I'd overlooked the 'upon login' bit. In that case, sod the JS and just add a message block to the page to notify them of new uploads when they log in. That can be done within the server scripting language. No need for using JS.
    That's actually better than my suggestion, since you can just append any new entries to the listing and make a button so that the reviewer can clear his listing from time to time.

  • #6
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What general topic in PHP handles this part of the scripting?

  • #7
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry but We've just started studying and using php and we don't quit know the extents of the language. What do you mean by placing a message block?. Is it using echo or something? would it somehow read the changes in the database so that it would display the notification?

  • #8
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Quote Originally Posted by fireflight View Post
    What do you mean by placing a message block?. Is it using echo or something? would it somehow read the changes in the database so that it would display the notification?
    That's pretty much what would happen. A normal page would be something like:

    Code:
    <html>
    <head>
    </head>
    <body>
    <div class="main-content">
    [your normal page output here]
    </div>
    </body>
    </html>
    When a user logs in and you query the DB to find out if there are new messages for them, whilst you are generating the page you would add an extra block where you place links, summaries etc of the new reports. Something like:

    Code:
    <html>
    <head>
    </head>
    <body>
    <div class="reports">
    [list the new reports here]
    </div>
    <div class="main-content">
    [your normal page output goes here]
    </div>
    </body>
    </html>
    That reports div would only be there if there if any new reports had been found for that user.


  •  

    Posting Permissions

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