class BotchaRecipebookController in BOTCHA Spam Prevention 6.3
Same name and namespace in other branches
- 7.3 controller/recipebook/botcha.recipebook.controller.inc \BotchaRecipebookController
Hierarchy
- class \BotchaRecipebookController extends \Controller implements IBotchaRecipebookController
Expanded class hierarchy of BotchaRecipebookController
File
- controller/
recipebook/ botcha.recipebook.controller.inc, line 16 - Controller layer of the BotchaRecipebook objects.
View source
class BotchaRecipebookController extends Controller implements IBotchaRecipebookController {
protected $app_name = 'Botcha';
protected $controller_type = Botcha::CONTROLLER_TYPE_RECIPEBOOK;
/**
* Just for IDE autocomplete feature.
* @return BotchaRecipebookModel
*/
protected function getModel() {
return parent::getModel();
}
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;
}
public function getRecipebooks($reset = FALSE, $withNone = FALSE) {
// @todo Pass parameters accurately (add reset).
$recipebooks = $this
->getModel()
->getRecipebooks();
if ($withNone) {
// @todo Remove hardcode.
$recipebook_none = $this
->getRecipebook('none');
$recipebooks[$recipebook_none->id] = $recipebook_none;
}
return $recipebooks;
}
public function save($recipebook) {
// Save recipe book to DB.
$this
->getModel()
->save($recipebook);
// Return updated object to check results if necessary.
return $this
->getRecipebook($recipebook->id, FALSE);
}
public function delete($recipebook) {
// Delete recipe book from DB.
$this
->getModel()
->delete($recipebook);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BotchaRecipebookController:: |
protected | property | ||
BotchaRecipebookController:: |
protected | property | ||
BotchaRecipebookController:: |
public | function |
Overrides IBotchaRecipebookController:: |
|
BotchaRecipebookController:: |
protected | function | Just for IDE autocomplete feature. | |
BotchaRecipebookController:: |
public | function |
Overrides IBotchaRecipebookController:: |
|
BotchaRecipebookController:: |
public | function |
Overrides IBotchaRecipebookController:: |
|
BotchaRecipebookController:: |
public | function |
Overrides IBotchaRecipebookController:: |