Esempio n. 1
0
 /**
  *
  * @param ZendT_View $object
  * @param string $name 
  */
 public function add($object, $name = '')
 {
     if ($name == null) {
         $name = $object->getId();
     }
     $object->addClass('item');
     $this->_object[$name] = $object;
     $this->_objectOrder[] = $name;
 }
Esempio n. 2
0
 /**
  *
  * @return string
  */
 public function createJS()
 {
     $js = '';
     $js2 = '';
     $script = 'if({{condition}}){' . "\n";
     $script .= '   e.preventDefault();' . "\n";
     $script .= '   e.stopPropagation();' . "\n";
     $script .= '   {{action}}';
     $script .= '   return false;' . "\n";
     $script .= '} ';
     $specialKeys = array('ctrlON', 'altON', 'shiftON');
     if (count($this->_hotkeys) > 0) {
         foreach ($this->_hotkeys as $values) {
             $arrKey = explode('+', $values['key']);
             $hotkeys = array();
             $hotkeys2 = array();
             foreach ($arrKey as $key) {
                 $hkey = $this->_getKey($key);
                 if (in_array($hkey, $specialKeys)) {
                     $hotkeys2[] = $hkey;
                 } else {
                     $hotkeys2[] = $this->_getKey($key, 'w');
                 }
                 $hotkeys[] = $hkey;
             }
             $js .= str_replace('{{action}}', $values['action'], $script);
             $js = str_replace('{{condition}}', implode(' && ', $hotkeys), $js);
             $js2 .= str_replace('{{action}}', '', $script);
             $js2 = str_replace('{{condition}}', implode(' && ', $hotkeys2), $js2);
         }
         $js = "\n                    var ctrlON = false;\n                    var altON = false;\n                    var shiftON = false;\n                    \$(document).keydown(function(e){\n                        if(e.which == 17){\n                            ctrlON = true;\n                        }\n                        if(e.which == 18){\n                            altON = true;\n                        }\n                        if(e.which == 16){\n                            shiftON = true;\n                        }\n                        {$js}\n                    });\n                    \$(document).keyup(function(e){\n                        if(e.which == 17){\n                            ctrlON = false;\n                        }\n                        if(e.which == 18){\n                            altON = false;\n                        }\n                        if(e.which == 16){\n                            shiftON = false;\n                        }\n                    });\n                    \$(document).keypress(function(e){\n                        {$js2}\n                    });\n                ";
         ZendT_View::getInstance()->addOnLoad($js, 'hotkeys');
     }
     return '';
 }
Esempio n. 3
0
 /**
  * Singleton instance
  *
  * @return \ZendT_View
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 4
0
 /**
  * Adiciona um script
  * 
  * @param string $path
  * @return \ZendT_View_Html 
  */
 public function addHeadScript($name, $command)
 {
     ZendT_View::getInstance()->appendScript($command, $name);
     return $this;
 }