当前位置: 首页>>代码示例>>PHP>>正文


PHP JControllerLegacy::setMessage方法代码示例

本文整理汇总了PHP中JControllerLegacy::setMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP JControllerLegacy::setMessage方法的具体用法?PHP JControllerLegacy::setMessage怎么用?PHP JControllerLegacy::setMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JControllerLegacy的用法示例。


在下文中一共展示了JControllerLegacy::setMessage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetRedirectWithUrlNoMessageAndMessageTypeWithPreviouslySetMessage

 /**
  * @testdox  Tests that message and message type set in setMessage() are overriden by setRedirect()
  *
  * @covers   JControllerLegacy::setRedirect
  */
 public function testSetRedirectWithUrlNoMessageAndMessageTypeWithPreviouslySetMessage()
 {
     $this->class->setMessage('Folks?', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar', null, 'question');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class);
     $this->assertAttributeEquals('Folks?', 'message', $this->class);
     $this->assertAttributeEquals('question', 'messageType', $this->class);
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:13,代码来源:JControllerLegacyTest.php

示例2: orderPlugins

 /**
  * 
  * @return type
  */
 protected function orderPlugins()
 {
     $aOrder = array('jscsscontrol', 'eorisis_jquery', 'jqueryeasy', 'jch_optimize', 'plugin_googlemap3', 'cdnforjoomla', 'bigshotgoogleanalytics', 'GoogleAnalytics', 'jat3', 'cache', 'jSGCache', 'jotcache', 'vmcache_last');
     $aPlugins = $this->getPlugins();
     $aLowerPlugins = array_values(array_filter($aOrder, function ($aVal) use($aPlugins) {
         return array_key_exists($aVal, $aPlugins);
     }));
     $iNoPlugins = count($aPlugins);
     $iNoLowerPlugins = count($aLowerPlugins);
     $iBaseOrder = $iNoPlugins - $iNoLowerPlugins;
     $cid = array();
     $order = array();
     foreach ($aPlugins as $key => $value) {
         if (in_array($key, $aLowerPlugins)) {
             $value['ordering'] = $iBaseOrder + 1 + array_search($key, $aLowerPlugins);
         } elseif ($value['ordering'] >= $iBaseOrder) {
             $value['ordering'] = $iBaseOrder - 1;
         }
         $cid[] = $value['extension_id'];
         $order[] = $value['ordering'];
     }
     JArrayHelper::toInteger($cid);
     JArrayHelper::toInteger($order);
     $aOrder = array();
     $aOrder['cid'] = $cid;
     $aOrder['order'] = $order;
     $oController = new JControllerLegacy();
     $oController->addModelPath(JPATH_ADMINISTRATOR . '/components/com_plugins/models', 'PluginsModel');
     $oPluginModel = $oController->getModel('Plugin', 'PluginsModel');
     if ($oPluginModel->saveorder($aOrder['cid'], $aOrder['order']) === FALSE) {
         $oController->setMessage(JText::sprintf('JLIB_APPLICATION_ERROR_REORDER_FAILED', $oPluginModel->getError()), 'error');
     } else {
         $oController->setMessage(JText::_('JLIB_APPLICATION_SUCCESS_ORDERING_SAVED'));
     }
     $this->display($oController);
 }
开发者ID:irovast,项目名称:eyedock,代码行数:40,代码来源:auto.php

示例3: testSetRedirect

 /**
  * Test JControllerLegacy::setRedirect
  *
  * @since   11.3
  *
  * @return  void
  */
 public function testSetRedirect()
 {
     // Set the URL only
     $this->class->setRedirect('index.php?option=com_foobar');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect.');
     $this->assertAttributeEquals(null, 'message', $this->class, 'Checks the message.');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type.');
     // Set the URL and message
     $this->class->setRedirect('index.php?option=com_foobar', 'Hello World');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (2).');
     $this->assertAttributeEquals('Hello World', 'message', $this->class, 'Checks the message (2).');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (2).');
     // URL, message and message type
     $this->class->setRedirect('index.php?option=com_foobar', 'Morning Universe', 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (3).');
     $this->assertAttributeEquals('Morning Universe', 'message', $this->class, 'Checks the message (3).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (3).');
     // With previously set message
     // URL
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (4).');
     $this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (4).');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (4).');
     // URL and message
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye all');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (5).');
     $this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (5).');
     $this->assertAttributeEquals('message', 'messageType', $this->class, 'Checks the message type (5).');
     // URL, message and message type
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye all', 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (6).');
     $this->assertAttributeEquals('Bye all', 'message', $this->class, 'Checks the message (6).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (6).');
     // URL and message type
     $this->class->setMessage('Hi all');
     $this->class->setRedirect('index.php?option=com_foobar', null, 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (7).');
     $this->assertAttributeEquals('Hi all', 'message', $this->class, 'Checks the message (7).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (7).');
     // With previously set message and message type
     // URL
     $this->class->setMessage('Hello folks', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (8).');
     $this->assertAttributeEquals('Hello folks', 'message', $this->class, 'Checks the message (8).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (8).');
     // URL and message
     $this->class->setMessage('Hello folks', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye, Folks');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (9).');
     $this->assertAttributeEquals('Bye, Folks', 'message', $this->class, 'Checks the message (9).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (9).');
     // URL, message and message type
     $this->class->setMessage('Hello folks', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar', 'Bye, folks', 'notice');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).');
     $this->assertAttributeEquals('Bye, folks', 'message', $this->class, 'Checks the message (10).');
     $this->assertAttributeEquals('notice', 'messageType', $this->class, 'Checks the message type (10).');
     // URL and message type
     $this->class->setMessage('Folks?', 'notice');
     $this->class->setRedirect('index.php?option=com_foobar', null, 'question');
     $this->assertAttributeEquals('index.php?option=com_foobar', 'redirect', $this->class, 'Checks the redirect (10).');
     $this->assertAttributeEquals('Folks?', 'message', $this->class, 'Checks the message (10).');
     $this->assertAttributeEquals('question', 'messageType', $this->class, 'Checks the message type (10).');
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:75,代码来源:JControllerLegacyTest.php


注:本文中的JControllerLegacy::setMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。