You are here

cmis_query.module in CMIS API 6.2

Search functions

File

cmis_query/cmis_query.module
View source
<?php

/**
 * @file
 * Search functions
 */

/**
 * Implementation of hook_menu() for CMIS search module.
 */
function cmis_query_menu() {
  $items = array();
  $items['cmis/query'] = array(
    'type' => MENU_NORMAL_ITEM,
    'title' => t('CMIS Query'),
    'page callback' => 'cmis_query_view',
    'access arguments' => array(
      'access cmis',
    ),
    'file' => 'cmis_query.pages.inc',
  );
  return $items;
}

/**
 * Implementation of hook_theme()
 */
function cmis_query_theme() {
  return array(
    'cmis_query_results' => array(
      'arguments' => array(
        'rows' => NULL,
      ),
      'file' => 'cmis_query.theme.inc',
    ),
    'cmis_query_pager' => array(
      'arguments' => array(
        'query' => NULL,
        'p' => NULL,
      ),
      'file' => 'cmis_query.theme.inc',
    ),
  );
}

/**
 * Render form for searching CMIS respository.
 */
function cmis_query_form(&$form_state) {
  $cmis_query = array(
    '#type' => 'fieldset',
    '#title' => t('Search the repository using CMIS SQL 1.0 queries.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $cmis_query['cmis_query'] = array(
    '#type' => 'textarea',
    '#title' => t('Query'),
    '#size' => 50,
    '#default_value' => urldecode(arg(2)),
  );
  $cmis_query['cmis_query_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Run'),
  );
  $form['statement'] = $cmis_query;
  return $form;
}

/**
 * Form submit for cmis_query_form - redirects to put query in url so we can use it on the results page
 */
function cmis_query_form_submit($form, &$form_state) {
  if ($form_state['values']['cmis_query']) {
    $form_state['redirect'] = 'cmis/query/' . urlencode(trim($form_state['values']['cmis_query']));
  }
  else {
    $form_state['redirect'] = 'cmis/query';
    form_set_error('cmis_query_form', 'Please enter a query');
  }
}

Functions

Namesort descending Description
cmis_query_form Render form for searching CMIS respository.
cmis_query_form_submit Form submit for cmis_query_form - redirects to put query in url so we can use it on the results page
cmis_query_menu Implementation of hook_menu() for CMIS search module.
cmis_query_theme Implementation of hook_theme()