本文整理汇总了PHP中Zend_View_Interface::formText方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Interface::formText方法的具体用法?PHP Zend_View_Interface::formText怎么用?PHP Zend_View_Interface::formText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View_Interface
的用法示例。
在下文中一共展示了Zend_View_Interface::formText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtml
/**
*
* @static
* @param string $value
* @param Zend_View_Interface $view
* @return string
*/
public static function getHtml($value, Zend_View_Interface $view = null)
{
$value = json_decode($value, true);
if (!is_array($value)) {
$value = json_decode(self::getSaveValue('25'), true);
}
$html = '<script type="text/javascript">
function removeRate(id) {
$(\'#wraper-\' + id).remove();
}
function addRate() {
var rand = Math.floor(Math.random() * 2147483647);
var html = $(\'#shippingmultirate-template\').html();
html = html.replace(/{template_id}/g, rand)
.replace(/{template}/g, \'confValue[\' + rand + \']\');
$(\'#shippingmultirate-template\').before(html);
}
</script>';
$i = 1;
foreach ($value as $subcode => $item) {
$html .= '<div id="wraper-' . $i . '">' . 'Subcode : ' . $view->formText('confValue[' . $i . '][subcode]', $subcode, array('size' => '10')) . 'Title : ' . $view->formText('confValue[' . $i . '][title]', $item['title'], array('size' => '10')) . 'Price : ' . $view->formText('confValue[' . $i . '][price]', $item['price'], array('size' => '10')) . 'Min Subtotal : ' . $view->formText('confValue[' . $i . '][minOrderTotal]', isset($item['minOrderTotal']) ? $item['minOrderTotal'] : '', array('size' => '10')) . 'Max Subtotal : ' . $view->formText('confValue[' . $i . '][maxOrderTotal]', isset($item['maxOrderTotal']) ? $item['maxOrderTotal'] : '', array('size' => '10')) . $view->formButton('shippingmultirate-template-remove', 'Remove', array('onclick' => 'removeRate(' . $i . ');')) . '</div>';
$i++;
}
$html .= '<div id="shippingmultirate-template" style="display:none" >' . '<div id="wraper-{template_id}">' . 'Subcode : ' . $view->formText('{template}[subcode]', $subcode, array('size' => '10')) . 'Title : ' . $view->formText('{template}[title]', $item['title'], array('size' => '10')) . 'Price : ' . $view->formText('{template}[price]', $item['price'], array('size' => '10')) . 'Min Subtotal : ' . $view->formText('{template}[minOrderTotal]', isset($item['minOrderTotal']) ? $item['minOrderTotal'] : '', array('size' => '10')) . 'Max Subtotal : ' . $view->formText('{template}[maxOrderTotal]', isset($item['maxOrderTotal']) ? $item['maxOrderTotal'] : '', array('size' => '10')) . $view->formButton('shippingmultirate-template-remove', 'Remove', array('onclick' => 'removeRate(\'{template_id}\');')) . '</div>' . '</div>' . $view->formButton('shippingmultirate-template-add', 'Add', array('onclick' => 'addRate();'));
return $html;
}
示例2: questionElement
/**
* Generate the form element required for a particular question/response
*
* @param QuestionModel question object for which an element is being generated
* @param ResponseModel response object
* @return string
*/
public function questionElement($q, $r)
{
$b = new Tag_Builder();
$responseText = $this->view->h($r->responseText);
switch (strtolower(substr($q->format, 0, 1))) {
case 'd':
return '<br/>' . $this->view->formText("q{$q->questionID}", $responseText, array('class' => 'calendarText', 'size' => 13, 'readonly' => 1)) . $this->view->linkTo('#showCalendar', $this->view->imageTag('icons/calendar.png', array('id' => "c{$q->questionID}", 'class' => 'calendarButton', 'title' => 'calendar')));
case 't':
return '<br/>' . $this->view->formText("q{$q->questionID}", $responseText, array('size' => 50));
case 's':
$response = '<br/>';
if (count($q->prompts) > 4) {
$options = '';
foreach ($q->prompts as $prompt) {
$class = $prompt['requireAddlInfo'] ? 'require-addl' : null;
$selected = $prompt['promptID'] == $responseText ? 'selected' : null;
$options .= $b->option(array_filter(array('value' => $prompt['promptID'], 'class' => $class, 'selected' => $selected)), $this->view->h($prompt['value']));
$response .= $this->rulesElements($prompt);
}
$response .= $b->select(array('name' => "q{$q->questionID}"), $options);
} else {
foreach ($q->prompts as $prompt) {
$class = $prompt['requireAddlInfo'] ? 'require-addl' : null;
$checked = $prompt['promptID'] == $r->responseText ? 'checked' : null;
$response .= $b->input(array_filter(array('type' => 'radio', 'value' => $prompt['promptID'], 'name' => "q{$q->questionID}", 'checked' => $checked, 'class' => $class)));
$response .= $this->rulesElements($prompt);
$response .= $b->label($this->view->h($prompt['value']));
}
}
return $response;
case 'm':
$response = '<br/>';
foreach (split(',', $responseText) as $id) {
$responseIDs[$id] = true;
}
foreach ($q->prompts as $prompt) {
$class = $prompt['requireAddlInfo'] ? 'require-addl' : null;
$checked = isset($responseIDs[$prompt['promptID']]) ? 'checked' : null;
$response .= $b->input(array_filter(array('type' => 'checkbox', 'value' => $prompt['promptID'], 'name' => "q{$q->questionID}_m{$prompt['promptID']}", 'checked' => $checked, 'class' => $class)));
$response .= $this->rulesElements($prompt);
$response .= $b->label($this->view->h($prompt['value']));
$response .= '<br/>';
}
return $response;
case '_':
return $this->view->formHidden("q{$q->questionID}", '');
default:
throw new Exception('Unrecognized question type');
}
return '';
}
示例3: getHtml
/**
*
* @param array $value
* @param Zend_View_Interface $view
* @return string
*/
public static function getHtml($value, Zend_View_Interface $view = null)
{
$value = json_decode($value, true);
foreach (self::_getOptions() as $options) {
switch ($options['type']) {
case 'bool':
$html .= $view->formRadio('confValue[' . $options['name'] . ']', $value[$options['id']], null, array('1' => Axis::translate()->__(' Yes'), '0' => Axis::translate()->__(' No')));
break;
case 'select':
$html .= $view->formSelect('confValue[' . $options['name'] . ']', $value[$options['id']], null, $options['config_options']);
break;
case 'multiple':
$html .= '<br />';
foreach ($options['config_options'] as $key => $dataItem) {
$html .= $view->formCheckbox('confValue[' . $options['name'] . '][' . $key . ']', isset($value[$options['name']][$key]) && $value[$options['name']][$key] ? 1 : null, null, array(1, 0)) . " {$dataItem} <br /> ";
}
break;
case 'text':
$html .= $view->formTextarea('confValue[' . $options['name'] . ']', $value[$options['id']], array('rows' => 8, 'cols' => 45));
break;
default:
$html .= $view->formText('confValue[' . $options['name'] . ']', $value[$options['id']], array('size' => '50'));
}
}
return $html;
}
示例4: getHtml
/**
*
* @static
* @param string $value
* @param Zend_View_Interface $view
* @return string
*/
public static function getHtml($value, Zend_View_Interface $view = null)
{
$value = Zend_Json_Decoder::decode($value);
$html = '';
foreach (self::_getOptions() as $options) {
$html .= $options['name'] . ' ' . $view->formText('confValue[' . $options['name'] . ']', $value[$options['id']], array('size' => '50'));
}
return $html;
}
示例5: renderDate
/**
* Render form controls for a date question
*
* @param ModelQuestionModel question being rendered
* @return string
*/
public function renderDate(ModelQuestionModel $question)
{
$name = "response[{$question->questionID}][target]";
$value = $question->hasModelResponse() ? $question->nextModelResponse()->target : null;
return $this->view->formText($name, $value, array('class' => 'calendarText', 'size' => 13, 'readonly' => 1)) . $this->view->linkTo('#showCalendar', $this->view->imageTag('icons/calendar.png', array('id' => "c{$question->questionID}", 'class' => 'calendarButton', 'title' => 'calendar')));
}
示例6: getHtml
/**
*
* @static
* @param array $value
* @param Zend_View_Interface $view
* @return string
*/
public static function getHtml($value, Zend_View_Interface $view = null)
{
$html = $view->formText('confValue', $value);
return $html;
}
示例7: getHtml
/**
*
* @param string $value
* @param Zend_View_Interface $view
* @return string
*/
public static function getHtml($value, Zend_View_Interface $view = null)
{
return $view->formText('confValue', Axis_Crypt::factory()->decrypt($value), array('size' => '50'));
}