/**
  * @param \Zend\Db\Adapter\Driver\Pdo\Pdo||\PDO $driver
  * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
  * @return $this
  */
 public function setDriver($driver)
 {
     if ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlite' || $driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlite') {
         $this->resource = $driver;
         return $this;
     }
     throw new Exception\InvalidArgumentException('$driver must be a Sqlite PDO Zend\\Db\\Adapter\\Driver, Sqlite PDO instance');
 }
Exemple #2
0
 /**
  * @param \Zend\Db\Adapter\Driver\Mysqli\Mysqli|\Zend\Db\Adapter\Driver\Pdo\Pdo||\mysqli|\PDO $driver
  * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
  * @return $this
  */
 public function setDriver($driver)
 {
     // handle Zend\Db drivers
     if ($driver instanceof Mysqli\Mysqli || $driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Mysql' || $driver instanceof \mysqli || $driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'mysql') {
         $this->resource = $driver;
         return $this;
     }
     throw new Exception\InvalidArgumentException('$driver must be a Mysqli or Mysql PDO Zend\\Db\\Adapter\\Driver, Mysqli instance or MySQL PDO instance');
 }
Exemple #3
0
 /**
  * @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo||resource|\PDO $driver
  * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
  * @return $this
  */
 public function setDriver($driver)
 {
     // handle Zend\Db drivers
     if ($driver instanceof Pdo\Pdo && in_array($driver->getDatabasePlatformName(), array('SqlServer', 'Dblib')) || $driver instanceof \PDO && in_array($driver->getAttribute(\PDO::ATTR_DRIVER_NAME), array('sqlsrv', 'dblib'))) {
         $this->resource = $driver;
         return $this;
     }
     throw new Exception\InvalidArgumentException('$driver must be a Sqlsrv PDO Zend\\Db\\Adapter\\Driver or Sqlsrv PDO instance');
 }
Exemple #4
0
function process($obj, $contents)
{
    global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
    // Get Image
    $node_list = $obj->getElementsByTagName('img');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'img-right') {
            $img_url = getAttribute($node, 'src');
        }
    }
    // biology
    $pattern = '/<h1>Biography<\\/h1>([^<]*)<div>([^<]*)<h2>([^<]*)<\\/h2>([^<]*)<p>([^<]*)<img ([^>]*)>([^<]*)<\\/p>/';
    $matches = '';
    $cnt = preg_match_all($pattern, $contents, $matches);
    if ($cnt == 1) {
        $biology = $matches[7][0];
    } else {
        // Add a <p> open tag next to image tag
        $pattern = '/<h1>Biography<\\/h1>([^<]*)<div>([^<]*)<h2>([^<]*)<\\/h2>([^<]*)<p>([^<]*)<img ([^>]*)>([^<]*)<p>([^<]*)<\\/p>/';
        $matches = '';
        $cnt = preg_match_all($pattern, $contents, $matches);
        //			var_dump( $matches );
        $biology = $matches[8][0];
        //			echo $contents;
    }
    // Get Speciality
    $node_list = $obj->getElementsByTagName('h2');
    foreach ($node_list as $node) {
        $speciality = $node->nodeValue;
        break;
    }
    $speciality = substr($speciality, strpos($speciality, '(') + 1);
    $speciality = substr($speciality, 0, strlen($speciality) - 1);
    // Get the Location and phone
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'style') == 'margin-bottom:10px;') {
            $location = $node->nodeValue;
            $phone = substr($location, strpos($location, 'Phone') + 7);
            $location = substr($location, 0, strpos($location, 'Phone'));
        }
    }
    // Get the zip code
    $pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
    $matches = '';
    if (preg_match_all($pattern, $location, $matches) > 0) {
        $zipcode = $matches[1][0];
    }
}
Exemple #5
0
 /**
  * @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo||resource|\PDO $driver
  * @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
  * @return $this
  */
 public function setDriver($driver)
 {
     // handle Zend_Db drivers
     if ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlsrv') {
         /** @var $driver \Zend\Db\Adapter\Driver\DriverInterface */
         $this->resource = $driver->getConnection()->getResource();
         return $this;
     }
     // handle
     if ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlsrv') {
         $this->resource = $driver;
         return $this;
     }
     throw new Exception\InvalidArgumentException('$driver must be a Sqlsrv PDO Zend\\Db\\Adapter\\Driver or Sqlsrv PDO instance');
 }
 function Curated($xml)
 {
     $this->name = getAttribute($xml, 'name');
     $this->by = getAttribute($xml, 'by');
     $this->scroll = getAttribute($xml, 'scroll');
     $this->resize = getAttribute($xml, 'resize');
     $this->width = getAttribute($xml, 'width');
     $this->height = getAttribute($xml, 'height');
     $this->image = getValue($xml, 'image');
     $this->description = innerHTML($xml, 'description');
     $this->location = getValue($xml, 'location');
     $links = $xml->getElementsByTagName('link');
     $links = $links->toArray();
     foreach ($links as $link) {
         $this->links[] = array('href' => $link->getAttribute('href'), 'title' => $link->getText());
     }
 }
<?php

