コード例 #1
0
 protected function _parse_mention($matches)
 {
     $user = \thebuggenie\core\entities\tables\Users::getTable()->getByUsername($matches[1]);
     if ($user instanceof \thebuggenie\core\entities\User) {
         $output = framework\Action::returnComponentHTML('main/userdropdown_inline', array('user' => $matches[1], 'displayname' => $matches[0]));
         $this->mentions[$user->getID()] = $user;
     } else {
         $output = $matches[0];
     }
     return $output;
 }
コード例 #2
0
ファイル: Mailing.php プロジェクト: RTechSoft/thebuggenie
    public function getEmailTemplates($template, $parameters = array())
    {
        if (!array_key_exists('module', $parameters)) {
            $parameters['module'] = $this;
        }
        $message_plain = framework\Action::returnComponentHTML("mailing/{$template}.text", $parameters);
        $html = framework\Action::returnComponentHTML("mailing/{$template}.html", $parameters);
        $styles = file_get_contents(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'fixtures' . DS . framework\Settings::getThemeName() . '.css');
        $message_html = <<<EOT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
        <head>
            <meta http-equiv=Content-Type content="text/html; charset=utf-8">
            <style type="text/css">
                {$styles}
            </style>
        </head>
        <body>
            {$html}
        </body>
    </html>
EOT;
        return array($message_plain, $message_html);
    }
コード例 #3
0
 protected function _parse_add_toc($matches)
 {
     if (framework\Context::isCLI()) {
         return '';
     }
     return framework\Action::returnComponentHTML('publish/toc', array('toc' => $this->toc));
 }
コード例 #4
0
ファイル: Main.php プロジェクト: pkdevboxy/thebuggenie
 /**
  * Milestone actions
  *
  * @Route(url="/milestone/:milestone_id/*")
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runMilestone(framework\Request $request)
 {
     $milestone_id = $request['milestone_id'] ? $request['milestone_id'] : null;
     $milestone = new \thebuggenie\core\entities\Milestone($milestone_id);
     try {
         if (!$this->getUser()->canManageProject($this->selected_project) || !$this->getUser()->canManageProjectReleases($this->selected_project)) {
             throw new \Exception($this->getI18n()->__("You don't have access to modify milestones"));
         }
         switch (true) {
             case $request->isDelete():
                 $milestone->delete();
                 $no_milestone = new \thebuggenie\core\entities\Milestone(0);
                 $no_milestone->setProject($milestone->getProject());
                 return $this->renderJSON(array('issue_count' => $no_milestone->countIssues(), 'hours' => $no_milestone->getHoursEstimated(), 'points' => $no_milestone->getPointsEstimated()));
             case $request->isPost():
                 $this->_saveMilestoneDetails($request, $milestone);
                 $board = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
                 if ($request->hasParameter('issues') && $request['include_selected_issues']) {
                     \thebuggenie\core\entities\tables\Issues::getTable()->assignMilestoneIDbyIssueIDs($milestone->getID(), $request['issues']);
                 }
                 $message = framework\Context::getI18n()->__('Milestone saved');
                 return $this->renderJSON(array('message' => $message, 'component' => $this->getComponentHTML('agile/milestonebox', array('milestone' => $milestone, 'board' => $board)), 'milestone_id' => $milestone->getID()));
             default:
                 return $this->renderJSON(array('content' => framework\Action::returnComponentHTML('agile/milestonebox', array('milestone' => $milestone)), 'milestone_id' => $milestone->getID(), 'milestone_name' => $milestone->getName(), 'milestone_order' => array_keys($milestone->getProject()->getMilestonesForRoadmap())));
         }
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $e->getMessage()));
     }
 }
コード例 #5
0
ファイル: ui.inc.php プロジェクト: AzerothShard/thebuggenie
/**
 * Return a rendered component with specified parameters
 *
 * @param string    $component    name of component to load, or module/component to load
 * @param array     $params      key => value pairs of parameters for the template
 */
function get_component_html($component, $params = array())
{
    return Action::returnComponentHTML($component, $params);
}
コード例 #6
0
 /**
  * Listen to milestone save event and return correct agile component
  *
  * @Listener(module="project", identifier="runMilestone::post")
  *
  * @param \thebuggenie\core\framework\Event $event
  */
 public function milestoneSave(framework\Event $event)
 {
     $board = entities\AgileBoard::getB2DBTable()->selectById(framework\Context::getRequest()->getParameter('board_id'));
     if ($board instanceof entities\AgileBoard) {
         $component = framework\Action::returnComponentHTML('agile/milestonebox', array('milestone' => $event->getSubject(), 'board' => $board, 'include_counts' => true));
         $event->setReturnValue($component);
         $event->setProcessed();
     }
 }