/** * print additional user defined elements in several contexts * @param int $trackerid the current tracker * @param array $fields the array of fields to be printed */ function tracker_printelements($trackerid, $fields = null, $dest = false) { tracker_loadelementsused($trackerid, $used); if (!empty($used)) { if (!empty($fields)) { foreach ($used as $element) { if (isset($fields[$element->id])) { foreach ($fields[$element->id] as $value) { $element->value = $value; } } } } foreach ($used as $element) { echo '<tr>'; echo '<td align="right" valign="top">'; echo '<b>' . format_string($element->description) . ':</b>'; echo '</td>'; echo '<td align="left" colspan="3">'; if ($dest == 'search') { $element->viewsearch(); } elseif ($dest == 'query') { $element->viewquery(); } else { $element->view(true); } echo '</td>'; echo '</tr>'; } } }
/** * @package mod-tracker * @category mod * @author Clifford Tham, Valery Fremaux > 1.8 * @date 02/12/2007 * * From for showing used element list */ if (!defined('MOODLE_INTERNAL')) { die('Direct access to this script is forbidden.'); /// It must be included from view.php in mod/tracker } print_simple_box_start('center', '100%', '', '', 'generalbox', 'description'); print_simple_box_end(); print_simple_box_start('center', '100%', '', '', 'generalbox', 'description'); tracker_loadelementsused($tracker, $used); print_heading(get_string('elementsused', 'tracker')); $orderstr = get_string('order', 'tracker'); $namestr = get_string('name'); $typestr = get_string('type', 'tracker'); $cmdstr = get_string('action', 'tracker'); $table->head = array("<b>{$orderstr}</b>", "<b>{$namestr}</b>", "<b>{$typestr}</b>", "<b>{$cmdstr}</b>"); $table->width = 400; $table->size = array(20, 250, 50, 100); $table->align = array('left', 'center', 'center', 'center'); if (!empty($used)) { foreach ($used as $element) { $icontype = "<img src=\"{$CFG->wwwroot}/mod/tracker/pix/types/{$element->type}.gif\" />"; if ($element->sortorder > 1) { $actions = "<a href=\"view.php?id={$cm->id}&what=raiseelement&elementid={$element->id}\"><img src=\"{$CFG->pixpath}/t/up.gif\" /></a>"; } else {
$issueid = required_param('issueid', PARAM_INT); $ccid = required_param('ccid', PARAM_INT); if (!get_record('tracker_issuecc', 'trackerid', $tracker->id, 'issueid', $issueid, 'userid', $ccid)) { $cc->trackerid = $tracker->id; $cc->issueid = $issueid; $cc->userid = $ccid; $cc->events = 31; insert_record('tracker_issuecc', $cc); } } elseif ($action == 'cascade') { global $USER; $issueid = required_param('issueid', PARAM_INT); $issue = get_record('tracker_issue', 'id', $issueid); $attributes = get_records('tracker_issueattribute', 'issueid', $issue->id); // remaps elementid to elementname for tracker_loadelementsused($tracker->id, $used); if (!empty($attributes)) { foreach (array_keys($attributes) as $attkey) { $attributes[$attkey]->elementname = $used[$attributes[$attkey]->id]->name; } } $issue->attributes = $attributes; // We get comments and make a single backtrack. There should not // be usefull to bring along full user profile. We just want not // to loose usefull information the previous track collected. $comments = get_records('tracker_issuecomment', 'issueid', $issue->id); $track = ''; if (!empty($comments)) { // collect userids foreach ($comments as $comment) { $useridsarray[] = $comment->userid;