define("true-access", true);
//if(!$hostname || !$user || !$password || !$dbName)
//{
//header ("Location: installation.php");
//		p("Please, make sure you introduced every data");
//}
//else{
$hostname = getAttribute("Prueba/hostname.txt");
$user = getAttribute("Prueba/user.txt");
$password = getAttribute("Prueba/password.txt");
$dbName = getAttribute("Prueba/dbName.txt");
function getAttribute($path)
{
    if (file_exists($path)) {
        $allData = file_get_contents($path);
        $arrayOfLines = file($path);
        $result = $arrayOfLines[sizeof($arrayOfLines) - 1];
    }
    return $result;
}
define("SALT", "word");
define("DB_HOST", $hostname);
define("DB_USER", $user);
define("DB_PASSWORD", $password);
define("DB_NAME", $dbName);
//echo "estos son mis params".SALT;
//echo "host".DB_HOST;
//echo DB_USER;
//echo DB_PASSWORD;
Exemple #8
0
<a class="addthis_button_google"></a>
<a class="addthis_button_twitter"></a>
<span class="addthis_separator">&bull;</span>
<a href="http://www.addthis.com/bookmark.php?v=250&amp;username=xa-4c40b32a7baba973" class="addthis_button_compact">More</a>
</div>
<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#username=xa-4c40b32a7baba973"></script>
<!-- AddThis Button END -->
<?php 
}
echo '<div class="scalar_logo_wrapper">' . "\n";
// Publisher icon
if (!empty($book->publisher_thumbnail)) {
    $href = '';
    $link_tags = get_tag('a', $book->publisher);
    if (!empty($link_tags)) {
        $href = getAttribute('href', $link_tags[0]);
    }
    if (!empty($href)) {
        echo '<a href="' . $href . '">';
    }
    echo '<img class="publisher-thumb" src="' . confirm_slash(base_url()) . confirm_slash($book->slug) . $book->publisher_thumbnail . '" />' . "\n";
    if (!empty($href)) {
        echo '</a>';
    }
}
// Page version number
if (isset($page->version_index) && isset($page->versions[$page->version_index]) && !empty($page->versions[$page->version_index])) {
    $title = $page->versions[$page->version_index]->title;
    $created = $page->versions[$page->version_index]->created;
    $version_num = $page->versions[$page->version_index]->version_num;
    echo '<span class="screen-version"><a href="' . $base_uri . $page->slug . '.' . $version_num . '.versions">Version ' . $version_num . '</a> <span id="screen-version-id">id ' . $page->versions[$page->version_index]->version_id . '</span> ';
?>
</li>
                                        </ul>
                                    </div> 
                                    <?php 
//}
?>
								</td>
							</tr>
							
							<tr>
								<td valign='middle' align='center'>
                                    <span class='msjError'>
                                        <?php 
if (request . getAttribute("error") != null) {
    out . println(request . getAttribute("error"));
}
?>
   
                                    </span>
								</td>
							</tr>
																
							<tr>
								<td valign='middle' align='center'>
									<input type='submit' value='Enviar' align='left' class='botns' />
                                    <?php 
if (ul != null) {
    ?>
                                    <a href="registrar_usu?proceso=eliminar"><input type='button' value='Darme de Baja' align='left' class='botns' /></a>
                                    <?php 
Exemple #10
0
function process($obj, $contents)
{
    global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
    // Get Image
    $node_list = $obj->getElementsByTagName('img');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'attachment-post-thumbnail wp-post-image') {
            $img_url = getAttribute($node, 'src');
        }
    }
    // Get Appointment
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'desktop') {
            $appointment = $node->nodeValue;
        }
    }
    // Get Other information
    $node_list = $obj->getElementsByTagName('h3');
    foreach ($node_list as $node) {
        switch ($node->nodeValue) {
            case 'Areas of treatment:':
                $expertise = $node->nextSibling->nodeValue;
                break;
            case 'Specialty:':
                $speciality .= $node->nextSibling->nodeValue;
                break;
            case 'Specialties:':
                $speciality .= $node->nextSibling->nodeValue;
                break;
            case 'Practicing location:':
                $location = $node->nextSibling->nodeValue;
                break;
            case 'Education:':
                $education = $node->nextSibling->nodeValue;
                break;
            case 'Certifications:':
                $certification = $node->nextSibling->nodeValue;
                break;
            case 'Awards:':
                $honor = $node->nextSibling->nodeValue;
                break;
            case 'Internships:':
                $training .= 'Internships : ' . $node->nextSibling->nodeValue . ', ';
                break;
            case 'Residencies:':
                $training .= 'Residencies : ' . $node->nextSibling->nodeValue . ', ';
                break;
            case 'Fellowships:':
                $training .= 'Fellowships : ' . $node->nextSibling->nodeValue . ', ';
                break;
        }
    }
    // Get the rank
    if (strpos(strtolower($appointment), 'associate professor') !== false) {
        $rank = 2;
    } elseif (strpos(strtolower($appointment), 'assistant professor') !== false) {
        $rank = 3;
    } elseif (strpos(strtolower($appointment), 'professor') !== false) {
        $rank = 1;
    }
    if (strlen($training) > 0) {
        $training = substr($training, 0, strlen($training) - 2);
    }
    $phone = '(800) USC-CARE (800-872-2273)';
}
Exemple #11
0
function process($obj, $contents)
{
    global $obj, $contents, $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank;
    // Get Image
    $pattern = '/<div id=\'physicianHeadshot\'>([^<]*)<img src="([^"]*)"([^>]*)>([^<]*)<\\/div>/';
    $matches = '';
    preg_match_all($pattern, $contents, $matches);
    $img_url = 'http://www.fccc.edu' . $matches[2][0];
    // Get Honor
    $pattern = '/<h4>Honors and Awards<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
    $matches = '';
    if (preg_match_all($pattern, $contents, $matches) > 0) {
        $honor = $matches[2][0];
    }
    // Get Education
    $pattern = '/<h4>Medical Education<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
    $matches = '';
    if (preg_match_all($pattern, $contents, $matches) > 0) {
        $education = $matches[2][0];
    }
    // Get Certification
    $pattern = '/<h4>Certifications:<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
    $matches = '';
    if (preg_match_all($pattern, $contents, $matches) > 0) {
        $certification = $matches[2][0];
    }
    // Get Research Interests
    $pattern = '/<h4>Research Interests<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
    $matches = '';
    if (preg_match_all($pattern, $contents, $matches) > 0) {
        $research_interests = $matches[2][0];
    }
    // Get Expertise
    $pattern = '/<h4>Clinical Expertise:<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
    $matches = '';
    if (preg_match_all($pattern, $contents, $matches) > 0) {
        $expertise = $matches[2][0];
    }
    // Get the specility and biology
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'id') == 'physicianHeadshot') {
            $speciality = $node->nextSibling->nextSibling->nodeValue;
        }
        if (getAttribute($node, 'id') == 'physicianQuotebox') {
            $biology = $node->nodeValue;
        }
        // Get the location
        if (getAttribute($node, 'id') == 'physicianAppt') {
            $location = $node->nodeValue;
            $location = trim(str_replace("New patients can request an appointment online or call", "", $location));
            // The the phone and zipcode
            $pos = strpos($location, " ");
            $phone = substr($location, 0, $pos);
            $location = substr($location, $pos);
            $pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
            $matches = '';
            if (preg_match_all($pattern, $location, $matches) > 0) {
                $zipcode = $matches[1][0];
            }
        }
    }
    // Get $speciality again
    if (trim($speciality) == '') {
        $node_list = $obj->getElementsByTagName('h2');
        foreach ($node_list as $node) {
            $speciality = $node->nodeValue;
        }
    }
    $node_list = $obj->getElementsByTagName('h4');
    $start = 0;
    foreach ($node_list as $node) {
        $start++;
        if ($start == 1) {
            $appointment = trim($node->nodeValue);
            if ($appointment == 'Clinical Expertise:') {
                $appointment = '';
            }
            if (substr($appointment, 0, 5) == 'Video') {
                $start = 0;
            }
            if (substr($appointment, 0, 4) == 'Why ') {
                $start = 0;
            }
            if (strpos($appointment, "Patient Stories") !== false) {
                $start = 0;
            }
        }
        $nodeValue = trim($node->nodeValue);
        if ($nodeValue == 'Clinical Expertise:') {
            $expertise = $node->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Certifications:' && $certification == '') {
            $certification = $node->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Medical Education' && $education == '') {
            $education = $node->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Research Interests' && $research_interests == '') {
            $research_interests = $node->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Clinical Expertise:' && $expertise == '') {
            $expertise = $node->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Honors and Awards' && $honor == '') {
            $honor = $node->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Residencies') {
            $training .= 'Residencies : ' . $node->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Fellowships') {
            $training .= 'Fellowships : ' . $node->nextSibling->nodeValue;
        }
    }
}
                         $xml .= "\t\t<" . $c . "_html5_mp3_audio>" . $mp3_audio . "</" . $c . "_html5_mp3_audio>\n";
                     }
                 }
                 $ogg_audio = getAttribute('ogg', $res['arp_header_shortcode']);
                 $ogg_audio = trim($ogg_audio, '"');
                 if ($ogg_audio != "") {
                     $ogg_audio_name = explode('/', $ogg_audio);
                     $ogg_audio_name = $ogg_audio_name[count($ogg_audio_name) - 1];
                     @copy($ogg_audio, $upload_dir . 'temp_' . $ogg_audio_name);
                     if (file_exists($upload_dir . "temp_" . $ogg_audio_name)) {
                         $filename_arry[] = 'temp_' . $ogg_audio_name;
                         $ogg_audio_name = 'temp_' . $ogg_audio_name;
                         $xml .= "\t\t<" . $c . "_html5_ogg_audio>" . $ogg_audio . "</" . $c . "_html5_ogg_audio>\n";
                     }
                 }
                 $wav_audio = getAttribute('wav', $res['arp_header_shortcode']);
                 $wav_audio = trim($wav_audio, '"');
                 if ($wav_audio != "") {
                     $wav_audio_name = explode('/', $wav_audio);
                     $wav_audio_name = $wav_audio_name[count($wav_audio_name) - 1];
                     @copy($wav_audio, $upload_dir . 'temp_' . $wav_audio_name);
                     if (file_exists($upload_dir . "temp_" . $wav_audio_name)) {
                         $filename_arry[] = 'temp_' . $wav_audio_name;
                         $wav_audio_name = 'temp_' . $wav_audio_name;
                         $xml .= "\t\t<" . $c . "_html5_wav_audio>" . $wav_audio . "</" . $c . "_html5_wav_audio>\n";
                     }
                 }
             }
         }
     }
 }
