本文整理汇总了PHP中ca_users::getDisplayLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_users::getDisplayLabel方法的具体用法?PHP ca_users::getDisplayLabel怎么用?PHP ca_users::getDisplayLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_users
的用法示例。
在下文中一共展示了ca_users::getDisplayLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
# -----------------------
}
}
//.........这里部分代码省略.........