コード例 #1
0
ファイル: IOFactory.php プロジェクト: sensorsix/app
 /**
  * Set search locations
  * 
  * @param array $value
  * @throws Exception
  */
 public static function setSearchLocations($value)
 {
     if (is_array($value)) {
         self::$_searchLocations = $value;
     } else {
         throw new Exception('Invalid parameter passed.');
     }
 }
コード例 #2
0
 public function export()
 {
     $objPHPPowerPoint = new PHPPowerPoint();
     $objPHPPowerPoint->getProperties()->setCreator("SensorSix");
     $objPHPPowerPoint->getProperties()->setLastModifiedBy("SensorSix");
     $currentSlide = $objPHPPowerPoint->getActiveSlide();
     $this->buildTitleSlide($currentSlide);
     foreach ($this->roadmap->getOrderedRoadmapDecision() as $roadmap_decision) {
         $currentSlide = $objPHPPowerPoint->createSlide();
         $this->buildSlide($currentSlide, $roadmap_decision->getDecision());
     }
     $objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
     $objWriter->save('php://output');
 }
コード例 #3
0
 public function export()
 {
     $objPHPPowerPoint = new PHPPowerPoint();
     $objPHPPowerPoint->getProperties()->setCreator("Maarten Balliauw");
     $objPHPPowerPoint->getProperties()->setLastModifiedBy("Maarten Balliauw");
     $currentSlide = $objPHPPowerPoint->getActiveSlide();
     foreach ($this->posts as $post) {
         if (!$currentSlide) {
             $currentSlide = $objPHPPowerPoint->createSlide();
         }
         $this->buildSlide($currentSlide, $post);
         $currentSlide = null;
     }
     $objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
     $objWriter->save('php://output');
 }
コード例 #4
0
ファイル: 01simple.php プロジェクト: ruckfull/PHPPowerPoint
// Create new PHPPowerPoint object
echo date('H:i:s') . ' Create new PHPPowerPoint object' . EOL;
$objPHPPowerPoint = new PHPPowerPoint();
// Set properties
echo date('H:i:s') . ' Set properties' . EOL;
$objPHPPowerPoint->getProperties()->setCreator('Maarten Balliauw')->setLastModifiedBy('Maarten Balliauw')->setTitle('Office 2007 PPTX Test Document')->setSubject('Office 2007 PPTX Test Document')->setDescription('Test document for Office 2007 PPTX, generated using PHP classes.')->setKeywords('office 2007 openxml php')->setCategory('Test result file');
// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
$currentSlide = $objPHPPowerPoint->getActiveSlide();
// Create a shape (drawing)
echo date('H:i:s') . ' Create a shape (drawing)' . EOL;
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPowerPoint logo')->setDescription('PHPPowerPoint logo')->setPath('./images/phppowerpoint_logo.gif')->setHeight(36)->setOffsetX(10)->setOffsetY(10);
$shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
// Create a shape (text)
echo date('H:i:s') . ' Create a shape (rich text)' . EOL;
$shape = $currentSlide->createRichTextShape()->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);
$shape->getActiveParagraph()->getAlignment()->setHorizontal(PHPPowerPoint_Style_Alignment::HORIZONTAL_CENTER);
$textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!');
$textRun->getFont()->setBold(true)->setSize(60)->setColor(new PHPPowerPoint_Style_Color('FFC00000'));
// Save PowerPoint 2007 file
echo date('H:i:s') . ' Write to PowerPoint2007 format' . EOL;
$objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
$objWriter->save(str_replace('.php', '.pptx', __FILE__));
echo date('H:i:s') . ' Write to OpenDocumentPresentation format' . EOL;
$objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'ODPresentation');
$objWriter->save(str_replace('.php', '.odp', __FILE__));
// Echo memory peak usage
echo date('H:i:s') . ' Peak memory usage: ' . memory_get_peak_usage(true) / 1024 / 1024 . ' MB' . EOL;
// Echo done
echo date('H:i:s') . ' Done writing file.' . EOL;
コード例 #5
0
ファイル: 07chart.php プロジェクト: ruckfull/PHPPowerPoint
echo date('H:i:s') . " Create a shape (chart)\n";
$shape = $currentSlide->createChartShape();
$shape->setName('PHPPowerPoint Daily Download Distribution')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80);
$shape->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
$shape->getFill()->setFillType(PHPPowerPoint_Style_Fill::FILL_GRADIENT_LINEAR)->setStartColor(new PHPPowerPoint_Style_Color('FFCCCCCC'))->setEndColor(new PHPPowerPoint_Style_Color('FFFFFFFF'))->setRotation(270);
$shape->getBorder()->setLineStyle(PHPPowerPoint_Style_Border::LINE_SINGLE);
$shape->getTitle()->setText('PHPPowerPoint Daily Downloads');
$shape->getTitle()->getFont()->setItalic(true);
$shape->getPlotArea()->setType($lineChart);
$shape->getView3D()->setRotationX(30);
$shape->getView3D()->setPerspective(30);
$shape->getLegend()->getBorder()->setLineStyle(PHPPowerPoint_Style_Border::LINE_SINGLE);
$shape->getLegend()->getFont()->setItalic(true);
// Save PowerPoint 2007 file
echo date('H:i:s') . " Write to PowerPoint2007 format\n";
$objWriter = PHPPowerPoint_IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
$objWriter->save(str_replace('.php', '.pptx', __FILE__));
// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . memory_get_peak_usage(true) / 1024 / 1024 . " MB\r\n";
// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
/**
 * Creates a templated slide
 *
 * @param PHPPowerPoint $objPHPPowerPoint
 * @return PHPPowerPoint_Slide
 */
