<?php
class docFlash extends docBase {

  public function onPrivateUpload($tempFile) {
    $size = sfConversion::getSWFImageSize($tempFile);
    $this->doc->setDocWidth($size[0]);
    $this->doc->setDocHeight($size[1]);
    $this->doc->setDocThumbnail(3);
  }

  public function getPreview($width = 300, $height = 300) {
    $options = $this->getInnerSize($width, $height);
    if (strstr($this->doc->getDocSource(), 'edumedia')) {
      return flash_tag($this->viewRoot.'plugins/flash/sciencePlayer.swf', $options['width'], $options['height'],
      array('childMov'=>$this->getPreviewUrl(), 'sizex'=>$this->doc->getDocWidth(), 'sizey'=>$this->doc->getDocHeight()));
    }
    if ($this->doc->getDocThumbnail() == 3) {
      return flash_tag($this->viewRoot.'plugins/flash/thumbcreate2.swf', $options['width'], $options['height'], array(
      'childMov'=>$this->getPreviewUrl(), 'docId'=>$this->doc->getDocId(),
      'sizex'=>$this->doc->getDocWidth(), 'sizey'=>$this->doc->getDocHeight(),
      'createMov'=>$this->viewRoot.'main/document/swfthumb'));
    }
    return flash_tag($this->getPreviewUrl(), $options['width'], $options['height']);
  }
}
?>
