/** * Generates a list of RSS feed items. * * @return void */ function display() { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $params = $app->getParams(); $doc->link = htmlspecialchars(JFactory::getURI()->toString()); $feed_email = $app->getCfg('feed_email') == '' ? 'site' : $app->getCfg('feed_email'); $site_email = $app->getCfg('mailfrom'); // Set the query limit to the feed setting JRequest::setVar('limit', (int) $app->getCfg('feed_limit', 20)); // Get model data $rows = $this->get('Items'); foreach ($rows as $row) { // Load individual item creator class $item = new JFeedItem(); $item->title = html_entity_decode($this->escape($row->title), ENT_COMPAT, 'UTF-8'); $item->link = JRoute::_(PFtasksHelperRoute::getTaskRoute($row->slug, $row->project_slug, $row->milestone_slug, $row->list_slug)); $item->description = $row->description; $item->date = $row->created ? date('r', strtotime($row->created)) : ''; $item->author = $row->author_name; $item->authorEmail = $feed_email == 'site' ? $site_email : $row->author_email; // Categorize the item $item->category = array(); // Project if (!empty($row->project_title)) { $item->category[] = html_entity_decode($this->escape($row->project_title), ENT_COMPAT, 'UTF-8'); } // Milestone if (!empty($row->milestone_title)) { $item->category[] = html_entity_decode($this->escape($row->milestone_title), ENT_COMPAT, 'UTF-8'); } // List if (!empty($row->list_title)) { $item->category[] = html_entity_decode($this->escape($row->list_title), ENT_COMPAT, 'UTF-8'); } // Loads item info into the RSS array $doc->addItem($item); } }
<?php } ?> <div id="list-toolbar-<?php echo $x; ?> " class="pull-left"> <div class="btn-group"> <?php echo JHtml::_('pftasks.complete', $x, $item->complete, $can_change, $item->dependencies, $item->users, $item->start_date); ?> </div> </div> <span class="task-title"> <a href="<?php echo JRoute::_(PFtasksHelperRoute::getTaskRoute($item->slug, $item->project_slug, $item->milestone_slug, $item->list_slug)); ?> " class="pull-left"> <?php if ($item->checked_out) { ?> <span aria-hidden="true" class="icon-lock"></span> <?php } ?> <?php echo $this->escape($item->title); ?> </a> <span class="dropdown pull-left"> <?php $this->menu->start(array('class' => 'btn-mini btn-link'));
function displayData($items) { jimport('joomla.html.pagination'); $module = JModuleHelper::getModule('mod_pf_time'); $params = new JRegistry(); $params->loadString($module->params); $list_limit = (int) $params->get('list_limit'); $show_monetary = (int) $params->get('show_monetary'); $show_date = (int) $params->get('show_date'); $show_author = (int) $params->get('show_author'); $menu = new PFMenuContext(); $app = JFactory::getApplication(); $limitstart = (int) JRequest::getVar('limitstart', 0); $stotal_time = 0; $total_time = 0; $html = ' <div class="cat-list-row"> <ul class="list-tasks list-striped list-condensed unstyled" id="tasklist">'; $x = 0; $k = 0; foreach ($items as $i => $item) { $total_time += $item->log_time; if ($limitstart == 0) { if ($i > $list_limit - 1) { continue; } } else { if ($i < $limitstart || $i >= $limitstart + $list_limit) { continue; } } $stotal_time += $item->log_time; $items[$i]->slug = $items[$i]->id; $items[$i]->project_slug = $items[$i]->project_alias ? $items[$i]->project_id . ':' . $items[$i]->project_alias : $items[$i]->project_id; $items[$i]->task_slug = $items[$i]->task_alias ? $items[$i]->task_id . ':' . $items[$i]->task_alias : $items[$i]->task_id; $items[$i]->milestone_slug = $items[$i]->milestone_alias ? $items[$i]->milestone_id . ':' . $items[$i]->milestone_alias : $items[$i]->milestone_id; $items[$i]->list_slug = $items[$i]->list_alias ? $items[$i]->list_id . ':' . $items[$i]->list_alias : $items[$i]->list_id; $exists = (int) $item->task_exists > 0; $html .= ' <li id="list-item-' . $x . '" class="clearfix "> <div class="task-row clearfix"> <span class="task-title">'; if ($exists) { $html .= '<a class="pull-left" href="' . JRoute::_(PFtasksHelperRoute::getTaskRoute($item->task_slug, $item->project_slug, $item->milestone_slug, $item->list_slug)) . '" rel="popover" title="' . htmlspecialchars($item->task_title, ENT_QUOTES, "UTF-8") . '" data-content="' . htmlspecialchars($item->description, ENT_QUOTES, "UTF-8") . '">' . htmlspecialchars($item->task_title, ENT_QUOTES, 'UTF-8') . '</a> <span class="dropdown pull-left">'; $menu->start(array('class' => 'btn-mini btn-link')); $itm_icon = 'icon-menu-2'; $itm_txt = 'COM_PROJECTFORK_DETAILS_LABEL'; $itm_link = '#collapse-' . $x; $menu->itemCollapse($itm_icon, $itm_txt, $itm_link); $menu->end(); $html .= $menu->render(array('class' => 'btn-mini btn-link', 'pull' => 'left')); $html .= '</span>'; } else { $html .= htmlspecialchars($item->task_title, ENT_QUOTES, 'UTF-8'); } $html .= '</span> <span class="pull-right">' . JHtml::_('time.format', $item->log_time) . '</span> </div> <div id="collapse-' . $x . '" class="collapse"> <hr /> <small class="task-description">' . JText::_('COM_PROJECTFORK_FIELD_PROJECT_LABEL') . ':' . htmlspecialchars($item->project_title, ENT_COMPAT, 'UTF-8') . '</small>'; if ($show_author) { $html .= '<span class="label user"> <span aria-hidden="true" class="icon-user icon-white"></span>' . htmlspecialchars($item->author_name, ENT_COMPAT, 'UTF-8') . '</span> <input type="hidden" id="assigned' . $i . '" name="assigned[' . $item->id . ']" />'; } if ($show_date) { $html .= '<span class="label label-success"><span aria-hidden="true" class="icon-calendar"></span>' . JHtml::_('date', $item->log_date, JText::_('DATE_FORMAT_LC4')) . '</span>'; } if ($show_monetary) { $html .= '<span class="label label-inverse">' . JText::_('COM_PROJECTFORK_TIME_TRACKING_RATE') . ': ' . JHtml::_('pfhtml.format.money', $item->rate) . '</span>'; if (!$item->billable) { $html .= '<span class="label label-info">' . JText::_('COM_PROJECTFORK_TIME_TRACKING_UNBILLABLE') . ': ' . JHtml::_('pfhtml.format.money', $item->billable_total) . '</span>'; } else { $html .= '<span class="label label-success">' . JText::_('COM_PROJECTFORK_TIME_TRACKING_BILLABLE') . ': ' . JHtml::_('pfhtml.format.money', $item->billable_total) . '</span>'; } } $html .= '</div> </li>'; $x++; $k = 1 - $k; } $html .= '<li id="list-item-' . $x++ . '" class="clearfix ">'; $html .= '<div class="task-row clearfix">'; if ($total_time == $stotal_time) { $html .= ' <span class="task-title">' . JText::_('MOD_PF_TIME_TOTAL') . '</span><span class="pull-right">' . JHtml::_('time.format', $total_time) . '</span>'; } else { $html .= ' <span class="task-title">' . JText::_('MOD_PF_TIME_TOTAL') . '</span><span class="pull-right">' . JHtml::_('time.format', $stotal_time) . ' / ' . JHtml::_('time.format', $total_time) . '</span>'; } $html .= '</div></li>'; $html .= ' </ul> </div>'; $pageNav = new moduleHelperPagination(count($items), $limitstart, $list_limit); $html .= $pageNav->getListFooter(true); echo $html; $app->close(); }
/** * Sends an email to all newly assigned users * * @param array $uids The users to notify * @param integer $task_id The task id * * @return void */ protected function notifyAssignedUsers($uids, $pk) { // Load the relevant task information $query = $this->_db->getQuery(true); $query->select('a.id, a.project_id, a.milestone_id, a.list_id, a.title, a.description, a.priority')->select('a.start_date, a.end_date')->select('p.title AS p_title, m.title AS ms_title, l.title AS l_title')->from('#__pf_tasks AS a')->join('LEFT', '#__pf_projects AS p ON p.id = a.project_id')->join('LEFT', '#__pf_milestones AS m ON m.id = a.milestone_id')->join('LEFT', '#__pf_task_lists AS l ON l.id = a.list_id')->where('a.id = ' . (int) $pk); $this->_db->setQuery($query); $task = $this->_db->loadObject(); if (empty($task)) { return; } // Get the default language $def_lang = JComponentHelper::getParams('com_languages')->get('administrator'); $debug = JFactory::getConfig()->get('debug_lang'); // Email settings $mailfrom = JFactory::getConfig()->get('mailfrom'); $fromname = JFactory::getConfig()->get('fromname'); // Own user account $user = JFactory::getUser(); // mysql nulldate $nd = $this->_db->getNullDate(); // Task link $link = JRoute::_(JURI::root() . PFtasksHelperRoute::getTaskRoute($task->id, $task->project_id, $task->milestone_id, $task->list_id)); $is_site = JFactory::getApplication()->isSite(); // Send to each user... foreach ($uids as $uid) { // Dont email to self if ($uid == $user->id) { continue; } // Get recipient $recipient = JFactory::getUser($uid); // Load the default language of the recipient $lang = JLanguage::getInstance($recipient->getParam('site_language', $def_lang), $debug); $lang->load('com_projectfork'); $lang->load('com_pftasks'); if ($is_site) { $lang->load('com_projectfork', JPATH_ADMINISTRATOR); $lang->load('com_pftasks', JPATH_ADMINISTRATOR); } // Prepare subject $format = $lang->_('COM_PROJECTFORK_TASK_EMAIL_ASSIGN_SUBJECT'); $subject = sprintf($format, $task->p_title, $user->name, $task->title); // Prepare text $format = $lang->_('COM_PROJECTFORK_TASK_EMAIL_ASSIGN_MESSAGE'); $text = array(); // Title $text[] = '* ' . $lang->_('JGLOBAL_TITLE') . ': \\n ' . $task->title . '\\n'; // Milestone $text[] = '* ' . $lang->_('COM_PROJECTFORK_EMAIL_LABEL_MILESTONE_ID') . ': \\n ' . (empty($task->m_title) ? '-' : $task->m_title) . '\\n'; // Task list $text[] = '* ' . $lang->_('COM_PROJECTFORK_EMAIL_LABEL_LIST_ID') . ': \\n ' . (empty($task->l_title) ? '-' : $task->l_title) . '\\n'; // Start $text[] = '* ' . $lang->_('COM_PROJECTFORK_EMAIL_LABEL_START_DATE') . ': \\n ' . ($task->start_date == $nd ? '-' : JHtml::_('date', $task->start_date, JText::_('DATE_FORMAT_LC3'))) . '\\n'; // End $text[] = '* ' . $lang->_('COM_PROJECTFORK_EMAIL_LABEL_END_DATE') . ': \\n ' . ($task->end_date == $nd ? ' -' : JHtml::_('date', $task->end_date, JText::_('DATE_FORMAT_LC3'))) . '\\n'; // Priority $text[] = '* ' . $lang->_('COM_PROJECTFORK_EMAIL_LABEL_PRIORITY') . ': \\n ' . PFTasksHelper::priority2string($task->priority) . '\\n'; // Description $text[] = '* ' . $lang->_('COM_PROJECTFORK_EMAIL_LABEL_DESCRIPTION') . ': \\n' . strip_tags($task->description); // Done. Compile text $text = implode('', $text); $text = str_replace('\\n', "\n", $text); $text = sprintf($format, $recipient->name, $user->name, $text, $link) . "\n\n" . sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); // Mail it $result = JFactory::getMailer()->sendMail($mailfrom, $fromname, $recipient->email, $subject, $text); // Break on the first failure, assuming emails aren't working if (!$result) { break; } } }
/** * Method to get a list of items of a project to render in the gantt chart * * @return array $items The items to render */ protected static function getItemsDetail() { $data = self::getProjectDetails(); $user = JFactory::getUser(); $config = JFactory::getConfig(); $params = self::$params; $items = array(); $can_edit_m_state = $user->authorise('core.edit.state', 'com_pfmilestones'); $can_edit_t_state = $user->authorise('core.edit.state', 'com_pftasks'); $default = array('1', '0', '2'); $show_ms = $params->get('show_milestones', $default); $show_l = $params->get('show_lists', $default); $show_t = $params->get('show_tasks', $default); $ms_display = (int) $params->get('ms_display'); $highlight = (int) $params->get('highlight_today'); $date_now = new JDate('now', 'UTC'); $date_now->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset')))); $today = $date_now->toUnix() * 1000; $icons = array('milestone' => 'icon-flag', 'tasklist' => 'icon-list-view', 'task-complete' => 'icon-checkbox', 'task-incomplete' => 'icon-checkbox-unchecked'); $prev_level = 0; $level = 0; // Fix "Show Task Lists" setting from older module versions if (!is_array($show_l)) { if ($show_l == '1') { $show_l = array('1', '0', '2'); } else { $show_l = array('-1'); } } // Fix empty "Show X" settings if (is_array($show_ms) && count($show_ms) == 0) { $show_ms = $default; } if (is_array($show_l) && count($show_l) == 0) { $show_l = $default; } if (is_array($show_t) && count($show_t) == 0) { $show_t = $default; } // Map item keys $map_ms = array(); $map_l = array(); $map_t = array(); foreach ($data as $i => $record) { if ($record->type == 'milestone') { $map_ms[$record->id] = $i; } if ($record->type == 'tasklist') { $map_l[$record->id] = $i; } if ($record->type == 'task') { $map_t[$record->id] = $i; } } foreach ($data as $i => $record) { $link = '#'; $prev_level = $level; $dep = array(); if ($record->type == 'milestone') { // Hide milestone? if (!in_array($record->state, $show_ms)) { continue; } $slug = $record->id . ':' . $record->alias; $pslug = self::$project . ':' . $record->p_alias; $link = JRoute::_(PFmilestonesHelperRoute::getMilestoneRoute($slug, $pslug)); $level = 0; $class = 'gantt-m'; $bid = 'gantt-m-' . $record->id; $can_edit = $can_edit_m_state; } if ($record->type == 'tasklist') { // Hide list? if (!in_array($record->state, $show_l)) { continue; } $slug = $record->id . ':' . $record->alias; $pslug = self::$project . ':' . $record->p_alias; $mslug = $record->milestone_id . ':' . $record->m_alias; $link = JRoute::_(PFtasksHelperRoute::getTasksRoute($pslug, $mslug, $slug)); $class = 'gantt-l'; $bid = 'gantt-l-' . $record->id; $can_edit = $can_edit_t_state; if ($record->milestone_id) { if (isset($map_ms[$record->milestone_id])) { $k = $map_ms[$record->milestone_id]; $ms = $data[$k]; if (!in_array($ms->state, $show_ms)) { $record->milestone_id = 0; } } } $level = $record->milestone_id ? 1 : 0; } if ($record->type == 'task') { // Hide task? if (!in_array($record->state, $show_t)) { continue; } $slug = $record->id . ':' . $record->alias; $pslug = self::$project . ':' . $record->p_alias; $mslug = $record->milestone_id . ':' . $record->m_alias; $lslug = $record->list_id . ':' . $record->l_alias; $link = JRoute::_(PFtasksHelperRoute::getTaskRoute($slug, $pslug, $mslug, $lslug)); $bid = 'gantt-t-' . $record->id; $record->type .= '-' . ($record->complete ? 'complete' : 'incomplete'); if ($record->milestone_id) { if (isset($map_ms[$record->milestone_id])) { $k = $map_ms[$record->milestone_id]; $ms = $data[$k]; if (!in_array($ms->state, $show_ms)) { $record->milestone_id = 0; } } } if ($record->list_id) { if (isset($map_l[$record->list_id])) { $k = $map_l[$record->list_id]; $l = $data[$k]; if (!in_array($l->state, $show_l)) { $record->list_id = 0; } } } if ($record->l_ms) { if (isset($map_l[$record->l_ms])) { $k = $map_l[$record->list_id]; $l = $data[$k]; if (!in_array($l->state, $show_l)) { $record->l_ms = 0; } } } if (in_array('-1', $show_l)) { $record->l_ms = 0; } $level = $record->list_id ? $record->l_ms ? 2 : 1 : ($record->milestone_id ? 1 : 0); $class = 'gantt-t'; $can_edit = $can_edit_t_state; // Add task dependencies if (count($record->parents)) { foreach ($record->parents as $parent) { $dep[] = 'gantt-t-' . $parent; } } } // Set arrow direction and indentation if ($level == 0) { $indent = '<i class="icon-arrow-right-3"></i> '; } else { $indent = '<i class="icon-arrow-' . ($ms_display ? 'down' : 'up') . '-3" style="margin-left:' . 16 * $level . 'px"></i> '; } if (!$can_edit) { $name = '<i class="' . $icons[$record->type] . '"></i> ' . '<span>' . ucfirst(htmlspecialchars($record->title)) . '</span>'; } else { $name = '<i class="' . $icons[$record->type] . '"></i> ' . '<a href="' . $link . '">' . ucfirst(htmlspecialchars($record->title)) . '</a>'; } // Create row object $row = new stdClass(); $row->name = $indent . $name; $row->desc = self::formatDuration($record->duration, $record->start_time, $record->end_time, $record->complete); $row->values = array(); // Create row item object $item = new stdClass(); if ($record->type == 'milestone' && $ms_display) { $item->label = '<i class="icon-flag"></i>'; $item->from = '/Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . ')/'; } else { $item->label = ucfirst(htmlspecialchars($record->title)); $item->from = '/Date(' . $record->start_year . ', ' . ($record->start_month - 1) . ', ' . $record->start_day . ')/'; } $item->to = '/Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . ')/'; $item->id = $bid; $item->desc = ''; // Determine custom class $item->customClass = $class; if ($record->complete) { $item->customClass .= '-complete'; } elseif ($record->start_time > self::$time_today) { $item->customClass .= '-notstarted'; } elseif ($record->end_time < self::$time_today) { $item->customClass .= '-behind'; } // Add dependencies if (count($dep)) { $item->dep = $dep; } // Highlight today? if ($highlight) { $hl = new stdClass(); $hl->label = ''; $hl->desc = ''; $hl->from = '/Date()/'; $hl->to = '/Date()/'; $hl->customClass = 'gantt-today'; $row->values[] = $hl; } $row->values[] = $item; $items[] = $row; } return $items; }
/** * Method to generate the email message * * @param object $lang Instance of the default user language * @param object $receiveer Instance of the the receiving user * @param object $user Instance of the user who made the change * @param object $after Instance of the item table after it was updated * @param object $before Instance of the item table before it was updated * @param boolean $is_new True if the item is new ($before will be null) * * @return string */ public static function getTaskMessage($lang, $receiver, $user, $after, $before, $is_new) { // Get the changed fields $props = array('description', 'created_by', 'access', array('start_date', 'NE-SQLDATE'), array('end_date', 'NE-SQLDATE'), 'milestone_id', 'list_id', 'priority', 'complete', 'rate', 'cost', 'estimate'); $changes = array(); if (is_object($before) && is_object($after)) { $changes = PFObjectHelper::getDiff($before, $after, $props); } if ($is_new) { $changes = PFObjectHelper::toArray($after, $props); } $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); $format = $lang->_($txt_prefix . '_MESSAGE'); $changes = PFnotificationsHelper::formatChanges($lang, $changes); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . PFtasksHelperRoute::getTaskRoute($after->id, $after->project_id, $after->milestone_id, $after->list_id)); $txt = sprintf($format, $receiver->name, $user->name, $changes, $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); return $txt; }
/** * Method to get a list of items of a project to render in the calendar * * @return array $items The items to render */ protected static function getItemsDetail() { $data = self::getProjectDetails(); $user = JFactory::getUser(); $params = self::$params; $uid = $user->id; $items = array(); $can_edit_m_state = $user->authorise('core.edit.state', 'com_pfmilestones'); $can_edit_t_state = $user->authorise('core.edit.state', 'com_pftasks'); $default = array('1', '0', '2'); $show_ms = $params->get('show_milestones', $default); $show_t = $params->get('show_tasks', $default); $ms_display = (int) $params->get('ms_display', 0); $t_display = (int) $params->get('task_display', 0); $filter_ms_complete = (int) $params->get('filter_ms_complete', 1); $filter_t_complete = (int) $params->get('filter_t_complete', 1); $filter_assigned = (int) $params->get('filter_assigned', 0); $truncate = (int) $params->get('truncate', 0); // Fix empty "Show X" settings if (is_array($show_ms) && count($show_ms) == 0) { $show_ms = $default; } if (is_array($show_t) && count($show_t) == 0) { $show_t = $default; } foreach ($data as $i => $record) { $title = ucfirst(htmlspecialchars($record->title, ENT_COMPAT, 'UTF-8')); $title2 = str_replace('&', '&', $title); if ($truncate > 0 && strlen($title) > $truncate + 3) { $title = substr($title, 0, $truncate) . '...'; } $item = '{'; $item .= 'title:\'' . $title . '\','; $item .= 'title_alt:\'' . $title2 . '\','; if ($record->type == 'milestone') { // Hide milestone? if (!in_array($record->state, $show_ms) || $filter_ms_complete == 1 && $record->complete) { continue; } $slug = $record->id . ':' . $record->alias; $pslug = self::$project . ':' . $record->p_alias; $link = JRoute::_(PFmilestonesHelperRoute::getMilestoneRoute($slug, $pslug)); $item .= 'i_type:\'ms\','; if ($ms_display == 0) { // Deadline // $item .= 'start:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'start:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'\','; $item .= 'allDay: true,'; } elseif ($ms_display == 1) { // Start and Deadline if ($record->start_time > 0) { $item2 = '{'; $item2 .= 'title:\'' . $title . '\','; $item2 .= 'title_alt:\'' . $title2 . '\','; // $item2 .= 'start:new Date(' . ($record->start_time * 1000) . '),'; $item2 .= 'start:new Date(' . $record->start_year . ', ' . ($record->start_month - 1) . ', ' . $record->start_day . '),'; $item2 .= 'allDay: true,'; $item2 .= 'ev_type:\'start\','; // Color if ($record->complete) { $item2 .= 'color:\'#468847\','; } elseif ($record->end_time < self::$time_today) { $item2 .= 'color:\'#B94A48\','; } $item2 .= 'url:\'' . JRoute::_(PFmilestonesHelperRoute::getMilestoneRoute($slug, $pslug)) . '\''; $item2 .= '}'; $items[] = $item2; } // $item .= 'start:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'start:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'end\','; $item .= 'allDay: true,'; } elseif ($ms_display == 2) { // Entire span if ($record->start_time > 0) { // $item .= 'start:new Date(' . ($record->start_time * 1000) . '),'; $item .= 'start:new Date(' . $record->start_year . ', ' . ($record->start_month - 1) . ', ' . $record->start_day . '),'; // $item .= 'end:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'end:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'span\','; } else { // $item .= 'start:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'start:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'end\','; $item .= 'allDay: true,'; } } } if ($record->type == 'task') { // Hide task? if (!in_array($record->state, $show_t) || $filter_t_complete == 1 && $record->complete) { continue; } if ($filter_assigned && !in_array($uid, $record->users)) { continue; } if ($record->complete) { $item .= 'i_type:\'tc\','; } else { $item .= 'i_type:\'ti\','; } $slug = $record->id . ':' . $record->alias; $pslug = self::$project . ':' . $record->p_alias; $mslug = $record->milestone_id . ':' . $record->m_alias; $lslug = $record->list_id . ':' . $record->l_alias; $link = JRoute::_(PFtasksHelperRoute::getTaskRoute($slug, $pslug, $mslug, $lslug)); if ($t_display == 0) { // Deadline // $item .= 'start:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'start:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'\','; $item .= 'allDay: true,'; } elseif ($t_display == 1) { // Start and Deadline if ($record->start_time > 0) { $item2 = '{'; $item2 .= 'title:\'' . ucfirst(htmlspecialchars($record->title)) . '\','; // $item2 .= 'start:new Date(' . ($record->start_time * 1000) . '),'; $item2 .= 'start:new Date(' . $record->start_year . ', ' . ($record->start_month - 1) . ', ' . $record->start_day . '),'; $item2 .= 'allDay: true,'; $item2 .= 'ev_type:\'start\','; // Color if ($record->complete) { $item2 .= 'color:\'#468847\','; } elseif ($record->end_time < self::$time_today) { $item2 .= 'color:\'#B94A48\','; } $item2 .= 'url:\'' . JRoute::_(PFtasksHelperRoute::getTaskRoute($slug, $pslug, $mslug, $lslug)) . '\''; $item2 .= '}'; $items[] = $item2; } // $item .= 'start:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'start:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'end\','; $item .= 'allDay: true,'; } elseif ($t_display == 2) { // Entire span if ($record->start_time > 0) { // $item .= 'start:new Date(' . ($record->start_time * 1000) . '),'; $item .= 'start:new Date(' . $record->start_year . ', ' . ($record->start_month - 1) . ', ' . $record->start_day . '),'; // $item .= 'end:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'end:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'span\','; } else { // $item .= 'start:new Date(' . ($record->end_time * 1000) . '),'; $item .= 'start:new Date(' . $record->end_year . ', ' . ($record->end_month - 1) . ', ' . $record->end_day . '),'; $item .= 'ev_type:\'end\','; $item .= 'allDay: true,'; } } } // Color if ($record->complete) { $item .= 'color:\'#468847\','; } elseif ($record->end_time < self::$time_today) { $item .= 'color:\'#B94A48\','; } $item .= 'url:\'' . $link . '\''; $item .= '}'; $items[] = $item; } return '[' . implode(',', $items) . ']'; }