|
@@ 300-332 (lines=33) @@
|
| 297 |
|
* @return RedirectResponse |
| 298 |
|
* @throws AccessDeniedException |
| 299 |
|
*/ |
| 300 |
|
public function publishAction(Request $request, $id) |
| 301 |
|
{ |
| 302 |
|
$this->init($request); |
| 303 |
|
/* @var Node $node */ |
| 304 |
|
$node = $this->em->getRepository('KunstmaanNodeBundle:Node')->find($id); |
| 305 |
|
|
| 306 |
|
$nodeTranslation = $node->getNodeTranslation($this->locale, true); |
| 307 |
|
$request = $this->get('request_stack')->getCurrentRequest(); |
| 308 |
|
|
| 309 |
|
if ($request->get('pub_date')) { |
| 310 |
|
$date = new \DateTime( |
| 311 |
|
$request->get('pub_date') . ' ' . $request->get('pub_time') |
| 312 |
|
); |
| 313 |
|
$this->get('kunstmaan_node.admin_node.publisher')->publishLater( |
| 314 |
|
$nodeTranslation, |
| 315 |
|
$date |
| 316 |
|
); |
| 317 |
|
$this->addFlash( |
| 318 |
|
FlashTypes::SUCCESS, |
| 319 |
|
$this->get('translator')->trans('kuma_node.admin.publish.flash.success_scheduled') |
| 320 |
|
); |
| 321 |
|
} else { |
| 322 |
|
$this->get('kunstmaan_node.admin_node.publisher')->publish( |
| 323 |
|
$nodeTranslation |
| 324 |
|
); |
| 325 |
|
$this->addFlash( |
| 326 |
|
FlashTypes::SUCCESS, |
| 327 |
|
$this->get('translator')->trans('kuma_node.admin.publish.flash.success_published') |
| 328 |
|
); |
| 329 |
|
} |
| 330 |
|
|
| 331 |
|
return $this->redirect($this->generateUrl('KunstmaanNodeBundle_nodes_edit', array('id' => $node->getId()))); |
| 332 |
|
} |
| 333 |
|
|
| 334 |
|
/** |
| 335 |
|
* @Route( |
|
@@ 348-373 (lines=26) @@
|
| 345 |
|
* @return RedirectResponse |
| 346 |
|
* @throws AccessDeniedException |
| 347 |
|
*/ |
| 348 |
|
public function unPublishAction(Request $request, $id) |
| 349 |
|
{ |
| 350 |
|
$this->init($request); |
| 351 |
|
/* @var Node $node */ |
| 352 |
|
$node = $this->em->getRepository('KunstmaanNodeBundle:Node')->find($id); |
| 353 |
|
|
| 354 |
|
$nodeTranslation = $node->getNodeTranslation($this->locale, true); |
| 355 |
|
$request = $this->get('request_stack')->getCurrentRequest(); |
| 356 |
|
|
| 357 |
|
if ($request->get('unpub_date')) { |
| 358 |
|
$date = new \DateTime($request->get('unpub_date') . ' ' . $request->get('unpub_time')); |
| 359 |
|
$this->get('kunstmaan_node.admin_node.publisher')->unPublishLater($nodeTranslation, $date); |
| 360 |
|
$this->addFlash( |
| 361 |
|
FlashTypes::SUCCESS, |
| 362 |
|
$this->get('translator')->trans('kuma_node.admin.unpublish.flash.success_scheduled') |
| 363 |
|
); |
| 364 |
|
} else { |
| 365 |
|
$this->get('kunstmaan_node.admin_node.publisher')->unPublish($nodeTranslation); |
| 366 |
|
$this->addFlash( |
| 367 |
|
FlashTypes::SUCCESS, |
| 368 |
|
$this->get('translator')->trans('kuma_node.admin.unpublish.flash.success_unpublished') |
| 369 |
|
); |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
return $this->redirect($this->generateUrl('KunstmaanNodeBundle_nodes_edit', array('id' => $node->getId()))); |
| 373 |
|
} |
| 374 |
|
|
| 375 |
|
/** |
| 376 |
|
* @Route( |