Example #1
0
 /**
  * @param string $get_array
  * @return string
  * @throws ProjectException
  * @throws ProjectSecurityAccessDeniedException
  * @throws ProjectIDMissingException
  */
 public static function restore_handler($get_array)
 {
     global $user;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['project_id']) {
         $project = new Project($_GET['project_id']);
         if ($user->is_admin() == true) {
             if ($project->get_deleted() == true) {
                 if ($project->mark_as_undeleted() == false) {
                     throw new ProjectException();
                 } else {
                     return "1";
                 }
             } else {
                 throw new ProjectException();
             }
         } else {
             throw new ProjectSecurityAccessDeniedException();
         }
     } else {
         throw new ProjectIDMissingException();
     }
 }
Example #2
0
 /**
  * @see ProjectInterface::list_organisation_unit_related_projects()
  * @param integer $organisation_unit_id
  * @param bool $include_deleted
  * @return array
  */
 public static function list_organisation_unit_related_projects($organisation_unit_id, $include_deleted)
 {
     $project_array = Project_Access::list_entries_by_toid_organ_unit($organisation_unit_id);
     if ($include_deleted == false) {
         if (is_array($project_array) and count($project_array) >= 1) {
             $return_array = array();
             foreach ($project_array as $key => $value) {
                 $project = new Project($value);
                 if ($project->get_deleted() == false) {
                     array_push($return_array, $value);
                 }
             }
             return $return_array;
         } else {
             return null;
         }
     } else {
         return $project_array;
     }
 }