Example #1
0
 function AddHeading()
 {
     global $report;
     // determine the number of columns and build heading
     //	foreach ($report->fieldlist as $Temp) $ColBreak[] = ($Temp['break']) ? true : false;
     $html_heading = array();
     $data = NULL;
     foreach ($report->fieldlist as $value) {
         if ($value->visible) {
             $data .= htmlspecialchars($value->description);
             if (!$value->columnbreak) {
                 $data .= '<br />';
                 continue;
             }
             $html_heading[] = array('align' => $align, 'value' => $data);
             $data = NULL;
         }
     }
     if ($data !== NULL) {
         // catches not checked column break at end of row
         $html_heading[] = array('align' => $align, 'value' => $data);
     }
     $this->numColumns = sizeof($html_heading);
     $rStyle = '';
     if ($report->page->heading->show) {
         // Show the company name
         $color = $this->convert_hex($report->page->heading->color);
         $dStyle = 'style="font-family:' . $report->page->heading->font . '; color:' . $color . '; font-size:' . $report->page->heading->size . 'pt; font-weight:bold;"';
         $this->writeRow(array(array('align' => $report->page->heading->align, 'value' => htmlspecialchars(COMPANY_NAME))), $rStyle, $dStyle, $heading = true);
     }
     if ($report->page->title1->show) {
         // Set title 1 heading
         $color = $this->convert_hex($report->page->title1->color);
         $dStyle = 'style="font-family:' . $report->page->title1->font . '; color:' . $color . '; font-size:' . $report->page->title1->size . 'pt;"';
         $this->writeRow(array(array('align' => $report->page->title1->align, 'value' => htmlspecialchars(TextReplace($report->page->title1->text)))), $rStyle, $dStyle, $heading = true);
     }
     if ($report->page->title2->show) {
         // Set Title 2 heading
         $color = $this->convert_hex($report->page->title2->color);
         $dStyle = 'style="font-family:' . $report->page->title2->font . '; color:' . $color . '; font-size:' . $report->page->title2->size . 'pt;"';
         $this->writeRow(array(array('align' => $report->page->title2->align, 'value' => htmlspecialchars(TextReplace($report->page->title2->text)))), $rStyle, $dStyle, $heading = true);
     }
     // Set the filter heading
     $color = $this->convert_hex($report->page->filter->color);
     $dStyle = 'style="font-family:' . $report->page->filter->font . '; color:' . $color . '; font-size:' . $report->page->filter->size . 'pt;"';
     $this->writeRow(array(array('align' => $report->page->filter->align, 'value' => htmlspecialchars(TextReplace($report->page->filter->text)))), $rStyle, $dStyle, $heading = true);
     // Set the table header
     $color = $this->convert_hex($report->page->data->color);
     $rStyle = 'style="background-color:' . $this->HdColor . '"';
     $dStyle = 'style="font-family:' . $report->page->data->font . '; color:' . $color . '; font-size:' . $report->page->data->size . 'pt;"';
     $align = $report->page->data->align;
     // Ready to draw the column titles in the header
     $this->writeRow($html_heading, $rStyle, $dStyle);
 }
 function AddHeading()
 {
     global $Prefs, $Heading, $Seq;
     // determine the number of columns and build heading
     foreach ($Seq as $Temp) {
         $ColBreak[] = $Temp['break'] ? true : false;
     }
     $html_heading = array();
     $data = NULL;
     foreach ($Heading as $key => $value) {
         $data .= htmlspecialchars($value);
         if (!$ColBreak[$key]) {
             $data .= '<br />';
             continue;
         }
         $html_heading[] = array('align' => $align, 'value' => $data);
         $data = NULL;
     }
     if ($data !== NULL) {
         // catches not checked column break at end of row
         $html_heading[] = array('align' => $align, 'value' => $data);
     }
     $this->numColumns = sizeof($html_heading);
     $rStyle = '';
     if ($Prefs['coynameshow']) {
         // Show the company name
         $color = $this->convert_hex($Prefs['coynamefontcolor']);
         $dStyle = 'style="font-family:' . $Prefs['coynamefont'] . '; color:' . $color . '; font-size:' . $Prefs['coynamefontsize'] . 'pt; font-weight:bold;"';
         $this->writeRow(array(array('align' => $Prefs['coynamealign'], 'value' => htmlspecialchars(COMPANY_NAME))), $rStyle, $dStyle, $heading = true);
     }
     if ($Prefs['title1show']) {
         // Set title 1 heading
         $color = $this->convert_hex($Prefs['title1fontcolor']);
         $dStyle = 'style="font-family:' . $Prefs['title1font'] . '; color:' . $color . '; font-size:' . $Prefs['title1fontsize'] . 'pt;"';
         $this->writeRow(array(array('align' => $Prefs['title1fontalign'], 'value' => htmlspecialchars(TextReplace($Prefs['title1desc'])))), $rStyle, $dStyle, $heading = true);
     }
     if ($Prefs['title2show']) {
         // Set Title 2 heading
         $color = $this->convert_hex($Prefs['title2fontcolor']);
         $dStyle = 'style="font-family:' . $Prefs['title2font'] . '; color:' . $color . '; font-size:' . $Prefs['title2fontsize'] . 'pt;"';
         $this->writeRow(array(array('align' => $Prefs['title2fontalign'], 'value' => htmlspecialchars(TextReplace($Prefs['title2desc'])))), $rStyle, $dStyle, $heading = true);
     }
     // Set the filter heading
     $color = $this->convert_hex($Prefs['filterfontcolor']);
     $dStyle = 'style="font-family:' . $Prefs['filterfont'] . '; color:' . $color . '; font-size:' . $Prefs['filterfontsize'] . 'pt;"';
     $this->writeRow(array(array('align' => $Prefs['filterfontalign'], 'value' => htmlspecialchars(TextReplace($Prefs['filterdesc'])))), $rStyle, $dStyle, $heading = true);
     // Set the table header
     $color = $this->convert_hex($Prefs['datafontcolor']);
     $rStyle = 'style="background-color:' . $this->HdColor . '"';
     $dStyle = 'style="font-family:' . $Prefs['datafont'] . '; color:' . $color . '; font-size:' . $Prefs['datafontsize'] . 'pt;"';
     $align = $Prefs['datafontalign'];
     // Ready to draw the column titles in the header
     $this->writeRow($html_heading, $rStyle, $dStyle);
 }
    include $custom_path;
}
/**************   page specific initialization  *************************/
$todo = isset($_POST['todo']) ? $_POST['todo'] : $_GET['todo'];
$ReportID = isset($_POST['ReportID']) ? $_POST['ReportID'] : $_GET['ReportID'];
$result = $db->Execute("select description from " . TABLE_REPORTS . " where id = " . $ReportID);
$report_title = $result->fields['description'];
$result = $db->Execute("select params from " . TABLE_REPORT_FIELDS . " where entrytype = 'pagelist' and reportid = " . $ReportID);
$Prefs = unserialize($result->fields['params']);
$result = $db->Execute("select display_name, admin_email from " . TABLE_USERS . " where admin_id = " . $_SESSION['admin_id']);
$sender_name = $result->fields['display_name'];
$sender_email = $result->fields['admin_email'];
$recpt_name = '';
$recpt_email = '';
$message_subject = $report_title . ' ' . TEXT_FROM . ' ' . COMPANY_NAME;
$message_body = $Prefs['email_msg'] ? TextReplace($Prefs['email_msg']) : sprintf(RW_EMAIL_BODY, $report_title, COMPANY_NAME);
$delivery_method = $_POST['delivery_method'] ? $_POST['delivery_method'] : 'I';
if ($delivery_method == 'S') {
    $from_name = $_POST['sender_name'] ? $_POST['sender_name'] : $sender_name;
    $from_address = $_POST['sender_email'] ? $_POST['sender_email'] : $sender_email;
    $to_name = $_POST['recpt_name'] ? $_POST['recpt_name'] : $recpt_name;
    $to_address = $_POST['recpt_email'] ? $_POST['recpt_email'] : $recpt_email;
    $cc_name = $_POST['cc_name'] ? $_POST['cc_name'] : $_POST['cc_email'];
    $cc_address = $_POST['cc_email'] ? $_POST['cc_email'] : '';
    $email_subject = $_POST['message_subject'] ? $_POST['message_subject'] : $message_subject;
    $email_text = $_POST['message_body'] ? $_POST['message_body'] : $message_body;
}
if (!$ReportID) {
    // then no report was selected, error
    $messageStack->add(RW_FRM_NORPT, 'error');
} else {
Example #4
0
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   |
// | GNU General Public License for more details.                    |
// +-----------------------------------------------------------------+
//  Path: /modules/phreeform/ajax/load_email_msg.php
//
/**************   Check user security   *****************************/
$security_level = validate_ajax_user(SECURITY_ID_PHREEFORM);
/**************  include page specific files    *********************/
require_once DIR_FS_MODULES . 'phreeform/defaults.php';
require_once DIR_FS_MODULES . 'phreeform/functions/phreeform.php';
/**************   page specific initialization  *************************/
$rID = $_GET['rID'];
if (!$rID) {
    die;
}
$result = $db->Execute("select doc_title from " . TABLE_PHREEFORM . " where id = '" . $rID . "'");
$subject = $result->fields['doc_title'] . ' ' . TEXT_FROM . ' ' . COMPANY_NAME;
$report = get_report_details($rID);
if (!$report->emailmessage) {
    $text = sprintf(PHREEFORM_EMAIL_BODY, $result->fields['doc_title'], COMPANY_NAME);
} else {
    $text = TextReplace($report->emailmessage);
}
$xml = '';
$xml .= "\t" . xmlEntry("subject", $subject);
$xml .= "\t" . xmlEntry("text", $text);
// error check
echo createXmlHeader() . $xml . createXmlFooter();
die;
 function Header()
 {
     global $report, $Heading, $Seq;
     $this->SetX($report->page->margin->left);
     $this->SetY($report->page->margin->top);
     $this->SetFillColor(255);
     if ($report->page->heading->show) {
         // Show the company name
         $this->SetFont($report->page->heading->font, 'B', $report->page->heading->size);
         $Colors = explode(':', $report->page->heading->color);
         $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
         $CellHeight = ($report->page->heading->size + REPORT_ROWSPACE) * 0.35;
         $this->Cell(0, $CellHeight, COMPANY_NAME, 0, 1, $report->page->heading->align);
     }
     if ($report->page->title1->show) {
         // Set title 1 heading
         $this->SetFont($report->page->title1->font, '', $report->page->title1->size);
         $Colors = explode(':', $report->page->title1->color);
         $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
         $CellHeight = ($report->page->title1->size + REPORT_ROWSPACE) * 0.35;
         $this->Cell(0, $CellHeight, TextReplace($report->page->title1->text), 0, 1, $report->page->title1->align);
     }
     if ($report->page->title2->show) {
         // Set Title 2 heading
         $this->SetFont($report->page->title2->font, '', $report->page->title2->size);
         $Colors = explode(':', $report->page->title2->color);
         $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
         $CellHeight = ($report->page->title2->size + REPORT_ROWSPACE) * 0.35;
         $this->Cell(0, $CellHeight, TextReplace($report->page->title2->text), 0, 1, $report->page->title2->align);
     }
     // Set the filter heading
     $this->SetFont($report->page->filter->font, '', $report->page->filter->size);
     $Colors = explode(':', $report->page->filter->color);
     $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
     $CellHeight = ($report->page->filter->size + REPORT_ROWSPACE) * 0.35;
     // convert points to mm
     $this->MultiCell(0, $CellHeight, $report->page->filter->text, 'B', 1, $report->page->filter->align);
     $this->y0 = $this->GetY();
     // set y position after report headings before column titles
     // Set the table header
     $this->SetFont($report->page->data->font, '', $report->page->data->size);
     $Colors = explode(':', $report->page->data->color);
     $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
     $this->SetDrawColor(128, 0, 0);
     $this->SetLineWidth(0.35);
     // 1 point
     $CellHeight = ($report->page->data->size + REPORT_ROWSPACE) * 0.35;
     // fetch the column widths
     $CellXPos = $this->columnWidths;
     // Fetch the column break array
     foreach ($Seq as $Temp) {
         $ColBreak[] = $Temp['break'] ? true : false;
     }
     // See if we need to truncate the data
     $trunc = $report->truncate == '1' ? true : false;
     // Ready to draw the column titles in the header
     $maxY = $this->y0;
     // set to track the tallest column
     $col = 1;
     $LastY = $this->y0;
     foreach ($Heading as $key => $value) {
         $this->SetLeftMargin($CellXPos[$col - 1]);
         $this->SetX($CellXPos[$col - 1]);
         $this->SetY($LastY);
         // truncate data if selected
         if ($trunc) {
             $value = $this->TruncData($value, $CellXPos[$col] - $CellXPos[$col - 1]);
         }
         $this->MultiCell($CellXPos[$col] - $CellXPos[$col - 1], $CellHeight, $value, 0, $report->page->data->align);
         if ($ColBreak[$key]) {
             $col++;
             $LastY = $this->y0;
         } else {
             $LastY = $this->GetY();
         }
         if ($this->GetY() > $maxY) {
             $maxY = $this->GetY();
         }
         // check for new col max height
     }
     // Draw a bottom line for the end of the heading
     $this->SetLeftMargin($CellXPos[0]);
     $this->SetX($CellXPos[0]);
     $this->SetY($this->y0);
     $this->Cell(0, $maxY - $this->y0, ' ', 'B');
     $this->y0 = $maxY + 0.35;
 }
Example #6
0
if (isset($_GET['xfld']) && strpos($_GET['xfld'], 'journal_main') !== false) {
    // try to extract email info from the journal
    $result = $db->Execute("select bill_primary_name, bill_email from " . TABLE_JOURNAL_MAIN . " where id = '" . $_GET['xmin'] . "'");
    $_GET['rName'] = $result->fields['bill_primary_name'];
    $_GET['rEmail'] = $result->fields['bill_email'];
}
$delivery_method = $_POST['delivery_method'] ? $_POST['delivery_method'] : 'I';
$from_email = $_POST['from_email'] ? $_POST['from_email'] : $_SESSION['admin_email'];
$from_name = $_POST['from_name'] ? $_POST['from_name'] : $_SESSION['display_name'];
$to_email = $_POST['to_email'] ? $_POST['to_email'] : $_GET['rEmail'];
$to_name = $_POST['to_name'] ? $_POST['to_name'] : $_GET['rName'];
$cc_email = $_POST['cc_email'] ? $_POST['cc_email'] : '';
$cc_name = $_POST['cc_name'] ? $_POST['cc_name'] : $cc_address;
$message_subject = $title . ' ' . TEXT_FROM . ' ' . COMPANY_NAME;
$message_subject = $_POST['message_subject'] ? $_POST['message_subject'] : $message_subject;
$message_body = $report->emailmessage ? TextReplace($report->emailmessage) : sprintf(PHREEFORM_EMAIL_BODY, $title, COMPANY_NAME);
$email_text = $_POST['message_body'] ? $_POST['message_body'] : $message_body;
if (!$error) {
    switch ($_REQUEST['action']) {
        case 'save':
        case 'save_as':
        case 'exp_csv':
        case 'exp_xml':
        case 'exp_pdf':
        case 'exp_html':
            // read in user data and merge with report defaults
            if ($report->reporttype == 'rpt') {
                $report->grpbreak = isset($_POST['grpbreak']) ? '1' : '0';
                $report->truncate = isset($_POST['deftrunc']) ? $_POST['deftrunc'] : '0';
                $report->page->size = $_POST['papersize'];
                $report->page->orientation = $_POST['paperorientation'];
 function Header()
 {
     global $Prefs, $Heading, $Seq;
     $this->SetX($Prefs['marginleft']);
     $this->SetY($Prefs['margintop']);
     $this->SetFillColor(255);
     if ($Prefs['coynameshow']) {
         // Show the company name
         $this->SetFont($Prefs['coynamefont'], 'B', $Prefs['coynamefontsize']);
         $Colors = explode(':', $Prefs['coynamefontcolor']);
         $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
         $CellHeight = ($Prefs['coynamefontsize'] + RowSpace) * 0.35;
         $this->Cell(0, $CellHeight, COMPANY_NAME, 0, 1, $Prefs['coynamealign']);
     }
     if ($Prefs['title1show']) {
         // Set title 1 heading
         $this->SetFont($Prefs['title1font'], '', $Prefs['title1fontsize']);
         $Colors = explode(':', $Prefs['title1fontcolor']);
         $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
         $CellHeight = ($Prefs['title1fontsize'] + RowSpace) * 0.35;
         $this->Cell(0, $CellHeight, TextReplace($Prefs['title1desc']), 0, 1, $Prefs['title1fontalign']);
     }
     if ($Prefs['title2show']) {
         // Set Title 2 heading
         $this->SetFont($Prefs['title2font'], '', $Prefs['title2fontsize']);
         $Colors = explode(':', $Prefs['title2fontcolor']);
         $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
         $CellHeight = ($Prefs['title2fontsize'] + RowSpace) * 0.35;
         $this->Cell(0, $CellHeight, TextReplace($Prefs['title2desc']), 0, 1, $Prefs['title2fontalign']);
     }
     // Set the filter heading
     $this->SetFont($Prefs['filterfont'], '', $Prefs['filterfontsize']);
     $Colors = explode(':', $Prefs['filterfontcolor']);
     $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
     $CellHeight = ($Prefs['filterfontsize'] + RowSpace) * 0.35;
     // convert points to mm
     $this->MultiCell(0, $CellHeight, $Prefs['filterdesc'], 'B', 1, $Prefs['filterfontalign']);
     $this->y0 = $this->GetY();
     // set y position after report headings before column titles
     // Set the table header
     $this->SetFont($Prefs['datafont'], '', $Prefs['datafontsize']);
     $Colors = explode(':', $Prefs['datafontcolor']);
     $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]);
     $this->SetDrawColor(128, 0, 0);
     $this->SetLineWidth(0.35);
     // 1 point
     $CellHeight = ($Prefs['datafontsize'] + RowSpace) * 0.35;
     // fetch the column widths
     $CellXPos = $this->columnWidths;
     // Fetch the column break array
     foreach ($Seq as $Temp) {
         $ColBreak[] = $Temp['break'] ? true : false;
     }
     // See if we need to truncate the data
     $trunc = $Prefs['trunclong'] == '1' ? true : false;
     // Ready to draw the column titles in the header
     $maxY = $this->y0;
     // set to track the tallest column
     $col = 1;
     $LastY = $this->y0;
     foreach ($Heading as $key => $value) {
         $this->SetLeftMargin($CellXPos[$col - 1]);
         $this->SetX($CellXPos[$col - 1]);
         $this->SetY($LastY);
         // truncate data if selected
         if ($trunc) {
             $value = $this->TruncData($value, $CellXPos[$col] - $CellXPos[$col - 1]);
         }
         $this->MultiCell($CellXPos[$col] - $CellXPos[$col - 1], $CellHeight, $value, 0, $Prefs['datafontalign']);
         if ($ColBreak[$key]) {
             $col++;
             $LastY = $this->y0;
         } else {
             $LastY = $this->GetY();
         }
         if ($this->GetY() > $maxY) {
             $maxY = $this->GetY();
         }
         // check for new col max height
     }
     // Draw a bottom line for the end of the heading
     $this->SetLeftMargin($CellXPos[0]);
     $this->SetX($CellXPos[0]);
     $this->SetY($this->y0);
     $this->Cell(0, $maxY - $this->y0, ' ', 'B');
     $this->y0 = $maxY + 0.35;
 }