diff --git a/admin/reports_editor.php b/admin/reports_editor.php index e9cbf52f..8710c01c 100644 --- a/admin/reports_editor.php +++ b/admin/reports_editor.php @@ -238,6 +238,51 @@ function reportChange() echo happy(i18n("Report Duplicated")); } + if($repaction == 'export') { + echo "
";
+	$q = mysql_query("SELECT system_report_id FROM reports WHERE 1 ORDER BY system_report_id DESC");
+	$r = mysql_fetch_assoc($q);
+	$sid = $r['system_report_id'] + 1;
+	$n = mysql_escape_string($report['name']);
+	$c = mysql_escape_string($report['creator']);
+	$d = mysql_escape_string($report['desc']);
+	$t = mysql_escape_string($report['type']);
+
+ 	echo "INSERT INTO `reports` (`id`, `system_report_id`, `name`, `desc`, `creator`, `type`) VALUES\n";
+	echo "\t('', '$sid', '$n', '$d', '$c', '$t');\n";
+
+	echo "INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`, `x`, `y`, `w`, `h`, `lines`, `face`, `align`) VALUES ";
+
+	/* Do the options */
+	$x = 0;
+	foreach($report['option'] as $k=>$v) {
+		echo "\n\t('', LAST_INSERT_ID(), 'option', $x, '$k', '$v', 0, 0, 0, 0, 0, '', ''),";
+		$x++;
+	}
+	/* Do the fields */
+	$fields = array('col', 'group', 'sort', 'distinct', 'filter');
+	$first = true;
+	foreach($fields as $f) {
+		foreach($report[$f] as $x=>$v) {
+			$k = $v['field'];
+			$vx = intval($v['x']);
+			$vy = intval($v['y']);
+			$vw = intval($v['w']);
+			$vh = intval($v['h']);
+			$vlines = intval($v['lines']);
+			$face = $v['face'];
+			$align = $v['align']. ' ' . $v['valign'];
+			$value=mysql_escape_string(stripslashes($v['value']));
+			if(!$first) echo ',';
+			$first = false;
+			echo "\n\t('', LAST_INSERT_ID(), '$f', $x, '$k', '$value', $vx, $vy, $vw, $vh, $vlines, '$face', '$align')";
+		}
+	}
+	echo ";\n";
+	echo "
"; + } + + /* ---- Setup ------ */ @@ -433,6 +478,7 @@ function reportChange() echo " "; $sel = ($repaction_save == 'try') ? "selected=\"selected\"" : ''; echo " "; + echo " "; echo " "; echo " "; echo " "; @@ -441,6 +487,7 @@ function reportChange() echo " "; $sel = ($repaction_save == 'try') ? "selected=\"selected\"" : ''; echo " "; + echo " "; } echo ""; diff --git a/admin/reports_schools.inc.php b/admin/reports_schools.inc.php index 9b8f2dd6..81382f49 100644 --- a/admin/reports_schools.inc.php +++ b/admin/reports_schools.inc.php @@ -121,7 +121,7 @@ $report_schools_fields = array( 'school_contactphone' => array( 'name' => 'School -- Contact Phone (School Phone if exists, else Science Head Phone)', - 'header' => 'Contact Phone', + 'header' => 'Cnct Phone', 'width' => 1, 'table' => "IF(schools.phone='',schools.scienceheadphone,schools.phone)", 'table_sort' => 'schools.phone' ),