本文整理汇总了PHP中RSMembershipHelper::showCustomField方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::showCustomField方法的具体用法?PHP RSMembershipHelper::showCustomField怎么用?PHP RSMembershipHelper::showCustomField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::showCustomField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItem
public function getItem($pk = null)
{
$id = $pk ? $pk : $this->getState($this->getName() . '.id');
// $item = parent::getItem($id);
// if transaction is made and user is not created
$transaction = JTable::getInstance('Transaction', 'RSMembershipTable');
$transaction->load($id);
/// get the user data
$data = $transaction->user_data ? (object) unserialize($transaction->user_data) : (object) array();
if (!$transaction->user_id) {
$user = (object) array('id' => 0, 'username' => isset($data->username) && !empty($data->username) ? $data->username : JText::_('COM_RSMEMBERSHIP_SUBSCRIBERNAME_EMPTY'), 'name' => isset($data->name) ? $data->name : '', 'email' => $transaction->user_email);
} else {
$user = JFactory::getUser($transaction->user_id);
}
$params = RSMembershipHelper::parseParams($transaction->params);
$membership_id = 0;
if (isset($params['membership_id'])) {
$membership_id = $params['membership_id'];
}
if (isset($params['to_id'])) {
$membership_id = $params['to_id'];
}
$membership_info = array();
if ($membership_id) {
if ($membership_fields = RSMembership::getCustomMembershipFields($membership_id)) {
$selected = isset($data->membership_fields) ? $data->membership_fields : array();
foreach ($membership_fields as $field) {
$membership_info[] = RSMembershipHelper::showCustomField($field, $selected, false, false, 'membership');
}
}
}
$item = (object) array('user_id' => $user->id, 'username' => $user->username, 'email' => $user->email, 'name' => $user->name, 'transaction' => $id, 'transaction_data' => $transaction, 'membership_info' => $membership_info);
return $item;
}
示例2: getItem
public function getItem($pk = null)
{
static $cache = array();
if (!isset($cache[$pk])) {
$item = parent::getItem($pk);
if (isset($item->extras)) {
$item->extras = explode(',', $item->extras);
}
if (empty($item->user_id)) {
$item->user_id = JFactory::getApplication()->input->get('user_id', 0, 'int');
}
if (empty($item->currency)) {
$item->currency = RSMembershipHelper::getConfig('currency');
}
@(list($date, $time) = explode(' ', $item->membership_end, 2));
if ($item->membership_end == '0000-00-00 00:00:00' || $date == '1970-01-01' || $date == '1969-12-31') {
$item->unlimited = 1;
}
$membership_info = array();
$hasTransaction = (int) $item->last_transaction_id;
if ($item->membership_id && $hasTransaction) {
if ($membership_fields = RSMembership::getCustomMembershipFields($item->membership_id)) {
// get the trasaction
$transaction = JTable::getInstance('Transaction', 'RSMembershipTable');
$transaction->load($item->last_transaction_id);
$user_data = $transaction->user_data ? (object) unserialize($transaction->user_data) : (object) array();
$selected = isset($user_data->membership_fields) ? $user_data->membership_fields : array();
foreach ($membership_fields as $field) {
$membership_info[] = RSMembershipHelper::showCustomField($field, $selected, true, true, 'membership');
}
}
}
$item->membership_info = $membership_info;
$cache[$pk] = $item;
}
return $cache[$pk];
}
示例3: getMembershipFields
public static function getMembershipFields($membership_id, $editable = true, $user_id = false, $show_required = true, $transaction_id = 0)
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$return = array();
if ($user_id) {
$user = JFactory::getUser($user_id);
$guest = false;
} else {
$user = JFactory::getUser();
$guest = $user->get('guest');
}
$post = JFactory::getApplication()->input->get('rsm_membership_fields', array(), 'array');
$fields = RSMembership::getCustomMembershipFields($membership_id);
if (!$post && !$guest) {
if ($transaction_id) {
$query->clear();
$query->select($db->qn('user_data'))->from($db->qn('#__rsmembership_transactions'))->where($db->qn('id') . ' = ' . $db->q($transaction_id));
$db->setQuery($query);
$data = unserialize($db->loadResult());
if (isset($data->membership_fields)) {
foreach ($data->membership_fields as $key => $val) {
$post[$key] = $val;
}
}
}
}
foreach ($fields as $field) {
$return[] = RSMembershipHelper::showCustomField($field, $post, $editable, $show_required, 'membership');
}
return $return;
}
示例4: _getFields
function _getFields()
{
$fields = array();
$field = new stdClass();
$field->id = '';
$field->name = 'cc_number';
$field->label = JText::_('RSM_AUTHORIZE_CC_NUMBER');
$field->type = 'textbox';
$field->values = '';
$field->additional = 'maxlength="16" onkeydown="return rsm_check_card(this);" onkeyup="return rsm_check_card(this);"';
$field->required = 1;
$fields['cc_number'] = RSMembershipHelper::showCustomField($field, array(), true, false);
$field = new stdClass();
$field->id = '';
$field->name = 'csc_number';
$field->label = JText::_('RSM_AUTHORIZE_CSC');
$field->type = 'textbox';
$field->values = '';
$field->additional = 'style="width: 45px; text-align: center;" maxlength="4" onkeydown="return rsm_check_card(this);" onkeyup="return rsm_check_card(this);"';
$field->required = 1;
$fields['csc_number'] = RSMembershipHelper::showCustomField($field, array(), true, false);
$field = new stdClass();
$field->id = '';
$field->name = 'cc_image';
$field->label = '';
$field->type = 'freetext';
$field->values = JHTML::image('plugins/system/' . $this->joomla16prefix . 'rsmembershipauthorize/images/cc_logos.gif', 'Credit Cards');
$field->additional = '';
$field->required = 0;
$fields['cc_image'] = RSMembershipHelper::showCustomField($field, array(), true, false);
$field = new stdClass();
$field->id = '';
$field->name = 'cc_exp_mm';
$field->label = JText::_('RSM_MONTH');
$field->type = 'select';
$field->values = array();
for ($i = 1; $i <= 12; $i++) {
$field->values[] = ($i < 10 ? '0' . $i : $i) . '-' . JText::_('RSM_AUTHORIZE_MONTH_' . $i);
}
$field->values = implode("\n", $field->values);
$field->additional = '';
$field->required = 1;
$fields['cc_exp_mm'] = RSMembershipHelper::showCustomField($field, array(), true, false);
$field = new stdClass();
$field->id = '';
$field->name = 'cc_exp_yy';
$field->label = JText::_('RSM_YEAR');
$field->type = 'textbox';
$field->values = '';
$field->additional = 'style="width: 35px; text-align: center;" maxlength="4" onblur="rsm_check_year(this)" onkeydown="return rsm_check_card(this);" onkeyup="return rsm_check_card(this);"';
$field->required = 1;
$fields['cc_exp_yy'] = RSMembershipHelper::showCustomField($field, array(), true, false);
$field = new stdClass();
$field->id = '';
$field->name = 'cc_fname';
$field->label = JText::_('RSM_AUTHORIZE_FIRST_NAME');
$field->type = 'textbox';
$field->values = '';
$field->additional = 'maxlength="64"';
$field->required = 1;
$fields['cc_fname'] = RSMembershipHelper::showCustomField($field, array(), true, false);
$field = new stdClass();
$field->id = '';
$field->name = 'cc_lname';
$field->label = JText::_('RSM_AUTHORIZE_LAST_NAME');
$field->type = 'textbox';
$field->values = '';
$field->additional = 'maxlength="64"';
$field->required = 1;
$fields['cc_lname'] = RSMembershipHelper::showCustomField($field, array(), true, false);
return $fields;
}
示例5: getFields
function getFields($editable = true, $user_id = false, $show_required = true, $transaction_id = 0)
{
$return = array();
$db = JFactory::getDBO();
if ($user_id) {
$user = JFactory::getUser($user_id);
$guest = false;
} else {
$user = JFactory::getUser();
$guest = $user->get('guest');
}
$post = JRequest::getVar('rsm_fields', array(), 'post');
$db->setQuery("SELECT * FROM #__rsmembership_fields WHERE published='1' ORDER BY ordering");
$fields = $db->loadObjectList();
if (!$post && !$guest) {
if ($transaction_id) {
$db->setQuery("SELECT `user_data` FROM #__rsmembership_transactions WHERE `id`='" . (int) $transaction_id . "'");
$data = @unserialize($db->loadResult());
$post = array();
foreach ($data->fields as $key => $val) {
$post[$key] = $val;
}
} else {
$db->setQuery("SELECT * FROM #__rsmembership_users WHERE user_id='" . $user->get('id') . "'");
$data = $db->loadObject();
if (!empty($data)) {
unset($data->user_id);
foreach ($fields as $field) {
$field_id = 'f' . $field->id;
if (!isset($data->{$field_id})) {
continue;
}
if (in_array($field->type, array('select', 'multipleselect', 'checkbox'))) {
$post[$field->name] = explode("\n", $data->{$field_id});
} else {
$post[$field->name] = $data->{$field_id};
}
}
}
}
}
foreach ($fields as $field) {
$return[] = RSMembershipHelper::showCustomField($field, $post, $editable, $show_required);
}
return $return;
}