Exemple #13
0
  function readDOM($dom) {
    $cur=$dom.firstChild;

    while($cur) {
      if($cur->nodeName=="tag") {
	$this->set($cur.getAttribute("k"), $cur.getAttribute("v"));
      }
      $cur=$cur.nextSibling;
    }
  }
Exemple #14
0
function process($obj, $contents)
{
    global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
    // Get Image + 1
    $pattern = '/<div class="profilePhotoContainer" id="provImage_MD">([^<]*)<img src="([^"]*)"([^>]*)>([^<]*)<\\/div>/';
    $matches = '';
    preg_match_all($pattern, $contents, $matches);
    $img_url = 'http://doctors.ucsd.edu' . $matches[2][0];
    // Get Dgree
    $node_list = $obj->getElementsByTagName('h1');
    foreach ($node_list as $node) {
        $inner_name = $node->nodeValue;
        $dgree = trim(substr($inner_name, strpos($inner_name, ',') + 2));
    }
    // Get Address
    $arrAddr = array();
    $node_list = $obj->getElementsByTagName('h3');
    foreach ($node_list as $node) {
        $arrAddr['addr1'][] = $node->nodeValue;
    }
    $node_list = $obj->getElementsByTagName('span');
    foreach ($node_list as $node) {
        switch (getAttribute($node, 'itemprop')) {
            case 'addressLocality':
                $arrAddr['addr4'][] = $node->nodeValue;
                break;
            case 'addressRegion':
                $arrAddr['addr5'][] = $node->nodeValue;
                break;
            case 'postalCode':
                $arrAddr['addr6'][] = $node->nodeValue;
                break;
        }
    }
    // Get Other information
    $currentProfile = '';
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        switch (getAttribute($node, 'id')) {
            case 'acadTitle':
                $appointment = $node->nodeValue;
                break;
            case 'providerSpec_MD':
                $speciality = $node->nodeValue;
                break;
            case 'tabs-1':
                //					$biology = $node->nodeValue;
                break;
            case 'tabs-2':
                break;
            case 'tabs-3':
                $expertise = $node->nodeValue;
                break;
            case 'tabs-4':
                //					$location = $node->nodeValue;
                break;
            case 'tabs-5':
                $phone = $node->nodeValue;
                $phone = trim(str_replace('Contact Numbers', '', $phone));
                break;
        }
        // Get the education, Training and Certificate
        if (getAttribute($node, 'class') == 'profileLabel') {
            $currentProfile = $node->nodeValue;
        }
        if (getAttribute($node, 'class') == 'profileData') {
            switch ($currentProfile) {
                case 'Medical Degree:':
                    $education .= $node->nodeValue . ', ';
                    break;
                case 'Residency:':
                    $training .= 'Residency : ' . $node->nodeValue . ', ';
                    break;
                case 'Fellowship:':
                    $training .= 'Fellowship : ' . $node->nodeValue . ', ';
                    break;
                case 'Internship:':
                    $training .= 'Internship : ' . $node->nodeValue . ', ';
                    break;
                case 'Board Certifications:':
                    $certification .= $node->nodeValue . ', ';
                    break;
            }
        }
        // Get the address 2, 3
        if (getAttribute($node, 'class') == 'profileDataNoLabel emphasize' && getAttribute($node, 'itemprop') == 'name') {
            $arrAddr['addr2'][] = $node->nodeValue;
        }
        if (getAttribute($node, 'class') == 'profileDataNoLabel ' && getAttribute($node, 'itemprop') == 'streetAddress') {
            $arrAddr['addr3'][] = $node->nodeValue . ' ' . $node->nextSibling->nodeValue;
        }
    }
    // Get  the biology
    $bioloby = '';
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'profileDataNoLabel') {
            if (strlen($node->nodeValue) > strlen($biology)) {
                $biology = $node->nodeValue;
            }
        }
    }
    $pos = strrpos($biology, 'UC San Diego Health');
    if ($pos > 0) {
        $biology = substr($biology, 0, $pos);
    }
    // Build the address
    for ($i = 0; $i < count($arrAddr['addr1']); $i++) {
        $location .= $arrAddr['addr1'][$i] . ' ' . $arrAddr['addr2'][$i] . ' ' . $arrAddr['addr3'][$i] . ' ' . $arrAddr['addr4'][$i] . ' ' . $arrAddr['addr5'][$i] . ' ' . $arrAddr['addr6'][$i] . ', ';
        $zipcode .= $arrAddr['addr6'][$i] . ', ';
    }
    // Get the rank
    if (strpos($appointment, 'Associate Professor') !== false) {
        $rank = 2;
    } elseif (strpos($appointment, 'Assistant Professor') !== false) {
        $rank = 3;
    } elseif (strpos($appointment, 'Professor') !== false) {
        $rank = 1;
    }
    if (strlen($education) > 0) {
        $education = substr($education, 0, strlen($education) - 2);
    }
    if (strlen($training) > 0) {
        $training = substr($training, 0, strlen($training) - 2);
    }
    if (strlen($certification) > 0) {
        $certification = substr($certification, 0, strlen($certification) - 2);
    }
    if (strlen($location) > 0) {
        $location = substr($location, 0, strlen($location) - 2);
    }
    if (strlen($zipcode) > 0) {
        $zipcode = substr($zipcode, 0, strlen($zipcode) - 2);
    }
}
        $labelChanges[] = $change;
    }
    if (count($labelChanges) > 0) {
        saveLabelChanges($labelChanges);
    }
} else {
    if (!is_null($_GET) && array_key_exists("id", $_GET) && $_GET["id"] != '') {
        $attributeID = intval($_GET["id"]);
    }
}
if (strpos($error, "Duplicate entry") !== FALSE) {
    $error = "Another attribute already exists with code [" . $_POST["attributeCode"] . "]. Codes must be unique.";
}
$attribute = null;
if (!is_null($attributeID)) {
    $attribute = getAttribute($attributeID);
}
$attributeID = is_null($attribute) ? "" : $attribute->id;
$code = is_null($attribute) ? "" : $attribute->code;
$name = is_null($attribute) ? "" : $attribute->name;
$description = is_null($attribute) ? "" : $attribute->description;
?>

