/**
  * Move object into a different project
  *
  * @param void
  * @return null
  */
 function move()
 {
     if (!$this->active_object->canMove($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN, null, true, $this->request->isApiCall());
     }
     // if
     if ($this->request->isSubmitted()) {
         $project = null;
         $project_id = (int) $this->request->post('move_to_project_id');
         if ($project_id) {
             $destination_project = Projects::findById($project_id);
         }
         // if
         $move_child_objects = $this->request->post('move_child_objects');
         $this->smarty->assign('data', array('move_child_objects' => $move_child_objects));
         if (!instance_of($destination_project, 'Project')) {
             flash_error('Please select destination project');
             $this->redirectToUrl($this->active_object->getMoveUrl());
         }
         // if
         $source_project = $this->active_object->getProject();
         if (instance_of($this->active_object, 'Milestone') && $move_child_objects) {
             $child_objects = ProjectObjects::findByMilestone($this->active_object);
         } else {
             $child_objects = null;
         }
         // if
         $move = $this->active_object->moveToProject($destination_project);
         if ($move && !is_error($move)) {
             if (is_foreachable($child_objects)) {
                 foreach ($child_objects as $child_object) {
                     $child_moved = $child_object->moveToProject($destination_project, $this->active_object);
                 }
                 // foreach
             }
             // if
             if (instance_of($source_project, 'Project')) {
                 $source_project->refreshTasksCount();
             }
             // if
             $destination_project->refreshTasksCount();
             flash_success('":name" has been successfully moved to ":project" project', array('name' => $this->active_object->getName(), 'project' => $destination_project->getName()));
             $this->redirectToUrl($this->active_object->getViewUrl());
         } else {
             flash_error('Failed to move ":name" to ":project" project', array('name' => $this->active_object->getName(), 'project' => $destination_project->getName()));
             $this->redirectToUrl($this->active_object->getMoveUrl());
         }
         // if
     }
     // if
 }