Beispiel #1
0
 public function remove()
 {
     if (empty($_GET['actionId'])) {
         throw new Redirect404Exception();
     }
     $id = (int) $_GET['actionId'];
     $dto = $this->service->findActionById($id);
     if (empty($dto)) {
         exit;
     }
     $this->service->removeActionById($id);
     exit(OW::getLanguage()->text('newsfeed', 'item_deleted_feedback'));
 }
Beispiel #2
0
 public function remove()
 {
     if (empty($_GET['actionId'])) {
         throw new Redirect404Exception();
     }
     $id = (int) $_GET['actionId'];
     $dto = $this->service->findActionById($id);
     if (empty($dto)) {
         exit;
     }
     $data = json_decode($dto->data, true);
     if (!empty($data['attachmentId'])) {
         OW::getEventManager()->call('base.attachment_delete_image', array('id' => $data['attachmentId']));
     }
     $this->service->removeActionById($id);
     exit(OW::getLanguage()->text('newsfeed', 'item_deleted_feedback'));
 }
Beispiel #3
0
 private function deleteActions($data, $processData)
 {
     $actionsCount = 10;
     $actionIds = empty($data['actionIds']) ? array() : $data['actionIds'];
     $processData = empty($processData) ? array() : $processData;
     $currentActions = array_diff($actionIds, $processData);
     $currentActions = array_values($currentActions);
     if (empty($currentActions)) {
         return true;
     }
     $iterationsCount = count($currentActions);
     $iterationsCount = $iterationsCount > $actionsCount ? $actionsCount : $iterationsCount;
     for ($i = 0; $i < $iterationsCount; $i++) {
         $this->service->removeActionById($currentActions[$i]);
         $processData[] = $currentActions[$i];
     }
     return $processData;
 }