本文整理汇总了PHP中objects_for_select函数的典型用法代码示例。如果您正苦于以下问题:PHP objects_for_select函数的具体用法?PHP objects_for_select怎么用?PHP objects_for_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了objects_for_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select_tag_campuses
function select_tag_campuses($name = 'campus', $selected = 2, $options = array())
{
$c = new Criteria();
$c->addAscendingOrderByColumn(CampusPeer::NAME);
$campuses = CampusPeer::doSelect($c);
return select_tag($name, objects_for_select($campuses, 'getId', 'getName', $selected, array()), $options);
}
示例2: objects_for_select
$obj2->setValue('value2');
$actual = objects_for_select(array($obj1, $obj2), 'getValue', 'getText', 'value');
$expected = "<option value=\"value\" selected=\"selected\">text</option>\n<option value=\"value2\">text2</option>\n";
$t->is($expected, $actual);
$actual = objects_for_select(array($obj1, $obj2), 'getValue');
$expected = "<option value=\"value\">value</option>\n<option value=\"value2\">value2</option>\n";
$t->is($expected, $actual);
try {
$actual = objects_for_select(array($obj1, $obj2), 'getNonExistantMethod');
$t->is($expected, $actual);
$t->fail();
} catch (sfViewException $e) {
$t->pass();
}
try {
$actual = objects_for_select(array($obj1, $obj2), 'getValue', 'getNonExistantMethod');
$t->is($expected, $actual);
$t->fail();
} catch (sfViewException $e) {
$t->pass();
}
// object_input_hidden_tag()
$t->diag('object_input_hidden_tag()');
$obj1 = new TestObject();
$t->is(object_input_hidden_tag($obj1, 'getValue'), '<input type="hidden" name="value" id="value" value="value" />');
// object_input_tag()
$t->diag('object_input_tag()');
$obj1 = new TestObject();
$t->is(object_input_tag($obj1, 'getValue'), '<input type="text" name="value" id="value" value="value" />');
// object_checkbox_tag()
$t->diag('object_checkbox_tag()');
示例3: input_tag
echo input_tag($name, $cs_setting->getValue(), 'size=55');
break;
case 'textarea':
echo textarea_tag($name, $cs_setting->getValue());
break;
case 'yesno':
echo 'Yes: ' . radiobutton_tag($name, 1, $cs_setting->getValue());
echo 'No: ' . radiobutton_tag($name, 0, $cs_setting->getValue() ? false : true);
break;
case 'select':
$options = _parse_attributes($cs_setting->getOptions());
echo select_tag($name, options_for_select($options, $cs_setting->getValue(), 'include_blank=true'));
break;
case 'model':
$config = _parse_attributes($cs_setting->getOptions());
$method = $cs_setting->getOption('table_method');
$method = $method ? $method : 'findAll';
$options = Doctrine::getTable($cs_setting->getOption('model', true))->{$method}();
echo select_tag($name, objects_for_select($options, 'getId', '__toString', $cs_setting->getValue()), 'include_blank=true');
break;
case 'wysiwyg':
echo textarea_tag($name, $cs_setting->getvalue(), 'rich=true ' . $cs_setting->getOptions());
break;
case 'upload':
echo $cs_setting->getValue() ? link_to($cs_setting->getValue(), public_path('uploads/setting/' . $cs_setting->getValue())) . '<br />' : '';
echo input_file_tag($name, $cs_setting->getValue(), $cs_setting->getOptions());
break;
default:
echo input_tag($name, $cs_setting->getValue(), 'size=55');
break;
}
示例4: use_helper
<?php
use_helper('Validation');
use_helper('Object');
include_partial('global/page_header', array('title' => 'Weryfikacja właściciela bloga'));
echo form_tag('blog/verification');
?>
<fieldset>
<div class="row">
<label for="login">Wybierz swój blog: </label>
<?php
echo select_tag('blog_id', objects_for_select($blogs, 'getId', 'getName'));
?>
</div>
<div class="infobox"><p class="center">Podaj swój login i hasło z <a href="http://forum.php.pl">Forum PHP.pl</a></p></div>
<div class="row">
<?php
echo form_error('login');
?>
<label for="login">Login: </label>
<?php
echo input_tag('login');
?>
</div>
<div class="row">
<?php
echo form_error('password');
?>
示例5: object_input_tag
if ($sf_request->hasError('first_name')) {
echo '<span class="form-error">' . $sf_request->getError('first_name') . '</span>';
}
?>
</div></label>
<label for="last_name">Last Name:
<div class="registration-input"><?php
echo object_input_tag($profile, 'getLastName');
if ($sf_request->hasError('last_name')) {
echo '<span class="form-error">' . $sf_request->getError('last_name') . '</span>';
}
?>
</div></label>
<label for="department">Department:
<div class="registration-input"><?php
echo select_tag('department', objects_for_select($departments, 'getUuid', 'getName', $profile->getDepartmentId(), array()), array('class' => 'xxx'));
if ($sf_request->hasError('department')) {
echo '<span class="form-error">' . $sf_request->getError('department') . '</span>';
}
?>
</div></label>
</fieldset>
</div>
<div>
You will be able to change your primary email address later by clicking on profile->edit
</div>
<div class="submit-row" style="text-align:center;"><?php
echo submit_tag('Sign Up', array());
?>
<p/></div>
</form>
示例6: render
/**
* Renders the images editor
*
* @return string
*
*/
public function render()
{
return sprintf($this->editorSkeleton, label_for('page_name', __('Page name:')), input_tag('w3s_page_name', ''), label_for('group_name', __('Group name:')), select_tag('w3s_groups_select', objects_for_select(W3sGroupPeer::getActiveGroups(), 'getId', 'getGroupName')), link_to_function(__('Add Page'), 'W3sPage.add()', 'class="link_button"'));
}
示例7: __
<?php
if ($show_project_select) {
?>
<label>
<?php
echo __('Project');
?>
:
</label>
<select name="filter[project]">
<option value="-1"><?php
echo __('All');
?>
</option>
<?php
echo objects_for_select($projects, 'getId', '__toString', $sf_user->getAttribute('project', -1, 'report_filter') != -1 ? $sf_user->getAttribute('project', '', 'report_filter') : null);
?>
</select>
<?php
}
?>
<input class="button altbutton" type="submit" value="<?php
echo __('Filter');
?>
" />
<input type="button" onclick="location.href='<?php
echo url_for('report/clearFilter?target=' . $destination_action . '&pagesize=' . $sf_request->getParameter('pagesize', 20) . '&page=' . $sf_request->getParameter('page', 1));
?>
示例8: use_helper
<?php
use_helper('I18N', 'Object', 'Javascript');
?>
<?php
if ($sf_request->hasError('filters{id_reunion}')) {
?>
<?php
echo form_error('filters{id_reunion}', array('class' => 'form-error-msg'));
}
?>
<?php
$value = select_tag('filters[id_reunion]', objects_for_select($reuniones, 'getIdReunion', 'getNombre', '', array('include_blank' => true), array('control_name' => 'filters[id_reunion]')));
echo $value ? $value : ' ';
示例9: select_tag
?>
<label for="deceased_after"> To</label>
<?php
echo $date_widget->render('added_date2', $added_date2);
?>
</div>
<div class="div-contact">
<br clear="left"/>
<label for="ff_city">Ref Source</label>
<?php
echo select_tag('ref_source', objects_for_select($ref_sources, 'getId', 'getSourceName', $ref_source, array('include_custom' => '- any -')), array('class' => 'text'));
?>
<br clear="left"/>
<label for="ff_country">Contact Type</label>
<?php
echo select_tag('contact_type', objects_for_select($contact_types, 'getId', '__toString', $contact_type, array('include_custom' => '- any -')), array('class' => 'text'));
?>
</div>
<div class="div-contact">
<br clear="left"/>
<br clear="left"/>
<br clear="left"/>
<input type="submit" value="Find"/>
<?php
echo link_to('reset', '@default_index?module=contact&filter=1');
?>
</div>
</div>
</div>
<input type="submit" class="hide" value="submit"/>
</div>
示例10: render
/**
* Renders the editor
*
* @return string
*
*/
public function render()
{
$options = DbFinder::from('W3sTemplate')->find();
return sprintf($this->editorSkeleton, label_for('group_name', w3sCommonFunctions::toI18n('Group name:')), input_tag('w3s_group_name', ''), label_for('template_name', w3sCommonFunctions::toI18n('Template name:')), select_tag('w3s_templates_select', objects_for_select($options, 'getId', 'getTemplateName')), link_to_function(w3sCommonFunctions::toI18n('Add Group'), 'W3sGroup.add()', 'id="w3s_change_button" class="link_button"'));
}
示例11: form_error
<?php
if ($sf_request->hasError('documento{id_reunion}')) {
?>
<?php
echo form_error('documento{id_reunion}', array('class' => 'form-error-msg'));
?>
<?php
}
?>
<?php
$reuniones = $documento->getIdproyecto() ? ReunionPeer::getReunionesEmpresaProyecto($documento->getIdProyecto()) : array();
?>
<?php
echo select_tag('documento[id_reunion]', objects_for_select($reuniones, 'getIdReunion', 'getNombre', $documento->getIdReunion(), array('include_custom' => "- " . __('Sin definir') . " -")));
?>
</div>
</div>
<?php
}
?>
<div class="form-row">
<?php
echo label_for('documento[id_categoria]', __($labels['documento{id_categoria}']), '');
?>
<div class="content"><?php
$value = object_select_tag($documento->getIdCategoria(), 'getNombre', array('related_class' => 'Parametro', 'control_name' => 'documento[id_categoria]', 'peer_method' => 'getCategoriasDocumentos', 'text_method' => 'getNombre', 'include_custom' => "- " . __('Sin definir') . " -"));
echo $value ? $value : ' ';
?>
</div>
示例12: form_error
}
?>
">
<?php
if ($sf_request->hasError('campo{valor_defecto}')) {
?>
<?php
echo form_error('campo{valor_defecto}', array('class' => 'form-error-msg'));
?>
<?php
}
?>
<?php
eval("if (in_array('getCriterioAlcance',get_class_methods('" . $campo->getValorObjeto() . "Peer'))) {\$c = " . $campo->getValorObjeto() . "Peer::getCriterioAlcance();} else {\$c = new Criteria();}");
eval("\$valores = " . $campo->getValorObjeto() . "Peer::doSelect(\$c);");
$value = select_tag("campo[defecto_objeto]", objects_for_select($valores, 'getPrimaryKey', '__toString', $campo->getDefecto(), array('include_blank' => true)), array('control_name' => "campo[defecto_objeto]"));
echo $value ? $value : ' ';
?>
<div class="sf_edit_help"><?php
echo __('Indique el valor por defecto del campo');
?>
</div>
</div>
<?php
}
?>
</div>
<div class="form-row" id="capa_texto_corto" <?php
if (!$campo->esTipoTextoCorto()) {
echo "style=\"display:none;\"";
示例13: input_tag
echo input_tag("last_name");
?>
</li>
<li>
<?php
echo label_for('register_password', 'Password'), input_password_tag("register_password");
?>
<br />
<?php
echo label_for('register_password_confirm', 'Confirm Password'), input_password_tag("register_password_confirm");
?>
</li>
<li>
<?php
echo label_for('register_email', __('Email')), input_tag("register_email");
?>
<br />
<?php
echo label_for('department', __('Department')), select_tag('department', objects_for_select($departments, 'getUuid', 'getName', '', array()), array('class' => 'xxx', 'style' => 'width:100px;'));
?>
</li>
</ul>
<div style="text-align:center;clear:both;">
<?php
echo submit_tag('Submit', array('class' => 'btn', 'style' => 'color:black;'));
?>
</div>
</form>
</div>
示例14: observe_field
?>
<?php
echo observe_field('filters_id_fase', array('frequency' => 1, 'script' => 'true', 'update' => 'reuniones', 'url' => 'documentos/elegirfasefilters', 'with' => "'id_proyecto='+\$('filters_id_proyecto').value+'id_fase='+\$('filters_id_fase').value"));
?>
</div>
</div>
<div class="form-row">
<label for="filters_id_reunion"><?php
echo __('Reunion:');
?>
</label>
<div id="reuniones" class="content"><?php
echo select_tag('filters[id_reunion]', options_for_select(array('' => '')) . objects_for_select($reuniones, 'getIdReunion', 'getNombre', isset($filters['id_reunion']) ? $filters['id_reunion'] : null));
?>
</div>
</div>
<div class="form-row">
<label for="filters_id_categoria"><?php
echo __('Categoría') . ":";
?>
</label>
<div class="content"><?php
$value = object_select_tag(isset($filters['id_categoria']) ? $filters['id_categoria'] : null, 'getNombre', array('related_class' => 'Parametro', 'control_name' => 'filters[id_categoria]', 'peer_method' => 'getCategoriasDocumentos', 'text_method' => 'getNombre', 'include_blank' => true));
echo $value ? $value : ' ';
?>
</div>
示例15: label_for
echo label_for('project_school', 'School'), select_tag('project_school', objects_for_select($campuses, 'getId', 'getName', '', array('include_blank' => true)));
?>
</li>
<?php
/*<li><?php echo label_for('project_status', 'Status'), select_tag('project_status', options_for_select(array(
'' => '',
'0' => __('complete'),
'1' => __('cancelled'),
'2' => __('pending approval'),
'3' => __('in progress'),
'4' => __('unknown'),
)) )
?></li> */
?>
<li><?php
echo label_for('project_department', 'Department'), select_tag('project_department', objects_for_select($departments, 'getId', 'getName', '', array('include_blank' => true)), array('class' => 'xxx'));
?>
</li>
<li><br /><?php
echo submit_tag(__('Update Projects'));
?>
</li>
</ul>
</form>
<div style="height:20px;display:inline;">
<p id="form-search-indicator" style="display:none">
<?php
echo image_tag('indicator.gif');
?>
Searching projects...