forked from science-ation/science-ation
- Make "Contact Phone" sorter, so it fits in the header of the PDF
- Add an "export" option to the report editor.. so any custom report can be exported.. and sent to us, and we can insert it as a system report.
This commit is contained in:
parent
5bf1171f17
commit
d65bf7642e
@ -238,6 +238,51 @@ function reportChange()
|
|||||||
echo happy(i18n("Report Duplicated"));
|
echo happy(i18n("Report Duplicated"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($repaction == 'export') {
|
||||||
|
echo "<pre>";
|
||||||
|
$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 "</pre>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ---- Setup ------ */
|
/* ---- Setup ------ */
|
||||||
|
|
||||||
@ -433,6 +478,7 @@ function reportChange()
|
|||||||
echo " <option value=\"save\" $sel>Save this report</option>";
|
echo " <option value=\"save\" $sel>Save this report</option>";
|
||||||
$sel = ($repaction_save == 'try') ? "selected=\"selected\"" : '';
|
$sel = ($repaction_save == 'try') ? "selected=\"selected\"" : '';
|
||||||
echo " <option value=\"try\" $sel>Try this report</option>";
|
echo " <option value=\"try\" $sel>Try this report</option>";
|
||||||
|
echo " <option value=\"export\">Export this report</option>";
|
||||||
echo " <option value=\"\" ></option>";
|
echo " <option value=\"\" ></option>";
|
||||||
echo " <option value=\"dupe\" >Save as a new report(duplicate)</option>";
|
echo " <option value=\"dupe\" >Save as a new report(duplicate)</option>";
|
||||||
echo " <option value=\"\" ></option>";
|
echo " <option value=\"\" ></option>";
|
||||||
@ -441,6 +487,7 @@ function reportChange()
|
|||||||
echo " <option value=\"dupe\" >Save as a new report(duplicate)</option>";
|
echo " <option value=\"dupe\" >Save as a new report(duplicate)</option>";
|
||||||
$sel = ($repaction_save == 'try') ? "selected=\"selected\"" : '';
|
$sel = ($repaction_save == 'try') ? "selected=\"selected\"" : '';
|
||||||
echo " <option value=\"try\" $sel>Try this report</option>";
|
echo " <option value=\"try\" $sel>Try this report</option>";
|
||||||
|
echo " <option value=\"export\">Export this report</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</select>";
|
echo "</select>";
|
||||||
|
@ -121,7 +121,7 @@ $report_schools_fields = array(
|
|||||||
|
|
||||||
'school_contactphone' => array(
|
'school_contactphone' => array(
|
||||||
'name' => 'School -- Contact Phone (School Phone if exists, else Science Head Phone)',
|
'name' => 'School -- Contact Phone (School Phone if exists, else Science Head Phone)',
|
||||||
'header' => 'Contact Phone',
|
'header' => 'Cnct Phone',
|
||||||
'width' => 1,
|
'width' => 1,
|
||||||
'table' => "IF(schools.phone='',schools.scienceheadphone,schools.phone)",
|
'table' => "IF(schools.phone='',schools.scienceheadphone,schools.phone)",
|
||||||
'table_sort' => 'schools.phone' ),
|
'table_sort' => 'schools.phone' ),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user