Project

General

Profile

« Previous | Next » 

Revision 806baeb2

Added by Andreas Kohlbecker about 14 years ago

refactoring i.e. splitting the themes file

View differences:

modules/cdm_dataportal/cdm_dataportal.module
6 6
 * cdm_dataportal
7 7
 *
8 8
 * Copyright (C) 2007 EDIT
9
 * European Distributed Institute of Taxonomy
9
 * European Distributed Institute of Taxonomy 
10 10
 * http://www.e-taxonomy.eu
11
 *
11
 * 
12
 * The contents of this file are subject to the Mozilla Public License Version 1.1
13
 * See http://www.mozilla.org/MPL/MPL-1.1.html for the full license terms.
12 14
 */
13 15

  
14 16
require_once('node_types.php');
15
require_once('cdm_dataportal.theme.php');
17

  
18
require_once('theme/cdm_dataportal.common.theme');
19
require_once('theme/cdm_dataportal.descriptions.theme');
20
require_once('theme/cdm_dataportal.media.theme');
21
require_once('theme/cdm_dataportal.occurrence.theme');
22
require_once('theme/cdm_dataportal.page.theme');
23
require_once('theme/cdm_dataportal.taxon.theme');
24
require_once('theme/cdm_dataportal.name.theme');
25
require_once('theme/cdm_dataportal.references.theme');
26

  
16 27
require_once('classes/footnotemanager.php');
17 28
require_once('classes/footnote.php');
18 29

  
......
27 38
    "cdm_dataportal_show_thumbnail_captions" => 1,
28 39
    "cdm_dataportal_media_maxextend" => 120,
29 40
    "cdm_dataportal_media_cols" => 3,
30
    "cdm_dataportal_media_maxRows" => 1);
41
    "cdm_dataportal_media_maxRows" => 0);
31 42
define('CDM_DATAPORTAL_GALLERY_SETTINGS', serialize($gallery_settings));
32
define('CDM_DATAPORTAL_DESCRIPTION_GALLERY_FORM_NAME', "description_gallery");
33
define('CDM_DATAPORTAL_MEDIA_GALLERY_FORM_NAME', "media_gallery");
34
define('CDM_DATAPORTAL_SEARCH_GALLERY_FORM_NAME', "search_gallery");
43
define('CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME', "description_gallery");
44
define('CDM_DATAPORTAL_MEDIA_GALLERY_NAME', "media_gallery");
45
define('CDM_DATAPORTAL_SEARCH_GALLERY_NAME', "search_gallery");
46

  
47

  
48

  
49

  
50
function getGallerySettings($gallery_config_form_name){
51
	$default_values = unserialize(CDM_DATAPORTAL_GALLERY_SETTINGS);
52
  	return variable_get($gallery_config_form_name, $default_values);
53
}
35 54

  
36 55

  
37 56

  
......
761 780
    '#options' => $selectShowMedia,
762 781
    '#description'   => t('Select if a taxon should show only his media or also child media.')
763 782
    );
764
/*
765
    // --- SEARCH TAXA GALLERY ---- //
766
    $form['findtaxa'] = array(
767
    '#type' => 'fieldset',
768
    '#title' => t('Search Taxa'),
769
    '#collapsible' => TRUE,
770
    '#collapsed' => FALSE,
771
    );
772 783

  
773
    //variable_get('', 1);
774
    $form['findtaxa']['cdm_dataportal_findtaxa_show_taxon_thumbnails'] = array(
775
    '#type' => 'checkbox',
776
    '#title' => t('Show media thumbnails for accepted taxa'),
777
    '#default_value' => variable_get('cdm_dataportal_findtaxa_show_taxon_thumbnails', 1),
778
    '#description' => t('')
779
    );
780

  
781
    $form['findtaxa']['cdm_dataportal_findtaxa_show_synonym_thumbnails'] = array(
782
    '#type' => 'checkbox',
783
    '#title' => t('Show media thumbnails for synonyms'),
784
    '#default_value' => variable_get('cdm_dataportal_findtaxa_show_synonym_thumbnails', 0),
785
    '#description' => t('')
786
    );
787

  
788
    //   $showCaption = variable_get('cdm_dataportal_findtaxa_show_thumbnail_captions', 0);
789
    $form['findtaxa']['cdm_dataportal_findtaxa_show_thumbnail_captions'] = array(
790
    '#type' => 'checkbox',
791
    '#title' => t('Show captions under thumbnails'),
792
    '#default_value' => variable_get('cdm_dataportal_findtaxa_show_thumbnail_captions', 1),
793
    '#description' => t('')
794
    );
795

  
796
    $form['findtaxa']['cdm_dataportal_findtaxa_media_maxextend'] = array(
797
    '#type' => 'textfield',
798
    '#title' => t('Maximum extend of Images'),
799
    '#default_value' => variable_get('cdm_dataportal_findtaxa_media_maxextend', 120),
800
    '#description' => t('')
801
    );
802

  
803
    $form['findtaxa']['cdm_dataportal_findtaxa_media_cols'] = array(
804
    '#type' => 'textfield',
805
    '#title' => t('Number of columns'),
806
    '#default_value' => variable_get('cdm_dataportal_findtaxa_media_cols', 3),
807
    '#description' => t('')
808
    );
809

  
810
    $form['findtaxa']['cdm_dataportal_findtaxa_media_maxRows'] = array(
811
    '#type' => 'textfield',
812
    '#title' => t('Maximum number of rows'),
813
    '#default_value' => variable_get('cdm_dataportal_findtaxa_media_maxRows', 1),
814
    '#description' => t('')
815
    );
816
*/
817 784
    // --- SEARCH TAXA GALLERY ---- //
