| @@ 414-431 (lines=18) @@ | ||
| 411 | * @param $iconId |
|
| 412 | * @return null|string |
|
| 413 | */ |
|
| 414 | public function hideIconAction($iconId) |
|
| 415 | { |
|
| 416 | if (!$this->isCourseTeacher()) { |
|
| 417 | return $this->abort(404); |
|
| 418 | } |
|
| 419 | ||
| 420 | $entityManager = $this->getDoctrine()->getManager(); |
|
| 421 | $criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId); |
|
| 422 | $tool = $this->getRepository( |
|
| 423 | 'Chamilo\CourseBundle\Entity\CTool' |
|
| 424 | )->findOneBy($criteria); |
|
| 425 | if ($tool) { |
|
| 426 | $tool->setVisibility(0); |
|
| 427 | } |
|
| 428 | $entityManager->persist($tool); |
|
| 429 | //$entityManager->flush(); |
|
| 430 | return Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation'); |
|
| 431 | } |
|
| 432 | ||
| 433 | /** |
|
| 434 | * @Route("/delete/{iconId}") |
|
| @@ 439-453 (lines=15) @@ | ||
| 436 | * @param $iconId |
|
| 437 | * @return null|string |
|
| 438 | */ |
|
| 439 | public function deleteIcon($iconId) |
|
| 440 | { |
|
| 441 | if (!$this->isCourseTeacher()) { |
|
| 442 | return $this->abort(404); |
|
| 443 | } |
|
| 444 | ||
| 445 | $entityManager = $this->getDoctrine()->getManager(); |
|
| 446 | $criteria = array('cId' => api_get_course_int_id(), 'id' => $iconId, 'added_tool' => 1); |
|
| 447 | $tool = $this->getRepository( |
|
| 448 | 'Chamilo\CourseBundle\Entity\CTool' |
|
| 449 | )->findOneBy($criteria); |
|
| 450 | $entityManager->remove($tool); |
|
| 451 | //$entityManager->flush(); |
|
| 452 | return Display::return_message(get_lang('Deleted'), 'confirmation'); |
|
| 453 | } |
|
| 454 | ||
| 455 | /** |
|
| 456 | * @Route("/icon_list") |
|