Project

General

Profile

« Previous | Next » 

Revision 5f5e44b2

Added by Andreas Kohlbecker over 10 years ago

removing all implemetation of the theme hooks theme_get_nameRenderTemplate() and theme_get_partDefinition

View differences:

7.x/themes/garland_cichorieae/template.php
334 334
  return $output;
335 335
}
336 336

  
337
/**
338
 * @deprecated define name render templates via the layout settings
339
 */
340
function garland_cichorieae_get_partDefinition() {
341
  return
342
    array(
343
        'ZoologicalName' => array(
344
            'namePart' => array('name' => TRUE),
345
            'referencePart' => array('authors' => TRUE),
346
            'microreferencePart' => array('microreference' => TRUE),
347
            'statusPart' => array('status' => TRUE),
348
            'descriptionPart' => array('description' => TRUE),
349
        ),
350
        'BotanicalName' => array(
351
            'namePart' => array('name' => TRUE),
352
            'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE),
353
            'referencePart' => array('reference' => TRUE, 'microreference' => TRUE),
354
            'statusPart' => array('status' => TRUE),
355
            'descriptionPart' => array('description' => TRUE),
356
        ),
357
        '#DEFAULT' => array(
358
            'namePart' => array(
359
                'name' => TRUE,
360
                'authors' => TRUE
361
            ),
362
            'referencePart' => array(
363
                'reference' => TRUE
364
            ),
365
            'microreferencePart' => array(
366
                'microreference' => TRUE,
367
            ),
368
            'statusPart' => array(
369
                'status' => TRUE,
370
            ),
371
            'descriptionPart' => array(
372
                'description' => TRUE,
373
            ),
374
        )
375
    );
376
}
377

  
378
/**
379
 * @deprecated define name render templates via the layout settings
380
 */
