You are here

function workflow_handler_arg_sid in Workflow 5

Same name and namespace in other branches
  1. 5.2 workflow.module \workflow_handler_arg_sid()

Handler to deal with sid as an argument.

1 string reference to 'workflow_handler_arg_sid'
workflow_views_arguments in ./workflow.module
Implementation of hook_views_arguments()

File

./workflow.module, line 1919

Code

function workflow_handler_arg_sid($op, &$query, $argtype, $arg = '') {
  switch ($op) {
    case 'summary':
      $query
        ->add_table('workflow_states', TRUE);
      $fieldinfo['field'] = "workflow_states.sid";
      $query
        ->add_field('sid', 'workflow_states');
      $query
        ->add_field('state', 'workflow_states');
      $query
        ->add_where('workflow_node.sid IS NOT NULL');
      return $fieldinfo;
      break;
    case 'filter':
      $query
        ->add_table('workflow_states', TRUE);
      if (is_numeric($arg)) {
        $query
          ->add_where("workflow_states.sid = %d", $arg);
      }
      else {
        $query
          ->add_where("workflow_states.state = '%s'", $arg);
      }
      break;
    case 'link':
      return l($query->state, "{$arg}/{$query->sid}");
    case 'title':
      $state = db_fetch_object(db_query("SELECT state FROM {workflow_states} WHERE sid=%d", $query));
      return $state->state;
  }
}