use DBI;
use Getopt::Std;
+
###################################################
# GLOBALS
$dbname = "phpgroupware";
-$dbhost = "192.168.0.2";
+$dbhost = "192.168.0.2"; # This can be an IP address or name
$dbport = 3306;
-$dbuser = "phpgroupware";
-$dbpass = "phpgroupware";
+$dbuser = "phpgroupware"; # This may require an additional '\@localhost'
+$dbpass = "phpgroupware";
+###################################################
+
%hometeaching_data = ();
%membership_data = ();
getopts('vsn:o:');
###################################################
# Open a connection to the database
-$dbh=DBI->connect("dbi:mysql:dbname=$dbname;host=$dbhost port=$dbport",$dbuser,$dbpass,{
+$dbh=DBI->connect("dbi:mysql:dbname=$dbname;host=$dbhost;port=$dbport",$dbuser,$dbpass,{
AutoCommit=>0,
PrintError=>0}) or print "Connect Failure:".$DBI::errstr."\n" and exit 2;
&update_eq_parent_table();
&update_eq_child_table();
+print "\n-> Import Successful! DONE...\n";
+
###################################################
# Disconnect from the database
$dbh->disconnect();
######################################################################
-
-
-
-
-
-
-
-
-
-
use DBI;
use Getopt::Std;
+
###################################################
# GLOBALS
$dbname = "phpgroupware";
-$dbhost = "192.168.0.2";
+$dbhost = "192.168.0.2"; # This can be an IP address or a name
$dbport = 3306;
-$dbuser = "phpgroupware";
-$dbpass = "phpgroupware";
+$dbuser = "phpgroupware"; # This may require an additional '\@localhost'
+$dbpass = "phpgroupware";
+###################################################
+
%hometeaching_data = ();
%membership_data = ();
getopts('vsn:o:b');
###################################################
# Open a connection to the database
-$dbh=DBI->connect("dbi:mysql:dbname=$dbname;host=$dbhost port=$dbport",$dbuser,$dbpass,{
+$dbh=DBI->connect("dbi:mysql:dbname=$dbname;host=$dbhost;port=$dbport",$dbuser,$dbpass,{
AutoCommit=>0,
PrintError=>0}) or print "Connect Failure:".$DBI::errstr."\n" and exit 2;
4) Edit the LOCAL CONFIGURATION section of eq/inc/class.eq.inc.php
Make sure you update the path locations for your specific:
upload_target_path & script_path
- 5) A graphical representation of the mysql schema used by this application can
+ 5) Edit the GLOBALS section of the eq/bin/import_ward_data script
+ 6) Edit the GLOBALS section of the eq/bin/parse_ward_data script
+ 7) Try to run eq/bin/import_ward_data & parse_ward_data scripts from the commandline
+ to check for any missing perl library dependencies and mysql connection.
+ Just run them without command line args.
+ Install the right perl modules until the scripts run without any errors.
+ 8) A graphical representation of the mysql schema used by this application can
be found here: eq/sql/eq.jpg
- 6) Click on the Admin tool in the EQ app to import your initial set of ward data
+ 9) Click on the Admin tool in the EQ app to import your initial set of ward data
obtained from MLS into the EQ application.
- 7) Click on the Admin tool and update the EQ Presidency Table appropriately.
+ 10) Click on the Admin tool and update the EQ Presidency Table appropriately.
The most important thing at this point is to get your district leaders added
for each district you have in your quorum.
+ 11) I highly recommend installing phpmyadmin to view/edit/debug mysql tables related to this tool.
Requirements
function eq()
{
// LOCAL CONFIGURATION. PLEASE UPDATE AS APPROPRIATE.
- $this->upload_target_path = "/home/users/eqpres/eq_data/";
- $this->script_path = "/usr/share/phpgroupware/eq/bin/";
+ $this->upload_target_path = "/home/users/eqpres/eq_data";
+ $this->script_path = "/usr/share/phpgroupware/eq/bin";
$this->default_ht_num_months = 3;
$this->default_ppi_num_months = 3;
$this->default_ppi_num_years = 0;
if($action == 'upload')
{
- $target_path = $this->upload_target_path . basename( $_FILES['uploadedfile']['name']);
+ $target_path = $this->upload_target_path . '/' . basename( $_FILES['uploadedfile']['name']);
- if((($_FILES['uploadedfile']['type'] == "application/zip") ||
- ($_FILES['uploadedfile']['type'] == "application/x-zip-compressed") ||
- ($_FILES['uploadedfile']['type'] == "application/x-zip") ||
- ($_FILES['uploadedfile']['type'] == "application/octet-stream")) &&
- (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))) {
+ if(($_FILES['uploadedfile']['type'] == "application/zip") ||
+ ($_FILES['uploadedfile']['type'] == "application/x-zip-compressed") ||
+ ($_FILES['uploadedfile']['type'] == "application/x-zip") ||
+ ($_FILES['uploadedfile']['type'] == "application/octet-stream")) {
+
+ if(!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
+ $uploadstatus = "<b><font color=red> -E- Unable to move the uploaded file to ";
+ $uploadstatus.= "the target path (check the path and permissions) of: $target_path</font></b>";
+ $this->t->set_var('uploadstatus',$uploadstatus);
+ $this->t->pfp('uploadhandle','upload',True);
+ return 0;
+ }
+
$uploadstatus = "<b>The following file was uploaded successfully: </b><br><br>";
$uploadstatus.= "Filename : " . $_FILES['uploadedfile']['name'] . "<br>";
$uploadstatus.= "Type : " . $_FILES['uploadedfile']['type'] . "<br>";
# make a directory for this data to be stored in
$date="data_" . date("Y_m_d");
- $data_dir = $this->upload_target_path . $date;
+ $data_dir = $this->upload_target_path . '/' . $date;
print "-> Making the data directory: $date<br>\n";
- exec('mkdir ' . $data_dir . ' 2>&1', $result, $return_code);
+ exec('mkdir -p ' . $data_dir . ' 2>&1', $result, $return_code);
if($return_code != 0) {
print implode('\n',$result) . "<br>";
print "<b><font color=red>";
# update the data_latest link to point to this new directory
print "-> Updating the latest data dir link<br>\n";
- $data_latest = $this->upload_target_path . 'data_latest';
+ $data_latest = $this->upload_target_path . '/data_latest';
exec('rm ' . $data_latest. '; ln -s ' . $data_dir .' '. $data_latest .' 2>&1', $result, $return_code);
if($return_code != 0) {
print implode('\n',$result) . "<br>";
ob_flush(); flush(); sleep(1);
$import_log = $this->upload_target_path . '/import.log';
$data_log = $this->upload_target_path . '/data.log';
- $import_cmd = $this->script_path . 'import_ward_data ' . $data_latest . ' | tee ' . $import_log;
- $parse_cmd = $this->script_path . 'parse_ward_data -v ' . $data_latest . ' > ' . $data_log;
+ $import_cmd = $this->script_path . '/import_ward_data ' . $data_latest . ' 2>&1 | tee ' . $import_log;
+ $parse_cmd = $this->script_path . '/parse_ward_data -v ' . $data_latest . ' > ' . $data_log . '2>&1';
#print "import_cmd: $import_cmd<br>";
#print "parse_cmd: $parse_cmd<br>";
ob_start('ob_logstdout', 2);
`president` tinyint(1) default '0',
`counselor` tinyint(1) default '0',
`secretary` tinyint(1) default '0',
+ `eqpres` tinyint(1) default '0',
`valid` tinyint(1) default '1',
KEY `presidency` (`presidency`),
KEY `elder` (`elder`)
{table_data}
</table>
<b>Notes:</b>
+ <br>- The District is a drop-down list. Please assign a unique district number per district supervisor.
<br>- The President, Counselor, Secretary, and EQ Presidency fields are boolean value (true|false) flags.
<br>- If a member of the presidency is not a District Leader, make sure to set their "District=0".
<br>- If a district leader is not a member of the presidency, add them without setting any other flags except the district.
<br>- You can only add 1 new presidency member at a time (1 per each update request to the table).
- <br>- Make sure you have at least 1 EQ Presidency member that is marked as EQ Presidency=1 with no Elder selected.
+ <br>- Make sure you have 1 EQ Presidency member that is marked as EQ Presidency=1 with no Elder selected.
<br>This entry is used to email the entire presidency, and its email address should cause that to happen.
<br><br>
<input type="submit" value="Update EQ Presidency Table">