You are here

public function BotchaRecipebookController::getRecipebook in BOTCHA Spam Prevention 7.3

Same name and namespace in other branches
  1. 6.3 controller/recipebook/botcha.recipebook.controller.inc \BotchaRecipebookController::getRecipebook()

Overrides IBotchaRecipebookController::getRecipebook

2 calls to BotchaRecipebookController::getRecipebook()
BotchaRecipebookController::getRecipebooks in controller/recipebook/botcha.recipebook.controller.inc
BotchaRecipebookController::save in controller/recipebook/botcha.recipebook.controller.inc

File

controller/recipebook/botcha.recipebook.controller.inc, line 28
Controller layer of the BotchaRecipebook objects.

Class

BotchaRecipebookController

Code

public function getRecipebook($id = 'default', $create = TRUE) {
  $none = TRUE;
  if ($id != 'none') {
    $rb = $this
      ->getModel()
      ->getRecipebook($id);
    if ($rb || $create) {
      $none = FALSE;
    }
  }
  if ($none) {
    $recipebook = new BotchaRecipebookNone($id);
  }
  else {
    $recipebook = new BotchaRecipebook($id);
    if ($rb) {
      $recipebook
        ->setTitle($rb->title)
        ->setDescription($rb->description);
    }
    $recipebook
      ->getForms();
    $recipebook
      ->getRecipes();
  }
  return $recipebook;
}