function theme_pm_link in Drupal PM (Project Management) 7
Provides HTML for a Project Management link.
File
- ./
pm.theme.inc, line 210 - Provides theme functions for Project Management modules
Code
function theme_pm_link($source_module = '', $destination_module = '', $node_nid = 0, $weight = 0) {
switch ($source_module) {
case "pmorganization":
$params_key = 'organization_nid';
break;
case "pmproject":
$params_key = 'project_nid';
break;
case "pmtask":
$params_key = 'task_nid';
break;
case "pmticket":
$params_key = 'ticket_nid';
break;
}
switch ($destination_module) {
case "pmattribute":
$user_access_check = 'Project Management: access administration pages';
$list_text = t('Attributes');
$list_path = 'pm/attributes';
$add_icon_type = 'pmattribute';
$add_path = 'pm/attributes/add';
$dt_id = 'pmattributes';
break;
case "pmconfiguration":
$user_access_check = 'Project Management: access administration pages';
$list_text = t('Configuration');
$list_path = 'admin/settings/pm';
$add_icon_type = '';
$add_path = '';
$dt_id = 'pmconfiguration';
break;
case "pmexpense":
$user_access_check = 'Project Management expense: access';
$list_text = t('Expenses');
$list_path = 'pm/expenses';
$add_icon_type = 'pmexpense';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmexpenses';
break;
case "pminvoice":
$user_access_check = 'Project Management invoice: access';
$list_text = t('Invoices');
$list_path = 'pm/invoices';
$add_icon_type = 'pminvoice';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pminvoices';
break;
case "pmknowledgebase":
$user_access_check = 'Project Management knowledgebase: access';
$list_text = t('Knowledge base');
$list_path = 'pm/knowledgebase';
$add_icon_type = 'pmknowledgebase';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmknowledgebase';
break;
case "pmnote":
$user_access_check = 'Project Management note: access';
$list_text = t('Notes');
$list_path = 'pm/notes/';
$add_icon_type = 'pmnote';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmnotes';
break;
case "pmorganization":
$user_access_check = 'Project Management organization: access';
$list_text = t('Organizations');
$list_path = 'pm/organizations';
$add_icon_type = 'pmorganization';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmorganizations';
break;
case "pmperson":
$user_access_check = 'Project Management person: access';
$list_text = t('People');
$list_path = 'pm/people/';
$add_icon_type = 'pmperson';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmpeople';
break;
case "pmproject":
$user_access_check = 'Project Management project: access';
$list_text = t('Projects');
$list_path = 'pm/projects';
$add_icon_type = 'pmproject';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmprojects';
break;
case "pmtask":
$user_access_check = 'Project Management task: access';
$list_text = t('Tasks');
$list_path = 'pm/tasks/';
$add_icon_type = 'pmtask';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmtasks';
break;
case "pmteam":
$user_access_check = 'Project Management team: access';
$list_text = t('Teams');
$list_path = 'pm/teams';
$add_icon_type = 'pmteam';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmteams';
break;
case "pmticket":
$user_access_check = 'Project Management ticket: access';
$list_text = t('Tickets');
$list_path = 'pm/tickets/';
$add_icon_type = 'pmticket';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmtickets';
break;
case "pmtimetracking":
$user_access_check = 'Project Management timetracking: access';
$list_text = t('Timetrackings');
$list_path = 'pm/timetrackings';
$add_icon_type = 'pmtimetracking';
$node_links_key = 'timetrackings';
$add_path = 'node/add/' . $destination_module;
$dt_id = 'pmtimetrackings';
break;
}
if ($destination_module == 'pmconfiguration' && user_access($user_access_check) || module_exists($destination_module) && user_access($user_access_check)) {
if ($node_nid == 0) {
$params = array();
}
else {
$params = array(
'query' => array(
$params_key => $node_nid,
),
);
}
$v = l($list_text, $list_path, $params);
if (!$add_icon_type == '') {
$i = new stdClass();
$i->type = $add_icon_type;
if ($node_nid == 0) {
$params = $_GET;
}
else {
$params = $_GET;
$params[$params_key] = $node_nid;
}
$nmb_itms = _pm_number_of_items($source_module, $destination_module, $node_nid);
$nmb_itms = theme('pm_number_items', $nmb_itms);
$v .= $nmb_itms . pm_icon_add($add_path, $i, $params);
}
if ($node_nid == 0) {
$r = variable_get('pm_icons_display', TRUE) ? '<dt id="' . $dt_id . '" class="pmcomponent">' : '<dt class="pmcomponent">';
$r .= $v;
$r .= '</dt>';
}
else {
$r = array(
'#prefix' => variable_get('pm_icons_display', TRUE) ? '<dt id="' . $dt_id . '" class="pmcomponent">' : '<dt class="pmcomponent">',
'#suffix' => '</dt>',
'#value' => $v,
'#weight' => $weight,
);
}
return $r;
}
}