本文整理匯總了PHP中UserData::setData方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserData::setData方法的具體用法?PHP UserData::setData怎麽用?PHP UserData::setData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserData
的用法示例。
在下文中一共展示了UserData::setData方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: amp_badge_related_form
function amp_badge_related_form($data)
{
$data = array_merge($data, $_GET);
foreach ($data as $key => $value) {
if (is_array($value) && count($value) == 1) {
$quick_val = array_values($value);
$data[$key] = $quick_val[0];
}
}
$modin = isset($data['modin']) && $data['modin'] ? $data['modin'] : false;
$related_index = isset($data['related_index']) && $data['related_index'] ? $data['related_index'] : false;
if (!$modin) {
return false;
}
if (!AMP_authenticate('admin')) {
$live_forms = AMP_lookup('formsPublic');
if (!isset($live_forms[$modin])) {
return 'Please publish the related form';
}
}
require_once 'AMP/UserData.php';
$udm = new UserData(AMP_Registry::getDbcon(), $modin);
$udm->registerPlugin('Output', 'Text');
$udm->setData($data);
$renderer = AMP_get_renderer();
# $delete_button = $renderer->form(
$delete_button = $renderer->link('#', $renderer->image(AMP_SYSTEM_ICON_DELETE, array('class' => 'icon', 'style' => 'border: 0;')), array('alt' => AMP_TEXT_DELETE_ITEM, 'title' => AMP_TEXT_DELETE_ITEM, 'onClick' => "\$('form_related_item_{$related_index}').remove( ); \$('form_{$modin}_related_custom_fields_{$related_index}').remove(); return false;"));
$content = $delete_button . $renderer->tag('pre', $udm->doPlugin('Output', 'Text'));
$result = $renderer->div($content, array('class' => 'form_related_item', 'id' => 'form_related_item_' . $related_index));
return $result;
}