function createTemplatedSlide(PHPPowerPoint $objPHPPowerPoint)
{
    // Create slide
    $slide = $objPHPPowerPoint->createSlide();
コード例 #6
0
ファイル: lib_ppt.php プロジェクト: netcon-source/dotspotting
function ppt_export_dots(&$dots, &$more)
{
    $maps = array();
    $w = 960;
    $h = 720;
    $ppt = new PHPPowerPoint();
    $ppt->getProperties()->setTitle($more['title']);
    $ppt->getProperties()->setCreator("Dotspotting");
    # set title here
    # $slide = $ppt->getActiveSlide();
    $ppt->removeSlideByIndex(0);
    # draw the maps
    $dot_per_slide = 1;
    $img_more = array('width' => $w, 'height' => $h, 'dot_size' => 20);
    if (!$dot_per_slide || count($dots) == 0) {
        $maps[] = maps_png_for_dots($dots, $img_more);
    } else {
        $img_more['dot_size'] = 25;
        $img_more['width'] = $img_more['height'];
        $img_more['img_prefix'] = 'ppt';
        # remember: 1 dot per slide
        $_dots = array();
        foreach ($dots as $dot) {
            $_dots[] = array($dot);
        }
        # See this? It's to prevent Dotspoting from accidentally
        # DOS-ing itself.
        $enable_multigets = $GLOBALS['cfg']['wscompose_enable_multigets'];
        if ($dot_per_slide && count($dots) > $GLOBALS['cfg']['wscompose_max_dots_for_multigets']) {
            $GLOBALS['cfg']['wscompose_enable_multigets'] = 0;
        }
        $maps = maps_png_for_dots_multi($_dots, $img_more);
        $GLOBALS['cfg']['wscompose_enable_multigets'] = $enable_multigets;
    }
    # now draw all the maps...
    $count_maps = count($maps);
    for ($i = 0; $i < $count_maps; $i++) {
        $map = $maps[$i];
        $slide = $ppt->createSlide();
        $shape = $slide->createDrawingShape();
        $shape->setName('map');
        $shape->setDescription('');
        $shape->setPath($map);
        $shape->setWidth($w);
        $shape->setHeight($h);
        $shape->setOffsetX(0);
        $shape->setOffsetY(0);
        if ($dot_per_slide) {
            $dot = $dots[$i];
            if (!$dot['id']) {
                continue;
            }
            $_dot = dots_get_dot($dot['id'], $more['viewer_id']);
            if (!$_dot['id']) {
                continue;
            }
            $shape = $slide->createDrawingShape();
            $shape->setName('map');
            $shape->setDescription('');
            $shape->setPath($map);
            $text = $slide->createRichTextShape();
            $text->setHeight($h);
            $text->setWidth($w - $h);
            $text->setOffsetX($h + 20);
            $text->setOffsetY(0 + 20);
            $align = $text->getAlignment();
            $align->setHorizontal(PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT);
            $cols = array_merge($_dot['index_on'], array('latitude', 'longitude', 'created', 'id'));
            foreach ($cols as $col) {
                $value = trim($dot[$col]);
                if (!$value) {
                    continue;
                }
                $body = $text->createTextRun("{$col}:\n");
                $body->getFont()->setSize(18);
                $body->getFont()->setBold(false);
                # default bold font is not what do say "pretty"
                $body = $text->createTextRun("{$dot[$col]}\n\n");
                $body->getFont()->setSize(14);
                $body->getFont()->setBold(false);
            }
        }
    }
    #
    $writer = PHPPowerPoint_IOFactory::createWriter($ppt, 'PowerPoint2007');
    $writer->save($more['path']);
    $writer = null;
    foreach ($maps as $path) {
        if ($path && !file_exists($path) && !unlink($path)) {
            error_log("[EXPORT] (ppt) failed to unlink {$path}");
        }
    }
    return $more['path'];
}
コード例 #7
0
ファイル: ppt.php プロジェクト: phaidra/phaidraplus
    }
    $img->setWidth(round($newWidth))->setHeight(round($newHeight))->setOffsetX(round($offsetX))->setOffsetY(round($offsetY));
    // adding text to the slide
    $title = $slide->createRichTextShape();
    if (is_array($slideInfo['title'])) {
        $slideInfo['title'] = join(" | ", $slideInfo['title']);
    }
    $titleText = substr($slideInfo['title'], 0, 80);
    $titleText .= strlen($slideInfo['title']) > 80 ? '...' : '';
    $titleFormat = $title->createTextRun($titleText);
    $titleFormat->getFont()->setSize(28)->setBold(true);
    if ($landscape) {
        $title->setWidth($_SLIDE_SIZE['width'])->setHeight(90);
    } else {
        $title->setWidth(266)->setHeight(round($_SLIDE_SIZE['height'] / 2));
    }
    $i++;
    if (microtime(true) - $startTime >= $maxExecTime * $maxExecutionThreshold || $_MAX_SLIDES <= $i) {
        break;
    }
}
if ($i == count($json)) {
    //$ppt->removeSlideByIndex(0);
    $writer = PHPPowerPoint_IOFactory::createWriter($ppt, 'PowerPoint2007');
    $writer->save($dirname . '/presentation.pptx');
    chmod($dirname . '/presentation.pptx', 0777);
    echo json_encode(array('file' => $dirname . '/presentation.pptx', 'execTime' => microtime(true) - $startTime));
    exit(0);
}
echo json_encode(array('pickup' => $slideId));
exit(0);