/** * render separating row */ public function render(&$item) { require_once "db/class_company.inc.php"; if (isset($item->company)) { if ($c = Company::getVisibleById($item->company)) { return $c->getLink(); } else { return __("Company"); } } else { trigger_error("can't group for company", E_USER_NOTICE); return "---"; } }
/** * Create new comment * * New comments have to be attached to an option. So the major part of this code * deals with finding out, to what the comment belongs to. * * @ingroup pages * * * - requires comment, task or comments_* - param */ function commentNew() { global $PH; global $COMMENTTYPE_VALUES; $project = NULL; $name = get('new_name') ? get('new_name') : __('New Comment', 'Default name of new comment'); ### build new object ### $newComment = new Comment(array('id' => 0, 'name' => $name)); ### try single project-id ### if ($id = getOnePassedId('prj', 'projects_*', false)) { #no not abort if not found if ($project = Project::getVisibleById($id)) { $newComment->project = $project->id; } } ### try single task-id ### $task = NULL; $comment = NULL; if ($id = getOnePassedId('tsk', 'tasks_*', false)) { #no not abort if not found if ($task = Task::getVisibleById($id)) { $newComment->task = $task->id; ### try to figure project-id from task ### if (!$newComment->project) { $newComment->project = $task->getProject()->id; } } } ### subtask? ### if (!$task) { if ($task_id = get('parent_task')) { if ($task = Task::getVisibleById($task_id)) { $newComment->task = $task->id; ### try to figure project-id from task ### if (!$newComment->project) { $newComment->project = $task->getProject()->id; } } } } ### try single company-id ### if ($id = getOnePassedId('company', 'companies_*', false)) { #no not abort if not found if ($company = Company::getVisibleById($id)) { $newComment->company = $company->id; } } ### try single person-id ### if ($id = getOnePassedId('person', 'people_*', false)) { #no not abort if not found if ($person = Person::getVisibleById($id)) { $newComment->person = $person->id; } } ### try comment on comment ### if ($id = getOnePassedId('comment', 'comments_*', false)) { #no not abort if not found if ($comment = Comment::getById($id)) { $newComment->comment = $comment->id; switch (confGet('REPLY_ON_COMMENT_PREFIX')) { case 0: $newComment->name = ''; break; case 1: $newComment->name = __('Re: ') . $comment->name; break; case 2: $newComment->name = __('Reply to ', 'prefix for name of new comment on another comment') . $comment->name; break; default: $newComment->name = __('Re: ') . $comment->name; break; } $newComment->occasion = $COMMENTTYPE_VALUES['Reply']; } } ### get current project ### if (!$project) { if ($task) { if (!($project = Project::getVisibleById($task->project))) { $PH->abortWarning('invalid project id', ERROR_FATAL); } } else { $PH->abortWarning('can´t access project', ERROR_BUG); } } if (!$task && !$comment) { $PH->abortWarning('need at least comment or task', ERROR_WARNING); } ### set a valid create-level ### $newComment->pub_level = $project->getCurrentLevelCreate(); if ($newComment->pub_level < 1) { ### abort, if not enough rights ### $PH->abortWarning(__('insufficient rights'), ERROR_RIGHTS); } ### render form ### $PH->show('commentEdit', array('comment' => $newComment->id), $newComment); }
function render_tr(&$item, $style = "") { global $PH; $str_url = ""; $str_name = ""; $str_addon = ""; $isDone = ""; $html_details = ""; $link = ""; if ($type = $item->type) { switch ($type) { case ITEM_TASK: require_once "db/class_task.inc.php"; if ($task = Task::getVisibleById($item->id)) { $str_name = asHtml($task->name); $str_url = $PH->getUrl('taskView', array('tsk' => $task->id)); if ($task->status >= STATUS_COMPLETED) { $isDone = "class=isDone"; } if ($prj = Project::getVisibleById($task->project)) { $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id)); $html_details .= __('in', 'very short for IN folder...') . ' ' . $link; if ($tmp = $task->getFolderLinks()) { $html_details .= ' > ' . $tmp; } } } break; case ITEM_COMMENT: require_once "db/class_comment.inc.php"; if ($comment = Comment::getVisibleById($item->id)) { $str_name = asHtml($comment->name); if ($comment->comment) { $str_url = $PH->getUrl('taskView', array('tsk' => $comment->task)); $str_addon = __("(on comment)"); } else { if ($comment->task) { $str_url = $PH->getUrl('taskView', array('tsk' => $comment->task)); $str_addon = __("(on task)"); } else { $str_url = $PH->getUrl('projView', array('prj' => $comment->project)); $str_addon = __("(on project)"); } } } break; case ITEM_PERSON: require_once "db/class_person.inc.php"; if ($person = Person::getVisibleById($item->id)) { $str_name = asHtml($person->name); $str_url = $PH->getUrl('personView', array('person' => $person->id)); } break; case ITEM_EFFORT: require_once "db/class_effort.inc.php"; if ($e = Effort::getVisibleById($item->id)) { $str_name = asHtml($e->name); $str_url = $PH->getUrl('effortEdit', array('effort' => $e->id)); } if ($prj = Project::getVisibleById($e->project)) { $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id)); $html_details .= __('in', 'very short for IN folder...') . ' ' . $link; } break; case ITEM_FILE: require_once "db/class_file.inc.php"; if ($f = File::getVisibleById($item->id)) { $str_name = asHtml($f->org_filename); $str_url = $PH->getUrl('fileView', array('file' => $f->id)); if ($f->status >= STATUS_COMPLETED) { $isDone = "class=isDone"; } if ($prj = Project::getVisibleById($f->project)) { $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id)); $html_details .= __('in', 'very short for IN folder...') . ' ' . $link; } } break; case ITEM_PROJECT: require_once "db/class_project.inc.php"; if ($prj = Project::getVisibleById($item->id)) { $str_name = asHtml($prj->name); $str_url = $PH->getUrl('projView', array('prj' => $prj->id)); if ($prj->status >= STATUS_COMPLETED) { $isDone = "class=isDone"; } } break; case ITEM_COMPANY: require_once "db/class_company.inc.php"; if ($c = Company::getVisibleById($item->id)) { $str_name = asHtml($c->name); $str_url = $PH->getUrl('companyView', array('company' => $c->id)); } break; case ITEM_VERSION: require_once "db/class_task.inc.php"; if ($tsk = Task::getVisibleById($item->id)) { $str_name = asHtml($tsk->name); $str_url = $PH->getUrl('taskView', array('tsk' => $tsk->id)); if ($tsk->status >= STATUS_COMPLETED) { $isDone = "class=isDone"; } if ($prj = Project::getVisibleById($task->project)) { $link = $PH->getLink('projView', $prj->getShort(), array('prj' => $prj->id)); $html_details .= __('in', 'very short for IN folder...') . ' ' . $link; } } break; default: break; } print "<td class='nowrap'><span {$isDone}><a href='{$str_url}'>{$str_name}</a> {$str_addon}</span>"; if ($html_details) { print "<br><span class='sub who'>{$html_details}</span>"; } print "</td>"; } else { $PH->abortWarning("Could not get type of the element.", ERROR_BUG); print "<td> </td>"; } }
/** * Submit changes to a person @ingroup pages */ function personEditSubmit() { global $PH; global $auth; global $g_user_profile_names; global $g_user_profiles; ### cancel ? ### if (get('form_do_cancel')) { if (!$PH->showFromPage()) { $PH->show('home', array()); } exit; } ### Validate form integrity if (!validateFormCrc()) { $PH->abortWarning(__('Invalid checksum for hidden form elements')); } ### get person #### $id = getOnePassedId('person'); ### temporary obj, not in db if ($id == 0) { $person = new Person(array('id' => 0)); } else { if (!($person = Person::getEditableById($id))) { $PH->abortWarning(__("Could not get person")); return; } } ### person category ### $pcategory = get('pcategory'); if ($pcategory != NULL) { if ($pcategory == -1) { $person->category = PCATEGORY_STAFF; } else { if ($pcategory == -2) { $person->category = PCATEGORY_CONTACT; } else { $person->category = $pcategory; } } } ### validate rights ### if ($auth->cur_user->id == $person->id && $auth->cur_user->user_rights & RIGHT_PERSON_EDIT_SELF || $auth->cur_user->user_rights & RIGHT_PERSON_EDIT || $auth->cur_user->user_rights & RIGHT_PERSON_CREATE && $person->id == 0) { $pass = true; } else { $PH->abortWarning(__("not allowed to edit"), ERROR_RIGHTS); } $flag_ok = true; # update valid? # retrieve all possible values from post-data # NOTE: # - this could be an security-issue. # - TODO: as some kind of form-edit-behaviour to field-definition foreach ($person->fields as $f) { $name = $f->name; $f->parseForm($person); } ### rights & theme & profile ### if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT_RIGHTS) { /** * if profile != -1, it will OVERWRITE (or reinit) user_rights * * therefore persEdit set profil to 0 if rights don't fit profile. It will * then be skipped here */ $profile_num = get('person_profile'); if (!is_null($profile_num)) { if ($profile_num != -1) { $person->profile = $profile_num; if (isset($g_user_profiles[$profile_num]['default_user_rights'])) { $rights = $g_user_profiles[$profile_num]['default_user_rights']; /** * add warning on changed profile */ if ($person->user_rights != $rights && $person->id) { new FeedbackHint(__('The changed profile <b>does not affect existing project roles</b>! Those has to be adjusted inside the projects.')); } $person->user_rights = $rights; } else { trigger_error("Undefined profile requested ({$profile_num})", E_USER_ERROR); } } } } ### can login ### if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT_RIGHTS || $auth->cur_user->user_rights & RIGHT_PERSON_CREATE && $auth->cur_user->user_rights & RIGHT_PROJECT_ASSIGN && $person->id == 0) { /** * NOTE, if checkbox is not rendered in editForm, user-account will be disabled! * there seems no way the be sure the checkbox has been rendered, if it is not checked in form */ if ($can_login = get('person_can_login')) { $person->can_login = 1; } else { $person->can_login = 0; } } $period = get('person_notification_period'); ### turn off ### if ($period === 0 || $period === "0") { $person->settings &= USER_SETTING_NOTIFICATIONS ^ RIGHT_ALL; $person->notification_period = 0; } else { $person->settings |= USER_SETTING_NOTIFICATIONS; $person->notification_period = $period; if ($person->can_login && !$person->personal_email && !$person->office_email) { $flag_ok = false; $person->fields['office_email']->required = true; $person->fields['personal_email']->required = true; new FeedbackWarning(__("Sending notifactions requires an email-address.")); } } if (get('person_html_mail')) { $person->settings |= USER_SETTING_HTML_MAIL; } else { $person->settings &= USER_SETTING_HTML_MAIL ^ RIGHT_ALL; } ### effort style ### if ($effort_style = get('person_effort_style')) { if ($effort_style == EFFORT_STYLE_TIMES) { $person->settings &= USER_SETTING_EFFORTS_AS_DURATION ^ RIGHT_ALL; } else { if ($effort_style == EFFORT_STYLE_DURATION) { $person->settings |= USER_SETTING_EFFORTS_AS_DURATION; } else { trigger_error("undefined person effort style", E_USER_WARNING); } } } ### filter own changes ### if (get('person_filter_own_changes')) { $person->settings |= USER_SETTING_FILTER_OWN_CHANGES; } else { $person->settings &= USER_SETTING_FILTER_OWN_CHANGES ^ RIGHT_ALL; } ### enable bookmarks ### if (get('person_enable_bookmarks')) { $person->settings |= USER_SETTING_ENABLE_BOOKMARKS; } else { $person->settings &= USER_SETTING_ENABLE_BOOKMARKS ^ RIGHT_ALL; } if (get('person_enable_efforts')) { $person->settings |= USER_SETTING_ENABLE_EFFORTS; } else { $person->settings &= USER_SETTING_ENABLE_EFFORTS ^ RIGHT_ALL; } $zone = get('person_time_zone'); if ($zone != NULL && $person->time_zone != 1.0 * $zone) { $person->time_zone = 1.0 * $zone; if ($zone == TIME_OFFSET_AUTO) { new FeedbackMessage(__("Using auto detection of time zone requires this user to relogin.")); } else { $person->time_offset = $zone * 60.0 * 60.0; if ($person->id == $auth->cur_user->id) { $auth->cur_user->time_offset = $zone * 60.0 * 60.0; } } } $theme = get('person_theme'); if ($theme != NULL) { $person->theme = $theme; ### update immediately / without page-reload #### if ($person->id == $auth->cur_user->id) { $auth->cur_user->theme = $theme; } } $language = get('person_language'); global $g_languages; if (isset($g_languages[$language])) { $person->language = $language; ### update immediately / without page-reload #### if ($person->id == $auth->cur_user->id) { $auth->cur_user->language = $language; setLang($language); } } $t_nickname = get('person_nickname'); ### check if changed nickname is unique if ($person->can_login || $person->nickname != "") { /** * actually this should be mb_strtolower, but this is not installed by default */ if ($person->nickname != strtolower($person->nickname)) { new FeedbackMessage(__("Nickname has been converted to lowercase")); $person->nickname = strtolower($person->nickname); } ### authentication ### $p_auth = get('person_auth'); if ($p_auth) { $person->ldap = 1; } else { $person->ldap = 0; } if ($p2 = Person::getByNickname($t_nickname)) { # another person with this nick? if ($p2->id != $person->id) { new FeedbackWarning(__("Nickname has to be unique")); $person->fields['nickname']->required = true; $flag_ok = false; } } } ### password entered? ### $t_password1 = get('person_password1'); $t_password2 = get('person_password2'); $flag_password_ok = true; if (($t_password1 || $t_password2) && $t_password1 != "__dont_change__") { ### check if password match ### if ($t_password1 !== $t_password2) { new FeedbackWarning(__("Passwords do not match")); $person->fields['password']->required = true; $flag_ok = false; $flag_password_ok = false; } ### check if password is good enough ### if ($person->can_login) { $password_length = strlen($t_password1); $password_count_numbers = strlen(preg_replace('/[\\d]/', '', $t_password1)); $password_count_special = strlen(preg_replace('/[\\w]/', '', $t_password1)); $password_value = -7 + $password_length + $password_count_numbers * 2 + $password_count_special * 8; if ($password_value < confGet('CHECK_PASSWORD_LEVEL')) { new FeedbackWarning(__("Password is too weak (please add numbers, special chars or length)")); $flag_ok = false; $flag_password_ok = false; } } if ($flag_password_ok) { $person->password = md5($t_password1); } } if ($flag_ok && $person->can_login) { if (!$person->nickname) { new FeedbackWarning(__("Login-accounts require a unique nickname")); $person->fields['nickname']->required = true; $person->fields['nickname']->invalid = true; $flag_ok = false; } } ### repeat form if invalid data ### if (!$flag_ok) { $PH->show('personEdit', NULL, $person); exit; } /** * store indentifier-string for login from notification & reminder - mails */ $person->identifier = $person->calcIdentifierString(); ### insert new object ### if ($person->id == 0) { if ($person->settings & USER_SETTING_NOTIFICATIONS && $person->can_login) { $person->settings |= USER_SETTING_SEND_ACTIVATION; new FeedbackHint(sprintf(__("A notification / activation will be mailed to <b>%s</b> when you log out."), $person->name) . " " . sprintf(__("Read more about %s."), $PH->getWikiLink('notifications'))); } $person->notification_last = getGMTString(time() - $person->notification_period * 60 * 60 * 24 - 1); $person->cookie_string = $person->calcCookieString(); if ($person->insert()) { ### link to a company ### if ($c_id = get('company')) { require_once confGet('DIR_STREBER') . 'db/class_company.inc.php'; if ($c = Company::getVisibleById($c_id)) { require_once confGet('DIR_STREBER') . 'db/class_employment.inc.php'; $e = new Employment(array('id' => 0, 'person' => $person->id, 'company' => $c->id)); $e->insert(); } } ## assigne to project ## require_once confGet('DIR_STREBER') . 'db/class_projectperson.inc.php'; $prj_num = get('assigned_prj'); if (isset($prj_num)) { if ($prj_num != -1) { if ($p = Project::getVisibleById($prj_num)) { $prj_person = new ProjectPerson(array('person' => $person->id, 'project' => $p->id, 'name' => $g_user_profile_names[$person->profile])); $prj_person->insert(); } } } new FeedbackMessage(sprintf(__('Person %s created'), $person->getLink())); } else { new FeedbackError(__("Could not insert object")); } } else { new FeedbackMessage(sprintf(__('Updated settings for %s.'), $person->getLink())); $person->update(); } if ($auth->cur_user->id == $person->id) { $auth->cur_user = $person; } ### notify on change ### $person->nowChangedByUser(); ### store cookie, if accountActivation ### if (get('tuid')) { $auth->removeUserCookie(); $auth->storeUserCookie(); } ### create another person ### if (get('create_another')) { if ($c_id = get('company')) { $PH->show('personNew', array('company' => $c_id)); } else { $PH->show('personNew'); } } else { ### display fromPage #### if (!$PH->showFromPage()) { $PH->show('home', array()); } } }
/** * returns visible object of correct type by an itemId * * this is useful, eg. if you when to access common parameters like name, * regardless of the object's type. * * DbProjectItem::getById() would only load to basic fields. Getting the * complete date required check for type. * * @NOTE: This function causes a awkward dependency to classes derived from * DbProjectItem. It's somehow weird, that this method is placed inside the * parent class. */ public static function getObjectById($id) { $id = intval($id); if (!($item = DbProjectItem::getById($id))) { return NULL; } if ($type = $item->type) { switch ($type) { case ITEM_TASK: require_once "db/class_task.inc.php"; $item_full = Task::getVisibleById($item->id); break; case ITEM_COMMENT: require_once "db/class_comment.inc.php"; $item_full = Comment::getVisibleById($item->id); break; case ITEM_PERSON: require_once "db/class_person.inc.php"; $item_full = Person::getVisibleById($item->id); break; case ITEM_EFFORT: require_once "db/class_effort.inc.php"; $item_full = Effort::getVisibleById($item->id); break; case ITEM_FILE: require_once "db/class_file.inc.php"; $item_full = File::getVisibleById($item->id); break; case ITEM_PROJECT: require_once "db/class_project.inc.php"; $item_full = Project::getVisibleById($item->id); break; case ITEM_COMPANY: require_once "db/class_company.inc.php"; $item_full = Company::getVisibleById($item->id); break; case ITEM_VERSION: require_once "db/class_task.inc.php"; $item_full = Task::getVisibleById($item->id); break; default: $item_full = NULL; } return $item_full; } }
/** * getCompanyLink */ function getCompanyLink($show_long = false) { global $PH; if (!$this->company) { return ""; } require_once confGet('DIR_STREBER') . 'db/class_company.inc.php'; if ($company = Company::getVisibleById($this->company)) { return $company->getLink($show_long); } else { return "-"; } }
function ajaxUserProjects() { global $PH; global $auth; require_once confGet('DIR_STREBER') . 'db/class_company.inc.php'; $projects = array(); if ($q = getOnePassedId("q")) { $all_projects = Project::getAll(); foreach ($all_projects as $p) { if (stristr($p->name, $q) !== false) { $projects[] = $p; } } } else { $projects = Project::getAll(); } $result = array(); foreach ($projects as $p) { $company_name = ""; if ($company = Company::getVisibleById($p->company)) { $company_name = $company->getShort(12); } $result[] = array('name' => $p->name . " – " . $company_name, 'id' => $p->id); } echo json_encode($result); }
/** * edit several bookmarks @ingroup pages */ function itemBookmarkEditMultiple($thebookmarks = NULL) { global $PH; global $auth; global $g_notitychange_period; $is_already_bookmark = array(); $bookmarks = array(); $items = array(); $edit_fields = array('notify_if_unchanged', 'notify_on_change'); $different_fields = array(); # hash containing fieldnames which are different in bookmarks if (!$thebookmarks) { $item_ids = getPassedIds('bookmark', 'bookmarks_*'); foreach ($item_ids as $is) { if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id))) { if ($item = DbProjectItem::getById($bookmark[0]->item)) { $bookmarks[] = $bookmark[0]; $items[] = $item; $is_already_bookmark[$bookmark[0]->id] = true; } } } } else { $item_ids = $thebookmarks; foreach ($item_ids as $is) { if ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 0))) { if ($item = DbProjectItem::getById($bookmark[0]->item)) { $bookmarks[] = $bookmark[0]; $items[] = $item; $is_already_bookmark[$bookmark[0]->id] = false; } } elseif ($bookmark = ItemPerson::getAll(array('item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1))) { if ($item = DbProjectItem::getById($bookmark[0]->item)) { $bookmarks[] = $bookmark[0]; $items[] = $item; $is_already_bookmark[$bookmark[0]->id] = true; } } else { $date = getGMTString(); $bookmark = new ItemPerson(array('id' => 0, 'item' => $is, 'person' => $auth->cur_user->id, 'is_bookmark' => 1, 'notify_if_unchanged' => 0, 'notify_on_change' => 0, 'created' => $date)); if ($item = DbProjectItem::getById($is)) { $bookmarks[] = $bookmark; $items[] = $item; $is_already_bookmark[$bookmark->id] = false; } } } } if (!$items) { $PH->abortWarning(__("Please select some items")); } $page = new Page(); $page->cur_tab = 'home'; $page->options = array(new NaviOption(array('target_id' => 'itemBookmarkEdit', 'name' => __('Edit bookmarks')))); $page->type = __('Edit multiple bookmarks', 'page title'); $page->title = sprintf(__('Edit %s bookmark(s)'), count($items)); $page->title_minor = __('Edit'); echo new PageHeader(); echo new PageContentOpen(); echo "<ol>"; foreach ($items as $item) { ## get item name ## $str_link = ''; if ($type = $item->type) { switch ($type) { case ITEM_TASK: require_once "db/class_task.inc.php"; if ($task = Task::getVisibleById($item->id)) { $str_link = $task->getLink(false); } break; case ITEM_COMMENT: require_once "db/class_comment.inc.php"; if ($comment = Comment::getVisibleById($item->id)) { $str_link = $comment->getLink(false); } break; case ITEM_PERSON: require_once "db/class_person.inc.php"; if ($person = Person::getVisibleById($item->id)) { $str_link = $person->getLink(false); } break; case ITEM_EFFORT: require_once "db/class_effort.inc.php"; if ($e = Effort::getVisibleById($item->id)) { $str_link = $e->getLink(false); } break; case ITEM_FILE: require_once "db/class_file.inc.php"; if ($f = File::getVisibleById($item->id)) { $str_link = $f->getLink(false); } break; case ITEM_PROJECT: require_once "db/class_project.inc.php"; if ($prj = Project::getVisibleById($item->id)) { $str_link = $prj->getLink(false); } break; case ITEM_COMPANY: require_once "db/class_company.inc.php"; if ($c = Company::getVisibleById($item->id)) { $str_link = $c->getLink(false); } break; case ITEM_VERSION: require_once "db/class_task.inc.php"; if ($tsk = Task::getVisibleById($item->id)) { $str_link = $tsk->getLink(false); } break; default: break; } } echo "<li>" . $str_link . "</li>"; } echo "</ol>"; foreach ($bookmarks as $bookmark) { foreach ($edit_fields as $field_name) { if ($bookmark->{$field_name} != $bookmarks[0]->{$field_name}) { $different_fields[$field_name] = true; } } } $block = new PageBlock(array('id' => 'functions')); $block->render_blockStart(); $form = new PageForm(); $form->button_cancel = true; $b = array(); $b[0] = __('no'); $b[1] = __('yes'); if (isset($different_fields['notify_on_change'])) { $b[-1] = '-- ' . __('keep different') . ' --'; $form->add(new Form_Dropdown('notify_on_change', __("Notify on change"), array_flip($b), -1)); } else { $form->add(new Form_Dropdown('notify_on_change', __("Notify on change"), array_flip($b), $bookmarks[0]->notify_on_change)); } $a = array(); foreach ($g_notitychange_period as $key => $value) { $a[$key] = $value; } if (isset($different_fields['notify_if_unchanged'])) { $a[-1] = '-- ' . __('keep different') . ' --'; $form->add(new Form_Dropdown('notify_if_unchanged', __("Notify if unchanged in"), array_flip($a), -1)); } else { $form->add(new Form_Dropdown('notify_if_unchanged', __("Notify if unchanged in"), array_flip($a), $bookmarks[0]->notify_if_unchanged)); } $number = 0; foreach ($bookmarks as $bm) { $form->add(new Form_HiddenField("bookmark_id_{$number}", '', $bm->id)); $form->add(new Form_HiddenField("bookmark_item_{$number}", '', $bm->item)); $form->add(new Form_HiddenField("is_already_bookmark_{$number}", '', $is_already_bookmark[$bm->id])); $number++; } $form->add(new Form_HiddenField("number", '', $number)); echo $form; $block->render_blockEnd(); $PH->go_submit = 'itemBookmarkEditMultipleSubmit'; echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * Submit data of a newly registered person @ingroup pages */ function personRegisterSubmit() { global $PH; global $auth; ### cancel ? ### if (get('form_do_cancel')) { if (!$PH->showFromPage()) { $PH->show('home', array()); } exit; } if (!validateFormCrc()) { $PH->abortWarning(__('Invalid checksum for hidden form elements')); } $person = new Person(array('id' => 0)); $person->user_rights = RIGHT_PERSON_EDIT_SELF; ### person category ### $pcategory = get('pcategory'); if ($pcategory != NULL) { if ($pcategory == -1) { $person->category = PCATEGORY_STAFF; } else { if ($pcategory == -2) { $person->category = PCATEGORY_CONTACT; } else { $person->category = $pcategory; } } } $flag_ok = true; # update valid? # retrieve all possible values from post-data # NOTE: # - this could be an security-issue. # - TODO: as some kind of form-edit-behaviour to field-definition foreach ($person->fields as $f) { $name = $f->name; $f->parseForm($person); } $person->can_login = 1; $period = get('person_notification_period'); ### turn off ### if ($period === 0 || $period === "0") { $person->settings &= USER_SETTING_NOTIFICATIONS ^ RIGHT_ALL; $person->notification_period = 0; } else { $person->settings |= USER_SETTING_NOTIFICATIONS; $person->notification_period = $period; if ($person->can_login && !$person->personal_email && !$person->office_email) { $flag_ok = false; $person->fields['office_email']->required = true; $person->fields['personal_email']->required = true; new FeedbackWarning(__("Sending notifactions requires an email-address.")); } } if (get('person_html_mail')) { $person->settings |= USER_SETTING_HTML_MAIL; } else { $person->settings &= USER_SETTING_HTML_MAIL ^ RIGHT_ALL; } $zone = get('person_time_zone'); if ($zone != NULL && $person->time_zone != 1.0 * $zone) { $person->time_zone = 1.0 * $zone; if ($zone == TIME_OFFSET_AUTO) { new FeedbackMessage(__("Using auto detection of time zone requires this user to relogin.")); } else { $person->time_offset = $zone * 60.0 * 60.0; if ($person->id == $auth->cur_user->id) { $auth->cur_user->time_offset = $zone * 60.0 * 60.0; } } } $theme = get('person_theme'); if ($theme != NULL) { $person->theme = $theme; ### update immediately / without page-reload #### if ($person->id == $auth->cur_user->id) { $auth->cur_user->theme = $theme; } } $language = get('person_language'); global $g_languages; if (isset($g_languages[$language])) { $person->language = $language; ### update immediately / without page-reload #### if ($person->id == $auth->cur_user->id) { $auth->cur_user->language = $language; setLang($language); } } if (!$person->name) { new FeedbackWarning(__("Login-accounts require a full name.")); $person->fields['name']->required = true; $person->fields['name']->invalid = true; $flag_ok = false; } if (!$person->office_email) { new FeedbackWarning(__("Please enter an e-mail address.")); $person->fields['office_email']->required = true; $person->fields['office_email']->invalid = true; $flag_ok = false; } $t_nickname = get('person_nickname'); if (!$person->nickname) { new FeedbackWarning(__("Login-accounts require a unique nickname")); $person->fields['nickname']->required = true; $person->fields['nickname']->invalid = true; $flag_ok = false; } ### check if changed nickname is unique if ($person->can_login || $person->nickname != "") { /** * \todo actually this should be mb_strtolower, but this is not installed by default */ if ($person->nickname != strtolower($person->nickname)) { new FeedbackMessage(__("Nickname has been converted to lowercase")); $person->nickname = strtolower($person->nickname); } if ($p2 = Person::getByNickname($t_nickname)) { # another person with this nick? if ($p2->id != $person->id) { new FeedbackWarning(__("Nickname has to be unique")); $person->fields['nickname']->required = true; $flag_ok = false; } } } ### password entered? ### $t_password1 = get('person_password1'); $t_password2 = get('person_password2'); $flag_password_ok = true; if (($t_password1 || $t_password2) && $t_password1 != "__dont_change__") { ### check if password match ### if ($t_password1 !== $t_password2) { new FeedbackWarning(__("Passwords do not match")); $person->fields['password']->required = true; $flag_ok = false; $flag_password_ok = false; $person->cookie_string = $auth->cur_user->calcCookieString(); } } ### check if password is good enough ### $password_length = strlen($t_password1); $password_count_numbers = strlen(preg_replace('/[\\d]/', '', $t_password1)); $password_count_special = strlen(preg_replace('/[\\w]/', '', $t_password1)); $password_value = -7 + $password_length + $password_count_numbers * 2 + $password_count_special * 4; if ($password_value < confGet('CHECK_PASSWORD_LEVEL')) { new FeedbackWarning(__("Password is too weak (please add numbers, special chars or length)")); $flag_ok = false; $flag_password_ok = false; } if ($flag_password_ok) { $person->password = md5($t_password1); } if (!validateFormCaptcha()) { new FeedbackWarning(__("Please copy the text from the image.")); $flag_ok = false; } ### repeat form if invalid data ### if (!$flag_ok) { $PH->show('personRegister', NULL, $person); exit; } /** * store indentifier-string for login from notification & reminder - mails */ $person->identifier = $person->calcIdentifierString(); ### insert new object ### if ($person->settings & USER_SETTING_NOTIFICATIONS && $person->can_login) { $person->settings |= USER_SETTING_SEND_ACTIVATION; new FeedbackHint(sprintf(__("A notification / activation will be mailed to <b>%s</b> when you log out."), $person->name) . " " . sprintf(__("Read more about %s."), $PH->getWikiLink('notifications'))); } $person->notification_last = getGMTString(time() - $person->notification_period * 60 * 60 * 24 - 1); $person->cookie_string = $person->calcCookieString(); if ($person->insert()) { new FeedbackHint(__("Thank you for registration! After your request has been approved by a moderator, you will can an email.")); ### link to a company ### if ($c_id = get('company')) { require_once confGet('DIR_STREBER') . 'db/class_company.inc.php'; if ($c = Company::getVisibleById($c_id)) { require_once confGet('DIR_STREBER') . 'db/class_employment.inc.php'; $e = new Employment(array('id' => 0, 'person' => $person->id, 'company' => $c->id)); $e->insert(); } } ## assigne to project ## require_once confGet('DIR_STREBER') . 'db/class_projectperson.inc.php'; $prj_num = confGet('REGISTER_NEW_USERS_TO_PROJECT'); global $g_user_profile_names; if (isset($prj_num)) { if ($prj_num != -1) { if ($p = Project::getVisibleById($prj_num)) { $prj_person = new ProjectPerson(array('person' => $person->id, 'project' => $p->id, 'name' => $g_user_profile_names[$person->profile])); $prj_person->insert(); } } } new FeedbackMessage(sprintf(__('Person %s created'), $person->getLink())); ### automatically login ### $foo = array('login_name' => $person->nickname, 'login_password_md5' => $person->password); addRequestVars($foo); $PH->show('loginFormSubmit', array()); exit; } else { new FeedbackError(__("Could not insert object")); } ### display fromPage #### if (!$PH->showFromPage()) { $PH->show('home', array()); } }
static function getForQuery($search_query, $project = NULL) { $count_overall = 0; $results = array(); global $PH; require_once confGet('DIR_STREBER') . "db/class_company.inc.php"; $args = array('order_str' => NULL, 'has_id' => NULL, 'search' => $search_query); foreach ($companies = Company::getAll($args) as $company) { $rate = RATE_TYPE_COMPANY; $rate *= SearchResult::RateItem($company); $rate *= SearchResult::RateTitle($company, $search_query); $results[] = new SearchResult(array('name' => $company->name, 'rating' => $rate, 'type' => __('Company'), 'jump_id' => 'companyView', 'jump_params' => array('company' => $company->id, 'q' => $search_query), 'item' => $company)); } require_once confGet('DIR_STREBER') . "db/class_person.inc.php"; foreach ($people = Person::getPeople(array('search' => $search_query)) as $person) { $rate = RATE_TYPE_PERSON; $rate *= SearchResult::RateItem($person); $rate *= SearchResult::RateTitle($person, $search_query); $results[] = new SearchResult(array('name' => $person->name, 'rating' => $rate, 'type' => __('Person'), 'jump_id' => 'personView', 'jump_params' => array('person' => $person->id, 'q' => $search_query), 'item' => $person)); } require_once confGet('DIR_STREBER') . "db/class_project.inc.php"; $projects = Project::getAll(array('status_min' => 0, 'status_max' => 10, 'search' => $search_query)); if ($projects) { foreach ($projects as $project) { $rate = RATE_TYPE_PROJECT; if ($project->status == STATUS_TEMPLATE) { $rate *= RATE_PROJECT_IS_TEMPLATE; } else { if ($project->status < STATUS_COMPLETED) { $rate *= RATE_PROJECT_IS_OPEN; } else { $rate *= RATE_PROJECT_IS_CLOSED; } } if ($diz = SearchResult::getExtract($project, $search_query)) { $rate *= RATE_IN_DETAILS; } ### status ### global $g_status_names; $status = isset($g_status_names[$project->status]) ? $g_status_names[$project->status] : ''; if ($project->status > STATUS_COMPLETED) { $rate *= RATE_TASK_STATUS_CLOSED; } else { if ($project->status >= STATUS_COMPLETED) { $rate *= RATE_TASK_STATUS_COMPLETED; } } ### for company ### $html_location = ''; if ($company = Company::getVisibleById($project->company)) { $html_location = __('for') . ' ' . $company->getLink(); } $rate *= SearchResult::RateItem($project); $rate *= SearchResult::RateTitle($project, $search_query); $results[] = new SearchResult(array('name' => $project->name, 'rating' => $rate, 'item' => $project, 'type' => __('Project'), 'jump_id' => 'projView', 'jump_params' => array('prj' => $project->id, 'q' => $search_query), 'extract' => $diz, 'status' => $status, 'html_location' => $html_location)); } } require_once confGet('DIR_STREBER') . "db/class_task.inc.php"; $order_str = get('sort_' . $PH->cur_page->id . "_tasks"); $tasks = Task::getAll(array('order_by' => $order_str, 'search' => $search_query, 'status_min' => STATUS_UPCOMING, 'status_max' => STATUS_CLOSED)); if ($tasks) { foreach ($tasks as $task) { $rate = RATE_TYPE_TASK; $rate *= SearchResult::RateItem($task); $rate *= SearchResult::RateTitle($task, $search_query); if ($task->category == TCATEGORY_FOLDER) { $rate *= RATE_TASK_IS_FOLDER; } if ($diz = SearchResult::getExtract($task, $search_query)) { $rate *= RATE_IN_DETAILS; } global $g_status_names; $status = isset($g_status_names[$task->status]) ? $g_status_names[$task->status] : ''; if ($task->status > STATUS_COMPLETED) { $rate *= RATE_TASK_STATUS_CLOSED; } else { if ($task->status >= STATUS_COMPLETED) { $rate *= RATE_TASK_STATUS_COMPLETED; } } if ($project = Project::getVisibleById($task->project)) { $prj = $project->getLink(); } else { $prj = ''; } $html_location = __('in') . " <b>{$prj}</b> > " . $task->getFolderLinks(); $is_done = $task->status < STATUS_COMPLETED ? false : true; $results[] = new SearchResult(array('name' => $task->name, 'rating' => $rate, 'extract' => $diz, 'item' => $task, 'type' => $task->getLabel(), 'status' => $status, 'html_location' => $html_location, 'is_done' => $is_done, 'jump_id' => 'taskView', 'jump_params' => array('tsk' => $task->id, 'q' => $search_query))); } } require_once confGet('DIR_STREBER') . "db/class_comment.inc.php"; $comments = Comment::getAll(array('search' => $search_query)); if ($comments) { foreach ($comments as $comment) { $rate = RATE_TYPE_COMMENT; $rate *= SearchResult::RateItem($comment); $rate *= SearchResult::RateTitle($comment, $search_query); if ($diz = SearchResult::getExtract($comment, $search_query)) { $rate *= RATE_IN_DETAILS; } if ($project = Project::getVisibleById($comment->project)) { $prj = $project->getLink(); } else { $prj = ''; } $html_location = __('on') . " <b>{$prj}</b>"; $is_done = false; if ($task = Task::getVisibleById($comment->task)) { if ($folders = $task->getFolderLinks()) { $html_location .= ' > ' . $folders; } $html_location .= ' > ' . $task->getLink(false); if ($task->status >= STATUS_COMPLETED) { $is_done = true; } } else { $html_location = ''; } $results[] = new SearchResult(array('name' => $comment->name, 'rating' => $rate, 'extract' => $diz, 'type' => __('Comment'), 'html_location' => $html_location, 'jump_id' => 'commentView', 'jump_params' => array('comment' => $comment->id, 'q' => $search_query), 'item' => $comment, 'is_done' => $is_done)); } } $count_overall += count($comments); require_once confGet('DIR_STREBER') . "db/class_effort.inc.php"; $efforts = Effort::getAll(array('search' => $search_query)); if ($efforts) { foreach ($efforts as $effort) { $rate = RATE_TYPE_EFFORT; $rate *= SearchResult::RateItem($effort); $rate *= SearchResult::RateTitle($effort, $search_query); if ($diz = SearchResult::getExtract($effort, $search_query)) { $rate *= RATE_IN_DETAILS; } if ($project = Project::getVisibleById($effort->project)) { $prj = $project->getLink(); } else { $prj = ''; } $html_location = __('on') . " <b>{$prj}</b>"; $is_done = false; if ($task = Task::getVisibleById($effort->task)) { if ($folders = $task->getFolderLinks()) { $html_location .= ' > ' . $folders; } $html_location .= ' > ' . $task->getLink(false); if ($task->status >= STATUS_COMPLETED) { $is_done = true; } } else { $html_location = ''; } $results[] = new SearchResult(array('name' => $effort->name, 'rating' => $rate, 'extract' => $diz, 'type' => __('Effort'), 'html_location' => $html_location, 'jump_id' => 'effortView', 'jump_params' => array('effort' => $effort->id, 'q' => $search_query), 'item' => $effort, 'is_done' => $is_done)); } } $count_overall += count($efforts); return $results; }
/** * 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(); }
function render_tr(&$obj, $style = "") { global $PH; $str_url = ""; $str_name = ""; $str_addon = ""; switch ($obj->type) { case ITEM_PROJECT: if ($project = Project::getVisibleById($obj->id)) { $str_name = asHtml($project->name); $str_url = $PH->getUrl('projView', array('prj' => $project->id)); } break; case ITEM_TASK: if ($task = Task::getVisibleById($obj->id)) { $str_name = asHtml($task->name); $str_url = $PH->getUrl('taskView', array('tsk' => $task->id)); if ($project = Project::GetVisibleById($task->project)) { $str_addon = "(" . $project->getLink(false) . ")"; } } break; case ITEM_COMMENT: if ($comment = Comment::getVisibleById($obj->id)) { if ($comment->name == '') { $str_name = "-"; } else { $str_name = asHtml($comment->name); } $str_url = $PH->getUrl('taskView', array('tsk' => $comment->task)); $str_addon .= "("; if ($task = Task::getVisibleById($comment->task)) { if ($project = Project::getVisibleById($task->project)) { $str_addon .= $project->getLink(false) . " > "; } $str_addon .= $task->getLink(false); if ($comment->comment) { if ($comm = Comment::getVisibleById($comment->comment)) { $str_addon .= " > " . $comm->name; } } } $str_addon .= ")"; } break; case ITEM_COMPANY: if ($c = Company::getVisibleById($obj->id)) { $str_name = asHtml($c->name); $str_url = $PH->getUrl('companyView', array('company' => $c->id)); } break; case ITEM_PERSON: if ($person = Person::getVisibleById($obj->id)) { $str_name = asHtml($person->name); $str_url = $PH->getUrl('personView', array('person' => $person->id)); } break; case ITEM_PROJECTPERSON: if ($pp = ProjectPerson::getVisibleById($obj->id)) { if (!($person = new Person($pp->person))) { $PH->abortWarning("ProjectPerson has invalid person-pointer!", ERROR_BUG); } $str_name = asHtml($person->name); $str_url = $PH->getUrl('personView', array('person' => $person->id)); if ($project = Project::getVisibleById($pp->project)) { $str_addon = "(" . $project->getLink(false) . ")"; } } break; case ITEM_EMPLOYMENT: if ($emp = Employment::getById($obj->id)) { if ($person = Person::getVisibleById($emp->person)) { $str_name = asHtml($person->name); $str_url = $PH->getUrl('personView', array('person' => $person->id)); } if ($company = Company::getVisibleById($emp->company)) { $str_addon = "(" . $company->getLink(false) . ")"; } } break; case ITEM_EFFORT: if ($e = Effort::getVisibleById($obj->id)) { $str_name = asHtml($e->name); $str_url = $PH->getUrl('effortEdit', array('effort' => $e->id)); if ($task = Task::getVisibleById($e->task)) { if ($project = Project::getVisibleById($task->project)) { $str_addon .= "(" . $project->getLink(false); $str_addon .= " > " . $task->getLink(false) . ")"; } } } break; case ITEM_FILE: if ($f = File::getVisibleById($obj->id)) { $str_name = asHtml($f->org_filename); $str_url = $PH->getUrl('fileView', array('file' => $f->id)); $str_addon .= "("; if ($p = Project::getVisibleById($f->project)) { $str_addon .= $p->getLink(false); } if ($t = Task::getVisibleById($f->parent_item)) { $str_addon .= " > " . $t->getLink(false); } $str_addon .= ")"; } break; case ITEM_ISSUE: if ($i = Issue::getVisibleById($obj->id)) { if ($t = Task::getVisibleById($i->task)) { $str_name = asHtml($t->name); $str_url = $PH->getUrl('taskView', array('tsk' => $t->id)); if ($p = Project::getVisibleById($t->project)) { $str_addon .= "(" . $p->getLink(false) . ")"; } } } break; case ITEM_TASKPERSON: if ($tp = TaskPerson::getVisibleById($obj->id)) { if ($person = Person::getVisibleById($tp->person)) { $str_name = asHtml($person->name); $str_url = $PH->getUrl('personView', array('person' => $person->id)); } if ($task = Task::getVisibleById($tp->task)) { if ($project = Project::getVisibleById($task->project)) { $str_addon .= "(" . $project->getLink(false); $str_addon .= " > " . $task->getLink(false) . ")"; } } } break; default: break; } print "<td><a href='{$str_url}'>{$str_name}</a><span class='sub who'> {$str_addon}</span></td>"; }