Advertisement
Guest User

Untitled

a guest
Nov 11th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 12.74 KB | None | 0 0
  1. <?php defined('_JEXEC') or die('Restricted access');
  2.  
  3. $db         = &JFactory::getDBO();
  4. $user       = &JFactory::getUser();
  5. $config     = &JFactory::getConfig();
  6. $nullDate   = $db->getNullDate();
  7. $now        = &JFactory::getDate();
  8.  
  9. echo '<div id="phocadownload-upload">'.$this->tmpl['iepx'];
  10.  
  11. if ($this->tmpl['displayupload'] == 1) {
  12.  
  13.  
  14. ?>
  15. <script type="text/javascript">
  16. Joomla.submitbutton = function(task, id)
  17. {
  18.     if (id > 0) {
  19.         document.getElementById('phocadownloadfiles-form').actionid.value = id;
  20.     }
  21.     Joomla.submitform(task, document.getElementById('phocadownloadfiles-form'));
  22.    
  23. }
  24. </script>
  25.  
  26.  
  27.  
  28.  
  29. <fieldset>
  30.  
  31. <legend><h3>Files Caricati</h3></legend>
  32. <form action="<?php echo htmlspecialchars($this->tmpl['action']);?>" method="post" name="phocadownloadfilesform" id="phocadownloadfiles-form">
  33. <table>
  34.     <tr>
  35.         <td align="left" width="100%"><?php echo JText::_( 'COM_PHOCADOWNLOAD_FILTER' ); ?>:
  36.         <input type="text" name="search" id="pdsearch" value="<?php echo $this->listsfiles['search'];?>" onchange="document.phocadownloadfilesform.submit();" />
  37.         <button class="btn" onclick="this.form.submit();"><?php echo JText::_( 'COM_PHOCADOWNLOAD_SEARCH' ); ?></button>
  38.         <button class="btn" onclick="document.getElementById('pdsearch').value='';document.phocadownloadfilesform.submit();"><?php echo JText::_( 'COM_PHOCADOWNLOAD_RESET' ); ?></button></td>
  39.         <td nowrap="nowrap"><?php echo $this->listsfiles['catid'];?></td>
  40.        
  41.        
  42.     </tr>
  43. </table>
  44.        
  45. <table class="adminlist">
  46. <thead>
  47.     <tr>
  48.     <th class="title" width="50%"><?php echo JHTML::_('grid.sort',  'COM_PHOCADOWNLOAD_TITLE', 'a.title', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image'); ?></th>
  49.     <th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort',  'COM_PHOCADOWNLOAD_PUBLISHED', 'a.published', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?></th>
  50.     <th width="3%" nowrap="nowrap"><?php echo JText::_('COM_PHOCADOWNLOAD_DELETE'); ?></th>
  51.     <th width="3%" nowrap="nowrap"><?php echo JText::_('COM_PHOCADOWNLOAD_ACTIVE'); ?></th>
  52.     <th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_APPROVED', 'a.approved', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?></th>
  53.  
  54.     <th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_DATE_UPLOAD', 'a.date', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?></th>
  55.    
  56.    
  57.     <th width="3%" nowrap="nowrap"><?php echo JHTML::_('grid.sort', 'COM_PHOCADOWNLOAD_CATEGORY', 'a.catid', $this->listsfiles['order_Dir'], $this->listsfiles['order'], 'image' ); ?></th>
  58.  
  59. </thead>
  60.            
  61. <tbody><?php
  62. $k      = 0;
  63. $i      = 0;
  64. $n      = count( $this->tmpl['filesitems'] );
  65. $rows   = &$this->tmpl['filesitems'];
  66.  
  67. if (is_array($rows)) {
  68.     foreach ($rows as $row) {
  69.    
  70.     // USER RIGHT - Delete (Publish/Unpublish) - - - - - - - - - - -
  71.     // 2, 2 means that user access will be ignored in function getUserRight for display Delete button
  72.     // because we cannot check the access and delete in one time
  73.     $user = JFactory::getUser();
  74.     $rightDisplayDelete = 0;
  75.     $catAccess  = PhocaDownloadHelper::getCategoryAccessByFileId((int)$row->id);
  76.  
  77.     if (!empty($catAccess)) {
  78.         $rightDisplayDelete = PhocaDownloadHelper::getUserRight('deleteuserid', $catAccess->deleteuserid, 2, $user->authorisedLevels(), $user->get('id', 0), 0);
  79.     }
  80.     // - - - - - - - - - - - - - - - - - - - - - -
  81.  
  82.     ?><tr class="<?php echo "row$k"; ?>">
  83.  
  84.     <td><?php echo $row->title; ?></td>
  85.    
  86.     <?php
  87.  
  88.     // Publish Unpublish
  89.     echo '<td align="center">';
  90.     if ($row->published == 1) {
  91.         if ($rightDisplayDelete) {
  92.             echo '<a href="javascript:void(0)" onclick="javascript:Joomla.submitbutton(\'unpublish\', '.(int)$row->id.');" >';
  93.             echo JHTML::_('image', $this->tmpl['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_PUBLISHED'));
  94.             echo '</a>';
  95.         } else {
  96.             echo JHTML::_('image', $this->tmpl['pi'].'icon-publish-g.png', JText::_('COM_PHOCADOWNLOAD_PUBLISHED'));
  97.         }
  98.     }
  99.     if ($row->published == 0) {
  100.         if ($rightDisplayDelete) {
  101.             echo '<a href="javascript:void(0)" onclick="javascript:Joomla.submitbutton(\'publish\', '.(int)$row->id.');" >';
  102.             echo JHTML::_('image', $this->tmpl['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
  103.             echo '</a>';
  104.         } else {
  105.             echo JHTML::_('image', $this->tmpl['pi'].'icon-unpublish-g.png', JText::_('COM_PHOCADOWNLOAD_UNPUBLISHED'));
  106.         }
  107.     }
  108.     echo '</td>';
  109.    
  110.     echo '<td align="center">';
  111.     if ($rightDisplayDelete) {
  112.         echo '<a href="javascript:void(0)" onclick="javascript: if (confirm(\''.JText::_('COM_PHOCADOWNLOAD_WARNING_DELETE_ITEMS').'\')) {Joomla.submitbutton(\'delete\', '.(int)$row->id.');}" >';
  113.         echo JHTML::_('image', $this->tmpl['pi'].'icon-trash.png', JText::_('COM_PHOCADOWNLOAD_DELETE'));
  114.         echo '</a>';
  115.     } else {
  116.         echo JHTML::_('image', $this->tmpl['pi'].'icon-trash-g.png', JText::_('COM_PHOCADOWNLOAD_DELETE'));
  117.     }
  118.     echo '</td>';
  119.    
  120.     echo '<td align="center">';
  121.     // User should get info about active/not active file (if e.g. admin change the active status)          
  122.     $publish_up     = &JFactory::getDate($row->publish_up);
  123.     $publish_down   = &JFactory::getDate($row->publish_down);
  124.     $publish_up->setOffset($config->getValue('config.offset'));
  125.     $publish_down->setOffset($config->getValue('config.offset'));
  126.     if ( $now->toUnix() <= $publish_up->toUnix() ) {
  127.         $text = JText::_( 'COM_PHOCADOWNLOAD_PENDING' );
  128.     } else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) ) {
  129.         $text = JText::_( 'COM_PHOCADOWNLOAD_ACTIVE' );
  130.     } else if ( $now->toUnix() > $publish_down->toUnix() ) {
  131.         $text = JText::_( 'COM_PHOCADOWNLOAD_EXPIRED' );
  132.     }
  133.  
  134.     $times = '';
  135.     if (isset($row->publish_up)) {
  136.         if ($row->publish_up == $nullDate) {
  137.             $times .= JText::_( 'COM_PHOCADOWNLOAD_START') . ': '.JText::_( 'COM_PHOCADOWNLOAD_ALWAYS' );
  138.         } else {
  139.             $times .= JText::_( 'COM_PHOCADOWNLOAD_START') .": ". $publish_up->toFormat();
  140.         }
  141.     }
  142.     if (isset($row->publish_down)) {
  143.         if ($row->publish_down == $nullDate) {
  144.             $times .= "<br />". JText::_( 'COM_PHOCADOWNLOAD_FINISH'). ': '. JText::_('COM_PHOCADOWNLOAD_NO_EXPIRY' );
  145.         } else {
  146.             $times .= "<br />". JText::_( 'COM_PHOCADOWNLOAD_FINISH') .": ". $publish_down->toFormat();
  147.         }
  148.     }
  149.    
  150.     if ( $times ) {
  151.         echo '<span class="editlinktip hasTip" title="'. JText::_( 'COM_PHOCADOWNLOAD_PUBLISH_INFORMATION' ).'::'. $times.'">'
  152.             .'<a href="javascript:void(0);" >'. $text.'</a></span>';
  153.     }
  154.    
  155.    
  156.     echo '</td>';
  157.    
  158.     // Approved
  159.     echo '<td align="center">';
  160.     if ($row->approved == 1) {
  161.         echo JHTML::_('image', $this->tmpl['pi'].'icon-publish.png', JText::_('COM_PHOCADOWNLOAD_APPROVED'));
  162.     } else {   
  163.         echo JHTML::_('image', $this->tmpl['pi'].'icon-unpublish.png', JText::_('COM_PHOCADOWNLOAD_NOT_APPROVED'));
  164.     }
  165.     echo '</td>';
  166.    
  167.     echo '<td align="center">'. $row->date .'</td>';
  168.    
  169.  
  170.     echo '<td align="center">'. $row->categorytitle .'</td>'
  171.     //echo '<td align="center">'. $row->id .'</td>'
  172.     .'</tr>';
  173.  
  174.         $k = 1 - $k;
  175.         $i++;
  176.     }
  177. }
  178. ?></tbody>
  179. <tfoot>
  180.     <tr>
  181.     <td colspan="7" class="footer"><?php
  182.    
  183. //$this->tmpl['filespagination']->setTab($this->tmpl['currenttab']['files']);
  184. if (count($this->tmpl['filesitems'])) {
  185.     echo '<div><center>';
  186.     echo '<div style="margin:0 10px 0 10px;display:inline;">'
  187.         .JText::_('COM_PHOCADOWNLOAD_DISPLAY_NUM') .'&nbsp;'
  188.         .$this->tmpl['filespagination']->getLimitBox()
  189.         .'</div>';
  190.     echo '<div class="sectiontablefooter'.$this->params->get( 'pageclass_sfx' ).'" style="margin:0 10px 0 10px;display:inline;" >'
  191.         .$this->tmpl['filespagination']->getPagesLinks()
  192.         .'</div>';
  193.     echo '<div class="pagecounter" style="margin:0 10px 0 10px;display:inline;">'
  194.         .$this->tmpl['filespagination']->getPagesCounter()
  195.         .'</div>';
  196.     echo '</center></div>';
  197. }
  198.  
  199.  
  200.  
  201.  
  202. ?></td>
  203.     </tr>
  204. </tfoot>
  205. </table>
  206.  
  207.  
  208. <?php echo JHTML::_( 'form.token' ); ?>
  209.  
  210. <input type="hidden" name="controller" value="user" />
  211. <input type="hidden" name="task" value=""/>
  212. <input type="hidden" name="view" value="user"/>
  213. <input type="hidden" name="actionid" value=""/>
  214. <input type="hidden" name="tab" value="<?php echo $this->tmpl['currenttab']['files'];?>" />
  215. <input type="hidden" name="limitstart" value="<?php echo $this->tmpl['filespagination']->limitstart;?>" />
  216. <input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid', 0, '', 'int') ?>"/>
  217. <input type="hidden" name="filter_order" value="<?php echo $this->listsfiles['order']; ?>" />
  218. <input type="hidden" name="filter_order_Dir" value="" />
  219.  
  220. </form>
  221. </fieldset>
  222. <?php
  223.  
  224. // Upload  
  225. /* <td><input type="text" id="phocadownload-upload-license" name="phocadownloaduploadlicense" value="<?php echo $this->formdata->license ?>"  maxlength="255" class="comment-input" /></td>
  226.  <td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_LICENSE' ); ?>:</strong></td> */
  227.  
  228. $currentFolder = '';
  229. if (isset($this->state->folder) && $this->state->folder != '') {
  230.     $currentFolder = $this->state->folder;
  231. }
  232. ?><fieldset>
  233. <legend><?php
  234.     echo JText::_( 'COM_PHOCADOWNLOAD_UPLOAD_FILE' ).' [ '. JText::_( 'COM_PHOCADOWNLOAD_MAX_SIZE' ).':&nbsp;'.$this->tmpl['uploadmaxsizeread'].']';
  235. ?></legend>
  236.                
  237. <?php
  238. if ($this->tmpl['errorcatid'] != '') {
  239.     echo '<div class="error">' . $this->tmpl['errorcatid'] . '</div>';
  240. } ?>
  241.                
  242. <form onsubmit="return OnUploadSubmitFile();" action="<?php echo $this->tmpl['actionamp'] ?>task=upload&amp;<?php echo $this->session->getName().'='.$this->session->getId(); ?>&amp;<?php echo JUtility::getToken();?>=1" name="phocadownloaduploadform" id="phocadownload-upload-form" method="post" enctype="multipart/form-data">
  243. <br>
  244. <h3>Carica nuovo File</h3>
  245. <legend></legend>
  246. <br>
  247. <table>
  248.     <!--<td><strong><?php echo JText::_('Cartella');?>:</strong></td>
  249.             <td nowrap="nowrap"><?php echo $this->listsfiles['catid'];?>
  250.             </td>
  251.                 !-->   
  252.         <tr>
  253.             <td><strong><?php echo JText::_('COM_PHOCADOWNLOAD_FILENAME');?>:</strong></td><td>
  254.             <input type="file"  id="file-upload" name="Filedata" />
  255.            
  256.             <span id="upload-clear"></span></td>
  257.            
  258.         </tr>
  259.        
  260.         <tr>   
  261.        
  262.             <td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_FILE_TITLE' ); ?>:</strong></td>
  263.            
  264.             <td><input type="text"  id="phocadownload-upload-title" name="phocadownloaduploadtitle" value="<?php echo $this->formdata->title ?>"  maxlength="255" class="comment-input" /></td>
  265.            
  266.         </tr>
  267.        
  268.         <tr>
  269.             <td><strong><?php echo JText::_( 'COM_PHOCADOWNLOAD_DESCRIPTION' ); ?>:</strong></td>
  270.             <td><textarea id="phocadownload-upload-description" name="phocadownloaduploaddescription" onkeyup="countCharsUpload();" cols="30" rows="4" class="comment-input"><?php echo $this->formdata->description ?></textarea></td>
  271.         </tr>
  272.         <tr>
  273.             <td>&nbsp;</td>
  274.             <td><?php echo JText::_('COM_PHOCADOWNLOAD_CHARACTERS_WRITTEN');?> <input name="phocadownloaduploadcountin" value="0" readonly="readonly" class="comment-input2" /> <?php echo JText::_('COM_PHOCADOWNLOAD_AND_LEFT_FOR_DESCRIPTION');?> <input name="phocadownloaduploadcountleft" value="<?php echo $this->tmpl['maxuploadchar'];?>" readonly="readonly" class="comment-input2" />
  275.             <br>
  276.             <br>
  277.             <br>
  278.             <div align=center><input type="submit" class="btn btn-primary" id="file-upload-submit" style="font-size:150%" value="<?php echo JText::_('avvia il caricamento'); ?>"/></div>
  279.             <br>
  280.             </td>
  281.         </tr>
  282.        
  283.         <tr>
  284.             <tr>
  285.        
  286.        
  287.         <?php
  288.         if ($this->tmpl['errorfile'] != '') {
  289.             echo '<tr><td></td><td><div class="error">' . $this->tmpl['errorfile'] . '</div></td></tr>';
  290.         } ?>
  291.         </tr>
  292.         <tr>
  293.            
  294.         </tr>
  295.        
  296.         <?php
  297.         if ($this->tmpl['erroremail'] != '') {
  298.             echo '<tr><td></td><td><div class="error">' . $this->tmpl['erroremail'] . '</div></td></tr>';
  299.         } ?>
  300.        
  301.         <tr>
  302.            
  303.         </tr>
  304.        
  305.         <?php
  306.         if ($this->tmpl['errorwebsite'] != '') {
  307.             echo '<tr><td></td><td><div class="error">' . $this->tmpl['errorwebsite'] . '</div></td></tr>';
  308.         } ?>
  309.        
  310.         <tr>
  311.        
  312.         </tr>
  313.        
  314.         <tr>
  315.            
  316.         </tr>
  317.        
  318.     </table>
  319.    
  320.    
  321.     <ul class="upload-queue" id="upload-queue"><li style="display: none" ></li></ul>
  322.  
  323.     <?php /*<input type="hidden" name="controller" value="user" /> */ ?>
  324.     <input type="hidden" name="viewback" value="user" />
  325.     <input type="hidden" name="view" value="user"/>
  326.     <input type="hidden" name="task" value="upload"/>
  327.     <input type="hidden" name="tab" value="<?php echo $this->tmpl['currenttab']['files'];?>" />
  328.     <input type="hidden" name="Itemid" value="<?php echo JRequest::getVar('Itemid', 0, '', 'int') ?>"/>
  329.     <input type="hidden" name="filter_order" value="<?php echo $this->listsfiles['order']; ?>" />
  330.     <input type="hidden" name="filter_order_Dir" value="" />
  331.     <input type="hidden" name="catidfiles" value="<?php echo $this->tmpl['catidfiles'] ?>"/>
  332. </form>
  333. <div id="loading-label-file"><center><?php echo JHTML::_('image', $this->tmpl['pi'].'icon-loading.gif', '') . JText::_('COM_PHOCADOWNLOAD_LOADING'); ?></center></div>
  334. </fieldset>
  335.     <?php
  336. }
  337. echo '</div>';
  338.  
  339. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement