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


PHP Context::loadLibrary方法代码示例

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


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

示例1: getTextColor

 public function getTextColor()
 {
     if (!\thebuggenie\core\framework\Context::isCLI()) {
         \thebuggenie\core\framework\Context::loadLibrary('ui');
     }
     $rgb = hex2rgb($this->_itemdata);
     return 0.299 * $rgb['red'] + 0.587 * $rgb['green'] + 0.114 * $rgb['blue'] > 170 ? '#333' : '#FFF';
 }
开发者ID:shoreless-Limited,项目名称:thebuggenie,代码行数:8,代码来源:Status.php

示例2: runIssueEditTimeSpent

 public function runIssueEditTimeSpent(framework\Request $request)
 {
     try {
         $entry_id = $request['entry_id'];
         $spenttime = $entry_id ? tables\IssueSpentTimes::getTable()->selectById($entry_id) : new entities\IssueSpentTime();
         if ($issue_id = $request['issue_id']) {
             $issue = entities\Issue::getB2DBTable()->selectById($issue_id);
         } else {
             throw new \Exception('no issue');
         }
         framework\Context::loadLibrary('common');
         $spenttime->editOrAdd($issue, $this->getUser(), array_only_with_default($request->getParameters(), array_merge(array('timespent_manual', 'timespent_specified_type', 'timespent_specified_value', 'timespent_activitytype', 'timespent_comment', 'edited_at'), \thebuggenie\core\entities\common\Timeable::getUnitsWithPoints())));
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('edited' => 'error', 'error' => $e->getMessage()));
     }
     $this->return_data = array('edited' => 'ok');
 }
开发者ID:LogosLabs,项目名称:thebuggenie-module-api,代码行数:18,代码来源:Project.php

示例3: _parseText

 protected function _parseText($options = array())
 {
     $options = array_merge($options, $this->options);
     framework\Context::loadLibrary('common');
     $output = "";
     $text = $this->text;
     if (!isset($this->options['plain'])) {
         $this->list_level_types = array();
         $this->list_level = 0;
         $this->deflist = false;
         $this->ignore_newline = false;
         $text = preg_replace_callback('/<(nowiki|pre)>(.*)<\\/(\\1)>(?!<\\/(\\1)>)/ismU', array($this, "_parse_save_nowiki"), $text);
         $text = preg_replace_callback('/[\\{]{3,3}([\\d|\\w|\\|]*)[\\}]{3,3}/ismU', array($this, "_parse_insert_variables"), $text);
         $text = preg_replace_callback('/(?<!\\{)[\\{]{2,2}([^{^}.]*)[\\}]{2,2}(?!\\})/ismU', array($this, "_parse_insert_template"), $text);
         if (isset($this->options['included'])) {
             $text = preg_replace_callback('/<noinclude>(.+?)<\\/noinclude>(?!<\\/noinclude>)/ism', array($this, "_parse_remove_noinclude"), $text);
             $text = preg_replace_callback('/<includeonly>(.+?)<\\/includeonly>(?!<\\/includeonly>)/ism', array($this, "_parse_preserve_includeonly"), $text);
             return $text;
         }
         if (!isset($this->options['included'])) {
             $text = preg_replace_callback('/<includeonly>(.+?)<\\/includeonly>(?!<\\/includeonly>)/ism', array($this, "_parse_remove_includeonly"), $text);
             $text = preg_replace_callback('/<noinclude>(.+?)<\\/noinclude>(?!<\\/noinclude>)/ism', array($this, "_parse_preserve_noinclude"), $text);
         }
         $text = preg_replace_callback('/<source((?:\\s+[^\\s]+=".*")*)>\\s*?(.+)\\s*?<\\/source>/ismU', array($this, "_parse_save_code"), $text);
         // Thanks to Mike Smith (scgtrp) for the above regexp
         $text = tbg_decodeUTF8($text, true);
         $text = preg_replace_callback('/&lt;(strike|u|pre|tt|s|del|ins|u|blockquote|div|span|font|sub|sup)(\\s.*)?&gt;(.*)&lt;\\/(\\1)&gt;/ismU', array($this, '_parse_allowed_tags'), $text);
         $text = str_replace('&lt;br&gt;', '<br>', $text);
         $lines = explode("\n", $text);
         foreach ($lines as $line) {
             if (mb_substr($line, -1) == "\r") {
                 $line = mb_substr($line, 0, -1);
             }
             $output .= $this->_parse_line($line, $options);
         }
         // Check if we need to close any tags in case the list items, etc were the last line
         if ($this->list_level > 0) {
             $output .= $this->_parse_list(false, true);
         }
         if ($this->deflist) {
             $output .= $this->_parse_definitionlist(false, true);
         }
         if ($this->preformat) {
             $output .= $this->_parse_preformat(false, true);
         }
         if ($this->quote) {
             $output .= $this->_parse_quote(false, true);
         }
         $output .= $this->_parse_tablecloser(false);
         $this->nowikis = array_reverse($this->nowikis);
         $this->codeblocks = array_reverse($this->codeblocks);
         $this->elinks = array_reverse($this->elinks);
         if (!array_key_exists('ignore_toc', $options)) {
             $output = preg_replace_callback('/\\{\\{TOC\\}\\}/', array($this, "_parse_add_toc"), $output);
         } else {
             $output = str_replace('{{TOC}}', '', $output);
         }
         $output = preg_replace_callback('/~~~NOWIKI~~~/i', array($this, "_parse_restore_nowiki"), $output);
         if (!isset($options['no_code_highlighting'])) {
             $output = preg_replace_callback('/~~~CODE~~~/Ui', array($this, "_parse_restore_code"), $output);
         }
         $output = preg_replace_callback('/~~~ILINK~~~/i', array($this, "_parse_restore_ilink"), $output);
         $output = preg_replace_callback('/~~~ELINK~~~/i', array($this, "_parse_restore_elink"), $output);
     } else {
         $text = nl2br(tbg_decodeUTF8($text, true));
         $text = preg_replace_callback(self::getIssueRegex(), array($this, '_parse_issuelink'), $text);
         $text = preg_replace_callback(self::getMentionsRegex(), array($this, '_parse_mention'), $text);
         $output = $text;
     }
     return $output;
 }