<h1><a href="overview.php">Overview</a> > <a href="attributes.php">Attributes</a> > Edit Attribute</h1>
<?php 
if ($error != "") {
    echo "<p class=\"error\">{$error}</p>";
}
?>
<form method="post">
    <input type="hidden" name="oldAttributeCode" value="<?php 
function getPlayerInfo($href)
{
    //$href = "playerpage.htm?ilkid=ALLENMAR01";
    //$href = "playerpage.htm?ilkid=ARRINLAV01";
    $debug = false;
    $base_url = "http://databasefootball.com/players/";
    //echo "href: $href<br>";
    //echo "$base_url $href<br>";
    $p_url = $base_url . $href;
    //echo "player url: $p_url<br>";
    $player_page = file_get_html($p_url);
    $bio = $player_page->find('font.bio', 0);
    //echo var_dump($bio);
    $plaintext = $bio->plaintext;
    $innerText = $bio->innerText;
    //echo "innerText: $innerText<br>";
    echo "Plaintext: {$plaintext}<br>";
    $plaintext = preg_replace("(\\'\\')", "\"", $plaintext);
    $plaintext = preg_replace("(\\')", "\\'", $plaintext);
    $fullName = $position = $height = $weight = $dob = $hometown = $college = $drafted = $nickname = "null";
    $fullName = getAttribute($plaintext, "", "Position:");
    if (preg_match("/Full Name:/", $plaintext)) {
        if (!(strpos($fullName, "Full Name:") === false)) {
            $fullName = getAttribute($plaintext, "Full Name:", "Position:");
        }
    }
    if (preg_match("/\\(*\\)/", $fullName)) {
        $nickname = getAttribute($plaintext, "(", ")");
    }
    //echo "FullName: $fullName<br>";
    if (preg_match("/Position:/", $plaintext)) {
        if (preg_match("/Height:/", $plaintext)) {
            $position = getAttribute($plaintext, "Position:", "Height:");
        } else {
            $position = getAttribute($plaintext, "Position:", "Born:");
        }
    }
    if (preg_match("/Height:/", $plaintext)) {
        $height = getAttribute($plaintext, "Height:", "Weight:");
    }
    if (preg_match("/Weight:/", $plaintext)) {
        $weight = getAttribute($plaintext, "Weight:", "Born:");
    }
    if (preg_match("/Born:/", $plaintext)) {
        if (preg_match("/, in/", $plaintext)) {
            $dob = getAttribute($plaintext, "Born:", ", in");
            $hometown = getAttribute($plaintext, ", in", "High School:");
        } else {
            if (preg_match("/High School:/", $plaintext)) {
                $dob = getAttribute($plaintext, "Born:", "High School:");
                $dob = preg_replace("/,/", "", $dob);
            } else {
                $dob = getAttribute($plaintext, "Born:", "");
            }
        }
        $dob = preg_replace("/,/", "", $dob);
    }
    if (preg_match("/College:/", $plaintext)) {
        $college = getAttribute($plaintext, "College:", "Drafted");
    }
    if (preg_match("/Drafted:/", $plaintext)) {
        $drafted = getAttribute($plaintext, "Drafted:", "");
    }
    //$fullName = $player_page->find("a h1")->plaintext;
    $header = $player_page->find("a[name] h1", 0);
    $fullName = $header->plaintext;
    //Jerry Da prato
    //John Smith
    //La var Arrington
    $fullName = preg_replace("/[[:space:]]([A-Z])/", " !\$1", htmltrim($fullName));
    $fullName = preg_replace("(\\')", "\\'", $fullName);
    //echo var_dump($fullName)."<br>";
    $name_array = explode(' !', $fullName);
    $first = $name_array[0];
    $last = $name_array[1];
    //echo "trs: ".var_dump($player_page->find('table tr[onmouseover]'));
    $teams = getTeams($player_page->find('table tbody tr td table tbody tr[onmouseover]'));
    //echo "Name: $fullName<br>";
    if ($debug) {
        echo "plaintext: {$plaintext}<br>";
        echo "nickName: {$nickname}<br>";
        echo "Position: '{$position}'<br>";
        echo "height: {$height}<br>";
        echo "weight: {$weight}<br>";
        echo "dob: {$dob}<br>";
        echo "hometown: {$hometown}<br>";
        echo "college: {$college}<br>";
        echo "drafted: {$drafted}<br>";
        echo "teams: {$teams}<br><br>";
    }
    $insert = "INSERT INTO players (\r\n\t\t\t\tfirst_name, last_name, height, weight, dob, position, team, college, hometown, drafted, nickname) \r\n\t\t\t\tVALUES('{$first}', '{$last}', '{$height}', {$weight}, '{$dob}', '{$position}', '{$teams}', '{$college}', '{$hometown}', '{$drafted}', '{$nickname}')";
    preg_replace("/''/", "'", $insert);
    echo $insert . "<br>";
    //$result = mysql_query($insert);
    $id = mysql_insert_id();
    /***********************
    	///awards section
    	/***********************/
    getAwards($id, $player_page->find('td p font.bio', 0));
    //->find('a[href^=/awards]')
}
Exemple #17
0
function process($obj, $contents)
{
    global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
    // Get Other information
    $node_list = $obj->getElementsByTagName('img');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'width') == '150') {
            $img_url = 'http://hospitals.jefferson.edu' . getAttribute($node, 'src');
        }
    }
    // Get Other information
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        // Get Speciality
        if (getAttribute($node, 'class') == 'specLineItem') {
            $speciality .= $node->nodeValue . ', ';
        }
        // Appointment
        if (getAttribute($node, 'class') == 'professional-titles') {
            $appointment = $node->nodeValue;
        }
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl00_pnlThumbnail') {
            //				$img_url = getAttribute( $node->firstChild, 'src' );
        }
        // Get Location
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl02_pnlOffices') {
            $location = $node->nodeValue;
            $location = str_replace('Office Locations', '', $location);
            $location = str_replace('View on Google Maps', '', $location);
        }
        // Get Certification
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabCertifications') {
            $certification = $node->nodeValue;
            $certification = str_replace('Board Certifications', '', $certification);
        }
        // Get Education
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabEducation') {
            $education = $node->nodeValue;
            $education = str_replace('Education', '', $education);
        }
        // Get Honor
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabAwards') {
            $honor = $node->nodeValue;
            $honor = str_replace('Awards and Honors', '', $honor);
        }
        // Training
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabInternship') {
            $training .= $node->nodeValue . ', ';
        }
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabResidency') {
            $training .= $node->nodeValue . ', ';
        }
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabFellowship') {
            $training .= $node->nodeValue . ', ';
        }
        // Expertise
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabConditions') {
            $expertise .= 'Conditions : ' . substr($node->nodeValue, strlen('Conditions')) . ', ';
        }
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabTreatments') {
            $expertise .= 'Treatments : ' . substr($node->nodeValue, strlen('Treatments')) . ', ';
        }
        if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabTests') {
            $expertise .= 'Tests : ' . substr($node->nodeValue, strlen('Tests')) . ', ';
        }
    }
    $pattern = '/Phone: *(\\([0-9]+\\) *[0-9\\-]+)/';
    $matches = '';
    $cntPhone = preg_match_all($pattern, $location, $matches);
    if ($cntPhone > 0) {
        for ($i = 0; $i < $cntPhone; $i++) {
            $phone .= $matches[1][$i] . ', ';
        }
    } else {
        $phone = ' 1-800-JEFF-NOW (800-533-3669)';
    }
    // Get the zip code
    $pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
    $matches = '';
    if (preg_match_all($pattern, $location, $matches) > 0) {
        for ($i = 0; $i < count($matches[1]); $i++) {
            $zipcode .= $matches[1][$i] . ', ';
        }
    }
    // Get the rank
    if (strpos(strtolower($appointment), 'associate professor') !== false) {
        $rank = 2;
    } elseif (strpos(strtolower($appointment), 'assistant professor') !== false) {
        $rank = 3;
    } elseif (strpos(strtolower($appointment), 'professor') !== false) {
        $rank = 1;
    }
    if (strlen($training) > 0) {
        $training = substr($training, 0, strlen($training) - 2);
    }
    if (strlen($speciality) > 0) {
        $speciality = substr($speciality, 0, strlen($speciality) - 2);
    }
    if (strlen($expertise) > 0) {
        $expertise = substr($expertise, 0, strlen($expertise) - 2);
    }
    if (strlen($zipcode) > 0) {
        $zipcode = substr($zipcode, 0, strlen($zipcode) - 2);
    }
}
 function set($att, $value)
 {
     $aux = getAttribute($att);
     $this->attributes[$att] = $value;
     return $aux;
 }