381
function garland_cichorieae_get_nameRenderTemplate($variables) {
382
  $templates = array(
383
   'taxon_page_title,polytomousKey'=> array(
384
        'namePart' => array('#uri' => TRUE),
385
      ),
386
    'taxon_page_synonymy,related_taxon'=> array(
387
        'nameAuthorPart' => array('#uri' => TRUE),
388
        'referencePart' => TRUE,
389
        'statusPart' => TRUE,
390
        'descriptionPart' => TRUE,
391
      ),
392
    'acceptedFor,typedesignations,list_of_taxa' => array(
393
        'nameAuthorPart' => array('#uri' => TRUE),
394
        'referencePart' => TRUE,
395
      ),
396
    '#DEFAULT' => array(
397
        'nameAuthorPart' => array('#uri' => TRUE),
398
        'referencePart' => TRUE,
399
      )
400
    );
401
  return $templates;
402
}
403

  
404 337
/**
405 338
 * Returns HTML for taxon list thumbnails.
406 339
 *
7.x/themes/garland_diptera/template.php
100 100
function compare_citations($x, $y)
101 101
{
102 102

  
103
	if( !$x->sources[0]->citation->uuid){// && !$y->sources[0]->citation->uuid){
104
		$res = -1;
105
		//var_dump($y->sources[0]->citation->uuid);
106
	}elseif(!$y->sources[0]->citation->uuid){
107
		$res = 1;
108
		//var_dump($x->sources[0]->citation->uuid);
109
	}
110
	else{
103
  if( !$x->sources[0]->citation->uuid){// && !$y->sources[0]->citation->uuid){
104
    $res = -1;
105
    //var_dump($y->sources[0]->citation->uuid);
106
  }elseif(!$y->sources[0]->citation->uuid){
107
    $res = 1;
108
    //var_dump($x->sources[0]->citation->uuid);
109
  }
110
  else{
111 111

  
112 112

  
113 113
  $author_team_x = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $x->sources[0]->citation->uuid);
114 114
  $author_team_y = cdm_ws_get(CDM_WS_REFERENCE_AUTHORTEAM, $y->sources[0]->citation->uuid);
115 115

  
116
	 //same author, and different year
117
	if($author_team_x->titleCache == $author_team_y->titleCache){
118
		$x_year = substr(
119
		        $x->sources[0]->citation->datePublished->start,
120
		        0,
121
		        strpos($x->sources[0]->citation->datePublished->start,'-'));
122
		$y_year = substr(
123
		          $y->sources[0]->citation->datePublished->start,
124
		          0,
125
		          strpos($y->sources[0]->citation->datePublished->start,'-'));
126
		if ($x_year < $y_year){//the year of the first publication is smaller
127
			$res = -1;
128
		}
129
		else if($x_year == $y_year){ //if same year check the page
130
			$x_page = $x->sources[0]->citationMicroReference;
131
			$y_page = $y->sources[0]->citationMicroReference;
132
			if($x_page < $y_page){
133
				$res = -1;
134
			}
135
			else{
136
				$res = 1;
137
			}
138
		}else
139
		$res = 1;
140
	}
141
	//different author and the first one is alphabetically smaller
142
	//else if($x->sources[0]->citation->authorTeam->teamMembers[0]->lastname <
143
	//$y->sources[0]->citation->authorTeam->teamMembers[0]->lastname){
144
	else if ($author_team_x->titleCache < $author_team_y->titleCache)	{
145
		$res = -1;
146
	}
147
	//different author and the second one is alphabetically smaller
148
	else{
149
		$res = 1;
150
	}
116
   //same author, and different year
117
  if($author_team_x->titleCache == $author_team_y->titleCache){
118
    $x_year = substr(
119
            $x->sources[0]->citation->datePublished->start,
120
            0,
121
            strpos($x->sources[0]->citation->datePublished->start,'-'));
122
    $y_year = substr(
123
              $y->sources[0]->citation->datePublished->start,
124
              0,
125
              strpos($y->sources[0]->citation->datePublished->start,'-'));
126
    if ($x_year < $y_year){//the year of the first publication is smaller
127
      $res = -1;
128
    }
129
    else if($x_year == $y_year){ //if same year check the page
130
      $x_page = $x->sources[0]->citationMicroReference;
131
      $y_page = $y->sources[0]->citationMicroReference;
132
      if($x_page < $y_page){
133
        $res = -1;
134
      }
135
      else{
136
        $res = 1;
137
      }
138
    }else
139
    $res = 1;
140
  }
141
  //different author and the first one is alphabetically smaller
142
  //else if($x->sources[0]->citation->authorTeam->teamMembers[0]->lastname <
143
  //$y->sources[0]->citation->authorTeam->teamMembers[0]->lastname){
144
  else if ($author_team_x->titleCache < $author_team_y->titleCache)	{
145
    $res = -1;
146
  }
147
  //different author and the second one is alphabetically smaller
148
  else{
149
    $res = 1;
150
  }
151 151

  
152 152
  }
153
	//var_dump($res);
154
	//var_dump(' ============ ');
155
	return $res;
153
  //var_dump($res);
154
  //var_dump(' ============ ');
155
  return $res;
156 156
}
157 157

  
158 158

  
......
163 163
  $sortOutArray = false;
164 164
  $enclosingHtml = 'ul';
165 165

  
166
	$citations = array();
166
  $citations = array();
167 167

  
168 168
  // only for diptera
169 169
  if(isset($descriptionElements[0]) && $descriptionElements[0]->feature->uuid == UUID_CITATION ) {
......
183 183
    $descriptionElements = $elementMap;
184 184
  }
185 185
  // ---
186
	usort($descriptionElements, 'compare_citations');
186
  usort($descriptionElements, 'compare_citations');
187 187
  foreach($descriptionElements as $element){
188 188
    if($element->class == 'TextData'){
189 189
      $asListElement = true;
......
219 219
function garland_diptera_cdm_feature_name($feature_name){
220 220
  switch($feature_name){
221 221
    case "Citation": return t("Citations");
222
		case 'Has orthographic variant': return t("Misspellings");
222
    case 'Has orthographic variant': return t("Misspellings");
223 223
    default: return t(ucfirst($feature_name));
224 224
  }
225 225
}
226 226

  
227

  
228
function garland_diptera_get_partDefinition($nameType){
229

  
230
  if($nameType == 'ZoologicalName'){
231
    return array(
232
        'namePart' => array(
233
          'name' => true
234
        ),
235
        'nameAuthorPart' => array(
236
          'name' => true,
237
          'authors' => true
238
        ),
239
        'referencePart' => array(
240
         'authors' => true,
241
         'microreference' => true
242
        ),
243
        'statusPart' => array(
244
          'status' => true,
245
        ),
246
        'descriptionPart' => array(
247
          'description' => true,
248
        ),
249
      );
250
  }
251
  return false;
252
}
253

  
254
function garland_diptera_get_nameRenderTemplate($renderPath){
255

  
256
  switch ($renderPath){
257
    case 'taxon_page_title':
258
      $template = array(
259
          'namePart' => array('#uri'=>true),
260
        );
261
      break;
262
    case  'acceptedFor':
263
    case 'list_of_taxa':
264
      $template = array(
265
        'namePart' => array('#uri'=>true),
266
        'referencePart' => array('#uri'=>true),
267
      );
268
      break;
269
    case 'typedesignations':
270
      $template = array(
271
        'namePart' => array('#uri'=>true),
272
        'referencePart' => array('#uri'=>true)
273
      );
274
      break;
275
    case 'taxon_page_synonymy':
276
    case 'related_taxon':
277
    case '#DEFAULT':
278
      $template = array(
279
        'namePart' => array('#uri'=>true),
280
        'referencePart' => array('#uri'=>true),
281
        'statusPart' => true,
282
        'descriptionPart' => true
283
      );
284
  }
285
  return $template;
286
}
287

  
288 227
function garland_diptera_cdm_OriginalSource($descriptionElementSource, $doLink = TRUE){
289 228

  
290 229
    //ev. delegate to theme_cdm_ReferencedEntityBase
7.x/themes/palmweb_2/template.php
559 559
  return $output;
560 560
}
561 561

  
562
/**
563
 *  @deprecated define name render templates via the layout settings
564
 */
