function CourseObjectUbercart::take in Course 7.2
Same name and namespace in other branches
- 8.3 modules/course_uc/course_uc.classes.inc \CourseObjectUbercart::take()
- 8.2 modules/course_uc/course_uc.classes.inc \CourseObjectUbercart::take()
- 6 modules/course_uc/course_uc.classes.inc \CourseObjectUbercart::take()
- 7 modules/course_uc/course_uc.classes.inc \CourseObjectUbercart::take()
Display the add to cart button, or a message that it was already purchased.
Implementing classes should override me if a custom display is desired.
Overrides CourseObject::take
File
- modules/
course_uc/ course_uc.classes.inc, line 14
Class
Code
function take() {
global $user;
if (!($this
->getNode()->sell_price > 0) && variable_get('course_access_bypass_checkout', 1)) {
$this
->getFulfillment($user)
->setComplete(1)
->save();
}
if ($this
->getFulfillment($user)
->isComplete()) {
return "You've already purchased this activity.";
}
else {
$node_view = node_view($this
->getNode());
$atc = t('You must purchase this course before proceeding.') . drupal_render($node_view['display_price']) . drupal_render($node_view['add_to_cart']);
if (!$atc) {
// The add to cart form was hidden?
return "Something isn't right...";
}
else {
return $atc;
}
}
}