本文整理汇总了PHP中core_kernel_classes_Resource::getOnePropertyValue方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::getOnePropertyValue方法的具体用法?PHP core_kernel_classes_Resource::getOnePropertyValue怎么用?PHP core_kernel_classes_Resource::getOnePropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_kernel_classes_Resource
的用法示例。
在下文中一共展示了core_kernel_classes_Resource::getOnePropertyValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createExecutionEnvironment
/**
* Build and load the item execution environment.
*
* @param core_kernel_classes_Resource $processExecution
* @param core_kernel_classes_Resource $item
* @param core_kernel_classes_Resource $test
* @param core_kernel_classes_Resource $delivery
* @param core_kernel_classes_Resource $user
*
* @return array
*/
protected function createExecutionEnvironment(core_kernel_classes_Resource $processExecution, core_kernel_classes_Resource $item, core_kernel_classes_Resource $test, core_kernel_classes_Resource $delivery, core_kernel_classes_Resource $user)
{
$executionEnvironment = array();
foreach (func_get_args() as $arg) {
if (is_null($arg)) {
return $executionEnvironment;
}
}
//we build the data to give to the item
$executionEnvironment = array('token' => $this->createToken(), 'localNamespace' => rtrim(common_ext_NamespaceManager::singleton()->getLocalNamespace()->getUri(), '#'), CLASS_PROCESS_EXECUTIONS => array('uri' => $processExecution->getUri(), RDFS_LABEL => $processExecution->getLabel()), TAO_ITEM_CLASS => array('uri' => $item->getUri(), RDFS_LABEL => $item->getLabel()), TAO_TEST_CLASS => array('uri' => $test->getUri(), RDFS_LABEL => $test->getLabel()), TAO_DELIVERY_CLASS => array('uri' => $delivery->getUri(), RDFS_LABEL => $delivery->getLabel()), TAO_SUBJECT_CLASS => array('uri' => $user->getUri(), RDFS_LABEL => $user->getLabel(), PROPERTY_USER_LOGIN => (string) $user->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_USER_LOGIN)), PROPERTY_USER_FIRSTNAME => (string) $user->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_USER_FIRSTNAME)), PROPERTY_USER_LASTNAME => (string) $user->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_USER_LASTNAME))));
$session = PHPSession::singleton();
$session->setAttribute(self::ENV_VAR_NAME . '_' . tao_helpers_Uri::encode($user->getUri()), $executionEnvironment);
return $executionEnvironment;
}
示例2: getBaseUrl
public static function getBaseUrl(core_kernel_classes_Resource $serviceDefinition)
{
try {
$url = common_cache_FileCache::singleton()->get(self::CACHE_PREFIX_URL . urlencode($serviceDefinition->getUri()));
} catch (common_cache_NotFoundException $e) {
$serviceDefinitionUrl = $serviceDefinition->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_SUPPORTSERVICES_URL));
if ($serviceDefinitionUrl instanceof core_kernel_classes_Literal) {
$serviceUrl = $serviceDefinitionUrl->literal;
} else {
if ($serviceDefinitionUrl instanceof core_kernel_classes_Resource) {
// hack nescessary since fully qualified urls are considered to be resources
$serviceUrl = $serviceDefinitionUrl->getUri();
} else {
throw new common_exception_InconsistentData('Invalid service definition url for ' . $serviceDefinition->getUri());
}
}
// Remove the parameters because they are only for show, and they are actualy encoded in the variables
$urlPart = explode('?', $serviceUrl);
$url = $urlPart[0];
common_cache_FileCache::singleton()->put($url, self::CACHE_PREFIX_URL . urlencode($serviceDefinition->getUri()));
}
if ($url[0] == '/') {
//create absolute url (prevent issue when TAO installed on a subfolder
$url = ROOT_URL . ltrim($url, '/');
}
return $url;
}
示例3: getValue
/**
* Short description of method getValue
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @param Resource resource
* @param Column column
* @return string
*/
public function getValue(core_kernel_classes_Resource $resource, tao_models_classes_table_Column $column)
{
$returnValue = (string) '';
$result = $resource->getOnePropertyValue($column->getProperty());
$returnValue = $result instanceof core_kernel_classes_Resource ? $result->getLabel() : (string) $result;
return (string) $returnValue;
}
示例4: getElseActivity
/**
* Short description of method getElseActivity
*
* @access public
* @author Lionel Lecaque, <lionel.lecaque@tudor.lu>
* @param Resource rule
* @return core_kernel_classes_Resource
*/
public function getElseActivity(core_kernel_classes_Resource $rule)
{
$returnValue = null;
$elseProperty = new core_kernel_classes_Property(PROPERTY_TRANSITIONRULES_ELSE);
$returnValue = $rule->getOnePropertyValue($elseProperty);
return $returnValue;
}
示例5: deleteContent
/**
* (non-PHPdoc)
* @see taoTests_models_classes_TestModel::onTestModelSet()
*/
public function deleteContent(core_kernel_classes_Resource $test)
{
$content = $test->getOnePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
if (!is_null($content)) {
$content->delete();
$test->removePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP), $content);
}
}
示例6: getUserMail
/**
* Get user mail value
* @param core_kernel_classes_Resource $user
* @return string | null
*/
public function getUserMail(\core_kernel_classes_Resource $user)
{
$userMailProperty = new \core_kernel_classes_Property(PROPERTY_USER_MAIL);
$result = (string) $user->getOnePropertyValue($userMailProperty);
if (!$result || !filter_var($result, FILTER_VALIDATE_EMAIL)) {
$result = null;
}
return $result;
}
示例7: logoutUser
protected function logoutUser()
{
if (!is_null($this->currentUser)) {
$loginProperty = new core_kernel_classes_Property(PROPERTY_USER_LOGIN);
$this->out("logout " . $this->currentUser->getOnePropertyValue($loginProperty) . ' "' . $this->currentUser->getUri() . '"', true);
$this->userService->logout();
$this->currentUser = null;
}
}
示例8: getValue
public function getValue($rowId, $columnId, $data = null)
{
$returnValue = null;
if (isset($this->data[$rowId])) {
//return values:
if (isset($this->data[$rowId][$columnId])) {
$returnValue = $this->data[$rowId][$columnId];
}
} else {
if (common_Utils::isUri($rowId)) {
$processInstance = new core_kernel_classes_Resource($rowId);
//TODO: property uris need to be set in the constant files:
$unit = $processInstance->getOnePropertyValue(TranslationProcessHelper::getProperty('unitUri'));
$countryCode = $processInstance->getOnePropertyValue(TranslationProcessHelper::getProperty('CountryCOde'));
$langCode = $processInstance->getOnePropertyValue(TranslationProcessHelper::getProperty('LanguageCode'));
$this->data[$rowId] = array('unit' => is_null($unit) ? 'n/a' : $unit->getLabel(), 'country' => $countryCode instanceof core_kernel_classes_Literal ? $countryCode->literal : 'n/a', 'language' => $langCode instanceof core_kernel_classes_Literal ? $langCode->literal : 'n/a');
if (isset($this->data[$rowId][$columnId])) {
$returnValue = $this->data[$rowId][$columnId];
}
}
}
return $returnValue;
}
示例9: getValue
/**
* Short description of method getValue
*
* @access public
* @author Somsack Sipasseuth, <somsack.sipasseuth@tudor.lu>
* @param string rowId
* @param string columnId
* @param string data
* @return mixed
*/
public function getValue($rowId, $columnId, $data = null)
{
$returnValue = null;
$user = new core_kernel_classes_Resource($rowId);
$prop = new core_kernel_classes_Property($columnId);
$res = $user->getOnePropertyValue($prop);
if (is_null($res)) {
$returnValue = '';
} elseif ($res instanceof core_kernel_classes_Resource) {
$returnValue = $res->getLabel();
} else {
$returnValue = (string) $res;
}
return $returnValue;
}
示例10: initElements
/**
* Used to create the form elements and bind them to the form instance
*
* @access protected
* @return mixed
*/
protected function initElements()
{
//create file upload form box
$fileElt = \tao_helpers_form_FormFactory::getElement('source', 'AsyncFile');
$fileElt->setDescription(__("Add a media file"));
if (isset($_POST['import_sent_file'])) {
$fileElt->addValidator(\tao_helpers_form_FormFactory::getValidator('NotEmpty'));
} else {
$fileElt->addValidator(\tao_helpers_form_FormFactory::getValidator('NotEmpty', array('message' => '')));
}
$fileElt->addValidators(array(\tao_helpers_form_FormFactory::getValidator('FileSize', array('max' => \tao_helpers_Environment::getFileUploadLimit()))));
$this->form->addElement($fileElt);
$langService = \tao_models_classes_LanguageService::singleton();
$dataUsage = new \core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_DATA);
$dataLang = \common_session_SessionManager::getSession()->getDataLanguage();
$dataLang = 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' . $dataLang;
if (!is_null($this->instanceUri)) {
$instance = new \core_kernel_classes_Resource($this->instanceUri);
$lang = $instance->getOnePropertyValue(new \core_kernel_classes_Property(MEDIA_LANGUAGE));
if ($lang instanceof \core_kernel_classes_Resource) {
$dataLang = $lang->getUri();
}
}
$langOptions = array();
foreach ($langService->getAvailableLanguagesByUsage($dataUsage) as $lang) {
$langOptions[\tao_helpers_Uri::encode($lang->getUri())] = $lang->getLabel();
}
$langElt = \tao_helpers_form_FormFactory::getElement('lang', 'Combobox');
$langElt->setValue(\tao_helpers_Uri::encode($dataLang));
$langElt->setOptions($langOptions);
$this->form->addElement($langElt);
$this->form->createGroup('options', __('Media Options'), array($langElt));
$fileSentElt = \tao_helpers_form_FormFactory::getElement('import_sent_file', 'Hidden');
$fileSentElt->setValue(1);
$this->form->addElement($fileSentElt);
if (!is_null($this->instanceUri)) {
$instanceElt = \tao_helpers_form_FormFactory::getElement('instanceUri', 'Hidden');
$instanceElt->setValue($this->instanceUri);
$this->form->addElement($instanceElt);
}
}
示例11: initElements
/**
* (non-PHPdoc)
* @see tao_actions_form_Instance::initElements()
*/
protected function initElements()
{
parent::initElements();
$elementId = tao_helpers_Uri::encode(TAO_ITEM_MODEL_PROPERTY);
$ele = $this->form->getElement($elementId);
$ele->feed();
$modelUri = $ele->getEvaluatedValue();
if (empty($modelUri)) {
// remove deprecated models
$statusProperty = new core_kernel_classes_Property(TAO_ITEM_MODEL_STATUS_PROPERTY);
$options = array();
foreach ($ele->getOptions() as $optUri => $optLabel) {
$model = new core_kernel_classes_Resource(tao_helpers_Uri::decode($optUri));
$status = $model->getOnePropertyValue($statusProperty);
if (!is_null($status) && $status->getUri() != TAO_ITEM_MODEL_STATUS_DEPRECATED) {
$options[$optUri] = $optLabel;
}
}
$ele->setOptions($options);
if (count($options) === 1) {
reset($options);
$ele->setValue(key($options));
}
} else {
// replace radio with hidden element
$this->form->removeElement($elementId);
$itemModelElt = tao_helpers_form_FormFactory::getElement($elementId, 'Hidden');
$itemModelElt->setValue($modelUri);
$this->form->addElement($itemModelElt);
// display model label
$model = new core_kernel_classes_Resource($modelUri);
$itemModelLabelElt = tao_helpers_form_FormFactory::getElement('itemModelLabel', 'Label');
$itemModelLabelElt->setDescription(__('Item Model'));
$itemModelLabelElt->setValue($model->getLabel());
$this->form->addElement($itemModelLabelElt);
}
}
示例12: setDefaultParameters
/**
* returns an array with the defined default values for the
* service definition's parameters
*
* @param core_kernel_classes_Resource $serviceDefinition
*/
public function setDefaultParameters(core_kernel_classes_Resource $serviceCall)
{
$serviceDefinition = $this->getServiceDefinition($serviceCall);
$processService = wfAuthoring_models_classes_ProcessService::singleton();
$processService->deleteActualParameters($serviceCall);
$defaultConstProp = new core_kernel_classes_Property(PROPERTY_FORMALPARAMETER_DEFAULTCONSTANTVALUE);
$params = $serviceDefinition->getPropertyValues(new core_kernel_classes_Property(PROPERTY_SERVICESDEFINITION_FORMALPARAMIN));
foreach ($params as $paramUri) {
$param = new core_kernel_classes_Resource($paramUri);
$default = $param->getOnePropertyValue($defaultConstProp);
if (!is_null($default)) {
$processService->setActualParameter($serviceCall, $param, $default, PROPERTY_CALLOFSERVICES_ACTUALPARAMETERIN, PROPERTY_ACTUALPARAMETER_CONSTANTVALUE);
}
}
$defaultVariableProp = new core_kernel_classes_Property(PROPERTY_FORMALPARAMETER_DEFAULTPROCESSVARIABLE);
$params = $serviceDefinition->getPropertyValues(new core_kernel_classes_Property(PROPERTY_SERVICESDEFINITION_FORMALPARAMIN));
foreach ($params as $paramUri) {
$param = new core_kernel_classes_Resource($paramUri);
$default = $param->getOnePropertyValue($defaultVariableProp);
if (!is_null($default)) {
$processService->setActualParameter($serviceCall, $param, $default, PROPERTY_CALLOFSERVICES_ACTUALPARAMETERIN, PROPERTY_ACTUALPARAMETER_PROCESSVARIABLE);
}
}
}
示例13: getItemModel
/**
* Short description of method getItemModel
*
* @access public
* @author Joel Bout, <joel@taotesting.com>
* @param Resource item
* @return core_kernel_classes_Resource
*/
public function getItemModel(core_kernel_classes_Resource $item)
{
$returnValue = null;
$itemModel = $item->getOnePropertyValue($this->itemModelProperty);
if ($itemModel instanceof core_kernel_classes_Resource) {
$returnValue = $itemModel;
}
return $returnValue;
}
示例14: createTransitionRule
/**
* Short description of method createTransitionRule
*
* @access private
* @author Joel Bout, <joel@taotesting.com>
* @param Resource connector
* @param Expression expression
* @return core_kernel_classes_Resource
*/
private function createTransitionRule(core_kernel_classes_Resource $connector, core_kernel_rules_Expression $expression)
{
$returnValue = null;
$transitionRule = $connector->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_CONNECTORS_TRANSITIONRULE));
if (empty($transitionRule) || $transitionRule == null) {
//create an instance of transition rule:
$transitionRuleClass = new core_kernel_classes_Class(CLASS_TRANSITIONRULES);
$transitionRule = $transitionRuleClass->createInstance();
//Associate the newly created transition rule to the connector:
$connector->editPropertyValues(new core_kernel_classes_Property(PROPERTY_CONNECTORS_TRANSITIONRULE), $transitionRule->getUri());
}
if (empty($expression)) {
common_Logger::e('condition is not an instance of ressource : ' . $expression);
} else {
//delete old condition:
$oldCondition = $transitionRule->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_RULE_IF));
if (!is_null($oldCondition)) {
$this->deleteCondition($oldCondition);
}
$transitionRule->editPropertyValues(new core_kernel_classes_Property(PROPERTY_RULE_IF), $expression);
}
$returnValue = $transitionRule;
return $returnValue;
}
示例15: getActivityExecutions
/**
* Returns the activityExecutions of a ProcessInstance
* in order of execution
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @param Resource process
* @return array
*/
public static function getActivityExecutions(core_kernel_classes_Resource $process)
{
$returnValue = array();
$prop = new core_kernel_classes_Property(PROPERTY_PROCESSINSTANCES_ACTIVITYEXECUTIONS);
$activities = $process->getPropertyValues($prop);
$nextmap = array();
$previous = new core_kernel_classes_Property(PROPERTY_ACTIVITY_EXECUTION_PREVIOUS);
$ordered = array();
foreach ($activities as $activity) {
$activityRessource = new core_kernel_classes_Resource($activity);
$predecessor = $activityRessource->getOnePropertyValue($previous);
if (is_null($predecessor)) {
$currenturi = $activity;
$returnValue[] = new core_kernel_classes_Resource($activity);
} else {
$nextmap[$predecessor->getUri()] = $activity;
}
}
while (!empty($nextmap)) {
$nexturi = $nextmap[$currenturi];
$returnValue[] = new core_kernel_classes_Resource($nexturi);
unset($nextmap[$currenturi]);
$currenturi = $nexturi;
}
return (array) $returnValue;
}