565
function palmweb_2_get_partDefinition($variables) {
566

  
567
  return array(
568
    'BotanicalName'=> array(
569
        'namePart' => array('name' => TRUE, 'authors' => TRUE),
570
        'authorshipPart' => array(),
571
        'referencePart' => array('reference' => TRUE, 'microreference' => TRUE),
572
        'statusPart' => array('status' => TRUE),
573
        'descriptionPart' => array('description' => TRUE),
574
    ),
575
    'ZoologicalName' => array(
576
          'namePart' => array('name' => TRUE),
577
          'referencePart' => array('authors' => TRUE),
578
          'microreferencePart' => array('microreference' => TRUE),
579
          'statusPart' => array('status' => TRUE),
580
          'descriptionPart' => array('description' => TRUE),
581
      ),
582
    '#DEFAULT' => array(
583
        'namePart' => array(
584
            'name' => TRUE,
585
            'authors' => TRUE
586
        ),
587
        'referencePart' => array(
588
            'reference' => TRUE
589
        ),
590
        'microreferencePart' => array(
591
            'microreference' => TRUE,
592
        ),
593
        'statusPart' => array(
594
            'status' => TRUE,
595
        ),
596
        'descriptionPart' => array(
597
            'description' => TRUE,
598
        ),
599
      )
600
  );
601
}
602

  
603
/**
604
 *  @deprecated define name render templates via the layout settings
605
 */
606
function palmweb_2_get_nameRenderTemplate($variables){
607
  return array(
608
    'acceptedFor' =>
609
      $template = array(
610
        'namePart' => array('#uri'=>TRUE),
611
      ),
612
    'typedesignations' => array(
613
        'namePart' => array('#uri'=>TRUE),
614
        'referencePart' => TRUE,
615
      ),
616
    'taxon_page_title,list_of_taxa,taxon_page_synonymy,related_taxon,polytomousKey' => array(
617
        'namePart' => array('#uri'=>TRUE),
618
        'referencePart' => TRUE,
619
        'descriptionPart' => TRUE,
620
        'statusPart' => TRUE,
621
      ),
622
    '#DEFAULT' => array(
623
        'namePart' => array('#uri'=>TRUE),
624
        'referencePart' => TRUE,
625
        'descriptionPart' => TRUE,
626
        'statusPart' => TRUE,
627
     )
628
  );
629
}
630

  
631 562
/**
632 563
 * @todo Please document this function.
633 564
 * @see http://drupal.org/node/1354
7.x/themes/zen_dataportal/template.php
333 333
  //}
334 334
}
335 335
// */
336

  
337
/**
338
 *  @deprecated define name render templates via the layout settings
339
function zen_dataportal_get_partDefinition() {
340
  return array(
341
    'BotanicalName'=> array(
342
        'namePart' => array('name' => TRUE),
343
        'nameAuthorPart' => array('name' => TRUE, 'authors' => TRUE),
344
        'referencePart' => array('reference' => TRUE, 'microreference' => TRUE),
345
        'statusPart' => array('status' => TRUE),
346
        'descriptionPart' => array('description' => TRUE),
347
    ),
348
    'ZoologicalName' => array(
349
          'namePart' => array('name' => TRUE),
350
          'referencePart' => array('authors' => TRUE),
351
          'microreferencePart' => array('microreference' => TRUE),
352
          'statusPart' => array('status' => TRUE),
353
          'descriptionPart' => array('description' => TRUE),
354
      ),
355
    '#DEFAULT' => array(
356
        'namePart' => array(
357
            'name' => TRUE,
358
            'authors' => TRUE
359
        ),
360
        'referencePart' => array(
361
            'reference' => TRUE
362
        ),
363
        'microreferencePart' => array(
364
            'microreference' => TRUE,
365
        ),
366
        'statusPart' => array(
367
            'status' => TRUE,
368
        ),
369
        'descriptionPart' => array(
370
            'description' => TRUE,
371
        ),
372
      )
373
    );
374
}
375
 */
376

  
377
/**
378
 * @deprecated define name render templates via the layout settings
379
function zen_dataportal_get_nameRenderTemplate() {
380

  
381
  $templates = array(
382
    'taxon_page_title,polytomousKey' => array(
383
        'namePart' => array(
384
          '#uri' => TRUE
385
        )
386
      ),
387
    'taxon_page_synonymy,related_taxon' => array(
388
        'nameAuthorPart' => array(
389
          '#uri' => TRUE
390
        ),
391
        'referencePart' => TRUE,
392
        'statusPart' => TRUE,
393
        'descriptionPart' => TRUE
394
      ),
395
     'acceptedFor' => array(
396
        'nameAuthorPart' => array(
397
          '#uri' => TRUE
398
        ),
399
        'referencePart' => TRUE
400
      ),
401
     'typedesignations,list_of_taxa' => array(
402
        'nameAuthorPart' => array(
403
           '#uri' => TRUE
404
        ), 'referencePart' => TRUE
405
      ),
406
    '#DEFAULT'=> array(
407
        'nameAuthorPart' => array(
408
           '#uri' => TRUE
409
        ), 'referencePart' => TRUE
410
      )
411
  );
412
  return $templates;
413
}
414
 */
415

  

Also available in: Unified diff