本文整理汇总了PHP中FieldList::getFieldInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::getFieldInstance方法的具体用法?PHP FieldList::getFieldInstance怎么用?PHP FieldList::getFieldInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::getFieldInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveFields
/**
* @param array $predefined_data
* @param array $custom_data
* @param integer $id user id; if 0 a new user will be created
* @param boolean $dropdown_id if true will take dropdown values as id;
* else will search the id starting from the value.
*/
function saveFields($predefined_data, $custom_data, $id = 0, $dropdown_id = TRUE)
{
require_once $GLOBALS["where_crm"] . "/modules/company/lib.company.php";
// TODO: at this moment the function works only for user creation;
// does not update the user if it already exists
$acl =& Docebo::user()->getACL();
$acl_manager =& Docebo::user()->getAclManager();
$data = array();
$userid = $predefined_data["userid"];
$firstname = $predefined_data["firstname"];
$lastname = $predefined_data["lastname"];
$pass = $predefined_data["pass"];
$email = $predefined_data["email"];
if (!empty($userid)) {
$idst = $acl_manager->registerUser($userid, $firstname, $lastname, $pass, $email, '', '');
} else {
$idst = FALSE;
}
if ($idst !== false) {
// -- Add user to registered users group if not importing into root ---
$idst_oc = $acl_manager->getGroup(false, '/oc_0');
$idst_oc = $idst_oc[ACL_INFO_IDST];
$idst_ocd = $acl_manager->getGroup(false, '/ocd_0');
$idst_ocd = $idst_ocd[ACL_INFO_IDST];
$acl_manager->addToGroup($idst_oc, $idst);
$acl_manager->addToGroup($idst_ocd, $idst);
// -------------------------------------------------------------------|
// add to group level
$userlevel = $acl_manager->getGroupST(ADMIN_GROUP_USER);
$acl_manager->addToGroup($userlevel, $idst);
// -- Custom fields ----------------------------------------------------
require_once $GLOBALS["where_framework"] . "/lib/lib.field.php";
$res = array();
$fl = new FieldList();
$custom_fields = array_keys($this->getCustomFields(FALSE));
$field_info_arr = $fl->getFieldsFromIdst($custom_fields);
foreach ($custom_fields as $field_id) {
// store direct
if (isset($custom_data[$field_id])) {
$field_obj =& $fl->getFieldInstance($field_id);
// $field_obj->setFieldEntryTable($company_entry_table);
$field_obj->storeDirect($idst, $custom_data[$field_id], $dropdown_id, FALSE, TRUE);
}
}
}
return $idst;
}
示例2: FieldList
function _maskTemplateManager()
{
require_once _base_ . '/lib/lib.form.php';
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
require_once _base_ . '/lib/lib.table.php';
$lang =& DoceboLanguage::createInstance('configuration', 'framework');
$field_man = new FieldList();
$html = '';
if (isset($_POST['save_and_refresh'])) {
if (!sql_query("\r\n\t\t\tUPDATE " . $this->table . "\r\n\t\t\tSET param_value = '" . $_POST['templ_use_field'] . "'\r\n\t\t\tWHERE pack = 'main' AND param_name = 'templ_use_field'")) {
$html .= getErrorUi('_ERROR_WHILE_SAVING_NEW_FIELD');
} else {
setTemplate($_POST['templ_use_field']);
}
}
$drop_field = array();
$drop_field = $field_man->getFlatAllFields(false, 'dropdown');
$drop_field[0] = $lang->def('_NO');
$html .= Form::getDropdown($lang->def('_TEMPL_USE_FIELD'), 'templ_use_field', 'templ_use_field', $drop_field, Get::sett('templ_use_field'));
$html .= Form::getButton('save_and_refresh', 'save_and_refresh', $lang->def('_SAVE_AND_REFRESH'));
if (Get::sett('templ_use_field') != 0) {
$field_obj =& $field_man->getFieldInstance(Get::sett('templ_use_field'));
if ($field_obj === NULL) {
return $html . getErrorUi('_ERROR_WITH_THIS_FIELD');
}
$assignement = array();
$query_template_assigned = "\r\n\t\t\tSELECT ref_id, template_code\r\n\t\t\tFROM " . $GLOBALS['prefix_fw'] . "_field_template\r\n\t\t\tWHERE id_common = '" . Get::sett('templ_use_field') . "'";
$re_templ_assigned = sql_query($query_template_assigned);
while (list($ref_id, $template_code) = sql_fetch_row($re_templ_assigned)) {
$assignement[$ref_id] = $template_code;
}
$son_value = $field_obj->getAllSon();
$template_list = getTemplateList(true);
$default_template = getDefaultTemplate();
$tb_son = new Table(0, $lang->def('_ASSIGN_DROPDOWN_VALUE_TEMPLATE'), $lang->def('_ASSIGN_DROPDOWN_VALUE_TEMPLATE_SUMMARY'));
$cont_h = array($lang->def('_VALUE'), $lang->def('_TEMPLATE_VALUE'));
$type_h = array('', '');
$tb_son->setColsStyle($type_h);
$tb_son->addHead($cont_h);
while (list($id_son, $drop_son_name) = each($son_value)) {
$cont = array('<label for="template_selected_' . $id_son . '">' . $drop_son_name . '</label>', Form::getInputDropdown('dropdown', 'template_selected_' . $id_son, 'template_selected[' . $id_son . ']', $template_list, isset($assignement[$id_son]) && isset($template_list[$assignement[$id_son]]) ? $assignement[$id_son] : $default_template, ''));
$tb_son->addBody($cont);
}
$html .= $tb_son->getTable();
}
return $html;
}
示例3: getUserContactNoRestriction
/**
* retrive the value of the extra field for the user that is classiied as contact without checking the access list
*/
function getUserContactNoRestriction($id_user)
{
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
$field_man = new FieldList();
$field_founded = $field_man->getFieldsAndValueFromUser($id_user, false, false, array('contact'));
$field = array();
foreach ($field_founded as $id => $arr_value) {
$ob =& $field_man->getFieldInstance($id, $arr_value[5], $arr_value[6]);
$field[$id] = array('name' => $arr_value[0], 'value' => $arr_value[1], 'href' => $ob->getIMBrowserHref($id_user, $arr_value[1]), 'image' => $ob->getIMBrowserImageSrc($id_user, $arr_value[1]), 'head' => $ob->getIMBrowserHead($id_user, $arr_value[1]), 'field_type' => $arr_value[4]);
}
return $field;
}
示例4: getUsers
//.........这里部分代码省略.........
break;
//<
//<
case 1:
$temp .= " <= '" . $date . " 23:59:59' ";
break;
//<=
//<=
case 2:
$temp = " ( register_date >= '" . $date . " 00:00:00' AND register_date <= '" . $date . " 23:59:59' ) ";
break;
//=
//=
case 3:
$temp .= " >= '" . $date . " 00:00:00' ";
break;
//>=
//>=
case 4:
$temp .= " > '" . $date . " 23:59:59' ";
break;
//>
//>
default:
$temp .= " NOT LIKE '%' ";
//unexistent
}
$std_condition[] = $temp;
break;
case 5:
//lastenter
$date = substr(Format::dateDb($params['value'], 'date'), 0, 10);
$temp = " lastenter ";
switch ($params['cond']) {
case 0:
$temp .= " < '" . $date . " 00:00:00' ";
break;
//<
//<
case 1:
$temp .= " <= '" . $date . " 23:59:59' ";
break;
//<=
//<=
case 2:
$temp = " ( lastenter >= '" . $date . " 00:00:00' AND lastenter <= '" . $date . " 23:59:59' ) ";
break;
//=
//=
case 3:
$temp .= " >= '" . $date . " 00:00:00' ";
break;
//>=
//>=
case 4:
$temp .= " > '" . $date . " 23:59:59' ";
break;
//>
//>
default:
$temp .= " NOT LIKE '%' ";
//unexistent
}
$std_condition[] = $temp;
break;
default:
}
break;
// filter on a custom field
// filter on a custom field
case _CUSTOM_FIELDS_PREFIX:
$fobj = $fman->getFieldInstance($id);
$in_conditions[] = $fobj->getFieldQuery($params);
break;
// other special field
// other special field
case _OTHER_FIELDS_PREFIX:
$ofobj = new OtherFieldsTypes();
$other_conditions[] = $ofobj->getFieldQuery($id, $params);
break;
default:
}
//end switch
}
//end foreach
if ($exclusive) {
$query = $base_query . ' WHERE 1 ' . (!empty($std_condition) ? " AND " . implode(" AND ", $std_condition) : '') . (!empty($in_conditions) ? ' AND idst IN ( ' . implode(" ) AND idst IN ( ", $in_conditions) . ' ) ' : '') . (!empty($other_conditions) ? ' AND idst IN ( ' . implode(" ) AND idst IN ( ", $other_conditions) . ' ) ' : '');
} else {
$query = $base_query . ' WHERE 0 ' . (!empty($std_condition) ? ' OR ( ' . implode(" ) OR idst IN ( ", $std_condition) . ' ) ' : '') . (!empty($in_conditions) ? ' OR idst IN ( ' . implode(" ) OR idst IN ( ", $in_conditions) . ' ) ' : '') . (!empty($other_conditions) ? ' OR idst IN ( ' . implode(" ) OR idst IN ( ", $other_conditions) . ' ) ' : '');
}
//produce output
$output = array();
$re = $this->db->query($query);
while ($rw = $this->db->fetch_assoc($re)) {
if ($rw['userid'] != '/Anonymous') {
$output[] = $rw['idst'];
}
}
return $output;
}