%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/pn/utils/classes/
Upload File :
Create Path :
Current File : /var/www/pn/utils/classes/AdbProject.php

<?php
namespace WebPappers\AdbProject;
use WebPappers\Project\Project;

class AdbProject extends Project
{
    private $NAME_PATH_NAME = '#page-title';
    private $STATUS_PATH_NAME = '.project-status-data';
    private $BENEFICIARYSAI_PATH_NAME = '.project-detail .project-field';
    private $DESCRIPTION_PATH_NAME = '.field-type-text-with-summary';

    public function getName()
    {
        $name = $this->dom->find($this->NAME_PATH_NAME);
        $name = trim($name[0]->text());
        
        return $name;
    }

    public function getPropertyByName($propertyName)
    {        
        $properties = $this->dom->find('tr');
        
        foreach($properties as $property){
            $propertyData = $property->find('td');            
            if(empty($propertyData[1])){
                continue;
            }
            
            $currentPropertyName = trim($propertyData[0]->text());
            if($currentPropertyName == $propertyName){
                return trim($propertyData[1]->innerHtml());
            }
        }        
    }

    public function getStatus()
    {
        $status = $this->getPropertyByName('Project Status');
        
        return $status; 
    }

    public function getBeneficiarySAI()
    {
        $country = $this->getPropertyByName('Country');
        $country = str_replace('Regional', '', $country);
        $country = str_replace('<br>', ',', $country);
        $country = trim($country);
        if($country[0] == ','){
            $country = ltrim($country, ',');
        }

        if($country[strlen($country)-1] == ','){
            $country = rtrim($country, ',');
        }
        return $country; 
    }

    public function getDescription()
    {
        $description = $this->dom->find($this->DESCRIPTION_PATH_NAME);
        $description = trim($description[0]->text());
        
        return $description;
    }

    public function getType()
    {
        return ADB_NAME;
    }

    public function getImplementingAgency()
    {
        return 'Asian development Bank';
    }
    
    public function getBeneficiaryLevel()
    {
        $contry = trim($this->getPropertyByName('Country'));
        $contry = strtolower($contry);
        if(stripos($contry,'regional') !== false){
            return 'Regional';
        }else{
            return 'Country';
        }
    }
    
}

Zerion Mini Shell 1.0