本文整理汇总了PHP中tao_helpers_Uri::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP tao_helpers_Uri::encode方法的具体用法?PHP tao_helpers_Uri::encode怎么用?PHP tao_helpers_Uri::encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tao_helpers_Uri
的用法示例。
在下文中一共展示了tao_helpers_Uri::encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initElements
/**
* Short description of method initElements
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @return mixed
*/
public function initElements()
{
parent::initElements();
$codeElt = $this->form->getElement(tao_helpers_Uri::encode(PROPERTY_PROCESSVARIABLES_CODE));
$codeElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty'));
$codeElt->addValidator(new wfAuthoring_actions_form_validators_VariableCode(array('uri' => $this->getInstance()->getUri())));
}
示例2: editCenter
/**
* Edit a Test Center instance
* @return void
*/
public function editCenter()
{
$clazz = $this->getCurrentClass();
$testcenter = $this->getCurrentInstance();
$formContainer = new \tao_actions_form_Instance($clazz, $testcenter);
$myForm = $formContainer->getForm();
if ($myForm->isSubmited()) {
if ($myForm->isValid()) {
$binder = new \tao_models_classes_dataBinding_GenerisFormDataBinder($testcenter);
$testcenter = $binder->bind($myForm->getValues());
$this->setData("selectNode", \tao_helpers_Uri::encode($testcenter->getUri()));
$this->setData('message', __('Test center saved'));
$this->setData('reload', true);
}
}
$memberProperty = new \core_kernel_classes_Property(TestCenterService::PROPERTY_MEMBERS_URI);
$memberForm = \tao_helpers_form_GenerisTreeForm::buildReverseTree($testcenter, $memberProperty);
$memberForm->setData('title', __('Select test takers for the test center'));
$this->setData('memberForm', $memberForm->render());
$groupProperty = new \core_kernel_classes_Property(TestCenterService::PROPERTY_DELIVERY_URI);
$groupForm = \tao_helpers_form_GenerisTreeForm::buildTree($testcenter, $groupProperty);
$groupForm->setData('title', __('Select deliveries available at the test center'));
$this->setData('groupForm', $groupForm->render());
$proctorProperty = new \core_kernel_classes_Property(TestCenterService::PROPERTY_PROCTORS_URI);
$proctorForm = \tao_helpers_form_GenerisTreeForm::buildReverseTree($testcenter, $proctorProperty);
$proctorForm->setData('title', __('Select proctors for the test center'));
$this->setData('proctorForm', $proctorForm->render());
$this->setData('formTitle', __('Edit test center'));
$this->setData('myForm', $myForm->render());
$this->setView('form_test_center.tpl');
}
示例3: index
/**
* Renders the auhtoring for simple tests
*/
public function index()
{
$test = $this->getCurrentInstance();
$itemSequence = array();
$itemUris = array();
$counter = 1;
foreach ($this->service->getTestItems($test) as $item) {
$itemUris[] = $item->getUri();
$itemSequence[$counter] = array('uri' => tao_helpers_Uri::encode($item->getUri()), 'label' => $item->getLabel());
$counter++;
}
// data for item sequence, terrible solution
// @todo implement an ajax request for labels or pass from tree to sequence
$allItems = array();
foreach ($this->service->getAllItems() as $itemUri => $itemLabel) {
$allItems['item_' . tao_helpers_Uri::encode($itemUri)] = $itemLabel;
}
$this->setData('uri', $test->getUri());
$this->setData('allItems', json_encode($allItems));
$this->setData('itemSequence', $itemSequence);
// data for generis tree form
$this->setData('relatedItems', json_encode(tao_helpers_Uri::encodeArray($itemUris)));
$openNodes = tao_models_classes_GenerisTreeFactory::getNodesToOpen($itemUris, new core_kernel_classes_Class(TAO_ITEM_CLASS));
$this->setData('itemRootNode', TAO_ITEM_CLASS);
$this->setData('itemOpenNodes', $openNodes);
$this->setData('saveUrl', _url('saveItems', 'Authoring', 'taoWfTest'));
$this->setView('authoring.tpl');
}
示例4: editInstance
public function editInstance()
{
$clazz = $this->getCurrentClass();
$instance = $this->getCurrentInstance();
$myFormContainer = new \tao_actions_form_Instance($clazz, $instance);
$myForm = $myFormContainer->getForm();
$nameElement = $myForm->getElement(\tao_helpers_Uri::encode(WebBrowserService::PROPERTY_NAME));
$versionElement = $myForm->getElement(\tao_helpers_Uri::encode(WebBrowserService::PROPERTY_VERSION));
$nameElement->addClass('select2');
$versionElement->setHelp("<span class=\"icon-help tooltipstered\" data-tooltip=\".web-browser-form .browser-version-tooltip-content\" data-tooltip-theme=\"info\"></span>");
if ($myForm->isSubmited()) {
if ($myForm->isValid()) {
$values = $myForm->getValues();
// save properties
$binder = new \tao_models_classes_dataBinding_GenerisFormDataBinder($instance);
$instance = $binder->bind($values);
$message = __('Instance saved');
$this->setData('message', $message);
$this->setData('reload', true);
}
}
$this->setData('formTitle', __('Edit Authorized Web Browser'));
$this->setData('myForm', $myForm->render());
$this->setView('WebBrowsers/form.tpl');
}
示例5: initElements
protected function initElements()
{
parent::initElements();
$labelElt = $this->form->getElement(\tao_helpers_Uri::encode(RDFS_LABEL));
if ($labelElt !== null) {
$labelElt->addAttribute('noLabel', true);
$labelElt->addAttribute('class', 'full-width js-label');
$labelElt->addAttribute('value', '{{label}}');
$labelElt->setName('label');
$labelElt->addValidators(array(\tao_helpers_form_FormFactory::getValidator('NotEmpty')));
$this->form->addElement($labelElt);
}
$maxExecElt = $this->form->getElement(\tao_helpers_Uri::encode(TAO_DELIVERY_MAXEXEC_PROP));
if ($maxExecElt !== null) {
$maxExecElt->addValidators(array(\tao_helpers_form_FormFactory::getValidator('Integer', array('min' => 1))));
$maxExecElt->addAttribute('value', '{{maxexec}}');
$maxExecElt->addAttribute('noLabel', true);
$maxExecElt->setName('maxexec');
$maxExecElt->addAttribute('class', 'full-width js-maxexec');
$this->form->addElement($maxExecElt);
}
$resultServerElt = $this->form->getElement(\tao_helpers_Uri::encode(TAO_DELIVERY_RESULTSERVER_PROP));
if ($resultServerElt !== null) {
$resultServerElt->addAttribute('noLabel', true);
$resultServerElt->addAttribute('class', 'full-width');
$resultServerElt->setName('resultserver');
$resultServerElt->addValidators(array(\tao_helpers_form_FormFactory::getValidator('NotEmpty')));
$this->form->addElement($resultServerElt);
}
$recurrenceRuleElt = $this->form->getElement(\tao_helpers_Uri::encode(DeliveryScheduleService::TAO_DELIVERY_RRULE_PROP));
if ($recurrenceRuleElt !== null) {
$recurrenceRuleElt->setName('rrule');
$this->form->addElement($recurrenceRuleElt);
}
}
示例6: initElements
/**
* Short description of method initElements
*
* @access protected
* @author Joel Bout, <joel.bout@tudor.lu>
* @return mixed
*/
protected function initElements()
{
$langService = tao_models_classes_LanguageService::singleton();
// Retrieve languages available for a GUI usage.
$guiUsage = new core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_GUI);
$guiOptions = array();
foreach ($langService->getAvailableLanguagesByUsage($guiUsage) as $lang) {
$guiOptions[tao_helpers_Uri::encode($lang->getUri())] = $lang->getLabel();
}
// Retrieve languages available for a Data usage.
$dataUsage = new core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_DATA);
$dataOptions = array();
foreach ($langService->getAvailableLanguagesByUsage($dataUsage) as $lang) {
$dataOptions[tao_helpers_Uri::encode($lang->getUri())] = $lang->getLabel();
}
$uiLangElement = tao_helpers_form_FormFactory::getElement('ui_lang', 'Combobox');
$uiLangElement->setDescription(__('Interface language'));
$uiLangElement->setOptions($guiOptions);
$this->form->addElement($uiLangElement);
$dataLangElement = tao_helpers_form_FormFactory::getElement('data_lang', 'Combobox');
$dataLangElement->setDescription(__('Data language'));
$dataLangElement->setOptions($dataOptions);
$this->form->addElement($dataLangElement);
$tzElement = tao_helpers_form_FormFactory::getElement('timezone', 'Combobox');
$tzElement->setDescription(__('Time zone'));
$options = array();
foreach (DateTimeZone::listIdentifiers() as $id) {
$options[$id] = $id;
}
$tzElement->setOptions($options);
$this->form->addElement($tzElement);
}
示例7: editCenter
/**
* Edit a Test Center instance
* @return void
*/
public function editCenter()
{
$clazz = $this->getCurrentClass();
$testCenter = $this->getCurrentInstance();
$formContainer = new \tao_actions_form_Instance($clazz, $testCenter);
$myForm = $formContainer->getForm();
if ($myForm->isSubmited()) {
if ($myForm->isValid()) {
$binder = new \tao_models_classes_dataBinding_GenerisFormDataBinder($testCenter);
$testCenter = $binder->bind($myForm->getValues());
$this->setData("selectNode", \tao_helpers_Uri::encode($testCenter->getUri()));
$this->setData('message', $this->convert('Test center saved'));
$this->setData('reload', true);
}
}
$childrenProperty = new \core_kernel_classes_Property(TestCenterService::PROPERTY_CHILDREN_URI);
$childrenForm = \tao_helpers_form_GenerisTreeForm::buildTree($testCenter, $childrenProperty);
$childrenForm->setHiddenNodes(array($testCenter->getUri()));
$childrenForm->setTitle($this->convert('Define sub-centers'));
$this->setData('childrenForm', $childrenForm->render());
$administratorProperty = new \core_kernel_classes_Property(TestCenterService::PROPERTY_ADMINISTRATOR_URI);
$administratorForm = \tao_helpers_form_GenerisTreeForm::buildReverseTree($testCenter, $administratorProperty);
$administratorForm->setData('title', $this->convert('Assign administrator'));
$this->setData('administratorForm', $administratorForm->render());
$proctorProperty = new \core_kernel_classes_Property(ProctorManagementService::PROPERTY_ASSIGNED_PROCTOR_URI);
$proctorForm = \tao_helpers_form_GenerisTreeForm::buildReverseTree($testCenter, $proctorProperty);
$proctorForm->setData('title', $this->convert('Assign proctors'));
$this->setData('proctorForm', $proctorForm->render());
$this->setData('formTitle', $this->convert('Edit test center'));
$this->setData('testCenter', $testCenter->getUri());
$this->setData('myForm', $myForm->render());
$this->setView('form_test_center.tpl');
}
示例8: getAuthoring
/**
* @deprecated
* @see taoTests_models_classes_TestModel::getAuthoring()
*/
public function getAuthoring(core_kernel_classes_Resource $test)
{
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById('taoWfTest');
$testService = taoTests_models_classes_TestsService::singleton();
$itemSequence = array();
$itemUris = array();
$i = 1;
foreach ($testService->getTestItems($test) as $item) {
$itemUris[] = $item->getUri();
$itemSequence[$i] = array('uri' => tao_helpers_Uri::encode($item->getUri()), 'label' => $item->getLabel());
$i++;
}
// data for item sequence, terrible solution
// @todo implement an ajax request for labels or pass from tree to sequence
$allItems = array();
foreach ($testService->getAllItems() as $itemUri => $itemLabel) {
$allItems['item_' . tao_helpers_Uri::encode($itemUri)] = $itemLabel;
}
$widget = new Renderer($ext->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'authoring.tpl');
$widget->setData('uri', $test->getUri());
$widget->setData('allItems', json_encode($allItems));
$widget->setData('itemSequence', $itemSequence);
// data for generis tree form
$widget->setData('relatedItems', json_encode(tao_helpers_Uri::encodeArray($itemUris)));
$openNodes = tao_models_classes_GenerisTreeFactory::getNodesToOpen($itemUris, new core_kernel_classes_Class(TAO_ITEM_CLASS));
$widget->setData('itemRootNode', TAO_ITEM_CLASS);
$widget->setData('itemOpenNodes', $openNodes);
$widget->setData('saveUrl', _url('saveItems', 'Authoring', 'taoWfTest'));
return $widget->render();
}
示例9: initElements
protected function initElements()
{
$title = tao_helpers_form_FormFactory::getElement('title', 'Free');
$title->setValue('<h2>' . $this->convert('Create and authorize a proctor to the selected test sites') . '</h2>');
$this->form->addElement($title);
parent::initElements();
$this->form->removeElement(\tao_helpers_Uri::encode(PROPERTY_USER_ROLES));
}
示例10: 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));
}
示例11: initElements
/**
* Initialize the form elements
*
* @access protected
* @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu>
* @return mixed
*/
protected function initElements()
{
$chainingElt = tao_helpers_form_FormFactory::getElement('chaining', 'Radiobox');
$chainingElt->setDescription(__('Filtering mode'));
$chainingElt->setOptions(array('or' => __('Exclusive (OR)'), 'and' => __('Inclusive (AND)')));
$chainingElt->setValue('or');
$this->form->addElement($chainingElt);
$recursiveElt = tao_helpers_form_FormFactory::getElement('recursive', 'Checkbox');
$recursiveElt->setDescription(__('Scope'));
$recursiveElt->setOptions(array('0' => __('Search sub-classes')));
$this->form->addElement($recursiveElt);
$searchClassUriElt = tao_helpers_form_FormFactory::getElement("clazzUri", "Hidden");
$searchClassUriElt->setValue(tao_helpers_Uri::encode($this->clazz->getUri()));
$this->form->addElement($searchClassUriElt);
$langElt = tao_helpers_form_FormFactory::getElement('lang', 'Combobox');
$langElt->setDescription(__('Language'));
$languages = array_merge(array('-- any --'), tao_helpers_I18n::getAvailableLangsByUsage(new core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_DATA)));
$langElt->setOptions($languages);
$langElt->setValue(0);
$this->form->addElement($langElt);
$this->form->createGroup('params', __('<del>Options</del>'), array('chaining', 'recursive', 'lang'));
$filters = array();
$defaultProperties = tao_helpers_form_GenerisFormFactory::getDefaultProperties();
$classProperties = $this->getClassProperties();
$properties = array_merge($defaultProperties, $classProperties);
isset($this->options['recursive']) ? $recursive = $this->options['recursive'] : ($recursive = false);
if ($recursive) {
foreach ($this->clazz->getSubClasses(true) as $subClass) {
$properties = array_merge($subClass->getProperties(false), $properties);
}
}
foreach ($properties as $property) {
$element = tao_helpers_form_GenerisFormFactory::elementMap($property);
if (!is_null($element) && !$element instanceof tao_helpers_form_elements_Authoring && !$element instanceof tao_helpers_form_elements_Hiddenbox && !$element instanceof tao_helpers_form_elements_Hidden) {
if ($element instanceof tao_helpers_form_elements_MultipleElement) {
$newElement = tao_helpers_form_FormFactory::getElement($element->getName(), 'Checkbox');
$newElement->setDescription($element->getDescription());
$newElement->setOptions($element->getOptions());
$element = $newElement;
}
if ($element instanceof tao_helpers_form_elements_Htmlarea) {
$newElement = tao_helpers_form_FormFactory::getElement($element->getName(), 'Textarea');
$newElement->setDescription($element->getDescription());
$element = $newElement;
}
$this->form->addElement($element);
$filters[] = $element->getName();
}
}
$this->form->createGroup('filters', __('<del>Filters</del>'), $filters);
}
示例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: initElements
/**
* Short description of method initElements
*
* @access public
* @author Joel Bout, <joel@taotesting.com>
* @return mixed
*/
public function initElements()
{
parent::initElements();
$encodedIncludesRolePropertyUri = tao_helpers_Uri::encode(PROPERTY_ROLE_INCLUDESROLE);
$encodedInstanceUri = tao_helpers_Uri::encode($this->getInstance()->getUri());
$rolesElement = $this->form->getElement($encodedIncludesRolePropertyUri);
if (!is_null($rolesElement)) {
$rolesOptions = $rolesElement->getOptions();
// remove the role itself in the list of includable roles
// to avoid cyclic inclusions (even if the system supports it).
if (array_key_exists($encodedInstanceUri, $rolesOptions)) {
unset($rolesOptions[$encodedInstanceUri]);
}
$rolesElement->setOptions($rolesOptions);
}
}
示例14: editDelivery
/**
* Edit a delivery instance
*
* @access public
* @author CRP Henri Tudor - TAO Team - {@link http://www.tao.lu}
* @return void
*/
public function editDelivery()
{
$clazz = $this->getCurrentClass();
$delivery = $this->getCurrentInstance();
$formContainer = new taoDelivery_actions_form_Delivery($clazz, $delivery);
$myForm = $formContainer->getForm();
$myForm->evaluate();
if ($myForm->isSubmited()) {
if ($myForm->isValid()) {
$propertyValues = $myForm->getValues();
// then save the property values as usual
$binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($delivery);
$delivery = $binder->bind($propertyValues);
$this->setData("selectNode", tao_helpers_Uri::encode($delivery->getUri()));
$this->setData('message', __('Delivery saved'));
$this->setData('reload', true);
}
}
$this->setData('label', $delivery->getLabel());
// history
$this->setData('date', taoDelivery_models_classes_DeliveryAssemblyService::singleton()->getCompilationDate($delivery));
if (taoDelivery_models_classes_execution_ServiceProxy::singleton()->implementsMonitoring()) {
$execs = taoDelivery_models_classes_execution_ServiceProxy::singleton()->getExecutionsByDelivery($delivery);
$this->setData('exec', count($execs));
}
// define the groups related to the current delivery
$property = new core_kernel_classes_Property(PROPERTY_GROUP_DELVIERY);
$tree = tao_helpers_form_GenerisTreeForm::buildReverseTree($delivery, $property);
$tree->setTitle(__('Assigned to'));
$tree->setTemplate(Template::getTemplate('widgets/assignGroup.tpl'));
$this->setData('groupTree', $tree->render());
// testtaker brick
$this->setData('assemblyUri', $delivery->getUri());
// define the subjects excluded from the current delivery
$property = new core_kernel_classes_Property(TAO_DELIVERY_EXCLUDEDSUBJECTS_PROP);
$excluded = $delivery->getPropertyValues($property);
$this->setData('ttexcluded', count($excluded));
$users = taoDelivery_models_classes_AssignmentService::singleton()->getAssignedUsers($delivery);
$assigned = array_diff(array_unique($users), $excluded);
$this->setData('ttassigned', count($assigned));
$this->setData('formTitle', __('Properties'));
$this->setData('myForm', $myForm->render());
if (common_ext_ExtensionsManager::singleton()->isEnabled('taoCampaign')) {
$this->setData('campaign', taoCampaign_helpers_Campaign::renderCampaignTree($delivery));
}
$this->setView('Delivery/editDelivery.tpl');
}
示例15: 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'));
}