コード例 #1
0
 /**
  * render the main layout
  *
  * @author CRP Henri Tudor - TAO Team - {@link http://www.tao.lu}
  */
 public function index()
 {
     if ($this->hasRequestParameter('openFolder')) {
         $folder = $this->getRequestParameter('openFolder');
         if (tao_helpers_File::securityCheck($folder, true)) {
             $folder = preg_replace('/^\\//', '', $folder);
             $folder = preg_replace('/\\/$/', '', $folder);
             $this->setData('openFolder', $folder);
         }
     }
     if ($this->hasRequestParameter('urlData')) {
         $this->setData('urlData', $this->getRequestParameter('urlData'));
     }
     if ($this->hasRequestParameter('error')) {
         $this->setData('error', $this->getRequestParameter('error'));
     }
     // Show select action?
     $this->setData('showSelect', false);
     if ($this->hasRequestParameter('showselect') && $this->getRequestParameter('showselect') == '1') {
         $this->setData('showSelect', true);
     }
     //creates the URL of the action used to configure the client side
     $context = Context::getInstance();
     $clientConfigParameters = array('extension' => $context->getExtensionName(), 'module' => $context->getModuleName(), 'action' => $context->getActionName());
     $this->setData('client_config_url', _url('config', 'ClientConfig', 'tao', $clientConfigParameters));
     $this->setData('upload_limit', $this->getFileUploadLimit());
     $this->setView('index.tpl');
 }
コード例 #2
0
 /**
  * Entrypoint of every tool
  */
 public function launch()
 {
     try {
         taoLti_models_classes_LtiService::singleton()->startLtiSession(common_http_Request::currentRequest());
         // check if cookie has been set
         if (tao_models_classes_accessControl_AclProxy::hasAccess('verifyCookie', 'CookieUtils', 'taoLti')) {
             $this->redirect(_url('verifyCookie', 'CookieUtils', 'taoLti', array('session' => session_id(), 'redirect' => _url('run', null, null, $_GET))));
         } else {
             $this->returnError(__('You are not authorized to use this system'));
         }
     } catch (common_user_auth_AuthFailedException $e) {
         common_Logger::i($e->getMessage());
         $this->returnError(__('The LTI connection could not be established'), false);
     } catch (taoLti_models_classes_LtiException $e) {
         // In regard of the IMS LTI standard, we have to show a back button that refer to the
         // launch_presentation_return_url url param. So we have to retrieve this parameter before trying to start
         // the session
         $params = common_http_Request::currentRequest()->getParams();
         if (isset($params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_NAME])) {
             $this->setData('consumerLabel', $params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_NAME]);
         } elseif (isset($params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_DESCRIPTION])) {
             $this->setData('consumerLabel', $params[taoLti_models_classes_LtiLaunchData::TOOL_CONSUMER_INSTANCE_DESCRIPTION]);
         }
         if (isset($params[taoLti_models_classes_LtiLaunchData::LAUNCH_PRESENTATION_RETURN_URL])) {
             $this->setData('returnUrl', $params[taoLti_models_classes_LtiLaunchData::LAUNCH_PRESENTATION_RETURN_URL]);
         }
         common_Logger::i($e->getMessage());
         $this->returnError(__('The LTI connection could not be established'), false);
     } catch (tao_models_classes_oauth_Exception $e) {
         common_Logger::i($e->getMessage());
         $this->returnError(__('The LTI connection could not be established'), false);
     }
 }
