function show_item_content($item) { $elements = array_merge($this->description_items, $this->additional_content_items); echo $this->get_edit_project_link($item->id()); $this->show_list_item_desc($item, $elements); $es = $es = new entity_selector(); $es->add_type(id_of('office_department_type')); $es->add_right_relationship($item->id(), relationship_id_of('project_to_client_office_dept')); $es->set_order('entity.name ASC'); $clients = $es->run_one(); if (!empty($clients)) { echo '<h4>Clients</h4>' . "\n"; echo '<ul>'; foreach ($clients as $client) { $url_pieces = array(); $url_pieces[] = 'filters[1][type]=client'; $url_pieces[] = 'filters[1][id]=' . $client->id(); if (!empty($this->parent->textonly)) { $url_pieces[] = 'textonly=' . $this->parent->textonly; } echo '<li><a href="?' . implode('&', $url_pieces) . '">' . $client->get_value('name') . '</a></li>'; } echo '</ul>'; } $es = $es = new entity_selector(); $es->add_type(id_of('project_type_type')); $es->add_right_relationship($item->id(), relationship_id_of('project_to_project_type')); $es->set_order('entity.name ASC'); $project_types = $es->run_one(); if (!empty($project_types)) { echo '<h4>'; if (count($project_types) > 1) { echo 'Project Types'; } else { echo 'Project Type'; } echo '</h4>' . "\n"; echo '<ul>'; foreach ($project_types as $project_type) { $url_pieces = array(); $url_pieces[] = 'filters[1][type]=project_type'; $url_pieces[] = 'filters[1][id]=' . $project_type->id(); if (!empty($this->parent->textonly)) { $url_pieces[] = 'textonly=' . $this->parent->textonly; } echo '<li><a href="?' . implode('&', $url_pieces) . '">' . $project_type->get_value('name') . '</a></li>'; } echo '</ul>'; } $es = new entity_selector(); $es->add_type(id_of('bug')); $es->add_left_relationship($item->id(), relationship_id_of('bug_to_project')); $es->set_order('bug_state ASC'); $tasks = $es->run_one(); if (!empty($tasks)) { echo '<h4>Component Tasks</h4>' . "\n"; echo '<ul>' . "\n"; foreach ($tasks as $task) { echo '<li><strong>' . $task->get_value('name') . '</strong>' . "\n"; echo '<ul>' . "\n"; foreach ($this->task_description_items as $key => $phrase) { if ($task->get_value($key)) { if (!empty($this->field_handlers[$key])) { $func = $this->field_handlers[$key]; echo '<li><strong>' . $phrase . ':</strong> ' . $this->{$func}($task->get_value($key)) . '</li>'; } else { echo '<li><strong>' . $phrase . ':</strong> ' . $task->get_value($key) . '</li>' . "\n"; } } } echo '</ul>' . "\n"; echo '</li>' . "\n"; } echo '</ul>' . "\n"; } $es = new entity_selector(); $es->add_type(id_of('image')); $es->add_right_relationship($item->id(), relationship_id_of('project_to_image')); $images = $es->run_one(); if (!empty($images)) { echo '<h4>Images</h4>' . "\n"; echo '<ul>' . "\n"; $die = false; $popup = true; $desc = true; $show_text = false; foreach ($images as $image) { echo '<li>' . "\n"; show_image($image, $die, $popup, $desc, $show_text, $this->parent->textonly, false); echo '</li>' . "\n"; } echo '</ul>' . "\n"; } $es = new entity_selector(); $es->add_type(id_of('asset')); $es->add_right_relationship($item->id(), relationship_id_of('project_to_asset')); $assets = $es->run_one(); if (!empty($assets)) { echo '<h4>Assets</h4>' . "\n"; $site = new entity($this->parent->site_id); reason_include_once('function_libraries/asset_functions.php'); echo make_assets_list_markup($assets, $site); } echo $this->get_edit_project_link($item->id()); }
/** * Get the markup for a list of assets * * @param array $assets * @return string $markup */ function get_asset_markup($assets) { if (!empty($this->params['show_fields']) && !empty($this->params['date_format'])) { $markup = make_assets_list_markup($assets, $this->site, $this->params['show_fields'], $this->params['date_format']); } elseif (!empty($this->params['show_fields'])) { $markup = make_assets_list_markup($assets, $this->site, $this->params['show_fields']); } elseif (!empty($this->params['date_format'])) { trigger_error('assetsModule::run(): the show_fields parameter must be passed to the assetsModule for the date_format parameter to work'); $markup = make_assets_list_markup($assets, $this->site); } else { $markup = make_assets_list_markup($assets, $this->site); } return $markup; }
function get_assets_section() { reason_include_once('function_libraries/asset_functions.php'); $str = '<h4>Related Documents</h4>'; $str .= make_assets_list_markup($this->passed_vars['item_assets'], $this->passed_vars['site']); return $str; }