'spaces/team/autocomplete', 'title' => t('Group Members'), 'callback' => 'spaces_casetracker_users_autocomplete', 'access' => user_access('access case tracker'), 'type' => MENU_CALLBACK, ); } return $items; } /** * Implementation of hook_help() */ function spaces_casetracker_help($page) { if (context_get('spaces', 'feature') == 'casetracker') { if (strpos('node/add', $page) === 0) { } else { return "

". t('The casetracker allows you to file tickets for other team members and keep track of tasks that others have filed for you.') ."

"; } } } /** * Implementation of hook_block() */ function spaces_casetracker_block($op = 'list', $delta = 0) { if ($op == 'list') { $blocks = array(); $blocks[1]['info'] = t('Spaces: User Casetracker Stats'); return $blocks; } else if ($op == 'view') { switch ($delta) { case 1: $u = (object) array('uid' => arg(1)); $u = user_load($u); $block['subject'] = t('Case Stats for @user', array('@user' => $u->name)); $block['content'] = theme('spaces_casestats', spaces_casetracker_case_stats(arg(1), spaces_gid()), $u->name); return $block; } } } /** * Implementation of hook_form_alter() */ function spaces_casetracker_form_alter($form_id, &$form) { switch ($form_id) { case 'casetracker_basic_case_node_form': case 'comment_form': // Allow adding cases in batches if ($_GET['batch'] == 1) { $form['#redirect'] = array('node/add/casetracker-basic-case', 'batch=1'); } // Change the autocomplete callback to limit by group & Remove disallowed projects. if (isset($form['casetracker_project_information'])) { $pid = ($form_id == 'casetracker_basic_case_node_form' ? 'pid' : 'prid'); // "sigh." see casetracker_form_alter() for details. if (is_array($form['casetracker_project_information'][$pid]['#options'])) { foreach ($form['casetracker_project_information'][$pid]['#options'] as $key => $value) { $node = array('nid' => $key, 'type' => 'casetracker_basic_project'); $groups = og_get_node_groups((object)($node)); if ($current_gid = spaces_gid()) { if (!array_key_exists($current_gid, $groups)) { unset($form['casetracker_project_information'][$pid]['#options'][$key]); } } } $form['casetracker_case_information']['assign_to']['#autocomplete_path'] = 'spaces/team/autocomplete/'. $current_gid; } } break; // Views filters // Handle exposed casetracker filters, sadly case tracker is dumb to og. case 'views_filters': switch ($form['#view_name']) { case 'spaces_cases_my': case 'spaces_cases_byproject': case 'spaces_cases_bycreated': unset($form['filter0']['#options']); $form['filter0']['#options'] = spaces_casetracker_project_options(); break; case 'spaces_cases_byuser': unset($form['filter0']['#options']); $form['filter0']['#options'] = spaces_casetracker_user_options(); break; case 'spaces_cases_filter': unset($form['filter0']['#options']); $form['filter0']['#options'] = spaces_casetracker_project_options(); unset($form['filter1']['#options']); $form['filter1']['#options'] = spaces_casetracker_user_options(); break; } break; } } /** * Implementation of hook_default_views */ function spaces_casetracker_views_default_views() { $default_views = array( '_spaces_casetracker_views_cases', '_spaces_casetracker_views_cases_recent', '_spaces_casetracker_views_cases_bystatus', '_spaces_casetracker_views_cases_byuser', '_spaces_casetracker_views_cases_byproject', '_spaces_casetracker_views_cases_my', '_spaces_casetracker_views_cases_myblock', '_spaces_casetracker_views_cases_mycreated', '_spaces_casetracker_views_cases_filter', '_spaces_casetracker_views_cases_projects', ); foreach ($default_views as $v) { $view = call_user_func($v); if (is_object($view) && $view->name) { $views[$view->name] = $view; } } return $views; } /** * hook_context_define() */ function spaces_casetracker_context_define() { $items = array(); $items[] = array( 'namespace' => 'spaces', 'attribute' => 'feature', 'value' => 'casetracker', 'node' => array('casetracker_basic_case', 'casetracker_basic_project'), 'views' => _spaces_casetracker_views(), 'block' => array( array( 'module' => 'views', 'delta' => 'spaces_cases_myblock', 'region' => 'right', 'weight' => -11, ), ), 'menu' => array('cases'), 'spaces' => array( 'label' => t('Casetracker'), 'description' => t('A casetracker for managing projects.'), 'options' => _spaces_group_options(), ), ); return $items; } function _spaces_casetracker_views() { return array( 'spaces_cases', 'spaces_cases_my', 'spaces_cases_mycreated', 'spaces_cases_bystatus', 'spaces_cases_byuser', 'spaces_cases_byproject', 'spaces_cases_filter', 'spaces_cases_recent', 'spaces_cases_projects', 'spaces_cases_myblock', ); } /* * Implementation of hook_views_post_view() */ function spaces_casetracker_views_post_view(&$view) { if ($view->build_type == 'page' && in_array($view->name, _spaces_casetracker_views())) { context_set('theme', 'layout', 'wide'); } } /** * Build option array of project id's for the current group. */ function spaces_casetracker_project_options() { $return = array(); $results = db_query(db_rewrite_sql("SELECT ct.project_number, n.title FROM {node} n INNER JOIN {casetracker_project} ct ON n.nid = ct.nid INNER JOIN {og_ancestry} og ON n.nid = og.nid WHERE n.type IN (".str_pad('', count(array_filter(variable_get('casetracker_project_node_types', array('casetracker_basic_project')))) * 5 - 1, "'%s',").") AND og.group_nid = %d AND n.status = 1 ORDER BY n.title"), array_merge( array_filter(variable_get('casetracker_project_node_types', array('casetracker_basic_project'))), array(spaces_gid()) ) ); while ($row = db_fetch_object($results)) { $return[$row->project_number] = $row->project_number ." - ". $row->title; } return $return; } /** * Build option array of users in the current group */ function spaces_casetracker_user_options() { $return = array(); $result = db_query(og_list_users_sql(0), spaces_gid()); while ($user = db_fetch_object($result)) { $return[$user->uid] = $user->name; } return $return; } /** * Autocomplete callback. This should be moved into casetracker eventually. */ function spaces_casetracker_users_autocomplete($gid, $string) { $matches = array(); $result = db_query_range("SELECT name FROM {users} u INNER JOIN {og_uid} og ON u.uid = og.uid WHERE og.nid = %d AND LOWER(u.name) LIKE LOWER('%s%%')", $gid, $string, 0, 10); while ($user = db_fetch_object($result)) { $matches[$user->name] = check_plain($user->name); } print drupal_to_js($matches); exit(); } /** * Casetracker: produce case stats for a user. */ function spaces_casetracker_case_stats($uid, $gid = NULL) { $status_closed = 7; $status_open = 6; $week = time() - 7*24*3600; $args = array(); // ASSIGNED if ($gid) { $args[] = $gid; $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {og_ancestry} og ON c.nid = og.nid WHERE og.group_nid = %d AND c.case_status_id = %d AND c.assign_to = %d"; } else { $q = "SELECT COUNT(nid) AS count FROM {casetracker_case} WHERE case_status_id = %d AND assign_to = %d"; } $stats['assigned']['total_open'] = db_result(db_query($q, array_merge($args, array($status_open, $uid)))); $stats['assigned']['total_closed'] = db_result(db_query($q, array_merge($args, array($status_closed, $uid)))); if ($gid) { $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {og_ancestry} og ON c.nid = og.nid WHERE og.group_nid = %d AND c.case_status_id = %d AND c.assign_to = %d AND n.created > %d"; } else { $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = %d AND c.assign_to = %d AND n.created > %d"; } $stats['assigned']['week_open'] = db_result(db_query($q, array_merge($args, array($status_open, $uid, $week)))); $stats['assigned']['week_closed'] = db_result(db_query($q, array_merge($args, array($status_closed, $uid, $week)))); // CREATED if ($gid) { $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {og_ancestry} og ON c.nid = og.nid WHERE og.group_nid = %d AND c.case_status_id = %d AND n.uid = %d"; } else{ $q = "SELECT COUNT(c.nid) AS count FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.case_status_id = %d AND n.uid = %d"; } $stats['created']['total_open'] = db_result(db_query($q, array_merge($args, array($status_open, $uid)))); $stats['created']['total_closed'] = db_result(db_query($q, array_merge($args, array($status_closed, $uid)))); $q .= " AND n.created > %d"; $stats['created']['week_open'] = db_result(db_query($q, array_merge($args, array($status_open, $uid, $week)))); $stats['created']['week_closed'] = db_result(db_query($q, array_merge($args, array($status_closed, $uid, $week)))); if ($gid) { $q = "SELECT COUNT(c.case_type_id) AS count, cs.case_state_name AS name FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {casetracker_case_states} cs ON c.case_type_id = cs.csid INNER JOIN {og_ancestry} og ON c.nid = og.nid WHERE og.group_nid = %d AND n.uid = %d GROUP BY c.case_type_id"; } else { $q = "SELECT COUNT(c.case_type_id) AS count, cs.case_state_name AS name FROM {casetracker_case} c INNER JOIN {node} n ON c.nid = n.nid INNER JOIN {casetracker_case_states} cs ON c.case_type_id = cs.csid WHERE n.uid = %d GROUP BY c.case_type_id"; } $result = db_query($q, array_merge($args, array($uid))); while($type = db_fetch_array($result)) { $stats['created']['breakdown'][$type['name']] = $type['count']; } return $stats; } /* * Theme out casestat counts */ function _spaces_casestats_count($label, $count) { $class = strtolower($label); return "$count$label"; } /* * Theme out casestats */ function theme_spaces_casestats($stats, $username) { drupal_add_css(drupal_get_path('module', 'spaces') . '/spaces.css'); $labels = array( array( 'data' =>t('Assigned to !user', array('!user'=>$username)), 'colspan' =>2, 'class' =>'halfpoint', ), array( 'data'=>t('Created by !user', array('!user'=>$username)), 'colspan'=>2, ), ); $rows[] = array( array( 'data' =>t('This Week'), 'colspan' =>2, 'class' =>'header halfpoint', ), array( 'data' =>t('This Week'), 'colspan' =>2, 'class' =>'header', ), ); $rows[] = array( _spaces_casestats_count(t('Open'), $stats['assigned']['week_open']), array('data'=>_spaces_casestats_count(t('Closed'), $stats['assigned']['week_closed']), 'class'=>'halfpoint'), _spaces_casestats_count(t('Open'), $stats['created']['week_open']), _spaces_casestats_count(t('Closed'), $stats['created']['week_closed']), ); $rows[] = array( array( 'data' =>t('Total'), 'colspan' =>2, 'class' =>'header halfpoint', ), array( 'data' =>t('Total'), 'colspan' =>2, 'class' =>'header', ), ); $rows[] = array( _spaces_casestats_count(t('Open'), $stats['assigned']['total_open']), array('data'=>_spaces_casestats_count(t('Closed'), $stats['assigned']['total_closed']), 'class'=>'halfpoint'), _spaces_casestats_count(t('Open'), $stats['created']['total_open']), _spaces_casestats_count(t('Closed'), $stats['created']['total_closed']), ); $o = theme('table', $labels, $rows, array('class'=>'casestats')); /*** Breakdown ***/ if ($stats['created']['breakdown']) { $total = array_sum($stats['created']['breakdown']); foreach ($stats['created']['breakdown'] as $label => $count) { $pct = floor($count/$total * 1000)*.1; $breakdown[] = "$pct% ".t('in')." $label"; } $breakdown = implode(', ', $breakdown) . "."; $breakdown = "
".t('Cases created:')."$breakdown
"; } return $o . $breakdown; } /* VIEWS */ function _spaces_casetracker_views_cases() { $view = new stdClass(); $view->name = 'spaces_cases'; $view->description = t('A view of all cases by date.'); $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('Cases'); $view->page = TRUE; $view->page_title = t('Cases'); $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases'; $view->use_pager = TRUE; $view->nodes_per_page = '50'; $view->sort = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'sortorder' => 'ASC', 'options' => 'normal', ), ); $view->argument = array(); $view->field = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'pid', 'label' => 'Project', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'casetracker', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned', 'sortable' => '1', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated', 'handler' => 'views_handler_field_date_small', 'sortable' => '1', 'defaultsort' => 'DESC', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_case', ), ), array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array (); $view->requires = array(node, casetracker_case); return $view; } function _spaces_casetracker_views_cases_recent() { $view = new stdClass(); $view->name = 'spaces_cases_recent'; $view->description = ''; $view->view_args_php = 'return _spaces_views_arg_og_handler($args);'; $view->access = array(); $view->page = TRUE; $view->page_title = t('Recent Cases'); $view->page_type = 'table'; $view->url = 'recent-cases'; $view->use_pager = TRUE; $view->nodes_per_page = '50'; $view->block = TRUE; $view->block_title = t('Recent Cases'); $view->block_empty = "

" . t('No recent cases.') . "

"; $view->block_empty_format = '1'; $view->block_type = 'spaces_datetitle'; $view->nodes_per_block = '5'; $view->argument = array( array( 'type' => 'gid', 'argdefault' => '2' ), ); $view->sort = array ( array ( 'tablename' => 'node', 'field' => 'created', 'sortorder' => 'DESC', 'options' => 'normal', ), ); $view->field = array ( array ( 'tablename' => 'og_node_data', 'field' => 'title', 'label' => 'Group', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'og', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Case', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'node', 'field' => 'created', 'label' => 'Created On', 'handler' => 'views_handler_field_since', 'options' => 1, ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned To', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_case', ), ), array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', 'defaultsort' => 'ASC', ), array ( 'tablename' => 'og_uid_node', 'field' => 'currentuid', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_USER***', ), array ( 'tablename' => 'node', 'field' => 'changed', 'operator' => '>', 'options' => -1*SPACES_ARCHIVE_TIMESTAMP, 'value' => 'now', ), ); $view->exposed_filter = array (); $view->requires = array(node, casetracker_case, og_node_data, og_uid_node); return $view; } function _spaces_casetracker_views_cases_bystatus() { $view = new stdClass(); $view->name = 'spaces_cases_bystatus'; $view->description = t('Filter cases by status.'); $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('Cases by status'); $view->page = TRUE; $view->page_title = t('Cases by status'); $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases/by-status'; $view->use_pager = TRUE; $view->nodes_per_page = '25'; $view->argument = array(); $view->sort = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'sortorder' => 'ASC', 'options' => 'normal', ), ); $view->field = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'pid', 'label' => 'Project', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'casetracker', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned', 'sortable' => '1', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated', 'handler' => 'views_handler_field_date_small', 'sortable' => '1', 'defaultsort' => 'DESC', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_case', ), ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '6', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => t('Status'), 'optional' => '0', 'is_default' => '1', 'operator' => '1', 'single' => '1', ), ); $view->requires = array(node, casetracker_case); return $view; } function _spaces_casetracker_views_cases_byuser() { $view = new stdClass(); $view->name = 'spaces_cases_byuser'; $view->description = t('Filter cases by user.'); $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('Cases by user'); $view->page = TRUE; $view->page_title = t('Cases by user'); $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases/by-user'; $view->use_pager = TRUE; $view->nodes_per_page = '25'; $view->argument = array(); $view->sort = array( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'sortorder' => 'ASC', 'options' => 'normal', ), ); $view->field = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'pid', 'label' => 'Project', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'casetracker', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated', 'handler' => 'views_handler_field_date_small', 'sortable' => '1', 'defaultsort' => 'DESC', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_case', ), ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '29', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'User', 'optional' => '0', 'is_default' => '0', 'operator' => '1', 'single' => '1', ), ); $view->requires = array(node, casetracker_case); return $view; } function _spaces_casetracker_views_cases_my() { $view = new stdClass(); $view->name = 'spaces_cases_my'; $view->description = 'My cases'; $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('My cases'); $view->page = TRUE; $view->page_title = 'My cases'; $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases/my'; $view->use_pager = TRUE; $view->nodes_per_page = '25'; $view->argument = array(); $view->sort = array( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'sortorder' => 'ASC', 'options' => 'normal', ), ); $view->field = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'pid', 'label' => 'Project', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'casetracker', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated', 'handler' => 'views_handler_field_date_small', 'sortable' => '1', 'defaultsort' => 'DESC', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to_currentuid', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_USER***', ), array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '100', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array ( array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'label' => 'Project', 'optional' => '1', 'is_default' => '0', 'operator' => '1', 'single' => '1', ), ); $view->requires = array(node, casetracker_case); return $view; } function _spaces_casetracker_views_cases_myblock() { $view = new stdClass(); $view->name = 'spaces_cases_myblock'; $view->description = t('Provides a block listing of cases assigned to current user.'); $view->access = array (); $view->view_args_php = ''; $view->page = FALSE; $view->block = TRUE; $view->block_title = t('My Cases'); $view->block_empty = "

" . t('No cases found.') . "

"; $view->block_empty_format = '2'; $view->block_type = 'spaces_datetitle'; $view->nodes_per_block = '10'; $view->sort = array ( array ( 'tablename' => 'node_comment_statistics', 'field' => 'last_comment_timestamp', 'sortorder' => 'DESC', 'options' => 'normal', ), ); $view->argument = array(); $view->field = array ( array ( 'tablename' => 'node_comment_statistics', 'field' => 'last_comment_timestamp', 'label' => '', 'handler' => 'views_handler_field_since', 'options' => 1, ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => '', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'users', 'field' => 'name', 'label' => t('Author'), ), ); $view->filter = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to_currentuid', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_USER***', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '6', 1 => '8', 2 => '9', 3 => '10', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array (); $view->requires = array(node_comment_statistics, node, casetracker_case); return $view; } function _spaces_casetracker_views_cases_byproject() { $view = new stdClass(); $view->name = 'spaces_cases_byproject'; $view->description = t('Filter cases by project.'); $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('Cases by project'); $view->page = TRUE; $view->page_title = 'Cases by project'; $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases/by-project'; $view->use_pager = TRUE; $view->nodes_per_page = '25'; $view->argument = array(); $view->sort = array( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'sortorder' => 'ASC', 'options' => 'normal', ), ); $view->field = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'pid', 'label' => 'Project', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'casetracker', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned', 'sortable' => '1', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated', 'handler' => 'views_handler_field_date_small', 'sortable' => '1', 'defaultsort' => 'DESC', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_case', ), ), array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '100', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array ( array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'label' => 'Project', 'optional' => '0', 'is_default' => '1', 'operator' => '1', 'single' => '1', ), ); $view->requires = array(node, casetracker_case, casetracker_project); return $view; } function _spaces_casetracker_views_cases_mycreated() { $view = new stdClass(); $view->name = 'spaces_cases_mycreated'; $view->description = t('A view of all cases made by the current user.'); $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('Created by me'); $view->page = TRUE; $view->page_title = t('Created by me'); $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases/mycreated'; $view->use_pager = TRUE; $view->nodes_per_page = '50'; $view->argument = array(); $view->sort = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'sortorder' => 'ASC', 'options' => 'normal', ), ); $view->field = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'pid', 'label' => 'Project', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'casetracker', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned', 'sortable' => '1', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated', 'handler' => 'views_handler_field_date_small', 'sortable' => '1', 'defaultsort' => 'DESC', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_case', ), ), array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'node', 'field' => 'currentuid', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_USER***', ), array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '100', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array ( array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'label' => 'Project', 'optional' => '1', 'is_default' => '0', 'operator' => '1', 'single' => '1', ), ); $view->requires = array(node, casetracker_case); return $view; } function _spaces_casetracker_views_cases_filter() { $view = new stdClass(); $view->name = 'spaces_cases_filter'; $view->description = t('A massive case filter form.'); $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('Cases filter'); $view->page = TRUE; $view->page_title = t('Cases filter'); $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases/filter'; $view->use_pager = TRUE; $view->nodes_per_page = '100'; $view->argument = array(); $view->sort = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'sortorder' => 'ASC', 'options' => 'normal', ), ); $view->field = array ( array ( 'tablename' => 'casetracker_case', 'field' => 'pid', 'label' => 'Project', 'handler' => 'spaces_views_handler_crayon_name', 'options' => 'casetracker', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Title', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'Assigned', 'sortable' => '1', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'sortable' => '1', ), array ( 'tablename' => 'node', 'field' => 'changed', 'label' => 'Updated', 'handler' => 'views_handler_field_date_small', 'sortable' => '1', 'defaultsort' => 'DESC', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_case', ), ), array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '100', ), ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '1', ), ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_type_id', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '11', ), ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '1', ), ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => '6', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array ( array ( 'tablename' => 'casetracker_project', 'field' => 'project_number', 'label' => 'Project', 'optional' => '1', 'is_default' => '0', 'operator' => '1', 'single' => '0', ), array ( 'tablename' => 'casetracker_case', 'field' => 'assign_to', 'label' => 'For', 'optional' => '1', 'is_default' => '0', 'operator' => '1', 'single' => '0', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_type_id', 'label' => 'Type', 'optional' => '1', 'is_default' => '0', 'operator' => '1', 'single' => '0', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_priority_id', 'label' => 'Priority', 'optional' => '1', 'is_default' => '0', 'operator' => '1', 'single' => '0', ), array ( 'tablename' => 'casetracker_case', 'field' => 'case_status_id', 'label' => 'Status', 'optional' => '1', 'is_default' => '0', 'operator' => '1', 'single' => '0', ), ); $view->requires = array(node, casetracker_case, casetracker_project); return $view; } function _spaces_casetracker_views_cases_projects() { $view = new stdClass(); $view->name = 'spaces_cases_projects'; $view->description = t('A listing of all projects.'); $view->access = array(); $view->view_args_php = ''; $view->menu = TRUE; $view->menu_title = t('Projects'); $view->page = TRUE; $view->page_title = t('Projects'); $view->page_empty = ''; $view->page_empty_format = '2'; $view->page_type = 'table'; $view->url = 'cases/projects'; $view->use_pager = TRUE; $view->nodes_per_page = '99'; $view->argument = array(); $view->sort = array ( array ( 'tablename' => 'node', 'field' => 'title', 'sortorder' => 'ASC', 'options' => '', ), ); $view->field = array ( array ( 'tablename' => 'node', 'field' => 'title', 'label' => 'Project', 'handler' => 'views_handler_field_nodelink', 'options' => 'link', ), array ( 'tablename' => 'node', 'field' => 'created', 'label' => '', 'handler' => 'views_handler_field_date_custom', 'options' => 'F j, Y', ), array ( 'tablename' => 'casetracker_case_node', 'field' => 'nid', 'label' => '', ), ); $view->filter = array ( array ( 'tablename' => 'node', 'field' => 'status', 'operator' => '=', 'options' => '', 'value' => '1', ), array ( 'tablename' => 'node', 'field' => 'type', 'operator' => 'OR', 'options' => '', 'value' => array ( 0 => 'casetracker_basic_project', ), ), array ( 'tablename' => 'og_ancestry', 'field' => 'picg', 'operator' => '=', 'options' => '', 'value' => '***CURRENT_GID***', ), ); $view->exposed_filter = array (); $view->requires = array(node, casetracker_case_node); return $view; }