Archived
1
0
Fork 0
This repository has been archived on 2026-05-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
fiktivkod/library/Fiktiv/View/Helper/Fancybox.php
2010-10-02 00:08:03 +02:00

50 lines
No EOL
1.2 KiB
PHP

<?php
class Fiktiv_View_Helper_Fancybox extends Zend_View_Helper_Abstract
{
protected $_enabled = false;
protected $_transition = 'elastic';
protected $_titlePosition = 'outside';
protected $_fancy = array();
public function fancybox()
{
return $this;
}
public function enable()
{
$this->_enabled = true;
}
public function disable()
{
$this->_enabled = false;
}
public function headScript()
{
if (!$this->_enabled)
return;
$start = "<script type=\"text/javascript\">\n\t$(document).ready(function() {\n\t\t";
$body = join("\n\t\t", $this->_fancy);
$end = "\n\t});\n </script>\n";
return $start . $body . $end;
}
public function registerFancyness($access, $titlePosition = null, $transition = null)
{
$titlePosition = ($titlePosition) ? $titlePosition : $this->_titlePosition;
$transition = ($transition) ? $transition : $this->_transition;
return $this->_fancy[] = '$("' . $access . '").fancybox({\'titlePosition\' : \'' . $titlePosition . '\', \'transitionIn\' : \'' . $transition . '\'});';
}
}