| @@ 123-147 (lines=25) @@ | ||
| 120 | * @param array $args The argument list. |
|
| 121 | * @param array &$data The local request data. |
|
| 122 | */ |
|
| 123 | public function _handler_delete($handler_id, array $args, array &$data) |
|
| 124 | { |
|
| 125 | $article = new midcom_db_article($args[0]); |
|
| 126 | ||
| 127 | $qb = net_nehmer_blog_link_dba::new_query_builder(); |
|
| 128 | $qb->add_constraint('topic', '=', $this->_content_topic->id); |
|
| 129 | $qb->add_constraint('article', '=', $article->id); |
|
| 130 | ||
| 131 | if ($qb->count() === 0) |
|
| 132 | { |
|
| 133 | throw new midcom_error_notfound('No links were found'); |
|
| 134 | } |
|
| 135 | ||
| 136 | // Get the link |
|
| 137 | $results = $qb->execute_unchecked(); |
|
| 138 | $this->_link = $results[0]; |
|
| 139 | $this->_link->require_do('midgard:delete'); |
|
| 140 | ||
| 141 | $workflow = $this->get_workflow('delete', array |
|
| 142 | ( |
|
| 143 | 'object' => $this->_link, |
|
| 144 | 'label' => $this->_l10n->get('article link') |
|
| 145 | )); |
|
| 146 | return $workflow->run(); |
|
| 147 | } |
|
| 148 | } |
|
| 149 | ||
| @@ 140-162 (lines=23) @@ | ||
| 137 | * @param array $args The argument list. |
|
| 138 | * @param array &$data The local request data. |
|
| 139 | */ |
|
| 140 | public function _handler_deletelink($handler_id, array $args, array &$data) |
|
| 141 | { |
|
| 142 | $this->_article = new midcom_db_article($args[0]); |
|
| 143 | ||
| 144 | $qb = net_nehmer_static_link_dba::new_query_builder(); |
|
| 145 | $qb->add_constraint('topic', '=', $this->_content_topic->id); |
|
| 146 | $qb->add_constraint('article', '=', $this->_article->id); |
|
| 147 | ||
| 148 | if ($qb->count() === 0) |
|
| 149 | { |
|
| 150 | throw new midcom_error_notfound('No links were found'); |
|
| 151 | } |
|
| 152 | ||
| 153 | // Get the link |
|
| 154 | $results = $qb->execute_unchecked(); |
|
| 155 | $this->_link = $results[0]; |
|
| 156 | $workflow = $this->get_workflow('delete', array |
|
| 157 | ( |
|
| 158 | 'object' => $this->_link, |
|
| 159 | 'label' => $this->_l10n->get('article link') |
|
| 160 | )); |
|
| 161 | return $workflow->run(); |
|
| 162 | } |
|
| 163 | ||
| 164 | /** |
|
| 165 | * Displays an article delete confirmation view. |
|