Example #1
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;
 }
Example #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);
     if ($configs->includeInPackage == false) {
         return false;
     }
     $list = NULL;
     if (!$attachments) {
         return false;
     }
     $class = $configs->multiZip == 1 && count($attachments) > 1 ? 'level2' : 'level1';
     // Draw bundles
     if ($configs->multiZip == 1 && $attachments && count($attachments) > 1) {
         $title = $configs->bundleTitle ? $configs->bundleTitle : 'Bundle';
         $list .= '<li>' . \Components\Projects\Models\File::drawIcon('zip') . ' ' . $title . '</li>';
     }
     // Draw directories
     if ($configs->multiZip == 2 && $configs->subdir || $configs->bundleDirectory) {
         // Bundle name
         $name = $configs->bundleDirectory ? $configs->bundleDirectory : $configs->subdir;
         $list .= '<li>' . \Components\Projects\Models\File::drawIcon('folder') . ' ' . $name . '</li>';
         $class = 'level2';
     }
     // List individual
     foreach ($attachments as $attach) {
         $filePath = $this->getFilePath($attach->path, $attach->id, $configs, $attach->params);
         if (file_exists($filePath)) {
             $fileinfo = pathinfo($filePath);
             $a_dir = $fileinfo['dirname'];
             $a_dir = trim(str_replace($configs->pubPath, '', $a_dir), DS);
             $fPath = $a_dir && $a_dir != '.' ? $a_dir . DS : '';
             $fPath .= basename($filePath);
             $where = '';
             if ($configs->directory && strtolower($configs->bundleDirectory) != strtolower($configs->directory)) {
                 $where .= $configs->directory != $pub->secret ? DS . $configs->directory : '';
             }
             $where .= $configs->subdir && $class == 'level1' ? DS . $configs->subdir : '';
             $where .= DS . $fPath;
             if (!$configs->bundleDirHierarchy) {
                 $where = $configs->subdir && $class == 'level1' ? DS . $configs->subdir : '';
                 $where .= DS . basename($filePath);
             }
             // File model
             $file = new \Components\Projects\Models\File($filePath);
             $list .= '<li class="' . $class . '"><span class="item-title" id="file-' . $attach->id . '">' . $file::drawIcon($file->get('ext')) . ' ' . trim($where, DS) . '</span>';
             $list .= '<span class="item-details">' . $attach->path . '</span>';
             $list .= '</li>';
         }
     }
     return $list;
 }
Example #3
0
    echo $this->option;
    ?>
" />

				<p><?php 
    echo Lang::txt('PLG_PROJECTS_FILES_DELETE_FILES_CONFIRM');
    ?>
</p>

				<ul class="sample">
					<?php 
    foreach ($this->items as $file) {
        ?>
						<li>
							<?php 
        echo \Components\Projects\Models\File::drawIcon($file->getExtension());
        ?>
							<?php 
        echo $file->getName();
        ?>
							<?php 
        echo $file->isDir() ? '<input type="hidden" name="folder[]" value="' . urlencode($file->getPath()) . '" />' : '<input type="hidden" name="asset[]"  value="' . urlencode($file->getPath()) . '" />';
        ?>
						</li>
					<?php 
    }
    ?>
				</ul>

				<p class="submitarea">
					<input type="submit" class="btn" value="<?php 
Example #4
0
 /**
  * Produce publication package
  *
  * @return     boolean
  */
 public function showPackageContents()
 {
     if (!$this->_pub) {
         return false;
     }
     // Get elements
     $prime = $this->getElements(1);
     $second = $this->getElements(2);
     $gallery = $this->getElements(3);
     $elements = array_merge($prime, $second, $gallery);
     // Do we have items to package?
     if (!$elements) {
         return '<p class="witherror">' . Lang::txt('COM_PUBLICATIONS_CURATION_PACKAGE_ERROR_NO_FILES') . '</p>';
     }
     // Get attachment type model
     $attModel = new Attachments($this->_db);
     $contents = '<ul class="filelist">';
     $contents .= $attModel->showPackagedItems($elements, $this->_pub);
     // Custom license to be included in LICENSE.txt
     if ($this->_pub->license_text) {
         $contents .= '<li>' . \Components\Projects\Models\File::drawIcon('txt') . ' LICENSE.txt</li>';
     }
     $contents .= '<li>' . \Components\Projects\Models\File::drawIcon('txt') . ' README.txt</li>';
     $contents .= '</ul>';
     return $contents;
 }