/** * 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::_(PFprojectsHelperRoute::getDashboardRoute($row->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 if (!empty($row->category_title)) { $item->category = array(html_entity_decode($this->escape($row->category_title), ENT_COMPAT, 'UTF-8')); } // Loads item info into the RSS array $doc->addItem($item); } }
protected function getTitleLink() { if ($this->client_id) { $link = 'index.php?option=' . $this->item->extension . '&task=' . $this->item->name . '.edit' . '&id=' . (int) $this->item->item_id; } else { $item_slug = $this->item->item_id . ':' . $this->item->metadata->get('alias'); $link = PFprojectsHelperRoute::getDashboardRoute($item_slug); } return JRoute::_($link); }
/** * Generates the toolbar for the top of the view * * @return string Toolbar with buttons */ protected function getToolbar() { $id = empty($this->item) || empty($this->item->id) ? null : $this->item->id; $access = PFprojectsHelper::getActions($id); $uid = JFactory::getUser()->get('id'); if (!empty($id)) { $slug = $this->item->id . ':' . $this->item->alias; $return = base64_encode(PFprojectsHelperRoute::getDashboardRoute($slug)); PFToolbar::button('COM_PROJECTFORK_ACTION_EDIT', '', false, array('access' => $access->get('core.edit') || $access->get('core.edit.own') && $uid == $this->item->created_by, 'href' => JRoute::_(PFprojectsHelperRoute::getProjectsRoute() . '&task=form.edit&id=' . $slug . '&return=' . $return))); } return PFToolbar::render(); }
/** * 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 getCommentMessage($lang, $receiver, $user, $after, $before, $is_new) { if (!$is_new) { return false; } list($component, $item) = explode('.', $after->context, 2); $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); $class_name = 'PF' . str_replace('com_pf', '', $component) . 'NotificationsHelper'; $value = null; if (class_exists($class_name)) { if (in_array('getItemName', get_class_methods($class_name))) { $item = call_user_func(array($class_name, 'getItemName'), $after->context); } } switch ($item) { case 'project': $link = PFprojectsHelperRoute::getDashboardRoute($after->project_id); break; default: $class_name = 'PF' . str_replace('com_pf', '', $component) . 'HelperRoute'; $method = 'get' . ucfirst($item) . 'Route'; $link = ''; if (file_exists(JPATH_SITE . '/components/' . $component . '/helpers/route.php')) { JLoader::register($class_name, JPATH_SITE . '/components/' . $component . '/helpers/route.php'); } if (class_exists($class_name)) { if (in_array($method, get_class_methods($class_name))) { $link = call_user_func_array(array($class_name, $method), array($after->item_id, $after->project_id)); } } break; } $format = $lang->_($txt_prefix . '_MESSAGE'); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . $link); $txt = sprintf($format, $receiver->name, $user->name, strip_tags($after->description), $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); return $txt; }
<?php echo $item->event->beforeDisplayContent; ?> <div class="item-description"> <dl class="article-info dl-horizontal pull-right"> <dt class="project-title"> <?php echo JText::_('JGRID_HEADING_PROJECT'); ?> : </dt> <dd class="project-data"> <a href="<?php echo JRoute::_(PFprojectsHelperRoute::getDashboardRoute($item->project_slug)); ?> "><?php echo $item->project_title; ?> </a> </dd> <?php if ($item->milestone_id) { ?> <dt class="milestone-title"> <?php echo JText::_('JGRID_HEADING_MILESTONE'); ?> : </dt>
<?php if ($params->get('show_page_heading', 1)) { ?> <h1><?php echo $this->escape($params->get('page_heading')); ?> </h1> <?php } ?> <div class="cat-items"> <form id="adminForm" name="adminForm" method="post" action="<?php echo JRoute::_(PFprojectsHelperRoute::getDashboardRoute($state->get('filter.project'))); ?> "> <?php if ($state->get('filter.project') && !empty($item)) { ?> <div class="btn-group pull-right"> <a data-toggle="collapse" data-target="#project-details" class="btn<?php echo $details_active; ?> "> <?php echo JText::_('COM_PROJECTFORK_DETAILS_LABEL'); ?> <span class="caret"></span>
/** * 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 getProjectMessage($lang, $receiver, $user, $after, $before, $is_new) { $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); // Get the changed fields $props = array('description', 'catid', 'created_by', 'access', 'start_date', 'end_date'); $changes = array(); if (is_object($before) && is_object($after)) { $changes = PFObjectHelper::getDiff($before, $after, $props); } if (!count($changes)) { return false; } $format = $lang->_($txt_prefix . '_MESSAGE'); $changes = PFnotificationsHelper::formatChanges($lang, $changes); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . PFprojectsHelperRoute::getDashboardRoute($after->id . ':' . $after->alias)); $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 projects to render in the gantt chart * * @return array $items The items to render */ protected static function getItemsOverview() { $data = modPFganttHelperProjects::getItems(); $user = JFactory::getUser(); $config = JFactory::getConfig(); $params = self::$params; $items = array(); $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; foreach ($data as $i => $record) { $link = JRoute::_(PFprojectsHelperRoute::getDashboardRoute($record->id . ':' . $record->alias)); $name = '<i class="icon-star' . ($record->complete ? '' : '-empty') . '"></i> ' . '<a href="' . $link . '">' . ucfirst(htmlspecialchars($record->title)) . '</a>'; // Create row object $row = new stdClass(); $row->name = $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(); $item->label = ucfirst(htmlspecialchars($record->title)); $item->desc = ''; $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 . ')/'; // Determine custom class $item->customClass = 'gantt-p'; $item->id = 'gantt-p-' . $record->id; 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'; } // Highlight today? if ($highlight) { $hl = new stdClass(); $hl->label = ''; $hl->desc = ''; $hl->from = '/Date(' . intval($date_now->format('Y', true, false)) . ', ' . intval($date_now->format('m', true, false) - 1) . ', ' . intval($date_now->format('d', true, false)) . ')/'; $hl->to = '/Date(' . intval($date_now->format('Y', true, false)) . ', ' . intval($date_now->format('m', true, false) - 1) . ', ' . intval($date_now->format('d', true, false)) . ')/'; $hl->customClass = 'gantt-today'; $row->values[] = $hl; } $row->values[] = $item; $items[] = $row; } return $items; }
/** * Method to get a json encoded list of projects to render in the calendar * * @return array $items The items to render */ protected static function getItemsOverview() { $params = self::$params; $data = modPFcalendarHelperProjects::getItems(); $db = JFactory::getDbo(); $items = array(); $display = (int) $params->get('project_display', 0); $truncate = (int) $params->get('truncate', 0); 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 . '\','; // Display style if ($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 ($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::_(PFprojectsHelperRoute::getDashboardRoute($record->id . ':' . $record->alias)) . '\''; $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 ($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:\'' . JRoute::_(PFprojectsHelperRoute::getDashboardRoute($record->id . ':' . $record->alias)) . '\''; $item .= '}'; $items[] = $item; } return '[' . implode(',', $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 getAttachmentMessage($lang, $receiver, $user, $after, $before, $is_new) { if (!$is_new) { return false; } list($component, $item) = explode('.', $after->item_type, 2); $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); $class_name = 'PF' . str_replace('com_pf', '', $component) . 'NotificationsHelper'; $value = null; if (class_exists($class_name)) { $methods = get_class_methods($class_name); if (in_array('getItemName', $methods)) { $item = call_user_func(array($class_name, 'getItemName'), $after->context); } if (in_array('translateItem', $methods)) { $value = call_user_func_array(array($class_name, 'translateItem'), array($after->item_type, $after->item_id)); } } if (!$value) { $value = PFnotificationsHelper::translateValue($item . '_id', $after->item_id); } switch ($item) { case 'project': $link = PFprojectsHelperRoute::getDashboardRoute($after->project_id); break; default: $class_name = 'PF' . str_replace('com_pf', '', $component) . 'HelperRoute'; $method = 'get' . ucfirst($item) . 'Route'; $link = ''; if (class_exists($class_name)) { if (in_array($method, get_class_methods($class_name))) { $link = call_user_func_array(array($class_name, $method), array($after->item_id, $after->project_id)); } } break; } $format = $lang->_($txt_prefix . '_MESSAGE'); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . $link); $txt = sprintf($format, $receiver->name, $user->name, $value, $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); return $txt; }