本文整理汇总了PHP中Question::group方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::group方法的具体用法?PHP Question::group怎么用?PHP Question::group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question::group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFollowedQuestions
public function getFollowedQuestions()
{
global $sDB, $sUser;
$qF = array();
$res = $sDB->exec("SELECT `questions`.* FROM `notifications`\r\n LEFT JOIN `questions` ON `questions`.questionId = `notifications`.`questionId`\r\n WHERE `notifications`.`userId` = '" . $this->userId . "' ORDER BY `dateAdded` DESC;");
while ($row = mysql_fetch_object($res)) {
$q = new Question($row->questionId, $row);
if ($q->group() && $q->group()->getPermission($sUser, ACTION_VIEW_GROUP) == PERMISSION_DISALLOWED) {
}
array_push($qF, $q);
}
return $qF;
}
示例2: drawArgumentList
function drawArgumentList(Question $q, $basePath)
{
global $sTemplate, $sUser, $sPermissions;
$faction = $sUser->getFactionByQuestionId($q->questionId());
$onClickHandler = "";
if (!$sUser->isLoggedIn() && !$q->hasFlag(QUESTION_FLAG_PART_ALL)) {
$onClickHandler = "wikiargument.raiseError(\"" . $sTemplate->getString("NOTICE_NEW_ARGUMENT_NOT_LOGGED_IN") . "\"); return false;";
} else {
if ($sPermissions->getPermission($sUser, ACTION_NEW_ARGUMENT) == PERMISSION_DISALLOWED || $q->group() && $q->group()->getPermission($sUser, ACTION_NEW_ARGUMENT) == PERMISSION_DISALLOWED) {
$onClickHandler = "wikiargument.raiseError(\"" . $sTemplate->getString("NOTICE_NEW_ARGUMENT_NO_PERMISSION") . "\"); return false;";
}
}
$content = "\n<div class = 'arguments'>\n <div class = 'arguments_pro'>";
foreach ($q->arguments(FILTER_PRO, SORT_SCORE) as $k => $v) {
$content .= drawArgument($q, $v, $basePath);
}
$content .= "\n <a href = '" . $q->urlNewArgument(true) . "' onclick = '" . $onClickHandler . "'>\n <div class = 'button_argument button_new_argument_pro'><span>\n " . $sTemplate->getString("NEW_ARGUMENT") . "</span>\n </div>\n </a>";
$content .= "\n </div>\n <div class = 'arguments_con'>";
foreach ($q->arguments(FILTER_CON, SORT_SCORE) as $k => $v) {
$content .= drawArgument($q, $v, $basePath);
}
$content .= "\n <a href = '" . $q->urlNewArgument(false) . "' onclick = '" . $onClickHandler . "'>\n <div class = 'button_argument button_new_argument_con'><span>\n " . $sTemplate->getString("NEW_ARGUMENT") . "</span>\n </div>\n </a>";
$content .= "\n </div>\n <div class = 'clear'></div>\n</div>\n<div class = 'clear'></div>\n ";
echo $content;
}
示例3: handlePacket
public function handlePacket()
{
global $sUser, $sDB, $sTemplate, $sLog, $sStatistics;
$requestObj = $this->_requestObj;
$response = $this->_response;
$qId = $requestObj->getInt(array("data", "qId"));
$aId = $requestObj->getInt(array("data", "aId"));
$vote = $requestObj->getInt(array("data", "vote"));
$question = new Question($qId);
$argument = false;
if ($aId) {
$argument = new Argument($aId);
}
$response->opcode = SMSG_VOTE_RESPONSE;
$response->data->result = 0;
$response->data->qId = $qId;
$response->data->aId = $aId;
$response->data->vote = $vote;
// check for valid question / argument
if ($question->questionId() == 0 || $argument && $argument->argumentId() == -1) {
$response->data->error = $sTemplate->getString("NOTICE_VOTE_NOT_LOGGED_IN");
return false;
}
// user login state
if (!$sUser->isLoggedIn() && ($question->type() != QUESTION_TYPE_UNLISTED || !($question->flags() & QUESTION_FLAG_PART_ALL))) {
$response->data->error = $sTemplate->getString("NOTICE_VOTE_NOT_LOGGED_IN");
return false;
}
// group validation
if ($question->group() && $question->group()->getPermission($sUser, ACTION_VOTE) == PERMISSION_DISALLOWED) {
$response->data->error = $sTemplate->getString("NOTICE_VOTE_NOT_LOGGED_IN");
return false;
}
// faction checkin
if ($argument) {
$faction = $sUser->getFactionByQuestionId($qId);
if ($faction != $argument->type()) {
$response->data->error = $sTemplate->getString("NOTICE_VOTE_NOT_CHECKED_IN");
}
}
$sStatistics->vote($question, $aId, $vote);
$response->data->result = 1;
// get new question score
if ($aId == 0) {
$question = new Question($qId);
$response->data->score = $question->score();
} else {
$argument = new Argument($aId);
$response->data->score = $argument->score();
}
}