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