예제 #1
0
파일: pfrepo.php 프로젝트: MrJookie/pm
 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);
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
        $icon = 'icon-checkbox';
        $rev_tt = JText::_('COM_PROJECTFORK_REV_HEAD_DESC');
        $link = PFrepoHelperRoute::getNoteRoute($item->slug, $item->project_slug, $item->dir_slug, $item->path);
        $desc = $item->text;
    } elseif ($item->ordering == 1) {
        $rev_id = $txt_root;
        $rev_class = ' badge-inverse';
        $icon = 'icon-checkbox-partial';
        $rev_tt = JText::_('COM_PROJECTFORK_REV_ROOT_DESC');
        $desc = $item->description;
    } else {
        $rev_id = (int) $item->ordering;
        $desc = $item->description;
    }
    if (empty($link)) {
        $link = PFrepoHelperRoute::getNoteRoute($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 
예제 #4
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 getNoteMessage($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::getNoteRoute($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;
 }