Exemple #19
0
function process($obj, $contents)
{
    global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree, $first_name, $last_name;
    // Get Image
    $node_list = $obj->getElementsByTagName('img');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'typeof') == 'foaf:Image') {
            $img_url = getAttribute($node, 'src');
        }
    }
    // Get First Name, Last Name, Degree
    $node_list = $obj->getElementsByTagName('h1');
    foreach ($node_list as $node) {
        $inner_name = $node->nodeValue;
    }
    $temp = '';
    do {
        $dgree .= $temp;
        $pos = strrpos($inner_name, ' ');
        $temp = substr($inner_name, $pos);
        $inner_name = substr($inner_name, 0, $pos);
    } while ($temp == strtoupper($temp));
    $inner_name .= $temp;
    $pos = strpos($inner_name, ' ');
    $dgree = trim($dgree);
    $first_name = substr($inner_name, 0, $pos);
    $last_name = trim(substr($inner_name, $pos));
    // Get Other information
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        if (substr(trim($node->nodeValue), 0, 12) == 'Specialties:') {
            $speciality = $node->nextSibling->nodeValue;
        }
        if (getAttribute($node, 'class') == 'panel-pane pane-entity-field pane-node-field-clinical-interest') {
            $expertise = $node->nodeValue;
            $expertise = trim(str_replace('Clinical Interests:', '', $expertise));
        }
        if (getAttribute($node, 'class') == 'field field-name-field-physician-biography field-type-text-long field-label-hidden') {
            $biology = $node->nodeValue;
        }
        if (getAttribute($node, 'class') == 'field field-name-field-physician-locations field-type-field-collection field-label-hidden') {
            $location = $node->nodeValue;
        }
        if (getAttribute($node, 'class') == 'field field-name-field-research-interest field-type-text-long field-label-hidden') {
            $research_interests = $node->nodeValue;
        }
        if (getAttribute($node, 'class') == 'field field-name-field-physician-title field-type-text field-label-hidden') {
            $appointment = $node->nodeValue;
        }
    }
    // Get the education, Training and Certificate
    // Get Other information
    $node_list = $obj->getElementsByTagName('ul');
    foreach ($node_list as $node) {
        switch (getAttribute($node, 'class')) {
            case 'field field-name-field-physician-education field-type-text field-label-above':
                $education .= $node->nodeValue . ', ';
                break;
            case 'field field-name-field-physician-residency field-type-text-long field-label-above':
                $training .= 'Residency : ' . $node->nodeValue . ', ';
                break;
            case 'field field-name-field-physician-fellowship field-type-text field-label-above':
                $training .= 'Fellowship : ' . $node->nodeValue . ', ';
                break;
            case 'field field-name-field-physician-internship field-type-text field-label-above':
                $training .= 'Internship : ' . $node->nodeValue . ', ';
                break;
            case 'field field-name-field-physician-boards field-type-text field-label-above':
                $certification .= $node->nodeValue . ', ';
                break;
        }
    }
    // Get the zip code
    $pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
    $matches = '';
    if (preg_match_all($pattern, $location, $matches) > 0) {
        for ($i = 0; $i < count($matches[1]); $i++) {
            $zipcode .= $matches[1][$i] . ', ';
        }
    }
    // Get the rank
    if (strpos(strtolower($appointment), 'associate professor') !== false) {
        $rank = 2;
    } elseif (strpos(strtolower($appointment), 'assistant professor') !== false) {
        $rank = 3;
    } elseif (strpos(strtolower($appointment), 'professor') !== false) {
        $rank = 1;
    }
    // Extract phone from Location
    $location = str_replace("\r\n", " ", $location);
    $location = str_replace("\n", " ", $location);
    $pattern = '/Phone: *([0-9\\-]+)/';
    $matches = '';
    $cntPhone = preg_match_all($pattern, $location, $matches);
    if ($cntPhone > 0) {
        for ($i = 0; $i < $cntPhone; $i++) {
            $phone .= $matches[1][$i] . ', ';
        }
    } else {
        $phone = '';
    }
    if (strlen($education) > 0) {
        $education = substr($education, 0, strlen($education) - 2);
    }
    if (strlen($training) > 0) {
        $training = substr($training, 0, strlen($training) - 2);
    }
    if (strlen($certification) > 0) {
        $certification = substr($certification, 0, strlen($certification) - 2);
    }
    if (strlen($zipcode) > 0) {
        $zipcode = substr($zipcode, 0, strlen($zipcode) - 2);
    }
    if (strlen($phone) > 0) {
        $phone = substr($phone, 0, strlen($phone) - 2);
    }
}
Exemple #20
0
 /**
  * Replace an existing attribute with a new one. 
  * This function is implemented using removeAttribute and setAttribute in db-transaction
  *
  * @param string    old section name
  * @param string    old application code
  * @param string    old user login
  * @param string    old section
  * @param string    old param
  * @param string    new section name
  * @param string    new application code
  * @param string    new user login
  * @param string    new section
  * @param string    new param
  * @param string    new value
  * @param string    new value
  * @param string    new type
  * @param string    new type-extended
  * @param string    new private flag
  * @param integer   new order
  * @param string    new description
  * @param bool      fail if the old value doesn't exist. Dafault false
  * @return mixed    return true on success, else false
  * @access public
  */
 public function replaceAttribute($old_dn_name, $old_app_code, $old_us_login, $old_se_section, $old_se_param, $dn_name, $app_code, $us_login, $se_section, $se_param, $se_value, $se_type = 'STRING', $se_type_ext = '', $se_private = 'T', $se_order = 0, $se_descr = null, $failIfNotExists = false)
 {
     if ($failIfNotExists) {
         if (getAttribute($old_dn_name, $old_app_code, $old_us_login, $old_se_section, $old_se_param) == null) {
             return false;
         }
     }
     $inTransaction = $this->inTransaction;
     if (!$inTransaction) {
         $this->beginTransaction();
     }
     $this->removeAttribute($old_dn_name, $old_app_code, $old_us_login, $old_se_section, $old_se_param);
     $this->setAttribute($dn_name, $app_code, $us_login, $se_section, $se_param, $se_value, $se_type, $se_type_ext, $se_private, $se_order, $se_descr);
     if (!$inTransaction) {
         $this->commitTransaction();
     }
 }
 //$xmlDoc->load ( $tempfile );
 //$xmlcontent=file_get_contents($tempfile );
 $xmlDoc = simplexml_load_file($tempfile, 'SimpleXMLElement', LIBXML_PARSEHUGE);
 $searchNodes = $xmlDoc->xpath("/fps/item");
 $spid = 0;
 foreach ($searchNodes as $searchNode) {
     //echo $searchNode->title,"\n";
     $title = $searchNode->title;
     $time_limit = $searchNode->time_limit;
     $unit = getAttribute($searchNode, 'time_limit', 'unit');
     //echo $unit;
     if ($unit == 'ms') {
         $time_limit /= 1000;
     }
     $memory_limit = getValue($searchNode, 'memory_limit');
     $unit = getAttribute($searchNode, 'memory_limit', 'unit');
     if ($unit == 'kb') {
         $memory_limit /= 1024;
     }
     $description = getValue($searchNode, 'description');
     $input = getValue($searchNode, 'input');
     $output = getValue($searchNode, 'output');
     $sample_input = getValue($searchNode, 'sample_input');
     $sample_output = getValue($searchNode, 'sample_output');
     //		$test_input = getValue ( $searchNode, 'test_input' );
     //		$test_output = getValue ( $searchNode, 'test_output' );
     $hint = getValue($searchNode, 'hint');
     $source = getValue($searchNode, 'source');
     $solutions = $searchNode->children()->solution;
     $spjcode = getValue($searchNode, 'spj');
     $spj = trim($spjcode) ? 1 : 0;
Exemple #22
0
function process($obj, $contents)
{
    global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank;
    // Get Image and expertise
    $node_list = $obj->getElementsByTagName('figure');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'headshot') {
            $img_url = 'https://winshipcancer.emory.edu/' . substr(getAttribute($node->firstChild, 'src'), 6);
        }
    }
    // Get the Appointment Speciality and Expertise
    $node_list = $obj->getElementsByTagName('h2');
    foreach ($node_list as $node) {
        if (trim($node->nodeValue) == 'Titles and Roles') {
            $html = $obj->saveHTML($node->nextSibling->firstChild);
            $html = str_replace('<dt>', '', $html);
            $html = str_replace('</dt>', ', ', $html);
            $html = str_replace('<dd class="text-muted">', '', $html);
            $html = str_replace('</dd>', ', ', $html);
            $pattern = '/<dl[^>]*>([^<]*)<\\/dl>/';
            $matches = '';
            if (preg_match_all($pattern, $html, $matches) > 0) {
                $appointment = $matches[1][0];
            }
            $html = $obj->saveHTML($node->nextSibling->nextSibling->firstChild);
            $pattern = '/<dt>([^<]*)<\\/dt>/';
            $matches = '';
            if (preg_match_all($pattern, $html, $matches) > 0) {
                $speciality = $matches[1][0];
            }
            $pattern = '/<dd><a[^>]*>([^<]*)<\\/a><\\/dd>/';
            $matches = '';
            if (preg_match_all($pattern, $html, $matches) > 0) {
                for ($i = 0; $i < count($matches[1]); $i++) {
                    $expertise .= $matches[1][$i] . ', ';
                }
            }
        }
    }
    // Get the email and phone
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'id') == 'bio-primary-contact') {
            $phone = $node->firstChild->nodeValue;
            $email = $node->firstChild->nextSibling->nodeValue;
        }
    }
    // Get the biology, Education, Research, Certificate
    $node_list = $obj->getElementsByTagName('section');
    foreach ($node_list as $node) {
        $nodeValue = trim($node->firstChild->nodeValue);
        if ($nodeValue == 'Biography') {
            $biology = $node->firstChild->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Education') {
            $education = $node->firstChild->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Research') {
            $research_interests = $node->firstChild->nextSibling->nodeValue;
        }
        if ($nodeValue == 'Awards') {
            $honor = $node->firstChild->nextSibling->nodeValue;
        }
    }
    // Get the rank
    if (strpos($appointment, 'Associate Professor') !== false) {
        $rank = 2;
    } elseif (strpos($appointment, 'Assistant Professor') !== false) {
        $rank = 3;
    } elseif (strpos($appointment, 'Professor') !== false) {
        $rank = 1;
    }
}
Exemple #23
0
 $searchNodes = $xmlDoc->getElementsByTagName("item");
 foreach ($searchNodes as $searchNode) {
     $title = getValue($searchNode, 'title');
     $time_limit = getValue($searchNode, 'time_limit');
     $memory_limit = getValue($searchNode, 'memory_limit');
     $description = getValue($searchNode, 'description');
     $input = getValue($searchNode, 'input');
     $output = getValue($searchNode, 'output');
     $sample_input = getValue($searchNode, 'sample_input');
     $sample_output = getValue($searchNode, 'sample_output');
     $test_input = getValue($searchNode, 'test_input');
     $test_output = getValue($searchNode, 'test_output');
     $hint = getValue($searchNode, 'hint');
     $source = getValue($searchNode, 'source');
     $solution = getValue($searchNode, 'solution');
     $language = getAttribute($searchNode, 'solution', 'language');
     $spjcode = getValue($searchNode, 'spj');
     $spj = $spjcode ? 1 : 0;
     //
     //      $valueID = $searchNode->getAttribute ( 'ID' );
     //
     //		echo "->$title<br>\n";
     //		echo "->$time_limit<br>\n";
     //		echo "->$memory_limit<br>\n";
     //		echo "->$description<br>\n";
     //		echo "->$input<br>\n";
     //		echo "->$output<br>\n";
     //		echo "->$sample_input<br>\n";
     //		echo "->$sample_output<br>\n";
     //		echo "->$test_input<br>\n";
     //		echo "->$test_output<br>\n";
Exemple #24
0
function process($obj, $contents)
{
    global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
    // Get image information
    $node_list = $obj->getElementsByTagName('img');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'id') == 'main_0_content_0_ProfileImage') {
            $img_url = 'http://www.uhhospitals.org' . getAttribute($node, 'src');
        }
    }
    // Get the phone number
    $node_list = $obj->getElementsByTagName('h3');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'phoneNumber') {
            $phone = $node->nodeValue;
        }
    }
    // Get the Speciality
    $node_list = $obj->getElementsByTagName('h2');
    foreach ($node_list as $node) {
        $speciality = $node->nodeValue;
    }
    // Get the appointment
    $node_list = $obj->getElementsByTagName('ul');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'dr-profile-titles') {
            //                echo $obj->saveHTML( $node );
            $appointment = $node->nodeValue;
        }
    }
    // Get the other informations
    $node_list = $obj->getElementsByTagName('div');
    foreach ($node_list as $node) {
        if (getAttribute($node, 'class') == 'dr-profile-content') {
            $info = trim($node->nodeValue);
            // biology
            $pos = strpos($info, 'Video Library');
            $posCertification = strpos($info, 'Board Certifications');
            if ($pos === false) {
                $pos = $posCertification;
            }
            if (substr($info, 0, 3) == 'Bio') {
                $biology = substr($info, 3, $pos - 3);
            }
            $info = substr($info, $posCertification);
            // Certification
            $pos = strpos($info, 'Education & Training');
            if ($posCertification !== false) {
                $certification = substr($info, 0, $pos);
                $certification = str_replace('Board Certifications', '', $certification);
            }
            $info = substr($info, $pos);
            // Education & Training
            $pos = strpos($info, 'Expertise');
            $education = substr($info, 0, $pos);
            $education = str_replace('Education & Training', '', $education);
            $info = substr($info, $pos);
            // Expertise
            $pos = strpos($info, 'Office Locations');
            $expertise = substr($info, 0, $pos);
            $expertise = str_replace('Expertise', '', $expertise);
            $info = substr($info, $pos);
            // Location
            $pos = strpos($info, 'var map_options');
            $location = substr($info, 0, $pos);
            $location = str_replace('Office Locations', '', $location);
            $location = str_replace('Get Directions', '   ', $location);
            $info = substr($info, $pos);
        }
    }
    // Build the Education and Traning
    $posInternship = strpos($education, 'Internship');
    $posResidency = strpos($education, 'Residency');
    $posFellowship = strpos($education, 'Fellowship');
    $posTraining = 10000000;
    if ($posInternship !== false && $posTraining > $posInternship) {
        $posTraining = $posInternship;
    }
    if ($posResidency !== false && $posTraining > $posResidency) {
        $posTraining = $posResidency;
    }
    if ($posFellowship !== false && $posTraining > $posFellowship) {
        $posTraining = $posFellowship;
    }
    if ($posTraining != 10000000) {
        $training = substr($education, $posTraining);
        $education = substr($education, 0, $posTraining);
    }
    $education = str_replace('Medical / Professional School(s)', ' Medical / Professional School(s) : ', $education);
    $education = str_replace('Undergraduate', 'Undergraduate : ', $education);
    $training = str_replace('Internship', 'Internship : ', $training);
    $training = str_replace('Residency', ', Residency : ', $training);
    $training = str_replace('Fellowship', ', Fellowship : ', $training);
    if (substr($training, 0, 2) == ', ') {
        $training = substr($training, 2);
    }
    // Get the zip code
    $pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
    $matches = '';
    if (preg_match_all($pattern, $location, $matches) > 0) {
        for ($i = 0; $i < count($matches[1]); $i++) {
            $zipcode .= $matches[1][$i] . ', ';
        }
    }
    // Get the rank
    if (strpos(strtolower($appointment), 'associate professor') !== false) {
        $rank = 2;
    } elseif (strpos(strtolower($appointment), 'assistant professor') !== false || strpos(strtolower($appointment), 'assistant clinical professor') !== false) {
        $rank = 3;
    } elseif (strpos(strtolower($appointment), 'professor') !== false) {
        $rank = 1;
    }
    if (strlen($zipcode) > 0) {
        $zipcode = substr($zipcode, 0, strlen($zipcode) - 2);
    }
}