本文整理汇总了PHP中Company::getVisibleById方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::getVisibleById方法的具体用法?PHP Company::getVisibleById怎么用?PHP Company::getVisibleById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::getVisibleById方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* 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 "---";
}
}
示例2: commentNew
/**
* 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);
}
//.........这里部分代码省略.........
示例3: render_tr
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));
//.........这里部分代码省略.........
示例4: personEditSubmit
//.........这里部分代码省略.........
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());
}
}
}
示例5: getObjectById
/**
* 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;
}
}
示例6: getCompanyLink
/**
* 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 "-";
}
}
示例7: ajaxUserProjects
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);
}
示例8: itemBookmarkEditMultiple
/**
* 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";
//.........这里部分代码省略.........
示例9: personRegisterSubmit
//.........这里部分代码省略.........
/**
* \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());
}
}
示例10: getForQuery
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;
}
//.........这里部分代码省略.........
示例11: companyView
/**
* 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']);
//.........这里部分代码省略.........
示例12: render_tr
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);
}
//.........这里部分代码省略.........