/** * Render HTML form * * @param string $name Form name * @param null|array $attribs HTML form attributes * @param false|string $content Form content * @return string */ public function form($name, $attribs = null, $content = false) { $info = $this->_getInfo($name, $content, $attribs); extract($info); if (!empty($name)) { $name = ' name="' . $this->view->escape($name) . '"'; } if (!empty($id)) { $id = ' id="' . $this->view->escape($id) . '"'; } $xhtml = '<form' . $name . $id . $this->_htmlAttribs($attribs) . '>'; if (false !== $content) { $xhtml .= $content . '</form>'; } return $xhtml; }
/** * Render HTML form * * @param string $name Form name * @param string $content Form content * @param array $attribs HTML form attributes * @return string */ public function fieldset($name, $content, $attribs = null) { $info = $this->_getInfo($name, $content, $attribs); extract($info); $legend = ''; if (isset($attribs['legend'])) { $legend = '<legend>' . $this->view->escape($attribs['legend']) . '</legend>' . PHP_EOL; unset($attribs['legend']); } $xhtml = '<fieldset' . ' id="' . $this->view->escape($id) . '"' . $this->_htmlAttribs($attribs) . '>' . $legend . $content . '</fieldset>'; return $xhtml; }
/** * Render HTML form * * @param string $name Form name * @param string $content Form content * @param array $attribs HTML form attributes * @return string */ public function fieldset($name, $content, $attribs = null) { $info = $this->_getInfo($name, $content, $attribs); extract($info); // get legend $legend = ''; if (isset($attribs['legend'])) { $legendString = trim($attribs['legend']); if (!empty($legendString)) { $legend = '<legend>' . $this->view->escape($legendString) . '</legend>' . PHP_EOL; } unset($attribs['legend']); } // render fieldset $xhtml = '<fieldset' . ' id="' . $this->view->escape($id) . '"' . $this->_htmlAttribs($attribs) . '>' . $legend . $content . '</fieldset>'; return $xhtml; }
/** * Render the provided pages. This checks if $view->paginator is set and, * if so, uses that. Also, if no scrolling style or partial are specified, * the defaults will be used (if set). * * @param Zend_Paginator (Optional) $paginator * @param string $scrollingStyle (Optional) Scrolling style * @param string $partial (Optional) View partial * @param array|string $params (Optional) params to pass to the partial * @return string * @throws Zend_View_Exception */ public function paginationControl(Zend_Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null) { if ($paginator === null) { if (isset($this->view->paginator) and $this->view->paginator !== null and $this->view->paginator instanceof Zend_Paginator) { $paginator = $this->view->paginator; } else { /** * @see Zend_View_Exception */ require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('No paginator instance provided or incorrect type'); $e->setView($this->view); throw $e; } } if ($partial === null) { if (self::$_defaultViewPartial === null) { /** * @see Zend_View_Exception */ require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('No view partial provided and no default set'); $e->setView($this->view); throw $e; } $partial = self::$_defaultViewPartial; } $pages = get_object_vars($paginator->getPages($scrollingStyle)); if ($params !== null) { $pages = array_merge($pages, (array) $params); } if (is_array($partial)) { if (count($partial) != 2) { /** * @see Zend_View_Exception */ require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('A view partial supplied as an array must contain two values: the filename and its module'); $e->setView($this->view); throw $e; } if ($partial[1] !== null) { return $this->view->partial($partial[0], $partial[1], $pages); } $partial = $partial[0]; } return $this->view->partial($partial, $pages); }
/** * Render the provided pages. If no scrolling style or partial * are specified, the defaults will be used (if set). * * @param Zend_Paginator $paginator * @param string $scrollingStyle (Optional) Scrolling style * @param string $partial (Optional) View partial * @return string * @throws Zend_View_Exception */ public function paginationControl(Zend_Paginator $paginator, $scrollingStyle = null, $partial = null) { if (empty($partial)) { if (empty(self::$_defaultViewPartial)) { /** * @see Zend_View_Exception */ require_once 'Zend/View/Exception.php'; throw new Zend_View_Exception('No view partial provided and no default view partial set'); } $partial = self::$_defaultViewPartial; } return $this->view->partial($partial, $paginator->getPages($scrollingStyle)); }