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


PHP JEventDispatcher类代码示例

本文整理汇总了PHP中JEventDispatcher的典型用法代码示例。如果您正苦于以下问题:PHP JEventDispatcher类的具体用法?PHP JEventDispatcher怎么用?PHP JEventDispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return  void
  *
  * @since   3.6
  */
 protected function setUp()
 {
     parent::setUp();
     $this->saveFactoryState();
     JFactory::$application = $this->getMockCmsApp();
     JFactory::$session = $this->getMockSession();
     $this->dispatcher = new JEventDispatcher();
     TestReflection::setValue($this->dispatcher, 'instance', $this->dispatcher);
     $this->dispatcher->register('onAfterRenderModules', array($this, 'eventCallback'));
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:18,代码来源:JDocumentRendererHtmlModulesTest.php

示例2: attendeetoggle

 /**
  * toggletask
  */
 function attendeetoggle()
 {
     $jinput = JFactory::getApplication()->input;
     $id = $jinput->getInt('id');
     $fid = $jinput->getInt('Itemid');
     $model = $this->getModel('attendee');
     $model->setId($id);
     $attendee = $model->getData();
     $res = $model->toggle();
     $type = 'message';
     if ($res) {
         JPluginHelper::importPlugin('jem');
         $dispatcher = JEventDispatcher::getInstance();
         $res = $dispatcher->trigger('onUserOnOffWaitinglist', array($id));
         if ($attendee->waiting) {
             $msg = JText::_('COM_JEM_ADDED_TO_ATTENDING');
         } else {
             $msg = JText::_('COM_JEM_ADDED_TO_WAITING');
         }
     } else {
         $msg = JText::_('COM_JEM_WAITINGLIST_TOGGLE_ERROR') . ': ' . $model->getError();
         $type = 'error';
     }
     $this->setRedirect(JRoute::_('index.php?option=com_jem&view=attendees&id=' . $attendee->event . '&Itemid=' . $fid, false), $msg, $type);
     $this->redirect();
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:29,代码来源:attendees.php

示例3: showEndForm

 function showEndForm($pmconfigs, $order)
 {
     $jshopConfig = JSFactory::getConfig();
     $pm_method = $this->getPmMethod();
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->clear();
     $query->update('#__jshopping_orders')->set($db->quoteName('order_created') . ' = 1 ')->where($db->quoteName('order_id') . ' = ' . (int) $order->order_id);
     $db->setQuery($query);
     echo '<div id="begateway_erip">';
     try {
         $db->execute();
         $model = JSFactory::getModel('orderMail', 'jshop');
         $model->setData($order->order_id, 0);
         $model->send();
         if ($pmconfigs['auto'] == '1') {
             JPluginHelper::importPlugin('PlgSystemJoomShoppingErip');
             $dispatcher = JEventDispatcher::getInstance();
             $result = $dispatcher->trigger('onBeforeChangeOrderStatusAdmin', array($order->order_id, $this->getStatusId(), 'auto'));
             if (!$result) {
                 throw new Exception(JText::_('PLG_JSERIPPAYMENT_ORDER_ERROR'));
             }
             $instruction = JText::_('PLG_JSERIPPAYMENT_ERIP_INSTRUCTION');
             $instruction = str_replace('#TABS#', '<strong>' . $pmconfigs['tree_path_email'] . '</strong>', $instruction);
             $instruction = str_replace('#ORDER_ID#', '<strong>' . $order->order_id . '</strong>', $instruction);
             echo nl2br($instruction);
         } else {
             echo nl2br(JText::_('PLG_JSERIPPAYMENT_ORDER_CONFIRMATION'));
         }
     } catch (RuntimeException $e) {
         echo JText::_('PLG_JSERIPPAYMENT_ORDER_ERROR');
     }
     echo '</div>';
 }
开发者ID:beGateway,项目名称:joomshopping-erip-payment-plugin,代码行数:34,代码来源:pm_erip.php

示例4: addSubmenu

 /**
  * Configure the Link bar.
  *
  * @param   string  $vName  The name of the active view.
  *
  * @return  void
  */
 public static function addSubmenu($vName)
 {
     JHtmlSidebar::addEntry(JText::_('COM_FBIMPORTER_TOOL'), 'index.php?option=com_fbimporter&view=items', $vName == 'items');
     JHtmlSidebar::addEntry(JText::_('COM_FBIMPORTER_FORMAT_SETTING'), 'index.php?option=com_fbimporter&view=formats', $vName == 'formats');
     $dispatcher = \JEventDispatcher::getInstance();
     $dispatcher->trigger('onAfterAddSubmenu', array('com_fbimporter', $vName));
 }
开发者ID:beingsane,项目名称:facebook-importer,代码行数:14,代码来源:helper.php

示例5: saveScore

 public function saveScore($game_id, $game_title, $userid, $username, $score, $highestscore, $trigger)
 {
     $app = JFactory::getApplication();
     $player_ip = $app->input->server->get('REMOTE_ADDR', '0.0.0.0', 'raw');
     $res = 0;
     if ($highestscore != 0) {
         $this->dbo->setQuery('SELECT id FROM #__jvarcade ' . ' WHERE ' . $this->dbo->quoteName('gameid') . ' = ' . $this->dbo->Quote($game_id) . '	AND ' . $this->dbo->quoteName('userid') . ' = ' . $this->dbo->Quote($userid));
         $scoreid = (int) $this->dbo->loadResult();
         $this->dbo->setQuery('UPDATE #__jvarcade SET ' . $this->dbo->quoteName('score') . ' = ' . $this->dbo->Quote($score) . ', ' . $this->dbo->quoteName('ip') . ' = ' . $this->dbo->Quote($player_ip) . ', ' . $this->dbo->quoteName('date') . ' = ' . $this->dbo->Quote(date('Y-m-d H:i:s')) . ' WHERE ' . $this->dbo->quoteName('id') . ' = ' . $this->dbo->Quote($scoreid));
         if (!$scoreid || !$this->dbo->execute()) {
             $res = 0;
         } else {
             $res = 1;
         }
     } elseif ($highestscore == 0 || $highestscore == false) {
         $this->dbo->setQuery('INSERT INTO #__jvarcade (' . $this->dbo->quoteName('userid') . ', ' . $this->dbo->quoteName('score') . ', ' . $this->dbo->quoteName('ip') . ', ' . $this->dbo->quoteName('gameid') . ', ' . $this->dbo->quoteName('date') . ') ' . ' VALUES (' . $this->dbo->Quote($userid) . ',' . $this->dbo->Quote($score) . ',' . $this->dbo->Quote($player_ip) . ',' . $this->dbo->Quote($game_id) . ',' . $this->dbo->Quote(date('Y-m-d H:i:s')) . ')');
         if (!$this->dbo->execute()) {
             $res = 0;
         } else {
             $scoreid = $this->dbo->insertid();
             $res = 1;
         }
     } else {
         $res = 1;
     }
     if ($res == 1) {
         $this->setUpdateLeaderBoard();
         if ($trigger) {
             $dispatcher = JEventDispatcher::getInstance();
             // trigger the contest score event
             $dispatcher->trigger('onPUAScoreSaved', array($game_id, $game_title, $userid, $username, $score));
         }
     }
     return $res;
 }
开发者ID:Tfrez,项目名称:jVarcade,代码行数:35,代码来源:scores.php

示例6: display

 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $dispatcher = JEventDispatcher::getInstance();
     $this->item = $this->get('Item');
     $alt_layout = $this->get('Alt_layout');
     //echo'<pre>';var_dump($alt_layout);die;
     if (!empty($alt_layout)) {
         $this->setLayout($alt_layout);
     }
     if ($this->item !== false) {
         $this->state = $this->get('State');
         //$this->user		= $user;
         $this->elements = $this->get('Elements');
         // Check for errors.
         if (count($errors = $this->get('Errors'))) {
             JError::raiseWarning(500, implode("\n", $errors));
             return false;
         }
         $this->authorised = $user->authorise('core.edit', 'com_azurapagebuilder.page.' . $this->item->id);
         //echo'<pre>';var_dump($this->item->id);var_dump($user);die;
         $item = $this->item;
         $this->params = $this->state->get('params');
         $temp = clone $this->params;
         // Current view is not a single product, so the product params take priority here
         // Merge the menu item params with the product params so that the product params take priority
         $temp->merge($item->params);
         $item->params = $temp;
         //Escape strings for HTML output
         //$this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx'));
         $this->_prepareDocument();
         parent::display($tpl);
     }
 }
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:35,代码来源:view.html.php

示例7: displayRows

 /**
  * Method to display the layout of search results
  *
  * @return void
  */
 public function displayRows()
 {
     // Run events
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'search');
     $params->set('kunena_layout', 'default');
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->results, &$params, 0));
     foreach ($this->results as $this->message) {
         $this->topic = $this->message->getTopic();
         $this->category = $this->message->getCategory();
         $this->categoryLink = $this->getCategoryLink($this->category->getParent()) . ' / ' . $this->getCategoryLink($this->category);
         $ressubject = KunenaHtmlParser::parseText($this->message->subject);
         $resmessage = KunenaHtmlParser::parseBBCode($this->message->message, 500);
         $profile = KunenaFactory::getUser((int) $this->message->userid);
         $this->useravatar = $profile->getAvatarImage('kavatar', 'post');
         foreach ($this->searchwords as $searchword) {
             if (empty($searchword)) {
                 continue;
             }
             $ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/iu", '<span  class="searchword" >' . $searchword . '</span>', $ressubject);
             // FIXME: enable highlighting, but only after we can be sure that we do not break html
             // $resmessage = preg_replace ( "/" . preg_quote ( $searchword, '/' ) . "/iu", '<span  class="searchword" >' . $searchword . '</span>', $resmessage );
         }
         $this->author = $this->message->getAuthor();
         $this->topicAuthor = $this->topic->getAuthor();
         $this->topicTime = $this->topic->first_post_time;
         $this->subjectHtml = $ressubject;
         $this->messageHtml = $resmessage;
         $contents = $this->subLayout('Search/Results/Row')->setProperties($this->getProperties());
         echo $contents;
     }
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:40,代码来源:results.php

