本文整理汇总了PHP中thebuggenie\core\framework\Event::createNew方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::createNew方法的具体用法?PHP Event::createNew怎么用?PHP Event::createNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Event
的用法示例。
在下文中一共展示了Event::createNew方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _postSave
protected function _postSave($is_new)
{
if ($is_new) {
framework\Context::setPermission("canseecomponent", $this->getID(), "core", 0, framework\Context::getUser()->getGroup()->getID(), 0, true);
\thebuggenie\core\framework\Event::createNew('core', 'Component::createNew', $this)->trigger();
}
}
示例2: getUnattachedFiles
public function getUnattachedFiles()
{
$crit = $this->getCriteria();
$crit->addSelectionColumn(self::ID, 'id');
$res = $this->doSelect($crit);
$file_ids = [];
if ($res) {
while ($row = $res->getNextRow()) {
$file_ids[$row['id']] = $row['id'];
}
}
$file_ids = array_diff($file_ids, IssueFiles::getTable()->getLinkedFileIds($file_ids));
$event = framework\Event::createNew('core', 'thebuggenie\\core\\entities\\tables\\Files::getUnattachedFiles', $this, ['file_ids' => $file_ids], []);
$event->trigger();
if ($event->isProcessed()) {
foreach ($event->getReturnList() as $linked_file_ids) {
$file_ids = array_diff($file_ids, $linked_file_ids);
}
}
$system_file_ids = Settings::getTable()->getFileIds();
$file_ids = array_diff($file_ids, $system_file_ids);
$project_file_ids = Projects::getTable()->getFileIds();
$file_ids = array_diff($file_ids, $project_file_ids);
return $file_ids;
}
示例3: transform
public function transform($text)
{
$this->no_markup = true;
$this->no_entities = true;
$text = preg_replace_callback(\thebuggenie\core\helpers\TextParser::getIssueRegex(), array($this, '_parse_issuelink'), $text);
$text = parent::transform($text);
$text = preg_replace_callback(\thebuggenie\core\helpers\TextParser::getMentionsRegex(), array($this, '_parse_mention'), $text);
$text = preg_replace_callback(self::getStrikethroughRegex(), array($this, '_parse_strikethrough'), $text);
$event = framework\Event::createNew('core', 'thebuggenie\\core\\framework\\helpers\\TextParserMarkdown::transform', $this);
$event->trigger();
foreach ($event->getReturnList() as $regex) {
$text = preg_replace_callback($regex[0], $regex[1], $text);
}
return $text;
}
示例4: __
echo $project->getID();
?>
_input" value="" placeholder="<?php
echo __('Enter an issue number to jump to an issue');
?>
"> <input type="submit" value="<?php
echo __('Go to');
?>
">
</form>
</li>
</ul>
</li>
<?php
}
\thebuggenie\core\framework\Event::createNew('core', 'project_overview_item_links', $project)->trigger();
if (!$project->isLocked() && $tbg_user->canReportIssues($project)) {
?>
<?php
echo javascript_link_tag(__('Report an issue'), array('onclick' => "TBG.Issues.Add('" . make_url('get_partial_for_backdrop', array('key' => 'reportissue', 'project_id' => $project->getId())) . "', this);", 'class' => 'button button-green button-report-issue righthugging'));
?>
<a class="dropper button button-green last lefthugging reportissue_dropdown_button" style="font-size: 0.9em; position: relative;" href="javascript:void(0);">▼</a>
<ul id="create_issue_<?php
echo $project->getID();
?>
" class="more_actions_dropdown popup_box" style="position: absolute; right: 0; margin-top: 25px; display: none;">
<?php
foreach ($project->getIssuetypeScheme()->getReportableIssuetypes() as $issuetype) {
?>
<li><?php
echo javascript_link_tag(image_tag($issuetype->getIcon() . '_tiny.png') . __($issuetype->getName()), array('onclick' => "TBG.Issues.Add('" . make_url('get_partial_for_backdrop', array('key' => 'reportissue', 'project_id' => $project->getId(), 'issuetype' => $issuetype->getKey())) . "', this);"));
示例5: addScope
public function addScope(Scope $scope, $notify = true)
{
if (!$this->isMemberOfScope($scope)) {
tables\UserScopes::getTable()->addUserToScope($this->getID(), $scope->getID());
if ($notify) {
\thebuggenie\core\framework\Event::createNew('core', 'self::addScope', $this, array('scope' => $scope))->trigger();
}
$this->_scopes = null;
$this->_unconfirmed_scopes = null;
$this->_confirmed_scopes = null;
}
}
示例6: doSave
public function doSave($options = array(), $reason = null)
{
if (tables\Articles::getTable()->doesNameConflictExist($this->_name, $this->_id, framework\Context::getScope()->getID())) {
if (!array_key_exists('overwrite', $options) || !$options['overwrite']) {
throw new \Exception(framework\Context::getI18n()->__('Another article with this name already exists'));
}
}
$user_id = framework\Context::getUser() instanceof User ? framework\Context::getUser()->getID() : 0;
if (!isset($options['revert']) || !$options['revert']) {
$revision = tables\ArticleHistory::getTable()->addArticleHistory($this->_name, $this->_old_content, $this->_content, $user_id, $reason);
} else {
$revision = null;
}
tables\ArticleLinks::getTable()->deleteLinksByArticle($this->_name);
ArticleCategories::getTable()->deleteCategoriesByArticle($this->_name);
if ($this->getArticleType() == self::TYPE_MANUAL && isset($options['article_prev_name']) && $this->_name != $options['article_prev_name']) {
$manual_articles = Articles::getTable()->getManualSidebarArticles(framework\Context::getCurrentProject(), $options['article_prev_name']);
foreach ($manual_articles as $manual_article) {
$manual_article->setName(str_replace($options['article_prev_name'], $this->_name, $manual_article->getName()));
$manual_article->doSave();
}
}
$this->save();
$this->_old_content = $this->_content;
if (mb_substr($this->getContent(), 0, 10) == "#REDIRECT ") {
$content = explode("\n", $this->getContent());
preg_match('/(\\[\\[([^\\]]*?)\\]\\])$/im', mb_substr(array_shift($content), 10), $matches);
if (count($matches) == 3) {
return;
}
}
list($links, $categories) = $this->_retrieveLinksAndCategoriesFromContent($options);
foreach ($links as $link => $occurrences) {
tables\ArticleLinks::getTable()->addArticleLink($this->_name, $link);
}
foreach ($categories as $category => $occurrences) {
ArticleCategories::getTable()->addArticleCategory($this->_name, $category, $this->isCategory());
}
$this->_history = null;
\thebuggenie\core\framework\Event::createNew('core', 'thebuggenie\\modules\\publish\\entities\\Article::doSave', $this, compact('reason', 'revision', 'user_id'))->trigger();
return true;
}
示例7: loadArticles
public function loadArticles($namespace = '', $overwrite = true, $scope = null)
{
$scope = framework\Context::getScope()->getID();
$namespace = mb_strtolower($namespace);
$_path_handle = opendir(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'fixtures' . DS);
while ($original_article_name = readdir($_path_handle)) {
if (mb_strpos($original_article_name, '.') === false) {
$article_name = mb_strtolower($original_article_name);
$imported = false;
$import = false;
if ($namespace) {
if (mb_strpos(urldecode($article_name), "{$namespace}:") === 0 || mb_strpos(urldecode($article_name), "category:") === 0 && mb_strpos(urldecode($article_name), "{$namespace}:") === 9) {
$import = true;
}
} else {
if (mb_strpos(urldecode($article_name), "category:help:") === 0) {
$name_test = mb_substr(urldecode($article_name), 14);
} elseif (mb_strpos(urldecode($article_name), "category:") === 0) {
$name_test = mb_substr(urldecode($article_name), 9);
} else {
$name_test = urldecode($article_name);
}
if (mb_strpos($name_test, ':') === false) {
$import = true;
}
}
if ($import) {
if (framework\Context::isCLI()) {
\thebuggenie\core\framework\cli\Command::cli_echo('Saving ' . urldecode($original_article_name) . "\n");
}
if ($overwrite) {
Articles::getTable()->deleteArticleByName(urldecode($original_article_name));
}
if (Articles::getTable()->getArticleByName(urldecode($original_article_name)) === null) {
$content = file_get_contents(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'fixtures' . DS . $original_article_name);
Article::createNew(urldecode($original_article_name), $content, $scope, array('overwrite' => $overwrite, 'noauthor' => true));
$imported = true;
}
framework\Event::createNew('publish', 'fixture_article_loaded', urldecode($original_article_name), array('imported' => $imported))->trigger();
}
}
}
}
示例8: __
?>
</time>
<?php
echo __('%user_name posted a %comment on %article_name', array('%user_name' => get_component_html('main/userdropdown', array('user' => $notification->getTriggeredByUser())), '%comment' => link_tag(make_url('publish_article', array('article_name' => $notification->getTarget()->getTarget()->getName())) . '#comment_' . $notification->getTarget()->getID(), __('%username_posted_a comment %on_issue', array('%username_posted_a' => '', '%on_issue' => ''))), '%article_name' => link_tag(make_url('publish_article', array('article_name' => $notification->getTarget()->getTarget()->getName())), $notification->getTarget()->getTarget()->getName())));
?>
</h1>
<?php
break;
case \thebuggenie\core\entities\Notification::TYPE_ARTICLE_UPDATED:
?>
<h1>
<time><?php
echo tbg_formatTime($notification->getCreatedAt(), 20);
?>
</time>
<?php
echo __('%user_name updated %article_name', array('%user_name' => get_component_html('main/userdropdown', array('user' => $notification->getTriggeredByUser())), '%article_name' => link_tag(make_url('publish_article', array('article_name' => $notification->getTarget()->getTarget()->getName())), $notification->getTarget()->getTarget()->getName())));
?>
</h1>
<?php
break;
default:
\thebuggenie\core\framework\Event::createNew('core', '_notification_view', $notification)->trigger();
}
?>
</li>
<?php
}
?>
<?php
}
示例9: image_tag
<?php
echo image_tag('sidebar_collapse.png', array('class' => 'collapser'));
?>
<?php
echo image_tag('sidebar_expand.png', array('class' => 'expander'));
?>
</a>
</div>
<div class="container_div" style="margin: 0 0 5px 10px;">
<?php
include_component('main/myfriends');
?>
</div>
<?php
\thebuggenie\core\framework\Event::createNew('core', 'dashboard_left_bottom')->trigger();
?>
</td>
<td class="main_area" style="padding-right: 5px; padding-top: 0;">
<?php
\thebuggenie\core\framework\Event::createNew('core', 'dashboard_main_top')->trigger();
?>
<?php
include_component($dashboard->getLayout(), compact('dashboard'));
?>
<?php
\thebuggenie\core\framework\Event::createNew('core', 'dashboard_main_bottom')->trigger();
?>
</td>
</tr>
</table>
示例10: performAction
/**
* Performs an action.
*
* @param $action
* @param string $module Name of the action module
* @param string $method Name of the action method to run
*
* @return bool
* @throws \Exception
*/
public static function performAction($action, $module, $method)
{
// Set content variable
$content = null;
// Set the template to be used when rendering the html (or other) output
$templateBasePath = self::isInternalModule($module) ? THEBUGGENIE_INTERNAL_MODULES_PATH : THEBUGGENIE_MODULES_PATH;
$templatePath = $templateBasePath . $module . DS . 'templates' . DS;
$actionClassName = get_class($action);
$actionToRunName = 'run' . ucfirst($method);
$preActionToRunName = 'pre' . ucfirst($method);
// Set up the response object, responsible for controlling any output
self::getResponse()->setPage(self::getRouting()->getCurrentRouteName());
self::getResponse()->setTemplate(mb_strtolower($method) . '.' . self::getRequest()->getRequestedFormat() . '.php');
self::getResponse()->setupResponseContentType(self::getRequest()->getRequestedFormat());
self::setCurrentProject(null);
// Run the specified action method set if it exists
if (method_exists($action, $actionToRunName)) {
// Turning on output buffering
ob_start('mb_output_handler');
ob_implicit_flush(0);
if (self::getRouting()->isCurrentRouteCSRFenabled()) {
// If the csrf check fails, don't proceed
if (!self::checkCSRFtoken()) {
return true;
}
}
if (self::$_debug_mode) {
$time = explode(' ', microtime());
$pretime = $time[1] + $time[0];
}
if ($content === null) {
Logging::log('Running main pre-execute action');
// Running any overridden preExecute() method defined for that module
// or the default empty one provided by \thebuggenie\core\framework\Action
if ($pre_action_retval = $action->preExecute(self::getRequest(), $method)) {
$content = ob_get_clean();
Logging::log('preexecute method returned something, skipping further action');
if (self::$_debug_mode) {
$visited_templatename = "{$actionClassName}::preExecute()";
}
}
}
if ($content === null) {
$action_retval = null;
if (self::getResponse()->getHttpStatus() == 200) {
// Checking for and running action-specific preExecute() function if
// it exists
if (method_exists($action, $preActionToRunName)) {
Logging::log('Running custom pre-execute action');
$action->{$preActionToRunName}(self::getRequest(), $method);
}
// Running main route action
Logging::log('Running route action ' . $actionToRunName . '()');
if (self::$_debug_mode) {
$time = explode(' ', microtime());
$action_pretime = $time[1] + $time[0];
}
$action_retval = $action->{$actionToRunName}(self::getRequest());
if (self::$_debug_mode) {
$time = explode(' ', microtime());
$action_posttime = $time[1] + $time[0];
self::visitPartial("{$actionClassName}::{$actionToRunName}()", $action_posttime - $action_pretime);
}
}
if (self::getResponse()->getHttpStatus() == 200 && $action_retval) {
// If the action returns *any* output, we're done, and collect the
// output to a variable to be outputted in context later
$content = ob_get_clean();
Logging::log('...done');
} elseif (!$action_retval) {
// If the action doesn't return any output (which it usually doesn't)
// we continue on to rendering the template file for that specific action
Logging::log('...done');
Logging::log('Displaying template');
// Check to see if we have a translated version of the template
if ($method == 'notFound' && $module == 'main') {
$templateName = $templatePath . self::getResponse()->getTemplate();
} elseif (!self::isReadySetup() || ($templateName = self::getI18n()->hasTranslatedTemplate(self::getResponse()->getTemplate())) === false) {
// Check to see if any modules provide an alternate template
$event = Event::createNew('core', "self::performAction::renderTemplate")->triggerUntilProcessed(array('class' => $actionClassName, 'action' => $actionToRunName));
if ($event->isProcessed()) {
$templateName = $event->getReturnValue();
}
// Check to see if the template has been changed, and whether it's in a
// different module, specified by "module/templatename"
if (mb_strpos(self::getResponse()->getTemplate(), '/')) {
$newPath = explode('/', self::getResponse()->getTemplate());
$templateName = self::isInternalModule($newPath[0]) ? THEBUGGENIE_INTERNAL_MODULES_PATH : THEBUGGENIE_MODULES_PATH;
$templateName .= $newPath[0] . DS . 'templates' . DS . $newPath[1] . '.' . self::getRequest()->getRequestedFormat() . '.php';
} else {
//.........这里部分代码省略.........
示例11: testCreateNew
/**
* @covers \thebuggenie\core\framework\Event::__construct
* @covers \thebuggenie\core\framework\Event::createNew
*/
public function testCreateNew()
{
$event = \thebuggenie\core\framework\Event::createNew('modulename', 'identifier', 'subject', array('param1' => 1, 'param2' => 2), array('listitem1', 'listitem2'));
$this->assertInstanceOf('\\thebuggenie\\core\\framework\\Event', $event);
return $event;
}
示例12: include_component
</span></a>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php
if (\thebuggenie\core\framework\Settings::isOpenIDavailable()) {
?>
<?php
include_component('main/openidbuttons');
}
\thebuggenie\core\framework\Event::createNew('core', 'login_form_pane')->trigger(array_merge(array('selected_tab' => $selected_tab), $options));
if (\thebuggenie\core\framework\Settings::isRegistrationAllowed()) {
?>
<div style="text-align: center;" id="registration-button-container" class="logindiv login_button_container registration_button_container active">
<fieldset style="border: 0; border-top: 1px dotted rgba(0, 0, 0, 0.3); padding: 5px 100px; width: 100px; margin: 5px auto 0 auto;">
<legend style="text-align: center; width: 100%; background-color: transparent;"><?php
echo __('%login or %signup', array('%login' => '', '%signup' => ''));
?>
</legend>
</fieldset>
<a href="javascript:void(0);" id="create-account-button" onclick="$('register').addClassName('active');$('registration-button-container').removeClassName('active');$('regular_login_container').removeClassName('active');$('openid_container').removeClassName('active');"><?php
echo __('Create an account');
?>
</a>
</div>
<?php
示例13: link_tag
}
?>
</div>
<div style="clear: both;">
<?php
if (!$team->isOndemand()) {
?>
<?php
echo link_tag(make_url('team_dashboard', array('team_id' => $team->getID())), __('Show team dashboard'));
?>
<br>
<?php
}
?>
<?php
\thebuggenie\core\framework\Event::createNew('core', 'teamactions_bottom', $team)->trigger();
?>
</div>
</div>
<div style="text-align: right; padding: 3px; font-size: 9px;"><a href="javascript:void(0);" onclick="$('team_<?php
echo $team->getID() . "_" . $rnd_no;
?>
').toggle();$('team_<?php
echo $team->getID() . "_" . $rnd_no;
?>
').previous().toggleClassName('button-pressed')"><?php
echo __('Close this menu');
?>
</a></div>
</div>
</div>
示例14: getTypes
public static function getTypes()
{
$types = array();
$types[self::STATUS] = '\\thebuggenie\\core\\entities\\Status';
$types[self::PRIORITY] = '\\thebuggenie\\core\\entities\\Priority';
$types[self::CATEGORY] = '\\thebuggenie\\core\\entities\\Category';
$types[self::SEVERITY] = '\\thebuggenie\\core\\entities\\Severity';
$types[self::REPRODUCABILITY] = '\\thebuggenie\\core\\entities\\Reproducability';
$types[self::RESOLUTION] = '\\thebuggenie\\core\\entities\\Resolution';
$types[self::ACTIVITYTYPE] = '\\thebuggenie\\core\\entities\\ActivityType';
$types = \thebuggenie\core\framework\Event::createNew('core', 'Datatype::getTypes', null, array(), $types)->trigger()->getReturnList();
return $types;
}
示例15: image_tag
?>
_link').show();$('<?php
echo $customdatatype->getKey();
?>
_additional_div').hide();$('<?php
echo $customdatatype->getKey();
?>
_id_additional').setValue(0);"><?php
echo image_tag('undo.png', array('style' => 'float: none; margin-left: 5px;'));
?>
</a>
<?php
}
?>
</div>
</li>
<?php
}
?>
<?php
\thebuggenie\core\framework\Event::createNew('core', 'reportissue.listfields')->trigger();
?>
</ul>
<div style="clear: both;"> </div>
</div>
</div>
<?php
}
?>
</form>