818 785
    $collapsed = TRUE;
819
    $form_name = CDM_DATAPORTAL_SEARCH_GALLERY_FORM_NAME;
786
    $form_name = CDM_DATAPORTAL_SEARCH_GALLERY_NAME;
820 787
    $form_tittle = 'Search Taxa';
821 788
    $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
822 789

  
823 790
    // --- FEATURE DESCRIPTION GALLERY ---- //
824
    $form_name = CDM_DATAPORTAL_DESCRIPTION_GALLERY_FORM_NAME;
791
    $form_name = CDM_DATAPORTAL_DESCRIPTION_GALLERY_NAME;
825 792
    $form_tittle = 'Description elements gallery';
826 793
    $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
827 794

  
828 795
    // --- MEDIA GALLERY ---- //
829
    $form_name = CDM_DATAPORTAL_MEDIA_GALLERY_FORM_NAME;
796
    $form_name = CDM_DATAPORTAL_MEDIA_GALLERY_NAME;
830 797
    $form_tittle = 'Media gallery';
831 798
    $form[] = cdm_dataportal_create_gallery_settings_form($form_name, $form_tittle, $collapsed);
832 799

  
......
845 812

  
846 813
	$default_values = unserialize(CDM_DATAPORTAL_GALLERY_SETTINGS);
847 814
	$gallery_settings = variable_get($form_name, $default_values);
848
	//variable_get('', 1);
815

  
849 816
	$form[$form_name]['cdm_dataportal_show_taxon_thumbnails'] = array(
850 817
    '#type' => 'checkbox',
851 818
    '#title' => t('Show media thumbnails for accepted taxa'),
......
872 839
    '#type' => 'textfield',
873 840
    '#title' => t('Maximum extend of Images'),
874 841
    '#default_value' => $gallery_settings['cdm_dataportal_media_maxextend'],
875
    '#description' => t('')
842
    '#description' => t('In the gallery neither width or height will exceed the maximum extend of images.')
876 843
	);
877 844

  
878 845
	$form[$form_name]['cdm_dataportal_media_cols'] = array(
......
886 853
    '#type' => 'textfield',
887 854
    '#title' => t('Maximum number of rows'),
888 855
    '#default_value' => $gallery_settings['cdm_dataportal_media_maxRows'],
889
    '#description' => t('')
856
    '#description' => t('If you want an unlimited number of rows please set to 0')
890 857
	);
891 858

  
892 859
	return $form;
......
1669 1636
	//returned value
1670 1637
	return $metadata_caption;
1671 1638
}
1639

  
1640
/**
1641
 * This function collects all the media from a list of description elements
1642
 * and return them as an Array.
1643
 *
1644
 * @param $descriptionElementes The description elements
1645
 * @return Array The output with all the media
1646
 */
1647
function cdm_dataportal_media_from_descriptionElements($descriptionElements){
1648
	//variables
1649
	$outArrayOfMedia = array(); //return value
1650
	//implementation
1651
	foreach($descriptionElements as $descriptionElement){
1652
		foreach($descriptionElement->media as $media){
1653
			if(isset($media)){
1654
			 $outArrayOfMedia[] = $media;
1655
			}
1656
	 }
1657
	}
1658
	return $outArrayOfMedia;
1659
}
1660

  
1661

  

Also available in: Unified diff