当前位置: 首页>>代码示例>>PHP>>正文


PHP getVal函数代码示例

本文整理汇总了PHP中getVal函数的典型用法代码示例。如果您正苦于以下问题:PHP getVal函数的具体用法?PHP getVal怎么用?PHP getVal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getVal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getXmlData

 /**
  * @param $transactions
  * @return array
  */
 public function getXmlData(Collection $transactions)
 {
     $transactionData = [];
     foreach ($transactions as $totalTransaction) {
         $transaction = $totalTransaction->transaction;
         $sector = [];
         if (getVal($transaction, ['sector'])) {
             $vocabulary = $transaction['sector'][0]['sector_vocabulary'];
             if ($vocabulary == 1) {
                 $sectorValue = $transaction['sector'][0]['sector_code'];
             } elseif ($vocabulary == 2) {
                 $sectorValue = $transaction['sector'][0]['sector_category_code'];
             } elseif ($vocabulary == "") {
                 $sectorValue = $transaction['sector'][0]['sector_code'];
             } else {
                 $sectorValue = $transaction['sector'][0]['sector_text'];
             }
             $sector = ['@attributes' => ['vocabulary' => $vocabulary, 'vocabulary-uri' => getVal($transaction, ['sector', 0, 'vocabulary_uri']), 'code' => $sectorValue], 'narrative' => $this->buildNarrative(getVal($transaction, ['sector', 0, 'narrative'], []))];
         }
         $recipientCountry = [];
         if (getVal($transaction, ['recipient_country'])) {
             $recipientCountry = ['@attributes' => ['code' => $transaction['recipient_country'][0]['country_code']], 'narrative' => $this->buildNarrative(getVal($transaction, ['recipient_country', 0, 'narrative'], []))];
         }
         $recipientRegion = [];
         if (getVal($transaction, ['recipient_region'])) {
             $recipientRegion = ['@attributes' => ['code' => $transaction['recipient_region'][0]['region_code'], 'vocabulary' => $transaction['recipient_region'][0]['vocabulary'], 'vocabulary-uri' => getVal($transaction, ['recipient_region', 0, 'vocabulary_uri'])], 'narrative' => $this->buildNarrative(getVal($transaction, ['recipient_region', 0, 'narrative'], []))];
         }
         $transactionData[] = ['@attributes' => ['ref' => $transaction['reference'], 'humanitarian' => getVal($transaction, ['humanitarian'])], 'transaction-type' => ['@attributes' => ['code' => $transaction['transaction_type'][0]['transaction_type_code']]], 'transaction-date' => ['@attributes' => ['iso-date' => $transaction['transaction_date'][0]['date']]], 'value' => ['@attributes' => ['currency' => $transaction['value'][0]['currency'], 'value-date' => $transaction['value'][0]['date']], '@value' => $transaction['value'][0]['amount']], 'description' => ['narrative' => $this->buildNarrative(getVal($transaction, ['description', 0, 'narrative'], []))], 'provider-org' => ['@attributes' => ['ref' => $transaction['provider_organization'][0]['organization_identifier_code'], 'provider-activity-id' => $transaction['provider_organization'][0]['provider_activity_id'], 'type' => getVal($transaction, ['provider_organization', 0, 'type'])], 'narrative' => $this->buildNarrative(getVal($transaction, ['provider_organization', 0, 'narrative'], []))], 'receiver-org' => ['@attributes' => ['ref' => $transaction['receiver_organization'][0]['organization_identifier_code'], 'receiver-activity-id' => $transaction['receiver_organization'][0]['receiver_activity_id'], 'type' => getVal($transaction, ['receiver_organization', 0, 'type'])], 'narrative' => $this->buildNarrative(getVal($transaction, ['receiver_organization', 0, 'narrative'], []))], 'disbursement-channel' => ['@attributes' => ['code' => getVal($transaction, ['disbursement_channel', 0, 'disbursement_channel_code'])]], 'sector' => $sector, 'recipient-country' => $recipientCountry, 'recipient-region' => $recipientRegion, 'flow-type' => ['@attributes' => ['code' => getVal($transaction, ['flow_type', 0, 'flow_type'])]], 'finance-type' => ['@attributes' => ['code' => getVal($transaction, ['finance_type', 0, 'finance_type'])]], 'aid-type' => ['@attributes' => ['code' => getVal($transaction, ['aid_type', 0, 'aid_type'])]], 'tied-status' => ['@attributes' => ['code' => getVal($transaction, ['tied_status', 0, 'tied_status_code'])]]];
     }
     return $transactionData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:35,代码来源:Transaction.php

示例2: buildNarrative

 /**
  * Build narratives for Elements.
  * @param $narratives
  * @return array
  */
 public function buildNarrative($narratives)
 {
     $narrativeData = [];
     foreach ($narratives as $narrative) {
         $narrativeData[] = ['@value' => getVal($narrative, ['narrative']), '@attributes' => ['xml:lang' => getVal($narrative, ['language'])]];
     }
     return $narrativeData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:13,代码来源:BaseElement.php

示例3: getXmlData

 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $recipientRegions = (array) $activity->recipient_region;
     foreach ($recipientRegions as $recipientRegion) {
         $activityData[] = ['@attributes' => ['code' => getVal($recipientRegion, ['region_code']), 'percentage' => getVal($recipientRegion, ['percentage']), 'vocabulary' => getVal($recipientRegion, ['region_vocabulary']), 'vocabulary-uri' => getVal($recipientRegion, ['vocabulary_uri'])], 'narrative' => $this->buildNarrative(getVal($recipientRegion, ['narrative'], []))];
     }
     return $activityData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:13,代码来源:RecipientRegion.php

示例4: getXmlData

 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $participatingOrganizations = (array) $activity->participating_organization;
     foreach ($participatingOrganizations as $participatingOrganization) {
         $activityData[] = ['@attributes' => ['ref' => $participatingOrganization['identifier'], 'type' => $participatingOrganization['organization_type'], 'role' => $participatingOrganization['organization_role'], 'activity-id' => getVal($participatingOrganization, ['activity_id'])], 'narrative' => $this->buildNarrative($participatingOrganization['narrative'])];
     }
     return $activityData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:13,代码来源:ParticipatingOrganization.php

示例5: getXmlData

 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $policyMarkers = (array) $activity->policy_marker;
     foreach ($policyMarkers as $policyMarker) {
         $activityData[] = ['@attributes' => ['vocabulary' => $policyMarker['vocabulary'], 'vocabulary-uri' => getVal($policyMarker, ['vocabulary_uri']), 'code' => getVal($policyMarker, ['policy_marker']), 'significance' => getVal($policyMarker, ['significance'])], 'narrative' => $this->buildNarrative(getVal($policyMarker, ['narrative'], []))];
     }
     return $activityData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:13,代码来源:PolicyMarker.php

示例6: getXmlData

 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $budgets = (array) $activity->budget;
     foreach ($budgets as $budget) {
         $activityData[] = ['@attributes' => ['type' => $budget['budget_type'], 'status' => getVal($budget, ['status'])], 'period-start' => ['@attributes' => ['iso-date' => $budget['period_start'][0]['date']]], 'period-end' => ['@attributes' => ['iso-date' => $budget['period_end'][0]['date']]], 'value' => ['@attributes' => ['currency' => $budget['value'][0]['currency'], 'value-date' => $budget['value'][0]['value_date']], '@value' => $budget['value'][0]['amount']]];
     }
     return $activityData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:13,代码来源:Budget.php

示例7: getXmlData

 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $documentLinks = $activity->documentLinks()->get();
     foreach ($documentLinks as $documentLink) {
         $documentLink = $documentLink->document_link;
         $activityData[] = ['@attributes' => ['url' => $documentLink['url'], 'format' => $documentLink['format']], 'title' => ['narrative' => $this->buildNarrative(getVal($documentLink, ['title', 0, 'narrative'], []))], 'category' => ['@attributes' => ['code' => getVal($documentLink, ['category', 0, 'code'])]], 'language' => ['@attributes' => ['code' => getVal($documentLink, ['language', 0, 'language'])]], 'document-date' => ['@attributes' => ['iso-date' => getVal($documentLink, ['document_date', 0, 'date'])]]];
     }
     return $activityData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:14,代码来源:DocumentLink.php

示例8: getStatusDrop

function getStatusDrop(){
	$choices = getStatusDropArr();	
	
	$ret = '<select class="input" name="status" id="status">';
	foreach($choices as $k=>$v){
		$selected = ($v == getVal('status'))?'selected="selected"':'';
		$ret .= '<option value="'.$v.'" '.$selected.'>'.$v.'</option>';
	}
	$ret .= '</select>';
	return $ret;
}
开发者ID:rcroxyosox,项目名称:jobtracker,代码行数:11,代码来源:functions.php

示例9: getMessagesForDocumentLink

 /**
  * @param array $formFields
  * @return array
  */
 protected function getMessagesForDocumentLink(array $formFields)
 {
     $messages = [];
     foreach ($formFields as $documentLinkIndex => $documentLink) {
         $documentLinkForm = sprintf('document_link.%s', $documentLinkIndex);
         $messages[sprintf('document_link.%s.url.required', $documentLinkIndex)] = 'Url is required';
         $messages[sprintf('document_link.%s.url.url', $documentLinkIndex)] = 'Enter valid URL. eg. http://example.com';
         $messages[sprintf('document_link.%s.format.required', $documentLinkIndex)] = 'Format is required';
         $messages = array_merge($messages, $this->getMessagesForNarrative(getVal($documentLink, ['title', 0, 'narrative']), sprintf('%s.title.0', $documentLinkForm)), $this->getMessagesForDocumentCategory(getVal($documentLink, ['category'], []), $documentLinkForm));
         $messages[sprintf('%s.title.0.narrative.0.narrative.required', $documentLinkForm)] = 'Narrative is required.';
     }
     return $messages;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:17,代码来源:DocumentLink.php

示例10: getRulesForBudget

 /**
  * @param array $formFields
  * @return array
  */
 protected function getRulesForBudget(array $formFields)
 {
     $rules = [];
     foreach ($formFields as $budgetIndex => $budget) {
         $budgetForm = sprintf('budget.%s', $budgetIndex);
         $rules = array_merge($rules, $this->getRulesForPeriodStart($budget['period_start'], $budgetForm), $this->getRulesForPeriodEnd($budget['period_end'], $budgetForm), $this->getRulesForValue($budget['value'], $budgetForm));
         $startDate = getVal($budget, ['period_start', 0, 'date']);
         $newDate = $startDate ? date('Y-m-d', strtotime($startDate . '+1year')) : '';
         if ($newDate) {
             $rules[$budgetForm . '.period_end.0.date'][] = sprintf('before:%s', $newDate);
         }
     }
     return $rules;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:18,代码来源:Budget.php

示例11: getXmlData

 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $plannedDisbursements = (array) $activity->planned_disbursement;
     foreach ($plannedDisbursements as $plannedDisbursement) {
         if (!array_key_exists('provider_org', $plannedDisbursement)) {
             $plannedDisbursement['provider_org'] = $this->plannedDisbursementTemplate();
         }
         if (!array_key_exists('reciever_org', $plannedDisbursement)) {
             $plannedDisbursement['reciever_org'] = $this->plannedDisbursementTemplate();
         }
         $activityData[] = ['@attributes' => ['type' => $plannedDisbursement['planned_disbursement_type']], 'period-start' => ['@attributes' => ['iso-date' => $plannedDisbursement['period_start'][0]['date']]], 'period-end' => ['@attributes' => ['iso-date' => $plannedDisbursement['period_end'][0]['date']]], 'value' => ['@attributes' => ['currency' => $plannedDisbursement['value'][0]['currency'], 'value-date' => $plannedDisbursement['value'][0]['value_date']], '@value' => $plannedDisbursement['value'][0]['amount']], 'provider-org' => ['@attributes' => ['ref' => getVal($plannedDisbursement, ['provider_org', 0, 'ref']), 'provider-activity-id' => getVal($plannedDisbursement, ['provider_org', 0, 'activity_id']), 'type' => getVal($plannedDisbursement, ['provider_org', 0, 'type'])], 'narrative' => $this->buildNarrative(getVal($plannedDisbursement, ['provider_org', 0, 'narrative'], []))], 'receiver-org' => ['@attributes' => ['ref' => getVal($plannedDisbursement, ['receiver_org', 0, 'ref']), 'receiver-activity-id' => getVal($plannedDisbursement, ['receiver_org', 0, 'activity_id']), 'type' => getVal($plannedDisbursement, ['receiver_org', 0, 'type'])], 'narrative' => $this->buildNarrative(getVal($plannedDisbursement, ['receiver_org', 0, 'narrative'], []))]];
     }
     return $activityData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:19,代码来源:PlannedDisbursement.php

示例12: getXmlData

 /**
  * @param $activity
  * @return array
  */
 public function getXmlData(Activity $activity)
 {
     $activityData = [];
     $sectors = (array) $activity->sector;
     foreach ($sectors as $sector) {
         $vocabulary = $sector['sector_vocabulary'];
         if ($vocabulary == 1) {
             $sectorValue = $sector['sector_code'];
         } elseif ($vocabulary == 2) {
             $sectorValue = $sector['sector_category_code'];
         } else {
             $sectorValue = $sector['sector_text'];
         }
         $activityData[] = ['@attributes' => ['code' => $sectorValue, 'percentage' => $sector['percentage'], 'vocabulary' => $vocabulary, 'vocabulary-uri' => getVal($sector, ['vocabulary_uri'])], 'narrative' => $this->buildNarrative($sector['narrative'])];
     }
     return $activityData;
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:Sector.php

示例13: unlink

 /**
  * Unlink a file from the IATI Registry.
  * @param $registryInfo
  * @param $changeDetails
  * @return bool
  * @throws Exception
  */
 public function unlink($registryInfo, $changeDetails)
 {
     try {
         $apiKey = $registryInfo[0]['api_id'];
         $api = new CkanClient(env('REGISTRY_URL'), $apiKey);
         foreach ($changeDetails['previous'] as $filename => $previous) {
             $pieces = explode(".", $filename);
             $fileId = array_first($pieces, function () {
                 return true;
             });
             if (getVal($previous, ['published_status'])) {
                 $api->package_delete($fileId);
             }
         }
         return true;
     } catch (Exception $exception) {
         throw $exception;
     }
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:26,代码来源:Publisher.php

示例14: getRepsDrop

function getRepsDrop(){
	global $DB;
	$sql = "SELECT * FROM reps WHERE 1 ORDER BY firstname";
	$res = $DB->query($sql);
	
	$ret = '<select name="rep" id="rep" class="input">';
	while($r = $DB->fetchNextObject($res)){
		
		if($r->id == $_SESSION['loggedin'] && !isset($_REQUEST['e'])){ // if its from the logged in user
			$selected = 'selected="selected"';
		
		}elseif($r->id == getVal('rep')){ // if its from the db of the global vars
			$selected = 'selected="selected"';
		
		}else{
			$selected = '';	
		}
			
		$ret .= '<option value="'.$r->id.'" '.$selected.'>'.$r->firstname.' '.$r->lastname.'</option>';
		
	}
	$ret .= '</select>';
	return $ret;
}
开发者ID:rcroxyosox,项目名称:jobtracker,代码行数:24,代码来源:index.php

示例15: explode

$request = $_SERVER['REQUEST_URI'];
$request = explode('/', substr($request, strpos($request, 'api') + 4));
$noun = $request[0];
$id = mysql_real_escape_string($request[1]);
if (is_null($id)) {
    echo "id missing";
    return;
}
//	get variables
//	TODO this should eventually not be tied to Tasks so we can reuse this script for other objects
// foreach($put as $var => $val){
// 	echo $var . ": " . $val;
// };
$sql = "UPDATE task SET ";
foreach ($put as $name => $val) {
    $sql .= getVal($put, $name);
}
//	remove last ,
$sql = substr($sql, 0, strrpos($sql, ',')) . " ";
$sql .= "WHERE id = {$id};";
//	update in DB
$result = mysql_query($sql);
if (mysql_error()) {
    return false;
} else {
    //echo mysql_affected_rows();
    echo '{"id":' . $id . '}';
}
function getVal($put, $varName)
{
    if (isset($put->{$varName})) {
开发者ID:reergymerej,项目名称:timecard,代码行数:31,代码来源:put.php


注:本文中的getVal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。