本文整理汇总了PHP中FieldList::showFieldForUserArr方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::showFieldForUserArr方法的具体用法?PHP FieldList::showFieldForUserArr怎么用?PHP FieldList::showFieldForUserArr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::showFieldForUserArr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_newsletter
function send_newsletter($send_id)
{
checkPerm('view');
require_once _base_ . '/lib/lib.json.php';
$json = new Services_JSON();
$path = '/appCore/newsletter/';
//access control
$nl_sendpercycle = $GLOBALS["framework"]["nl_sendpercycle"];
//-TP// funAdminAccess('OP');
//@set_time_limit(60*15); // 15 minutes!
$out =& $GLOBALS['page'];
$out->setWorkingZone("content");
$lang =& DoceboLanguage::createInstance('admin_newsletter', 'framework');
$out->add(getTitleArea($lang->def("_NEWSLETTER"), "newsletter"));
$out->add("<div class=\"std_block\">\n");
$info = get_send_info($send_id);
$sel_groups = $info["sel_groups"];
$sel_lang = $info["sel_lang"];
$tot = $info["tot"];
$sub = $info["sub"];
$msg = $info["msg"];
$msg = str_replace("{site_base_url}", getSiteBaseUrl(), $msg);
$fromemail = $info["fromemail"];
$file_array = $json->decode($info['file']);
$attach = array();
foreach ($file_array as $file) {
$attach[] = '../files' . $path . $file;
}
$cycle = (int) $_GET["cycle"];
// Items per cycle
$ipc = $nl_sendpercycle;
if (($cycle + 1) * $ipc < $tot) {
$sendcomplete = 0;
} else {
$sendcomplete = 1;
}
$limit = $cycle * $ipc . ", " . $ipc;
$arr_st = getSendToIdst($send_id, $limit);
$acl_manager = Docebo::user()->getAclManager();
if (!empty($sel_lang) && $sel_lang != _ANY_LANG_CODE) {
$user_info = $acl_manager->getUsersByLanguage($sel_lang, $arr_st);
} else {
// Send to all languages
$user_info = $acl_manager->getUsers($arr_st);
}
$send_type = $info["send_type"];
switch ($send_type) {
case "email":
$tempemail = array();
foreach ($user_info as $info) {
// collect recipients email addresses: ------------------------------
$email = $info[ACL_INFO_EMAIL];
if ($email != "") {
$tempemail[] = $email;
}
// ----------------------------------------------
}
//send all mails
require_once _base_ . '/lib/lib.mailer.php';
$mailer = DoceboMailer::getInstance();
if (count($attach)) {
$mailer->SendMail($fromemail, $tempemail, $sub, $msg, $attach, array(MAIL_REPLYTO => $fromemail, MAIL_SENDER_ACLNAME => false));
} else {
$mailer->SendMail($fromemail, $tempemail, $sub, $msg, false, array(MAIL_REPLYTO => $fromemail, MAIL_SENDER_ACLNAME => false));
}
break;
case "sms":
// Collect users sms numbers
require_once $GLOBALS["where_framework"] . "/lib/lib.field.php";
$acl_man =& Docebo::user()->getACLManager();
$field_man = new FieldList();
$arr_sms_recipients = array();
$send_to_field = Get::sett('sms_cell_num_field');
$users_sms = $field_man->showFieldForUserArr($arr_st, array($send_to_field));
$users_info = $acl_man->getUsers($arr_st);
while (list(, $user_dett) = each($users_info)) {
// recover media setting
$idst_user = $user_dett[ACL_INFO_IDST];
if ($users_sms[$idst_user][$send_to_field] != '') {
$arr_sms_recipients[$idst_user] = $users_sms[$idst_user][$send_to_field];
}
}
require_once $GLOBALS["where_framework"] . "/lib/lib.sms.php";
$sms_manager = new SmsManager();
$sms_manager->sendSms($msg, $arr_sms_recipients);
break;
}
if ($sendcomplete) {
require_once _base_ . '/lib/lib.upload.php';
if (count($attach)) {
foreach ($attach as $file) {
sl_open_fileoperations();
sl_unlink(str_replace('../files', '', $file));
sl_close_fileoperations();
}
}
$url = "index.php?modname=public_newsletter_admin&op=complete";
Util::jump_to($url);
} else {
$url = "index.php?modname=public_newsletter_admin&op=pause&ipc=" . $ipc . "&cycle=" . ($cycle + 1) . "&id_send=" . $send_id;
//.........这里部分代码省略.........
示例2: getMappedFields
function getMappedFields($field_list, $id)
{
$res = array();
$debug = FALSE;
require_once $GLOBALS["where_framework"] . "/lib/lib.field.php";
$fl = new FieldList();
$field_map_info = $this->getFieldMap();
$field_map = $field_map_info["map"];
$map_custom_fields = $field_map_info["custom_fields"];
if ($debug) {
echo "<pre>\n";
print_r($field_map_info);
}
//--DEBUG--//
unset($field_map_info);
$fl->setFieldEntryTable($this->_getMapFromTable());
$user_field_arr = $fl->showFieldForUserArr(array($id), $field_list);
// to cache: arr[id]=res
if ($debug) {
print_r($user_field_arr);
}
//--DEBUG--//
if (is_array($user_field_arr[$id])) {
$field_val = $user_field_arr[$id];
} else {
$field_val = array();
}
// This way we are going to load only the information
// about the fields we really need.
$field_list = $field_list + $map_custom_fields;
if ($debug) {
print_r($field_list);
}
//--DEBUG--//
$field_info = $fl->getFieldsFromArray($field_list);
// to cache? maybe one for all
if ($debug) {
print_r($field_info);
}
//--DEBUG--//
// $mro: Map Resource Object (array)
// We'll use this later to read predefined fields names
$mro = array();
foreach ($this->getResourceList("list") as $code => $resource) {
require_once $resource["class_path"] . $resource["class_file"];
$mro[$code] = new $resource["class_name"]();
}
// Creating empty schema that will contain useful information
// like field description..
foreach ($mro as $resource => $resource_obj) {
foreach ($resource_obj->getRawPredefinedFields() as $code) {
$res[$resource]["predefined"][$code]["description"] = $resource_obj->getPredefinedFieldLabel($code);
$res[$resource]["predefined"][$code]["value"] = "";
}
}
foreach ($field_info as $field_id => $info) {
if (isset($field_map[$field_id])) {
$type = $field_map[$field_id]["type"];
$resource = $field_map[$field_id]["resource"];
$new_id = $field_map[$field_id]["map_to"];
if ($type == "custom") {
$res[$resource][$type][$new_id]["description"] = $field_info[$new_id][FIELD_INFO_TRANSLATION];
}
$res[$resource][$type][$new_id]["value"] = $field_val[$field_id];
} else {
if (!isset($field_map[$field_id]) && !in_array($field_id, $map_custom_fields)) {
$resource = "_not_mapped";
$type = "custom";
$res[$resource][$type][$field_id]["description"] = $field_info[$field_id][FIELD_INFO_TRANSLATION];
$res[$resource][$type][$field_id]["value"] = $field_val[$field_id];
if ($debug && empty($field_val[$field_id])) {
echo $field_id . " :: ";
}
}
}
}
if ($debug) {
print_r($res);
echo "\n</pre>\n";
}
//--DEBUG--//
return $res;
}
示例3: actionEvent
function actionEvent(&$event)
{
parent::actionEvent($event);
// initializing
require_once _adm_ . '/lib/lib.field.php';
$acl_man =& Docebo::user()->getACLManager();
$field_man = new FieldList();
$send_to_field = Get::sett('sms_cell_num_field');
$arr_mail_recipients = array();
$arr_sms_recipients = array();
// recover event information
$arr_recipients = explode(',', $event->getProperty('recipientid'));
$msg_composer = unserialize(urldecode($event->getProperty('MessageComposer')));
$msg_composer->after_unserialize();
$force_email_send = $event->getProperty('force_email_send');
if (!is_array($arr_recipients) || empty($arr_recipients)) {
return;
}
// recover user info and convert to idst if required
if (is_numeric($arr_recipients[0])) {
$idst_users =& $arr_recipients;
} else {
$idst_users = $acl_man->fromUseridToIdst($arr_recipients);
}
$users_info =& $acl_man->getUsers($idst_users);
// recove setting
$users_lang = $acl_man->getSettingValueOfUsers('ui.language', false, true);
$users_sms = $field_man->showFieldForUserArr($idst_users, array($send_to_field));
// scan all users
if (!is_array($users_info) || empty($users_info)) {
return;
}
while (list(, $user_dett) = each($users_info)) {
if ($user_dett[ACL_INFO_VALID] == '1') {
// recover media setting
$idst_user = $user_dett[ACL_INFO_IDST];
$media = usernotifier_getUserEventChannel($idst_user, $event->getClassName());
$lang = isset($users_lang[$idst_user]) && $users_lang[$idst_user] !== NULL ? $users_lang[$idst_user] : getDefaultLanguage();
if (in_array('email', $media) || $force_email_send == 'true') {
if ($user_dett[ACL_INFO_EMAIL] != '') {
$arr_mail_recipients[$lang][$idst_user] = $user_dett[ACL_INFO_EMAIL];
}
}
if (in_array('sms', $media)) {
if ($users_sms[$idst_user][$send_to_field] != '') {
$arr_sms_recipients[$lang][$idst_user] = $users_sms[$idst_user][$send_to_field];
}
}
}
}
if (!empty($arr_mail_recipients)) {
$lang_mail = array_keys($arr_mail_recipients);
foreach ($lang_mail as $lang_code) {
reset($arr_mail_recipients[$lang_code]);
$this->_sendMail($msg_composer->getSubject('email', $lang_code), $msg_composer->getBody('email', $lang_code), $arr_mail_recipients[$lang_code], $users_info);
}
}
if (!empty($arr_sms_recipients)) {
$lang_sms = array_keys($arr_sms_recipients);
foreach ($lang_sms as $lang_code) {
reset($arr_sms_recipients[$lang_sms]);
$this->_sendSms($msg_composer->getBody('sms', $lang_code), $arr_sms_recipients[$lang_code], $users_info);
}
}
return true;
}