本文整理汇总了PHP中CB\User::setUserConfigParam方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setUserConfigParam方法的具体用法?PHP User::setUserConfigParam怎么用?PHP User::setUserConfigParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CB\User
的用法示例。
在下文中一共展示了User::setUserConfigParam方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateLastSeenActionId
/**
* update last seen laction id
* @return json response
* @param int $actionId
*/
public static function updateLastSeenActionId($actionId, $userId = false)
{
$rez = array('success' => false);
if ($userId == false) {
$userId = User::getId();
}
if (is_numeric($actionId)) {
User::setUserConfigParam('lastSeenActionId', $actionId, $userId);
DM\Notifications::markAsSeenUpToActionId($actionId, $userId);
$rez = array('success' => true);
}
return $rez;
}
示例2: set
/**
* set state
* @param array $p
*/
public function set($p)
{
if (User::isLoged()) {
$rez = array('success' => true);
$state = User::getUserConfigParam('state', array());
if (!empty($p['value']) || isset($state[$p['name']])) {
if (empty($p['value'])) {
unset($state[$p['name']]);
} else {
$state[$p['name']] = $p['value'];
}
User::setUserConfigParam('state', $state);
}
} else {
$rez = array('success' => false);
}
return $rez;
}
示例3: sendUserMails
function sendUserMails($u)
{
$uid = $u['id'];
if (empty($u['email'])) {
return;
}
$sendType = User::canSendNotifications($uid);
if ($sendType == false) {
return;
}
$coreName = Config::get('core_name');
// $coreUrl = Config::get('core_url');
$languages = Config::get('languages');
$lang = $languages[$u['language_id'] - 1];
if (filter_var($u['email'], FILTER_VALIDATE_EMAIL)) {
//group mails into digest and separate ones (where user is mentioned)
$mails = array('digest' => array(), 'separate' => array());
foreach ($u['mails'] as $notificationId => $notification) {
//[$core #$nodeId] $action_type $template_name: $object_title
$templateId = Objects::getTemplateId($notification['object_id']);
$templateName = Objects::getName($templateId);
$subject = '[' . $coreName . ' #' . $notification['object_id'] . '] ' . Notifications::getActionDeclination($notification['action_type'], $lang) . ' ' . $templateName . ' "' . htmlspecialchars_decode($notification['data']['name']) . '"';
$sender = Notifications::getSender($notification['from_user_id']);
//divide notification into separate number of actions it consist of
$actions = getNotificationActions($notification);
for ($i = 0; $i < sizeof($actions); $i++) {
$a = $actions[$i];
$message = Notifications::getMailBodyForAction($a, $u);
$isMentioned = !empty($a['data']['mentioned']) && in_array($uid, $a['data']['mentioned']);
$mails[$isMentioned ? 'separate' : 'digest'][] = array('subject' => $subject, 'body' => $message, 'sender' => $sender, 'nId' => $notificationId);
}
}
//merge digest emails group into one email and put it into separate group
if (sizeof($mails['digest']) == 1) {
$mails['separate'][] = $mails['digest'][0];
} elseif (!empty($mails['digest'])) {
$mail = array();
$ids = array();
$sender = '';
foreach ($mails['digest'] as $m) {
$mail[] = $m['body'];
$sender = $m['sender'];
$ids[] = $m['nId'];
}
$mails['separate'][] = array('subject' => '[' . $coreName . '] Notifications digest', 'body' => implode('<hr />', $mail), 'sender' => $sender, 'nId' => $ids);
}
foreach ($mails['separate'] as $mail) {
echo $u['email'] . ': ' . $mail['subject'] . "\n";
if (!mail($u['email'], $mail['subject'], $mail['body'], "Content-type: text/html; charset=utf-8\r\nFrom: " . $mail['sender'] . "\r\n")) {
System::notifyAdmin('CaseBox cron notification: Cant send notification (' . $mail['nId'] . ') mail to "' . $u['email'] . '"', $mail['body']);
} else {
DM\Notifications::markAsSeen($mail['nId'], $uid);
}
}
if (!empty($mails['digest'])) {
User::setUserConfigParam('lastNotifyTime', Util\dateISOToMysql('now'), $uid);
}
}
}