| @@ 114-132 (lines=19) @@ | ||
| 111 | * @throws NotFoundHttpException |
|
| 112 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
| 113 | */ |
|
| 114 | public function up(Application $app, Request $request, $id) |
|
| 115 | { |
|
| 116 | $this->isTokenValid($app); |
|
| 117 | ||
| 118 | $TargetNews = $app['eccube.repository.news']->find($id); |
|
| 119 | if (!$TargetNews) { |
|
| 120 | throw new NotFoundHttpException(); |
|
| 121 | } |
|
| 122 | ||
| 123 | $status = $app['eccube.repository.news']->up($TargetNews); |
|
| 124 | ||
| 125 | if ($status) { |
|
| 126 | $app->addSuccess('admin.news.up.complete', 'admin'); |
|
| 127 | } else { |
|
| 128 | $app->addError('admin.news.up.error', 'admin'); |
|
| 129 | } |
|
| 130 | ||
| 131 | return $app->redirect($app->url('admin_content_news')); |
|
| 132 | } |
|
| 133 | ||
| 134 | /** |
|
| 135 | * 指定した新着情報の表示順を1つ下げる。 |
|
| @@ 143-161 (lines=19) @@ | ||
| 140 | * @throws NotFoundHttpException |
|
| 141 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
| 142 | */ |
|
| 143 | public function down(Application $app, Request $request, $id) |
|
| 144 | { |
|
| 145 | $this->isTokenValid($app); |
|
| 146 | ||
| 147 | $TargetNews = $app['eccube.repository.news']->find($id); |
|
| 148 | if (!$TargetNews) { |
|
| 149 | throw new NotFoundHttpException(); |
|
| 150 | } |
|
| 151 | ||
| 152 | $status = $app['eccube.repository.news']->down($TargetNews); |
|
| 153 | ||
| 154 | if ($status) { |
|
| 155 | $app->addSuccess('admin.news.down.complete', 'admin'); |
|
| 156 | } else { |
|
| 157 | $app->addError('admin.news.down.error', 'admin'); |
|
| 158 | } |
|
| 159 | ||
| 160 | return $app->redirect($app->url('admin_content_news')); |
|
| 161 | } |
|
| 162 | ||
| 163 | /** |
|
| 164 | * 指定した新着情報を削除する。 |
|
| @@ 172-190 (lines=19) @@ | ||
| 169 | * @throws NotFoundHttpException |
|
| 170 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
|
| 171 | */ |
|
| 172 | public function delete(Application $app, Request $request, $id) |
|
| 173 | { |
|
| 174 | $this->isTokenValid($app); |
|
| 175 | ||
| 176 | $TargetNews = $app['eccube.repository.news']->find($id); |
|
| 177 | if (!$TargetNews) { |
|
| 178 | throw new NotFoundHttpException(); |
|
| 179 | } |
|
| 180 | ||
| 181 | $status = $app['eccube.repository.news']->delete($TargetNews); |
|
| 182 | ||
| 183 | if ($status) { |
|
| 184 | $app->addSuccess('admin.news.delete.complete', 'admin'); |
|
| 185 | } else { |
|
| 186 | $app->addSuccess('admin.news.delete.error', 'admin'); |
|
| 187 | } |
|
| 188 | ||
| 189 | return $app->redirect($app->url('admin_content_news')); |
|
| 190 | } |
|
| 191 | } |
|
| @@ 236-254 (lines=19) @@ | ||
| 233 | * @param Application $app |
|
| 234 | * @param $id |
|
| 235 | */ |
|
| 236 | public function enable(Application $app, $id) |
|
| 237 | { |
|
| 238 | $this->isTokenValid($app); |
|
| 239 | ||
| 240 | $Plugin = $app['eccube.repository.plugin']->find($id); |
|
| 241 | ||
| 242 | if (!$Plugin) { |
|
| 243 | throw new NotFoundHttpException(); |
|
| 244 | } |
|
| 245 | ||
| 246 | if ($Plugin->getEnable() == Constant::ENABLED) { |
|
| 247 | $app->addError('admin.plugin.already.enable', 'admin'); |
|
| 248 | } else { |
|
| 249 | $app['eccube.service.plugin']->enable($Plugin); |
|
| 250 | $app->addSuccess('admin.plugin.enable.complete', 'admin'); |
|
| 251 | } |
|
| 252 | ||
| 253 | return $app->redirect($app->url('admin_store_plugin')); |
|
| 254 | } |
|
| 255 | ||
| 256 | /** |
|
| 257 | * 対象のプラグインを無効にします。 |
|
| @@ 262-280 (lines=19) @@ | ||
| 259 | * @param Application $app |
|
| 260 | * @param $id |
|
| 261 | */ |
|
| 262 | public function disable(Application $app, $id) |
|
| 263 | { |
|
| 264 | $this->isTokenValid($app); |
|
| 265 | ||
| 266 | $Plugin = $app['eccube.repository.plugin']->find($id); |
|
| 267 | ||
| 268 | if (!$Plugin) { |
|
| 269 | throw new NotFoundHttpException(); |
|
| 270 | } |
|
| 271 | ||
| 272 | if ($Plugin->getEnable() == Constant::ENABLED) { |
|
| 273 | $app['eccube.service.plugin']->disable($Plugin); |
|
| 274 | $app->addSuccess('admin.plugin.disable.complete', 'admin'); |
|
| 275 | } else { |
|
| 276 | $app->addError('admin.plugin.already.disable', 'admin'); |
|
| 277 | } |
|
| 278 | ||
| 279 | return $app->redirect($app->url('admin_store_plugin')); |
|
| 280 | } |
|
| 281 | ||
| 282 | ||
| 283 | /** |
|