本文整理汇总了PHP中tao_helpers_Uri::decode方法的典型用法代码示例。如果您正苦于以下问题:PHP tao_helpers_Uri::decode方法的具体用法?PHP tao_helpers_Uri::decode怎么用?PHP tao_helpers_Uri::decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tao_helpers_Uri
的用法示例。
在下文中一共展示了tao_helpers_Uri::decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
public function getData()
{
if (!tao_helpers_Request::isAjax()) {
throw new common_exception_IsAjaxAction(__FUNCTION__);
}
if ($this->hasRequestParameter('classUri')) {
$classUri = tao_helpers_Uri::decode($this->getRequestParameter('classUri'));
$class = new core_kernel_classes_Class($classUri);
$hideNode = true;
} elseif ($this->hasRequestParameter('rootNode')) {
$class = new core_kernel_classes_Class($this->getRequestParameter('rootNode'));
$hideNode = false;
} else {
throw new common_Exception('Missing node information for ' . __FUNCTION__);
}
$openNodes = array($class->getUri());
if ($this->hasRequestParameter('openNodes') && is_array($this->getRequestParameter('openNodes'))) {
$openNodes = array_merge($openNodes, $this->getRequestParameter('openNodes'));
}
$limit = $this->hasRequestParameter('limit') ? $this->getRequestParameter('limit') : self::DEFAULT_LIMIT;
$offset = $this->hasRequestParameter('offset') ? $this->getRequestParameter('offset') : 0;
$showInst = $this->hasRequestParameter('hideInstances') ? !$this->getRequestParameter('hideInstances') : true;
$factory = new tao_models_classes_GenerisTreeFactory();
$array = $factory->buildTree($class, $showInst, $openNodes, $limit, $offset);
if ($hideNode) {
$array = isset($array['children']) ? $array['children'] : array();
}
echo json_encode($array);
}
示例2: __construct
/**
* Short description of method __construct
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @param Class clazz
* @param Resource user
* @param boolean forceAdd
* @return mixed
*/
public function __construct(core_kernel_classes_Class $clazz, core_kernel_classes_Resource $user = null, $forceAdd = false)
{
if (empty($clazz)) {
throw new Exception('Set the user class in the parameters');
}
$this->formName = 'user_form';
$options = array();
$service = tao_models_classes_UserService::singleton();
if (!empty($user)) {
$this->user = $user;
$options['mode'] = 'edit';
} else {
if (isset($_POST[$this->formName . '_sent']) && isset($_POST['uri'])) {
$this->user = new core_kernel_classes_Resource(tao_helpers_Uri::decode($_POST['uri']));
} else {
$this->user = $service->createInstance($clazz, $service->createUniqueLabel($clazz));
}
$options['mode'] = 'add';
}
if ($forceAdd) {
$options['mode'] = 'add';
}
$options['topClazz'] = CLASS_GENERIS_USER;
parent::__construct($clazz, $this->user, $options);
}
示例3: save
/**
*
* @author Lionel Lecaque, lionel@taotesting.com
*/
public function save()
{
$saved = false;
$instance = $this->getCurrentInstance();
$testUri = tao_helpers_Uri::decode($this->getRequestParameter(tao_helpers_Uri::encode(PROPERTY_DELIVERYCONTENT_TEST)));
$saved = $this->contentModel->addTest($instance, new core_kernel_classes_Resource($testUri));
//$saved = $instance->editPropertyValues(new core_kernel_classes_Property(PROPERTY_DELIVERYCONTENT_TEST ), $testUri);
echo json_encode(array('saved' => $saved));
}
示例4: feed
/**
* Short description of method feed
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @return mixed
*/
public function feed()
{
$expression = "/^" . preg_quote($this->name, "/") . "(.)*[0-9]+\$/";
$this->setValues(array());
foreach ($_POST as $key => $value) {
if (preg_match($expression, $key)) {
$this->addValue(tao_helpers_Uri::decode($value));
}
}
}
示例5: initDeliveryExecution
public function initDeliveryExecution()
{
$compiledDelivery = new core_kernel_classes_Resource(tao_helpers_Uri::decode($this->getRequestParameter('uri')));
$user = common_session_SessionManager::getSession()->getUser();
if ($this->service->isDeliveryExecutionAllowed($compiledDelivery, $user)) {
$deliveryExecution = $this->executionService->initDeliveryExecution($compiledDelivery, $user->getIdentifier());
} else {
common_Logger::i('Testtaker ' . $user->getIdentifier() . ' not authorised to initialise delivery ' . $compiledDelivery->getUri());
return $this->returnError(__('You are no longer allowed to take the test %s', $compiledDelivery->getLabel()), true);
}
$this->redirect(_url('runDeliveryExecution', null, null, array('deliveryExecution' => $deliveryExecution->getIdentifier())));
}
示例6: getValues
/**
* Short description of method getValues
*
* @access public
* @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
* @param string groupName
* @return array
*/
public function getValues($groupName = '')
{
$returnValue = array();
foreach ($this->elements as $element) {
if (empty($groupName) || !isset($this->groups[$groupName]) || in_array($element->getName(), $this->groups[$groupName]['elements'])) {
$returnValue[tao_helpers_Uri::decode($element->getName())] = $element->getEvaluatedValue();
}
}
unset($returnValue['uri']);
unset($returnValue['classUri']);
return (array) $returnValue;
}
示例7: getCurrentInstance
/**
* get the selected group from the current context (from the uri and classUri parameter in the request)
* @return core_kernel_classes_Resource $group
*/
protected function getCurrentInstance()
{
$uri = tao_helpers_Uri::decode($this->getRequestParameter('uri'));
if (is_null($uri) || empty($uri) || !common_Utils::isUri($uri)) {
throw new Exception("No valid uri found");
}
$clazz = $this->getCurrentClass();
$role = $this->service->getRole($uri);
if (is_null($role)) {
throw new Exception("No role found for the uri {$uri}");
}
return $role;
}
示例8: initElements
/**
* Initialize the form elements
*
* @access protected
* @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
* @return mixed
*/
protected function initElements()
{
parent::initElements();
$elements = $this->form->getElements();
$this->form->setElements(array());
$currentLangElt = tao_helpers_form_FormFactory::getElement('current_lang', 'Textbox');
$currentLangElt->setDescription(__('Current language'));
$currentLangElt->setAttributes(array('readonly' => 'true'));
$currentLangElt->setValue(\common_session_SessionManager::getSession()->getDataLanguage());
//API lang /data lang
$this->form->addElement($currentLangElt);
$dataLangElement = tao_helpers_form_FormFactory::getElement('translate_lang', 'Combobox');
$dataLangElement->setDescription(__('Translate to'));
$dataLangElement->setOptions(tao_helpers_I18n::getAvailableLangsByUsage(new core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_DATA)));
$dataLangElement->setEmptyOption(__('Select a language'));
$dataLangElement->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
$this->form->addElement($dataLangElement);
$this->form->createGroup('translation_info', __('Translation parameters'), array('current_lang', 'translate_lang'));
$dataGroup = array();
foreach ($elements as $element) {
if ($element instanceof tao_helpers_form_elements_Hidden || $element->getName() == 'uri' || $element->getName() == 'classUri') {
$this->form->addElement($element);
} else {
$propertyUri = tao_helpers_Uri::decode($element->getName());
$property = new core_kernel_classes_Property($propertyUri);
//translate only language dependent properties or Labels
//supported widget are: Textbox, TextArea, HtmlArea
//@todo support other widgets
if ($property->isLgDependent() && ($element instanceof tao_helpers_form_elements_Textbox || $element instanceof tao_helpers_form_elements_TextArea || $element instanceof tao_helpers_form_elements_HtmlArea) || $propertyUri == RDFS_LABEL) {
$translatedElt = clone $element;
$viewElt = tao_helpers_form_FormFactory::getElement('view_' . $element->getName(), 'Label');
$viewElt->setDescription($element->getDescription());
$viewElt->setValue($element->getValue());
$viewElt->setAttribute('no-format', true);
if ($element instanceof tao_helpers_form_elements_HtmlArea) {
$viewElt->setAttribute('htmlentities', false);
}
$this->form->addElement($viewElt);
$dataGroup[] = $viewElt->getName();
$translatedElt->setDescription(' ');
$translatedElt->setValue('');
if ($propertyUri == RDFS_LABEL) {
$translatedElt->setForcedValid();
}
$this->form->addElement($translatedElt);
$dataGroup[] = $translatedElt->getName();
}
}
}
$this->form->createGroup('translation_form', __('Translate'), $dataGroup);
}
示例9: getCurrentResource
/**
* Return the currently viewing resource
*
* @return \core_kernel_classes_Resource
*/
private function getCurrentResource()
{
if ($this->hasRequestParameter('uri')) {
$uri = $this->getRequestParameter('uri');
if (preg_match('/^i[0-9]+$/', $uri)) {
$uri = LOCAL_NAMESPACE . '#' . $uri;
} elseif (substr($uri, 0, 7) == 'http_2_') {
$uri = \tao_helpers_Uri::decode($uri);
}
} else {
$uri = TAO_OBJECT_CLASS;
}
return new \core_kernel_classes_Resource($uri);
}
示例10: index
/**
* render the main layout
*/
public function index()
{
$uri = tao_helpers_Uri::decode($this->getRequestParameter('uri'));
$links = array();
$class = new core_kernel_classes_Class(CLASS_LTI_CONSUMER);
foreach ($class->getInstances() as $consumer) {
$links[] = array('key' => $consumer->getUniquePropertyValue(new core_kernel_classes_Property(PROPERTY_OAUTH_KEY)), 'secret' => $consumer->getUniquePropertyValue(new core_kernel_classes_Property(PROPERTY_OAUTH_SECRET)), 'url' => $this->service->getLaunchUrl(array('delivery' => $uri)));
}
$this->setData('links', $links);
$this->setData('launchUrl', $this->service->getLaunchUrl(array('delivery' => $uri)));
$this->setData('consumers', $class->getInstances());
$this->setData('delivery', $uri);
$this->setView('linkManagement.tpl', 'taoLti');
}
示例11: index
/**
* @requiresRight uri READ
*/
public function index()
{
$item = new core_kernel_classes_Resource(tao_helpers_Uri::decode($this->getRequestParameter('uri')));
$itemService = taoItems_models_classes_ItemsService::singleton();
if ($itemService->hasItemContent($item) && $itemService->isItemModelDefined($item)) {
//this is this url that will contains the preview
//@see taoItems_actions_LegacyPreviewApi
$previewUrl = $this->getPreviewUrl($item);
$this->setData('previewUrl', $previewUrl);
$this->setData('client_config_url', $this->getClientConfigUrl());
$this->setData('resultServer', $this->getResultServer());
}
$this->setView('ItemPreview/index.tpl', 'taoItems');
}
示例12: save
/**
* save the related items from the checkbox tree or from the sequence box
* @return void
*/
public function save()
{
$saved = false;
$instance = $this->getCurrentInstance();
$launchUrl = $this->getRequestParameter(tao_helpers_Uri::encode(PROPERTY_LTI_LINK_LAUNCHURL));
$consumerUrl = $this->getRequestParameter(tao_helpers_Uri::encode(PROPERTY_LTI_LINK_CONSUMER));
if (empty($launchUrl)) {
return $this->returnError('Launch URL is required');
}
if (empty($consumerUrl)) {
return $this->returnError('Consumer is required');
}
$consumer = new core_kernel_classes_Resource(tao_helpers_Uri::decode($consumerUrl));
$saved = $instance->setPropertiesValues(array(PROPERTY_LTI_LINK_LAUNCHURL => $launchUrl, PROPERTY_LTI_LINK_CONSUMER => $consumer));
echo json_encode(array('saved' => $saved));
}
示例13: edit
/**
* @param \core_kernel_classes_Resource $instance
* @param \tao_helpers_form_Form $form
* @return \common_report_Report
*/
public function edit($instance, $form)
{
\helpers_TimeOutHelper::setTimeOutLimit(\helpers_TimeOutHelper::LONG);
try {
$fileInfo = $form->getValue('source');
$xmlFile = $this->getSharedStimulusFile($fileInfo['uploaded_file']);
// throws an exception of invalid
SharedStimulusImporter::isValidSharedStimulus($xmlFile);
$embeddedFile = $this->embedAssets($xmlFile);
$report = $this->replaceSharedStimulus($instance, \tao_helpers_Uri::decode($form->getValue('lang')), $embeddedFile);
} catch (\Exception $e) {
$report = \common_report_Report::createFailure($e->getMessage());
}
\helpers_TimeOutHelper::reset();
return $report;
}
示例14: setServiceDefinition
public function setServiceDefinition()
{
$serviceCallUri = tao_helpers_Uri::decode($this->getRequestParameter('callOfServiceUri'));
$serviceDefinitionUri = tao_helpers_Uri::decode($this->getRequestParameter(tao_helpers_Uri::encode(PROPERTY_CALLOFSERVICES_SERVICEDEFINITION)));
if (empty($serviceCallUri)) {
throw new tao_models_classes_MissingRequestParameterException('callOfServiceUri');
}
if (empty($serviceDefinitionUri)) {
throw new tao_models_classes_MissingRequestParameterException(tao_helpers_Uri::encode(PROPERTY_CALLOFSERVICES_SERVICEDEFINITION));
}
$serviceCall = new core_kernel_classes_Resource($serviceCallUri);
$serviceDefinition = new core_kernel_classes_Resource($serviceDefinitionUri);
$service = tao_models_classes_InteractiveServiceService::singleton();
$service->setCallOfServiceDefinition($serviceCall, $serviceDefinition);
$service->setDefaultParameters($serviceCall);
echo json_encode(array('saved' => 'true'));
}
示例15: feed
/**
* Short description of method feed
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @return mixed
*/
public function feed()
{
$expression = "/^" . preg_quote($this->name, "/") . "(.)*[0-9]+\$/";
$foundIndexes = array();
foreach ($_POST as $key => $value) {
if (preg_match($expression, $key)) {
$foundIndexes[] = $key;
}
}
if (count($foundIndexes) > 0 && $_POST[$foundIndexes[0]] !== self::NO_TREEVIEW_INTERACTION_IDENTIFIER || count($foundIndexes) === 0) {
$this->setValues(array());
} elseif (count($foundIndexes) > 0 && $_POST[$foundIndexes[0]] === self::NO_TREEVIEW_INTERACTION_IDENTIFIER) {
array_shift($foundIndexes);
}
foreach ($foundIndexes as $index) {
$this->addValue(tao_helpers_Uri::decode($_POST[$index]));
}
}