function emailWizardExcelResultsSpreadsheet($targetEMailAddress, $excelFilePath) { $emailTargets = array(); $emailTargets[] = '*****@*****.**'; $emailTargets[] = $targetEMailAddress; $msg = "\n Hello <EmailUserName>,\n\n You are receiving this message because you have requested the list of resources found through the a wizard on BusinessUSA. Please refer to the attached Excel Spreadsheet for a detailed list of these resources.\n\n If you do not have Microsoft Excel installed, you can obtain an Excel Viewer from <a href=\"http://www.microsoft.com/en-us/download/details.aspx?id=10\">http://www.microsoft.com/en-us/download/details.aspx?id=10</a>. \n\n If you need more help, please refer to <a href=\"http://help.business.usa.gov/\">help.business.usa.gov</a>\n\n Thank you,\n - BusinessUSA team\n\n <small>[This is a system generated message]</small>\n "; $msg = str_replace("\n", "<br/>", trim($msg)); return dispatchEmails($emailTargets, '*****@*****.**', 'BusinessUSA - Resources and Results', $msg, array($excelFilePath)); }
/** * void cleanup_FixBadTextFormatUsage() * * This function will search for fields that are using the php_code * text-format that shouldn't. And set them to full_html * * Some fields should not be allowed to use the php_code text- * format because users under the Editor role are denied from * touching any field where this format is set on. */ function cleanup_FixBadTextFormatUsage() { /* ************************************************** DETAIL DESCRIPTION FOR PROGRAMS ************************************************** */ // First, get a list of Node-IDs that will be effected by this process $nids = db_query("SELECT entity_id, entity_id FROM field_data_field_program_detail_desc WHERE field_program_detail_desc_format = 'php_code' ")->fetchAllKeyed(); $nids = array_values($nids); // Fix php_code usage on the field_data_field_program_detail_desc field $badFormatCount = count($nids); if ($badFormatCount > 0) { $thisFunct = __FUNCTION__; error_log("{$thisFunct}() has found {$badFormatCount} programs that are using the php_code text-format, which will now be changed to full_html"); dispatchEmails(array('*****@*****.**', '*****@*****.**', '*****@*****.**'), '*****@*****.**', 'BUSA WARNING MESSAGE', "The {$thisFunct}() function has found <b>{$badFormatCount} programs</b> that are using the php_code text-format, " . "please note that we should not be using this text-format on fields that users under the Editor role may want " . "to access (<small>the Content-Management-Team does not, and cannot, have access to this Filter</small>). " . "Using this text-format disabels Editors from touching these field-values.<br/><br/>" . "All node->field_program_detail_desc text-formats will be set to full_html for the following node-ids:<br/>" . " - " . implode($nids, '<br/> - ')); db_query("\n UPDATE field_data_field_program_detail_desc \n SET field_program_detail_desc_format = 'full_html'\n WHERE field_program_detail_desc_format = 'php_code'\n "); } /* ************************************************** DETAIL DESCRIPTION FOR SERVICES ************************************************** */ // First, get a list of Node-IDs that will be effected by this process $nids = db_query("SELECT entity_id, entity_id FROM field_data_field_services_detail_desc WHERE field_services_detail_desc_format = 'php_code' ")->fetchAllKeyed(); $nids = array_values($nids); // Fix php_code usage on the field_data_field_program_detail_desc field $badFormatCount = count($nids); if ($badFormatCount > 0) { $thisFunct = __FUNCTION__; error_log("{$thisFunct}() has found {$badFormatCount} programs that are using the php_code text-format, which will now be changed to full_html"); dispatchEmails(array('*****@*****.**', '*****@*****.**', '*****@*****.**'), '*****@*****.**', 'BUSA WARNING MESSAGE', "The {$thisFunct}() function has found <b>{$badFormatCount} services</b> that are using the php_code text-format, " . "please note that we should not be using this text-format on fields that users under the Editor role may want " . "to access (<small>the Content-Management-Team does not, and cannot, have access to this Filter</small>). " . "Using this text-format disabels Editors from touching these field-values.<br/><br/>" . "All node->field_services_detail_desc text-formats will be set to full_html for the following node-ids:<br/>" . " - " . implode($nids, '<br/> - ')); db_query("\n UPDATE field_data_field_services_detail_desc \n SET field_services_detail_desc_format = 'full_html'\n WHERE field_services_detail_desc_format = 'php_code'\n "); } /* ************************************************** DETAIL DESCRIPTION FOR EVENTS ************************************************** */ // First, get a list of Node-IDs that will be effected by this process $nids = db_query("SELECT entity_id, entity_id FROM field_data_field_event_detail_desc WHERE field_event_detail_desc_format = 'php_code' ")->fetchAllKeyed(); $nids = array_values($nids); // Fix php_code usage on the field_data_field_event_detail_desc field $badFormatCount = count($nids); if ($badFormatCount > 0) { $thisFunct = __FUNCTION__; error_log("{$thisFunct}() has found {$badFormatCount} events that are using the php_code text-format, which will now be changed to full_html"); dispatchEmails(array('*****@*****.**', '*****@*****.**', '*****@*****.**'), '*****@*****.**', 'BUSA WARNING MESSAGE', "The {$thisFunct}() function has found <b>{$badFormatCount} events</b> that are using the php_code text-format, " . "please note that we should not be using this text-format on fields that users under the Editor role may want " . "to access (<small>the Content-Management-Team does not, and cannot, have access to this Filter</small>). " . "Using this text-format disabels Editors from touching these field-values.<br/><br/>" . "All node->field_event_detail_desc text-formats will be set to full_html for the following node-ids:<br/>" . " - " . implode($nids, '<br/> - ')); db_query("\n UPDATE field_data_field_event_detail_desc\n SET field_event_detail_desc_format = 'full_html'\n WHERE field_event_detail_desc_format = 'php_code'\n "); } }