/**
  * Quick add milestone
  *
  * @param void
  * @return null
  */
 function quick_add()
 {
     if (!Milestone::canAdd($this->logged_user, $this->active_project)) {
         $this->httpError(HTTP_ERR_FORBIDDEN, lang("You don't have permission for this action"), true, true);
     }
     // if
     $this->skip_layout = true;
     $milestone_data = $this->request->post('milestone');
     if (!is_array($milestone_data)) {
         $milestone_data = array('visibility' => $this->active_project->getDefaultVisibility());
     }
     // if
     $this->smarty->assign(array('milestone_data' => $milestone_data, 'quick_add_url' => assemble_url('project_milestones_quick_add', array('project_id' => $this->active_project->getId()))));
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $this->active_milestone = new Milestone();
         $this->active_milestone->setAttributes($milestone_data);
         if (!isset($milestone_data['priority'])) {
             $this->active_milestone->setPriority(PRIORITY_NORMAL);
         }
         // if
         $this->active_milestone->setProjectId($this->active_project->getId());
         $this->active_milestone->setCreatedBy($this->logged_user);
         $this->active_milestone->setState(STATE_VISIBLE);
         $this->active_milestone->setVisibility(VISIBILITY_NORMAL);
         $save = $this->active_milestone->save();
         if ($save && !is_error($save)) {
             $subscribers = array($this->logged_user->getId());
             if (is_foreachable(array_var($milestone_data['assignees'], 0))) {
                 $subscribers = array_merge($subscribers, array_var($milestone_data['assignees'], 0));
             } else {
                 $subscribers[] = $this->active_project->getLeaderId();
             }
             // if
             Subscriptions::subscribeUsers($subscribers, $this->active_milestone);
             db_commit();
             $this->active_milestone->ready();
             $this->smarty->assign(array('active_milestone' => $this->active_milestone, 'milestone_data' => array('visibility' => $this->active_project->getDefaultVisibility()), 'project_id' => $this->active_project->getId()));
             $this->skip_layout = true;
         } else {
             db_rollback();
             $this->httpError(HTTP_ERR_OPERATION_FAILED, $save->getErrorsAsString(), true, true);
         }
         // if
     }
     // if
 }