source: extensions/AMetaData/amd_aip.class.inc.php @ 27153

Last change on this file since 27153 was 16007, checked in by grum, 12 years ago

feature:2637- compatibility with Piwigo 2.4

  • Property svn:executable set to *
File size: 23.9 KB
Line 
1<?php
2/*
3 * -----------------------------------------------------------------------------
4 * Plugin Name: Advanced MetaData
5 * -----------------------------------------------------------------------------
6 * Author     : Grum
7 *   email    : grum@piwigo.org
8 *   website  : http://photos.grum.fr
9 *   PWG user : http://forum.piwigo.org/profile.php?id=3706
10 *
11 *   << May the Little SpaceFrog be with you ! >>
12 *
13 * -----------------------------------------------------------------------------
14 *
15 * See main.inc.php for release information
16 *
17 * AIP classe => manage integration in administration interface
18 *
19 * -----------------------------------------------------------------------------
20 */
21
22if (!defined('PHPWG_ROOT_PATH')) { die('Hacking attempt!'); }
23
24include_once('amd_root.class.inc.php');
25include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTabSheet.class.inc.php');
26include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/genericjs.class.inc.php');
27
28
29class AMD_AIP extends AMD_root
30{
31  protected $tabsheet;
32
33  /**
34   *
35   * constructor needs the prefix of piwigo's tables and the location of plugin
36   *
37   * @param String $prefixeTable
38   * @param String $filelocation
39   */
40  public function __construct($prefixeTable, $filelocation)
41  {
42    parent::__construct($prefixeTable, $filelocation);
43
44    $this->loadConfig();
45    $this->configForTemplate();
46    $this->initEvents();
47
48    $this->tabsheet = new tabsheet();
49
50    if($this->config['amd_InterfaceMode']=='basic')
51    {
52      $this->tabsheet->add('metadata',
53                            l10n('g003_metadata'),
54                            $this->getAdminLink().'-metadata');
55      $this->tabsheet->add('help',
56                            l10n('g003_help'),
57                            $this->getAdminLink().'-help');
58    }
59    else
60    {
61      $this->tabsheet->add('database',
62                            l10n('g003_database'),
63                            $this->getAdminLink().'-database');
64      $this->tabsheet->add('metadata',
65                            l10n('g003_metadata'),
66                            $this->getAdminLink().'-metadata');
67      $this->tabsheet->add('search',
68                            l10n('g003_search'),
69                            $this->getAdminLink().'-search');
70      $this->tabsheet->add('tags',
71                            l10n('g003_tags'),
72                            $this->getAdminLink().'-tags');
73      $this->tabsheet->add('help',
74                            l10n('g003_help'),
75                            $this->getAdminLink().'-help');
76    }
77  }
78
79  public function __destruct()
80  {
81    unset($this->tabsheet);
82    parent::__destruct();
83  }
84
85
86  /*
87   * ---------------------------------------------------------------------------
88   * Public classe functions
89   * ---------------------------------------------------------------------------
90   */
91
92
93  /**
94   * manage the plugin integration into piwigo's admin interface
95   */
96  public function manage()
97  {
98    global $template, $page;
99
100    $this->initRequest();
101
102    $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/amd_admin.tpl");
103
104    $this->tabsheet->select($_GET['tab']);
105    $this->tabsheet->assign();
106    $selected_tab=$this->tabsheet->get_selected();
107    $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]");
108
109    $pluginInfo=array(
110      'AMD_VERSION' => "<i>".$this->getPluginName()."</i> ".l10n('g003_version').AMD_VERSION,
111      'AMD_PAGE' => $_GET['tab'],
112      'PATH' => AMD_PATH
113    );
114
115    $template->assign('plugin', $pluginInfo);
116    GPCCore::setTemplateToken();
117
118    switch($_GET['tab'])
119    {
120      case 'help':
121        $this->displayHelp();
122        break;
123      case 'database':
124        $this->displayDatabase($_REQUEST['t']);
125        break;
126      case 'metadata':
127        $this->displayMetaData($_REQUEST['t']);
128        break;
129      case 'search':
130        $this->displaySearch($_REQUEST['t']);
131        break;
132      case 'tags':
133        $this->displayTags();
134        break;
135    }
136
137    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
138  }
139
140  /**
141   * initialize events call for the plugin
142   *
143   * don't inherits from its parent => it's normal
144   */
145  public function initEvents()
146  {
147    parent::initEvents();
148
149    if(isset($_GET['tab']) and $_GET['tab']=='search')
150    {
151      // load request builder JS only on the search page
152      GPCRequestBuilder::loadJSandCSS();
153    }
154  }
155
156
157  /**
158   * ---------------------------------------------------------------------------
159   * Private & protected functions
160   * ---------------------------------------------------------------------------
161   */
162
163  /**
164   * if empty, initialize the $_REQUEST var
165   *
166   * if not empty, check validity for the request values
167   *
168   */
169  private function initRequest()
170  {
171    //initialise $REQUEST values if not defined
172
173    if(!isset($_GET['tab']))
174    {
175      if($this->getNumOfPictures()==0 and $this->config['amd_InterfaceMode']=='advanced')
176      {
177        $_GET['tab']="database";
178        $_REQUEST['t']="state";
179      }
180      else
181      {
182        $_GET['tab']="metadata";
183        $_REQUEST['t']="select";
184      }
185    }
186
187    $tmp=explode('/', $_GET['tab'].'/');
188    $_GET['tab']=$tmp[0];
189    $_REQUEST['t']=$tmp[1];
190
191
192    if(!($_GET['tab']=="metadata" or
193         $_GET['tab']=="help" or
194         $_GET['tab']=="database" or
195         $_GET['tab']=="search" or
196         $_GET['tab']=="tags")
197         or
198         $this->config['amd_InterfaceMode']=='basic' and
199         (
200           $_GET['tab']=="database" or
201           $_GET['tab']=="search" or
202           $_GET['tab']=="tags"
203         )
204      )
205    {
206      $_GET['tab']="metadata";
207    }
208
209    /*
210     * metadata tabsheet
211     */
212    if($_GET['tab']=="metadata")
213    {
214      if(!isset($_REQUEST['t']))
215      {
216        if($this->config['amd_InterfaceMode']=='basic')
217        {
218          $_REQUEST['t']="display";
219        }
220        else
221        {
222          $_REQUEST['t']="select";
223        }
224      }
225
226      if(!($_REQUEST['t']=="personnal" or
227           $_REQUEST['t']=="select" or
228           $_REQUEST['t']=="display")
229           or
230           $this->config['amd_InterfaceMode']=='basic' and
231           (
232             $_REQUEST['t']=="select"
233           )
234        )
235      {
236        if($this->config['amd_InterfaceMode']=='basic')
237        {
238          $_REQUEST['t']="display";
239        }
240        else
241        {
242          $_REQUEST['t']="select";
243        }
244      }
245    }
246
247    /*
248     * help tabsheet
249     */
250    if($_GET['tab']=="help")
251    {
252      if(!isset($_REQUEST['t'])) $_REQUEST['t']="exif";
253
254      if(!($_REQUEST['t']=="exif" or
255           $_REQUEST['t']=="iptc" or
256           $_REQUEST['t']=="xmp" or
257           $_REQUEST['t']=="magic")) $_REQUEST['t']="exif";
258    }
259
260    /*
261     * search tabsheet
262     */
263    if($_GET['tab']=="search")
264    {
265      if(!isset($_REQUEST['t'])) $_REQUEST['t']="search";
266
267      if(!($_REQUEST['t']=="config" or
268           $_REQUEST['t']=="search")) $_REQUEST['t']="search";
269    }
270
271    /*
272     * database tabsheet
273     */
274    if($_GET['tab']=="database")
275    {
276      if(!isset($_REQUEST['t'])) $_REQUEST['t']="state";
277
278      if(!($_REQUEST['t']=="state" or
279           $_REQUEST['t']=="update")) $_REQUEST['t']="state";
280    }
281
282
283  } //init_request
284
285
286  /**
287   * manage adviser profile
288   *
289   * @return Boolean : true if user is adviser, otherwise false (and push a
290   *                   message in the error list)
291   */
292  protected function adviser_abort()
293  {
294    if(is_adviser())
295    {
296      $this->display_result(l10n("g003_adviser_not_allowed"), false);
297      return(true);
298    }
299    return(false);
300  }
301
302
303
304
305  /**
306   * display and manage the search page
307   */
308  protected function displaySearch()
309  {
310    global $template, $lang;
311
312    $template->set_filename('body_page',
313                dirname($this->getFileLocation()).'/admin/amd_metadata_search.tpl');
314
315    $template->assign('amd_search_page', GPCRequestBuilder::displaySearchPage('AMetaData'));
316
317    $template->assign_var_from_handle('AMD_BODY_PAGE', 'body_page');
318  }
319
320
321
322
323  /**
324   * display and manage the metadata page
325   * the page have three tabsheet :
326   *  - personnal tag management, to build personnal tags
327   *  - select tag management, to manage tags to be selected on the galerie
328   *  - display tag management, to choose how the tags are displayed
329   *
330   * @param String $tab : the selected tab on the stat page
331   */
332  protected function displayMetaData($tab)
333  {
334    global $template, $user;
335    $template->set_filename('body_page', dirname(__FILE__).'/admin/amd_metadata.tpl');
336
337    $statTabsheet = new GPCTabSheet('statTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder', 'itab2');
338    $statTabsheet->select($tab);
339    $statTabsheet->add('personnal',
340                          l10n('g003_personnal'),
341                          $this->getAdminLink().'-metadata/personnal');
342    if($this->config['amd_InterfaceMode']=='advanced')
343    {
344      $statTabsheet->add('select',
345                            l10n('g003_select'),
346                            $this->getAdminLink().'-metadata/select');
347    }
348    $statTabsheet->add('display',
349                          l10n('g003_display'),
350                          $this->getAdminLink().'-metadata/display');
351    $statTabsheet->assign();
352
353    switch($tab)
354    {
355      case 'select':
356        $template->assign('sheetContent', $this->displayMetaDataSelect());
357        break;
358      case 'display':
359        $template->assign('sheetContent', $this->displayMetaDataDisplay());
360        break;
361      case 'personnal':
362        $template->assign('sheetContent', $this->displayMetaDataPersonnal());
363        break;
364    }
365
366    $template->assign_var_from_handle('AMD_BODY_PAGE', 'body_page');
367  }
368
369
370  /**
371   * display and manage the metadata page allowing to build user defined tags
372   *
373   * @return String : the content of the page
374   */
375  protected function displayMetaDataPersonnal()
376  {
377    global $template, $theme, $themes, $themeconf, $lang;
378
379    $template->set_filename('sheet_page',
380                  dirname($this->getFileLocation()).'/admin/amd_metadata_personnal.tpl');
381
382    $datas=array(
383      'urlRequest' => $this->getAdminLink('ajax'),
384      'tagList' => array(),
385    );
386
387    /*
388     * build tagList
389     */
390    $sql="SELECT ut.name, ut.numId, ut.tagId
391          FROM ".$this->tables['used_tags']." ut
392            JOIN ".$this->tables['selected_tags']." st ON st.tagId = ut.tagId
393          ORDER BY tagId";
394    $result=pwg_query($sql);
395    if($result)
396    {
397      while($row=pwg_db_fetch_assoc($result))
398      {
399        $datas['tagList'][]=Array(
400          'tagId' => $row['tagId'],
401          'name'  => L10n::get($row['name']),
402          'numId' => $row['numId']
403        );
404      }
405    }
406
407    $lang['g003_personnal_page_help']=GPCCore::BBtoHTML($lang['g003_personnal_page_help']);
408
409    $template->assign('datas', $datas);
410    return($template->parse('sheet_page', true));
411  }
412
413
414  /**
415   * display and manage the metadata page allowing to make tags selection
416   *
417   * @return String : the content of the page
418   */
419  protected function displayMetaDataSelect()
420  {
421    global $template, $theme, $themes, $themeconf, $lang;
422
423    $template->set_filename('sheet_page',
424                  dirname($this->getFileLocation()).'/admin/amd_metadata_select.tpl');
425
426    $datas=array(
427      'urlRequest' => $this->getAdminLink('ajax'),
428      'config_GetListTags_OrderType' => $this->config['amd_GetListTags_OrderType'],
429      'config_GetListTags_FilterType' => $this->config['amd_GetListTags_FilterType'],
430      'config_GetListTags_ExcludeUnusedTag' => $this->config['amd_GetListTags_ExcludeUnusedTag'],
431      'config_GetListTags_SelectedTagOnly' => $this->config['amd_GetListTags_SelectedTagOnly'],
432      'config_GetListImages_OrderType' => $this->config['amd_GetListImages_OrderType']
433    );
434
435    $lang['g003_select_page_help']=GPCCore::BBtoHTML($lang['g003_select_page_help']);
436
437    $template->assign('datas', $datas);
438    return($template->parse('sheet_page', true));
439  }
440
441
442  /**
443   * display and manage the metadata page allowing to choose tags order
444   *
445   * @return String : the content of the page
446   */
447  protected function displayMetaDataDisplay()
448  {
449    global $user, $template, $lang;
450
451    //$local_tpl = new Template(AMD_PATH."admin/", "");
452    $template->set_filename('sheet_page',
453                  dirname($this->getFileLocation()).'/admin/amd_metadata_display.tpl');
454
455    $datas=array(
456      'urlRequest' => $this->getAdminLink('ajax'),
457      'selectedTags' => Array(),
458      'groups' => Array(),
459      'tagByGroup' => Array(),
460    );
461
462    $sql="SELECT st.tagId, st.order, st.groupId, ut.numId
463          FROM ".$this->tables['selected_tags']." st
464            LEFT JOIN ".$this->tables['used_tags']." ut
465              ON ut.tagId = st.tagId
466          ORDER BY st.groupId ASC, st.order ASC, st.tagId ASC";
467    $result=pwg_query($sql);
468    if($result)
469    {
470      while($row=pwg_db_fetch_assoc($result))
471      {
472        if($row['groupId']==-1)
473        {
474          $datas['selectedTags'][]=Array(
475            'numId' => $row['numId'],
476            'tagId' => $row['tagId']
477          );
478        }
479        else
480        {
481          $datas['tagByGroup'][]=Array(
482            'numId' => $row['numId'],
483            'tagId' => $row['tagId'],
484            'group' => $row['groupId'],
485            'order' => $row['order']
486          );
487        }
488      }
489    }
490
491    $sql="SELECT g.groupId, gn.name
492          FROM ".$this->tables['groups']." g
493            LEFT JOIN ".$this->tables['groups_names']." gn
494              ON g.groupId = gn.groupId
495          WHERE gn.lang = '".$user['language']."'
496          ORDER BY g.order;";
497    $result=pwg_query($sql);
498    if($result)
499    {
500      while($row=pwg_db_fetch_assoc($result))
501      {
502        $datas['groups'][]=Array(
503          'id' => $row['groupId'],
504          'name' => $row['name']
505        );
506      }
507    }
508
509    $lang['g003_display_page_help']=GPCCore::BBtoHTML($lang['g003_display_page_help']);
510    $template->assign('datas', $datas);
511    return($template->parse('sheet_page', true));
512  }
513
514
515  /**
516   * display and manage the database page
517   * the page have two tabsheet :
518   *  - state, to have general information about the database
519   *  - update, to manage database fill-in
520   *
521   * @param String $tab : the selected tab on the stat page
522   */
523  protected function displayDatabase($tab)
524  {
525    global $template, $user;
526    $template->set_filename('body_page', dirname(__FILE__).'/admin/amd_metadata.tpl');
527
528    $statTabsheet = new GPCTabSheet('statTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder', 'itab2');
529    $statTabsheet->select($tab);
530    $statTabsheet->add('state',
531                          l10n('g003_state'),
532                          $this->getAdminLink().'-database/state');
533    $statTabsheet->add('update',
534                          l10n('g003_update'),
535                          $this->getAdminLink().'-database/update');
536    $statTabsheet->assign();
537
538    switch($tab)
539    {
540      case 'state':
541        $template->assign('sheetContent', $this->displayDatabaseStatus());
542        break;
543      case 'update':
544        $template->assign('sheetContent', $this->displayDatabaseDatabase());
545        break;
546    }
547
548    $template->assign_var_from_handle('AMD_BODY_PAGE', 'body_page');
549  }
550
551
552
553  /**
554   * display the database status
555   *
556   * @return String : the content of the page
557   */
558  private function displayDatabaseStatus()
559  {
560    global $template, $page;
561
562    $template->set_filename('sheet_page', dirname(__FILE__).'/admin/amd_metadata_database_status.tpl');
563
564    $warning2='';
565    $sql="SELECT tagId
566          FROM ".$this->tables['used_tags']."
567          WHERE newFromLastUpdate='y'";
568    $result=pwg_query($sql);
569    if($result)
570    {
571      $tmp=array();
572      $tagSchema='';
573      while($row=pwg_db_fetch_assoc($result))
574      {
575        if(preg_match('/^([a-z0-9]*)\..*/i', $row['tagId'], $tagSchema))
576        {
577          if(!in_array($tagSchema[1],$this->config['amd_FillDataBaseIgnoreSchemas'])) $tmp[]=$row['tagId'];
578        }
579      }
580      if(count($tmp)>0)
581      {
582        $ul='';
583        foreach($tmp as $val)
584        {
585          $ul.='<li>'.$val.'</li>';
586        }
587        if(count($tmp)>1)
588        {
589          $warning2=sprintf(GPCCore::BBtoHTML(l10n('g003_databaseWarning2_n')),$ul);
590        }
591        else
592        {
593          $warning2=sprintf(GPCCore::BBtoHTML(l10n('g003_databaseWarning2_1')),$ul);
594        }
595      }
596    }
597
598
599    $datas=array(
600      'urlRequest' => $this->getAdminLink('ajax'),
601      'warning2' => $warning2,
602      'warning1' => GPCCore::BBtoHTML(l10n('g003_databaseWarning1')),
603      'nfoMetadata' => Array(
604          'exif' => 0,
605          'iptc' => 0,
606          'magic' => 0,
607          'xmp' => 0,
608          'com' => 0,
609          'userDefined' => 0,
610          'numOfPictures' => 0,
611          'numOfNotAnalyzedPictures' => 0,
612          'numOfPicturesWithoutTag' => 0,
613          'nfoSize' => 0,
614          'nfoRows' => 0,
615          'nfoSizeAndRows' => '',
616        )
617    );
618
619    $sql="SELECT SUM(numOfImg) AS nb, 'exif' AS `type`
620          FROM ".$this->tables['used_tags']."
621          WHERE tagId LIKE 'exif.%'
622          UNION
623          SELECT SUM(numOfImg), 'iptc'
624          FROM ".$this->tables['used_tags']."
625          WHERE tagId LIKE 'iptc.%'
626          UNION
627          SELECT SUM(numOfImg), 'magic'
628          FROM ".$this->tables['used_tags']."
629          WHERE tagId LIKE 'magic.%'
630          UNION
631          SELECT SUM(numOfImg), 'xmp'
632          FROM ".$this->tables['used_tags']."
633          WHERE tagId LIKE 'xmp.%'
634          UNION
635          SELECT SUM(numOfImg), 'com'
636          FROM ".$this->tables['used_tags']."
637          WHERE tagId LIKE 'com.%'
638          UNION
639          SELECT SUM(numOfImg), 'userDefined'
640          FROM ".$this->tables['used_tags']."
641          WHERE tagId LIKE 'userDefined.%'
642          UNION
643          SELECT COUNT(imageId), 'numOfPictures'
644          FROM ".$this->tables['images']."
645          WHERE analyzed='y'
646          UNION
647          SELECT COUNT(imageId), 'numOfNotAnalyzedPictures'
648          FROM ".$this->tables['images']."
649          WHERE analyzed='n'
650          UNION
651          SELECT COUNT(imageId), 'numOfPicturesWithoutTag'
652          FROM ".$this->tables['images']."
653          WHERE nbTags=0";
654    $result=pwg_query($sql);
655    if($result)
656    {
657      while($row=pwg_db_fetch_assoc($result))
658      {
659        if(!is_null($row['nb']))
660        {
661          $datas['nfoMetadata'][$row['type']]=$row['nb'];
662          if($row['type']=='exif' or
663             $row['type']=='iptc' or
664             $row['type']=='magic' or
665             $row['type']=='xmp' or
666             $row['type']=='com' or
667             $row['type']=='userDefined') $datas['nfoMetadata']['nfoRows']+=$row['nb'];
668        }
669      }
670    }
671
672    $sql="SHOW TABLE STATUS WHERE name LIKE '".$this->tables['images_tags']."'";
673    $result=pwg_query($sql);
674    if($result)
675    {
676      while($row=pwg_db_fetch_assoc($result))
677      {
678        $datas['nfoMetadata']['nfoSize']=$row['Data_length']+$row['Index_length'];
679      }
680    }
681
682    if($datas['nfoMetadata']['nfoSize']<1048576)
683    {
684      $datas['nfoMetadata']['nfoSize']=sprintf('%.2fKio', $datas['nfoMetadata']['nfoSize']/1024);
685    }
686    else
687    {
688      $datas['nfoMetadata']['nfoSize']=sprintf('%.2fMio', $datas['nfoMetadata']['nfoSize']/1048576);
689    }
690    $datas['nfoMetadata']['nfoSizeAndRows']=sprintf(l10n('g003_sizeAndRows'), $datas['nfoMetadata']['nfoSize'], $datas['nfoMetadata']['nfoRows']);
691    $datas['nfoMetadata']['numOfPictures']=sprintf(l10n('g003_numberOfAnalyzedPictures'), $datas['nfoMetadata']['numOfPictures']);
692    $datas['nfoMetadata']['numOfNotAnalyzedPictures']=sprintf(l10n('g003_numberOfNotAnalyzedPictures'), $datas['nfoMetadata']['numOfNotAnalyzedPictures']);
693    $datas['nfoMetadata']['numOfPicturesWithoutTag']=sprintf(l10n('g003_numberOfPicturesWithoutTags'), $datas['nfoMetadata']['numOfPicturesWithoutTag']);
694
695    $template->assign("datas", $datas);
696
697    return($template->parse('sheet_page', true));
698  } // displayDatabaseStatus
699
700
701
702
703  /**
704   * display and manage the database page
705   *
706   * the function automatically update the AMD tables :
707   *  - add new pictures in the AMD image table (assuming image is not analyzed
708   *    yet)
709   *  - remove deleted pictures in the AMD image & image_tags table
710   *
711   * @return String : the content of the page
712   */
713  private function displayDatabaseDatabase()
714  {
715    global $template, $page, $user;
716
717    /*
718     * insert new image (from piwigo images table) in the AMD images table, with
719     * statut 'not analyzed'
720     */
721    $sql="INSERT INTO ".$this->tables['images']."
722            SELECT id, 'n', 0
723              FROM ".IMAGES_TABLE."
724              WHERE id NOT IN (SELECT imageId FROM ".$this->tables['images'].")";
725    pwg_query($sql);
726
727
728    /*
729     * delete image who are in the AMD images table and not in the piwigo image
730     * table
731     */
732    $sql="DELETE FROM ".$this->tables['images']."
733            WHERE imageId NOT IN (SELECT id FROM ".IMAGES_TABLE.")";
734    pwg_query($sql);
735
736
737    /*
738     * delete metadata for images that are not in the AMD image table
739     */
740    $sql="DELETE ait
741          FROM ".$this->tables['images_tags']." ait
742            JOIN (SELECT DISTINCT imageId FROM ".$this->tables['images_tags']." ) aitd
743              ON ait.imageId=aitd.imageId
744          WHERE aitd.imageId NOT IN (SELECT id FROM ".IMAGES_TABLE.") ";
745    pwg_query($sql);
746
747
748    $caddieNbPictures=0;
749    $sql="SELECT COUNT(element_id) AS nbPictures
750          FROM ".CADDIE_TABLE."
751          WHERE user_id='".$user['id']."';";
752    $result=pwg_query($sql);
753    if($result)
754    {
755      while($row=pwg_db_fetch_assoc($result))
756      {
757        $caddieNbPictures=$row['nbPictures'];
758      }
759    }
760
761
762    $template->set_filename('sheet_page', dirname(__FILE__).'/admin/amd_metadata_database_database.tpl');
763
764    $datas=array(
765      'urlRequest' => $this->getAdminLink('ajax'),
766      'NumberOfItemsPerRequest' => $this->config['amd_NumberOfItemsPerRequest'],
767      'caddieNbPictures' => ($caddieNbPictures==1)?l10n('g003_1_picture_in_caddie'):sprintf(l10n('g003_n_pictures_in_caddie'), $caddieNbPictures)
768    );
769
770    $template->assign("datas", $datas);
771
772    return($template->parse('sheet_page', true));
773  } // displayDatabase
774
775
776
777
778
779  /**
780   * display and manage the help page
781   *
782   * @param String $tab : the selected tab on the help page
783   */
784  protected function displayHelp()
785  {
786    global $template, $user, $lang;
787    $template->set_filename('body_page', dirname(__FILE__).'/admin/amd_help.tpl');
788
789    $statTabsheet = new GPCTabSheet('statTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder', 'itab2');
790    $statTabsheet->add('exif',
791                          l10n('g003_help_tab_exif'),
792                          '', true, "displayHelp('exif');");
793    $statTabsheet->add('iptc',
794                          l10n('g003_help_tab_iptc'),
795                          '', false, "displayHelp('iptc');");
796    $statTabsheet->add('xmp',
797                          l10n('g003_help_tab_xmp'),
798                          '', false, "displayHelp('xmp');");
799    $statTabsheet->add('magic',
800                          l10n('g003_help_tab_magic'),
801                          '', false, "displayHelp('magic');");
802    $statTabsheet->assign();
803
804    $data=Array(
805      'sheetContent_exif' => GPCCore::BBtoHTML($lang['g003_help_exif']),
806      'sheetContent_xmp' => GPCCore::BBtoHTML($lang['g003_help_xmp']),
807      'sheetContent_iptc' => GPCCore::BBtoHTML($lang['g003_help_iptc']),
808      'sheetContent_magic' => GPCCore::BBtoHTML($lang['g003_help_magic']),
809      'title_exif' => l10n('g003_help_tab_exif'),
810      'title_xmp' => l10n('g003_help_tab_xmp'),
811      'title_iptc' => l10n('g003_help_tab_iptc'),
812      'title_magic' => l10n('g003_help_tab_magic')
813    );
814
815    $template->assign('data', $data);
816
817    $template->assign_var_from_handle('AMD_BODY_PAGE', 'body_page');
818  }
819
820
821  /**
822   * display and manage the tags page
823   *
824   */
825  protected function displayTags()
826  {
827    global $template, $user, $lang;
828    $template->set_filename('body_page', dirname(__FILE__).'/admin/amd_metadata_tags.tpl');
829
830    $datas=array(
831      'urlRequest' => $this->getAdminLink('ajax')
832    );
833
834    $lang['g003_tags_page_help']=GPCCore::BBtoHTML($lang['g003_tags_page_help']);
835
836    $template->assign('datas', $datas);
837
838    $template->assign_var_from_handle('AMD_BODY_PAGE', 'body_page');
839  }
840
841
842} // AMD_AIP class
843
844
845?>
Note: See TracBrowser for help on using the repository browser.