/** * @throws OrganisationUnitIDMissingException */ public static function detail() { global $user; if ($_GET['ou_id']) { $organisation_unit = new OrganisationUnit($_GET['ou_id']); $template = new HTMLTemplate("organisation_unit/organisation_unit_detail.html"); $template->set_var("title", $organisation_unit->get_name()); if ($user->is_admin() == true) { $paramquery = $_GET; $paramquery['nav'] = "administration"; $paramquery['run'] = "organisation_unit"; $paramquery['action'] = "detail"; $paramquery['id'] = $_GET['ou_id']; unset($paramquery['ou_id']); $params = http_build_query($paramquery, '', '&'); $template->set_var("admin_params", $params); $template->set_var("is_owner", true); } else { $template->set_var("is_owner", false); } // OWNERS $organisation_unit_owner_array = $organisation_unit->list_owners(12); if (is_array($organisation_unit_owner_array) and count($organisation_unit_owner_array) >= 1) { $ou_owners = null; foreach ($organisation_unit_owner_array as $key => $value) { if ($value == $user->get_user_id()) { $paramquery = $_GET; $paramquery['nav'] = "administration"; $paramquery['run'] = "organisation_unit"; $paramquery['action'] = "detail"; $paramquery['id'] = $_GET['ou_id']; unset($paramquery['ou_id']); $params = http_build_query($paramquery, '', '&'); $template->set_var("admin_params", $params); $template->set_var("is_owner", true); } $owner = new User($value); $owner_paramquery = $_GET; $owner_paramquery['run'] = "common_dialog"; $owner_paramquery['dialog'] = "user_detail"; $owner_paramquery['id'] = $value; $owner_params = http_build_query($owner_paramquery, '', '&'); if ($ou_owners) { $ou_owners .= ", <a href='index.php?" . $owner_params . "'>" . $owner->get_full_name(true) . "</a>"; } else { $ou_owners .= "<a href='index.php?" . $owner_params . "'>" . $owner->get_full_name(true) . "</a>"; } } } else { $ou_owners = "<span class='italic'>none</span>"; } $number_of_owners = $organisation_unit->get_number_of_owners(); $owner_list_paramquery = $_GET; $owner_list_paramquery['run'] = "common_dialog"; $owner_list_paramquery['dialog'] = "ou_detail"; $owner_list_paramquery['action'] = "list_owners"; $owner_list_paramquery['ou_id'] = $_GET['ou_id']; $owner_list_params = http_build_query($owner_list_paramquery, '', '&'); if ($number_of_owners > 12) { $number_of_owners = $number_of_owners - 12; $ou_owners .= " (+ <a href='index.php?" . $owner_list_params . "'>" . $number_of_owners . " more</a>)"; } else { $ou_owners .= " (<a href='index.php?" . $owner_list_params . "'>list</a>)"; } $template->set_var("owners", $ou_owners); // LEADERS $organisation_unit_leader_array = $organisation_unit->list_leaders(12); if (is_array($organisation_unit_leader_array) and count($organisation_unit_leader_array) >= 1) { $ou_leaders = null; foreach ($organisation_unit_leader_array as $key => $value) { $leader = new User($value); $leader_paramquery = $_GET; $leader_paramquery['run'] = "common_dialog"; $leader_paramquery['dialog'] = "user_detail"; $leader_paramquery['id'] = $value; $leader_params = http_build_query($leader_paramquery, '', '&'); if ($ou_leaders) { $ou_leaders .= ", <a href='index.php?" . $leader_params . "'>" . $leader->get_full_name(true) . "</a>"; } else { $ou_leaders .= "<a href='index.php?" . $leader_params . "'>" . $leader->get_full_name(true) . "</a>"; } } } else { $ou_leaders = "<span class='italic'>none</span>"; } $number_of_leaders = $organisation_unit->get_number_of_leaders(); $leader_list_paramquery = $_GET; $leader_list_paramquery['run'] = "common_dialog"; $leader_list_paramquery['dialog'] = "ou_detail"; $leader_list_paramquery['action'] = "list_leaders"; $leader_list_paramquery['ou_id'] = $_GET['ou_id']; $leader_list_params = http_build_query($leader_list_paramquery, '', '&'); if ($number_of_leaders > 12) { $number_of_leaders = $number_of_leaders - 12; $ou_leaders .= " (+ <a href='index.php?" . $leader_list_params . "'>" . $number_of_leaders . " more</a>)"; } else { $ou_leaders .= " (<a href='index.php?" . $leader_list_params . "'>list</a>)"; } $template->set_var("leaders", $ou_leaders); // MEMBERS $organisation_unit_member_array = $organisation_unit->list_members(12); if (is_array($organisation_unit_member_array) and count($organisation_unit_member_array) >= 1) { $ou_members = null; foreach ($organisation_unit_member_array as $key => $value) { $member = new User($value); $member_paramquery = $_GET; $member_paramquery['run'] = "common_dialog"; $member_paramquery['dialog'] = "user_detail"; $member_paramquery['id'] = $value; $member_params = http_build_query($member_paramquery, '', '&'); if ($ou_members) { $ou_members .= ", <a href='index.php?" . $member_params . "'>" . $member->get_full_name(true) . "</a>"; } else { $ou_members .= "<a href='index.php?" . $member_params . "'>" . $member->get_full_name(true) . "</a>"; } } } else { $ou_members = "<span class='italic'>none</span>"; } $number_of_users = $organisation_unit->get_number_of_users(); $member_list_paramquery = $_GET; $member_list_paramquery['run'] = "common_dialog"; $member_list_paramquery['dialog'] = "ou_detail"; $member_list_paramquery['action'] = "list_members"; $member_list_paramquery['ou_id'] = $_GET['ou_id']; $member_list_params = http_build_query($member_list_paramquery, '', '&'); if ($number_of_users > 12) { $number_of_users = $number_of_users - 12; $ou_members .= " (+ <a href='index.php?" . $member_list_params . "'>" . $number_of_users . " more</a>)"; } else { $ou_members .= " (<a href='index.php?" . $member_list_params . "'>list</a>)"; } $template->set_var("members", $ou_members); // QUALITY MANAGERS $organisation_unit_quality_manager_array = $organisation_unit->list_quality_managers(12); if (is_array($organisation_unit_quality_manager_array) and count($organisation_unit_quality_manager_array) >= 1) { $ou_quality_managers = null; foreach ($organisation_unit_quality_manager_array as $key => $value) { $quality_manager = new User($value); $quality_manager_paramquery = $_GET; $quality_manager_paramquery['run'] = "common_dialog"; $quality_manager_paramquery['dialog'] = "user_detail"; $quality_manager_paramquery['id'] = $value; $quality_manager_params = http_build_query($quality_manager_paramquery, '', '&'); if ($ou_quality_managers) { $ou_quality_managers .= ", <a href='index.php?" . $quality_manager_params . "'>" . $quality_manager->get_full_name(true) . "</a>"; } else { $ou_quality_managers .= "<a href='index.php?" . $quality_manager_params . "'>" . $quality_manager->get_full_name(true) . "</a>"; } } } else { $ou_quality_managers = "<span class='italic'>none</span>"; } $number_of_quality_managers = $organisation_unit->get_number_of_quality_managers(); $quality_manager_list_paramquery = $_GET; $quality_manager_list_paramquery['run'] = "common_dialog"; $quality_manager_list_paramquery['dialog'] = "ou_detail"; $quality_manager_list_paramquery['action'] = "list_quality_managers"; $quality_manager_list_paramquery['ou_id'] = $_GET['ou_id']; $quality_manager_list_params = http_build_query($quality_manager_list_paramquery, '', '&'); if ($number_of_quality_managers > 12) { $number_of_quality_managers = $number_of_quality_managers - 12; $ou_quality_managers .= " (+ <a href='index.php?" . $quality_manager_list_params . "'>" . $number_of_quality_managers . " more</a>)"; } else { $ou_quality_managers .= " (<a href='index.php?" . $quality_manager_list_params . "'>list</a>)"; } $template->set_var("quality_managers", $ou_quality_managers); // GROUPS $organisation_unit_group_array = $organisation_unit->list_groups(12); if (is_array($organisation_unit_group_array) and count($organisation_unit_group_array) >= 1) { $ou_groups = null; foreach ($organisation_unit_group_array as $key => $value) { $group = new Group($value); $group_paramquery = $_GET; $group_paramquery['run'] = "common_dialog"; $group_paramquery['dialog'] = "group_detail"; $group_paramquery['id'] = $value; $group_params = http_build_query($group_paramquery, '', '&'); if ($ou_groups) { $ou_groups .= ", <a href='index.php?" . $group_params . "'>" . $group->get_name() . "</a>"; } else { $ou_groups .= "<a href='index.php?" . $group_params . "'>" . $group->get_name() . "</a>"; } } } else { $ou_groups = "<span class='italic'>none</span>"; } $number_of_groups = $organisation_unit->get_number_of_groups(); $group_list_paramquery = $_GET; $group_list_paramquery['run'] = "common_dialog"; $group_list_paramquery['dialog'] = "ou_detail"; $group_list_paramquery['action'] = "list_groups"; $group_list_paramquery['ou_id'] = $_GET['ou_id']; $group_list_params = http_build_query($group_list_paramquery, '', '&'); if ($number_of_groups > 12) { $number_of_groups = $number_of_groups - 12; $ou_groups .= " (+ <a href='index.php?" . $group_list_params . "'>" . $number_of_groups . " more</a>)"; } else { $ou_groups .= " (<a href='index.php?" . $group_list_params . "'>list</a>)"; } $template->set_var("groups", $ou_groups); $module_link_array = ModuleLink::list_links_by_type("ou_detail_buttons"); if (is_array($module_link_array) and count($module_link_array) >= 1) { $content_array = array(); $counter = 0; foreach ($module_link_array as $key => $value) { $button_template = new HTMLTemplate($value['file']); $button_paramquery = array(); $button_paramquery['username'] = $_GET['username']; $button_paramquery['session_id'] = $_GET['session_id']; if (is_array($value['array']) and count($value['array']) >= 1) { foreach ($value['array'] as $array_key => $array_value) { if (strpos($array_value, "%") === 0 and strpos($array_value, "%", 1) !== false) { $array_value_key = strtolower(str_replace("%", "", $array_value)); if ($_GET[$array_value_key]) { $button_paramquery[$array_key] = $_GET[$array_value_key]; } } else { $button_paramquery[$array_key] = $array_value; } } } $button_params = http_build_query($button_paramquery, '', '&'); $button_template->set_var("params", $button_params); $content_array[$counter]['content'] = $button_template->get_string(); $counter++; } $template->set_var("OU_FOOTER_ARRAY", $content_array); } $template->output(); } else { throw new OrganisationUnitIDMissingException(); } }
/** * @see ProjectSecurityInterface::change_ou_user_permission() * @param integer $leader_id * @return bool * @throws ProjectSecurityChangeException */ public function change_ou_user_permission($organisation_unit_id) { if (is_numeric($organisation_unit_id)) { if (ProjectPermission::delete_entries_by_project_id_and_intention($this->project_id, 2) == true and ProjectPermission::delete_entries_by_project_id_and_intention($this->project_id, 5) == true) { $organisation_unit = new OrganisationUnit($organisation_unit_id); $leader_array = $organisation_unit->list_leaders($organisation_unit_id); if (is_array($leader_array) and count($leader_array) >= 1) { foreach ($leader_array as $key => $value) { try { $project_permission = new ProjectPermissionUser(null); $project_permission->create($value, $project_id, (int) Registry::get_value("project_leader_default_permission"), null, 2); } catch (ProjectPermissionUserException $e) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectSecurityChangeException(); } } } $quality_manager_array = $organisation_unit->list_quality_managers(); if (is_array($quality_manager_array) and count($quality_manager_array) >= 1) { foreach ($quality_manager_array as $key => $value) { try { $project_permission = new ProjectPermissionUser(null); $project_permission->create($value, $project_id, (int) Registry::get_value("project_quality_manager_default_permission"), null, 5); } catch (ProjectPermissionUserException $e) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ProjectSecurityChangeException(); } } } return true; } else { throw new ProjectSecurityChangeException("Cannot delete Entries"); } } else { throw new ProjectSecurityChangeException("Missing Information"); } }
/** * @see ProjectInterface::create() * @param integer $organisation_unit_id * @param integer $parent_project_id * @param string $name * @param integer $owner_id * @param integer $template_id * @param string $description * @return integer * @throws ProjectCreateException * @throws ProjectCreateProjectExistsException * @throws ProjectCreateStatusException * @throws ProjectCreateFolderException * @throws ProjectCreateStatusFolderException * @throws ProjectCreateStatusSubFolderException * @throws ProjectCreateSupplementaryFolderException * @throws ProjectCreateDescriptionException * @throws ProjectCreateMasterDataException * @throws ProjectCreatePermissionUserException * @throws ProjectCreatePermissionLeaderException * @throws ProjectCreatePermissionGroupException * @throws ProjectCreatePermissionOrganisationUnitException * @throws ProjectCreatePermissionQualityManagerException */ public function create($organisation_unit_id, $parent_project_id, $name, $owner_id, $template_id, $description) { global $transaction; if ($organisation_unit_id xor $parent_project_id) { if ($name and $owner_id and $template_id and $description and $this->project) { if ($organisation_unit_id) { $organisation_unit = new OrganisationUnit($organisation_unit_id); if ($organisation_unit->is_permission($owner_id)) { if (self::exist_project_name($organisation_unit_id, null, $name) == true) { throw new ProjectCreateProjectExistsException("Project already exists in this Organisation Unit"); } } else { throw new ProjectCreateException("Cannot access on this Organisation Unit"); } } else { if (self::exist_project_name(null, $parent_project_id, $name) == true) { throw new ProjectCreateProjectExistsException("Project already exists in this Project"); } } $transaction_id = $transaction->begin(); $user = new User($owner_id); $project_user = new ProjectUserData($owner_id); $project_quota = $project_user->get_quota(); // Create Project if (($project_id = $this->project->create($organisation_unit_id, $parent_project_id, $name, $owner_id, $template_id, $project_quota)) == null) { if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateException("Could not create Project in DB"); } else { self::__construct($project_id); $project_template = new ProjectTemplate($template_id); $project_all_status_array = $project_template->get_all_status(); $project_has_project_status = new ProjectHasProjectStatus_Access(null); if ($project_has_project_status->create($project_id, $project_all_status_array[0]) != true) { if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateStatusException("Could not create status"); } if ($organisation_unit_id) { $base_folder_id = constant("PROJECT_FOLDER_ID"); } else { $base_folder_id = ProjectFolder::get_folder_by_project_id($parent_project_id); } $base_folder = Folder::get_instance($base_folder_id); $path = new Path($base_folder->get_path()); $path->add_element($project_id); $project_folder = new ProjectFolder(null); if (($folder_id = $project_folder->create($project_id, $base_folder_id)) == null) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateFolderException("Could not create main folder"); } // Create Supplementary Folder $supplementary_path = new Path($path->get_path_string()); $supplementary_path->add_element("supplementary"); $supplementary_folder = Folder::get_instance(null); if ($supplementary_folder->create("supplementary", $folder_id, $supplementary_path->get_path_string(), $owner_id, null) == null) { $project_folder->delete(); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateSupplementaryFolderException("Could not create supplementary folder"); } // Status Folder $folder_array = array(); foreach ($project_all_status_array as $key => $value) { $project_status_array = $project_template->get_status_requirements($value); if (is_array($project_status_array) and count($project_status_array) >= 1) { foreach ($project_status_array as $status_key => $status_value) { if (!in_array($value, $folder_array)) { array_push($folder_array, $value); } } } } foreach ($folder_array as $key => $value) { $projet_status_folder = new ProjectStatusFolder(null); if (($status_folder_id = $projet_status_folder->create($project_id, $value)) == null) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateStatusFolderException("Could not create status folder"); } $project_status = new ProjectStatus($value); $project_status_requirements = $project_template->get_status_requirements($value); // Create Subfolder $sub_folder_array = array(); foreach ($project_status_requirements as $sub_key => $sub_value) { if (($sub_value['type'] == "file" or $sub_value['type'] == "value") and $sub_value['folder']) { if (array_search(trim($sub_value['folder']), $sub_folder_array) === false) { array_push($sub_folder_array, trim($sub_value['folder'])); } } } if (is_array($sub_folder_array) and count($sub_folder_array) >= 1) { foreach ($sub_folder_array as $sub_key => $sub_value) { $folder_name = strtolower(trim($sub_value)); $folder_name = str_replace(" ", "-", $folder_name); $folder_path = new Path($projet_status_folder->get_path()); $folder_path->add_element($folder_name); $sub_folder = Folder::get_instance(null); if ($sub_folder->create($sub_value, $status_folder_id, $folder_path->get_path_string(), $user->get_user_id(), null) == null) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateStatusSubFolderException("Could not create status sub folder"); } } } } // Create Project Description $value = Value::get_instance(null); if ($value->create($folder_id, $owner_id, 2, $description) == null) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateDescriptionException("Could not create description value"); } $project_item = new ProjectItem($project_id); $project_item->set_gid(1); $project_item->set_status_id(1); $project_item->set_item_id($value->get_item_id()); if ($project_item->link_item() == false) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateDescriptionException("Could not create description item link"); } if ($project_item->set_required(true) == false) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateDescriptionException("Could not create description item role"); } // Create Project Master Data if ($this->template_data_array and is_numeric($this->template_data_type_id)) { $value = Value::get_instance(null); if ($value->create($folder_id, $owner_id, $this->template_data_type_id, $this->template_data_array) == null) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateMasterDataException("Could not create master-data value"); } $project_item = new ProjectItem($project_id); $project_item->set_gid(1); $project_item->set_status_id(1); $project_item->set_item_id($value->get_item_id()); if ($project_item->link_item() == false) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateMasterDataException("Could not create master-data item link"); } if ($project_item->set_required(true) == false) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreateMasterDataException("Could not create master-data item role"); } } // Permissions if ($organisation_unit_id) { $organisation_unit = new OrganisationUnit($organisation_unit_id); try { $project_permission = new ProjectPermissionUser(null); $project_permission->create($owner_id, $project_id, (int) Registry::get_value("project_user_default_permission"), null, 1); } catch (ProjectPermissionUserException $e) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreatePermissionUserException("Could not create user/owner permission"); } $leader_array = $organisation_unit->list_leaders(); if (is_array($leader_array) and count($leader_array) >= 1) { foreach ($leader_array as $key => $value) { try { $project_permission = new ProjectPermissionUser(null); $project_permission->create($value, $project_id, (int) Registry::get_value("project_leader_default_permission"), null, 2); } catch (ProjectPermissionUserException $e) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreatePermissionLeaderException("Could not create leader permission"); } } } try { $project_permission = new ProjectPermissionOrganisationUnit(null); $project_permission->create($organisation_unit_id, $project_id, (int) Registry::get_value("project_organisation_unit_default_permission"), null, 3); } catch (ProjectPermissionOrganisationUnitException $e) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreatePermissionOrganisationUnitException("Could not create Organisation Unit permission"); } $quality_manager_array = $organisation_unit->list_quality_managers(); if (is_array($quality_manager_array) and count($quality_manager_array) >= 1) { foreach ($quality_manager_array as $key => $value) { try { $project_permission = new ProjectPermissionUser(null); $project_permission->create($value, $project_id, (int) Registry::get_value("project_quality_manager_default_permission"), null, 5); } catch (ProjectPermissionUserException $e) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreatePermissionQualityManagerException("Could not create quality-manager permission"); } } } $group_array = $organisation_unit->list_groups(); if (is_array($group_array) and count($group_array) >= 1) { foreach ($group_array as $key => $value) { try { $project_permission = new ProjectPermissionGroup(null); $project_permission->create($value, $project_id, (int) Registry::get_value("project_group_default_permission"), null, 4); } catch (ProjectPermissionGroupException $e) { $project_folder->delete(true, true); if ($transaction_id != null) { $transaction->rollback($transaction_id, false); } throw new ProjectCreatePermissionGroupException("Could not create group permissions"); } } } } self::__construct($project_id); if ($transaction_id != null) { $transaction->commit($transaction_id); } return $project_id; } } else { throw new ProjectCreateException("Needed values are missing"); } } else { throw new ProjectCreateException("Project target is ambiguous"); } }
/** * @throws OrganisationUnitIDMissingException */ public static function detail() { global $user; if ($_GET['id']) { $organisation_unit_id = $_GET['id']; $template = new HTMLTemplate("organisation_unit/admin/organisation_unit/detail.html"); if ($user->is_admin()) { $template->set_var("is_admin", true); } else { $template->set_var("is_admin", false); } $organisation_unit = new OrganisationUnit($organisation_unit_id); $template->set_var("name", $organisation_unit->get_name()); $template->set_var("title", $organisation_unit->get_name()); $paramquery = $_GET; $paramquery['action'] = "rename"; $params = http_build_query($paramquery, '', '&'); $template->set_var("name_params", $params); // OWNERS $organisation_unit_owner_array = $organisation_unit->list_owners(12); if (is_array($organisation_unit_owner_array) and count($organisation_unit_owner_array) >= 1) { $ou_owners = null; foreach ($organisation_unit_owner_array as $key => $value) { $owner = new User($value); if ($ou_owners) { $ou_owners .= ", " . $owner->get_full_name(true); } else { $ou_owners .= $owner->get_full_name(true); } } } else { $ou_owners = "<span class='italic'>none</span>"; } $number_of_owners = $organisation_unit->get_number_of_owners(); if ($number_of_owners > 12) { $number_of_owners = $number_of_owners - 12; $ou_owners .= " (+ " . $number_of_owners . " more)"; } $template->set_var("owners", $ou_owners); // LEADERS $organisation_unit_leader_array = $organisation_unit->list_leaders(12); if (is_array($organisation_unit_leader_array) and count($organisation_unit_leader_array) >= 1) { $ou_leaders = null; foreach ($organisation_unit_leader_array as $key => $value) { $leader = new User($value); if ($ou_leaders) { $ou_leaders .= ", " . $leader->get_full_name(true); } else { $ou_leaders .= $leader->get_full_name(true); } } } else { $ou_leaders = "<span class='italic'>none</span>"; } $number_of_leaders = $organisation_unit->get_number_of_leaders(); if ($number_of_leaders > 12) { $number_of_leaders = $number_of_leaders - 12; $ou_leaders .= " (+ " . $number_of_leaders . " more)"; } $template->set_var("leaders", $ou_leaders); // MEMBERS $organisation_unit_member_array = $organisation_unit->list_members(12); if (is_array($organisation_unit_member_array) and count($organisation_unit_member_array) >= 1) { $ou_members = null; foreach ($organisation_unit_member_array as $key => $value) { $member = new User($value); if ($ou_members) { $ou_members .= ", " . $member->get_full_name(true); } else { $ou_members .= $member->get_full_name(true); } } } else { $ou_members = "<span class='italic'>none</span>"; } $number_of_users = $organisation_unit->get_number_of_users(); if ($number_of_users > 12) { $number_of_users = $number_of_users - 12; $ou_members .= " (+ " . $number_of_users . " more)"; } $template->set_var("members", $ou_members); // QUALITY MANAGERS $organisation_unit_quality_manager_array = $organisation_unit->list_quality_managers(12); if (is_array($organisation_unit_quality_manager_array) and count($organisation_unit_quality_manager_array) >= 1) { $ou_quality_managers = null; foreach ($organisation_unit_quality_manager_array as $key => $value) { $quality_manager = new User($value); if ($ou_quality_managers) { $ou_quality_managers .= ", " . $quality_manager->get_full_name(true); } else { $ou_quality_managers .= $quality_manager->get_full_name(true); } } } else { $ou_quality_managers = "<span class='italic'>none</span>"; } $number_of_quality_managers = $organisation_unit->get_number_of_quality_managers(); if ($number_of_quality_managers > 12) { $number_of_quality_managers = $number_of_quality_managers - 12; $ou_quality_managers .= " (+ " . $number_of_quality_managers . " more)"; } $template->set_var("quality_managers", $ou_quality_managers); // GROUPS $organisation_unit_group_array = $organisation_unit->list_groups(12); if (is_array($organisation_unit_group_array) and count($organisation_unit_group_array) >= 1) { $ou_groups = null; foreach ($organisation_unit_group_array as $key => $value) { $group = new Group($value); if ($ou_groups) { $ou_groups .= ", " . $group->get_name(); } else { $ou_groups .= $group->get_name(); } } } else { $ou_groups = "<span class='italic'>none</span>"; } $number_of_groups = $organisation_unit->get_number_of_groups(); if ($number_of_groups > 12) { $number_of_groups = $number_of_groups - 12; $ou_groups .= " (+ " . $number_of_groups . " more)"; } $template->set_var("groups", $ou_groups); $template->output(); } else { throw new OrganisationUnitIDMissingException(); } }