/** * List project templates @ingroup pages */ function ProjListTemplates() { require_once confGet('DIR_STREBER') . "lists/list_projects.inc.php"; global $PH; global $auth; ### create from handle ### $PH->defineFromHandle(); $page = new Page(); $page->cur_tab = 'projects'; $page->title = __("Project Templates"); if (!($auth->cur_user->user_rights & RIGHT_PROJECT_EDIT)) { $page->title_minor = sprintf(__("relating to %s"), $page->title_minor = $auth->cur_user->name); } else { $page->title_minor = __("admin view"); } $page->type = __('List', 'page type'); $page->options = build_projList_options(); ### render title ### echo new PageHeader(); echo new PageContentOpen(); $list = new ListBlock_projects(); ## Link to start cvs export ## $format = get('format'); if ($format == FORMAT_HTML || $format == '') { $list->footer_links[] = $PH->getCSVLink(); } unset($list->functions['effortNew']); unset($list->functions['projNew']); unset($list->functions['projCreateTemplate']); unset($list->functions['projOpenClose']); $list->title = $page->title; $list->query_options['status_min'] = STATUS_TEMPLATE; $list->query_options['status_max'] = STATUS_TEMPLATE; $list->no_items_html = __("no project templates"); $list->print_automatic(); echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * display projects for person... @ingroup pages */ function personViewProjects() { global $PH; ### get current project ### $id = getOnePassedId('person', 'people_*'); if (!($person = Person::getVisibleById($id))) { $PH->abortWarning("invalid person-id"); return; } $presets = array('all_related_projects' => array('name' => __('all'), 'filters' => array('project_status' => array('id' => 'project_status', 'visible' => true, 'active' => true, 'min' => STATUS_UNDEFINED, 'max' => STATUS_CLOSED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'open_related_projects' => array('name' => __('open'), 'filters' => array('project_status' => array('id' => 'project_status', 'visible' => true, 'active' => true, 'min' => STATUS_UNDEFINED, 'max' => STATUS_OPEN)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list'))), 'closed_related_projects' => array('name' => __('closed'), 'filters' => array('project_status' => array('id' => 'project_status', 'visible' => true, 'active' => true, 'min' => STATUS_BLOCKED, 'max' => STATUS_CLOSED)), 'list_settings' => array('tasks' => array('hide_columns' => array(''), 'style' => 'list')))); ## set preset location ## $preset_location = 'personViewProjects'; $preset_id = 'all_related_projects'; # default value if ($tmp_preset_id = get('preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } ### set cookie setcookie('STREBER_personViewProjects_preset', $preset_id, time() + 60 * 60 * 24 * 30, '', '', 0); } else { if ($tmp_preset_id = get('STREBER_personViewProjects_preset')) { if (isset($presets[$tmp_preset_id])) { $preset_id = $tmp_preset_id; } } } ### create from handle ### $PH->defineFromHandle(array('person' => $person->id, 'preset_id' => $preset_id)); $page = new Page(); $page->cur_tab = 'people'; $page->title = $person->name; $page->title_minor = __('Projects', 'Page title add on'); $page->type = __("Person"); $page->crumbs = build_person_crumbs($person); $page->options = build_person_options($person); echo new PageHeader(); echo new PageContentOpen(); $order_by = get('sort_' . $PH->cur_page->id . "_projects"); require_once confGet('DIR_STREBER') . 'db/class_project.inc.php'; $list = new ListBlock_projects(); unset($list->functions['effortNew']); unset($list->functions['projNew']); unset($list->functions['projNewFromTemplate']); $list->no_items_html = __('no projects yet'); $preset = $presets[$preset_id]; foreach ($preset['filters'] as $f_name => $f_settings) { switch ($f_name) { case 'project_status': $list->filters[] = new ListFilter_status_min(array('value' => $f_settings['min'])); $list->filters[] = new ListFilter_status_max(array('value' => $f_settings['max'])); break; default: trigger_error("Unknown filter setting {$f_name}", E_USER_WARNING); break; } } $filter_empty_folders = isset($preset['filter_empty_folders']) && $preset['filter_empty_folders'] ? true : NULL; $page->print_presets(array('target' => $preset_location, 'project_id' => '', 'preset_id' => $preset_id, 'presets' => $presets, 'person_id' => $person->id)); $list->query_options['order_by'] = $order_by; $list->query_options['person'] = $person->id; $list->print_automatic(); //$list->render_list($efforts); echo '<input type="hidden" name="person" value="' . $person->id . '">'; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * View a company * * @ingroup pages */ function companyView() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'render/render_wiki.inc.php'; ### get current company ### $id = getOnePassedId('company', 'companies_*'); $company = Company::getVisibleById($id); if (!$company) { $PH->abortWarning("invalid company-id"); return; } ## is viewed by user ## $company->nowViewedByUser(); $company->validateView(); ### create from handle ### $PH->defineFromHandle(array('company' => $company->id)); $page = new Page(); $page->cur_tab = 'companies'; $page->title = $company->name; $page->title_minor = __("Overview"); $page->type = __("Company"); ### breadcrumbs ### $page->crumbs = build_company_crumbs($company); ### page functions ### $page->add_function(new PageFunctionGroup(array('name' => __('edit')))); $page->add_function(new PageFunction(array('target' => 'companyEdit', 'params' => array('company' => $company->id), 'icon' => 'edit', 'tooltip' => __('Edit this company'), 'name' => __('Company')))); $item = ItemPerson::getAll(array('person' => $auth->cur_user->id, 'item' => $company->id)); if (!$item || $item[0]->is_bookmark == 0) { $page->add_function(new PageFunction(array('target' => 'itemsAsBookmark', 'params' => array('company' => $company->id), 'tooltip' => __('Mark this company as bookmark'), 'name' => __('Bookmark')))); } else { $page->add_function(new PageFunction(array('target' => 'itemsRemoveBookmark', 'params' => array('company' => $company->id), 'tooltip' => __('Remove this bookmark'), 'name' => __('Remove Bookmark')))); } if ($company->state == 1) { $page->add_function(new PageFunction(array('target' => 'companyDelete', 'params' => array('company' => $company->id), 'icon' => 'delete', 'tooltip' => __('Delete this company'), 'name' => __('Delete')))); } $page->add_function(new PageFunctionGroup(array('name' => __('new')))); $page->add_function(new PageFunction(array('target' => 'personNew', 'params' => array('company' => $company->id), 'icon' => 'new', 'tooltip' => __('Create new person for this company'), 'name' => __('Person')))); $page->add_function(new PageFunction(array('target' => 'projNew', 'params' => array('company' => $company->id), 'icon' => 'new', 'tooltip' => __('Create new project for this company'), 'name' => __('Project')))); $page->add_function(new PageFunction(array('target' => 'companyLinkPeople', 'params' => array('company' => $company->id), 'icon' => 'add', 'tooltip' => __('Add existing people to this company'), 'name' => __('People')))); ### render title ### echo new PageHeader(); echo new PageContentOpen_Columns(); $block = new PageBlock(array('title' => __('Summary'), 'id' => 'summary')); $block->render_blockStart(); echo "<div class=text>"; if ($company->comments) { echo wikifieldAsHtml($company, 'comments'); } if ($company->street) { echo '<div class=labeled><label>' . __('Adress') . ':</label>' . asHtml($company->street) . '</div>'; } if ($company->zipcode) { echo '<div class=labeled><label></label>' . asHtml($company->zipcode) . '</div>'; } if ($company->phone) { echo '<div class=labeled><label>' . __('Phone') . ':</label>' . asHtml($company->phone) . '</div>'; } if ($company->fax) { echo '<div class=labeled><label>' . __('Fax') . ':</label>' . asHtml($company->fax) . '</div>'; } if ($company->homepage) { echo '<div class=labeled><label>' . __('Web') . ':</label>' . url2linkExtern($company->homepage) . '</div>'; } if ($company->intranet) { echo '<div class=labeled><label>' . __('Intra') . ':</label>' . url2linkExtern($company->intranet) . '</div>'; } if ($company->email) { echo '<div class=labeled><label>' . __('Mail') . ':</label>' . url2linkMail($company->email) . '</div>'; } $sum = 0; foreach ($company->getProjects() as $p) { $sum += $p->getOpenEffortsSum(); } if ($sum > 0) { echo "<div class=text>"; echo '<div class=labeled><label>' . __('Open efforts') . ':</label>' . round($sum / 60 / 60, 1) . 'h</div>'; echo "</div>"; } echo "</div>"; $block->render_blockEnd(); require_once confGet('DIR_STREBER') . 'pages/person.inc.php'; $list = new ListBlock_people(); $people = $company->getPeople(); $list->title = __('related People'); $list->id = "related_people"; unset($list->columns['tagline']); unset($list->columns['nickname']); unset($list->columns['profile']); unset($list->columns['projects']); unset($list->columns['personal_phone']); unset($list->columns['office_phone']); unset($list->columns['companies']); unset($list->columns['changes']); unset($list->columns['last_login']); unset($list->functions['personDelete']); unset($list->functions['personEditRights']); /** * \NOTE We should provide a list-function to link more * people to this company. But therefore we would need to * pass the company's id, which is not possible right now... */ $list->add_function(new ListFunction(array('target' => $PH->getPage('companyLinkPeople')->id, 'name' => __('Link People'), 'id' => 'companyLinkPeople', 'icon' => 'add'))); $list->add_function(new ListFunction(array('target' => $PH->getPage('companyPeopleDelete')->id, 'name' => __('Remove person from company'), 'id' => 'companyPeopleDelete', 'icon' => 'sub', 'context_menu' => 'submit'))); if ($auth->cur_user->user_rights & RIGHT_COMPANY_EDIT) { $list->no_items_html = $PH->getLink('companyLinkPeople', __('link existing Person'), array('company' => $company->id)) . " " . __("or") . " " . $PH->getLink('personNew', __('create new'), array('company' => $company->id)); } else { $list->no_items_html = __("no people related"); } $list->render_list($people); //$list->print_automatic($people); echo new PageContentNextCol(); require_once confGet('DIR_STREBER') . 'lists/list_projects.inc.php'; $order_by = get('sort_' . $PH->cur_page->id . "_projects"); $list = new ListBlock_projects(); $list->title = __("Active projects"); $list->id = "active_projects"; $list->groupings = NULL; $list->block_functions = NULL; unset($list->columns['company']); unset($list->functions['projNew']); unset($list->functions['projDelete']); $list->query_options['status_min'] = STATUS_UPCOMING; $list->query_options['status_max'] = STATUS_OPEN; $list->query_options['company'] = $company->id; if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE) { $list->no_items_html = $PH->getLink('projNew', __('Create new project'), array('company' => $company->id)) . " " . __(" Hint: for already existing projects please edit those and adjust company-setting."); } else { $list->no_items_html = __("no projects yet"); } $list->print_automatic(); $list = new ListBlock_projects(); $list->groupings = NULL; $list->block_functions = NULL; $list->title = __("Closed projects"); $list->id = "closed_projects"; unset($list->columns['company']); unset($list->functions['projNew']); unset($list->functions['projDelete']); $list->query_options['status_min'] = STATUS_BLOCKED; $list->query_options['status_max'] = STATUS_CLOSED; $list->query_options['company'] = $company->id; $list->print_automatic(); ### add company-id ### # note: some pageFunctions like personNew can use this for automatical linking echo "<input type=hidden name=company value='{$company->id}'>"; echo new PageContentClose(); echo new PageHtmlEnd(); }