/** * render home view @ingroup pages */ function home() { global $PH; global $auth; ### create from handle ### $PH->defineFromHandle(array()); $page = new Page(); $page->cur_tab = 'home'; $page->options = build_home_options(); $page->title = __("Today"); # $auth->cur_user->name; $page->type = __("At Home"); $page->title_minor = renderTitleDate(time()); ### page functions ### $page->add_function(new PageFunction(array('target' => 'personEdit', 'params' => array('person' => $auth->cur_user->id), 'icon' => 'edit', 'name' => __('Edit your Profile')))); $page->add_function(new PageFunction(array('target' => 'personAllItemsViewed', 'params' => array('person' => $auth->cur_user->id), 'icon' => 'edit', 'name' => __('Mark all items as viewed')))); echo new PageHeader(); echo new PageContentOpen_Columns(); measure_stop('init2'); require_once confGet('DIR_STREBER') . 'db/class_company.inc.php'; $block = new PageBlock(array('title' => __('Active projects'), 'id' => 'projects')); $block->render_blockStart(); echo "<div class=linklist>"; /** * get companies */ foreach (Company::getAll() as $c) { /** * get project for company * * @NOTE single sql requests are not the fastes solution here... */ if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => $c->id))) { echo "<span class=sub>" . __("for", "short for client") . '</span> <b>' . $c->getLink() . "</b>:"; echo '<ul>'; foreach ($projects as $project) { echo '<li>' . $PH->getLink('projView', $project->name, array('prj' => $project->id)) . '</li>'; } echo '</ul>'; } } if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => 0))) { echo __("without client"); echo '<ul>'; foreach ($projects as $project) { echo '<li>' . $PH->getLink('projView', $project->name, array('prj' => $project->id)) . '</li>'; } echo '</ul>'; } echo "</div>"; $block->render_blockEnd(); echo new PageContentNextCol(); if ($projects = Project::getAll(array('order_by' => 'modified DESC'))) { require_once confGet('DIR_STREBER') . 'lists/list_recentchanges.inc.php'; printRecentChanges($projects); } echo new PageContentClose(); echo new PageHtmlEnd(); }
/** * query if visible for current user * * - returns NULL if failed * - this function is a double of validateView. Fix this */ static function getVisibleById($id) { $companies = Company::getAll(array('order_str' => NULL, 'has_id' => intval($id))); if (count($companies) == 1) { if ($companies[0]->id) { return $companies[0]; } } return NULL; }
public function print_automatic() { global $PH; $this->active_block_function = 'list'; $pass = true; ### add filter options ### foreach ($this->filters as $f) { foreach ($f->getQuerryAttributes() as $k => $v) { $this->query_options[$k] = $v; } } $companies = Company::getAll($this->query_options); $this->render_list($companies); }
protected function basicFields($search) { // Search by Source $search->addSearchField('source', 'source', 'select', '', 'basic'); $pp = new PeriodicPayment(); $options = array('' => 'All'); $sources = $pp->getEnumOptions('source'); $options += $sources; $search->setOptions('source', $options); // Search by Frequency $search->addSearchField('frequency', 'frequency', 'select', '', 'basic'); $options = array('' => 'All'); $frequencies = $pp->getEnumOptions('frequency'); $options += $frequencies; $search->setOptions('frequency', $options); // Search by Bank Account $search->addSearchField('cb_account_id', 'Bank Account', 'select', 0, 'advanced'); $cb = new CBAccount(); $cbs = $cb->getAll(); $options = array('0' => 'All'); $options += $cbs; $search->setOptions('cb_account_id', $options); // Search by Status $search->addSearchField('status', 'status', 'select', '', 'advanced'); $options = array('' => 'All'); $statuses = $pp->getEnumOptions('status'); $options += $statuses; $search->setOptions('status', $options); // Search by Source $search->addSearchField('company_id', 'company', 'select', 0, 'advanced'); $company = new Company(); $options = array('0' => 'All'); $companies = $company->getAll(); $options += $companies; $search->setOptions('company_id', $options); // Search by Next Due Date $search->addSearchField('next_due_date', 'Due Between', 'between', '', 'advanced'); }
/** * Link companies to person @ingroup pages */ function personLinkCompanies() { global $PH; $id = getOnePassedId('person', 'people_*'); # WARNS if multiple; ABORTS if no id found $person = Person::getEditableById($id); if (!$person) { $PH->abortWarning("ERROR: could not get Person"); return; } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'company_name')); $page->cur_tab = 'people'; $page->type = __("Edit Person"); $page->title = sprintf(__("Edit %s"), $person->name); $page->title_minor = __("Add related companies"); $page->crumbs = build_person_crumbs($person); $page->options[] = new NaviOption(array('target_id' => 'personLinkCompanies')); echo new PageHeader(); echo new PageContentOpen(); require_once confGet('DIR_STREBER') . 'pages/company.inc.php'; require_once confGet('DIR_STREBER') . 'render/render_form.inc.php'; $companies = Company::getAll(); $list = new ListBlock_companies(); $list->show_functions = false; $list->show_icons = false; $list->render_list($companies); $PH->go_submit = 'personLinkCompaniesSubmit'; echo "<input type=hidden name='person' value='{$person->id}'>"; echo "<input class=button2 type=submit>"; echo new PageContentClose(); echo new PageHtmlEnd(); }
<div class="category-tab" ><!--category-tab--> <div class="col-sm-12"> </div> <div class="tab-content"> <div class="tab-pane fade active in" id="tshirt" > <div> <input type="text" placeholder="Serch City"> <a href="<?php echo SERVER_URL; ?> /add-jobs" > Post Jobs</a></div> <table id="example" class="display" cellspacing="0" width="77%" style="float: left;"> <tbody> <?php $companyObj = new Company(); $result = $companyObj->getAll(); foreach ($result as $row) { ?> <tr class="trboder"> <td > <div class="divdesc"> <p><b>Name:</b> <?php echo $row['name']; ?> <br/> <b>City:</b> <?php echo $row['city']; ?> <br/> <b> Specialization:</b> <?php echo $row['specialization'];
<?php if (system\Helper::arcIsAjaxRequest()) { $table = "<table class=\"table table-hover table-condensed\">" . "<thead><tr><th>Name</th><th># Users</th>" . "<th class=\"text-right\"><a onclick=\"editCompany(0);\" class=\"btn btn-primary btn-xs\"><i class=\"fa fa-plus\"></i> Create</a></th>" . "</tr></thead><tbody>"; $companies = Company::getAll(); foreach ($companies as $company) { $userCount = $company->getUsers(); $table .= "<tr><td>{$company->name}</td>" . "<td>" . count($userCount) . "</td>" . "<td class=\"text-right\">" . "<div class=\"btn-group\" role=\"group\">" . "<a onclick=\"editCompany({$company->id});\" class=\"btn btn-success btn-xs\"><i class=\"fa fa-pencil\"></i> Edit</a>" . "<a onclick=\"removeCompany({$company->id});\" class=\"btn btn-danger btn-xs\"><i class=\"fa fa-remove\"></i> Remove</a>" . "</div>" . "</td></tr>"; } $table .= "</tbody></table>"; echo json_encode(["html" => $table]); }
<input type="text" class="form-control" name="query" placeholder="Search for company.." /> </div> <div class="col-sm-4"> <button type="submit" name="searchBy" value="company" class="btn btn-primary">Search</button> </div> </div> </form> </div> <div class="panel-body"> <?php if (\Input::has('searchBy') && \Input::get('query') !== '') { $companies = \Company::getByQuery(trim(\Input::get('query')), true, 15); } else { $companies = \Company::getAll(true, 15); } ?> @if (count($companies) > 0) <ul class="list-unstyled sc-list" id="companyAffiliateSearchList"> @foreach ($companies as $company) <li> <div class="media"> <div class="media-left"> @if (! is_null($company->image)) <img src="{{ asset($company->image) }}" width="52" /> @else <img data-src="holder.js/52x52?random=yes&text=no-image" /> @endif </div> <div class="media-body">
/** * renders the list of open projects that will be display when opening the project selector * * The opening is done with javascript. Placing the list beside the Project Selector icon * is done by css only. This is a little bit tricky, because the Tab-list is already an * span which allows only further Spans to be included... * * The selectorlist is triggered by * * read more at #3867 */ function buildProjectSelector() { global $auth; if (!$auth->cur_user || !$auth->cur_user->id) { return ""; } $buffer = ""; global $PH; require_once confGet('DIR_STREBER') . 'db/class_company.inc.php'; require_once confGet('DIR_STREBER') . "db/class_project.inc.php"; $buffer .= "<span id=projectselector class=selector> </span>"; $buffer .= "<span style='display:none;' id='projectselectorlist' class=selectorlist><span class=selectorlist_content>"; foreach (Company::getAll() as $c) { if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => $c->id))) { $buffer .= "<div class='companies'><span style='float:left;margin-right:3px;'>" . __("for", "short for client") . "</span>" . $c->getLink() . "</div>"; $buffer .= "<div class='projects'><ul>"; foreach ($projects as $p) { $buffer .= "<li>" . $PH->getLink('projView', $p->name, array('prj' => $p->id)) . "</li>"; } $buffer .= "</ul></div>"; } } /* projects without client */ if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => 0))) { $buffer .= "<div class='companies'><span style='float:left;margin-right:3px;'>" . __("without client", "short for client") . "</span> </div>"; $buffer .= "<div class='projects'><ul>"; foreach ($projects as $p) { $buffer .= "<li>" . $PH->getLink('projView', $p->name, array('prj' => $p->id)) . "</li>"; } $buffer .= "</ul></div>"; } $buffer .= "</span></span>"; return $buffer; }
<th>Date</th> <th>City</th> <th>Location</th> <th>Website</th> <th>Email</th> <th>Phone</th> <th>Specialization</th> <th>Description</th> <th>Status</th> <th>Actions</th> </tr> </thead> <tbody> <?php $companyObj = new Company(); $rows = $companyObj->getAll(); foreach ($rows as $row) { ?> <tr> <td><?php echo $row['id']; ?> </td> <td class="center"><?php echo $row['name']; ?> </td> <td class="center"><?php echo $row['date']; ?>
function request($params) { $errors = array(); // Parse parameters. $p1 = $params->getParam(0); $subject = $p1->scalarval(); $p2 = $params->getParam(1); $from_email = $p2->scalarval(); $p3 = $params->getParam(2); $parts = array(); foreach ($p3->scalarval() as $body) { $parts[] = $body->scalarval(); } $content = $parts[0]['content']; $request = $content->scalarval(); unset($parts[0]); $p4 = $params->getParam(3); $to_email = $p4->scalarval(); /* - mandatory fields summary character varying NOT NULL, client_ticket_priority_id bigint NOT NULL, client_ticket_severity_id bigint NOT NULL, ticket_queue_id bigint NOT NULL, ticket_category_id bigint NOT NULL, internal_ticket_priority_id bigint NOT NULL, internal_ticket_severity_id bigint NOT NULL, internal_ticket_status_id bigint NOT NULL, client_ticket_status_id bigint NOT NULL, - optional fields originator_person_id character varying, originator_company_id bigint, company_sla_id bigint, action_code character varying(4), originator_email_address character varying, assigned_to character varying, */ $config = Config::Instance(); $companyid = ''; $contact = new PartyContactMethodCollection(new PartyContactMethod()); $sh = new SearchHandler($contact, false, false); $sh->addConstraint(new Constraint('name', '=', $config->get('TICKET_SUPPORT'))); $sh->addConstraint(new Constraint('type', '=', 'E')); $sh->addConstraint(new Constraint('technical', 'is', TRUE)); $sh->addConstraint(new Constraint('contact', '=', $to_email)); $contact->load($sh); if ($contact->count() > 0) { $party_ids = array(); foreach ($contact as $party) { $party_ids[] = $party->party_id; $usercompanyid = $party->usercompanyid; } if (!defined('EGS_COMPANY_ID')) { define('EGS_COMPANY_ID', $usercompanyid); } $company = new Company(); $cc = new ConstraintChain(); $cc->add(new Constraint('party_id', 'in', '(' . implode(',', $party_ids) . ')')); $companylist = $company->getAll($cc); if (count($companylist) != 1) { $errors[] = '1) Unable to find your support details - please contact technical support'; } else { $company->load(key($companylist), true); $companyid = $company->id; $usercompanyid = $company->usercompanyid; } } else { $errors[] = '2) Unable to find your support details - please contact technical support'; } $data['attachments'] = $parts; $data['TicketResponse']['body'] = $request; $data['TicketResponse']['type'] = 'site'; $data['Ticket']['originator_company_id'] = $companyid; $data['reply_address'] = $to_email; $start = strpos($subject, '['); $end = strpos($subject, ']'); $mid = strpos($subject, '-'); if ($start > 0 && $mid > 0 && $end > 0 && $start < $end && $start < $mid && $mid < $end) { $ticket = substr($subject, $mid + 1, $end - $mid - 1); } if (empty($request)) { $errors[] = 'No request details submitted'; } elseif (count($errors) == 0) { if (isset($ticket) && is_numeric($ticket)) { $data['TicketResponse']['ticket_id'] = $ticket; self::updateRequest($data, $errors); $response = "Your response for Ticket " . $ticket . " has been received. The person dealing with your query has been notified."; } else { $data['Ticket']['summary'] = $subject; $data['Ticket']['originator_email_address'] = $from_email; $data['Ticket']['usercompanyid'] = $usercompanyid; self::newRequest($data, $errors); $response = "Your request has been received and assigned ticket no. " . $data['TicketResponse']['ticket_id'] . ". A confirmation email has been sent."; } } if (count($errors) > 0) { $errors[] = $sh->constraints->__toString(); $result = "ERROR\n"; $response = "Subject:" . $subject . "\n"; $response .= 'Email:' . $from_email . "\n"; $response .= 'Request:' . $request . ";\n\n"; $response .= "Errors:\n"; $response .= implode(";\n", $errors); } else { $result = 'SUCCESS'; } $struct = array('result' => new xmlrpcval($result, 'string'), 'response' => new xmlrpcval($response, 'string')); return new xmlrpcresp(new xmlrpcval($struct, 'struct')); }
/** * Edit a project @ingroup pages */ function projEdit($project = NULL) { global $PH; global $auth; require_once confGet('DIR_STREBER') . "db/class_company.inc.php"; if (!$project) { $prj = getOnePassedId('prj', 'projects_*'); ### get project #### if (!($project = Project::getEditableById($prj))) { $PH->abortWarning("could not get Project"); return; } } $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'project_name')); $page->cur_tab = 'projects'; $page->type = __("Edit Project"); $page->title = $project->name; $page->title_minor = $project->short; $page->crumbs = build_project_crumbs($project); $page->options[] = new NaviOption(array('target_id' => 'projEdit')); echo new PageHeader(); echo new PageContentOpen(); global $g_status_names; global $g_prio_names; require_once confGet('DIR_STREBER') . "render/render_form.inc.php"; ### form background ### $block = new PageBlock(array('id' => 'project_edit')); $block->render_blockStart(); $form = new PageForm(); $form->button_cancel = true; $form->add($project->fields['name']->getFormElement($project)); $form->add($tab_group = new Page_TabGroup()); $tab_group->add($tab = new Page_Tab("project", __("Project"))); $tab->add(new Form_Dropdown('project_status', "Status", array_flip($g_status_names), $project->status)); ### build company-list ### $companies = Company::getAll(); $cl_options = array('undefined' => 0); foreach ($companies as $c) { $cl_options[$c->name] = $c->id; } $tab->add(new Form_Dropdown('project_company', __('Company', 'form label'), $cl_options, $project->company)); $tab->add(new Form_Dropdown('project_prio', "Prio", array_flip($g_prio_names), $project->prio)); $tab->add($project->fields['projectpage']->getFormElement($project)); $tab->add($project->fields['date_start']->getFormElement($project)); $tab->add($project->fields['date_closed']->getFormElement($project)); $tab_group->add($tab = new Page_Tab("description", __("Description"))); $e = $project->fields['description']->getFormElement($project); $e->rows = 20; $tab->add($e); global $g_project_setting_names; $tab_group->add($tab = new Page_Tab("tab3", __("Display"))); $tab->add($project->fields['short']->getFormElement($project)); $tab->add($project->fields['status_summary']->getFormElement($project)); $tab->add($project->fields['color']->getFormElement($project)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_TASKS', $g_project_setting_names[PROJECT_SETTING_ENABLE_TASKS], $project->settings & PROJECT_SETTING_ENABLE_TASKS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_FILES', $g_project_setting_names[PROJECT_SETTING_ENABLE_FILES], $project->settings & PROJECT_SETTING_ENABLE_FILES)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_BUGS', $g_project_setting_names[PROJECT_SETTING_ENABLE_BUGS], $project->settings & PROJECT_SETTING_ENABLE_BUGS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_EFFORTS', $g_project_setting_names[PROJECT_SETTING_ENABLE_EFFORTS], $project->settings & PROJECT_SETTING_ENABLE_EFFORTS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_MILESTONES', $g_project_setting_names[PROJECT_SETTING_ENABLE_MILESTONES], $project->settings & PROJECT_SETTING_ENABLE_MILESTONES)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_VERSIONS', $g_project_setting_names[PROJECT_SETTING_ENABLE_VERSIONS], $project->settings & PROJECT_SETTING_ENABLE_VERSIONS)); $tab->add(new Form_checkbox('PROJECT_SETTING_ENABLE_NEWS', $g_project_setting_names[PROJECT_SETTING_ENABLE_NEWS], $project->settings & PROJECT_SETTING_ENABLE_NEWS)); ### create another one ### if ($auth->cur_user->user_rights & RIGHT_PROJECT_CREATE && $project->id == 0) { $checked = get('create_another') ? 'checked' : ''; $form->form_options[] = "<span class=option><input name='create_another' class='checker' type=checkbox {$checked}>" . __("Create another project after submit") . "</span>"; } #echo "<input type=hidden name='prj' value='$project->id'>"; $form->add(new Form_Hiddenfield('prj', '', $project->id)); echo $form; $block->render_blockEnd(); $PH->go_submit = 'projEditSubmit'; if ($return = get('return')) { echo "<input type=hidden name='return' value='{$return}'>"; } echo new PageContentClose(); echo new PageHtmlEnd(); }
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; }