当前位置: 首页>>代码示例>>PHP>>正文


PHP ArrayCollection::getName方法代码示例

本文整理汇总了PHP中Doctrine\Common\Collections\ArrayCollection::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayCollection::getName方法的具体用法?PHP ArrayCollection::getName怎么用?PHP ArrayCollection::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Collections\ArrayCollection的用法示例。


在下文中一共展示了ArrayCollection::getName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: downloadAction

 /**
  * Download Report for Organisationunit Completeness
  *
  * @Route("/download", name="report_organisationunit_completeness_download")
  * @Method("GET")
  * @Template()
  */
 public function downloadAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $organisationunitId = $request->query->get('organisationunitId');
     $organisationunitLevelId = $request->query->get('organisationunitLevel');
     $sameLevel = $request->query->get('sameLevel');
     // View same level personal data .ie. CHMT & RHMT
     if (!empty($sameLevel)) {
         $this->sameLevel = True;
     }
     $formsId = explode(",", $request->query->get('formids'));
     $forms = new ArrayCollection();
     //Get the objects from the the variables
     $this->organisationunit = $em->getRepository('HrisOrganisationunitBundle:Organisationunit')->find($organisationunitId);
     $this->organisationunitLevel = $em->getRepository('HrisOrganisationunitBundle:OrganisationunitLevel')->findOneBy(array('id' => $organisationunitLevelId));
     foreach ($formsId as $formId) {
         $forms->add($em->getRepository('HrisFormBundle:Form')->find($formId));
     }
     $this->forms = $forms;
     $this->processCompletenessFigures();
     // ask the service for a Excel5
     $excelService = $this->get('phpexcel')->createPHPExcelObject();
     $excelService->getProperties()->setCreator("HRHIS3")->setLastModifiedBy("HRHIS3")->setTitle(str_replace(' ', '_', $this->title))->setSubject("Office 2005 XLSX Test Document")->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.")->setKeywords("office 2005 openxml php")->setCategory("Test result file");
     //add style to the header
     $heading_format = array('font' => array('bold' => true, 'color' => array('rgb' => '000099'), 'size' => 12), 'alignment' => array('wrap' => true, 'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER));
     //add style to the Value header
     $header_format = array('font' => array('bold' => true, 'color' => array('rgb' => 'FFFFFF')), 'alignment' => array('wrap' => true, 'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'fill' => array('type' => \PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => '3333FF')));
     //add style to the text to display
     $text_format1 = array('font' => array('bold' => false, 'color' => array('rgb' => '000000')), 'alignment' => array('wrap' => true, 'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER));
     //add style to the Value header
     $text_format2 = array('font' => array('bold' => false, 'color' => array('rgb' => '000000')), 'alignment' => array('wrap' => true, 'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'fill' => array('type' => \PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => 'E0E0E0')));
     //write the header of the report
     $column = 'A';
     $row = 1;
     $date = "Date: " . date("jS F Y");
     $excelService->getActiveSheet()->getDefaultRowDimension()->setRowHeight(15);
     $excelService->getActiveSheet()->getDefaultColumnDimension()->setWidth(15);
     //Merge the Title Rows
     $mergeColumnTitle = 'A';
     if ($this->visibleFields) {
         for ($i = 1; $i < count($this->visibleFields) + 2; $i++) {
             $mergeColumnTitle++;
         }
     } else {
         for ($i = 1; $i < count($this->forms) * 3 + 2; $i++) {
             $mergeColumnTitle++;
         }
     }
     $excelService->getActiveSheet()->mergeCells($column . $row . ':' . $mergeColumnTitle . $row);
     $excelService->setActiveSheetIndex(0)->setCellValue($column . $row++, $this->title);
     $excelService->getActiveSheet()->mergeCells($column . $row . ':' . $mergeColumnTitle . $row);
     $excelService->setActiveSheetIndex(0)->setCellValue($column . $row, $date);
     //Apply the heading Format and Set the Row dimension for the headers
     $excelService->getActiveSheet()->getStyle('A1:' . $mergeColumnTitle . '2')->applyFromArray($heading_format);
     $excelService->getActiveSheet()->getRowDimension('1')->setRowHeight(30);
     $excelService->getActiveSheet()->getRowDimension('2')->setRowHeight(20);
     //reset the colomn and row number
     $column == 'A';
     $row += 2;
     if ($this->organisationunitChildren && !$this->sameLevel) {
         if ($this->organisationunitChildren && !$this->sameLevel) {
             //write the table heading of the values
             $excelService->getActiveSheet()->getStyle($column . $row . ':' . $mergeColumnTitle . ($row + 1))->applyFromArray($header_format);
             $excelService->getActiveSheet()->mergeCells($column . $row . ':' . $column . ($row + 1));
             $excelService->setActiveSheetIndex(0)->setCellValue($column++ . $row, 'SN');
             $excelService->getActiveSheet()->mergeCells($column . $row . ':' . $column . ($row + 1));
             $excelService->setActiveSheetIndex(0)->setCellValue($column++ . $row, 'Organisationunit');
         }
         foreach ($this->forms as $forms) {
             if ($this->organisationunitChildren || $this->sameLevel) {
                 if ($this->visibleFields) {
                     $colspan = count($this->visibleFields);
                 } else {
                     $colspan = 3;
                 }
             } else {
                 $colspan = 3;
             }
             if ($this->organisationunitChildren) {
                 $mergeColumn = $column;
                 for ($i = 1; $i < $colspan; $i++) {
                     $mergeColumn++;
                 }
                 $excelService->getActiveSheet()->mergeCells($column . $row . ':' . $mergeColumn . $row);
                 $excelService->setActiveSheetIndex(0)->setCellValue($column++ . $row, $forms->getName());
                 for ($i = 1; $i < $colspan; $i++) {
                     $column++;
                 }
             }
         }
     } elseif ($this->visibleFields) {
         //Headers for records compeleteness
         $excelService->setActiveSheetIndex(0)->setCellValue($column++ . $row, 'SN');
//.........这里部分代码省略.........
开发者ID:hrisproject,项目名称:hris,代码行数:101,代码来源:ReportOrganisationunitCompletenessController.php


注:本文中的Doctrine\Common\Collections\ArrayCollection::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。