本文整理汇总了PHP中sapp_Global::clean_output_buffer方法的典型用法代码示例。如果您正苦于以下问题:PHP sapp_Global::clean_output_buffer方法的具体用法?PHP sapp_Global::clean_output_buffer怎么用?PHP sapp_Global::clean_output_buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sapp_Global
的用法示例。
在下文中一共展示了sapp_Global::clean_output_buffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportemployeereportAction
/**
* Export analytics of employees reporting to manager to excel.
*/
public function exportemployeereportAction()
{
$this->_helper->layout->disableLayout();
$param_arr = $this->_getAllParams();
$cols_param_arr = $this->_getParam('cols_arr', array());
if (isset($param_arr['cols_arr'])) {
unset($param_arr['cols_arr']);
}
$page_no = isset($param_arr['page_no']) ? $param_arr['page_no'] : 1;
$per_page = isset($param_arr['per_page']) ? $param_arr['per_page'] : PERPAGE;
$sort_name = $param_arr['sort_name'];
$sort_type = $param_arr['sort_type'];
if (isset($param_arr['page_no'])) {
unset($param_arr['page_no']);
}
if (isset($param_arr['sort_name'])) {
unset($param_arr['sort_name']);
}
if (isset($param_arr['sort_type'])) {
unset($param_arr['sort_type']);
}
if (isset($param_arr['per_page'])) {
unset($param_arr['per_page']);
}
unset($param_arr['module']);
unset($param_arr['controller']);
unset($param_arr['action']);
// Get employees data reporting to manager
$myEmployees_model = new Default_Model_Myemployees();
$param_arr['reporting_manager'] = $myEmployees_model->getLoginUserId();
if (count($cols_param_arr) == 0) {
$cols_param_arr = $this->empreport_heplper1('mandatory');
}
$employee_model = new Default_Model_Employee();
$emp_data_org = $employee_model->getdata_emp_report($param_arr, $per_page, $page_no, $sort_name, $sort_type);
$emp_arr = $emp_data_org['rows'];
require_once 'Classes/PHPExcel.php';
require_once 'Classes/PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$letters = range('A', 'Z');
$count = 0;
$filename = "EmployeeReport.xlsx";
$cell_name = "";
// Show count of employees reporting to manager
// Get employees data reporting to manager
$myEmployees_model = new Default_Model_Myemployees();
$employee_model = new Default_Model_Employee();
$count_emp_reporting = $employee_model->getCountEmpReporting($myEmployees_model->getLoginUserId());
$objPHPExcel->getActiveSheet()->SetCellValue($letters[$count] . "1", "My Team Count : " . $count_emp_reporting);
// Make first row Headings bold and highlighted in Excel.
foreach ($cols_param_arr as $names) {
$i = 2;
$cell_name = $letters[$count] . $i;
$names = html_entity_decode($names, ENT_QUOTES, 'UTF-8');
$objPHPExcel->getActiveSheet()->SetCellValue($cell_name, $names);
// Make bold cells
$objPHPExcel->getActiveSheet()->getStyle($cell_name)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle($cell_name)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '82CAFF'))));
$objPHPExcel->getActiveSheet()->getColumnDimension($letters[$count])->setAutoSize(true);
$i++;
$count++;
}
// Display field/column values in Excel.
$i = 3;
foreach ($emp_arr as $emp_data) {
$count1 = 0;
foreach ($cols_param_arr as $column_key => $column_name) {
// display field/column values
$cell_name = $letters[$count1] . $i;
if ($column_key == 'userfullname') {
$value = isset($emp_data['prefix_name']) ? $emp_data['prefix_name'] . ". " . $emp_data['userfullname'] : $emp_data['userfullname'];
} elseif ($column_key == 'date_of_joining') {
$value = isset($emp_data['date_of_joining']) ? sapp_Global::change_date($emp_data['date_of_joining'], "view") : "";
} else {
$value = isset($emp_data[$column_key]) ? $emp_data[$column_key] : "";
}
$value = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
$objPHPExcel->getActiveSheet()->SetCellValue($cell_name, $value);
$count1++;
}
$i++;
}
sapp_Global::clean_output_buffer();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header('Cache-Control: max-age=0');
sapp_Global::clean_output_buffer();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;
}
示例2: requisitionrptexcelAction
/**
* This is used to export to excel.
*/
public function requisitionrptexcelAction()
{
$this->_helper->layout->disableLayout();
$param_arr = $this->_getAllParams();
$default_fields = array('requisition_code' => 'Requisition Code', 'job_title' => 'Job title', 'req_status' => 'Requisition Status', 'created_by' => 'Raised By', 'reporting_manager_name' => 'Reporting Manager', 'approver1' => 'Approver -1', 'appstatus1' => 'Status', 'req_no_positions' => 'No.of positions', 'selected_members' => 'Filled positions', 'created_on' => 'Raised On', 'onboard_date' => 'Due Date');
$cols_param_arr = $this->_getParam('cols_arr', $default_fields);
if (isset($param_arr['cols_arr'])) {
unset($param_arr['cols_arr']);
}
$page_no = isset($param_arr['page_no']) ? $param_arr['page_no'] : 1;
$per_page = isset($param_arr['per_page']) ? $param_arr['per_page'] : PERPAGE;
$sort_name = $param_arr['sort_name'];
$sort_type = $param_arr['sort_type'];
if (isset($param_arr['page_no'])) {
unset($param_arr['page_no']);
}
if (isset($param_arr['sort_name'])) {
unset($param_arr['sort_name']);
}
if (isset($param_arr['sort_type'])) {
unset($param_arr['sort_type']);
}
if (isset($param_arr['per_page'])) {
unset($param_arr['per_page']);
}
unset($param_arr['module']);
unset($param_arr['controller']);
unset($param_arr['action']);
unset($param_arr['total_grid_columns']);
$requisition_model = new Default_Model_Requisition();
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserGroup = $auth->getStorage()->read()->group_id;
}
$requisition_data = $requisition_model->getReportData($param_arr, $per_page, $page_no, $sort_name, $sort_type, $loginUserId, $loginuserGroup, 1);
$requisition_data = $requisition_data['rows'];
require_once 'Classes/PHPExcel.php';
require_once 'Classes/PHPExcel/IOFactory.php';
$objPHPExcel = new PHPExcel();
$letters = range('A', 'Z');
$count = 0;
$filename = "Requisitions_report.xlsx";
$cell_name = "";
// Make first row Headings bold and highlighted in Excel.
foreach ($cols_param_arr as $names) {
$i = 1;
$cell_name = $letters[$count] . $i;
$names = html_entity_decode($names, ENT_QUOTES, 'UTF-8');
$objPHPExcel->getActiveSheet()->SetCellValue($cell_name, $names);
// Make bold cells
$objPHPExcel->getActiveSheet()->getStyle($cell_name)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle($cell_name)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '82CAFF'))));
$objPHPExcel->getActiveSheet()->getColumnDimension($letters[$count])->setAutoSize(true);
$i++;
$count++;
}
// Display field/column values in Excel.
$i = 2;
foreach ($requisition_data as $requisition_data) {
$count1 = 0;
foreach ($cols_param_arr as $column_key => $column_name) {
// display field/column values
$cell_name = $letters[$count1] . $i;
if ($column_key == 'userfullname') {
$value = isset($requisition_data['userfullname']) ? $requisition_data['prefix_name'] . ". " . $requisition_data['userfullname'] : "";
} elseif ($column_key == 'date_of_joining') {
$value = isset($requisition_data['date_of_joining']) ? sapp_Global::change_date($requisition_data['date_of_joining'], "view") : "";
} else {
$value = isset($requisition_data[$column_key]) ? $requisition_data[$column_key] : "";
}
$value = html_entity_decode($value, ENT_QUOTES, 'UTF-8');
$objPHPExcel->getActiveSheet()->SetCellValue($cell_name, $value);
$count1++;
}
$i++;
}
sapp_Global::clean_output_buffer();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header('Cache-Control: max-age=0');
sapp_Global::clean_output_buffer();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;
}