| @@ -38,8 +38,9 @@ | ||
| 38 | 38 | $this->registryAction('embedded'); |
| 39 | 39 | $this->registryAction('link'); |
| 40 | 40 | $this->registryAction('unlink'); |
| 41 | 41 | $this->registryAction('unlinkAll'); |
| 42 | + $this->registryAction('getBlockLinkedTemplates'); | |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | /** |
| 45 | 46 | * put your comment there... |
| @@ -64,12 +65,38 @@ | ||
| 64 | 65 | // Get embedded template code! |
| 65 | 66 | $this->response['code'] = $this->model->embedded(); |
| 66 | 67 | } |
| 67 | 68 | |
| 68 | -/** | |
| 69 | -* put your comment there... | |
| 70 | -* | |
| 71 | -*/ | |
| 69 | + /** | |
| 70 | + * put your comment there... | |
| 71 | + * | |
| 72 | + */ | |
| 73 | + protected function getBlockLinkedTemplatesAction() { | |
| 74 | + | |
| 75 | + | |
| 76 | + $blockId = isset($_GET['blockId']) ? $_GET['blockId'] : null; | |
| 77 | + | |
| 78 | + try { | |
| 79 | + | |
| 80 | + if (!$blockId) { | |
| 81 | + | |
| 82 | + throw new Exception('Invalid Request parameters'); | |
| 83 | + } | |
| 84 | + | |
| 85 | + $this->response = CJTBlockTemplatesModel::getLinkedTemplatesCount($blockId); | |
| 86 | + } | |
| 87 | + catch (Exception $exception) { | |
| 88 | + | |
| 89 | + | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * put your comment there... | |
| 97 | + * | |
| 98 | + */ | |
| 72 | 99 | protected function linkAction() { |
| 73 | 100 | // Read inputs. |
| 74 | 101 | $this->model->inputs['templateId'] = $_REQUEST['templateId']; |
| 75 | 102 | $this->model->inputs['blockId'] = $_REQUEST['blockId']; |
| @@ -78,9 +105,10 @@ | ||
| 78 | 105 | // Response with new state! |
| 79 | 106 | $this->response['newState'] = array( |
| 80 | 107 | 'action' => 'unlink', |
| 81 | 108 | 'text' => cssJSToolbox::getText('Unlink'), |
| 82 | - 'className' => 'template-action unlink-template' | |
| 109 | + 'className' => 'template-action unlink-template', | |
| 110 | + 'count' => CJTBlockTemplatesModel::getLinkedTemplatesCount($_REQUEST['blockId']) | |
| 83 | 111 | ); |
| 84 | 112 | } |
| 85 | 113 | |
| 86 | 114 | /** |
| @@ -96,9 +124,10 @@ | ||
| 96 | 124 | // Response with new state! |
| 97 | 125 | $this->response['newState'] = array( |
| 98 | 126 | 'action' => 'link', |
| 99 | 127 | 'text' => cssJSToolbox::getText('Link'), |
| 100 | - 'className' => 'template-action link-template' | |
| 128 | + 'className' => 'template-action link-template', | |
| 129 | + 'count' => CJTBlockTemplatesModel::getLinkedTemplatesCount($_REQUEST['blockId']) | |
| 101 | 130 | ); |
| 102 | 131 | } |
| 103 | 132 | |
| 104 | 133 | /** |