本文整理汇总了PHP中ExtraFieldValue::getAllValuesByItemAndField方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtraFieldValue::getAllValuesByItemAndField方法的具体用法?PHP ExtraFieldValue::getAllValuesByItemAndField怎么用?PHP ExtraFieldValue::getAllValuesByItemAndField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtraFieldValue
的用法示例。
在下文中一共展示了ExtraFieldValue::getAllValuesByItemAndField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_extra_fields_in_form
//.........这里部分代码省略.........
}
}
}
}
}
$group = array();
$group[] = $form->createElement('select', 'extra_' . $field_details['field_variable'], null, $values, array('id' => $first_select_id));
$group[] = $form->createElement('select', 'extra_' . $field_details['field_variable'] . '_second', null, $second_values, array('id' => 'second_extra_' . $field_details['field_variable']));
$form->addGroup($group, 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], ' ');
if (!$admin_permissions) {
if ($field_details['field_visible'] == 0) {
$form->freeze('extra_' . $field_details['field_variable']);
}
}
break;
case ExtraField::FIELD_TYPE_DIVIDER:
$form->addElement('static', $field_details['field_variable'], '<br /><strong>' . $field_details['field_display_text'] . '</strong>');
break;
case ExtraField::FIELD_TYPE_TAG:
$field_variable = $field_details['field_variable'];
$field_id = $field_details['id'];
if ($this->type == 'user') {
// The magic should be here
$user_tags = UserManager::get_user_tags($user_id, $field_details['id']);
$tag_list = '';
if (is_array($user_tags) && count($user_tags) > 0) {
foreach ($user_tags as $tag) {
$tag_list .= '<option value="' . $tag['tag'] . '" class="selected">' . $tag['tag'] . '</option>';
}
}
$url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?';
} else {
$extraFieldValue = new ExtraFieldValue($this->type);
$tags = array();
if (!empty($itemId)) {
$tags = $extraFieldValue->getAllValuesByItemAndField($itemId, $field_id);
}
$tag_list = '';
if (is_array($tags) && count($tags) > 0) {
$extraFieldOption = new ExtraFieldOption($this->type);
foreach ($tags as $tag) {
$option = $extraFieldOption->get($tag['field_value']);
$tag_list .= '<option value="' . $option['id'] . '" class="selected">' . $option['option_display_text'] . '</option>';
}
}
$url = api_get_path(WEB_AJAX_PATH) . 'extra_field.ajax.php';
}
$form->addElement('hidden', 'extra_' . $field_details['field_variable'] . '__persist__', 1);
$multiSelect = '<select id="extra_' . $field_details['field_variable'] . '" name="extra_' . $field_details['field_variable'] . '">
' . $tag_list . '
</select>';
$form->addElement('label', $field_details['field_display_text'], $multiSelect);
$complete_text = get_lang('StartToType');
//if cache is set to true the jquery will be called 1 time
$jquery_ready_content .= <<<EOF
\$("#extra_{$field_variable}").fcbkcomplete({
json_url: "{$url}?a=search_tags&field_id={$field_id}&type={$this->type}",
cache: false,
filter_case: true,
filter_hide: true,
complete_text:"{$complete_text}",
firstselected: false,
filter_selected: true,
newel: true
});
EOF;
$jquery_ready_content = null;
break;
case ExtraField::FIELD_TYPE_TIMEZONE:
$form->addElement('select', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], api_get_timezones(), '');
if ($field_details['field_visible'] == 0) {
$form->freeze('extra_' . $field_details['field_variable']);
}
break;
case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
// get the social network's favicon
$icon_path = UserManager::get_favicon_from_url($extraData['extra_' . $field_details['field_variable']], $field_details['field_default_value']);
// special hack for hi5
$leftpad = '1.7';
$top = '0.4';
$domain = parse_url($icon_path, PHP_URL_HOST);
if ($domain == 'www.hi5.com' or $domain == 'hi5.com') {
$leftpad = '3';
$top = '0';
}
// print the input field
$form->addElement('text', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], array('size' => 60, 'style' => 'background-image: url(\'' . $icon_path . '\'); background-repeat: no-repeat; background-position: 0.4em ' . $top . 'em; padding-left: ' . $leftpad . 'em; '));
$form->applyFilter('extra_' . $field_details['field_variable'], 'stripslashes');
$form->applyFilter('extra_' . $field_details['field_variable'], 'trim');
if ($field_details['field_visible'] == 0) {
$form->freeze('extra_' . $field_details['field_variable']);
}
break;
}
}
}
$return = array();
$return['jquery_ready_content'] = $jquery_ready_content;
return $return;
}