开发者ID:underblaze,项目名称:thebuggenie-4.1.0,代码行数:71,代码来源:TextParser.php

示例4: do_execute

 public function do_execute()
 {
     $this->cliEcho('Showing detailed information about ');
     $this->cliEcho($this->getProvidedArgument('project_key'), 'green');
     $this->cliEcho(' issue ');
     $print_issue_number = $this->getProvidedArgument('issue_number');
     if (is_numeric($print_issue_number)) {
         $print_issue_number = '#' . $print_issue_number;
     }
     $this->cliEcho($print_issue_number, 'yellow');
     $this->cliEcho(' on ');
     $this->cliEcho($this->_getCurrentRemoteServer(), 'white', 'bold');
     $this->cliEcho("\n");
     $url_options = array('project_key' => $this->project_key, 'issue_no' => $this->issue_number, 'format' => 'json');
     $this->cliEcho("\n");
     $issue = $this->getRemoteResponse($this->getRemoteURL('api_viewissue', $url_options));
     \thebuggenie\core\framework\Context::loadLibrary('common');
     $this->cliEcho($print_issue_number, 'green', 'bold');
     $this->cliEcho(" - ");
     $state = $issue->state == \thebuggenie\core\entities\Issue::STATE_OPEN ? 'OPEN' : 'CLOSED';
     $this->cliEcho("[{$state}] ", 'cyan');
     $this->cliEcho(html_entity_decode($issue->title), 'white', 'bold');
     $this->cliEcho("\n");
     $this->cliEcho("State: ", 'white', 'bold');
     $this->cliEcho($state);
     $this->cliEcho("\n");
     $this->cliEcho("Posted: ", 'white', 'bold');
     $this->cliEcho(tbg_formatTime($issue->created_at, 21, true, true) . ' (' . $issue->created_at . ')');
     $this->cliEcho("\n");
     $this->cliEcho("Posted by: ", 'white', 'bold');
     if ($issue->posted_by) {
         $this->cliEcho($issue->posted_by->name);
     } else {
         $this->cliEcho('-');
     }
     $this->cliEcho("\n");
     $this->cliEcho("Updated: ", 'white', 'bold');
     $this->cliEcho(tbg_formatTime($issue->updated_at, 21, true, true) . ' (' . $issue->updated_at . ')');
     $this->cliEcho("\n");
     $this->cliEcho("Assigned to: ", 'white', 'bold');
     if ($issue->assignee) {
         $this->cliEcho($issue->assignee->name);
     } else {
         $this->cliEcho('-');
     }
     $this->cliEcho("\n");
     $this->cliEcho("Status: ", 'white', 'bold');
     if ($issue->status) {
         $this->cliEcho($issue->status->name);
     } else {
         $this->cliEcho('-');
     }
     $this->cliEcho("\n");
     foreach ($issue->visible_fields as $field => $details) {
         $name = ucfirst(str_replace('_', ' ', $field));
         $this->cliEcho("{$name}: ", 'white', 'bold');
         if (isset($issue->{$field})) {
             if ($field == 'estimated_time' || $field == 'spent_time') {
                 if (isset($issue->{$field}->points)) {
                     $this->cliEcho($issue->{$field}->points . 'p, ' . $issue->{$field}->hours . 'h, ' . $issue->{$field}->days . 'd, ' . $issue->{$field}->weeks . 'w, ' . $issue->{$field}->months . 'mo');
                 } else {
                     $this->cliEcho('-');
                 }
             } else {
                 if (is_object($issue->{$field})) {
                     $this->cliEcho($issue->{$field}->name);
                 } else {
                     $this->cliEcho($issue->{$field});
                 }
             }
         } else {
             $this->cliEcho('-');
         }
         $this->cliEcho("\n");
     }
     if ($this->getProvidedArgument('include_comments', 'no') == 'yes') {
         $this->cliEcho("\n");
         $this->cliEcho("Comments: \n", 'white', 'bold');
         if (count($issue->comments) > 0) {
             foreach ($issue->comments as $comment) {
                 if ($comment->system_comment && $this->getProvidedArgument('include_system_comments', 'no') != 'yes') {
                     continue;
                 }
                 $this->cliEcho('Comment #' . $comment->comment_number, 'yellow', 'bold');
                 $this->cliEcho("\n");
                 $this->cliEcho('Posted by: ', 'white', 'bold');
                 if ($comment->posted_by) {
                     $this->cliEcho($comment->posted_by->name);
                 } else {
                     $this->cliEcho("Unknown user");
                 }
                 $this->cliEcho("\n");
                 $this->cliEcho('Posted: ', 'white', 'bold');
                 $this->cliEcho(tbg_formatTime($comment->created_at, 21, true, true) . ' (' . $comment->created_at . ')');
                 $this->cliEcho("\n");
                 $this->cliEcho('Comment: ', 'white', 'bold');
                 $this->cliEcho($comment->content);
                 $this->cliEcho("\n");
                 $this->cliEcho('----------', 'white', 'bold');
                 $this->cliEcho("\n\n");
//.........这里部分代码省略.........
开发者ID:LogosLabs,项目名称:thebuggenie-module-api,代码行数:101,代码来源:ShowIssue.php

示例5: link_tag

<?php

\thebuggenie\core\framework\Context::loadLibrary('ui');
?>
<div id="project_box_<?php 
echo $project->getID();
?>
" class="greybox" style="margin: 10px 0px 10px 0px; position: relative;">
    <div style="padding: 3px; font-size: 14px;">
        <?php 
if ($project->isArchived()) {
    ?>
            <span class="faded_out"><?php 
    echo __('ARCHIVED');
    ?>
 </span>
        <?php 
}
?>
            <strong><?php 
echo link_tag(make_url('project_dashboard', array('project_key' => $project->getKey())), $project->getName());
?>
</strong>&nbsp;<span class="project_key" style="position: relative;">(<div class="tooltip leftie"><?php 
echo __('This is the project key, used in most places when accessing the project');
?>
</div><?php 
echo $project->getKey();
?>
)</span>
        <?php 
if ($project->usePrefix()) {
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:31,代码来源:_projectbox.inc.php

示例6: getDateString

 public function getDateString()
 {
     framework\Context::loadLibrary('common');
     $i18n = framework\Context::getI18n();
     if ($this->hasStartingDate() && $this->hasScheduledDate()) {
         if ($this->getStartingDate() < NOW && $this->getScheduledDate() < NOW) {
             return $i18n->__('%milestone_name (started %start_date - ended %end_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true), '%end_date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         } elseif ($this->getStartingDate() < NOW && $this->getScheduledDate() > NOW) {
             return $i18n->__('%milestone_name (started %start_date - ends %end_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true), '%end_date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         } elseif ($this->getStartingDate() > NOW) {
             return $i18n->__('%milestone_name (starts %start_date - ended %end_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true), '%end_date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         }
     } elseif ($this->hasStartingDate()) {
         if ($this->getStartingDate() < NOW) {
             return $i18n->__('%milestone_name (started %start_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true)));
         } else {
             return $i18n->__('%milestone_name (starts %start_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true)));
         }
     } elseif ($this->hasScheduledDate()) {
         if ($this->getScheduledDate() < NOW) {
             return $i18n->__('%milestone_name (released: %date)', array('%milestone_name' => '', '%date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         } else {
             return $i18n->__('%milestone_name (will be released: %date)', array('%milestone_name' => '', '%date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         }
     } elseif ($this->hasReachedDate()) {
         return $i18n->__('%milestone_name (reached: %date)', array('%milestone_name' => '', '%date' => tbg_formatTime($this->getReachedDate(), 23, true, true)));
     }
     return $i18n->__('Not scheduled');
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:29,代码来源:Milestone.php

示例7: runCheckIncomingAccount

 /**
  * Check incoming email accounts for incoming emails
  *
  * @Route(url="/mailing/incoming_account/:account_id/check", name="check_account")
  * @param \thebuggenie\core\framework\Request $request
  * @return type
  * @throws \Exception
  */
 public function runCheckIncomingAccount(framework\Request $request)
 {
     framework\Context::loadLibrary('common');
     if ($account_id = $request['account_id']) {
         try {
             $account = new \thebuggenie\modules\mailing\entities\IncomingEmailAccount($account_id);
             try {
                 if (!function_exists('imap_open')) {
                     throw new \Exception($this->getI18n()->__('The php imap extension is not installed'));
                 }
                 framework\Context::getModule('mailing')->processIncomingEmailAccount($account);
             } catch (\Exception $e) {
                 $this->getResponse()->setHttpStatus(400);
                 return $this->renderJSON(array('error' => $e->getMessage()));
             }
             return $this->renderJSON(array('account_id' => $account->getID(), 'time' => tbg_formatTime($account->getTimeLastFetched(), 6), 'count' => $account->getNumberOfEmailsLastFetched()));
         } catch (\Exception $e) {
             $this->getResponse()->setHttpStatus(400);
             return $this->renderJSON(array('error' => $this->getI18n()->__('This is not a valid mailing account')));
         }
     } else {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $this->getI18n()->__('This is not a valid mailing account')));
     }
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:33,代码来源:Main.php

示例8: preExecute

 /**
  * Pre-execute function
  *
  * @param framework\Request     $request
  * @param string        $action
  */
 public function preExecute(framework\Request $request, $action)
 {
     // forward 403 if you're not allowed here
     if ($request->isAjaxCall() == false) {
         $this->forward403unless(framework\Context::getUser()->canAccessConfigurationPage());
     }
     $this->access_level = $this->getAccessLevel(framework\Settings::CONFIGURATION_SECTION_IMPORT, 'core');
     if (!$request->isAjaxCall()) {
         $this->getResponse()->setPage('config');
         framework\Context::loadLibrary('ui');
         $this->getResponse()->addBreadcrumb(framework\Context::getI18n()->__('Configure %thebuggenie_name', array('%thebuggenie_name' => framework\Settings::getSiteHeaderName())), framework\Context::getRouting()->generate('configure'), $this->getResponse()->getPredefinedBreadcrumbLinks('configure'));
     }
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:19,代码来源:Main.php

示例9: getArticleLinkTag

 public function getArticleLinkTag($matches, $parser)
 {
     $article_link = $matches[0];
     $parser->addInternalLinkOccurrence($article_link);
     $article_name = $this->getSpacedName($matches[0]);
     if (!framework\Context::isCLI()) {
         framework\Context::loadLibrary('ui');
         return link_tag(make_url('publish_article', array('article_name' => $matches[0])), $article_name);
     } else {
         return $matches[0];
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:12,代码来源:Publish.php

示例10: runSettings

 /**
  * Configure general and server settings
  *
  * @param framework\Request $request The request object
  */
 public function runSettings(framework\Request $request)
 {
     if (framework\Context::getRequest()->isPost()) {
         $this->forward403unless($this->access_level == framework\Settings::ACCESS_FULL);
         $settings = array(framework\Settings::SETTING_USER_DISPLAYNAME_FORMAT, framework\Settings::SETTING_ENABLE_GRAVATARS, framework\Settings::SETTING_IS_SINGLE_PROJECT_TRACKER, framework\Settings::SETTING_REQUIRE_LOGIN, framework\Settings::SETTING_ALLOW_REGISTRATION, framework\Settings::SETTING_ALLOW_OPENID, framework\Settings::SETTING_USER_GROUP, framework\Settings::SETTING_RETURN_FROM_LOGIN, framework\Settings::SETTING_RETURN_FROM_LOGOUT, framework\Settings::SETTING_IS_PERMISSIVE_MODE, framework\Settings::SETTING_ALLOW_PERSONA, framework\Settings::SETTING_REGISTRATION_DOMAIN_WHITELIST, framework\Settings::SETTING_SHOW_PROJECTS_OVERVIEW, framework\Settings::SETTING_KEEP_COMMENT_TRAIL_CLEAN, framework\Settings::SETTING_TBG_NAME, framework\Settings::SETTING_TBG_NAME_HTML, framework\Settings::SETTING_DEFAULT_CHARSET, framework\Settings::SETTING_DEFAULT_LANGUAGE, framework\Settings::SETTING_SERVER_TIMEZONE, framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_LANGUAGE, framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL, framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_NUMBERING, framework\Settings::SETTING_PREVIEW_COMMENT_IMAGES, framework\Settings::SETTING_HEADER_LINK, framework\Settings::SETTING_MAINTENANCE_MESSAGE, framework\Settings::SETTING_MAINTENANCE_MODE, framework\Settings::SETTING_ELEVATED_LOGIN_DISABLED, framework\Settings::SETTING_NOTIFICATION_POLL_INTERVAL);
         foreach ($settings as $setting) {
             if (framework\Context::getRequest()->getParameter($setting) !== null) {
                 $value = framework\Context::getRequest()->getParameter($setting);
                 switch ($setting) {
                     case framework\Settings::SETTING_TBG_NAME:
                         $value = framework\Context::getRequest()->getParameter($setting, null, false);
                         break;
                     case framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL:
                         if (!is_numeric($value) || $value < 1) {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Please provide a valid setting for highlighting interval')));
                         }
                         break;
                     case framework\Settings::SETTING_DEFAULT_CHARSET:
                         framework\Context::loadLibrary('common');
                         if ($value && !tbg_check_syntax($value, "CHARSET")) {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Please provide a valid setting for charset')));
                         }
                         break;
                     case framework\Settings::SETTING_NOTIFICATION_POLL_INTERVAL:
                         if (!ctype_digit($value)) {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('error' => framework\Context::getI18n()->__('Please provide a valid setting for notification poll interval')));
                         }
                 }
                 framework\Settings::saveSetting($setting, $value);
             }
         }
         return $this->renderJSON(array('title' => framework\Context::getI18n()->__('All settings saved')));
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:42,代码来源:Main.php

示例11: runCaptcha

 /**
  * Generate captcha picture
  *
  * @Route(name="captcha", url="/captcha/*")
  * @AnonymousRoute
  *
  * @param \thebuggenie\core\framework\Request $request The request object
  * @global array $_SESSION['activation_number'] The session captcha activation number
  */
 public function runCaptcha(framework\Request $request)
 {
     framework\Context::loadLibrary('ui');
     if (!function_exists('imagecreatetruecolor')) {
         return $this->return404();
     }
     $this->getResponse()->setContentType('image/png');
     $this->getResponse()->setDecoration(\thebuggenie\core\framework\Response::DECORATE_NONE);
     $chain = str_split($_SESSION['activation_number'], 1);
     $size = getimagesize(THEBUGGENIE_PATH . DS . 'themes' . DS . framework\Settings::getThemeName() . DS . 'numbers/0.png');
     $captcha = imagecreatetruecolor($size[0] * sizeof($chain), $size[1]);
     foreach ($chain as $n => $number) {
         $pic = imagecreatefrompng(THEBUGGENIE_PATH . DS . 'themes' . DS . framework\Settings::getThemeName() . DS . "numbers/{$number}.png");
         imagecopymerge($captcha, $pic, $size[0] * $n, 0, 0, 0, imagesx($pic), imagesy($pic), 100);
         imagedestroy($pic);
     }
     imagepng($captcha);
     imagedestroy($captcha);
     return true;
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:29,代码来源:Main.php

示例12: runPoll

 /**
  * Poller for the planning page
  *
  * @Route(url="/boards/:board_id/poll/:mode")
  *
  * @param framework\Request $request
  */
 public function runPoll(framework\Request $request)
 {
     $this->forward403unless($this->_checkProjectPageAccess('project_planning'));
     $last_refreshed = $request['last_refreshed'];
     $board = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
     $search_object = $board->getBacklogSearchObject();
     if ($search_object instanceof \thebuggenie\core\entities\SavedSearch) {
         $search_object->setFilter('last_updated', \thebuggenie\core\entities\SearchFilter::createFilter('last_updated', array('o' => \b2db\Criteria::DB_GREATER_THAN_EQUAL, 'v' => $last_refreshed - 2)));
     }
     if ($request['mode'] == 'whiteboard') {
         $milestone_id = $request['milestone_id'];
         $ids = \thebuggenie\core\entities\tables\Issues::getTable()->getUpdatedIssueIDsByTimestampAndProjectIDAndMilestoneID($last_refreshed - 2, $this->selected_project->getID(), $milestone_id);
     } else {
         $ids = \thebuggenie\core\entities\tables\Issues::getTable()->getUpdatedIssueIDsByTimestampAndProjectIDAndIssuetypeID($last_refreshed - 2, $this->selected_project->getID());
         $epic_ids = $board->getEpicIssuetypeID() ? \thebuggenie\core\entities\tables\Issues::getTable()->getUpdatedIssueIDsByTimestampAndProjectIDAndIssuetypeID($last_refreshed - 2, $this->selected_project->getID(), $board->getEpicIssuetypeID()) : array();
     }
     $backlog_ids = array();
     if ($search_object instanceof \thebuggenie\core\entities\SavedSearch) {
         foreach ($search_object->getIssues(true) as $backlog_issue) {
             foreach ($ids as $id_issue) {
                 if ($id_issue['issue_id'] == $backlog_issue->getID()) {
                     continue 2;
                 }
             }
             $backlog_ids[] = array('issue_id' => $backlog_issue->getID(), 'last_updated' => $backlog_issue->getLastUpdatedTime());
         }
     }
     \thebuggenie\core\framework\Context::loadLibrary('ui');
     $whiteboard_url = make_url('agile_whiteboardissues', array('project_key' => $board->getProject()->getKey(), 'board_id' => $board->getID()));
     return $this->renderJSON(compact('ids', 'backlog_ids', 'epic_ids', 'milestone_id', 'whiteboard_url'));
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:38,代码来源:Main.php

示例13: runBulkUpdateIssues

 public function runBulkUpdateIssues(framework\Request $request)
 {
     $issue_ids = $request['issue_ids'];
     $options = array('issue_ids' => array_values($issue_ids));
     framework\Context::loadLibrary('common');
     $options['last_updated'] = tbg_formatTime(time(), 20);
     if (!empty($issue_ids)) {
         $options['bulk_action'] = $request['bulk_action'];
         switch ($request['bulk_action']) {
             case 'assign_milestone':
                 $milestone = null;
                 if ($request['milestone'] == 'new') {
                     $milestone = new entities\Milestone();
                     $milestone->setProject(framework\Context::getCurrentProject());
                     $milestone->setName($request['milestone_name']);
                     $milestone->save();
                     $options['milestone_url'] = framework\Context::getRouting()->generate('agile_milestone', array('project_key' => $milestone->getProject()->getKey(), 'milestone_id' => $milestone->getID()));
                 } elseif ($request['milestone']) {
                     $milestone = new entities\Milestone($request['milestone']);
                 }
                 $milestone_id = $milestone instanceof entities\Milestone ? $milestone->getID() : null;
                 foreach (array_keys($issue_ids) as $issue_id) {
                     if (is_numeric($issue_id)) {
                         $issue = new entities\Issue($issue_id);
                         $issue->setMilestone($milestone_id);
                         $issue->save();
                     }
                 }
                 $options['milestone_id'] = $milestone_id;
                 $options['milestone_name'] = $milestone_id ? $milestone->getName() : '-';
                 break;
             case 'set_status':
                 if (is_numeric($request['status'])) {
                     $status = new entities\Status($request['status']);
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new entities\Issue($issue_id);
                             $issue->setStatus($status->getID());
                             $issue->save();
                         }
                     }
                     $options['status'] = array('color' => $status->getColor(), 'name' => $status->getName(), 'id' => $status->getID());
                 }
                 break;
             case 'set_severity':
                 if (is_numeric($request['severity'])) {
                     $severity = $request['severity'] ? new entities\Severity($request['severity']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new entities\Issue($issue_id);
                             $severity_id = $severity instanceof entities\Severity ? $severity->getID() : 0;
                             $issue->setSeverity($severity_id);
                             $issue->save();
                         }
                     }
                     $options['severity'] = array('name' => $severity instanceof entities\Severity ? $severity->getName() : '-', 'id' => $severity instanceof entities\Severity ? $severity->getID() : 0);
                 }
                 break;
             case 'set_resolution':
                 if (is_numeric($request['resolution'])) {
                     $resolution = $request['resolution'] ? new entities\Resolution($request['resolution']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new entities\Issue($issue_id);
                             $resolution_id = $resolution instanceof entities\Resolution ? $resolution->getID() : 0;
                             $issue->setResolution($resolution_id);
                             $issue->save();
                         }
                     }
                     $options['resolution'] = array('name' => $resolution instanceof entities\Resolution ? $resolution->getName() : '-', 'id' => $resolution instanceof entities\Resolution ? $resolution->getID() : 0);
                 }
                 break;
             case 'set_priority':
                 if (is_numeric($request['priority'])) {
                     $priority = $request['priority'] ? new entities\Priority($request['priority']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new entities\Issue($issue_id);
                             $priority_id = $priority instanceof entities\Priority ? $priority->getID() : 0;
                             $issue->setPriority($priority_id);
                             $issue->save();
                         }
                     }
                     $options['priority'] = array('name' => $priority instanceof entities\Priority ? $priority->getName() : '-', 'id' => $priority instanceof entities\Priority ? $priority->getID() : 0);
                 }
                 break;
             case 'set_category':
                 if (is_numeric($request['category'])) {
                     $category = $request['category'] ? new entities\Category($request['category']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new entities\Issue($issue_id);
                             $category_id = $category instanceof entities\Category ? $category->getID() : 0;
                             $issue->setCategory($category_id);
                             $issue->save();
                         }
                     }
                     $options['category'] = array('name' => $category instanceof entities\Category ? $category->getName() : '-', 'id' => $category instanceof entities\Category ? $category->getID() : 0);
                 }
                 break;
//.........这里部分代码省略.........
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:101,代码来源:Actions.php

示例14: do_execute

 public function do_execute()
 {
     $this->cliEcho('Querying ');
     $this->cliEcho($this->_getCurrentRemoteServer(), 'white', 'bold');
     $this->cliEcho(" for list of issues ...\n\n");
     $this->cliEcho("Filters:\n", 'white', 'bold');
     $options = array('format' => 'json');
     $options["state"] = $this->getProvidedArgument("state", "open");
     $this->cliEcho("State: ");
     $this->cliEcho($options["state"], "yellow", "bold");
     $this->cliEcho("\n");
     $options["issuetype"] = $this->getProvidedArgument("issuetype", "all");
     $this->cliEcho("Issuetypes: ");
     $this->cliEcho($options["issuetype"], "yellow", "bold");
     $this->cliEcho("\n");
     $options["assigned_to"] = $this->getProvidedArgument("assigned_to", "all");
     $this->cliEcho("Assigned to: ");
     $this->cliEcho($options["assigned_to"], "yellow", "bold");
     $this->cliEcho("\n");
     $options["assigned"] = $this->getProvidedArgument("state", "all");
     $options['project_key'] = $this->getProvidedArgument('project_key');
     $response = $this->getRemoteResponse($this->getRemoteURL('project_list_issues', $options));
     $this->cliEcho("\n");
     if (!empty($response) && $response->count > 0) {
         \thebuggenie\core\framework\Context::loadLibrary('common');
         $this->cliEcho("The following {$response->count} issues were found:\n", 'white', 'bold');
         foreach ($response->issues as $issue) {
             //$this->cliEcho("ID: {$issue->id} ", 'yellow');
             if (mb_strtolower($options['state']) == 'all') {
                 $this->cliEcho($issue->state == \thebuggenie\core\entities\Issue::STATE_OPEN ? "[open] " : "[closed] ");
             }
             $this->cliEcho($issue->issue_no, 'green', 'bold');
             $this->cliEcho(" - ");
             $this->cliEcho(html_entity_decode($issue->title), 'white', 'bold');
             $this->cliEcho("\n");
             if ($this->getProvidedArgument('detailed', 'no') == 'yes') {
                 $this->cliEcho("Posted: ", 'blue', 'bold');
                 $this->cliEcho(tbg_formatTime($issue->created_at, 21));
                 $this->cliEcho(" by ");
                 $this->cliEcho($issue->posted_by, 'cyan');
                 $this->cliEcho("\n");
                 $this->cliEcho("Updated: ", 'blue', 'bold');
                 $this->cliEcho(tbg_formatTime($issue->last_updated, 21));
                 $this->cliEcho("\n");
                 $this->cliEcho("Assigned to: ", 'blue', 'bold');
                 $this->cliEcho($issue->assigned_to, 'yellow', 'bold');
                 $this->cliEcho(" | ", 'white', 'bold');
                 $this->cliEcho("Status: ", 'blue', 'bold');
                 $this->cliEcho($issue->status);
                 $this->cliEcho("\n\n");
             }
         }
         $this->cliEcho("\n");
         $this->cliEcho("If you are going to update or query any of these issues, use the \n");
         $this->cliEcho("issue number shown in front of the issue (do not include the \n");
         $this->cliEcho("issue type), ex:\n");
         $this->cliEcho("./tbg_cli", 'green');
         $this->cliEcho(" remote:update_issue projectname ");
         $this->cliEcho("300\n", 'white', 'bold');
         $this->cliEcho("./tbg_cli", 'green');
         $this->cliEcho(" remote:show_issue projectname ");
         $this->cliEcho("300\n", 'white', 'bold');
         $this->cliEcho("./tbg_cli", 'green');
         $this->cliEcho(" remote:list_transitions projectname ");
         $this->cliEcho("300\n", 'white', 'bold');
         $this->cliEcho("\nor\n");
         $this->cliEcho("./tbg_cli", 'green');
         $this->cliEcho(" remote:update_issue projectname ");
         $this->cliEcho("PREFIX-12\n", 'white', 'bold');
         $this->cliEcho("./tbg_cli", 'green');
         $this->cliEcho(" remote:show_issue projectname ");
         $this->cliEcho("PREFIX-12\n", 'white', 'bold');
         $this->cliEcho("./tbg_cli", 'green');
         $this->cliEcho(" remote:list_transitions projectname ");
         $this->cliEcho("PREFIX-12\n", 'white', 'bold');
         $this->cliEcho("\n");
         $this->cliEcho("\n");
     } else {
         $this->cliEcho("No issues available matching your filters.\n\n");
     }
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:81,代码来源:ListIssues.php

示例15: getAgileTextColor

 public function getAgileTextColor()
 {
     if (!framework\Context::isCLI()) {
         framework\Context::loadLibrary('ui');
     }
     $rgb = hex2rgb($this->_scrumcolor);
     if (!$rgb) {
         return '#333';
     }
     return 0.299 * $rgb['red'] + 0.587 * $rgb['green'] + 0.114 * $rgb['blue'] > 170 ? '#333' : '#FFF';
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:11,代码来源:Issue.php


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