if (!in_array($field, array('priority', 'status', 'assigned'))) { // Invalid field $Ajaxlog->add(sprintf('Invalid field: %s', $field), 'error'); break; } $post_ID = param('post_ID', 'integer', true); $ItemCache =& get_ItemCache(); $Item =& $ItemCache->get_by_ID($post_ID); // Check permission: $current_User->check_perm('item_post!CURSTATUS', 'edit', true, $Item); $new_attrs = ''; switch ($field) { case 'priority': // Update task priority $new_value = param('new_priority', 'integer', NULL); $new_attrs = ' color="' . item_priority_color($new_priority) . '"'; $new_title = item_priority_title($new_priority); $Item->set_from_Request('priority', 'new_priority', true); $Item->dbupdate(); break; case 'assigned': // Update task assigned user $new_assigned_ID = param('new_assigned_ID', 'integer', NULL); $new_assigned_login = param('new_assigned_login', 'string', NULL); if ($Item->assign_to($new_assigned_ID, $new_assigned_login)) { // An assigned user can be changed $Item->dbupdate(); } else { // Error on changing of an assigned user load_funcs('_core/_template.funcs.php'); headers_content_mightcache('text/html', 0, '#', false);
if ($latest_Comment =& $Item->get_latest_Comment()) { // At least one reply exists: printf(T_('%s replies'), '<div><a href="' . $latest_Comment->get_permanent_url() . '" title="' . T_('View latest comment') . '">' . $comments_number . '</a></div>'); } else { // No replies yet: printf(T_('%s replies'), '<div>0</div>'); } } echo '</div>'; } // -------------------------------------------------------------------------------------------------------------------------- echo '<!-- Assigned User Block -->'; if ($display_workflow) { // ========================================================================================================================== $assigned_User = $Item->get_assigned_User(); $priority_color = item_priority_color($Item->priority); $url = $Item->get_permanent_url() . '#workflow_panel'; // We offer 2 modes of displaying workflow. $worfklow_display_mode = $Skin->get_setting('workflow_display_mode'); // Possible values = 'assignee_and_status' or 'status_and_author' if ($worfklow_display_mode == 'assignee_and_status') { if ($assigned_User) { echo '<div class="ft_assigned col-lg-2 col-md-2 col-sm-3 col-sm-offset-0 col-xs-6">'; echo '<div class="ft_assigned_header">'; echo '<a href="' . $url . '" style="color: ' . $priority_color . ';">' . T_('Assigned to') . ':</a>'; echo '</div>'; // Assigned user avatar $Item->assigned_to2(array('thumb_class' => 'ft_assigned_avatar', 'link_class' => 'ft_assigned_avatar', 'thumb_size' => 'crop-top-32x32')); echo '<div class="ft_assigned_info">'; // Assigned user login $Item->assigned_to2(array('after' => '<br />', 'link_text' => 'name'));