示例8: DefaultViewHelperFooter16

function DefaultViewHelperFooter16($view)
{
    if (JRequest::getInt('pop', 0)) {
        ?>
	<div class="ev_noprint"><p align="center">
	<a href="#close" onclick="if (window.parent==window){self.close();} else {try {window.parent.jQuery('#myEditModal').modal('hide');}catch (e){}try {window.parent.SqueezeBox.close(); return false;} catch(e) {self.close();return false;}}" title="<?php 
        echo JText::_('JEV_CLOSE');
        ?>
"><?php 
        echo JText::_('JEV_CLOSE');
        ?>
</a>
	</p></div>
<?php 
    }
    $view->loadHelper("JevViewCopyright");
    JevViewCopyright();
    ?>
</div>
</div> <!-- close #jevents //-->
<?php 
    $dispatcher = JEventDispatcher::getInstance();
    $dispatcher->trigger('onJEventsFooter');
    $task = JRequest::getString("jevtask");
    $view->loadModules("jevpostjevents");
    $view->loadModules("jevpostjevents_" . $task);
    JEVHelper::componentStylesheet($view, "extra.css");
    jimport('joomla.filesystem.file');
    // Lets check if we have editted before! if not... rename the custom file.
    if (JFile::exists(JPATH_SITE . "/components/com_jevents/assets/css/jevcustom.css")) {
        // It is definitely now created, lets load it!
        JEVHelper::stylesheet('jevcustom.css', 'components/' . JEV_COM_COMPONENT . '/assets/css/');
    }
}
开发者ID:hriggs,项目名称:cs-website,代码行数:34,代码来源:defaultviewhelperfooter16.php

