/**
  * attachments_mass_update
  *
  * @param void
  * @return null
  */
 function attachments_mass_update()
 {
     if (!$this->active_object->canEdit($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall());
     }
     // if
     if ($this->request->isSubmitted()) {
         $action = $this->request->post('action');
         if (!in_array($action, array('move_to_trash'))) {
             $this->httpError(HTTP_ERR_BAD_REQUEST, 'Invalid action');
         }
         // if
         $objects = ProjectObjects::findByIds($this->request->post('objects'));
         $operations_performed = 0;
         foreach ($objects as $object) {
             if ($action == 'move_to_trash') {
                 $operation = $object->moveToTrash();
             }
             // if
             if ($operation && !is_error($operation)) {
                 $operations_performed++;
             }
             // if
         }
         // foreach
         db_commit();
         if ($action == 'move_to_trash') {
             $message = lang(':count objects moved to trash', array('count' => $operations_performed));
         }
         // if
         flash_success($message, null, true);
         $this->redirectToUrl($this->active_object->getAttachmentsUrl());
     }
     // if
 }
 /**
  * Starred Project Objects
  *
  * @param void
  * @return null
  */
 function starred()
 {
     $this->wireframe->current_menu_item = 'starred_folder';
     if ($this->request->isSubmitted()) {
         $action = $this->request->post('action');
         if (!in_array($action, array('unstar', 'unstar_and_complete', 'trash'))) {
             $this->httpError(HTTP_ERR_BAD_REQUEST, 'Invalid action');
         }
         // if
         $objects = ProjectObjects::findByIds($this->request->post('objects'), STATE_VISIBLE, $this->logged_user->getVisibility());
         db_begin_work();
         foreach ($objects as $object) {
             // Unstar selected object
             if ($action == 'unstar') {
                 $object->unstar($this->logged_user);
                 // Unstar and marked as completed
             } elseif ($action == 'unstar_and_complete') {
                 $operation = $object->unstar($this->logged_user);
                 if ($operation && !is_error($operation)) {
                     if ($object->can_be_completed) {
                         $object->complete($this->logged_user);
                     }
                     // if
                 }
                 // if
                 // Move to Trash
             } elseif ($action == 'trash') {
                 if (!$object->canDelete($this->logged_user)) {
                     continue;
                 }
                 // if
                 $object->moveToTrash();
             }
             // if
         }
         // foreach
         db_commit();
     }
     // if
     $this->smarty->assign('objects', StarredObjects::findByUser($this->logged_user));
     $this->smarty->assign('user_pages', StarredObjects::findStarredPagesByUser($this->logged_user->getId(), '2'));
     if ($this->request->get('async')) {
         $this->smarty->display(get_template_path('starred', 'dashboard', SYSTEM_MODULE));
         die;
     }
     // if
 }