Exemple #1
0
 protected function getTitleLink()
 {
     $meta =& $this->item->metadata;
     if ($this->item->name == 'directory') {
         if ($this->client_id) {
             $link = 'index.php?option=' . $this->item->extension . '&filter_project=' . $this->item->xref_id . '&filter_parent_id=' . (int) $this->item->item_id;
         } else {
             $item_slug = $this->item->item_id . ':' . $meta->get('alias');
             $p_slug = $this->item->xref_id . ':' . $meta->get('p_alias');
             $link = PFrepoHelperRoute::getRepositoryRoute($p_slug, $item_slug, $meta->get('path'));
         }
     }
     if ($this->item->name == 'note') {
         if ($this->client_id) {
             $link = 'index.php?option=' . $this->item->extension . '&task=note.edit' . '&filter_project=' . $this->item->xref_id . '&filter_parent_id=' . $meta->get('d_id') . '&id=' . $this->item->item_id;
         } else {
             $item_slug = $this->item->item_id . ':' . $meta->get('alias');
             $p_slug = $this->item->xref_id . ':' . $meta->get('p_alias');
             $d_slug = $meta->get('d_id') . ':' . $meta->get('d_alias');
             $link = PFrepoHelperRoute::getNoteRoute($item_slug, $p_slug, $d_slug, $meta->get('path'));
         }
     }
     if ($this->item->name == 'file') {
         if ($this->client_id) {
             $link = 'index.php?option=' . $this->item->extension . '&task=file.download' . '&filter_project=' . $this->item->xref_id . '&filter_parent_id=' . $meta->get('d_id') . '&id=' . $this->item->item_id;
         } else {
             $item_slug = $this->item->item_id . ':' . $meta->get('alias');
             $p_slug = $this->item->xref_id . ':' . $meta->get('p_alias');
             $d_slug = $meta->get('d_id') . ':' . $meta->get('d_alias');
             $link = PFrepoHelperRoute::getFileRoute($item_slug, $p_slug, $d_slug, $meta->get('path'));
         }
     }
     return JRoute::_($link);
 }
 /**
  * Returns a list with attachments
  *
  * @param     array     $items    The attachment objects
  *
  * @return    string
  */
 public static function attachments($items = array())
 {
     if (!is_array($items) || !count($items)) {
         return '';
     }
     $user = JFactory::getUser();
     $levels = $user->getAuthorisedViewLevels();
     $admin = $user->authorise('core.admin', 'com_pfrepo');
     $html[] = '<ul class="unstyled">';
     foreach ($items as $item) {
         if (!isset($item->repo_data) || empty($item->repo_data)) {
             continue;
         }
         $data =& $item->repo_data;
         if (!$admin && !in_array($data->access, $levels)) {
             continue;
         }
         list($asset, $id) = explode('.', $item->attachment, 2);
         $icon = '<i class="icon-file"></i> ';
         $link = '#';
         if ($asset == 'directory') {
             $icon = '<i class="icon-folder"></i> ';
             $link = PFrepoHelperRoute::getRepositoryRoute($data->project_id . ':' . $data->project_alias, $data->id . ':' . $data->alias, $data->path);
         }
         if ($asset == 'note') {
             $icon = '<i class="icon-pencil"></i> ';
             $link = PFrepoHelperRoute::getNoteRoute($data->id . ':' . $data->alias, $data->project_id . ':' . $data->project_alias, $data->dir_id . ':' . $data->dir_alias, $data->path);
         }
         if ($asset == 'file') {
             $link = PFrepoHelperRoute::getFileRoute($data->id . ':' . $data->alias, $data->project_id . ':' . $data->project_alias, $data->dir_id . ':' . $data->dir_alias, $data->path);
         }
         $html[] = '<li>';
         $html[] = $icon;
         $html[] = '<a href="' . JRoute::_($link) . '">';
         $html[] = htmlspecialchars($data->title, ENT_COMPAT, 'UTF-8');
         $html[] = '</a>';
         $html[] = '</li>';
     }
     $html[] = '</ul>';
     return implode('', $html);
 }
 * @author       Tobias Kuhn (eaxs)
 * @copyright    Copyright (C) 2006-2013 Tobias Kuhn. All rights reserved.
 * @license      http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
 */
defined('_JEXEC') or die;
$user = JFactory::getUser();
$uid = $user->get('id');
$x = count($this->items['directories']) + count($this->items['notes']);
$this_dir = $this->items['directory'];
$this_path = empty($this_dir) ? '' : $this_dir->path;
$filter_search = $this->state->get('filter.search');
$filter_project = (int) $this->state->get('filter.project');
$is_search = empty($filter_search) ? false : true;
$txt_revs = JText::_('COM_PROJECTFORK_VIEW_REVISIONS');
foreach ($this->items['files'] as $i => $item) {
    $link = PFrepoHelperRoute::getFileRoute($item->slug, $item->project_slug, $item->dir_slug, $item->path);
    $access = PFrepoHelper::getActions('file', $item->id);
    $icon = $this->escape(strtolower($item->file_extension));
    $can_create = $access->get('core.create');
    $can_edit = $access->get('core.edit');
    $can_checkin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $uid || $item->checked_out == 0;
    $can_edit_own = $access->get('core.edit.own') && $item->created_by == $uid;
    $can_change = $access->get('core.edit.state') && $can_checkin;
    $date_opts = array('past-class' => '', 'past-icon' => 'calendar');
    ?>
    <tr class="row<?php 
    echo $i % 2;
    ?>
">
        <?php 
    if ($this_dir->parent_id >= 1) {
    if (!isset($item->ordering)) {
        $rev_id = $txt_head;
        $rev_class = ' badge-success';
        $icon = 'icon-checkbox';
        $rev_tt = JText::_('COM_PROJECTFORK_REV_HEAD_DESC');
        $dl_link = PFrepoHelperRoute::getFileRoute($item->slug, $item->project_slug, $item->dir_slug, $item->path);
    } elseif ($item->ordering == 1) {
        $rev_id = $txt_root;
        $rev_class = ' badge-inverse';
        $icon = 'icon-checkbox-partial';
        $rev_tt = JText::_('COM_PROJECTFORK_REV_ROOT_DESC');
    } else {
        $rev_id = (int) $item->ordering;
    }
    if (empty($dl_link)) {
        $dl_link = PFrepoHelperRoute::getFileRoute($file->slug, $file->project_slug, $file->dir_slug, $file->path, $item->id);
    }
    ?>
                        <tr class="row<?php 
    echo $i % 2;
    ?>
">
                            <td class="nowrap">
                                <span class="badge hasTip hasTooltip<?php 
    echo $rev_class;
    ?>
" title="<?php 
    echo $rev_tt;
    ?>
">
                                    <i class="<?php 
Exemple #5
0
 /**
  * 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 getFileMessage($lang, $receiver, $user, $after, $before, $is_new)
 {
     // Get the changed fields
     $props = array('description', 'created_by', 'access');
     $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() . PFrepoHelperRoute::getFileRoute($after->id, $after->project_id, $after->dir_id));
     $txt = sprintf($format, $receiver->name, $user->name, $changes, $link);
     $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer);
     return $txt;
 }