本文整理汇总了PHP中K2HelperHTML::gender方法的典型用法代码示例。如果您正苦于以下问题:PHP K2HelperHTML::gender方法的具体用法?PHP K2HelperHTML::gender怎么用?PHP K2HelperHTML::gender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K2HelperHTML
的用法示例。
在下文中一共展示了K2HelperHTML::gender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFormFields
/**
* Hook for children views to allow them attach fields to the form object.
* Children views usually should override this method.
*
* @return void
*/
protected function setFormFields(&$_form, $row)
{
$language = JFactory::getLanguage();
$language->load('', JPATH_ADMINISTRATOR);
$language->load('com_users', JPATH_ADMINISTRATOR);
// Import JForm
jimport('joomla.form.form');
// Determine form name and path
$formName = 'K2' . ucfirst($this->getName()) . 'Form';
$formPath = JPATH_ADMINISTRATOR . '/components/com_users/models/forms/user.xml';
// Convert JRegistry instances to plain object so JForm can bind them
if ($row->id) {
$row->params = $row->params->toObject();
}
// Get the form instance
$form = JForm::getInstance($formName, $formPath);
// Bind values
$form->bind($row);
$form->setValue('password', null);
$form->setValue('password2', null);
// Attach the JForm fields to the form
foreach ($form->getFieldsets() as $fieldset) {
$array = array();
foreach ($form->getFieldset($fieldset->name) as $field) {
$tmp = new stdClass();
$tmp->label = $field->label;
$tmp->input = $field->input;
$array[$field->name] = $tmp;
}
$name = $fieldset->name;
$_form->{$name} = $array;
}
JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models');
$model = JModelLegacy::getInstance('User', 'UsersModel');
if ($row->id) {
$assignedGroups = $model->getAssignedGroups($row->id);
} else {
$assignedGroups = null;
}
$_form->groups = JHtml::_('access.usergroups', 'groups', $assignedGroups, true);
require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/html.php';
$_form->gender = K2HelperHTML::gender('gender', $row->gender);
require_once JPATH_ADMINISTRATOR . '/components/com_k2/helpers/extrafields.php';
$_form->extraFields = K2HelperExtraFields::getUserExtraFieldsGroups($row->extra_fields);
require_once JPATH_ADMINISTRATOR . '/components/com_k2/classes/editor.php';
$config = JFactory::getConfig();
$editor = K2Editor::getInstance($config->get('editor'));
$_form->description = $editor->display('description', $row->description, '100%', '300', '40', '5');
}