| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disllow direct access. |
| 7 |
defined('ABSPATH') or die('Access denied'); |
| 8 |
|
| 9 |
/** |
| 10 |
* |
| 11 |
*/ |
| 12 |
class CJTBlockTemplatesModel extends CJTHookableClass { |
| 13 |
|
| 14 |
/** |
| 15 |
* Check weather a template is linked to specific block. |
| 16 |
* |
| 17 |
* Check database block_templates table for record with the given ids. |
| 18 |
* |
| 19 |
* @param Integer Block Id. |
| 20 |
* @param Integer Template Id. |
| 21 |
* @return boolean TRUE if linked, FALSE if not. |
| 22 |
*/ |
| 23 |
public function isLinked($blockId, $templateId) { |
| 24 |
// Try to load block template table with the requested Ids. |
| 25 |
$tableBlockTemplate = CJTxTable::getInstance('block-template'); |
| 26 |
$tableBlockTemplate->set('blockId', $blockId) |
| 27 |
->set('templateId', $templateId) |
| 28 |
->load(array('blockId', 'templateId')); |
| 29 |
// Return TRUE if the blockId and the TemplateId returned from the load process! |
| 30 |
return ($tableBlockTemplate->get('blockId') && $tableBlockTemplate->get('templateId')); |
| 31 |
} |
| 32 |
|
| 33 |
} // End class. |
| 34 |
|
| 35 |
// Hookable! |
| 36 |
CJTBlockTemplatesModel::define('CJTBlockTemplatesModel'); |