Ejemplo n.º 1
0
function from_camel_case($str)
{
    if (isset($str) && is_array($str)) {
        $str[0] = strtolower($str[0]);
        $func = create_function('$c', 'return " " . strtolower($c[1]);');
        $newStr = preg_replace_callback('/([A-Z])/', $func, $str);
        return ucfirst($newStr);
    } elseif (is_string($str)) {
        return sentenceCase($str);
    } else {
        return '';
    }
}
function readable($text, $altered = false, $class = false, $to_class = false)
{
    $relationshipText = $text;
    $defaultText = sentenceCase($text);
    $text = trim(strtolower($text));
    if (gettype($altered) == 'string') {
        return format_relationship($class, $relationshipText, $altered, $to_class);
    }
    switch ($text) {
        case "all":
            return 'All';
            break;
        case "draft":
            return $altered ? 'Draft' : 'Drafts';
            break;
        case "submitted_for_assessment":
            return 'Submitted for Assessment';
            break;
        case "assessment_in_progress":
            return 'Assessment In Progress';
            break;
        case "approved":
            return $altered ? 'Approved' : 'Approved Records';
            break;
        case "published":
            return $altered ? 'Published' : 'Published Records';
            break;
        case "more_work_required":
            return 'More Work Required';
            break;
        case "collection":
            return 'Collections';
            break;
        case "party":
            return 'Parties';
            break;
        case "service":
            return 'Services';
            break;
        case "activity":
            return 'Activities';
            break;
        case "role_user":
            return 'User';
            break;
        case "role_organisational":
            return 'Organisation';
            break;
        case "role_functional":
            return 'Functional';
            break;
        case "role_doi_appid":
            return 'DOI Application Identifier';
            break;
        case "t":
            return "<i class='icon icon-ok'></i>";
            break;
        case "f":
            return "<i class='icon icon-remove'></i>";
            break;
        case "1":
            return "<i class='icon icon-ok'></i>";
            break;
        case "0":
            return "<i class='icon icon-remove'></i>";
            break;
        case "authentication_built_in":
            return "Built-in";
            break;
        case "authentication_ldap":
            return "LDAP";
            break;
        case "authentication_shibboleth":
            return "Shibboleth";
            break;
        case "pmhharvester":
            return "OAI-PMH Harvester";
            break;
        case "getharvester":
            return "GET Harvester";
            break;
        case "cswharvester":
            return "CSW Harvester";
            break;
        case "ckanharvester":
            return "CKAN Harvester";
            break;
        case 'licence':
            return 'Licence';
            break;
        case 'rights':
            return 'Rights';
            break;
        case 'accessrights':
            return 'Access rights';
            break;
        case 'rightsstatement':
            return 'Rights Statement';
            break;
        case 'full':
            return 'Full description';
            break;
        case 'brief':
            return 'Brief description';
            break;
        case 'note':
            return 'Notes';
            break;
        case 'lineage':
            return 'Lineage';
            break;
        case 'addsvalueto':
            return 'Adds value to';
            break;
        case 'describes':
            return 'Describes';
            break;
        case 'enriches':
            return 'Enriches';
            break;
        case 'fundingamount':
            return 'Funding Amount';
            break;
        case 'deliverymethod':
            return 'Delivery method';
            break;
        case 'researchers':
            return 'Researchers';
            break;
        case 'fundingscheme':
            return 'Funding Scheme';
            break;
        case 'leadinvestigator':
            return 'Lead investigator';
            break;
        case 'principalinvestigator':
            return 'Principal investigator';
            break;
        case 'coinvestigator':
            return 'Co investigator';
            break;
        default:
            return $defaultText;
    }
}
Ejemplo n.º 3
0
public function setType($type)
{
        $this->type = $type;
}

*  
*/
foreach ($argv as $mutatorName) {
    if ($mutatorName !== "makemutators.php") {
        echo '
		public function get' . sentenceCase($mutatorName) . '() 
		{
			return $this->' . $mutatorName . ';
		}
					
		public function set' . sentenceCase($mutatorName) . '($' . $mutatorName . ')
		{
			$this->' . $mutatorName . ' = $' . $mutatorName . ';
		}			
		';
    }
}
function sentenceCase($s)
{
    //thought this was a built in function
    $ret = '';
    // $str = strtolower($s);
    $str = $s;
    $cap = true;
    for ($x = 0; $x < strlen($str); $x++) {
        $letter = substr($str, $x, 1);