本文整理匯總了PHP中Default_Model_Employee::getCountEmpReporting方法的典型用法代碼示例。如果您正苦於以下問題:PHP Default_Model_Employee::getCountEmpReporting方法的具體用法?PHP Default_Model_Employee::getCountEmpReporting怎麽用?PHP Default_Model_Employee::getCountEmpReporting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Default_Model_Employee
的用法示例。
在下文中一共展示了Default_Model_Employee::getCountEmpReporting方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}