Exemple #1
0
 /**
  * Build Data object
  *
  * @return  HTML string
  */
 public function buildDataObject($att, $view, $i = 1)
 {
     // Get configs
     $configs = $this->getConfigs($view->manifest->params, $view->elementId, $view->pub, $view->master->params);
     $data = new \Components\Projects\Models\File($att->path, $configs->path);
     // Customize title
     $defaultTitle = $view->manifest->params->title ? str_replace('{pubtitle}', $view->pub->title, $view->manifest->params->title) : NULL;
     $defaultTitle = $view->manifest->params->title ? str_replace('{pubversion}', $view->pub->version_label, $defaultTitle) : NULL;
     // Set default title
     $incNum = $view->manifest->params->max > 1 ? ' (' . $i . ')' : '';
     $dTitle = $defaultTitle ? $defaultTitle . $incNum : $data->get('name');
     $title = $att->title && $att->title != $defaultTitle ? $att->title : $dTitle;
     $data->set('title', $title);
     $fpath = $this->getFilePath($att->path, $att->id, $configs, $att->params);
     $data->set('fpath', $fpath);
     $data->set('ordering', $i);
     $data->set('pub', $view->pub);
     $data->set('id', $att->id);
     $data->set('hash', $att->vcs_hash);
     $data->set('md5Hash', $att->content_hash);
     $data->set('viewer', $view->viewer);
     $data->set('pubPath', $configs->pubPath);
     $data->set('props', $view->master->block . '-' . $view->master->blockId . '-' . $view->elementId);
     $data->set('downloadUrl', Route::url($view->pub->link('serve') . '&el=' . $view->elementId . '&a=' . $att->id . '&download=1'));
     // Is attachment (image) also publication thumbnail
     $params = new \Hubzero\Config\Registry($att->params);
     $data->set('pubThumb', $params->get('pubThumb', NULL));
     $data->set('suffix', $params->get('suffix', NULL));
     return $data;
 }
Exemple #2
0
 /**
  * Draw list
  *
  * @return  boolean
  */
 public function drawPackageList($attachments, $element, $elementId, $pub, $blockParams, $authorized)
 {
     // Get configs
     $configs = $this->getConfigs($element->params, $elementId, $pub, $blockParams);
     $list = NULL;
     if (!$attachments) {
         return false;
     }
     $list .= '<li>' . \Components\Projects\Models\File::drawIcon('csv') . ' data.csv</li>';
     // Add data files
     $dataFiles = array();
     if (is_dir($configs->dataPath)) {
         $dataFiles = Filesystem::files($configs->dataPath, '.', true, true);
     }
     if (!empty($dataFiles)) {
         $list .= '<li>' . \Components\Projects\Models\File::drawIcon('folder') . ' data</li>';
         foreach ($dataFiles as $e) {
             // Skip thumbnails and CSV
             if (preg_match("/_tn.gif/", $e) || preg_match("/_medium.gif/", $e) || preg_match("/data.csv/", $e)) {
                 continue;
             }
             $file = new \Components\Projects\Models\File($e);
             $fileinfo = pathinfo($e);
             $a_dir = $fileinfo['dirname'];
             $a_dir = trim(str_replace($configs->dataPath, '', $a_dir), DS);
             $fPath = $a_dir && $a_dir != '.' ? $a_dir . DS : '';
             $where = 'data' . DS . $fPath . basename($e);
             $list .= '<li class="level2"><span class="item-title">' . $file::drawIcon($file->get('ext')) . ' ' . trim($where, DS) . '</span></li>';
         }
     }
     return $list;
 }
Exemple #3
0
    ?>
<div class="public-list-header">
	<h3><?php 
    echo ucfirst(Lang::txt('COM_PROJECTS_PUBLIC'));
    ?>
 <?php 
    echo Lang::txt('COM_PROJECTS_FILES');
    ?>
</h3>
</div>
<div class="public-list-wrap">
	<ul>
		<?php 
    foreach ($items as $item) {
        $ref = json_decode($item->reference);
        $file = new \Components\Projects\Models\File($e);
        ?>
		<li><a href="<?php 
        echo Route::url($this->model->link('stamp') . '&s=' . $item->stamp);
        ?>
"><?php 
        echo $file::drawIcon($file->get('ext'));
        ?>
 <?php 
        echo basename($ref->file);
        ?>
</li>
		<?php 
    }
    ?>
	</ul>