Example #1
0
 /**
  * @param string $get_array
  * @param string $comment
  * @return string
  * @throws ProjectException
  * @throws ProjectSecurityAccessDeniedException
  * @throws ProjectIDMissingException
  */
 public static function cancel_handler($get_array, $comment)
 {
     global $user;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['project_id']) {
         $project = new Project($_GET['project_id']);
         if ($project->get_current_status_id() == 0) {
             if ($user->is_admin() == true) {
                 if ($project->mark_as_reactivated() == false) {
                     throw new ProjectException();
                 } else {
                     return "1";
                 }
             } else {
                 throw new ProjectSecurityAccessDeniedException();
             }
         } else {
             $project_security = new ProjectSecurity($_GET['project_id']);
             if ($project_security->is_access(3, false) == true) {
                 if ($project->mark_as_canceled($comment) == false) {
                     throw new ProjectException();
                 } else {
                     return "1";
                 }
             } else {
                 throw new ProjectSecurityAccessDeniedException();
             }
         }
     } else {
         throw new ProjectIDMissingException();
     }
 }