本文整理汇总了PHP中obj::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP obj::assign方法的具体用法?PHP obj::assign怎么用?PHP obj::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obj
的用法示例。
在下文中一共展示了obj::assign方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WarnsHTML_frl_offers
/**
* Изменение HTML после предупреждений. общий случай.
*
* @param int $uid UID пользователя
* @param array $warns массив предупреждений
* @param obj $objResponse xajaxResponse
* @param string $uniqId ID DOM элемента, в котором появляется окно c предупреждением (warnlist)
* @param array $contextId Контекст (для лога админских действий)
* @param string $drawFunc что рисуем (блоги, проекты, дефиле)
*/
function WarnsHTML_frl_offers($uid, &$warns, &$objResponse, $uniqId, $contextId, $drawFunc)
{
$warncount = $warns ? count($warns) : 0;
if ($warncount < 3) {
$objResponse->script("\$\$('.warncount-{$uid}').set('html','{$warncount}');");
} else {
$objResponse->script("\$\$('.warnlink-{$uid}').set('html','<a class=\"b-buttons__link b-buttons__link_dot_c10601 b-buttons__link_margleft_10\" href=\"javascript:void(0);\" onclick=\"banned.userBan({$uid}, \\'{$contextId}\\',0);\">Забанить!</a>');");
}
$objResponse->script("if(\$('warnlist-{$uid}')!='undefined'){xajax_GetWarns({$uid},'userpage');}");
$objResponse->assign("warnreason-{$uniqId}", 'style.display', 'none');
}
示例2: buildPledgeBlock
/**
* Function to build Pledge Block in Contribution Pages
*
* @param obj $form
* @static
*/
static function buildPledgeBlock($form)
{
//build pledge payment fields.
if (!empty($form->_values['pledge_id'])) {
//get all payments required details.
$allPayments = array();
$returnProperties = array('status_id', 'scheduled_date', 'scheduled_amount', 'currency');
CRM_Core_DAO::commonRetrieveAll('CRM_Pledge_DAO_PledgePayment', 'pledge_id', $form->_values['pledge_id'], $allPayments, $returnProperties);
//get all status
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$nextPayment = array();
$isNextPayment = FALSE;
$overduePayments = array();
$now = date('Ymd');
foreach ($allPayments as $payID => $value) {
if ($allStatus[$value['status_id']] == 'Overdue') {
$overduePayments[$payID] = array('id' => $payID, 'scheduled_amount' => CRM_Utils_Rule::cleanMoney($value['scheduled_amount']), 'scheduled_amount_currency' => $value['currency'], 'scheduled_date' => CRM_Utils_Date::customFormat($value['scheduled_date'], '%B %d'));
} elseif (!$isNextPayment && $allStatus[$value['status_id']] == 'Pending') {
//get the next payment.
$nextPayment = array('id' => $payID, 'scheduled_amount' => CRM_Utils_Rule::cleanMoney($value['scheduled_amount']), 'scheduled_amount_currency' => $value['currency'], 'scheduled_date' => CRM_Utils_Date::customFormat($value['scheduled_date'], '%B %d'));
$isNextPayment = TRUE;
}
}
//build check box array for payments.
$payments = array();
if (!empty($overduePayments)) {
foreach ($overduePayments as $id => $payment) {
$key = ts("%1 - due on %2 (overdue)", array(1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $payment), CRM_Utils_Array::value('scheduled_amount_currency', $payment)), 2 => CRM_Utils_Array::value('scheduled_date', $payment)));
$payments[$key] = CRM_Utils_Array::value('id', $payment);
}
}
if (!empty($nextPayment)) {
$key = ts("%1 - due on %2", array(1 => CRM_Utils_Money::format(CRM_Utils_Array::value('scheduled_amount', $nextPayment), CRM_Utils_Array::value('scheduled_amount_currency', $nextPayment)), 2 => CRM_Utils_Array::value('scheduled_date', $nextPayment)));
$payments[$key] = CRM_Utils_Array::value('id', $nextPayment);
}
//give error if empty or build form for payment.
if (empty($payments)) {
CRM_Core_Error::fatal(ts("Oops. It looks like there is no valid payment status for online payment."));
} else {
$form->assign('is_pledge_payment', TRUE);
$form->addCheckBox('pledge_amount', ts('Make Pledge Payment(s):'), $payments);
}
} else {
$pledgeBlock = self::getPledgeBlock($form->_id);
//build form for pledge creation.
$pledgeOptions = array('0' => ts('I want to make a one-time contribution'), '1' => ts('I pledge to contribute this amount every'));
$form->addRadio('is_pledge', ts('Pledge Frequency Interval'), $pledgeOptions, NULL, array('<br/>'));
$form->addElement('text', 'pledge_installments', ts('Installments'), array('size' => 3));
if (!empty($pledgeBlock['is_pledge_interval'])) {
$form->assign('is_pledge_interval', CRM_Utils_Array::value('is_pledge_interval', $pledgeBlock));
$form->addElement('text', 'pledge_frequency_interval', NULL, array('size' => 3));
} else {
$form->add('hidden', 'pledge_frequency_interval', 1);
}
//Frequency unit drop-down label suffixes switch from *ly to *(s)
$freqUnitVals = explode(CRM_Core_DAO::VALUE_SEPARATOR, $pledgeBlock['pledge_frequency_unit']);
$freqUnits = array();
$frequencyUnits = CRM_Core_OptionGroup::values('recur_frequency_units');
foreach ($freqUnitVals as $key => $val) {
if (array_key_exists($val, $frequencyUnits)) {
$freqUnits[$val] = !empty($pledgeBlock['is_pledge_interval']) ? "{$frequencyUnits[$val]}(s)" : $frequencyUnits[$val];
}
}
$form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits);
}
}