bookmarks fixing

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2013-03-07 19:04:15 +01:00
parent 454adf9478
commit 06a4d254c2
6 changed files with 169 additions and 64 deletions
+48 -1
View File
@@ -333,6 +333,54 @@ function materio_flag_nodelinks(){
drupal_json_output($rep);
}
function materio_flag_user_bookmarks(){
global $user;
drupal_set_title(t('My bookmarks'), PASS_THROUGH);
$flaged = flag_get_user_flags('node');
// dsm($flaged, 'flaged');
$flag = flag_get_flag('bookmarks');
$flaged_content = $flaged['bookmarks'];
// dsm($flaged_content, 'flaged_content');
$viewmode = isset($user->data['materiosearchapi_viewmode']) ? $user->data['materiosearchapi_viewmode'] : variable_get('defaultviewmode', 'full');
$limit = variable_get($viewmode.'_limite', '10');
$offset = pager_find_page() * $limit;
$count = count($flaged_content);
$max = $offset+$limit > $count ? $count : $offset+$limit;
$i = 0;
foreach ($flaged_content as $id => $item) {
if($i >= $offset){
if($i < $max){
if($item->entity_type == 'node'){
$items[] = node_load($id);
}
}else{
break;
}
}
}
$ret['#items'] = $items;
$ret['#theme'] = 'materio_flag_mylists_list';
$ret['#view_mode'] = $viewmode;
$ret['#fid'] = $flag->fid;
$ret['#count'] = $count;
$ret['#name'] = variable_get('flag_lists_name', 'list');
$ret['#title'] = $flag->title;
pager_default_initialize($count, $limit);
$ret['#pager'] = theme('pager');
drupal_add_js(drupal_get_path('module', 'materio_flag').'/js/materio_flag-ck.js');
return $ret;
}
function materio_flag_user_lists($fid){
global $user;
$flag = flag_lists_get_flag($fid);
@@ -368,7 +416,6 @@ function materio_flag_user_lists($fid){
$ret['#pager'] = theme('pager');
return $ret;
}
function materio_flag_ajax_list($fid, $page = 0){