Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
공백 변경 숨기기
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
텍스트 스타일
모양 변경
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
TaskHelper.php
생성일
작년
비교 결과 만료 없음
초기화
내보내기
공유
설명
0 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
326 행
복사
30 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
356 행
복사
<?php
<?php
namespace Kanboard\Helper;
namespace Kanboard\Helper;
use Kanboard\Core\Base;
use Kanboard\Core\Base;
/**
/**
* Task helpers
* Task helpers
*
*
* @package helper
* @package helper
* @author Frederic Guillot
* @author Frederic Guillot
*/
*/
class TaskHelper extends Base
class TaskHelper extends Base
{
{
/**
/**
* Local cache for project columns
* Local cache for project columns
*
*
* @access private
* @access private
* @var array
* @var array
*/
*/
private $columns = array();
private $columns = array();
public function getColors()
public function getColors()
{
{
return $this->colorModel->getList();
return $this->colorModel->getList();
}
}
public function recurrenceTriggers()
public function recurrenceTriggers()
{
{
return $this->taskRecurrenceModel->getRecurrenceTriggerList();
return $this->taskRecurrenceModel->getRecurrenceTriggerList();
}
}
public function recurrenceTimeframes()
public function recurrenceTimeframes()
{
{
return $this->taskRecurrenceModel->getRecurrenceTimeframeList();
return $this->taskRecurrenceModel->getRecurrenceTimeframeList();
}
}
public function recurrenceBasedates()
public function recurrenceBasedates()
{
{
return $this->taskRecurrenceModel->getRecurrenceBasedateList();
return $this->taskRecurrenceModel->getRecurrenceBasedateList();
}
}
public function renderTitleField(array $values, array $errors)
public function renderTitleField(array $values, array $errors)
{
{
$html = $this->helper->form->label(t('Title'), 'title', ['class="ui-helper-hidden-accessible"']);
$html = $this->helper->form->label(t('Title'), 'title', ['class="ui-helper-hidden-accessible"']);
$html .= $this->helper->form->text(
$html .= $this->helper->form->text(
'title',
'title',
$values,
$values,
$errors,
$errors,
array(
array(
'autofocus',
'autofocus',
'required',
'required',
'tabindex="1"',
'tabindex="1"',
'placeholder="'.t('Title').'"'
'placeholder="'.t('Title').'"'
)
)
);
);
return $html;
return $html;
}
}
public function renderDescriptionField(array $values, array $errors)
public function renderDescriptionField(array $values, array $errors)
{
{
return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2, 'aria-label' => t('Description')));
return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2, 'aria-label' => t('Description')));
}
}
public function renderDescriptionTemplateDropdown($projectId)
public function renderDescriptionTemplateDropdown($projectId)
{
{
$templates = $this->predefinedTaskDescriptionModel->getAll($projectId);
$templates = $this->predefinedTaskDescriptionModel->getAll($projectId);
if (! empty($templates)) {
if (! empty($templates)) {
$html = '<div class="dropdown dropdown-smaller">';
$html = '<div class="dropdown dropdown-smaller">';
$html .= '<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-floppy-o fa-fw" aria-hidden="true"></i>'.t('Template for the task description').' <i class="fa fa-caret-down" aria-hidden="true"></i></a>';
$html .= '<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-floppy-o fa-fw" aria-hidden="true"></i>'.t('Template for the task description').' <i class="fa fa-caret-down" aria-hidden="true"></i></a>';
$html .= '<ul>';
$html .= '<ul>';
foreach ($templates as $template) {
foreach ($templates as $template) {
$html .= '<li>';
$html .= '<li>';
$html .= '<a href="#" data-template-target="textarea[name=description]" data-template="'.$this->helper->text->e($template['description']).'" class="js-template">';
$html .= '<a href="#" data-template-target="textarea[name=description]" data-template="'.$this->helper->text->e($template['description']).'" class="js-template">';
$html .= $this->helper->text->e($template['title']);
$html .= $this->helper->text->e($template['title']);
$html .= '</a>';
$html .= '</a>';
$html .= '</li>';
$html .= '</li>';
}
}
$html .= '</ul></div>';
$html .= '</ul></div>';
return $html;
return $html;
}
}
return '';
return '';
}
}
public function renderTagField(array $project, array $tags = array())
public function renderTagField(array $project, array $tags = array())
{
{
$options = $this->tagModel->getAssignableList($project['id'], $project['enable_global_tags']);
$options = $this->tagModel->getAssignableList($project['id'], $project['enable_global_tags']);
$html = $this->helper->form->label(t('Tags'), 'tags[]');
$html = $this->helper->form->label(t('Tags'), 'tags[]');
$html .= '<input type="hidden" name="tags[]" value="">';
$html .= '<input type="hidden" name="tags[]" value="">';
$html .= '<select name="tags[]" id="form-tags" class="tag-autocomplete" multiple tabindex="3">';
$html .= '<select name="tags[]" id="form-tags" class="tag-autocomplete" multiple tabindex="3">';
foreach ($options as $tag) {
foreach ($options as $tag) {
$html .= sprintf(
$html .= sprintf(
'<option value="%s" %s>%s</option>',
'<option value="%s" %s>%s</option>',
$this->helper->text->e($tag),
$this->helper->text->e($tag),
in_array($tag, $tags) ? 'selected="selected"' : '',
in_array($tag, $tags) ? 'selected="selected"' : '',
$this->helper->text->e($tag)
$this->helper->text->e($tag)
);
);
}
}
$html .= '</select>';
$html .= '</select>';
return $html;
return $html;
}
}
public function renderColorField(array $values)
public function renderColorField(array $values)
{
{
$html = $this->helper->form->colorSelect('color_id', $values);
$html = $this->helper->form->colorSelect('color_id', $values);
return $html;
return $html;
}
}
public function renderAssigneeField(array $users, array $values, array $errors = array(), array $attributes = array())
public function renderAssigneeField(array $users, array $values, array $errors = array(), array $attributes = array())
{
{
if (isset($values['project_id']) && ! $this->helper->projectRole->canChangeAssignee($values)) {
if (isset($values['project_id']) && ! $this->helper->projectRole->canChangeAssignee($values)) {
return '';
return '';
}
}
$attributes = array_merge(array('tabindex="5"'), $attributes);
$attributes = array_merge(array('tabindex="5"'), $attributes);
$html = $this->helper->form->label(t('Assignee'), 'owner_id');
$html = $this->helper->form->label(t('Assignee'), 'owner_id');
$html .= $this->helper->form->select('owner_id', $users, $values, $errors, $attributes);
$html .= $this->helper->form->select('owner_id', $users, $values, $errors, $attributes);
$html .= ' ';
$html .= ' ';
$html .= '<small>';
$html .= '<small>';
$html .= '<a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'" aria-label="'.t('Assign to me').'">'.t('Me').'</a>';
$html .= '<a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'" aria-label="'.t('Assign to me').'">'.t('Me').'</a>';
$html .= '</small>';
$html .= '</small>';
return $html;
return $html;
}
}
public function renderCategoryField(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false)
public function renderCategoryField(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false)
{
{
$attributes = array_merge(array('tabindex="6"'), $attributes);
$attributes = array_merge(array('tabindex="6"'), $attributes);
$html = '';
$html = '';
if (! (! $allow_one_item && count($categories) === 1 && key($categories) == 0)) {
if (! (! $allow_one_item && count($categories) === 1 && key($categories) == 0)) {
$html .= $this->helper->form->label(t('Category'), 'category_id');
$html .= $this->helper->form->label(t('Category'), 'category_id');
$html .= $this->helper->form->select('category_id', $categories, $values, $errors, $attributes);
$html .= $this->helper->form->select('category_id', $categories, $values, $errors, $attributes);
}
}
return $html;
return $html;
}
}
public function renderSwimlaneField(array $swimlanes, array $values, array $errors = array(), array $attributes = array())
public function renderSwimlaneField(array $swimlanes, array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="7"'), $attributes);
$attributes = array_merge(array('tabindex="7"'), $attributes);
$html = '';
$html = '';
if (count($swimlanes) > 1) {
if (count($swimlanes) > 1) {
$html .= $this->helper->form->label(t('Swimlane'), 'swimlane_id');
$html .= $this->helper->form->label(t('Swimlane'), 'swimlane_id');
$html .= $this->helper->form->select('swimlane_id', $swimlanes, $values, $errors, $attributes);
$html .= $this->helper->form->select('swimlane_id', $swimlanes, $values, $errors, $attributes);
}
}
return $html;
return $html;
}
}
public function renderColumnField(array $columns, array $values, array $errors = array(), array $attributes = array())
public function renderColumnField(array $columns, array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="8"'), $attributes);
$attributes = array_merge(array('tabindex="8"'), $attributes);
$html = $this->helper->form->label(t('Column'), 'column_id');
$html = $this->helper->form->label(t('Column'), 'column_id');
$html .= $this->helper->form->select('column_id', $columns, $values, $errors, $attributes);
$html .= $this->helper->form->select('column_id', $columns, $values, $errors, $attributes);
return $html;
return $html;
}
}
public function renderPriorityField(array $project, array $values)
public function renderPriorityField(array $project, array $values)
{
{
$range = range($project['priority_start'], $project['priority_end']);
$range = range($project['priority_start'], $project['priority_end']);
$options = array_combine($range, $range);
$options = array_combine($range, $range);
$values += array('priority' => $project['priority_default']);
$values += array('priority' => $project['priority_default']);
$html = $this->helper->form->label(t('Priority'), 'priority');
$html = $this->helper->form->label(t('Priority'), 'priority');
$html .= $this->helper->form->select('priority', $options, $values, array(), array('tabindex="9"'));
$html .= $this->helper->form->select('priority', $options, $values, array(), array('tabindex="9"'));
return $html;
return $html;
}
}
public function renderScoreField(array $values, array $errors = array(), array $attributes = array())
public function renderScoreField(array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="14"'), $attributes);
$attributes = array_merge(array('tabindex="14"'), $attributes);
$html = $this->helper->form->label(t('Complexity'), 'score');
$html = $this->helper->form->label(t('Complexity'), 'score');
$html .= $this->helper->form->number('score', $values, $errors, $attributes);
$html .= $this->helper->form->number('score', $values, $errors, $attributes);
return $html;
return $html;
}
}
public function renderReferenceField(array $values, array $errors = array(), array $attributes = array())
public function renderReferenceField(array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="15"'), $attributes);
$attributes = array_merge(array('tabindex="15"'), $attributes);
$html = $this->helper->form->label(t('Reference'), 'reference');
$html = $this->helper->form->label(t('Reference'), 'reference');
$html .= $this->helper->form->text('reference', $values, $errors, $attributes, 'form-input-small');
$html .= $this->helper->form->text('reference', $values, $errors, $attributes, 'form-input-small');
return $html;
return $html;
}
}
public function renderTimeEstimatedField(array $values, array $errors = array(), array $attributes = array())
public function renderTimeEstimatedField(array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="12"'), $attributes);
$attributes = array_merge(array('tabindex="12"'), $attributes);
$html = $this->helper->form->label(t('Original estimate'), 'time_estimated');
$html = $this->helper->form->label(t('Original estimate'), 'time_estimated');
$html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes);
$html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes);
$html .= ' '.t('hours');
$html .= ' '.t('hours');
return $html;
return $html;
}
}
public function renderTimeSpentField(array $values, array $errors = array(), array $attributes = array())
public function renderTimeSpentField(array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="13"'), $attributes);
$attributes = array_merge(array('tabindex="13"'), $attributes);
$html = $this->helper->form->label(t('Time spent'), 'time_spent');
$html = $this->helper->form->label(t('Time spent'), 'time_spent');
$html .= $this->helper->form->numeric('time_spent', $values, $errors, $attributes);
$html .= $this->helper->form->numeric('time_spent', $values, $errors, $attributes);
$html .= ' '.t('hours');
$html .= ' '.t('hours');
return $html;
return $html;
}
}
public function renderStartDateField(array $values, array $errors = array(), array $attributes = array())
public function renderStartDateField(array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="11"'), $attributes);
$attributes = array_merge(array('tabindex="11"'), $attributes);
return $this->helper->form->datetime(t('Start Date'), 'date_started', $values, $errors, $attributes);
return $this->helper->form->datetime(t('Start Date'), 'date_started', $values, $errors, $attributes);
}
}
public function renderDueDateField(array $values, array $errors = array(), array $attributes = array())
public function renderDueDateField(array $values, array $errors = array(), array $attributes = array())
{
{
$attributes = array_merge(array('tabindex="10"'), $attributes);
$attributes = array_merge(array('tabindex="10"'), $attributes);
return $this->helper->form->datetime(t('Due Date'), 'date_due', $values, $errors, $attributes);
return $this->helper->form->datetime(t('Due Date'), 'date_due', $values, $errors, $attributes);
}
}
public function renderPriority($priority)
public function renderPriority($priority)
{
{
$html = '<span class="task-priority" title="'.t('Task priority').'">';
$html = '<span class="task-priority" title="'.t('Task priority').'">';
$html .= '<span class="ui-helper-hidden-accessible">'.t('Task priority').' </span>';
$html .= '<span class="ui-helper-hidden-accessible">'.t('Task priority').' </span>';
$html .= $this->helper->text->e($priority >= 0 ? 'P'.$priority : '-P'.abs($priority));
$html .= $this->helper->text->e($priority >= 0 ? 'P'.$priority : '-P'.abs($priority));
$html .= '</span>';
$html .= '</span>';
return $html;
return $html;
}
}
public function renderReference(array $task)
public function renderReference(array $task)
{
{
if (! empty($task['reference'])) {
if (! empty($task['reference'])) {
$reference = $this->helper->text->e($task['reference']);
$reference = $this->helper->text->e($task['reference']);
if (filter_var($task['reference'], FILTER_VALIDATE_URL) !== false) {
if (filter_var($task['reference'], FILTER_VALIDATE_URL) !== false) {
return sprintf('<a href="%s" target=_blank">%s</a>', $reference, $reference);
return sprintf('<a href="%s" target=_blank">%s</a>', $reference, $reference);
}
}
return $reference;
return $reference;
}
}
return '';
return '';
}
}
복사
복사됨
복사
복사됨
public function renderInternalLinkField(array $internallinks, array $values, array $errors = array(), array $attributes = array())
{
$attributes = array_merge(array('tabindex="15"'), $attributes);
$html = '';
$html .= $this->helper->form->hidden('opposite_task_id', $values);
$html .= '<span class="task-internallink" title="'.t('Add internal link').'">'.t('Add internal link').'</span>';
$html .= '<br><br>';
$html .= $this->helper->form->label(t('Label'), 'link_id');
$html .= $this->helper->form->select('link_id', $internallinks, $values, $errors, $attributes);
$html .= $this->helper->form->label(t('Task'), 'title');
$html .= $this->helper->form->text(
'title',
$values,
$errors,
array(
'required',
'placeholder="'.t('Start to type task title...').'"',
'title="'.t('Start to type task title...').'"',
'data-dst-field="opposite_task_id"',
// 'data-search-url="'.$this->helper->url->href('TaskAjaxController', 'autocomplete', array('exclude_task_id' => $task['id'])).'"',
// TODO exclude_task_id shoulb be changed to allow more than one task id
'data-search-url="'.$this->helper->url->href('TaskAjaxController', 'autocomplete').'"',
),
'autocomplete');
return $html;
}
public function getProgress($task)
public function getProgress($task)
{
{
if (! isset($this->columns[$task['project_id']])) {
if (! isset($this->columns[$task['project_id']])) {
$this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']);
$this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']);
}
}
return $this->taskModel->getProgress($task, $this->columns[$task['project_id']]);
return $this->taskModel->getProgress($task, $this->columns[$task['project_id']]);
}
}
public function getNewBoardTaskButton(array $swimlane, array $column)
public function getNewBoardTaskButton(array $swimlane, array $column)
{
{
$html = '<div class="board-add-icon">';
$html = '<div class="board-add-icon">';
$providers = $this->externalTaskManager->getProviders();
$providers = $this->externalTaskManager->getProviders();
if (empty($providers)) {
if (empty($providers)) {
$html .= $this->helper->modal->largeIcon(
$html .= $this->helper->modal->largeIcon(
'plus',
'plus',
t('Add a new task'),
t('Add a new task'),
'TaskCreationController',
'TaskCreationController',
'show', array(
'show', array(
'project_id' => $column['project_id'],
'project_id' => $column['project_id'],
'column_id' => $column['id'],
'column_id' => $column['id'],
'swimlane_id' => $swimlane['id'],
'swimlane_id' => $swimlane['id'],
)
)
);
);
} else {
} else {
$html .= '<div class="dropdown">';
$html .= '<div class="dropdown">';
$html .= '<a href="#" class="dropdown-menu"><i class="fa fa-plus" aria-hidden="true"></i></a><ul>';
$html .= '<a href="#" class="dropdown-menu"><i class="fa fa-plus" aria-hidden="true"></i></a><ul>';
$link = $this->helper->modal->large(
$link = $this->helper->modal->large(
'plus',
'plus',
t('Add a new Kanboard task'),
t('Add a new Kanboard task'),
'TaskCreationController',
'TaskCreationController',
'show', array(
'show', array(
'project_id' => $column['project_id'],
'project_id' => $column['project_id'],
'column_id' => $column['id'],
'column_id' => $column['id'],
'swimlane_id' => $swimlane['id'],
'swimlane_id' => $swimlane['id'],
)
)
);
);
$html .= '<li>'.$link.'</li>';
$html .= '<li>'.$link.'</li>';
foreach ($providers as $provider) {
foreach ($providers as $provider) {
$link = $this->helper->url->link(
$link = $this->helper->url->link(
$provider->getMenuAddLabel(),
$provider->getMenuAddLabel(),
'ExternalTaskCreationController',
'ExternalTaskCreationController',
'step1',
'step1',
array('project_id' => $column['project_id'], 'swimlane_id' => $swimlane['id'], 'column_id' => $column['id'], 'provider_name' => $provider->getName()),
array('project_id' => $column['project_id'], 'swimlane_id' => $swimlane['id'], 'column_id' => $column['id'], 'provider_name' => $provider->getName()),
false,
false,
'js-modal-large'
'js-modal-large'
);
);
$html .= '<li>'.$provider->getIcon().' '.$link.'</li>';
$html .= '<li>'.$provider->getIcon().' '.$link.'</li>';
}
}
$html .= '</ul></div>';
$html .= '</ul></div>';
}
}
$html .= '</div>';
$html .= '</div>';
return $html;
return $html;
}
}
}
}
저장된 비교 결과
원본
파일 열기
<?php namespace Kanboard\Helper; use Kanboard\Core\Base; /** * Task helpers * * @package helper * @author Frederic Guillot */ class TaskHelper extends Base { /** * Local cache for project columns * * @access private * @var array */ private $columns = array(); public function getColors() { return $this->colorModel->getList(); } public function recurrenceTriggers() { return $this->taskRecurrenceModel->getRecurrenceTriggerList(); } public function recurrenceTimeframes() { return $this->taskRecurrenceModel->getRecurrenceTimeframeList(); } public function recurrenceBasedates() { return $this->taskRecurrenceModel->getRecurrenceBasedateList(); } public function renderTitleField(array $values, array $errors) { $html = $this->helper->form->label(t('Title'), 'title', ['class="ui-helper-hidden-accessible"']); $html .= $this->helper->form->text( 'title', $values, $errors, array( 'autofocus', 'required', 'tabindex="1"', 'placeholder="'.t('Title').'"' ) ); return $html; } public function renderDescriptionField(array $values, array $errors) { return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2, 'aria-label' => t('Description'))); } public function renderDescriptionTemplateDropdown($projectId) { $templates = $this->predefinedTaskDescriptionModel->getAll($projectId); if (! empty($templates)) { $html = '<div class="dropdown dropdown-smaller">'; $html .= '<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-floppy-o fa-fw" aria-hidden="true"></i>'.t('Template for the task description').' <i class="fa fa-caret-down" aria-hidden="true"></i></a>'; $html .= '<ul>'; foreach ($templates as $template) { $html .= '<li>'; $html .= '<a href="#" data-template-target="textarea[name=description]" data-template="'.$this->helper->text->e($template['description']).'" class="js-template">'; $html .= $this->helper->text->e($template['title']); $html .= '</a>'; $html .= '</li>'; } $html .= '</ul></div>'; return $html; } return ''; } public function renderTagField(array $project, array $tags = array()) { $options = $this->tagModel->getAssignableList($project['id'], $project['enable_global_tags']); $html = $this->helper->form->label(t('Tags'), 'tags[]'); $html .= '<input type="hidden" name="tags[]" value="">'; $html .= '<select name="tags[]" id="form-tags" class="tag-autocomplete" multiple tabindex="3">'; foreach ($options as $tag) { $html .= sprintf( '<option value="%s" %s>%s</option>', $this->helper->text->e($tag), in_array($tag, $tags) ? 'selected="selected"' : '', $this->helper->text->e($tag) ); } $html .= '</select>'; return $html; } public function renderColorField(array $values) { $html = $this->helper->form->colorSelect('color_id', $values); return $html; } public function renderAssigneeField(array $users, array $values, array $errors = array(), array $attributes = array()) { if (isset($values['project_id']) && ! $this->helper->projectRole->canChangeAssignee($values)) { return ''; } $attributes = array_merge(array('tabindex="5"'), $attributes); $html = $this->helper->form->label(t('Assignee'), 'owner_id'); $html .= $this->helper->form->select('owner_id', $users, $values, $errors, $attributes); $html .= ' '; $html .= '<small>'; $html .= '<a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'" aria-label="'.t('Assign to me').'">'.t('Me').'</a>'; $html .= '</small>'; return $html; } public function renderCategoryField(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false) { $attributes = array_merge(array('tabindex="6"'), $attributes); $html = ''; if (! (! $allow_one_item && count($categories) === 1 && key($categories) == 0)) { $html .= $this->helper->form->label(t('Category'), 'category_id'); $html .= $this->helper->form->select('category_id', $categories, $values, $errors, $attributes); } return $html; } public function renderSwimlaneField(array $swimlanes, array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="7"'), $attributes); $html = ''; if (count($swimlanes) > 1) { $html .= $this->helper->form->label(t('Swimlane'), 'swimlane_id'); $html .= $this->helper->form->select('swimlane_id', $swimlanes, $values, $errors, $attributes); } return $html; } public function renderColumnField(array $columns, array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="8"'), $attributes); $html = $this->helper->form->label(t('Column'), 'column_id'); $html .= $this->helper->form->select('column_id', $columns, $values, $errors, $attributes); return $html; } public function renderPriorityField(array $project, array $values) { $range = range($project['priority_start'], $project['priority_end']); $options = array_combine($range, $range); $values += array('priority' => $project['priority_default']); $html = $this->helper->form->label(t('Priority'), 'priority'); $html .= $this->helper->form->select('priority', $options, $values, array(), array('tabindex="9"')); return $html; } public function renderScoreField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="14"'), $attributes); $html = $this->helper->form->label(t('Complexity'), 'score'); $html .= $this->helper->form->number('score', $values, $errors, $attributes); return $html; } public function renderReferenceField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="15"'), $attributes); $html = $this->helper->form->label(t('Reference'), 'reference'); $html .= $this->helper->form->text('reference', $values, $errors, $attributes, 'form-input-small'); return $html; } public function renderTimeEstimatedField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="12"'), $attributes); $html = $this->helper->form->label(t('Original estimate'), 'time_estimated'); $html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes); $html .= ' '.t('hours'); return $html; } public function renderTimeSpentField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="13"'), $attributes); $html = $this->helper->form->label(t('Time spent'), 'time_spent'); $html .= $this->helper->form->numeric('time_spent', $values, $errors, $attributes); $html .= ' '.t('hours'); return $html; } public function renderStartDateField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="11"'), $attributes); return $this->helper->form->datetime(t('Start Date'), 'date_started', $values, $errors, $attributes); } public function renderDueDateField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="10"'), $attributes); return $this->helper->form->datetime(t('Due Date'), 'date_due', $values, $errors, $attributes); } public function renderPriority($priority) { $html = '<span class="task-priority" title="'.t('Task priority').'">'; $html .= '<span class="ui-helper-hidden-accessible">'.t('Task priority').' </span>'; $html .= $this->helper->text->e($priority >= 0 ? 'P'.$priority : '-P'.abs($priority)); $html .= '</span>'; return $html; } public function renderReference(array $task) { if (! empty($task['reference'])) { $reference = $this->helper->text->e($task['reference']); if (filter_var($task['reference'], FILTER_VALIDATE_URL) !== false) { return sprintf('<a href="%s" target=_blank">%s</a>', $reference, $reference); } return $reference; } return ''; } public function getProgress($task) { if (! isset($this->columns[$task['project_id']])) { $this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']); } return $this->taskModel->getProgress($task, $this->columns[$task['project_id']]); } public function getNewBoardTaskButton(array $swimlane, array $column) { $html = '<div class="board-add-icon">'; $providers = $this->externalTaskManager->getProviders(); if (empty($providers)) { $html .= $this->helper->modal->largeIcon( 'plus', t('Add a new task'), 'TaskCreationController', 'show', array( 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id'], ) ); } else { $html .= '<div class="dropdown">'; $html .= '<a href="#" class="dropdown-menu"><i class="fa fa-plus" aria-hidden="true"></i></a><ul>'; $link = $this->helper->modal->large( 'plus', t('Add a new Kanboard task'), 'TaskCreationController', 'show', array( 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id'], ) ); $html .= '<li>'.$link.'</li>'; foreach ($providers as $provider) { $link = $this->helper->url->link( $provider->getMenuAddLabel(), 'ExternalTaskCreationController', 'step1', array('project_id' => $column['project_id'], 'swimlane_id' => $swimlane['id'], 'column_id' => $column['id'], 'provider_name' => $provider->getName()), false, 'js-modal-large' ); $html .= '<li>'.$provider->getIcon().' '.$link.'</li>'; } $html .= '</ul></div>'; } $html .= '</div>'; return $html; } }
수정본
파일 열기
<?php namespace Kanboard\Helper; use Kanboard\Core\Base; /** * Task helpers * * @package helper * @author Frederic Guillot */ class TaskHelper extends Base { /** * Local cache for project columns * * @access private * @var array */ private $columns = array(); public function getColors() { return $this->colorModel->getList(); } public function recurrenceTriggers() { return $this->taskRecurrenceModel->getRecurrenceTriggerList(); } public function recurrenceTimeframes() { return $this->taskRecurrenceModel->getRecurrenceTimeframeList(); } public function recurrenceBasedates() { return $this->taskRecurrenceModel->getRecurrenceBasedateList(); } public function renderTitleField(array $values, array $errors) { $html = $this->helper->form->label(t('Title'), 'title', ['class="ui-helper-hidden-accessible"']); $html .= $this->helper->form->text( 'title', $values, $errors, array( 'autofocus', 'required', 'tabindex="1"', 'placeholder="'.t('Title').'"' ) ); return $html; } public function renderDescriptionField(array $values, array $errors) { return $this->helper->form->textEditor('description', $values, $errors, array('tabindex' => 2, 'aria-label' => t('Description'))); } public function renderDescriptionTemplateDropdown($projectId) { $templates = $this->predefinedTaskDescriptionModel->getAll($projectId); if (! empty($templates)) { $html = '<div class="dropdown dropdown-smaller">'; $html .= '<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-floppy-o fa-fw" aria-hidden="true"></i>'.t('Template for the task description').' <i class="fa fa-caret-down" aria-hidden="true"></i></a>'; $html .= '<ul>'; foreach ($templates as $template) { $html .= '<li>'; $html .= '<a href="#" data-template-target="textarea[name=description]" data-template="'.$this->helper->text->e($template['description']).'" class="js-template">'; $html .= $this->helper->text->e($template['title']); $html .= '</a>'; $html .= '</li>'; } $html .= '</ul></div>'; return $html; } return ''; } public function renderTagField(array $project, array $tags = array()) { $options = $this->tagModel->getAssignableList($project['id'], $project['enable_global_tags']); $html = $this->helper->form->label(t('Tags'), 'tags[]'); $html .= '<input type="hidden" name="tags[]" value="">'; $html .= '<select name="tags[]" id="form-tags" class="tag-autocomplete" multiple tabindex="3">'; foreach ($options as $tag) { $html .= sprintf( '<option value="%s" %s>%s</option>', $this->helper->text->e($tag), in_array($tag, $tags) ? 'selected="selected"' : '', $this->helper->text->e($tag) ); } $html .= '</select>'; return $html; } public function renderColorField(array $values) { $html = $this->helper->form->colorSelect('color_id', $values); return $html; } public function renderAssigneeField(array $users, array $values, array $errors = array(), array $attributes = array()) { if (isset($values['project_id']) && ! $this->helper->projectRole->canChangeAssignee($values)) { return ''; } $attributes = array_merge(array('tabindex="5"'), $attributes); $html = $this->helper->form->label(t('Assignee'), 'owner_id'); $html .= $this->helper->form->select('owner_id', $users, $values, $errors, $attributes); $html .= ' '; $html .= '<small>'; $html .= '<a href="#" class="assign-me" data-target-id="form-owner_id" data-current-id="'.$this->userSession->getId().'" title="'.t('Assign to me').'" aria-label="'.t('Assign to me').'">'.t('Me').'</a>'; $html .= '</small>'; return $html; } public function renderCategoryField(array $categories, array $values, array $errors = array(), array $attributes = array(), $allow_one_item = false) { $attributes = array_merge(array('tabindex="6"'), $attributes); $html = ''; if (! (! $allow_one_item && count($categories) === 1 && key($categories) == 0)) { $html .= $this->helper->form->label(t('Category'), 'category_id'); $html .= $this->helper->form->select('category_id', $categories, $values, $errors, $attributes); } return $html; } public function renderSwimlaneField(array $swimlanes, array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="7"'), $attributes); $html = ''; if (count($swimlanes) > 1) { $html .= $this->helper->form->label(t('Swimlane'), 'swimlane_id'); $html .= $this->helper->form->select('swimlane_id', $swimlanes, $values, $errors, $attributes); } return $html; } public function renderColumnField(array $columns, array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="8"'), $attributes); $html = $this->helper->form->label(t('Column'), 'column_id'); $html .= $this->helper->form->select('column_id', $columns, $values, $errors, $attributes); return $html; } public function renderPriorityField(array $project, array $values) { $range = range($project['priority_start'], $project['priority_end']); $options = array_combine($range, $range); $values += array('priority' => $project['priority_default']); $html = $this->helper->form->label(t('Priority'), 'priority'); $html .= $this->helper->form->select('priority', $options, $values, array(), array('tabindex="9"')); return $html; } public function renderScoreField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="14"'), $attributes); $html = $this->helper->form->label(t('Complexity'), 'score'); $html .= $this->helper->form->number('score', $values, $errors, $attributes); return $html; } public function renderReferenceField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="15"'), $attributes); $html = $this->helper->form->label(t('Reference'), 'reference'); $html .= $this->helper->form->text('reference', $values, $errors, $attributes, 'form-input-small'); return $html; } public function renderTimeEstimatedField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="12"'), $attributes); $html = $this->helper->form->label(t('Original estimate'), 'time_estimated'); $html .= $this->helper->form->numeric('time_estimated', $values, $errors, $attributes); $html .= ' '.t('hours'); return $html; } public function renderTimeSpentField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="13"'), $attributes); $html = $this->helper->form->label(t('Time spent'), 'time_spent'); $html .= $this->helper->form->numeric('time_spent', $values, $errors, $attributes); $html .= ' '.t('hours'); return $html; } public function renderStartDateField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="11"'), $attributes); return $this->helper->form->datetime(t('Start Date'), 'date_started', $values, $errors, $attributes); } public function renderDueDateField(array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="10"'), $attributes); return $this->helper->form->datetime(t('Due Date'), 'date_due', $values, $errors, $attributes); } public function renderPriority($priority) { $html = '<span class="task-priority" title="'.t('Task priority').'">'; $html .= '<span class="ui-helper-hidden-accessible">'.t('Task priority').' </span>'; $html .= $this->helper->text->e($priority >= 0 ? 'P'.$priority : '-P'.abs($priority)); $html .= '</span>'; return $html; } public function renderReference(array $task) { if (! empty($task['reference'])) { $reference = $this->helper->text->e($task['reference']); if (filter_var($task['reference'], FILTER_VALIDATE_URL) !== false) { return sprintf('<a href="%s" target=_blank">%s</a>', $reference, $reference); } return $reference; } return ''; } public function renderInternalLinkField(array $internallinks, array $values, array $errors = array(), array $attributes = array()) { $attributes = array_merge(array('tabindex="15"'), $attributes); $html = ''; $html .= $this->helper->form->hidden('opposite_task_id', $values); $html .= '<span class="task-internallink" title="'.t('Add internal link').'">'.t('Add internal link').'</span>'; $html .= '<br><br>'; $html .= $this->helper->form->label(t('Label'), 'link_id'); $html .= $this->helper->form->select('link_id', $internallinks, $values, $errors, $attributes); $html .= $this->helper->form->label(t('Task'), 'title'); $html .= $this->helper->form->text( 'title', $values, $errors, array( 'required', 'placeholder="'.t('Start to type task title...').'"', 'title="'.t('Start to type task title...').'"', 'data-dst-field="opposite_task_id"', // 'data-search-url="'.$this->helper->url->href('TaskAjaxController', 'autocomplete', array('exclude_task_id' => $task['id'])).'"', // TODO exclude_task_id shoulb be changed to allow more than one task id 'data-search-url="'.$this->helper->url->href('TaskAjaxController', 'autocomplete').'"', ), 'autocomplete'); return $html; } public function getProgress($task) { if (! isset($this->columns[$task['project_id']])) { $this->columns[$task['project_id']] = $this->columnModel->getList($task['project_id']); } return $this->taskModel->getProgress($task, $this->columns[$task['project_id']]); } public function getNewBoardTaskButton(array $swimlane, array $column) { $html = '<div class="board-add-icon">'; $providers = $this->externalTaskManager->getProviders(); if (empty($providers)) { $html .= $this->helper->modal->largeIcon( 'plus', t('Add a new task'), 'TaskCreationController', 'show', array( 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id'], ) ); } else { $html .= '<div class="dropdown">'; $html .= '<a href="#" class="dropdown-menu"><i class="fa fa-plus" aria-hidden="true"></i></a><ul>'; $link = $this->helper->modal->large( 'plus', t('Add a new Kanboard task'), 'TaskCreationController', 'show', array( 'project_id' => $column['project_id'], 'column_id' => $column['id'], 'swimlane_id' => $swimlane['id'], ) ); $html .= '<li>'.$link.'</li>'; foreach ($providers as $provider) { $link = $this->helper->url->link( $provider->getMenuAddLabel(), 'ExternalTaskCreationController', 'step1', array('project_id' => $column['project_id'], 'swimlane_id' => $swimlane['id'], 'column_id' => $column['id'], 'provider_name' => $provider->getName()), false, 'js-modal-large' ); $html .= '<li>'.$provider->getIcon().' '.$link.'</li>'; } $html .= '</ul></div>'; } $html .= '</div>'; return $html; } }
비교하기