'. t("Provides quick notes support for SuiteDesk") .'
'; break; } return $o; } function stormidea_perm() { return array( 'Storm idea: access', 'Storm idea: add', 'Storm idea: delete all', 'Storm idea: delete own', 'Storm idea: edit all', 'Storm idea: edit own', 'Storm idea: view all', 'Storm idea: view own', ); } function stormidea_access($op, $node, $account = NULL) { if (empty($account)) { global $user; $account = $user; } if ($op == 'create') { return user_access('Storm idea: add'); } if (is_numeric($node)) { $node = node_load($node); } if ($op == 'delete') { if (user_access('Storm idea: delete all')) { return TRUE; } elseif (user_access('Storm idea: delete own') && ($account->uid == $node->uid)) { return TRUE; } } if ($op == 'update') { if (user_access('Storm idea: edit all')) { return TRUE; } elseif (user_access('Storm idea: edit own') && ($account->uid == $node->uid)) { return TRUE; } } if ($op == 'view') { if (user_access('Storm idea: view all')) { return TRUE; } elseif (user_access('Storm idea: view own') && ($account->uid == $node->uid)) { return TRUE; } } return FALSE; } function stormidea_access_sql($sql, $where = array()) { if (!user_access('Storm idea: view all')) { global $user; $cond = ''; if (user_access('Storm idea: view own')) { $cond .= 'n.uid = ' . $user->uid; } $where[] = empty($cond) ? '0 = 1' : $cond; } $where[] = "'storm_access' = 'storm_access'"; return storm_rewrite_sql($sql, $where); } function stormidea_storm_rewrite_where_sql_old($query, $primary_table, $account) { static $conds = array(); if (isset($conds[$primary_table][$account->uid])) { return $conds[$primary_table][$account->uid]; } $cond = ''; if (!preg_match("/'storm_access' = 'storm_access'/", $query)) { if (user_access('Storm idea: view all', $account)) { return ''; } if (user_access('Storm idea: view own', $account)) { $cond .= "${primary_table}.uid = " . $account->uid; } if ($cond) { $cond = " WHEN 'stormidea' THEN (SELECT IF($cond, 1, 0) FROM {stormidea} sno1 WHERE sno1.vid = ${primary_table}.vid) "; } else { $cond = " WHEN 'stormidea' THEN 0 "; } } $conds[$primary_table][$account->uid] = $cond; return $cond; } function stormidea_menu() { $items = array(); $items['ideas'] = array( 'title' => 'Reminders', 'description' => 'SuiteDesk ideas', 'page callback' => 'stormidea_list', 'access arguments' => array('Storm idea: access'), 'type' => MENU_NORMAL_ITEM, 'file' => 'stormidea.admin.inc', 'weight' => 7, ); return $items; } function stormidea_theme() { return array( 'stormidea_list' => array( 'file' => 'stormidea.theme.inc', 'arguments' => array('header', 'ideas'), ), 'stormidea_view' => array( 'file' => 'stormidea.theme.inc', 'arguments' => array('node', 'teaser', 'page'), ), ); } function stormidea_node_info() { return array( 'stormidea' => array( 'name' => t('Idea'), 'module' => 'stormidea', 'description' => t("A quick note for SuiteDesk."), 'has_body' => TRUE, ) ); } function stormidea_form(&$node) { $breadcrumb = array(); $breadcrumb[] = l(t('Home'), '