本文整理汇总了PHP中XoopsUser::rank方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsUser::rank方法的具体用法?PHP XoopsUser::rank怎么用?PHP XoopsUser::rank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsUser
的用法示例。
在下文中一共展示了XoopsUser::rank方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sanitize
$modified = sanitize(date("d-m-Y H:i:s", $row['com_modified']));
$userid = sanitize($row['com_uid']);
$ip = sanitize($row['com_ip']);
$title = sanitize($row['com_title']);
$text = sanitize($row['com_text']);
$signature = sanitize($row['com_sig']);
$status = sanitize($row['com_status']);
$params = sanitize($row['com_exparams']);
$dohtml = sanitize($row['dohtml']);
$dosmiley = sanitize($row['dosmiley']);
$xcode = sanitize($row['doxcode']);
$doimage = sanitize($row['doimage']);
$linebreak = sanitize($row['dobr']);
$user = new XoopsUser($row['com_uid']);
$avatar = $user->user_avatar($row['com_uid']);
$rank = $user->rank($row['com_uid']);
$rank_title = $rank['title'];
$rank_image = XOOPS_UPLOAD_URL . "/" . $rank['image'];
$regdate = date("d-m-Y", $user->user_regdate($row['com_uid']));
$userLocation = $user->user_from($row['com_uid']);
$numposts = $user->getVar("posts");
$checkstatus = $user->isOnline();
if ($checkstatus > 0) {
$status = "Online";
} else {
$status = "Offline";
}
if ($icon = '') {
$comment_image = '';
} else {
$comment_image = '<img src="' . XOOPS_UPLOAD_URL . "/" . $icon . '" alt=""></img>';
示例2: foreach
$box_actions[] = "<input type='hidden' name='catbox' value='" . $catbox . "'>";
// $box_actions[] = "<input type='hidden' name='after' value='".$after."'>";
$box_actions[] = "<input type='hidden' name='limit_msg' value='" . $limit_msg . "'>";
$box_actions[] = "<input type='hidden' name='sortname' value='" . $sortname . "'>";
$box_actions[] = "<input type='hidden' name='sortorder' value='" . $sortorder . "'>";
$xoopsTpl->assign('box_actions', $box_actions);
$xoopsTpl->assign('mp_amount', $amount);
if ($amount == 0) {
$xoopsTpl->assign('lang_none', _MP_YOUDONTCONTACT);
}
$i = $start + 0;
foreach (array_keys($pm_cont) as $i) {
$poster = new XoopsUser($pm_cont[$i]->getVar('ct_contact'));
$mp['msg_id'] = $pm_cont[$i]->getVar('ct_contact');
$postername = $poster->getVar('uname') . "<br />" . $poster->getVar('name');
$userrank =& $poster->rank();
/* No need to show deleted users */
if ($postername) {
$mp['msg_poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $pm_cont[$i]->getVar('ct_contact') . "'>" . $postername . "</a>";
} else {
$mp['msg_poster'] = $xoopsConfig['anonymous'];
}
$mp['msg_joindate'] = formatTimestamp($poster->getVar("user_regdate"));
/* Online poster */
if ($poster->isOnline()) {
$mp['msg_online'] = '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/online.png" title="' . _MP_ONLINE . '" style="width: 20px; height: 20px;"/>';
} else {
$mp['msg_online'] = '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/offline.png" title="' . _MP_OFFLINE . '" style="width: 20px; height: 20px;"/>';
}
/**/
$mp['msg_last'] = formatTimestamp($poster->getVar("last_login"));
示例3: xhnewbb_show_tree
function xhnewbb_show_tree(&$arr, $current = 0, $key = 0, $prefix = '', $foundusers = array())
{
global $xoopsConfig;
if ($key != 0) {
if (0 != $arr[$key]['obj']->uid()) {
if (!isset($foundusers[$arr[$key]['obj']->uid()])) {
$eachposter = new XoopsUser($arr[$key]['obj']->uid());
$foundusers[$arr[$key]['obj']->uid()] =& $eachposter;
} else {
$eachposter =& $foundusers[$arr[$key]['obj']->uid()];
}
$poster_rank = $eachposter->rank();
if (!empty($poster_rank['image'])) {
$poster_rank['image'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $poster_rank['image'] . '" alt="" />';
}
if ($eachposter->isActive()) {
$posterarr = array('poster_uid' => $eachposter->getVar('uid'), 'poster_uname' => '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $eachposter->getVar('uid') . '">' . $eachposter->getVar('uname') . '</a>');
} else {
$posterarr = array('poster_uid' => 0, 'poster_uname' => $xoopsConfig['anonymous']);
}
} else {
$posterarr = array('poster_uid' => 0, 'poster_uname' => $xoopsConfig['anonymous']);
}
$posticon = $arr[$key]['obj']->icon();
if (isset($posticon) && $posticon != '') {
$post_image = '<img src="' . XOOPS_URL . '/modules/xhnewbb/images/' . $posticon . '" alt="" />';
} else {
$post_image = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />';
}
if ($current != $key) {
$subject = '<a href="viewtopic.php?topic_id=' . $arr[$key]['obj']->topic() . '&post_id=' . $arr[$key]['obj']->postid() . '&viewmode=thread#forumpost' . $arr[$key]['obj']->postid() . '">' . $arr[$key]['obj']->subject() . '</a>';
$GLOBALS['xoopsTpl']->append("topic_trees", array_merge($posterarr, array("post_id" => $arr[$key]['obj']->postid(), "post_parent_id" => $arr[$key]['obj']->parent(), "post_date" => formatTimestamp($arr[$key]['obj']->posttime(), "m"), "post_image" => $post_image, "post_title" => $subject, "post_prefix" => $prefix)));
} else {
$subject = '<b>' . $arr[$key]['obj']->subject() . '</b>';
$thisprefix = substr($prefix, 0, -6) . "<b>»</b>";
$GLOBALS['xoopsTpl']->append("topic_trees", array_merge($posterarr, array("post_id" => $arr[$key]['obj']->postid(), "post_parent_id" => $arr[$key]['obj']->parent(), "post_date" => formatTimestamp($arr[$key]['obj']->posttime(), "m"), "post_image" => $post_image, "post_title" => $subject, "post_prefix" => $thisprefix)));
}
}
if (isset($arr[$key]['replies']) && !empty($arr[$key]['replies'])) {
$prefix .= " ";
foreach ($arr[$key]['replies'] as $replykey) {
$current = $current == 0 ? $replykey : $current;
xhnewbb_show_tree($arr, $current, $replykey, $prefix, $foundusers);
}
}
}
示例4: getOutputValue
/**
* Returns a value for output of this field
*
* @param XoopsUser $user {@link XoopsUser} object to get the value of
* @param profileProfile $profile object to get the value of
*
* @return mixed
**/
function getOutputValue(&$user, $profile)
{
if (file_exists($file = $GLOBALS['xoops']->path('modules/profile/language/' . $GLOBALS['xoopsConfig']['language'] . '/modinfo.php'))) {
include_once $file;
} else {
include_once $GLOBALS['xoops']->path('modules/profile/language/english/modinfo.php');
}
$value = in_array($this->getVar('field_name'), $this->getUserVars()) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
switch ($this->getVar('field_type')) {
default:
case "textbox":
if ($this->getVar('field_name') == 'url' && $value != '') {
return '<a href="' . formatURL($value) . '" rel="external">' . $value . '</a>';
} else {
return $value;
}
break;
case "textarea":
case "dhtml":
case 'theme':
case "language":
case "list":
return $value;
break;
case "select":
case "radio":
$options = $this->getVar('field_options');
if (isset($options[$value])) {
$value = htmlspecialchars(defined($options[$value]) ? constant($options[$value]) : $options[$value]);
} else {
$value = "";
}
return $value;
break;
case "select_multi":
case "checkbox":
$options = $this->getVar('field_options');
$ret = array();
if (count($options) > 0) {
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars(defined($options[$key]) ? constant($options[$key]) : $options[$key]);
}
}
}
return $ret;
break;
case "group":
$member_handler =& xoops_gethandler('member');
$options = $member_handler->getGroupList();
$ret = isset($options[$value]) ? $options[$value] : '';
return $ret;
break;
case "group_multi":
$member_handler =& xoops_gethandler('member');
$options = $member_handler->getGroupList();
$ret = array();
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars($options[$key]);
}
}
return $ret;
break;
case "longdate":
//return YYYY/MM/DD format - not optimal as it is not using local date format, but how do we do that
//when we cannot convert it to a UNIX timestamp?
return str_replace("-", "/", $value);
case "date":
return formatTimestamp($value, 's');
break;
case "datetime":
if (!empty($value)) {
return formatTimestamp($value, 'm');
} else {
return $value = _PROFILE_MI_NEVER_LOGGED_IN;
}
break;
case "autotext":
$value = $user->getVar($this->getVar('field_name'), 'n');
//autotext can have HTML in it
$value = str_replace("{X_UID}", $user->getVar("uid"), $value);
$value = str_replace("{X_URL}", XOOPS_URL, $value);
$value = str_replace("{X_UNAME}", $user->getVar("uname"), $value);
return $value;
break;
case "rank":
$userrank = $user->rank();
$user_rankimage = "";
if (isset($userrank['image']) && $userrank['image'] != "") {
$user_rankimage = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="' . $userrank['title'] . '" /><br />';
}
//.........这里部分代码省略.........
示例5: __construct
/**
* __construct
*
* @param XoopsUser|XoopsObject &$obj user object
*/
public function __construct(XoopsUser &$obj)
{
$xoops = Xoops::getInstance();
if ($obj->isNew()) {
//Add user
$uid_value = "";
$uname_value = "";
$name_value = "";
$email_value = "";
$email_cbox_value = 0;
$url_value = "";
$timezone_value = $xoops->getConfig('default_TZ');
$icq_value = "";
$aim_value = "";
$yim_value = "";
$msnm_value = "";
$location_value = "";
$occ_value = "";
$interest_value = "";
$sig_value = "";
$sig_cbox_value = 0;
$bio_value = "";
$rank_value = 0;
$mailok_value = 0;
$form_title = SystemLocale::ADD_USER;
$form_isedit = false;
$groups = array(FixedGroups::USERS);
} else {
//Edit user
$uid_value = $obj->getVar("uid", "E");
$uname_value = $obj->getVar("uname", "E");
$name_value = $obj->getVar("name", "E");
$email_value = $obj->getVar("email", "E");
$email_cbox_value = $obj->getVar("user_viewemail") ? 1 : 0;
$url_value = $obj->getVar("url", "E");
$timezone_value = $obj->getVar("timezone_offset");
$icq_value = $obj->getVar("user_icq", "E");
$aim_value = $obj->getVar("user_aim", "E");
$yim_value = $obj->getVar("user_yim", "E");
$msnm_value = $obj->getVar("user_msnm", "E");
$location_value = $obj->getVar("user_from", "E");
$occ_value = $obj->getVar("user_occ", "E");
$interest_value = $obj->getVar("user_intrest", "E");
$sig_value = $obj->getVar("user_sig", "E");
$sig_cbox_value = $obj->getVar("attachsig") == 1 ? 1 : 0;
$bio_value = $obj->getVar("bio", "E");
$rank_value = $obj->rank(false);
$mailok_value = $obj->getVar('user_mailok', 'E');
$form_title = sprintf(SystemLocale::F_UPDATE_USER, $obj->getVar("uname"));
$form_isedit = true;
$groups = array_values($obj->getGroups());
}
//Affichage du formulaire
parent::__construct($form_title, "form_user", "admin.php", "post", true);
$this->addElement(new Xoops\Form\Text(XoopsLocale::USER_NAME, "username", 4, 25, $uname_value), true);
$this->addElement(new Xoops\Form\Text(XoopsLocale::NAME, "name", 5, 60, $name_value));
$email_tray = new Xoops\Form\ElementTray(XoopsLocale::EMAIL, "<br />");
$email_text = new Xoops\Form\Text("", "email", 5, 60, $email_value);
$email_tray->addElement($email_text, true);
$email_cbox = new Xoops\Form\Checkbox("", "user_viewemail", $email_cbox_value);
$email_cbox->addOption(1, XoopsLocale::ALLOW_OTHER_USERS_TO_VIEW_EMAIL);
$email_tray->addElement($email_cbox);
$this->addElement($email_tray, true);
$this->addElement(new Xoops\Form\Text(XoopsLocale::WEB_URL, "url", 5, 100, $url_value));
$this->addElement(new Xoops\Form\SelectTimeZone(XoopsLocale::TIME_ZONE, "timezone_offset", $timezone_value));
$this->addElement(new Xoops\Form\Text(XoopsLocale::ICQ, "user_icq", 3, 15, $icq_value));
$this->addElement(new Xoops\Form\Text(XoopsLocale::AIM, "user_aim", 3, 18, $aim_value));
$this->addElement(new Xoops\Form\Text(XoopsLocale::YIM, "user_yim", 3, 25, $yim_value));
$this->addElement(new Xoops\Form\Text(XoopsLocale::MSNM, "user_msnm", 3, 100, $msnm_value));
$this->addElement(new Xoops\Form\Text(XoopsLocale::LOCATION, "user_from", 5, 100, $location_value));
$this->addElement(new Xoops\Form\Text(XoopsLocale::OCCUPATION, "user_occ", 5, 100, $occ_value));
$this->addElement(new Xoops\Form\Text(XoopsLocale::INTEREST, "user_intrest", 5, 150, $interest_value));
$sig_tray = new Xoops\Form\ElementTray(XoopsLocale::SIGNATURE, "<br />");
$sig_tarea = new Xoops\Form\TextArea("", "user_sig", $sig_value, 5, 5);
$sig_tray->addElement($sig_tarea);
$sig_cbox = new Xoops\Form\Checkbox("", "attachsig", $sig_cbox_value);
$sig_cbox->addOption(1, XoopsLocale::ALWAYS_ATTACH_MY_SIGNATURE);
$sig_tray->addElement($sig_cbox);
$this->addElement($sig_tray);
$this->addElement(new Xoops\Form\TextArea(XoopsLocale::EXTRA_INFO, "bio", $bio_value, 5, 5));
if ($xoops->isActiveModule('userrank')) {
$rank_select = new Xoops\Form\Select(XoopsLocale::RANK, "rank", $rank_value);
$ranklist = XoopsLists::getUserRankList();
$rank_select->addOption(0, "--------------");
if (count($ranklist) > 0) {
$rank_select->addOptionArray($ranklist);
}
$this->addElement($rank_select);
} else {
$this->addElement(new Xoops\Form\Hidden("rank", $rank_value));
}
// adding a new user requires password fields
if (!$form_isedit) {
$this->addElement(new Xoops\Form\Password(XoopsLocale::PASSWORD, "password", 3, 32), true);
$this->addElement(new Xoops\Form\Password(XoopsLocale::RETYPE_PASSWORD, "pass2", 3, 32), true);
//.........这里部分代码省略.........
示例6: XoopsFormButton
$promotray->addElement($option_select);
$button_tray = new XoopsFormButton("", "submit", "<>", "submit");
$button_tray->setExtra("onclick=\"document.prvmsg.action='msgbox.php?op=sendbox&send=" . $send . "&reply=" . $reply . "'\"");
$select_form->addElement($promotray);
$promotray->addElement($button_tray);
$xoopsTpl->assign('mp_selectview', $select_form->render());
//
include 'include/form.inc.php';
// affiche le message de reponse
if ($reply == 1) {
$poster = new XoopsUser($pm2->getVar("from_userid"));
if (!$poster->isActive()) {
$poster_name = $xoopsConfig['anonymous'];
} else {
$poster_name = $poster->getVar("uname");
$poster_rank = $poster->rank();
echo "<br /><span style=\"background-color: #E9E9E9; border:1px solid #C0C0C0;font-size:10px;\"> \r\n" . _MP_MMES . " \r\n<a href=\"javascript:;\" onclick=\"showForm('prevu');\">+</a>/\r\n<a href=\"javascript:;\" onclick=\"hideAll('prevu');\">-</a> </span>\r\n<div id='prevu'>\r\n<table border='0' cellspacing='1' cellpadding='4' width='100%' class='outer'>\r\n<tr><td width='20%' class='xo-message-head'><b><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $poster->getVar("uid") . "'>" . $poster_name . "</a></td>\r\n <td class='xo-message-head'>" . _MP_POSTED . " " . formatTimestamp($pm2->getVar("msg_time")) . "</td>\r\n</tr>\t\r\n<tr><td class='xo-message-even' valign='top' rowspan='2'>\r\n\t\t<div class='comUserRank'><div class='comUserRankText'>" . $poster_rank['title'] . "</div>\r\n\r\n<img class='comUserRankImg' src='" . XOOPS_UPLOAD_URL . "/" . $poster_rank['image'] . "' alt='' />\r\n\r\n</div>\r\n<img class='comUserImg' src='" . XOOPS_UPLOAD_URL . "/" . $poster->getVar("user_avatar") . "' alt=''/>\r\n<div class='comUserStat'><span class='comUserStatCaption'>" . _MP_JOINED . "</span>\r\n" . formatTimestamp($poster->getVar('user_regdate'), 's') . "</div>\r\n<div class='comUserStat'><span class='comUserStatCaption'>" . _MP_FROM2 . "</span>\r\n" . $poster->getVar('user_from') . "</div>\r\n<div class='comUserStat'><span class='comUserStatCaption'>" . _MP_POSTS . "\r\n</span>" . $poster->getVar('posts') . "</div>";
if ($poster->isOnline()) {
echo '<div class="comUserStatus"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/online.png" title="' . _MP_ONLINE . '" style="width: 20px; height: 20px;"/></div>';
} else {
echo '<div class="comUserStatus"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/offline.png" title="' . _MP_OFFLINE . '" style="width: 20px; height: 20px;"/></div>';
}
}
echo "</td><td class='xo-message-odd' valign='top'><div class='comTitle'>";
if (!$pm2->getVar("msg_image")) {
echo "<img src='../../images/read.gif' alt='' />";
} else {
echo "<img src='../../images/subject/" . $pm2->getVar("msg_image") . "' alt='' />";
}
echo " " . $myts->htmlSpecialChars($myts->stripSlashesGPC($pm2->getVar("subject"))) . "</div>\r\n<div class='comText'>" . $myts->htmlSpecialChars($myts->stripSlashesGPC($pm2->getVar("msg_text"))) . "\r\n</td></tr></table></div>";
}
示例7: getOutputValue
/**
* Returns a value for output of this field
*
* @param XoopsUser $user {@link XoopsUser} object to get the value of
* @param profileProfile $profile object to get the value of
*
* @return string
**/
public function getOutputValue(XoopsUser &$user, ProfileProfile $profile)
{
$xoops = Xoops::getInstance();
$xoops->loadLanguage('modinfo', 'profile');
$value = in_array($this->getVar('field_name'), $this->getUserVars()) ? $user->getVar($this->getVar('field_name')) : $profile->getVar($this->getVar('field_name'));
switch ($this->getVar('field_type')) {
default:
case "textbox":
if ($this->getVar('field_name') == 'url' && $value != '') {
return '<a href="' . $xoops->formatURL($value) . '" rel="external">' . $value . '</a>';
} else {
return $value;
}
break;
case "textarea":
case "dhtml":
case 'theme':
case "language":
case "list":
return $value;
break;
case "select":
case "radio":
$options = $this->getVar('field_options');
if (isset($options[$value])) {
$value = htmlspecialchars(defined($options[$value]) ? constant($options[$value]) : $options[$value]);
} else {
$value = "";
}
return $value;
break;
case "select_multi":
case "checkbox":
$options = $this->getVar('field_options');
$ret = array();
if (count($options) > 0) {
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars(defined($options[$key]) ? constant($options[$key]) : $options[$key]);
}
}
}
return $ret;
break;
case "group":
$member_handler = $xoops->getHandlerMember();
$options = $member_handler->getGroupList();
$ret = isset($options[$value]) ? $options[$value] : '';
return $ret;
break;
case "group_multi":
$member_handler = $xoops->getHandlerMember();
$options = $member_handler->getGroupList();
$ret = array();
foreach (array_keys($options) as $key) {
if (in_array($key, $value)) {
$ret[$key] = htmlspecialchars($options[$key]);
}
}
return $ret;
break;
case "longdate":
//return YYYY/MM/DD format - not optimal as it is not using local date format, but how do we do that
//when we cannot convert it to a UNIX timestamp?
return str_replace("-", "/", $value);
case "date":
return XoopsLocale::formatTimestamp($value, 's');
break;
case "datetime":
if (!empty($value)) {
return XoopsLocale::formatTimestamp($value, 'm');
} else {
return _PROFILE_MI_NEVER_LOGGED_IN;
}
break;
case "autotext":
$value = $user->getVar($this->getVar('field_name'), 'n');
//autotext can have HTML in it
$value = str_replace("{X_UID}", $user->getVar("uid"), $value);
$value = str_replace("{X_URL}", \XoopsBaseConfig::get('url'), $value);
$value = str_replace("{X_UNAME}", $user->getVar("uname"), $value);
return $value;
break;
case "rank":
$userrank = $user->rank();
$user_rankimage = "";
if (isset($userrank['image']) && $userrank['image'] != "") {
$user_rankimage = '<img src="' . \XoopsBaseConfig::get('uploads-url') . '/' . $userrank['image'] . '" alt="' . $userrank['title'] . '" /><br />';
}
return $user_rankimage . $userrank['title'];
break;
case "yesno":
//.........这里部分代码省略.........