Exemplo n.º 1
0
 private function buildSlide(PHPPowerPoint_Slide $currentSlide, WallPost $post)
 {
     // Graph image
     $shape = $currentSlide->createDrawingShape();
     $shape->setName($post->title);
     $shape->setDescription($post->title);
     $shape->setPath($post->getFile());
     $shape->setHeight(405);
     $shape->setWidth(792);
     $shape->setOffsetX(70);
     $shape->setOffsetY(135);
     // Title
     $shape = $currentSlide->createRichTextShape();
     $shape->setHeight(30);
     $shape->setWidth(600);
     $shape->setOffsetX(180);
     $shape->setOffsetY(50);
     $shape->createText($post->title);
     $shape->getAlignment()->setHorizontal(PHPPowerPoint_Style_Alignment::HORIZONTAL_CENTER);
     // Comment
     $shape = $currentSlide->createRichTextShape();
     $shape->setHeight(100);
     $shape->setWidth(600);
     $shape->setOffsetX(180);
     $shape->setOffsetY(550);
     $shape->createText($post->comment);
     $shape->getAlignment()->setHorizontal(PHPPowerPoint_Style_Alignment::HORIZONTAL_CENTER);
 }
Exemplo n.º 2
0
 /**
  * @param sfWebRequest $request
  * @return string
  */
 public function executePinToWall(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $decision_id = $request->getParameter('decision_id', false);
     $this->forward404Unless(is_object(DecisionTable::getInstance()->getDecisionForUser($this->getUser()->getGuardUser(), $decision_id)));
     $type = $request->getParameter('type');
     $wall = Doctrine::getTable('Wall')->findOneBy('decision_id', $decision_id);
     $wallPost = new WallPost();
     $wallPost->wall_id = $wall->id;
     $wallPost->save();
     $htmlToImage = new HtmlToImageService();
     $route = array_merge(array('sf_route' => 'analyze\\generateImage', 'type' => $type));
     $htmlToImage->setUrl($this->getController()->genUrl($route, true));
     $htmlToImage->setData($request->getPostParameters());
     $htmlToImage->setImagePath($wallPost->getFile());
     $htmlToImage->setOptions(array('ignore-ssl-errors' => 'true'));
     $htmlToImage->run();
     $this->getContext()->getConfiguration()->loadHelpers(array('Asset', 'Tag'));
     $wallPost->content = image_tag($wallPost->getRelativeFilePath());
     $wallPost->save();
     // Create log
     $log = new Log();
     $log->injectDataAndPersist($wall, $this->getUser()->getGuardUser(), array('type' => $type, 'action' => 'edit'));
     return sfView::NONE;
 }