/**
  * Render contents
  * 
  * @return string
  */
 public function render()
 {
     $args = func_get_args();
     $changePwdImg = Fox::getThemeUrl('images/change_pwd.png');
     $loginImg = Fox::getThemeUrl('images/login.png');
     return '<a target="_self" href="' . $args[0]['change_password'] . '" title="' . $args[0]['change_password'] . '"><img src="' . $changePwdImg . '" alt="Change Password" title="Change Password" style="border:none;" /></a>&nbsp; <a target="_blank" href="' . $args[0]['login'] . '" title="' . $args[0]['login'] . '"><img src="' . $loginImg . '" alt="Login" title="Login" style="border:none;" /></a>';
 }
 /**
  * Render contents
  * 
  * @return string
  */
 public function render()
 {
     $args = func_get_args();
     $url = $args[0]['preview_url'];
     $queueImg = Fox::getThemeUrl('images/queue.png');
     $previewImg = Fox::getThemeUrl('images/preview.png');
     $previewUrl = "window.open('" . $url . "','previewWindow','width=800,height=600')";
     return '<a href="' . $args[0]['send_newsletter'] . '" title="' . $args[0]['send_newsletter'] . '"><img src="' . $queueImg . '" alt="Send Newsletter" title="Send Newsletter" style="border:none;" width="22" height="22"/></a>   <a target="_blank" title="' . $args[0]['preview_url'] . '" title="' . $args[0]['preview_url'] . '" onclick="' . $previewUrl . '"><img src="' . $previewImg . '" alt="Preview" title="Preview" /></a>';
 }
    /**
     * Method for helper calling
     *
     * @param string $name
     * @param string $value
     * @param array $attribs
     * @return string 
     */
    public function formDate($name, $value = null, $attribs = null)
    {
        $info = $this->_getInfo($name, $value, $attribs);
        extract($info);
        // name, value, attribs, options, listsep, disable
        // is it disabled?
        $disabled = '';
        if ($disable) {
            $disabled = ' disabled="disabled"';
        }
        $options = isset($attribs['options']) ? $attribs['options'] : array();
        if (!isset($options['changeMonth'])) {
            $options['changeMonth'] = true;
        }
        if (!isset($options['changeYear'])) {
            $options['changeYear'] = true;
        }
        if (!isset($options['showButtonPanel'])) {
            $options['showButtonPanel'] = true;
        }
        if (!isset($options['showOn'])) {
            $options['showOn'] = 'button';
        }
        if (!isset($options['buttonImage'])) {
            $options['buttonImage'] = Fox::getThemeUrl('images/calender.gif');
        }
        if (!isset($options['buttonImageOnly'])) {
            $options['buttonImageOnly'] = true;
        }
        if (!isset($options['dateFormat'])) {
            $options['dateFormat'] = 'yy-mm-dd';
        }
        $pickerOptions = Zend_Json_Encoder::encode($options);
        // build the element
        $eleml = '<input type="text" name="' . $this->view->escape($name) . '"' . ' id="' . $this->view->escape($id) . '"' . $disabled . $this->_htmlAttribs($attribs) . ' value="' . $this->view->escape($value) . '" />';
        $xhtml = <<<MARKUP
<script type="text/javascript">
\$(function() {
\t\t\$( "#{$this->view->escape($id)}" ).datepicker({$pickerOptions});
});
</script>
{$eleml}    
MARKUP;
        return $xhtml;
    }
 /**
  * Get header image url
  * 
  * @return string
  */
 public function getImageSrc()
 {
     $imgPath = Fox::getPreference('web/header/logo_image_src');
     return Fox::getThemeUrl($imgPath);
 }
 /**
  * Get current theme url
  * 
  * @param string $url
  * @return string 
  */
 public static function getThemeUrl($url = '')
 {
     return Fox::getThemeUrl($url, Uni_Controller_Action::MODE_WEB);
 }
 /**
  * Compose path for theme files
  *
  * @param string $path
  * @return string 
  */
 public function themeUrl($path = '')
 {
     return Fox::getThemeUrl($path);
 }
 /**
  * Parses head contents
  *
  * @param DOMNode $node 
  * @return void
  */
 private function parseHead(DOMNode $node)
 {
     if ($node->hasChildNodes()) {
         $nList = $node->childNodes;
         foreach ($nList as $n) {
             if ($n->nodeName == self::REMOVE) {
                 if ($key = $n->getAttribute('key')) {
                     if (array_key_exists($key, $this->headData)) {
                         unset($this->headData[$key]);
                     } else {
                     }
                 }
             } else {
                 if ($n->nodeName == self::TITLE) {
                     if ($n->getAttribute('type') == 'append') {
                         Fox::getHelper('core/head')->addTitle($n->nodeValue, TRUE);
                     } else {
                         if ($n->getAttribute('type') == 'prepend') {
                             Fox::getHelper('core/head')->addTitle($n->nodeValue, FALSE);
                         } else {
                             Fox::getHelper('core/head')->setTitle($n->nodeValue);
                         }
                     }
                 } else {
                     if ($n->nodeName == self::META_DESCRIPTION) {
                         if ($n->getAttribute('type') == 'append') {
                             Fox::getHelper('core/head')->addMetaDescription($n->nodeValue, TRUE);
                         } else {
                             if ($n->getAttribute('type') == 'prepend') {
                                 Fox::getHelper('core/head')->addMetaDescription($n->nodeValue, FALSE);
                             } else {
                                 Fox::getHelper('core/head')->setMetaDescription($n->nodeValue);
                             }
                         }
                     } else {
                         if ($n->nodeName == self::META_KEYWORD) {
                             if ($n->getAttribute('type') == 'append') {
                                 Fox::getHelper('core/head')->addMetaKeywords($n->nodeValue, TRUE);
                             } else {
                                 if ($n->getAttribute('type') == 'prepend') {
                                     Fox::getHelper('core/head')->addMetaKeywords($n->nodeValue, FALSE);
                                 } else {
                                     Fox::getHelper('core/head')->setMetaKeywords($n->nodeValue);
                                 }
                             }
                         } else {
                             if ($n->hasAttributes()) {
                                 if ($n->nodeName == self::SCRIPT) {
                                     $n->appendChild($n->ownerDocument->createTextNode(''));
                                     $kSrc = 'src';
                                 } else {
                                     $kSrc = 'href';
                                 }
                                 $nSrc = $n->getAttribute($kSrc);
                                 if ($n->hasAttribute(self::_GLOBAL)) {
                                     $n->setAttribute($kSrc, Fox::getSiteUrl() . $nSrc);
                                     $n->removeAttribute(self::_GLOBAL);
                                 } else {
                                     $n->setAttribute($kSrc, Fox::getThemeUrl($nSrc));
                                 }
                                 if ($nSrc) {
                                     $this->headData[$nSrc] = array('type' => $kSrc, 'node' => $n);
                                 } else {
                                     $this->headData[] = array('type' => $kSrc, 'node' => $n);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }