function _opigno_tincan_api_set_object_activity in Opigno TinCan API 7
Parameters
\TinCan\Statement $statement The statement to add the object:
string $activity_definition_type An array containing the activity name and type (url). Use TinCanActivityDefinitions:
object $activity_id The node to use as object activity:
Throws
Exception
1 call to _opigno_tincan_api_set_object_activity()
- _opigno_tincan_api_statement_base_creation in includes/
opigno_tincan_api.statements_func.inc - This function will add the current user as the actor, the verb selected in parameter, the object based on the node given in parameter and the timestamp based on the current time.
File
- includes/
opigno_tincan_api.statements_func.inc, line 62
Code
function _opigno_tincan_api_set_object_activity(TinCan\Statement &$statement, $activity_definition_type, $node) {
if (!_opigno_tincan_api_tincanphp_is_installed()) {
return false;
}
if (empty($activity_definition_type)) {
throw new Exception('The definition type given is empty.');
}
if (empty($node) || empty($node->nid) || empty($node->title)) {
watchdog('opigno_tincan_api', 'The node given is not loaded or is not a node: <pre>' . print_r($node, true) . '</pre>');
return false;
}
$object = new TinCan\Activity(array(
'id' => url('node/' . $node->nid, array(
'absolute' => true,
)),
'definition' => array(
'name' => array(
'en-US' => $node->title,
),
'type' => $activity_definition_type,
),
));
$statement
->setObject($object);
}