/**
  * Fungsi escapeCheckEmpty
  *
  * @param string $date tanggal yang mau diformat
  * @param integer $format jenis format yang mau dilakukan
  *
  * @return string tanggal yang sudah diformat
  */
 public function escapeCheckEmpty($input)
 {
     $output = '';
     if (empty($input)) {
         $output = '-';
     } else {
         $output = $this->view->escape($input);
     }
     return $output;
 }
Example #2
0
 /**
  * Escape a string
  * 
  * @param  string $string 
  * @return string
  */
 protected function _escape($string)
 {
     if ($this->view instanceof Zend_View_Interface) {
         return $this->view->escape($string);
     }
     return htmlentities((string) $string, null, 'UTF-8');
 }
Example #3
0
 /**
  * Render dojo module paths and requires
  * 
  * @return string
  */
 protected function _renderExtras()
 {
     $js = array();
     $modulePaths = $this->getModulePaths();
     if (!empty($modulePaths)) {
         foreach ($modulePaths as $path) {
             $js[] = 'dojo.registerModulePath("' . $this->view->escape($path) . '");';
         }
     }
     $modules = $this->getModules();
     if (!empty($modules)) {
         foreach ($modules as $module) {
             $js[] = 'dojo.require("' . $this->view->escape($module) . '");';
         }
     }
     $onLoadActions = array();
     foreach ($this->getOnLoadActions() as $callback) {
         $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
     }
     $content = '';
     if (!empty($js)) {
         $content .= implode("\n    ", $js) . "\n";
     }
     if (!empty($onLoadActions)) {
         $content .= implode("\n    ", $onLoadActions) . "\n";
     }
     if (preg_match('/^\\s*$/s', $content)) {
         return '';
     }
     $html = '<script type="text/javascript">' . PHP_EOL . ($this->_isXhtml ? '//<![CDATA[' : '//<!--') . PHP_EOL . $content . ($this->_isXhtml ? '//]]>' : '//-->') . PHP_EOL . PHP_EOL . '</script>';
     return $html;
 }
Example #4
0
 /**
  * Creates a hidden element.
  *
  * We have this as a common method because other elements often
  * need hidden elements for their operation.
  *
  * @access protected
  *
  * @param $name The element name.
  *
  * @param $value The element value.
  *
  * @param $attribs Attributes for the element.
  *
  * @return string A hidden element.
  */
 protected function _hidden($name, $value = null, $attribs = null)
 {
     return '<input type="hidden"'
          . ' name="' . $this->view->escape($name) . '"'
          . ' value="' . $this->view->escape($value) . '"'
          . $this->_htmlAttribs($attribs) . ' />';
 }
Example #5
0
 public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = $element->getName();
     }
     return '<div class="pointer" onClick = goToErrorLabel(\'' . $element->getId() . '\')>' . $this->getMarkupElementLabelStart() . $view->escape($label) . $this->getMarkupElementLabelEnd() . '</div>';
 }
Example #6
0
    /**
     * Render dojo module paths and requires
     *
     * @return string
     */
    protected function _renderExtras()
    {
        $js = array();
        $modulePaths = $this->getModulePaths();
        if (!empty($modulePaths)) {
            foreach ($modulePaths as $module => $path) {
                $js[] =  'dojo.registerModulePath("' . $this->view->escape($module) . '", "' . $this->view->escape($path) . '");';
            }
        }

        $modules = $this->getModules();
        if (!empty($modules)) {
            foreach ($modules as $module) {
                $js[] = 'dojo.require("' . $this->view->escape($module) . '");';
            }
        }

        $onLoadActions = array();
        // Get Zend specific onLoad actions; these will always be first to 
        // ensure that dijits are created in the correct order
        foreach ($this->_getZendLoadActions() as $callback) {
            $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
        }

        // Get all other onLoad actions
        foreach ($this->getOnLoadActions() as $callback) {
            $onLoadActions[] = 'dojo.addOnLoad(' . $callback . ');';
        }

        $javascript = implode("\n    ", $this->getJavascript());

        $content = '';
        if (!empty($js)) {
            $content .= implode("\n    ", $js) . "\n";
        }

        if (!empty($onLoadActions)) {
            $content .= implode("\n    ", $onLoadActions) . "\n";
        }

        if (!empty($javascript)) {
            $content .= $javascript . "\n";
        }

        if (preg_match('/^\s*$/s', $content)) {
            return '';
        }

        $html = '<script type="text/javascript">' . PHP_EOL
              . (($this->_isXhtml) ? '//<![CDATA[' : '//<!--') . PHP_EOL
              . $content
              . (($this->_isXhtml) ? '//]]>' : '//-->') . PHP_EOL
              . PHP_EOL . '</script>';
        return $html;
    }
Example #7
0
 /**
  * Render element label
  *
  * @param  Zend_Form_Element $element
  * @param  Zend_View_Interface $view
  * @return string
  */
 public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = $element->getName();
     }
     return $this->getMarkupElementLabelStart() . $view->escape($label) . $this->getMarkupElementLabelEnd();
 }
Example #8
0
 /**
  * Render element label
  *
  * @param  Zend_Form_Element $element
  * @param  Zend_View_Interface $view
  * @return string
  */
 public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = $element->getName();
         // Translate element name
         if (null !== ($translator = $element->getTranslator())) {
             $label = $translator->translate($label);
         }
     }
     if ($this->getEscape()) {
         $label = $view->escape($label);
     }
     return $this->getMarkupElementLabelStart() . $label . $this->getMarkupElementLabelEnd();
 }
Example #9
0
 /**
  * Creates a hidden element.
  *
  * We have this as a common method because other elements often
  * need hidden elements for their operation.
  *
  * @access protected
  *
  * @param $name The element name.
  *
  * @param $value The element value.
  *
  * @param $attribs Attributes for the element.
  *
  * @return string A hidden element.
  */
 protected function _hidden($name, $value = null, $attribs = null)
 {
     $endTag = $this->view->doctype()->isXhtml() ? ' />' : '>';
     return '<input type="hidden"' . ' name="' . $this->view->escape($name) . '"' . ' value="' . $this->view->escape($value) . '"' . $this->_htmlAttribs($attribs) . $endTag;
 }