blob: 646855a07d8e4c6436a820413fb2c51264508044 [file]
<?php
/**
* ********************************************************************
* Copyright (c) 2021 Eclipse Foundation and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Christopher Guindon (Eclipse Foundation) - initial API and implementation
*
* SPDX-License-Identifier: EPL-2.0
* ********************************************************************
*/
class Director {
private $first_name = '';
private $last_name = '';
private $organization_name = '';
private $organization_id = '';
private $relation = '';
private $bio = '';
public function setFirstName($first_name) {
$this->first_name = $first_name;
return $this;
}
public function getFirstName() {
return $this->first_name;
}
public function setLastName($last_name) {
$this->last_name = $last_name;
return $this;
}
public function getLastName() {
return $this->last_name;
}
public function setOrganizationName($organization_name) {
$this->organization_name = $organization_name;
return $this;
}
public function getOrganizationName() {
return $this->organization_name;
}
public function setOrganizationId($organization_id) {
$this->organization_id = $organization_id;
return $this;
}
public function getOrganizationId() {
return $this->organization_id;
}
public function setRelation($relation) {
$this->relation = strtoupper($relation);
return $this;
}
public function getRelation() {
return $this->relation;
}
/**
* Get Bio from org repository
*
* @return string
*/
private function _getBio() {
if (empty($this->bio)) {
// Handle special cases where first or last name had multiple words
$formatted_filename = str_replace(' ', '_', $this->getFirstName() . ' ' . $this->getLastName());
// Replace periods in name
$formatted_filename = str_replace('.', '', $formatted_filename);
if (file_exists($file = $_SERVER['DOCUMENT_ROOT'] . '/org/foundation/boardbios/' . $formatted_filename . '.php')) {
$this->bio = file_get_contents($file);
}
}
return $this->bio;
}
/**
* Html Output of a Director
*
* @return string
*/
function outputDirector() {
return "<h3>{$this->getFirstName()} {$this->getLastName()} <small>{$this->getOrganizationName()}</small> </h3>
<div class=\"row\">
<div class=\"col-sm-20\">{$this->_getBio()}</div>
<div class=\"col-sm-4\">{$this->getMemberLogo()}</div>
</div>
<hr>";
}
/**
* Get sortable array key name value
*
* @return string
*/
public function getArrayKey() {
return ucwords($this->getLastName() . ', ' . $this->getFirstName());
}
/**
* Get Member logo
*
* @return string
*/
function getMemberLogo() {
$img = "";
if ($this->getOrganizationId()) {
$img = "<img src='http://www.eclipse.org/membership/scripts/get_image.php?id=" . $this->getOrganizationId() . "&size=small'>";
}
return $img;
}
}