Ignore:
Timestamp:
Sep 1, 2009, 9:48:45 PM (15 years ago)
Author:
nikrou
Message:

wip: chargement des imagettes
todo: modification des templates pour virer les tableaux !

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/akBookStyle/trunk/include/akContent.class.php

    r3807 r3812  
    2929class akContent
    3030{
     31  private $json_url = false;
     32
    3133  public function __construct($config) {
    3234    $this->plugin_config = $config;
    3335    $this->current_picture = 0;
     36
     37    $pattern = '`^/category/\d+(/start\-\d+)?/json$`';
     38    if (preg_match($pattern, $_SERVER['QUERY_STRING'], $matches)) {
     39      $this->json_url = true;
     40    }
    3441  }
    3542
     
    6067  }
    6168
    62 
    6369  public function loc_end_index_thumbnails($tpl_vars, $images) {
    6470    foreach ($tpl_vars as &$tpl_var) {
     
    7480    }
    7581
     82    if (isset($GLOBALS['template']->smarty->_tpl_vars['navbar']['URL_PREV'])) {
     83      $GLOBALS['template']->smarty->_tpl_vars['navbar']['URL_PREV'] .= '/json';
     84    }
     85    if (isset($GLOBALS['template']->smarty->_tpl_vars['navbar']['URL_NEXT'])) {
     86      $GLOBALS['template']->smarty->_tpl_vars['navbar']['URL_NEXT'] .= '/json';
     87    }
     88
    7689    return $tpl_vars;
     90  }
     91
     92  public function isJsonUrl() {
     93    return $this->json_url;
     94  }
     95
     96  public function load_thumbnails($tpl_vars, $images) {
     97    $template = new Template(PHPWG_ROOT_PATH.'template/'. $GLOBALS['user']['template'],
     98                             $GLOBALS['user']['theme']
     99                             );
     100    $template->assign('thumbnails', $tpl_vars);
     101    $template->assign('AK_BY_LINE', $this->plugin_config->ak_by_line);
     102    $template->set_filenames(array('index_thumbnails'=> AK_PLUGIN_TEMPLATE . '/ak_vertical.tpl'));
     103    $response['thumbnails'] = $template->parse('index_thumbnails', true);
     104    header("Content-Type: application/json");
     105    echo json_encode($response);
     106    exit();
    77107  }
    78108
Note: See TracChangeset for help on using the changeset viewer.