コード例 #3
0
 /**
  * Renders the auhtoring for simple tests
  */
 public function index()
 {
     $test = new \core_kernel_classes_Resource($this->getRequestParameter('uri'));
     $model = $this->getServiceManager()->get(TestModel::SERVICE_ID);
     $itemSequence = array();
     $itemUris = array();
     $counter = 1;
     foreach ($model->getItems($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 (\taoTests_models_classes_TestsService::singleton()->getAllItems() as $itemUri => $itemLabel) {
         $allItems['item_' . tao_helpers_Uri::encode($itemUri)] = $itemLabel;
     }
     $config = $model->getConfig($test);
     $checked = isset($config['previous']) ? $config['previous'] : false;
     $testConfig['previous'] = array('label' => __('Allow test-taker to go back in test'), 'checked' => $checked);
     $this->setData('uri', $test->getUri());
     $this->setData('allItems', json_encode($allItems));
     $this->setData('itemSequence', $itemSequence);
     $this->setData('testConfig', $testConfig);
     // data for generis tree form
     $this->setData('relatedItems', json_encode(tao_helpers_Uri::encodeArray($itemUris)));
     $openNodes = TreeHelper::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', 'taoTestLinear'));
     $this->setView('Authoring/index.tpl');
 }
コード例 #4
0
 public function processGetTable()
 {
     $ppo = new CopixPPO();
     // Si c'est pour de l'ajax
     if (CopixRequest::get('url') == null) {
         try {
             //Recup les données
             $id = CopixRequest::get('table_id');
             $table = CopixListFactory::get($id);
             if (CopixRequest::get('submit') !== 'false') {
                 $table->getFromRequest();
             }
             //On génère le HTML
             $ppo->MAIN = $table->generateTable();
         } catch (Exception $e) {
             //En cas d'erreur en etant en ajax, on renvoi l'erreur
             $ppo->MAIN = $e->getMessage();
             return _arDirectPPO($ppo, 'blank.tpl');
         }
         return _arDirectPPO($ppo, 'blank.tpl');
         //Si c'est pas en ajax
     } else {
         //On récup les données
         $id = CopixRequest::get('table_id');
         $table = CopixListFactory::get($id);
         if (CopixRequest::get('submit') !== 'false') {
             $table->getFromRequest();
         }
         //Et on redirige
         return _arRedirect(_url(CopixRequest::get('url')));
     }
 }
コード例 #5
0
 /**
  * Tests that a form's action is retained after an Ajax submission.
  *
  * The 'action' attribute of a form should not change after an Ajax submission
  * followed by a non-Ajax submission, which triggers a validation error.
  */
 function testPreserveFormActionAfterAJAX()
 {
     // Create a multi-valued field for 'page' nodes to use for Ajax testing.
     $field_name = 'field_ajax_test';
     entity_create('field_storage_config', array('field_name' => $field_name, 'entity_type' => 'node', 'type' => 'text', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     entity_create('field_config', array('field_name' => $field_name, 'entity_type' => 'node', 'bundle' => 'page'))->save();
     entity_get_form_display('node', 'page', 'default')->setComponent($field_name, array('type' => 'text_textfield'))->save();
     // Log in a user who can create 'page' nodes.
     $this->web_user = $this->drupalCreateUser(array('create page content'));
     $this->drupalLogin($this->web_user);
     // Get the form for adding a 'page' node. Submit an "add another item" Ajax
     // submission and verify it worked by ensuring the updated page has two text
     // field items in the field for which we just added an item.
     $this->drupalGet('node/add/page');
     $this->drupalPostAjaxForm(NULL, array(), array('field_ajax_test_add_more' => t('Add another item')), 'system/ajax', array(), array(), 'page-node-form');
     $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, 'AJAX submission succeeded.');
     // Submit the form with the non-Ajax "Save" button, leaving the title field
     // blank to trigger a validation error, and ensure that a validation error
     // occurred, because this test is for testing what happens when a form is
     // re-rendered without being re-built, which is what happens when there's
     // a validation error.
     $this->drupalPostForm(NULL, array(), t('Save'));
     $this->assertText('Title field is required.', 'Non-AJAX submission correctly triggered a validation error.');
     // Ensure that the form contains two items in the multi-valued field, so we
     // know we're testing a form that was correctly retrieved from cache.
     $this->assert(count($this->xpath('//form[contains(@id, "page-node-form")]//div[contains(@class, "form-item-field-ajax-test")]//input[@type="text"]')) == 2, 'Form retained its state from cache.');
     // Ensure that the form's action is correct.
     $forms = $this->xpath('//form[contains(@class, "node-page-form")]');
     $this->assert(count($forms) == 1 && $forms[0]['action'] == _url('node/add/page'), 'Re-rendered form contains the correct action value.');
 }
コード例 #6
0
 /**
  * Tests the normalize function.
  */
 public function testNormalize()
 {
     $target_entity_de = entity_create('entity_test', array('langcode' => 'de', 'field_test_entity_reference' => NULL));
     $target_entity_de->save();
     $target_entity_en = entity_create('entity_test', array('langcode' => 'en', 'field_test_entity_reference' => NULL));
     $target_entity_en->save();
     // Create a German entity.
     $values = array('langcode' => 'de', 'name' => $this->randomMachineName(), 'field_test_text' => array('value' => $this->randomMachineName(), 'format' => 'full_html'), 'field_test_entity_reference' => array('target_id' => $target_entity_de->id()));
     // Array of translated values.
     $translation_values = array('name' => $this->randomMachineName(), 'field_test_entity_reference' => array('target_id' => $target_entity_en->id()));
     $entity = entity_create('entity_test', $values);
     $entity->save();
     // Add an English value for name and entity reference properties.
     $entity->getTranslation('en')->set('name', array(0 => array('value' => $translation_values['name'])));
     $entity->getTranslation('en')->set('field_test_entity_reference', array(0 => $translation_values['field_test_entity_reference']));
     $entity->save();
     $type_uri = _url('rest/type/entity_test/entity_test', array('absolute' => TRUE));
     $relation_uri = _url('rest/relation/entity_test/entity_test/field_test_entity_reference', array('absolute' => TRUE));
     $expected_array = array('_links' => array('curies' => array(array('href' => '/relations', 'name' => 'site', 'templated' => true)), 'self' => array('href' => $this->getEntityUri($entity)), 'type' => array('href' => $type_uri), $relation_uri => array(array('href' => $this->getEntityUri($target_entity_de), 'lang' => 'de'), array('href' => $this->getEntityUri($target_entity_en), 'lang' => 'en'))), '_embedded' => array($relation_uri => array(array('_links' => array('self' => array('href' => $this->getEntityUri($target_entity_de)), 'type' => array('href' => $type_uri)), 'uuid' => array(array('value' => $target_entity_de->uuid())), 'lang' => 'de'), array('_links' => array('self' => array('href' => $this->getEntityUri($target_entity_en)), 'type' => array('href' => $type_uri)), 'uuid' => array(array('value' => $target_entity_en->uuid())), 'lang' => 'en'))), 'uuid' => array(array('value' => $entity->uuid())), 'langcode' => array(array('value' => 'de')), 'name' => array(array('value' => $values['name'], 'lang' => 'de'), array('value' => $translation_values['name'], 'lang' => 'en')), 'field_test_text' => array(array('value' => $values['field_test_text']['value'], 'format' => $values['field_test_text']['format'])));
     $normalized = $this->serializer->normalize($entity, $this->format);
     $this->assertEqual($normalized['_links']['self'], $expected_array['_links']['self'], 'self link placed correctly.');
     // @todo Test curies.
     // @todo Test type.
     $this->assertFalse(isset($normalized['id']), 'Internal id is not exposed.');
     $this->assertEqual($normalized['uuid'], $expected_array['uuid'], 'Non-translatable fields is normalized.');
     $this->assertEqual($normalized['name'], $expected_array['name'], 'Translatable field with multiple language values is normalized.');
     $this->assertEqual($normalized['field_test_text'], $expected_array['field_test_text'], 'Field with properties is normalized.');
     $this->assertEqual($normalized['_embedded'][$relation_uri], $expected_array['_embedded'][$relation_uri], 'Entity reference field is normalized.');
     $this->assertEqual($normalized['_links'][$relation_uri], $expected_array['_links'][$relation_uri], 'Links are added for entity reference field.');
 }
コード例 #7
0
 /**
  * (non-PHPdoc)
  * @see \oat\tao\model\media\MediaBrowser::getDirectory
  */
 public function getDirectory($parentLink = '/', $acceptableMime = array(), $depth = 1)
 {
     $sysPath = $this->getSysPath($parentLink);
     $label = substr($parentLink, strrpos($parentLink, '/') + 1);
     if (!$label) {
         $label = 'local';
     }
     $data = array('path' => $parentLink, 'label' => $label);
     if ($depth > 0) {
         $children = array();
         if (is_dir($sysPath)) {
             foreach (new DirectoryIterator($sysPath) as $fileinfo) {
                 if (!$fileinfo->isDot()) {
                     $subPath = rtrim($parentLink, '/') . '/' . $fileinfo->getFilename();
                     if ($fileinfo->isDir()) {
                         $children[] = $this->getDirectory($subPath, $acceptableMime, $depth - 1);
                     } else {
                         $file = $this->getFileInfo($subPath, $acceptableMime);
                         if (!is_null($file) && (count($acceptableMime) == 0 || in_array($file['mime'], $acceptableMime))) {
                             $children[] = $file;
                         }
                     }
                 }
             }
         } else {
             common_Logger::w('"' . $sysPath . '" is not a directory');
         }
         $data['children'] = $children;
     } else {
         $data['url'] = _url('files', 'ItemContent', 'taoItems', array('uri' => $this->item->getUri(), 'lang' => $this->lang, 'path' => $parentLink));
     }
     return $data;
 }
コード例 #8
0
 public function process($pParams)
 {
     // paramètres requis
     $requestedParameters = array('form', 'submit', 'divErrors', 'urlVerif', 'urlSubmit');
     foreach ($requestedParameters as $param) {
         if (!isset($pParams[$param])) {
             throw new CopixTemplateTagException(_i18n('copix:copix.smarty.badTagParamValue', array('null', $param, 'ajax_submitform')));
         }
     }
     // on a besoin de mootools
     _tag('mootools');
     // code javascript
     $jsCode = '
         window.addEvent(\'domready\', function(){
             $(\'' . $pParams['submit'] . '\').addEvent(\'click\', function(e) {
                 $(\'' . $pParams['submit'] . '\').disabled = true;
                 $(\'' . $pParams['form'] . '\').action = \'' . _url($pParams['urlVerif']) . '\';
                 new Event (e).stop ();
                 $(\'' . $pParams['form'] . '\').send ({
                     update: $(\'formErrors\'),
                     onComplete: function (response) {
                         if (response == \'true\') {
                             $(\'' . $pParams['form'] . '\').action = \'' . _url($pParams['urlSubmit']) . '\';
                             $(\'' . $pParams['form'] . '\').submit ();
                         } else {
                             $(\'' . $pParams['submit'] . '\').disabled = false;
                         }
                     },
                 });
             });
         });';
     CopixHTMLHeader::addJSCode($jsCode, 'ajax_submitform_' . $pParams['form']);
 }
コード例 #9
0
ファイル: Paginator.php プロジェクト: wamania/mynd-framework
 public static function paginate($paginator, $params, $options = array())
 {
     $length = 11;
     $pager = '<ul>';
     if ($paginator->page() == 1) {
         $before = 1;
     } else {
         $before = $paginator->page() - 1;
     }
     $pager .= '<li><a href="' . _url(array_merge($params, array('page' => $before))) . '">&#9664;</a></li>';
     // pages d'avant
     $first = max(1, $paginator->page() - floor($length / 2));
     $last = min($paginator->pageCount(), $paginator->page() + floor($length / 2));
     for ($i = $first; $i < $paginator->page(); $i++) {
         $pager .= '<li><a href="' . _url(array_merge($params, array('page' => $i))) . '">' . $i . '</a></li>';
     }
     $pager .= '<li class="active"><a href="#">' . $paginator->page() . '</a></li>';
     for ($i = $paginator->page() + 1; $i <= $last; $i++) {
         $pager .= '<li><a href="' . _url(array_merge($params, array('page' => $i))) . '">' . $i . '</a></li>';
     }
     // after
     if ($paginator->page() == $paginator->pageCount()) {
         $after = $paginator->page();
     } else {
         $after = $paginator->page() + 1;
     }
     $pager .= '<li><a href="' . _url(array_merge($params, array('page' => $after))) . '">&#9654;</a></li>';
     $pager .= '</ul>';
     return $pager;
 }
コード例 #10
0
 /**
  * Tests the menu functionality.
  */
 function testMenus()
 {
     $this->drupalPlaceBlock('system_menu_block:main');
     // Create a view with a page display and a menu link in the Main Menu.
     $view = array();
     $view['label'] = $this->randomMachineName(16);
     $view['id'] = strtolower($this->randomMachineName(16));
     $view['description'] = $this->randomMachineName(16);
     $view['page[create]'] = 1;
     $view['page[title]'] = $this->randomMachineName(16);
     $view['page[path]'] = $this->randomMachineName(16);
     $view['page[link]'] = 1;
     $view['page[link_properties][menu_name]'] = 'main';
     $view['page[link_properties][title]'] = $this->randomMachineName(16);
     $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
     // Make sure there is a link to the view from the front page (where we
     // expect the main menu to display).
     $this->drupalGet('');
     $this->assertResponse(200);
     $this->assertLink($view['page[link_properties][title]']);
     $this->assertLinkByHref(_url($view['page[path]']));
     // Make sure the link is associated with the main menu.
     /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
     $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
     /** @var \Drupal\Core\Menu\MenuLinkInterface $link */
     $link = $menu_link_manager->createInstance('views_view:views.' . $view['id'] . '.page_1');
     $url = $link->getUrlObject();
     $this->assertEqual($url->getRouteName(), 'view.' . $view['id'] . '.page_1', String::format('Found a link to %path in the main menu', array('%path' => $view['page[path]'])));
     $metadata = $link->getMetaData();
     $this->assertEqual(array('view_id' => $view['id'], 'display_id' => 'page_1'), $metadata);
 }
コード例 #11
0
 public function testGet()
 {
     // Test si on récupère une adresse par défault
     $this->assertRegexp('/^http:\\/\\/.*www\\/$/', CopixUrl::get());
     $this->assertRegexp('/^http:\\/\\/.*www/', CopixUrl::get("#"));
     // Test des URL récupérées en mode prepend
     CopixConfig::instance()->significant_url_mode = 'prepend';
     // On attend ici une URL en utilisant tous les cas du paramètre $pDest
     // @todo : Changer le test quand on voudra enlever le deuxième default
     $this->assertRegexp('/^http:\\/\\/.*\\/default\\/default\\/copixtest/', _url('copixtest'));
     $params = new StdClass();
     $this->assertRegexp('/^http:\\/\\/.*\\/default\\/default\\/copixtest/', _url('copixtest', $params));
     $this->assertRegexp('/^http:\\/\\/.*\\/default\\/copixtest/', _url('copixtest|'));
     $this->assertRegexp('/^http:\\/\\/.*\\/copixtest/', _url('copixtest||'));
     // On cherche l'URL d'un module avec une variable définie dans une fichier significanturl
     $this->assertRegexp('/^http:\\/\\/.*?test=value$/', _url('copixtest||', array('test' => 'value')));
     $params = new StdClass();
     $params->test = 'value';
     $this->assertRegexp('/^http:\\/\\/.*?test=value$/', _url('copixtest||', $params));
     // On cherche l'URL d'un module avec une variable non définie dans une fichier significanturl
     $this->assertRegexp('/^http:\\/\\/.*\\/value$/', _url('copixtest||', array('var' => 'value')));
     // On cherche l'URL d'un module inexistant dans le site
     // @todo : Changer le test quand on voudra enlever le deuxième default
     $this->assertRegexp('/^http:\\/\\/.*\\/test$/', _url('test||'));
     // Test des URL récupérées en mode default
     CopixConfig::instance()->significant_url_mode = 'default';
     // On cherche l'URL d'un module avec une variable définie dans une fichier significanturl
     $this->assertRegexp('/^http:\\/\\/.*\\?module=copixtest.*&test=value$/', _url('copixtest||', array('test' => 'value')));
     // On cherche l'URL d'un module avec une variable non définie dans une fichier significanturl
     $this->assertRegexp('/^http:\\/\\/.*\\?module=copixtest.*&var=value$/', _url('copixtest||', array('var' => 'value')));
     // On cherche l'URL d'un module inexistant dans le site
     $this->assertRegexp('/^http:\\/\\/.*\\?module=test/', _url('test||'));
     $this->assertEquals('http://www.google.fr', _url('copixtest|google|'));
 }
 protected function validateClient($deliveryId)
 {
     $service = $this->getServiceLocator()->get(RequirementsServiceInterface::CONFIG_ID);
     if (!$service->compliesToDelivery($deliveryId)) {
         throw new UnAuthorizedException(_url('notCompatibleEnvironment', 'Error', 'taoClientRestrict'));
     }
 }
コード例 #13
0
ファイル: bind.php プロジェクト: zxw5775/yuhunclub
 function index($ctx)
 {
     $ctx->title = '绑定微信账号';
     setcookie('no_subscribe_prj', '', time() + 3600);
     $user = UC::auth();
     if ($user) {
         $connect = WxConnect::get_by('user_id', $user['id']);
         if ($connect) {
             _redirect('/');
         }
     }
     if (!$this->openid) {
         if (!$_GET['redirect']) {
             // 避免循环跳转
             UC::logout();
             // 使用域名 axelahome.com, 避免因为跨域导致 session 获取不到问题
             $jump = _url('https://axelahome.com/weixin/bind', array('redirect' => 1));
             $url = _url('https://axelahome.com/weixin/oauth', array('jump' => $jump));
             _redirect($url);
         }
         _throw("链接已经过期, 请重新获取微信消息!", 200);
     } else {
         $connect = WxConnect::get_by('wx_openid', $this->openid);
         if ($connect) {
             _throw('此微信号已经绑定过懒投资账号, 请先解绑!');
         }
     }
 }
コード例 #14
0
 /**
  * Construction du message
  * @param    mixed   $pParams    tableau de paramètre ou clef
  * @param    mixed   $pContent   null (ImageProtect n'est pas censé recevoir de contenu)
  * @return   string  balise html contenant l'image
  */
 public function process($pParams, $pContent = null)
 {
     if (!isset($pParams['id'])) {
         throw new CopixTagException("[ImageProtect] Missing id parameter");
     }
     return '<img src="' . _url('antispam|default|getimage') . '?id=' . $pParams['id'] . '" />';
 }
コード例 #15
0
 /**
  * Actiongroup qui permet de gérer la suppression
  *
  */
 public function processDelete()
 {
     $form = CopixFormFactory::get(_request('form_id'));
     $form->delete(CopixRequest::asArray());
     $url = _request('url');
     return _arRedirect(_url($url));
 }
コード例 #16
0
 /**
  *
  */
 public function processLaunch()
 {
     //Si aucun test n'est donné, on redirige vers la page de choix
     if (($test = _request('tests')) === null) {
         return _arRedirect(_url('unittest|'));
     }
     //Si on a demandé à lancer les tests avec Ajax, on génère le template d'appel pour chaque élément
     if (_request('ajax')) {
         $ppo = new CopixPpo();
         $ppo->TITLE_PAGE = 'Lancements des tests unitaires';
         $ppo->arTests = $this->_getTest();
         return _arPpo($ppo, 'tests.launch.php');
     } else {
         //on a pas demandé d'appel type ajax, donc on lance directement les tests demandés.
         if (CopixAjax::isAJAXRequest()) {
         } else {
             //C'est une demande normale, la réponse sera de type HTML
             $more = '';
         }
     }
     //On lance enfin la demande de test
     $httpClientRequest = new CopixHTTPClientRequest(CopixUrl::appendToUrl(_url() . 'test.php', array('tests' => $test, 'xml' => CopixAjax::isAJAXRequest())));
     $httpClient = new CopixHttpClient();
     $response = $httpClient->launch($httpClientRequest);
     return _arContent($response[0]->getBody(), array('content-type' => 'text/html'));
 }
コード例 #17
0
 public function process($pParams, $content)
 {
     extract($pParams);
     if (!isset($name)) {
         throw new CopixTemplateTagException("Manque nom");
     }
     $toReturn = "<div id=\"wiki_toolbar\" style=\"clear:both\">\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('**','**','" . _i18n("wiki|wiki.bold") . "');\" title=\"" . _i18n("wiki|wiki.bold") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/bold.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('//','//','" . _i18n("wiki|wiki.italic") . "');\" title=\"" . _i18n("wiki|wiki.italic") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/italic.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('__','__','" . _i18n("wiki|wiki.underline") . "');\" title=\"" . _i18n("wiki|wiki.underline") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/underline.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('   *','','" . _i18n("wiki|wiki.listitem") . "');\" title=\"" . _i18n("wiki|wiki.listitem") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/list.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('<del>','</del>','" . _i18n("wiki|wiki.strike") . "');\" title=\"" . _i18n("wiki|wiki.strike") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/strike.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('\n----\n','','');\" title=\"" . _i18n("wiki|wiki.hr") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/hr.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:fontStyle('\\'\\'','\\'\\'','" . _i18n("wiki|wiki.code") . "');\" title=\"" . _i18n("wiki|wiki.code") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/code.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(1);\" title=\"" . _i18n("wiki|wiki.header", 1) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h1.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(2);\" title=\"" . _i18n("wiki|wiki.header", 2) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h2.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(3);\" title=\"" . _i18n("wiki|wiki.header", 3) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h3.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(4);\" title=\"" . _i18n("wiki|wiki.header", 4) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h4.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:addHeader(5);\" title=\"" . _i18n("wiki|wiki.header", 5) . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/h5.png') . "\" /></a>\n";
     $toReturn .= "<a class=\"wiki_toolbar\" onclick=\"javascript:sendForPreview();\" title=\"" . _i18n("wiki|wiki.show.preview") . "\"><img src=\"" . CopixUrl::getResource('/img/modules/wiki/preview.png') . "\" /></a>\n";
     $toReturn .= "</div>";
     $toReturn .= "\n<textarea class=\"noresizable\" id=\"wiki_area_content\" name=\"{$name}\"\n    cols=\"100\" rows=\"30\">{$content}\n</textarea>\n<div id=\"aj_wiki_prev\" style=\"display: none\">\n</div>\n\n        ";
     $urlofrenderer = _url('generictools|ajax|getwikipreview');
     CopixHTMLHeader::addJsCode("\nvar onPreviewMode = false;\nfunction sendForPreview()\n{\n    if(!onPreviewMode){\n        var borders=\$('wiki_area_content').getStyle('border');\n        var width=\$('wiki_area_content').getStyle('width');\n        \$('aj_wiki_prev').setStyles({\n            'border': borders,\n            'width' : width\n        });\n        var aj = new Ajax('" . $urlofrenderer . "',{\n            method : 'post',\n            update :'aj_wiki_prev',\n            data : 'torender='+\$('wiki_area_content').value\n        }).request();\n        onPreviewMode = true;\n        \$('wiki_area_content').setStyle('display','none')\n        \$('aj_wiki_prev').setStyle('display','block')\n    }else{\n        \$('wiki_area_content').setStyle('display','block');\n        \$('aj_wiki_prev').setStyle('display','none');\n        onPreviewMode = false;\n    }\n}\n\nfunction addHeader(n)\n{\n    var h=\"\";\n    if(n==1) h=\"======\";\n    if(n==2) h=\"=====\";\n    if(n==3) h=\"====\";\n    if(n==4) h=\"===\";\n    if(n==5) h=\"==\";\n\n    var editor = document.getElementById('wiki_area_content');\n    fontStyle(h+\" \",\" \"+h,\"Header\"+n);\n}\n\n/**\n * apply tagOpen/tagClose to selection in textarea, use sampleText instead\n * of selection if there is none copied and adapted from phpBB\n *\n * @author phpBB development team\n * @author MediaWiki development team\n * @author Andreas Gohr <*****@*****.**>\n * @author Jim Raynor <*****@*****.**>\n */\nfunction fontStyle(tagOpen, tagClose, sampleText)\n{\n  var txtarea = document.getElementById('wiki_area_content');\n  // IE\n  if(document.selection  && !is_gecko) {\n    var theSelection = document.selection.createRange().text;\n    var replaced = true;\n    if(!theSelection){\n      replaced = false;\n      theSelection=sampleText;\n    }\n    txtarea.focus();\n\n    // This has change\n    text = theSelection;\n    if(theSelection.charAt(theSelection.length - 1) == \" \"){// exclude ending space char, if any\n      theSelection = theSelection.substring(0, theSelection.length - 1);\n      r = document.selection.createRange();\n      r.text = tagOpen + theSelection + tagClose + \" \";\n    } else {\n      r = document.selection.createRange();\n      r.text = tagOpen + theSelection + tagClose;\n    }\n    if(!replaced){\n      r.moveStart('character',-text.length-tagClose.length);\n      r.moveEnd('character',-tagClose.length);\n    }\n    r.select();\n  // Mozilla\n  } else if(txtarea.selectionStart || txtarea.selectionStart == '0') {\n    var replaced = false;\n    var startPos = txtarea.selectionStart;\n    var endPos   = txtarea.selectionEnd;\n    if(endPos - startPos) replaced = true;\n    var scrollTop=txtarea.scrollTop;\n    var myText = (txtarea.value).substring(startPos, endPos);\n    if(!myText) { myText=sampleText;}\n    if(myText.charAt(myText.length - 1) == \" \"){ // exclude ending space char, if any\n      subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + \" \";\n    } else {\n      subst = tagOpen + myText + tagClose;\n    }\n    txtarea.value = txtarea.value.substring(0, startPos) + subst +\n                    txtarea.value.substring(endPos, txtarea.value.length);\n    txtarea.focus();\n\n    //set new selection\n    //modified by Patrice Ferlet\n    // - selection wasn't good for selected text replaced\n    txtarea.selectionStart=startPos+tagOpen.length;\n    txtarea.selectionEnd=startPos+tagOpen.length+myText.length;\n\n    txtarea.scrollTop=scrollTop;\n  // All others\n  } else {\n    var copy_alertText=alertText;\n    var re1=new RegExp(\"\\\$1\",\"g\");\n    var re2=new RegExp(\"\\\$2\",\"g\");\n    copy_alertText=copy_alertText.replace(re1,sampleText);\n    copy_alertText=copy_alertText.replace(re2,tagOpen+sampleText+tagClose);\n    var text;\n    if (sampleText) {\n      text=prompt(copy_alertText);\n    } else {\n      text=\"\";\n    }\n    if(!text) { text=sampleText;}\n    text=tagOpen+text+tagClose;\n    //append to the end\n    txtarea.value += text;\n\n    // in Safari this causes scrolling\n    if(!is_safari) {\n      txtarea.focus();\n    }\n\n  }\n  // reposition cursor if possible\n  if (txtarea.createTextRange) txtarea.caretPos = document.selection.createRange().duplicate();\n}\n        ");
     return $toReturn;
 }
コード例 #18
0
 /**
  * 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');
 }
コード例 #19
0
 /**
  * action to perform authwith open_ID
  */
 public function login()
 {
     try {
         # Change 'localhost' to your domain name.
         $openid = new LightOpenID('http://e-learning-22/');
         $openid_identfier = "http://192.168.0.201:8080/Sayegh-OpenID-Provider/auth";
         if (!$openid->mode) {
             if (isset($openid_identfier)) {
                 $openid->identity = $openid_identfier;
                 # The following two lines request email, full name, and a nickname
                 # from the provider. Remove them if you don't need that data.
                 $openid->required = array('contact/email', 'namePerson');
                 $openid->optional = array("role");
                 header('Location: ' . $openid->authUrl());
                 die;
             }
             ?>
             WTF you should never reached here! XO
             <?php 
         } elseif ($openid->mode == 'cancel') {
             echo 'User has canceled authentication!';
         } else {
             $res = $openid->getAttributes();
             // [contact/email] => sara@syrianep.com [namePerson] => sara lakah
             $user = new OpenIDUser(new \core_kernel_classes_Resource("http://sep.com/" . $res['contact/email']));
             $session = new \common_session_DefaultSession($user);
             \common_session_SessionManager::startSession($session);
             $this->redirect(_url('entry', 'Main', "tao"));
             //   echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
             //  print_r($openid->getAttributes());
         }
     } catch (ErrorException $e) {
         echo $e->getMessage();
     }
 }
コード例 #20
0
/**
* Plugin smarty type fonction
* Purpose:  generation of a copixed url
*
* Input:    dest=module|desc|action
*           complete syntax will be:
*           desc|action for current module, desc and action
*           [action or |action] default desc, action
*           [|desc|action] project, desc and action
*           [||action] action in the project
*           [module||action] action in the default desc for the module
*           [|||] the only syntax for the current page
*
*           * = any extra params will be used to generate the url
*
*/
function smarty_function_copixurl($params, &$me)
{
    if (isset($params['notxml'])) {
        $isxml = $params['notxml'] == 'true' ? false : true;
        unset($params['notxml']);
    } else {
        $isxml = true;
    }
    $assign = '';
    if (isset($params['assign'])) {
        $assign = $params['assign'];
        unset($params['assign']);
    }
    if (!isset($params['dest']) && !isset($params['appendFrom'])) {
        $toReturn = _url(null, array(), $isxml);
    }
    if (isset($params['appendFrom'])) {
        $appendFrom = $params['appendFrom'];
        unset($params['appendFrom']);
        $toReturn = CopixUrl::appendToUrl($appendFrom, $params, $isxml);
    }
    if (isset($params['dest'])) {
        $dest = $params['dest'];
        unset($params['dest']);
        $toReturn = _url($dest, $params, $isxml);
    }
    if (strlen($assign) > 0) {
        $me->assign($assign, $toReturn);
        return '';
    } else {
        return $toReturn;
    }
}
コード例 #21
0
 /**
  * Performs various tests on nodes and their REST API.
  */
 public function testNodes()
 {
     $this->enableNodeConfiguration('GET', 'view');
     $node = $this->entityCreate('node');
     $node->save();
     $this->httpRequest('node/' . $node->id(), 'GET', NULL, $this->defaultMimeType);
     $this->assertResponse(200);
     $this->assertHeader('Content-type', $this->defaultMimeType);
     // Also check that JSON works and the routing system selects the correct
     // REST route.
     $this->enableService('entity:node', 'GET', 'json');
     $this->httpRequest('node/' . $node->id(), 'GET', NULL, 'application/json');
     $this->assertResponse(200);
     $this->assertHeader('Content-type', 'application/json');
     // Check that a simple PATCH update to the node title works as expected.
     $this->enableNodeConfiguration('PATCH', 'update');
     // Create a PATCH request body that only updates the title field.
     $new_title = $this->randomString();
     $data = array('_links' => array('type' => array('href' => _url('rest/type/node/resttest', array('absolute' => TRUE)))), 'title' => array(array('value' => $new_title)));
     $serialized = $this->container->get('serializer')->serialize($data, $this->defaultFormat);
     $this->httpRequest('node/' . $node->id(), 'PATCH', $serialized, $this->defaultMimeType);
     $this->assertResponse(204);
     // Reload the node from the DB and check if the title was correctly updated.
     $updated_node = entity_load('node', $node->id(), TRUE);
     $this->assertEqual($updated_node->getTitle(), $new_title);
     // Make sure that the UUID of the node has not changed.
     $this->assertEqual($node->get('uuid')->getValue(), $updated_node->get('uuid')->getValue(), 'UUID was not changed.');
 }
コード例 #22
0
 public function restore()
 {
     $currentSession = \common_session_SessionManager::getSession();
     if ($currentSession instanceof \common_session_RestrictedSession) {
         $currentSession->restoreOriginal();
     }
     $this->redirect(_url('index', 'Main', 'tao'));
 }
コード例 #23
0
 /**
  * Par défaut, on redirige vers l'url d'accueil définie dans les paramètres
  */
 public function processDefault()
 {
     $home = CopixConfig::get('|homePage');
     if (strpos($home, 'http://') !== 0) {
         $home = _url() . $home;
     }
     return _arRedirect($home);
 }
コード例 #24
0
 /**
  * Behaviour to adopt if the user is not allowed to access the current action.
  */
 protected function notAllowedRedirection()
 {
     if ($this->hasRequestParameter('processUri') && $this->hasRequestParameter('activityUri')) {
         $this->redirect(_url('index', 'Authentication', 'wfEngine', array('errorMessage' => urlencode(__('Please login to access the selected activity.')), 'processUri' => urlencode($this->getRequestParameter('processUri')), 'activityUri' => urlencode($this->getRequestParameter('activityUri')))));
     } else {
         $this->redirect(_url('index', 'Authentication', 'wfEngine', array('errorMessage' => urlencode(__('Access denied. Please renew your authentication!')))));
     }
 }
コード例 #25
0
 /**
  * Execute the search.
  *
  * This is a dummy search, so when search "executes", we just return a dummy
  * result containing the keywords and a list of conditions.
  *
  * @return array
  *   A structured list of search results
  */
 public function execute()
 {
     $results = array();
     if (!$this->isSearchExecutable()) {
         return $results;
     }
     return array(array('link' => _url('node'), 'type' => 'Dummy result type', 'title' => 'Dummy title', 'snippet' => SafeMarkup::set("Dummy search snippet to display. Keywords: {$this->keywords}\n\nConditions: " . print_r($this->searchParameters, TRUE))));
 }
コード例 #26
0
ファイル: multi_pay.php プロジェクト: ralfeus/moomi-daeri.com
 public function order()
 {
     $this->load->helper('multi_pay');
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link(_url($_GET), 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $order_id = _g($_GET, 'order_id', _g($this->session->data, 'order_id'));
     if (!$order_id) {
         $this->redirect($this->url->link('account/order', '', 'SSL'));
     }
     $this->session->data['order_id'] = $order_id;
     $this->language->load('account/multi_pay_order');
     $this->load->model('account/order');
     $order_info = $this->model_account_order->getOrder($order_id);
     $total = $order_info['total'];
     //trigger_error ( 'total:' . $total, E_USER_NOTICE );
     // если заказ с 0 оплатой или уже оплачен - то игнорируем
     if ($total == 0 || $order_info['order_status_id'] != 1) {
         $this->session->data['note'] = _note($this->language->get('note_cant_pay'), 'warning');
         $this->redirect($this->url->link('account/order/info', '&order_id=' . $order_id, 'SSL'));
     }
     //подключаем файл перевода
     $this->language->load('account/order');
     $this->load->model('account/order');
     $order_info = $this->model_account_order->getOrder($order_id);
     $this->load->model('payment/multi_pay');
     $payment_address_res = $this->model_payment_multi_pay->get_payment_address($order_info['customer_id'], $order_info['payment_address_1']);
     $payment_address = $payment_address_res->row;
     //trigger_error ( 'payment_address:' .json_encode($payment_address), E_USER_NOTICE );
     $method_data = $this->model_payment_multi_pay->get_payment_methods($payment_address, $total);
     //trigger_error ( 'method_data:' .json_encode($method_data), E_USER_NOTICE );
     if (empty($method_data)) {
         $this->data['error_warning'] = sprintf($this->language->get('error_no_payment'), $this->url->link('information/contact'));
     } else {
         $this->data['error_warning'] = '';
     }
     $this->document->setTitle($this->language->get('heading_title_ord'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('href' => $this->url->link('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_account'), 'href' => $this->url->link('account/account', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_order'), 'href' => $this->url->link('account/order/info', '&order_id=' . $order_id, 'SSL'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title_ord');
     $this->template = _tpl('/template/common/default.tpl', $this->config->get('config_template'));
     $this->children = array('common/content_top', 'common/header');
     $b = '';
     $b .= $this->data['error_warning'];
     $b .= '<h3>' . $this->language->get('text_subtitle') . '</h3>';
     $b .= $this->model_payment_multi_pay->payment_methods($method_data);
     $b .= '';
     $this->data['body'] = $b;
     $this->data['column_left'] = '';
     $this->data['column_right'] = '';
     $this->data['content_bottom'] = '';
     $this->data['footer'] = '';
     $this->response->setOutput($this->render());
 }
コード例 #27
0
 /**
  * Création de la zone de login
  */
 public function _createContent(&$toReturn)
 {
     $ppo = new CopixPPO();
     $ppo->user = CopixAuth::getCurrentUser()->isConnected() ? CopixAuth::getCurrentUser() : null;
     $ppo->auth_url_return = $this->getParam('auth_url_return', _url('#'));
     $ppo->createUser = CopixConfig::get('auth|createUser');
     $ppo->ask_remember = false;
     $toReturn = $this->_usePPO($ppo, $this->getParam('template', 'login.form.php'));
 }
コード例 #28
0
 /**
  * Either displays the currently associated delivery
  * or calls selectDelivery in order to allow the user to select a delivery
  * 
  * Only accessible to LTI instructors
  */
 public function configureDelivery()
 {
     $compiledDelivery = LTIDeliveryTool::singleton()->getDeliveryFromLink();
     if (is_null($compiledDelivery)) {
         $this->selectDelivery();
     } else {
         $this->redirect(_url('showDelivery', null, null, array('uri' => $compiledDelivery->getUri())));
     }
 }
コード例 #29
0
 public function process($pParams)
 {
     extract($pParams);
     if (!isset($name)) {
         throw new CopixTemplateTagException('[AutoComplete] Required parameter name');
     }
     if (!isset($field)) {
         $field = $name;
     }
     if (!isset($id)) {
         $id = $name;
     }
     if (!isset($value)) {
         $value = "";
     }
     if (!isset($onSelect)) {
         $onSelect = "";
     }
     if (!isset($onRequest)) {
         $onRequest = '';
     }
     if (!isset($extra)) {
         $extra = '';
     }
     if (!isset($pParams['datasource'])) {
         $pParams['datasource'] = 'dao';
     }
     $toMaj = '';
     $onSelectTemp = '';
     if (isset($maj)) {
         $onSelectTemp .= "eleme.selected.id = 'selector_autocomplete';";
         foreach ($maj as $key => $field) {
             $onSelectTemp .= "\n                        \$\$('#selector_autocomplete .{$key}').each (function (el) {\n                            \$('{$field}').value = el.innerHTML;\n                        });\n                    ";
             $toMaj .= $key . ';';
         }
     }
     $onSelect = $onSelectTemp . $onSelect;
     $url = 'generictools|ajax|getAutoComplete';
     if (isset($pParams['url'])) {
         $url = $pParams['url'];
     }
     $length = isset($length) ? $length : 1;
     $pParams['view'] = isset($pParams['view']) ? $pParams['view'] : $field;
     $tab = array();
     foreach ($pParams as $key => $param) {
         $tab[$key] = $param;
     }
     $tab['nb'] = 10;
     $tab['tomaj'] = $toMaj;
     $js = new CopixJSWidget();
     $js->tag_autocomplete($id, $name, $length, $tab, _url($url), $js->function_(null, 'el', $onRequest), $js->function_(null, 'el,eleme,element', $onSelect));
     CopixHTMLHeader::addJSDOMReadyCode($js);
     CopixHTMLHeader::addJSLink(_resource('js/taglib/tag_autocomplete.js'));
     _eTag("mootools", array('plugin' => "observer;autocompleter"));
     $toReturn = '<input type="text" id="' . $name . '" name="' . $name . '" value="' . $value . '" ' . $extra . ' /><span id="autocompleteload_' . $name . '"><img src="' . CopixUrl::getResource('img/tools/load.gif') . '" /></span>';
     return $toReturn;
 }
コード例 #30
0
 /**
  * Tests system #type 'more_link'.
  */
 function testMoreLink()
 {
     $elements = array(array('name' => "#type 'more_link' anchor tag generation without extra classes", 'value' => array('#type' => 'more_link', '#url' => Url::fromUri('http://drupal.org')), 'expected' => '//div[@class="more-link"]/a[@href="http://drupal.org" and text()="More"]'), array('name' => "#type 'more_link' anchor tag generation with different link text", 'value' => array('#type' => 'more_link', '#url' => Url::fromUri('http://drupal.org'), '#title' => 'More Titles'), 'expected' => '//div[@class="more-link"]/a[@href="http://drupal.org" and text()="More Titles"]'), array('name' => "#type 'more_link' anchor tag generation with attributes on wrapper", 'value' => array('#type' => 'more_link', '#url' => Url::fromUri('http://drupal.org'), '#theme_wrappers' => array('container' => array('#attributes' => array('title' => 'description', 'class' => array('more-link', 'drupal', 'test'))))), 'expected' => '//div[@title="description" and contains(@class, "more-link") and contains(@class, "drupal") and contains(@class, "test")]/a[@href="http://drupal.org" and text()="More"]'), array('name' => "#type 'more_link' anchor tag with a relative path", 'value' => array('#type' => 'more_link', '#url' => Url::fromRoute('router_test.1')), 'expected' => '//div[@class="more-link"]/a[@href="' . _url('router_test/test1') . '" and text()="More"]'), array('name' => "#type 'more_link' anchor tag with a route", 'value' => array('#type' => 'more_link', '#url' => Url::fromRoute('router_test.1')), 'expected' => '//div[@class="more-link"]/a[@href="' . \Drupal::urlGenerator()->generate('router_test.1') . '" and text()="More"]'), array('name' => "#type 'more_link' anchor tag with an absolute path", 'value' => array('#type' => 'more_link', '#url' => Url::fromRoute('system.admin_content'), '#options' => array('absolute' => TRUE)), 'expected' => '//div[@class="more-link"]/a[@href="' . _url('admin/content', array('absolute' => TRUE)) . '" and text()="More"]'), array('name' => "#type 'more_link' anchor tag to the front page", 'value' => array('#type' => 'more_link', '#url' => Url::fromRoute('<front>')), 'expected' => '//div[@class="more-link"]/a[@href="' . _url('<front>') . '" and text()="More"]'));
     foreach ($elements as $element) {
         $xml = new \SimpleXMLElement(drupal_render($element['value']));
         $result = $xml->xpath($element['expected']);
         $this->assertTrue($result, '"' . $element['name'] . '" input rendered correctly by drupal_render().');
     }
 }