|
@@ -4,7 +4,7 @@
|
|
|
function materio_search_api_ajax_search($page = 0){
|
|
|
$debug = false;
|
|
|
global $user, $base_url;
|
|
|
- // TODO: set research path configurable
|
|
|
+ // TODO: set research path configurable
|
|
|
$search_path = "explore";
|
|
|
|
|
|
# execute search
|
|
@@ -26,7 +26,7 @@ function materio_search_api_ajax_search($page = 0){
|
|
|
exit ;
|
|
|
}
|
|
|
|
|
|
- // TODO: if no permission, redirect to home
|
|
|
+ // TODO: if no permission, redirect to home
|
|
|
|
|
|
# content type filter s
|
|
|
// $types = $_GET['types'];
|
|
@@ -52,7 +52,7 @@ function materio_search_api_ajax_search($page = 0){
|
|
|
|
|
|
user_save($user, array("data"=>array('materiosearchapi_bundlesfilter' => $active_types)));
|
|
|
|
|
|
- # if we are not already on the search page then don't respond with search results but redirect to search page
|
|
|
+ # if we are not already on the search page then don't respond with search results but redirect to search page
|
|
|
if(isset($_GET['current_path'])){
|
|
|
// url() generates the prefix using hook_url_outbound_alter(). Instead of
|
|
|
// running the hook_url_outbound_alter() again here, extract the prefix
|
|
@@ -77,7 +77,7 @@ function materio_search_api_ajax_search($page = 0){
|
|
|
// TODO implement the new search mode (only term)
|
|
|
if(isset($_GET['searchmode'])){
|
|
|
$searchmode = $_GET['searchmode'];
|
|
|
- user_save($user, array("data"=>array('materiosearchapi_searchmode' => $searchmode)));
|
|
|
+ user_save($user, array("data"=>array('materiosearchapi_searchmode' => $searchmode)));
|
|
|
}
|
|
|
|
|
|
// dsm($path, 'path');
|
|
@@ -86,7 +86,7 @@ function materio_search_api_ajax_search($page = 0){
|
|
|
$return = menu_execute_active_handler($path, FALSE);
|
|
|
|
|
|
//dsm($return, '$return');
|
|
|
-
|
|
|
+
|
|
|
if (is_int($return)) {
|
|
|
switch ($return) {
|
|
|
case MENU_NOT_FOUND :
|
|
@@ -106,7 +106,7 @@ function materio_search_api_ajax_search($page = 0){
|
|
|
$return = drupal_render($return);
|
|
|
// $return = theme($return['#theme'], $return);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$rep = array(
|
|
|
'path'=>$search_path.'/'.$keys_encoded,
|
|
|
'keys'=>$keys,
|
|
@@ -119,14 +119,14 @@ function materio_search_api_ajax_search($page = 0){
|
|
|
|
|
|
if(isset($count))
|
|
|
$rep['count'] = $count;
|
|
|
-
|
|
|
+
|
|
|
if ($debug) {
|
|
|
//dsm($rep, 'rep');
|
|
|
return "debug display";
|
|
|
}else{
|
|
|
- drupal_json_output($rep);
|
|
|
+ drupal_json_output($rep);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -148,14 +148,14 @@ function materio_search_api_ajax_viewmode_change($vm){
|
|
|
// }
|
|
|
$_GET['page'] = 0;
|
|
|
$rep = _materio_search_api_change_viewmode($vm);
|
|
|
-
|
|
|
+
|
|
|
drupal_json_output($rep);
|
|
|
}
|
|
|
|
|
|
|
|
|
function materio_search_api_ajax_actuality($page = 0){
|
|
|
$debug = false;
|
|
|
-
|
|
|
+
|
|
|
$_GET['page'] = $page;
|
|
|
|
|
|
$path = 'actuality';
|
|
@@ -187,13 +187,13 @@ function materio_search_api_ajax_actuality($page = 0){
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
-
|
|
|
+
|
|
|
// get results
|
|
|
menu_set_active_item($path);
|
|
|
$return = menu_execute_active_handler($path, FALSE);
|
|
|
|
|
|
//dsm($return, '$return');
|
|
|
-
|
|
|
+
|
|
|
if (is_int($return)) {
|
|
|
switch ($return) {
|
|
|
case MENU_NOT_FOUND :
|
|
@@ -211,25 +211,25 @@ function materio_search_api_ajax_actuality($page = 0){
|
|
|
if (is_array($return)) {
|
|
|
$return = drupal_render($return);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$rep = array(
|
|
|
'path' => $path,
|
|
|
'returned'=>$return,
|
|
|
'title' => drupal_get_title(),
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
if ($debug) {
|
|
|
//dsm($rep, 'rep');
|
|
|
return "debug display";
|
|
|
}else{
|
|
|
- drupal_json_output($rep);
|
|
|
+ drupal_json_output($rep);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function materio_search_api_ajax_node($nid){
|
|
|
global $user;
|
|
|
-
|
|
|
+
|
|
|
$viewmode = isset($_GET['viewmode']) ? $_GET['viewmode'] : (isset($user->data['materiosearchapi_viewmode']) ? $user->data['materiosearchapi_viewmode'] : variable_get('defaultviewmode', 'full'));
|
|
|
|
|
|
$rep = array(
|
|
@@ -242,6 +242,6 @@ function materio_search_api_ajax_node($nid){
|
|
|
'nid' => $nid,
|
|
|
'node' => drupal_render($nodeview),
|
|
|
);
|
|
|
- drupal_json_output($rep);
|
|
|
+ drupal_json_output($rep);
|
|
|
}
|
|
|
}
|