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


PHP FileUtils::convertToFileName方法代码示例

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


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

示例1: DonwloadAllZip

 public function DonwloadAllZip()
 {
     $zipper = new Zipper();
     $files = $this->Files();
     $file_list = array();
     $zip_name = FileUtils::convertToFileName($this->Name) . '.zip';
     foreach ($files as $file) {
         if (!$file->Attachment()->Exists()) {
             continue;
         }
         $name = $file->Attachment()->Filename;
         array_push($file_list, Director::baseFolder() . '/' . $name);
     }
     if ($zipper->getZipLink($file_list, Director::baseFolder() . '/assets/marketing/temp', $zip_name)) {
         return '/assets/marketing/temp/' . $zip_name;
     } else {
         return '#';
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:19,代码来源:Graphic.php

示例2: pdf

 public function pdf($request)
 {
     $file = FileUtils::convertToFileName($this->Title) . '.pdf';
     $html_inner = $this->customise(array('BASEURL' => Director::protocolAndHost()))->renderWith("UserStoryPDF");
     $base = Director::baseFolder();
     $css = $base . "/themes/openstack/css/main.pdf.css";
     $html_outer = sprintf("<html><head><style>%s</style></head><body><div class='container'>%s</div></body></html>", str_replace("@host", $base, @file_get_contents($css)), str_replace('"/assets/', '"' . Director::protocolAndHost() . '/assets/', $html_inner));
     //for debug purposes
     if (isset($_GET['view'])) {
         echo $html_outer;
         die;
     }
     try {
         $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(15, 5, 15, 5));
         $html2pdf->setTestIsImage(false);
         $html2pdf->WriteHTML($html_outer);
         //clean output buffer
         ob_end_clean();
         $html2pdf->Output($file, "D");
     } catch (HTML2PDF_exception $e) {
         $message = array('errno' => '', 'errstr' => $e->__toString(), 'errfile' => 'UserStory.php', 'errline' => '', 'errcontext' => '');
         SS_Log::log($message, SS_Log::ERR);
         $this->httpError(404, 'There was an error on PDF generation!');
     }
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:25,代码来源:UserStory.php

示例3: ExportFullSchedule

 public function ExportFullSchedule()
 {
     $sort = $this->getRequest()->getVar('sort') ? $this->getRequest()->getVar('sort') : 'day';
     $show_desc = $this->getRequest()->getVar('show_desc') ? $this->getRequest()->getVar('show_desc') : false;
     $base = Director::protocolAndHost();
     if (is_null($this->Summit())) {
         return $this->httpError(404, 'Sorry, summit not found');
     }
     $schedule = $this->Summit()->getSchedule();
     $events = new ArrayList();
     $sort_list = false;
     foreach ($schedule as $event) {
         switch ($sort) {
             case 'day':
                 $group_label = $event->getDayLabel();
                 break;
             case 'track':
                 if (!$event->isPresentation() || !$event->Category() || !$event->Category()->Title) {
                     continue 2;
                 }
                 $group_label = $event->Category()->Title;
                 $sort_list = true;
                 break;
             case 'event_type':
                 $group_label = $event->Type->Type;
                 $sort_list = true;
                 break;
         }
         if ($group_array = $events->find('Group', $group_label)) {
             $group_array->Events->push($event);
         } else {
             $group_array = new ArrayData(array('Group' => $group_label, 'Events' => new ArrayList()));
             $group_array->Events->push($event);
             $events->push($group_array);
         }
     }
     if ($sort_list) {
         $events->sort('Group');
     }
     $html_inner = $this->renderWith(array('SummitAppMySchedulePage_pdf'), array('Schedule' => $events, 'Summit' => $this->Summit(), 'ShowDescription' => $show_desc, 'Heading' => 'Full Schedule by ' . $sort));
     $css = @file_get_contents($base . "/summit/css/summitapp-myschedule-pdf.css");
     //create pdf
     $file = FileUtils::convertToFileName('full-schedule') . '.pdf';
     $html_outer = sprintf("<html><head><style>%s</style></head><body><div class='container'>%s</div></body></html>", $css, $html_inner);
     try {
         $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(15, 5, 15, 5));
         $html2pdf->setTestIsImage(false);
         $html2pdf->WriteHTML($html_outer);
         //clean output buffer
         ob_end_clean();
         $html2pdf->Output($file, "D");
     } catch (HTML2PDF_exception $e) {
         $message = array('errno' => '', 'errstr' => $e->__toString(), 'errfile' => 'SummitAppSchedPage.php', 'errline' => '', 'errcontext' => '');
         SS_Log::log($message, SS_Log::ERR);
         $this->httpError(404, 'There was an error on PDF generation!');
     }
 }
开发者ID:hogepodge,项目名称:openstack-org,代码行数:57,代码来源:SummitAppSchedPage.php

示例4: draft_pdf

 public function draft_pdf()
 {
     $html_inner = '';
     $marketplace_type = $this->request->param('MARKETPLACETYPE');
     $instance_id = intval($this->request->param('ID'));
     $base = Director::baseFolder();
     $query = new QueryObject();
     $query->addAndCondition(QueryCriteria::id('ID', $instance_id));
     switch (strtolower($marketplace_type)) {
         case 'distribution':
             $distribution = $this->distribution_draft_repository->getBy($query);
             if (!$distribution) {
                 throw new NotFoundEntityException('', '');
             }
             $render = new DistributionSapphireRender($distribution);
             $distribution->IsPreview = true;
             $html_inner = $render->pdf();
             $css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
             break;
         case 'appliance':
             $appliance = $this->appliance_draft_repository->getBy($query);
             $appliance->IsPreview = true;
             $render = new ApplianceSapphireRender($appliance);
             $html_inner = $render->pdf();
             $css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
             break;
         case 'public_cloud':
             $public_cloud = $this->public_clouds_draft_repository->getBy($query);
             $public_cloud->IsPreview = true;
             if (!$public_cloud) {
                 throw new NotFoundEntityException('', '');
             }
             $render = new PublicCloudSapphireRender($public_cloud);
             $html_inner = $render->pdf();
             $css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
             break;
         case 'private_cloud':
             $private_cloud = $this->private_clouds_draft_repository->getBy($query);
             $private_cloud->IsPreview = true;
             $render = new PrivateCloudSapphireRender($private_cloud);
             $html_inner = $render->pdf();
             $css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
             break;
         case 'consultant':
             $consultant = $this->consultant_draft_repository->getBy($query);
             if (!$consultant) {
                 throw new NotFoundEntityException('', '');
             }
             $consultant->IsPreview = true;
             $render = new ConsultantSapphireRender($consultant);
             $html_inner = $render->pdf();
             $css = @file_get_contents($base . "/marketplace/code/ui/admin/css/pdf.css");
             break;
         default:
             $this->httpError(404);
             break;
     }
     //create pdf
     $file = FileUtils::convertToFileName('preview') . '.pdf';
     $html_outer = sprintf("<html><head><style>%s</style></head><body><div class='container'>%s</div></body></html>", str_replace("@host", $base, $css), $html_inner);
     try {
         $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(15, 5, 15, 5));
         //$html2pdf->addFont('Open Sans', '', $base.'/themes/openstack/assets/fonts/PT-Sans/PTC75F-webfont.ttf');
         $html2pdf->setTestIsImage(false);
         $html2pdf->WriteHTML($html_outer);
         //clean output buffer
         ob_end_clean();
         $html2pdf->Output($file, "D");
     } catch (HTML2PDF_exception $e) {
         $message = array('errno' => '', 'errstr' => $e->__toString(), 'errfile' => 'UserStory.php', 'errline' => '', 'errcontext' => '');
         SS_Log::log($message, SS_Log::ERR);
         $this->httpError(404, 'There was an error on PDF generation!');
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:74,代码来源:MarketPlaceAdminPage.php


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