コード例 #1
0
ファイル: WImage.php プロジェクト: point/cassea
    /**
     * Method description
     *
     * More detailed method description
     * @param    void
     * @return   void
     */
    function preRender()
    {
        $this->checkAndSetData();
        if (!$this->file instanceof iFile && isset($this->src) && isset($this->subst_src)) {
            $this->setSrc(sprintf($this->getSubstSrc(), $this->getSrc()));
        }
        if (empty($this->alt)) {
            $this->setAlt(basename($this->getSrc()));
        }
        if (empty($this->src)) {
            $this->setVisible(0);
            parent::preRender();
            return;
        }
        if (($this->getMaxWidth() || $this->getMaxHeight()) && !is_null($this->file)) {
            $iDeco = new ImageDecorator($this->file);
            $a = recalcSize($iDeco->getWidth(), $iDeco->getHeight(), $this->getMaxWidth(), $this->getMaxHeight());
            $this->setWidth($a['0']);
            $this->setHeight($a['1']);
        }
        if ($this->getWithPreview()) {
            $js = <<<EOD
\$(document).ready(function(){
\t\$('#{$this->getId()}').css('cursor','pointer').click(function(){
\t\tvar iot = \$("#{$this->getId()}").offset().top;
\t\t\$('<div id="{$this->getId()}_preview" class="image_preview"><img src="{$this->getSrc()}" /></div>').appendTo('body');
\t\tvar i_w = \$('#{$this->getId()}_preview > img').width();
\t\tvar i_h = \$('#{$this->getId()}_preview > img').height();
\t\tvar p = p1 = p2= 1;
\t\tif(i_w > 800) p1 = 800 / i_w;
\t\tif(i_h > 600) p2 = 600 / i_h;
\t\tp = Math.min(p1,p2);
\t\ti_w = i_w*p;i_h = i_h*p;
\t\tvar o_l = \$("#{$this->getId()}").offset().left;
\t\tif(o_l < 20) o_l = 20;
\t\tif(o_l + i_w > \$(window).width())
\t\t\to_l = \$(window).width()-i_w-40;
\t\t\$('#{$this->getId()}_preview').width(i_w).height(i_h).css('left',o_l).css('top',iot);
\t\t\$('#{$this->getId()}_preview > img').width(i_w).height(i_h).click(function() {
\t\t\t\$("#{$this->getId()}_preview").remove();
\t\t});
\t});
});
EOD;
            $this->javascript->addBeforeWidget($js);
        }
        parent::preRender();
    }
コード例 #2
0
ファイル: WCSS.php プロジェクト: point/cassea
 /**
  * Method description
  *
  * More detailed method description
  * @param    void
  * @return   void
  */
 function preRender()
 {
     $this->checkAndSetData();
     if (!isset($this->tpl) && !isset($this->src)) {
         $this->tpl = $this->createTemplate();
     }
     parent::preRender();
 }
コード例 #3
0
ファイル: WContainer.php プロジェクト: point/cassea
 function preRender()
 {
     parent::preRender();
     $this->childPreRender();
 }
コード例 #4
0
ファイル: WNavigator.php プロジェクト: point/cassea
 /**
  * Method description
  *
  * More detailed method description
  * @param    void
  * @return   void
  */
 function preRender()
 {
     $this->checkAndSetData();
     $controller = Controller::getInstance();
     $this->steps = $controller->getNavigator()->getSteps();
     parent::preRender();
 }
コード例 #5
0
ファイル: WControl.php プロジェクト: point/cassea
 /**
  * Method description
  *
  * More detailed method description
  * @param    void
  * @return   void
  */
 function preRender()
 {
     if (isset($this->valuechecker)) {
         $this->valuechecker->addWidgetId($this->getId());
         $event = new WidgetEvent("have_valuechecker", $this->getId());
         $event->setParams(array('id' => $this->valuechecker->getId()));
         Controller::getInstance()->getDispatcher()->notify($event);
     }
     parent::preRender();
     if (POSTErrors::hasErrors()) {
         $this->restorePOST();
     }
 }