本文整理汇总了PHP中getVal函数的典型用法代码示例。如果您正苦于以下问题:PHP getVal函数的具体用法?PHP getVal怎么用?PHP getVal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getVal函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: backend_keywords
function backend_keywords($name, $input = null, $options = array(), $methode = null)
{
$keywords = getVal($input, $methode, $name);
if ($keywords) {
$keywords = substr($keywords, 1, -1);
$keywords = str_replace('][', ',', $keywords) . ',';
}
$keywordsArr = explode(",", $keywords);
$code = '<div id="keywordsStock" style="width:325px">';
foreach ($keywordsArr as $key) {
$keyObj = Document::getDocumentInstance($key);
if ($keyObj = Document::getDocumentInstance($key)) {
$code .= '<div id="key_' . $key . '" class="s" onclick="removeKeyword(\'' . $key . '\')">' . $keyObj->getLabel() . '</div>';
}
}
$code .= '</div>';
$code .= input_hidden_tag($name, $keywords, array('id' => 'keywords'));
$code .= '<br><div style="clear:both"></div>';
$code .= getDivLabel($options, $name);
if ($options['size']) {
$size = $options['size'];
} else {
$size = 50;
}
$code .= '<input type="text" id="keyword" autocomplete="off" size="' . $size . '" onfocus="document.getElementById(\'fk\').style.display = \'none\'"
onkeyup="getKeywords(this.value, document.getElementById(\'fk\'))">
 <input type="button" value="' . $options['btnLabel'] . '" onclick="addKeyword(document.getElementById(\'keyword\').value)"><div id="fk"></div>';
return $code;
}
开发者ID:kotow,项目名称:work,代码行数:29,代码来源:BackendFormHelper.php
示例17: publish
/**
* Publish an Activity.
*
* If the auto-publish option is set, the Activity data is published into the IATI Registry.
* @param $activity
* @param $details
* @return bool
*/
public function publish($activity, array $details)
{
try {
$organization = $activity->organization;
$settings = $organization->settings;
$version = $settings->version;
$this->xmlServiceProvider->initializeGenerator($version)->generate($activity, $this->organizationManager->getOrganizationElement(), $this->activityManager->getActivityElement());
if (getVal($settings['registry_info'], [0, 'publish_files']) == 'yes') {
$this->publisher->publishFile($organization->settings['registry_info'], $this->organizationDataProvider->fileBeingPublished($activity->id), $organization, $organization->settings->publishing_type);
$this->activityManager->activityInRegistry($activity);
$this->twitter->post($organization->settings, $organization);
}
$this->update($details, $activity);
return true;
} catch (\ErrorException $exception) {
$this->logger->error($exception);
return null;
} catch (Exception $exception) {
$this->logger->error($exception);
return array_first(explode("\n", $exception->getMessage()), function () {
return true;
});
}
}
开发者ID:younginnovations,项目名称:aidstream,代码行数:32,代码来源:WorkflowManager.php
示例18: getValS
$fileInput = getValS(@$opt['i']);
$fileOutput = getValS(@$opt['o']);
if (isset($opt['N'])) {
$fileOutput = str_replace('*',pathinfo($fileInput,PATHINFO_FILENAME),$fileOutput);
}
$font = loadFont($fileInput);
$font['width'] = $font['width'] ? $font['width'] : 8;
$maxChar = $font['max'];
$pixX=getVal(@$opt['pxx'],1);
$pixY=getVal(@$opt['pxy'],$pixX);
$charXLine = getVal(@$opt['chl'],16);
if (isset($opt['mktpl'])) {
$tpl = array(
'i' => $fileOutput,
'chw' => $font['width'],
'chh' => $font['height'],
'name' => $font['name'],
'code' => $font['charset'],
'pxx' => $pixX,
'pxy' => $pixY,
'chars' => $font['max'],
'first' => 0,
'icw' => $font['width']*$pixX,
'ich' => $font['height']*$pixY,
'px' => 0,
开发者ID:epto,项目名称:MSF-MessaggioSpettrale,代码行数:31,代码来源:font2img.php
示例19: intval
$Applicant = @$_SESSION['SESS_Applicant_Name'];
$Address = @$_SESSION['SESS_Address'];
$NIC = @$_SESSION['SESS_NIC'];
$Telephone = @$_SESSION['SESS_Telephone'];
$Distance = @$_SESSION['SESS_Distance'];
if (isset($_POST['submit'])) {
$service = intval(getVal(@$_POST['service']));
$distance = intval(getVal(@$_POST['distance']));
$remoteCurrent = intval(getVal(@$_POST['remoteCurrent']));
$remote = intval(getVal(@$_POST['remote']));
$y2013 = intval(getVal(@$_POST['y2013']));
$y2012 = intval(getVal(@$_POST['y2012']));
$y2011 = intval(getVal(@$_POST['y2012']));
$y2010 = intval(getVal(@$_POST['y2010']));
$y2009 = intval(getVal(@$_POST['y2009']));
$schservice = intval(getVal(@$_POST['schservice']));
$marks31 = service(@$service);
$marks32 = distance(@$distance);
$marks33 = remote($remoteCurrent, $remote);
$marks34 = leave($y2013, $y2012, $y2011, $y2010, $y2009);
$marks35 = same_School_service($schservice);
$markst = $marks31 + $marks32 + $marks33 + $marks34 + $marks35;
if ($_POST['submit'] == "Submit") {
$sql = "INSERT INTO educationwork_child_marks " . "(Application_ID, Category_ID, Service, Distance, RemotePresent, RemoteService, LeaveY1,LeaveY2,LeaveY3,LeaveY4,LeaveY5, ServiceSameSchool,Marks_Service, Marks_Distance, Marks_Remote, Marks_Leave, Marks_SameSchool, Marks_Total)" . "VALUES ('{$app}', '{$cat}', '{$service}', '{$distance}', '{$remoteCurrent}', '{$remote}', '{$y2013}', '{$y2012}', '{$y2011}', '{$y2010}', '{$y2009}','{$schservice}', '{$marks31}', '{$marks32}', '{$marks33}', '{$marks34}', '{$marks35}', '{$markst}') " . "ON DUPLICATE KEY UPDATE Service = VALUES (Service),Distance = VALUES (Distance),RemotePresent = VALUES (RemotePresent),RemoteService = VALUES (RemoteService),LeaveY1 = VALUES (LeaveY1),LeaveY2 = VALUES (LeaveY2),LeaveY3 = VALUES (LeaveY3),LeaveY4 = VALUES (LeaveY4),LeaveY5 = VALUES (LeaveY5),ServiceSameSchool = VALUES (ServiceSameSchool)," . "Marks_Service = VALUES (Marks_Service),Marks_Distance = VALUES (Marks_Distance),Marks_Remote = VALUES (Marks_Remote),Marks_Leave = VALUES (Marks_Leave),Marks_SameSchool = VALUES (Marks_SameSchool),Marks_Total = VALUES (Marks_Total);";
$retval = mysql_query($sql);
if (!$retval) {
die('Could not enter data: ' . mysql_error());
} else {
$sql2 = "UPDATE application SET Marks = {$markst} WHERE Application_ID ={$app};";
$set = mysql_query($sql2);
if (!$set) {
开发者ID:sameera-sampath,项目名称:SEM,代码行数:31,代码来源:App_EducationOfficial.php
示例20: getVar
function getVar($var)
{
if ($var['0'] == '$') {
$var = getVal(substr($var, 1));
}
return $var;
}
开发者ID:jtresca,项目名称:nysurveyor,代码行数:7,代码来源:addtomenu.inc.php
注:本文中的getVal函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论