本文整理汇总了PHP中task::getBidLeaderID方法的典型用法代码示例。如果您正苦于以下问题:PHP task::getBidLeaderID方法的具体用法?PHP task::getBidLeaderID怎么用?PHP task::getBidLeaderID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类task
的用法示例。
在下文中一共展示了task::getBidLeaderID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public function initialize($info)
{
$error = array();
//check if task exists
$task = new task();
if (isset($info['taskid']) && $task->checkExistence($info['taskid'])) {
$this->taskid = $info['taskid'];
} else {
$error['taskid'] = true;
}
//check if task is already rated
//strip tags from comment before adding
if (isset($info['comment'])) {
$this->comment = strip_tags($info['comment']);
} else {
$error['comment'] = true;
}
//check if rating is a number between 0 and 5 inclusive
if (isset($info['rating']) && is_numeric($info['rating']) && $info['rating'] >= 0 && $info['rating'] <= 5) {
$this->rating = $info['rating'];
} else {
$error['rating'] = true;
}
//1 if a Doer rating, 0 if a Lister rating
//determine if Lister or Doer
$task->getFromDB($this->taskid);
$bidwinner = $task->getBidLeaderID();
//Must be logged in
if (!isset($_SESSION['userid'])) {
$error['login'] = true;
} else {
//If you're the winner, you are leaving a review for the Lister
if ($_SESSION['userid'] == $bidwinner) {
$this->reviewee_uid = $task->userid;
$this->listerOrDoer = false;
} else {
if ($_SESSION['userid'] == $task->userid) {
$this->reviewee_uid = $bidwinner;
$this->listerOrDoer = true;
} else {
$error['notinvolved'] = true;
}
}
}
$this->timestamp = time();
return $error;
}
示例2: header
if (isset($biderror['bidself'])) {
$_SESSION['msg_bidself'] = "Can't bid on own task";
}
if (isset($biderror['login'])) {
$_SESSION['msg_needlogin'] = "Log in to bid";
}
//redirect to prevent form resubmission on refresh
header("Location: /ViewTask.php?id=" . $intaskid);
die;
}
//AJAX for getting the current bid
if (isset($_GET['getCurrentBid'])) {
echo 'Current bid: $<b>';
echo $task->getCurrentBid();
echo '.00';
if (isset($_SESSION['userid']) && $task->getBidLeaderID() == $_SESSION['userid']) {
echo ' (You)';
}
echo '</b>';
die;
}
//show alert if task is not active
if (count($error) == 0 && $task->active == 0) {
if (isset($_SESSION['userid']) && $task->winnerid == $_SESSION['userid']) {
$_SESSION['msg_taskover_won'] = "Task ended, you won!";
} else {
$_SESSION['msg_taskover'] = "Task ended";
}
}
?>