I'd love to share information and am open to all the opinion and advices.
1.Try to open a web page file, such as
www.google.com
, using fopen( ) function. If we can open the file, then the internet is connected, otherwise, no connection.
2.I really appreciate you mentioned the cron job! For now, we've only completed the functions to meet the basic needs. The supervisors will have to import the vv files manually. Of course we rewrite the dataentry.php file so that they can import many vv files just like importing one. We have already planned to automaticly import vv files using shell in the next version.
3.We can't just upload the current day's surveys because we can't be sure that the interviewers can upload their surveys everyday, although the off-line end will pop up an alert when the interviewers haven't done the uploading operation in the last 24 hours.
So here's our solution: we modify the lime_survey_(sid) table by adding some useful columns, one of which is to record whether the certain row needs to be uploaded in the next uploading operation. Let's name the column A. A is either 0 or 1. 0 is the default value, meaning this row of data needs to be uploaded. 1 means that the row has already been uploaded in completion and doesn't need to be uploaded any more. Now you can tell, the newly inserted surveys, the uncompleted surveys and the not-yet-uploaded completed surveys are all set to 0. Only the ones that are completed and just uploaded will be set to 1, so in the next uploading the row wouldn't be uploaded again because we only upload those with A being 0.
4. We update the token table in the off-line end. Our survey is not anonymous and has a token table. The supervisors manage the token table on the server end. They generate a .sql file from the token table and upload the file to the ftp server when there are samples to be updated on the off-line ends. The interviewers will just click the update button and the .sql file will be downloaded to their systems to update their token tables backstage.
We are doing this for our own needs. I'd really like to know what kind of off-line limesurvey do you expect if you don't mind.