當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。