示例9: onAfterRender

 function onAfterRender()
 {
     if (class_exists('JEventDispatcher', false)) {
         $dispatcher = JEventDispatcher::getInstance();
     } else {
         $dispatcher = JDispatcher::getInstance();
     }
     $dispatcher->trigger('onNextendBeforeCompileHead');
     ob_start();
     if (class_exists('N2AssetsManager')) {
         echo N2AssetsManager::getCSS();
         echo N2AssetsManager::getJs();
     }
     $head = ob_get_clean();
     if ($head != '') {
         $application = JFactory::getApplication();
         if (class_exists('JApplicationWeb') && method_exists($application, 'getBody')) {
             $body = $application->getBody();
             $mode = 'JApplicationWeb';
         } else {
             $body = JResponse::getBody();
             $mode = 'JResponse';
         }
         $body = preg_replace('/<\\/head>/', $head . '</head>', $body, 1);
         switch ($mode) {
             case 'JResponse':
                 JResponse::setBody($body);
                 break;
             default:
                 $application->setBody($body);
         }
     }
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:33,代码来源:nextend2.php

示例10: init

 /**
  * @see AbstractTheme::init()
  */
 protected function init()
 {
     parent::init();
     $gantry = Gantry::instance();
     /** @var UniformResourceLocator $locator */
     $locator = $gantry['locator'];
     \JPluginHelper::importPlugin('gantry5');
     // Trigger the onGantryThemeInit event.
     $dispatcher = \JEventDispatcher::getInstance();
     $dispatcher->trigger('onGantry5ThemeInit', ['theme' => $this]);
     $lang = \JFactory::getLanguage();
     // FIXME: Do not hardcode this file.
     $lang->load('files_gantry5_nucleus', JPATH_SITE);
     if (\JFactory::getApplication()->isSite()) {
         // Load our custom positions file as frontend requires the strings to be there.
         $filename = $locator("gantry-theme://language/en-GB/en-GB.tpl_{$this->name}_positions.ini");
         if ($filename) {
             $lang->load("tpl_{$this->name}_positions", dirname(dirname(dirname($filename))), 'en-GB');
         }
     }
     $doc = \JFactory::getDocument();
     $this->language = $doc->language;
     $this->direction = $doc->direction;
     $this->url = \JUri::root(true) . '/templates/' . $this->name;
 }
开发者ID:legutierr,项目名称:gantry5,代码行数:28,代码来源:Theme.php

示例11: sendMemberDaytimeToAdmin

 function sendMemberDaytimeToAdmin($member_id, $service_id, $daytime_id)
 {
     define("BodyMemberDaytimeToAdmin", "<h1>Nouvelle inscription à une tranche horaire</h1><p>Un bénévole s'est inscrit à un secteur / tranche horaire.</p><p><strong>Nom :</strong> %s <br /><strong>Secteur :</strong> %s<br /><strong>Date :</strong> %s<br /><strong>Tranche horaire :</strong> %s</p><p><a href=\"" . JURI::root() . "/administrator/index.php?option=com_estivole&view=member&layout=edit&member_id=%s\">Cliquez ici</a> pour valider l'inscription et/ou recontacter le bénévole.</p>");
     define("SubjectMemberDaytimeToAdmin", "Nouvelle inscription à une tranche horaire");
     $db = JFactory::getDBO();
     $query = $db->getQuery(TRUE);
     $this->user = JFactory::getUser();
     // Get the dispatcher and load the user's plugins.
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('user');
     $data = new JObject();
     $data->id = $this->user->id;
     // Trigger the data preparation event.
     $dispatcher->trigger('onContentPrepareData', array('com_users.profilestivole', &$data));
     $userProfilEstivole = $data;
     $userName = $userProfilEstivole->profilestivole['firstname'] . ' ' . $userProfilEstivole->profilestivole['lastname'];
     $query->select('*');
     $query->from('#__estivole_members as b, #__estivole_services as s, #__estivole_daytimes as d');
     $query->where('b.member_id = ' . (int) $member_id);
     $query->where('s.service_id = ' . (int) $service_id);
     $query->where('d.daytime_id = ' . (int) $daytime_id);
     $db->setQuery($query);
     $mailModel = $db->loadObject();
     $mail = JFactory::getMailer();
     $mail->setBody(sprintf(constant("BodyMemberDaytimeToAdmin"), $userName, $mailModel->service_name, date('d-m-Y', strtotime($mailModel->daytime_day)), date('H:i', strtotime($mailModel->daytime_hour_start)) . ' - ' . date('H:i', strtotime($mailModel->daytime_hour_end)), $mailModel->member_id));
     $mail->setSubject(constant("SubjectMemberDaytimeToAdmin"));
     $mail->isHtml();
     $recipient = array('benevoles@estivale.ch', $mailModel->email_responsable);
     $mail->addRecipient($recipient);
     $mail->Send('estivole@estivale.ch');
 }
开发者ID:gorgozilla,项目名称:Estivole,代码行数:31,代码来源:mail.php

示例12: display

 public function display()
 {
     // Get model data.
     $state = $this->get('State');
     $item = $this->get('Item');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $doc = JFactory::getDocument();
     $doc->setMetaData('Content-Type', 'text/directory', true);
     // Initialise variables.
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $user = JFactory::getUser();
     $dispatcher = JEventDispatcher::getInstance();
     // Compute lastname, firstname and middlename
     $item->name = trim($item->name);
     // "Lastname, Firstname Midlename" format support
     // e.g. "de Gaulle, Charles"
     $namearray = explode(',', $item->name);
     if (count($namearray) > 1) {
         $lastname = $namearray[0];
         $card_name = $lastname;
         $name_and_midname = trim($namearray[1]);
         $firstname = '';
         if (!empty($name_and_midname)) {
             $namearray = explode(' ', $name_and_midname);
             $firstname = $namearray[0];
             $middlename = count($namearray) > 1 ? $namearray[1] : '';
             $card_name = $firstname . ' ' . ($middlename ? $middlename . ' ' : '') . $card_name;
         }
     } else {
         $namearray = explode(' ', $item->name);
         $middlename = count($namearray) > 2 ? $namearray[1] : '';
         $firstname = array_shift($namearray);
         $lastname = count($namearray) ? end($namearray) : '';
         $card_name = $firstname . ($middlename ? ' ' . $middlename : '') . ($lastname ? ' ' . $lastname : '');
     }
     $rev = date('c', strtotime($item->modified));
     JResponse::setHeader('Content-disposition', 'attachment; filename="' . $card_name . '.vcf"', true);
     $vcard = array();
     $vcard[] .= 'BEGIN:VCARD';
     $vcard[] .= 'VERSION:3.0';
     $vcard[] = 'N:' . $lastname . ';' . $firstname . ';' . $middlename;
     $vcard[] = 'FN:' . $item->name;
     $vcard[] = 'TITLE:' . $item->con_position;
     $vcard[] = 'TEL;TYPE=WORK,VOICE:' . $item->telephone;
     $vcard[] = 'TEL;TYPE=WORK,FAX:' . $item->fax;
     $vcard[] = 'TEL;TYPE=WORK,MOBILE:' . $item->mobile;
     $vcard[] = 'ADR;TYPE=WORK:;;' . $item->address . ';' . $item->suburb . ';' . $item->state . ';' . $item->postcode . ';' . $item->country;
     $vcard[] = 'LABEL;TYPE=WORK:' . $item->address . "\n" . $item->suburb . "\n" . $item->state . "\n" . $item->postcode . "\n" . $item->country;
     $vcard[] = 'EMAIL;TYPE=PREF,INTERNET:' . $item->email_to;
     $vcard[] = 'URL:' . $item->webpage;
     $vcard[] = 'REV:' . $rev . 'Z';
     $vcard[] = 'END:VCARD';
     echo implode("\n", $vcard);
     return true;
 }
开发者ID:exntu,项目名称:joomla-cms,代码行数:60,代码来源:view.vcf.php

示例13: onStylesSave

 public function onStylesSave(Event $event)
 {
     \JPluginHelper::importPlugin('gantry5');
     // Trigger the onGantryThemeUpdateCss event.
     $dispatcher = \JEventDispatcher::getInstance();
     $dispatcher->trigger('onGantry5UpdateCss', ['theme' => $event->theme]);
 }
开发者ID:Ettore495,项目名称:Ettore-Work,代码行数:7,代码来源:EventListener.php

示例14: getTypeOptions

 /**
  * Method to get the available menu item type options.
  *
  * @return  array  Array of groups with menu item types.
  * @since   1.6
  */
 public function getTypeOptions()
 {
     jimport('joomla.filesystem.file');
     $lang = JFactory::getLanguage();
     $list = array();
     // Get the list of components.
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('name, element AS ' . $db->quoteName('option'))->from('#__extensions')->where('type = ' . $db->quote('component'))->where('enabled = 1')->order('name ASC');
     $db->setQuery($query);
     $components = $db->loadObjectList();
     foreach ($components as $component) {
         if ($options = $this->getTypeOptionsByComponent($component->option)) {
             $list[$component->name] = $options;
             // Create the reverse lookup for link-to-name.
             foreach ($options as $option) {
                 if (isset($option->request)) {
                     $this->addReverseLookupUrl($option);
                     if (isset($option->request['option'])) {
                         $lang->load($option->request['option'] . '.sys', JPATH_ADMINISTRATOR, null, false, true) || $lang->load($option->request['option'] . '.sys', JPATH_ADMINISTRATOR . '/components/' . $option->request['option'], null, false, true);
                     }
                 }
             }
         }
     }
     // Allow a system plugin to insert dynamic menu types to the list shown in menus:
     JEventDispatcher::getInstance()->trigger('onAfterGetMenuTypeOptions', array(&$list, $this));
     return $list;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:34,代码来源:menutypes.php

示例15: before

 /**
  * Prepare reply history display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $id = $this->input->getInt('id');
     $this->topic = KunenaForumTopicHelper::get($id);
     $this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC');
     $this->replycount = $this->topic->getReplies();
     $this->historycount = count($this->history);
     KunenaAttachmentHelper::getByMessage($this->history);
     $userlist = array();
     foreach ($this->history as $message) {
         $userlist[(int) $message->userid] = (int) $message->userid;
     }
     KunenaUserHelper::loadUsers($userlist);
     // Run events
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'history');
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
     // FIXME: need to improve BBCode class on this...
     $this->attachments = KunenaAttachmentHelper::getByMessage($this->history);
     $this->inline_attachments = array();
     $this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:32,代码来源:display.php


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