...

View Full Version : Notifications/prompt to other user page using PHP?



fireflight
11-20-2010, 05:36 PM
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

MattF
11-20-2010, 05:46 PM
Two methods spring to mind. Send the recipient an e-mail or use AJAX to poll the server. Second method generates unnecessary network traffic.

DrDOS
11-20-2010, 05:54 PM
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.

MattF
11-20-2010, 05:56 PM
I'd overlooked the 'upon login' bit. :D 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.

DrDOS
11-20-2010, 06:01 PM
I'd overlooked the 'upon login' bit. :D 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.

fireflight
11-21-2010, 07:15 AM
What general topic in PHP handles this part of the scripting?

fireflight
11-21-2010, 08:47 AM
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?

MattF
11-21-2010, 11:04 AM
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:



<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:



<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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum