/**
  * Quick add checklist
  *
  * @param void
  * @return null
  */
 function quick_add()
 {
     if (!Page::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;
     $page_data = $this->request->post('page');
     if (!is_array($page_data)) {
         $page_data = array('visibility' => $this->active_project->getDefaultVisibility());
     }
     // if
     $this->smarty->assign(array('page_data' => $page_data, 'quick_add_url' => assemble_url('project_pages_quick_add', array('project_id' => $this->active_project->getId()))));
     if ($this->request->isSubmitted()) {
         db_begin_work();
         $this->active_page = new Page();
         if (count($_FILES > 0)) {
             attach_from_files($this->active_page, $this->logged_user);
         }
         // if
         $this->active_page->setAttributes($page_data);
         $this->active_page->setBody(clean(array_var($page_data, 'body', null)));
         $this->active_page->setProjectId($this->active_project->getId());
         $this->active_page->setCreatedBy($this->logged_user);
         $this->active_page->setState(STATE_VISIBLE);
         $save = $this->active_page->save();
         if ($save && !is_error($save)) {
             $subscribers = array($this->logged_user->getId());
             if (is_foreachable($this->request->post('notify_users'))) {
                 $subscribers = array_merge($subscribers, $this->request->post('notify_users'));
             } else {
                 $subscribers[] = $this->active_project->getLeaderId();
             }
             // if
             if (!in_array($this->active_project->getLeaderId(), $subscribers)) {
                 $subscribers[] = $this->active_project->getLeaderId();
             }
             // if
             Subscriptions::subscribeUsers($subscribers, $this->active_page);
             db_commit();
             $this->active_page->ready();
             $this->smarty->assign(array('active_page' => $this->active_page, 'page_data' => array('visibility' => $this->active_project->getDefaultVisibility()), 'project_id' => $this->active_project->getId()));
         } else {
             db_rollback();
             $this->httpError(HTTP_ERR_OPERATION_FAILED, $save->getErrorsAsString(), true, true);
         }
         // if
     }
     // if
 }