Exemplo n.º 1
0
 public static function finished_projects()
 {
     global $user;
     $sum_projects = Project_Wrapper::count_user_projects($user->get_user_id());
     $sum_finished_projects = Project_Wrapper::count_user_finished_projects($user->get_user_id());
     $template = new HTMLTemplate("project/home/summary/my_finished_projects.html");
     $template->set_var("finished_projects", $sum_finished_projects . "/" . $sum_projects);
     return $template->get_string();
 }
Exemplo n.º 2
0
 /**
  * @param string $json_argument_array
  * @return integer
  * @throws ProjectSecurityAccessDeniedException
  * @throws ProjectIDMissingException
  */
 public static function count_project_permissions($json_argument_array)
 {
     global $user, $project_security;
     $argument_array = json_decode($json_argument_array);
     $project_id = $argument_array[1];
     if (is_numeric($project_id)) {
         $project = new Project($project_id);
         $project_permission_array = ProjectPermission::list_entries_by_project_id($project_id);
         if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(2, false) == true or $project_security->is_access(4, false) == true or $project_security->is_access(7, false) == true) {
             return Project_Wrapper::count_project_permissions($project_id);
         } else {
             throw new ProjectSecurityAccessDeniedException();
         }
     } else {
         throw new ProjectIDMissingException();
     }
 }
Exemplo n.º 3
0
 /**
  * @param string $json_argument_array
  * @return integer
  * @throws ItemIDMissingException
  */
 public static function count_projects_by_item_id($json_argument_array)
 {
     global $user;
     $argument_array = json_decode($json_argument_array);
     $item_id = $argument_array[0][1];
     if (is_numeric($item_id)) {
         return Project_Wrapper::count_projects_by_item_id($item_id, $user->is_admin());
     } else {
         throw new ItemIDMissingException();
     }
 }
Exemplo n.º 4
0
 /**
  * @param string $json_argument_array
  * @return integer
  * @throws ProjectIDMissingException
  */
 public static function count_project_tasks($json_argument_array)
 {
     $argument_array = json_decode($json_argument_array);
     $project_id = $argument_array[1];
     if (is_numeric($project_id)) {
         return Project_Wrapper::count_project_tasks($project_id);
     } else {
         throw new ProjectIDMissingException();
     }
 }
Exemplo n.º 5
0
 /**
  * @param string $json_argument_array
  * @return integer
  * @throws BaseUserAccessDeniedException
  */
 public static function count_status($json_argument_array)
 {
     global $user;
     if ($user->is_admin()) {
         return Project_Wrapper::count_list_project_status();
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
Exemplo n.º 6
0
 /**
  * @param string $json_argument_array
  * @return integer
  * @throws BaseAjaxArgumentMissingException
  */
 public static function count_projects($json_argument_array)
 {
     $argument_array = json_decode($json_argument_array);
     if (is_array($argument_array)) {
         $string = $argument_array[0][1];
         $project_id_array = $argument_array[1][1];
         $item_type_array = $argument_array[2][1];
         return Project_Wrapper::count_data_search($string, $project_id_array, $item_type_array);
     } else {
         throw new BaseAjaxArgumentMissingException();
     }
 }
Exemplo n.º 7
0
 /**
  * @see ProjectItemInterface::unlink_item_full()
  * @return bool
  * @throws ProjectItemUnlinkException
  */
 public function unlink_item_full()
 {
     global $transaction;
     if ($this->item_id) {
         $transaction_id = $transaction->begin();
         if (Project_Wrapper::delete_data_entity_sub_item_links($this->item_id) == false) {
             if ($transaction_id != null) {
                 $transaction->rollback($transaction_id);
             }
             throw new ProjectItemUnlinkException(true, "Data-Entity Sub-Item delete failed");
         }
         if (ProjectHasItem_Access::delete_sub_items($this->item_id) == false) {
             if ($transaction_id != null) {
                 $transaction->rollback($transaction_id);
             }
             throw new ProjectItemUnlinkException(true, "Sub-Item delete failed");
         }
         $project_has_item_pk_array = ProjectHasItem_Access::list_entries_by_item_id($this->item_id);
         if (is_array($project_has_item_pk_array)) {
             if (count($project_has_item_pk_array) >= 1) {
                 foreach ($project_has_item_pk_array as $key => $value) {
                     $project_has_item = new ProjectHasItem_Access($value);
                     if ($project_has_item->delete() == false) {
                         if ($transaction_id != null) {
                             $transaction->rollback($transaction_id);
                         }
                         throw new ProjectItemUnlinkExecption(true, "Database delete failed");
                     }
                 }
                 if ($transaction_id != null) {
                     $transaction->commit($transaction_id);
                 }
                 return true;
             } else {
                 return true;
             }
         } else {
             throw new ProjectItemUnlinkExecption(false, "Item not linked");
         }
     } else {
         throw new ProjectItemUnlinkExecption();
     }
 }
Exemplo n.º 8
0
 /**
  * @param string $json_argument_array
  * @return integer
  * @throws BaseAjaxArgumentMissingException
  */
 public static function count_projects($json_argument_array)
 {
     $argument_array = json_decode($json_argument_array);
     if (is_array($argument_array)) {
         $name = $argument_array[0][1];
         $template_array = $argument_array[1][1];
         $organisation_unit_array = $argument_array[2][1];
         return Project_Wrapper::count_search_projects_without_subprojects($name, $template_array, $organisation_unit_array);
     } else {
         throw new BaseAjaxArgumentMissingException();
     }
 }