当前位置: 首页>>代码示例>>PHP>>正文


PHP input::vget方法代码示例

本文整理汇总了PHP中input::vget方法的典型用法代码示例。如果您正苦于以下问题:PHP input::vget方法的具体用法?PHP input::vget怎么用?PHP input::vget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在input的用法示例。


在下文中一共展示了input::vget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCode

 /**
  * Retrieves markup/code of databrowser to be embedded in view.
  *
  * @return string markup/code of databrowser
  */
 public function getCode()
 {
     // get items to render in databrowser
     try {
         $this->processInput();
         $items = $this->getItems();
     } catch (\RuntimeException $e) {
         return markup::paragraph(markup::emphasize(_L('Failed to query datasource for listing items.')));
     }
     // render table including related pager widget
     if (count($items)) {
         // fetch form to use optionally
         $form = $this->getForm();
         $volatiles = _A(config::get('databrowser.volatiles', array()))->elements;
         $available = input::listNames();
         foreach ($volatiles as $volatile) {
             if (in_array($volatile, $available)) {
                 $form->setHidden($volatile, input::vget($volatile));
             }
         }
         // split items into raw data and additionally delivered data per row
         $rows = $extras = array();
         foreach ($items as $key => $row) {
             $rows[$key] = $row;
             unset($rows[$key]['|extra']);
             $extras[$key] = $row['|extra'];
         }
         // use local callback to wrap custom cell formatter for enriching
         // with additional data per row
         $browser = $this;
         $cellFormatter = function ($value, $name, $item, $id) use($browser, $extras) {
             return $browser->formatCell($value, $name, $item, $id, $extras[$id]);
         };
         // render table view
         $id = $form ? null : $this->datasource->name();
         $table = html::arrayToTable($rows, $id, $cellFormatter, array(&$this, 'formatHeader'), '', '', $this->className);
         $code = $this->pager . $table;
         // wrap rendered table view in form
         if ($form && !$this->callerForm) {
             $code = (string) $form->addContent($code);
         }
         // return code of rendered databrowser
         return $code;
     }
     $text = $this->emptyText ? $this->emptyText : _L('There is no data to be listed here ...');
     return markup::paragraph(markup::emphasize($text), trim($this->className . ' empty-text'));
 }
开发者ID:cepharum,项目名称:txf,代码行数:52,代码来源:databrowser.php

示例2: __call

 public function __call($method, $arguments)
 {
     /**
      * implement convenience methods for describing forms
      *
      * @example
      *  $form->setTexteditRow( 'username', 'Your Login' );
      *  $form->setTextAreaRow( 'message', 'Your Message', 'Type your message here ...' );
      *  $form->setPASSWoRDRow( 'token', 'Your Password' );
      *
      *  $form->setButtonRow( 'Submit', 'Cancel' );
      *
      *  $form->setSelectorRow( 'gender', 'Your Gender', array( 'm' => 'male', 'f' => 'female' ), 'm' );
      *
      */
     if (substr($method, 0, 3) === 'set' && substr($method, -3) === 'Row') {
         // normalize segment in method name to match markup-template
         $type = strtolower(substr($method, 3, -3));
         // get arguments depending on selected template
         switch ($type) {
             case 'selector':
             case 'multiselector':
                 list($name, $label, $options, $value) = array_splice($arguments, 0, 4);
                 break;
             case 'textarea':
                 list($name, $label, $value, $rows, $columns) = array_splice($arguments, 0, 5);
                 break;
             default:
                 list($name, $label, $value) = array_splice($arguments, 0, 3);
         }
         // auto-integrate available input
         if ($type !== 'button') {
             $value = input::vget($name, $value);
         }
         // recompile arguments to use in call for markup-template
         switch ($type) {
             case 'selector':
                 $args = array($name, $options, $value);
                 break;
             case 'multiselector':
                 $type = 'selector';
                 $args = array($name, $options, $value, null, true);
                 break;
             case 'button':
                 $args = array($name, $value, $label);
                 $label = null;
                 break;
             case 'file':
                 $type = 'upload';
             case 'upload':
                 $args = array($name);
                 break;
             case 'password':
                 $args = array($name);
                 break;
             case 'textarea':
                 $args = array($name, $value, '', $rows, $columns);
                 break;
             case 'static':
                 $type = 'inline';
                 $args = array($value);
                 break;
             default:
                 $args = array($name, $value);
         }
         // add row to form using markup-template for rendering content
         $template = array('de\\toxa\\txf\\markup', $type);
         $code = call_user_func_array($template, $args);
         // compile arguments to use on adding row (including extra information optionally given in call to this magic caller)
         array_unshift($arguments, $code);
         array_unshift($arguments, $label);
         array_unshift($arguments, $name);
         call_user_func_array(array(&$this, 'setRow'), $arguments);
     } else {
         throw new \BadMethodCallException(sprintf('invalid call for method html_form::%s(), choose set*Row() instead', $method));
     }
     return $this;
 }
开发者ID:cepharum,项目名称:txf,代码行数:78,代码来源:html_form.php

示例3: offset

 /**
  * Retrieves current number of records to skip.
  *
  * @return integer number of items to skip
  */
 public function offset()
 {
     $offset = $this->isVolatile !== false ? input::vget($this->offsetName, 0, input::FORMAT_INTEGER) : input::get($this->offsetName, 0, input::FORMAT_INTEGER);
     return max(0, min($this->itemCount - ($this->showFullFinalPage() ? $this->size() : 1), $offset));
 }
开发者ID:cepharum,项目名称:txf,代码行数:10,代码来源:pager.php

示例4: check

 /**
  * Detects if any response by user is matching captcha's expected response.
  *
  * @return bool
  */
 public function check()
 {
     if ($this->valid === null) {
         $info =& $this->generate();
         $name = $info['name'];
         if ($name) {
             $this->valid = !!$this->isValid($info['a'], $info['b'], input::vget($name));
         } else {
             $this->valid = false;
         }
         // always generate new captcha
         $this->generate(true);
     }
     return $this->valid;
 }
开发者ID:cepharum,项目名称:txf,代码行数:20,代码来源:captcha.php


注:本文中的input::vget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。