本文整理汇总了PHP中ca_users::getPreferenceInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_users::getPreferenceInfo方法的具体用法?PHP ca_users::getPreferenceInfo怎么用?PHP ca_users::getPreferenceInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_users
的用法示例。
在下文中一共展示了ca_users::getPreferenceInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
function form($t_user = "")
{
if ($vs_last_page = $this->request->getParameter("site_last_page", pString)) {
# --- last_page is passed as "Sets" if was trying to add an image to set, "Bookmarks" if user was trying to bookmark an item
$this->request->session->setVar('site_last_page', $vs_last_page);
$this->request->session->setVar('site_last_page_object_id', $this->request->getParameter("object_id", pInteger));
$this->request->session->setVar('site_last_page_row_id', $this->request->getParameter("row_id", pInteger));
$this->request->session->setVar('site_last_page_tablename', $this->request->getParameter("tablename", pString));
}
if (!is_object($t_user)) {
$t_user = new ca_users();
}
$this->view->setVar("fname", $t_user->htmlFormElement("fname", "<div><b>" . _t("First name") . "</b><br/>^ELEMENT</div>"));
$this->view->setVar("lname", $t_user->htmlFormElement("lname", "<div><b>" . _t("Last name") . "</b><br/>^ELEMENT</div>"));
$this->view->setVar("email", $t_user->htmlFormElement("email", "<div><b>" . _t("Email address") . "</b><br/>^ELEMENT</div>"));
$this->view->setVar("password", $t_user->htmlFormElement("password", "<div><b>" . _t("Password") . "</b><br/>^ELEMENT</div>", array('value' => '')));
$va_profile_prefs = $t_user->getValidPreferences('profile');
if (is_array($va_profile_prefs) && sizeof($va_profile_prefs)) {
$va_elements = array();
foreach ($va_profile_prefs as $vs_pref) {
$va_pref_info = $t_user->getPreferenceInfo($vs_pref);
$va_elements[$vs_pref] = array('element' => $t_user->preferenceHtmlFormElement($vs_pref), 'formatted_element' => $t_user->preferenceHtmlFormElement($vs_pref, "<div><b>" . $va_pref_info['label'] . "</b><br/>^ELEMENT</div>"), 'info' => $va_pref_info, 'label' => $va_pref_info['label']);
}
$this->view->setVar("profile_settings", $va_elements);
}
$this->render('LoginReg/loginreg_html.php');
}
示例2: getValidLabelDisplayModes
/**
* Returns list of valid display modes as set in user_pref_defs.conf (via ca_users class)
*
* @return array List of modes
*/
private function getValidLabelDisplayModes()
{
$t_user = new ca_users();
$va_pref_info = $t_user->getPreferenceInfo('cataloguing_display_label_mode');
return array_values($va_pref_info['choiceList']);
}
示例3: DownloadUserReport
public function DownloadUserReport()
{
$vs_download_format = $this->request->getParameter("download_format", pString);
if (!$vs_download_format) {
$vs_download_format = "tab";
}
$this->view->setVar("download_format", $vs_download_format);
switch ($vs_download_format) {
default:
case "tab":
$this->view->setVar("file_extension", "txt");
$this->view->setVar("mimetype", "text/plain");
$vs_delimiter_col = "\t";
$vs_delimiter_row = "\n";
break;
# -----------------------------------
# -----------------------------------
case "csv":
$this->view->setVar("file_extension", "txt");
$this->view->setVar("mimetype", "text/plain");
$vs_delimiter_col = ",";
$vs_delimiter_row = "\n";
break;
# -----------------------------------
}
$o_db = new Db();
$t_user = new ca_users();
$va_fields = array("lname", "fname", "email", "user_name", "userclass", "active", "last_login");
$va_profile_prefs = $t_user->getValidPreferences('profile');
$va_profile_prefs_labels = array();
foreach ($va_profile_prefs as $vs_pref) {
$va_pref_info = $t_user->getPreferenceInfo($vs_pref);
$va_profile_prefs_labels[$vs_pref] = $va_pref_info["label"];
}
$qr_users = $o_db->query("SELECT * FROM ca_users ORDER BY user_id DESC");
if ($qr_users->numRows()) {
$va_rows = array();
# --- headings
$va_row = array();
# --- headings for field values
foreach ($va_fields as $vs_field) {
switch ($vs_field) {
case "last_login":
$va_row[] = _t("Last login");
break;
# --------------------
# --------------------
default:
$va_row[] = $t_user->getDisplayLabel("ca_users." . $vs_field);
break;
# --------------------
}
}
# --- headings for profile prefs
foreach ($va_profile_prefs_labels as $vs_pref => $vs_pref_label) {
$va_row[] = $vs_pref_label;
}
$va_rows[] = join($vs_delimiter_col, $va_row);
reset($va_fields);
reset($va_profile_prefs_labels);
$o_tep = new TimeExpressionParser();
while ($qr_users->nextRow()) {
$va_row = array();
# --- fields
foreach ($va_fields as $vs_field) {
switch ($vs_field) {
case "userclass":
$va_row[] = $t_user->getChoiceListValue($vs_field, $qr_users->get("ca_users." . $vs_field));
break;
# -----------------------
# -----------------------
case "active":
$va_row[] = $qr_users->get("ca_users." . $vs_field) == 1 ? _t("active") : _t("not active");
break;
# -----------------------
# -----------------------
case "last_login":
//if (!is_array($va_vars = $qr_users->getVars('vars'))) { $va_vars = array(); }
if (!is_array($va_vars = $qr_users->getVars('volatile_vars'))) {
$va_vars = array();
}
if ($va_vars['last_login'] > 0) {
$o_tep->setUnixTimestamps($va_vars['last_login'], $va_vars['last_login']);
$va_row[] = $o_tep->getText();
} else {
$va_row[] = "-";
}
break;
# -----------------------
# -----------------------
default:
if ($vs_download_format == "csv") {
$va_row[] = str_replace(",", "-", $qr_users->get("ca_users." . $vs_field));
} else {
$va_row[] = $qr_users->get("ca_users." . $vs_field);
}
break;
# -----------------------
}
}
//.........这里部分代码省略.........
示例4: GetUserProfileInfo
/**
* Return user profile values for specified user
*/
public function GetUserProfileInfo()
{
if (!$this->request->user->canDoAction('can_manage_clients')) {
return null;
}
$pn_user_id = $this->request->getParameter('user_id', pInteger);
$t_user = new ca_users($pn_user_id);
$va_profile_prefs = $t_user->getValidPreferences('profile');
if (is_array($va_profile_prefs) && sizeof($va_profile_prefs)) {
$va_elements = array();
foreach ($va_profile_prefs as $vs_pref) {
$va_pref_info = $t_user->getPreferenceInfo($vs_pref);
$va_elements[str_replace('user_profile_', '', $vs_pref)] = array($t_user->getPreference($vs_pref));
}
$this->view->setVar("profile_values", $va_elements);
}
$this->view->setVar("user_id", $pn_user_id);
$this->render('ajax_user_profile_info_json.php');
}