/** * select new people from a list @ingroup pages * * userRights have been validated by pageHandler() * * \TODO add additional project-specific check here? */ function projAddPerson() { global $PH; $id = getOnePassedId('prj', ''); # WARNS if multiple; ABORTS if no id found if (!($project = Project::getEditableById($id))) { $PH->abortWarning("ERROR: could not get Project"); } $page = new Page(array('use_jscalendar' => false)); $page->cur_tab = 'projects'; $page->type = __("Edit Project"); $page->title = "{$project->name}"; $page->title_minor = __("Select new team members"); $page->crumbs = build_project_crumbs($project); $page->options[] = new NaviOption(array('target_id' => 'projAddPerson')); echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . "pages/person.inc.php"; require_once confGet('DIR_STREBER') . "render/render_form.inc.php"; ### build hash of already added person ### $pps = $project->getProjectPeople(array('alive_only' => true, 'visible_only' => false)); $pp_hash = array(); foreach ($pps as $pp) { $pp_hash[$pp->person] = true; } ### filter already added people ### $people = array(); if ($pers = Person::getPeople()) { foreach ($pers as $p) { if (!isset($pp_hash[$p->id])) { $people[] = $p; } } } $list = new ListBlock_people(); unset($list->columns['personal_phone']); unset($list->columns['office_phone']); unset($list->columns['mobile_phone']); unset($list->columns['companies']); unset($list->columns['changes']); unset($list->columns['last_login']); $list->functions = array(); $list->no_items_html = __("Found no people to add. Go to `People` to create some."); $list->render_list($people); #@@@ probably add dropdown-list with new project-role here $PH->go_submit = 'projAddPersonSubmit'; echo "<input type=hidden name='project' value='{$project->id}'>"; echo "<div class=formbuttons>"; $name = __('Add'); echo "<input class=button type=submit value='{$name}'>"; echo "</div>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Link People to company * * @ingroup pages */ function companyLinkPeople() { global $PH; $id = getOnePassedId('company', 'companies_*'); # WARNS if multiple; ABORTS if no id found $company = Company::getEditableById($id); if (!$company) { $PH->abortWarning("ERROR: could not get Company"); return; } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'company_name')); $page->cur_tab = 'companies'; $page->type = __("Edit Company"); $page->title = sprintf(__("Edit %s"), $company->name); $page->title_minor = __("Add people employed or related"); $page->crumbs = build_company_crumbs($company); $page->options[] = new NaviOption(array('target_id' => 'companyLinkPeople')); echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . 'pages/person.inc.php'; require_once confGet('DIR_STREBER') . 'render/render_form.inc.php'; $people = Person::getPeople(); $list = new ListBlock_people(); $list->show_functions = false; $list->show_icons = false; $list->render_list($people); $PH->go_submit = 'companyLinkPeopleSubmit'; echo "<input type=hidden name='company' value='{$company->id}'>"; echo "<input class=button2 type=submit>"; echo new PageContentClose(); echo new PageHtmlEnd(); }