return FALSE;
}
-/**
- * Release an item requested by a given user.
- *
- * @param $nid
- * Item nid.
- *
- * @param $uid
- * Requester user uid.
- *
- * @todo
- */
-function muamba_release($nid, $uid) {
- global $user;
-
- $nid = (int) $nid;
- $node = node_load($nid);
-
- if (!$node || $node->type != MUAMBA_NODE_TYPE) {
- drupal_not_found();
- }
-
- if ($node->uid != $user->uid) {
- // TODO: not node owner
- }
-}
-
/**
* Get the requests sent or received.
*
* Requester user uid.
*/
function muamba_get_transactions($uid, $type = 'sent', $status = MUAMBA_REQUESTED) {
- $uid = (int) $uid;
+ $uid = (int) $uid;
+ $query = db_select('muamba', 'm');
- if ($type = 'sent') {
+ if ($type == 'sent') {
$query
->condition('m.uid', $uid, '=')
->condition('m.status', $status, '=');
* Transaction management page.
*/
function muamba() {
+ global $user;
+
+ $transactions = muamba_get_transactions($user->uid);
+ dpm($transactions);
+
+ return t('Muamba management page');
}
/**
*
* @param $mid
* Transaction id.
+ *
+ * @todo
*/
function muamba_accept($mid) {
}
*
* @param $mid
* Transaction id.
+ *
+ * @todo
*/
function muamba_reject($mid) {
}
*
* @param $mid
* Transaction id.
+ *
+ * @todo
*/
function muamba_release($mid) {
+ global $user;
+
+ // TODO: load nid from db
+ $nid = (int) $nid;
+ $node = node_load($nid);
+
+ if (!$node || $node->type != MUAMBA_NODE_TYPE) {
+ drupal_not_found();
+ }
+
+ if ($node->uid != $user->uid) {
+ // TODO: not node owner
+ }
}
+
/**
* Return an item.
*
* @param $mid
* Transaction id.
+ *
+ * @todo
*/
function muamba_return($mid) {
}
$items['muamba'] = array(
'title' => 'My items',
'page callback' => 'muamba',
- 'access arguments' => array(),
+ 'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
'file' => 'muamba.business.inc',
);