function opigno_opigno_tools in Opigno 7.0
Implements hook_opigno_tools()
File
- ./
opigno.module, line 279 - Contains all hook_implementations and module specific API.
Code
function opigno_opigno_tools($node) {
$tools = array();
$tools['wikis'] = array(
'tool_name' => t("Wikis"),
'tool_url' => url("node/{$node->nid}/wikis"),
);
if (user_access('create wiki content')) {
$tools['wikis']['create_label'] = t("Add a !type", array(
'!type' => 'wiki',
));
$tools['wikis']['create_url'] = url('node/add/wiki', array(
'query' => array(
'gids_node[]' => $node->nid,
),
));
}
$tools['calendar'] = array(
'tool_name' => t("Calendar"),
'tool_url' => url("node/{$node->nid}/calendar"),
);
if (user_access('create calendar_entry content')) {
$tools['calendar']['create_label'] = t("Add a !type", array(
'!type' => 'calendar entry',
));
$tools['calendar']['create_url'] = url('node/add/calendar-entry', array(
'query' => array(
'gids_node[]' => $node->nid,
),
));
}
$tools['poll'] = array(
'tool_name' => t("Polls"),
'tool_url' => url("node/{$node->nid}/polls"),
);
if (user_access('create poll content')) {
$tools['poll']['create_label'] = t("Add a !type", array(
'!type' => 'poll',
));
$tools['poll']['create_url'] = url('node/add/poll', array(
'query' => array(
'gids_node[]' => $node->nid,
),
));
}
$tools['workgroups'] = array(
'tool_name' => t("Workgroups"),
'tool_url' => url("node/{$node->nid}/workgroups"),
);
if (user_access('create workgroup content')) {
$tools['workgroups']['create_label'] = t("Add a !type", array(
'!type' => 'workgroup',
));
$tools['workgroups']['create_url'] = url('node/add/workgroup', array(
'query' => array(
'gids_node[]' => $node->nid,
),
));
}
// Course specific tools
if (opigno_is_course($node)) {
$tools['quizzes'] = array(
'tool_name' => t("Quizzes"),
'tool_url' => url("node/{$node->nid}/quizzes"),
);
if (user_access('create quiz content')) {
$tools['quizzes']['create_label'] = t("Add a !type", array(
'!type' => 'quiz',
));
$tools['quizzes']['create_url'] = url('node/add/quiz', array(
'query' => array(
'gids_node[]' => $node->nid,
),
));
}
}
return $tools;
}