Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion core/plugins/projects/todo/todo.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// Include model
include_once \Component::path('com_projects') . DS . 'models' . DS . 'todo.php';

use Hubzero\Utility\Arr;

/**
* Projects todo's
*/
Expand Down Expand Up @@ -485,7 +487,12 @@ public function save()
}
if (checkdate($month, $day, $year))
{
$objTD->duedate = Date::of(mktime(0, 0, 0, $month, $day, $year))->toSql();
$serverTimezone = Config::get('offset');
$userParams = json_decode(User::get('params'), 1);
$timezone = Arr::getValue($userParams, 'timezone', $serverTimezone);

$date = Date::of("$year-$month-$day", $timezone);
$objTD->duedate = $date->toSql();
}
}
}
Expand Down
55 changes: 55 additions & 0 deletions core/plugins/projects/todo/views/view/tmpl/_todo_pin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* @package hubzero-cms
* @copyright Copyright 2005-2019 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/

// No direct access
defined('_HZEXEC_') or die();

use \Hubzero\Utility\Str;

$defaultColor = 'grey';
$order = $this->order;
$url = $this->url;

$todo = $this->todo;
$todoColor = $todo->get('color');
$truncatedContent = Str::truncate($todo->get('content'), 150);
$id = $todo->get('id');
$isComplete = $todo->isComplete();

$color = $todoColor ? $todoColor : $defaultColor;
$colorClass = "pin_$color";
$closedClass = $isComplete ? 'tdclosed' : '';
$commentsLink = Route::url("$url&action=view") . "/?todoid=$id";
$commentsLinkTitle = Lang::txt('PLG_PROJECTS_TODO_TODO_VIEW_COMMENTS_AND_EDIT');
?>
<li class="<?php echo "$colorClass $closedClass"; ?> droptarget " id="todo-<?php echo $id; ?>">
<div id="td-<?php echo $id; ?>">

<input type="hidden" name="order" id="order-<?php echo $id; ?>" value="<?php echo $order; ?>" />

<span class="pin handle">&nbsp;</span>

<?php if ($isComplete): ?>
<span class="complete">&nbsp;</span>
<?php endif; ?>

<span class="todo-content" id="td-content-<?php echo $id; ?>"><?php echo $truncatedContent; ?></span>
<span class="todo-options" id="td-options-<?php echo $id; ?>">
<?php
$this->view('_todo_pin_assignment_info')
->set('id', $id)
->set('isComplete', $isComplete)
->set('todo', $todo)
->display();
?>
</span>

<span class="comment-blurb">
<a href="<?php echo $commentsLink; ?>" title="<?php echo $commentsLinkTitle; ?>"><?php echo $todo->comments('count'); ?>&nbsp;&raquo;</a>
</span>
</div>
</li>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* @package hubzero-cms
* @copyright Copyright 2005-2019 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/

// No direct access
defined('_HZEXEC_') or die();

$id = $this->id;
$isComplete = $this->isComplete;
$todo = $this->todo;
$overdue = $todo->isOverdue();

$overdueNotice = $overdue ? ' ('.Lang::txt('PLG_PROJECTS_TODO_OVERDUE').')' : '';

if ($isComplete): ?>
<span class="todo-assigned"><?php echo $todo->closer('name'); ?></span>
<span class="todo-due"><?php echo Lang::txt('PLG_PROJECTS_TODO_CHECKED_OFF') . ' ' . $todo->closed('date'); ?></span>
<?php else: ?>
<span class="todo-assigned" id="<?php echo "td-assigned-$id"; ?>"><?php echo $todo->owner('name'); ?></span>
<?php if ($todo->due()): ?>
<span class="todo-due" id="<?php echo "td-due-$id"; ?>">
<?php
echo Lang::txt('PLG_PROJECTS_TODO_DUE') . ' ' . $todo->due('date') . $overdueNotice; ?>
</span>
<?php endif; ?>
<?php endif; ?>
38 changes: 9 additions & 29 deletions core/plugins/projects/todo/views/view/tmpl/pinboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,36 +62,16 @@
<ul class="pinboard allow-sort" id="pinboard">
<?php if (count($rows) > 0) { ?>
<?php
$order = 1;
foreach ($rows as $row)
{
$color = $row->get('color');
$class = $color ? 'pin_' . $color : 'pin_grey';

$overdue = $row->isOverdue();
$oNote = $overdue ? ' ('.Lang::txt('PLG_PROJECTS_TODO_OVERDUE').')' : '';
?>
<li class="<?php echo $class; ?> droptarget <?php echo $row->isComplete() ? 'tdclosed' : ''; ?>" id="todo-<?php echo $row->get('id'); ?>">
<div id="td-<?php echo $row->get('id'); ?>">
<span class="pin handle">&nbsp;</span>
<?php if ($row->isComplete()) { ?>
<span class="complete">&nbsp;</span>
<?php } ?>
<span class="todo-content" id="td-content-<?php echo $row->get('id'); ?>"><?php echo \Hubzero\Utility\Str::truncate($row->get('content'), 150); ?></span>
<span class="todo-options" id="td-options-<?php echo $row->get('id'); ?>">
<?php if ($row->isComplete()) { ?>
<span class="todo-assigned"> <?php echo $row->closer('name'); ?></span> <?php if ($row->isComplete()) { echo '<span class="todo-due">' . Lang::txt('PLG_PROJECTS_TODO_CHECKED_OFF') . ' ' . $row->closed('date') . '</span>'; } ?>
<?php } else { ?>
<?php echo '<span class="todo-assigned" id="td-assigned-' . $row->get('id') . '">' . $row->owner('name') . '</span>'; ?> <?php if ($row->due()) { echo '<span class="todo-due" id="td-due-' . $row->get('id') . '">' . Lang::txt('PLG_PROJECTS_TODO_DUE') . ' ' . $row->due('date') . $oNote . '</span>'; } ?>
<?php } ?>
</span>
<input type="hidden" name="order" id="order-<?php echo $row->get('id'); ?>" value="<?php echo $order; ?>" />
<span class="comment-blurb"><a href="<?php echo Route::url($url . '&action=view').'/?todoid=' . $row->get('id'); ?>" title="<?php echo Lang::txt('PLG_PROJECTS_TODO_TODO_VIEW_COMMENTS_AND_EDIT'); ?>"><?php echo $row->comments('count'); ?>&nbsp;&raquo;</a></span>
</div>
</li>
<?php
$order = 1;
foreach ($rows as $row)
{
$this->view('_todo_pin')
->set('order', $order)
->set('todo', $row)
->set('url', $url)
->display();
}
$order++;
}
?>
<?php } elseif (!$this->filters['state'] && $this->model->access('content')) { ?>
<li class="todo-add">
Expand Down