本文整理汇总了PHP中Argument::type方法的典型用法代码示例。如果您正苦于以下问题:PHP Argument::type方法的具体用法?PHP Argument::type怎么用?PHP Argument::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Argument
的用法示例。
在下文中一共展示了Argument::type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawArgumentBoxFull
function drawArgumentBoxFull(Question $q, Argument $a, $basePath)
{
global $sTemplate, $sUser;
$ret = "";
$argumentId = $a->argumentId();
$numPoints = $a->score();
$ret .= '
<div class = "argument_full">
<div class = "stats question_stats">
<div class = "points question_points">' . $numPoints . '</div>
<div class = "points_text question_points_text">' . $sTemplate->getStringNumber("QUESTION_POINTS", array(), array(), $numPoints) . '</div>
' . voteUp('question_vote_up', $q->questionId(), $argumentId, $a->type(), $q->type(), $q->flags()) . '
' . voteDn('question_vote_dn', $q->questionId(), $argumentId, $a->type(), $q->type(), $q->flags()) . '
</div>
<div class = "argument_title"><a href = "' . $a->url($basePath) . '">' . $a->headline() . '</a></div>';
$ret .= '<div class = "argument_abstract_extended argument_abstract_cursive">' . $a->abstractText() . '</div>';
$ret .= '<div class = "argument_details_extended">' . $a->details() . '</div>';
if ($a->canEdit($sUser)) {
$ret .= '<div class = "author question_author"><a href = "' . $a->url($basePath) . 'edit/">' . $sTemplate->getString("ARGUMENT_EDIT", array("[TIMELEFT]"), array($a->timeLeftEdit())) . '</a></div>';
} else {
$ret .= '<div class = "author question_author">' . $sTemplate->getString("QUESTION_AUTHOR", array("[TIMESINCE]", "[USERNAME]"), array($a->timeSince(), $a->authorLink())) . '</div>';
}
$ret .= '
<div class = "argument_' . ($a->type() == ARGUMENT_PRO ? "pro" : "con") . '_bar"></div>
</div>';
if (!$a->parentId()) {
$numArguments = $a->numArguments();
$ret .= '
<div class = "counter_argument_box_full_line"></div>
<a href = "' . $a->urlCounterArguments($basePath) . '">
<div class = "counter_argument_box_full ' . ($a->type() == ARGUMENT_PRO ? "counter_argument_box_full_pro" : "counter_argument_box_full_con") . '">
<div class = "count">' . $numArguments . '</div>
<div class = "count_text">' . $sTemplate->getStringNumber("NUM_COUNTER_ARGUMENTS", array(), array(), $numArguments) . '</div>
<div class = "plus_sign"></div>
</div>
</a>';
}
return $ret;
}
示例2: 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();
}
}