本文整理汇总了PHP中FieldList::setFieldEntryTable方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::setFieldEntryTable方法的具体用法?PHP FieldList::setFieldEntryTable怎么用?PHP FieldList::setFieldEntryTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::setFieldEntryTable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
function _getSearchUsersBaseQuery($internal_fields, $extra_fields = FALSE, $idst_filter = FALSE)
{
require_once $GLOBALS["where_framework"] . "/lib/lib.field.php";
$field_names = $this->_getTableUserFieldNames();
// "SELECT * FROM ".. is made by the functions that calls this one..
$res = $this->_getTableUser() . " WHERE valid='1' ";
$internal_fields_tot = is_array($internal_fields) ? count($internal_fields) : 0;
if ($internal_fields_tot > 0) {
$res .= "AND (";
}
$i = 1;
foreach ($internal_fields as $field_id => $val) {
if (isset($val["add_before"]) && !empty($val["add_before"])) {
$res .= " " . $val["add_before"];
}
$res .= $field_names[$field_id];
$comp_op = isset($val["comp_op"]) && !empty($val["comp_op"]) ? $val["comp_op"] : "=";
if (!isset($val["like"]) || $val["like"] == "off") {
$res .= $comp_op . "'" . $val["filter"] . "' ";
} else {
if ($val["like"] == "both") {
$res .= " LIKE '%" . $val["filter"] . "%' ";
} else {
if ($val["like"] == "start") {
$res .= " LIKE '%" . $val["filter"] . "' ";
} else {
if ($val["like"] == "end") {
$res .= " LIKE '" . $val["filter"] . "%' ";
}
}
}
}
if (isset($val["add_after"]) && !empty($val["add_after"])) {
$res .= $val["add_after"] . " ";
}
if ($i < $internal_fields_tot) {
if (isset($val["nextop"]) && !empty($val["nextop"])) {
$next_operator = strtoupper($val["nextop"]);
} else {
$next_operator = "AND";
}
$res .= $next_operator . " ";
}
$i++;
}
if ($internal_fields_tot > 0) {
$res .= ") ";
}
if ($extra_fields !== FALSE) {
$fl = new FieldList();
$fl->setFieldEntryTable($GLOBALS['prefix_fw'] . '_field_userentry');
// <- ??!
$fields = $extra_fields["fields"];
$method = $extra_fields["method"];
$like_type = $extra_fields["like"];
$search = $extra_fields["search"];
$found_users = $fl->quickSearchUsersFromEntry($fields, $method, $like_type, $search);
if ($idst_filter !== FALSE) {
$idst_filter = array_intersect($idst_filter, $found_users);
} else {
$idst_filter = $found_users;
}
}
if ($idst_filter !== FALSE) {
$res .= "AND idst IN (" . implode(",", $idst_filter) . ") ";
}
$res .= "ORDER BY userid ";
return $res;
}
示例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: FieldList
/**
* @param string $id_folder folder destination of fields
* @param array $arr_fields an array with fields to attach to folder
* any element of folder is an array:
* key => array( 'fvalue', 'mandatory' )
* - key is the field name in current language
* - fvalue is the value of the field
* - mandatory is TRUE if this field is mandatory
*/
function _add_custom_fields($id_folder, $arr_fields)
{
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$fl = new FieldList();
$fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
$fl->setFieldEntryTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDENTRYTABLE);
$arr_all_fields = $fl->getFlatAllFields(false, false, $this->default_lang);
// remove all fields
foreach ($arr_all_fields as $id_field => $ftranslation) {
$fl->removeFieldFromGroup($id_field, $id_folder);
}
$arr_all_fields_translation = array_flip($arr_all_fields);
$arr_fields_value = array();
// add selected fields
foreach ($arr_fields as $field_translation => $field_data) {
if (isset($arr_all_fields_translation[$field_translation])) {
$field_id = $arr_all_fields_translation[$field_translation];
$fl->addFieldToGroup($field_id, $id_folder, $field_data['mandatory']);
$arr_fields_value[$field_id] = $field_data['fvalue'];
} else {
die("Field non trovato: {$field_translation}");
}
}
$fl->storeDirectFieldsForUser($id_folder, $arr_fields_value, FALSE);
}
示例4: Social
function _opt_in($options, $platform, $opt_link)
{
$social = new Social();
$lang =& DoceboLanguage::createInstance('register', $platform);
// Check for error
$out = '';
$error = $this->_checkField($_POST, $options, $platform, true);
if ($error['error']) {
$this->error = true;
return '<div class="reg_err_data">' . $error['msg'] . '</div>';
}
// Insert temporary
$random_code = md5($_POST['register']['userid'] . mt_rand() . mt_rand() . mt_rand());
// register as temporary user and send mail
$acl_man =& Docebo::user()->getAclManager();
$iduser = $acl_man->registerTempUser($_POST['register']['userid'], $_POST['register']['firstname'], $_POST['register']['lastname'], $_POST['register']['pwd'], $_POST['register']['email'], $random_code);
if ($iduser === false) {
$out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
$this->error = true;
return $out;
}
// facebook register:
if ($social->isActive('facebook')) {
if (isset($_SESSION['fb_info']) && is_array($_SESSION['fb_info'])) {
$social = new Social();
$social->connectAccount('facebook', $_SESSION['fb_info']['id'], $iduser, true);
unset($_SESSION['fb_info']);
}
}
// ----
// add base inscription policy
$enrollrules = new EnrollrulesAlms();
$enrollrules->newRules('_NEW_USER', array($iduser), Lang::get());
// subscribe to groups -----------------------------------------
if (isset($_POST['group_sel_implode'])) {
$groups = explode(',', $_POST['group_sel_implode']);
while (list(, $idst) = each($groups)) {
$acl_man->addToGroup($idst, $iduser);
// FORMA: added the inscription policy
$enrollrules = new EnrollrulesAlms();
$enrollrules->applyRulesMultiLang('_LOG_USERS_TO_GROUP', array((string) $iduser), false, (int) $idst, true);
// END FORMA
}
}
//if the user had enter a code we must check if there are folder related to it and add the folder's field
$registration_code_type = Get::sett('registration_code_type', '0');
$code_is_mandatory = Get::sett('mandatory_code', 'off') == 'on';
$reg_code = Get::req('reg_code', DOTY_MIXED, '');
if ($registration_code_type === 'custom') {
$reg_code = 'change_by_custom_operation';
}
$array_folder = false;
$uma = new UsermanagementAdm();
$reg_code_res = $this->processRegistrationCode($acl_man, $uma, $iduser, $reg_code, $registration_code_type);
if ($reg_code_res['success'] == false) {
$acl_man->deleteTempUser($iduser);
$this->error = true;
return '<div class="reg_err_data">' . $reg_code_res['msg'] . '</div>';
}
// save language selected
require_once _base_ . '/lib/lib.preference.php';
$preference = new UserPreferences($iduser);
$preference->setPreference('ui.language', Lang::get());
// Save fields
$extra_field = new FieldList();
$extra_field->setFieldEntryTable($GLOBALS['prefix_fw'] . '_field_userentry');
$extra_field->storeFieldsForUser($iduser);
// Send mail
$admin_mail = $options['mail_sender'];
// FIX BUG 399
//$link = str_replace('&', '&', $opt_link.( strpos($opt_link, '?') === false ? '?' : '&' ).'random_code='.$random_code);
$link = Get::sett('url', '') . 'index.php?modname=login&op=register_opt&random_code=' . $random_code;
// END FIX BUG 399
$text = $lang->def('_REG_MAIL_TEXT');
$text = str_replace('[userid]', $_POST['register']['userid'], $text);
$text = str_replace('[firstname]', $_POST['register']['firstname'], $text);
$text = str_replace('[lastname]', $_POST['register']['lastname'], $text);
$text = str_replace('[password]', $_POST['register']['pwd'], $text);
$text = str_replace('[link]', '' . $link . '', $text);
$text = str_replace('[hour]', $options['hour_request_limit'], $text);
$text = stripslashes($text);
//check register_type != self (include all previous cases except the new one "self without opt-in")
if (strcmp($options['register_type'], 'self') != 0) {
require_once _base_ . '/lib/lib.mailer.php';
$mailer = DoceboMailer::getInstance();
if (!$mailer->SendMail($admin_mail, $_POST['register']['email'], Lang::t('_MAIL_OBJECT', 'register'), $text, false, array(MAIL_REPLYTO => $admin_mail, MAIL_SENDER_ACLNAME => false))) {
if ($registration_code_type == 'code_module') {
// ok, the registration has failed, let's remove the user association form the code
$code_manager = new CodeManager();
$code_manager->resetUserAssociation($code, $iduser);
}
$acl_man->deleteTempUser($iduser);
$this->error = true;
$out .= '<div class="reg_err_data">' . $lang->def('_OPERATION_FAILURE') . '</div>';
} else {
$out .= '<div class="reg_success">' . $lang->def('_REG_SUCCESS') . '</div>';
}
}
//end
$_GET['random_code'] = $random_code;
//.........这里部分代码省略.........
示例5: loadRenameFolder
function loadRenameFolder()
{
$tdb =& $this->tdb;
$folder = $tdb->getFolderById($this->getSelectedFolderId());
$folder_idst = $tdb->getGroupST($this->getSelectedFolderId());
$acl =& Docebo::user()->getACL();
$aclManager =& $acl->getACLManager();
//$idst_field_group = $aclManager->getGroupST(ORG_CHART_FOLDER_FIELD_GROUP);
require_once _base_ . '/lib/lib.form.php';
$form = new Form();
$tree .= $form->openElementSpace();
$tree .= $this->printState();
$array_lang = Docebo::langManager()->getAllLangCode();
$mand_lang = getLanguage();
$array_translations = $tdb->getFolderTranslations($this->getSelectedFolderId());
if ($this->getSelectedFolderId() == '0') {
// is root
$tree .= $form->getTextfield($this->lang->def('_ROOT_RENAME'), 'rename_folder_root', $this->id . '[rename_folder][root]', 255, Get::sett('title_organigram_chart'), Get::sett('title_organigram_chart') . ' ' . $this->lang->def('MOD'));
} else {
foreach ($array_lang as $k => $lang_code) {
$tree .= $form->getTextfield(($mand_lang == $lang_code ? '<span class="mandatory">*</span>' : '') . $lang_code, 'rename_folder_' . $lang_code, $this->id . '[rename_folder][' . $lang_code . ']', 255, $array_translations[$lang_code], $lang_code . ' ' . $this->lang->def('_MOD'));
}
}
$tree .= $form->closeElementSpace();
// -- begin -- custom fields for folder
$tree .= $form->getOpenFieldset($this->lang->def('_ASSIGNED_EXTRAFIELD'));
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$fields = new FieldList();
$fields->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
$fields->setFieldEntryTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDENTRYTABLE);
$folder_id = $this->getSelectedFolderId();
$folder =& $this->tdb->getFolderById($folder_id);
$ancestor = $this->tdb->getAllParentId($folder, $this->tdb);
array_push($ancestor, $folder_id);
$tree .= $fields->playFieldsForUser($folder_id, $ancestor, FALSE, FALSE);
$tree .= $form->getCloseFieldset();
// -- end -- custom fields for folder
$tree .= $form->openButtonSpace() . $form->getButton('save_renamefolder' . $this->id, $this->id . '[save_renamefolder]', $this->lang->def('_SAVE')) . $form->getButton($this->_getCancelId(), $this->_getCancelId(), $this->lang->def('_UNDO')) . $form->closeButtonSpace();
return $tree;
}
示例6: connect
/**
* execute the connection to source
**/
function connect()
{
$this->lang = DoceboLanguage::createInstance('sap_report');
// perform the query for data retriving
$course_man = new Man_Course();
$this->_query_result = false;
$this->_readed_end = false;
$this->row_index = 0;
// find some information
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$field_man = new FieldList();
$field_man->setFieldEntryTable($GLOBALS['prefix_fw'] . '_field_userentry');
$this->_cid_list = $field_man->getAllFieldEntryData($this->cid_field);
$query_course_user = "\r\n\t\tSELECT cu.idUser, c.idCourse, c.code, cu.date_complete\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_courseuser AS cu \r\n\t\t\tJOIN " . $GLOBALS['prefix_lms'] . "_course AS c\r\n\t\tWHERE cu.idCourse = c.idCourse \r\n\t\t\tAND cu.status = '" . _CUS_END . "' ";
$this->_query_result = sql_query($query_course_user);
if (!$this->_query_result) {
$this->last_error = mysql_error();
return FALSE;
}
return TRUE;
}