Example #1
0
    function showDocuments($rows, $lists, $search, $pageNav, $number_pending, $number_unpublished, $view_type = 1)
    {
        global $database, $my, $_DOCMAN;
        global $mosConfig_live_site, $mosConfig_absolute_path;
        ?>

        <form action="index2.php" method="post" name="adminForm">

        <?php 
        dmHTML::adminHeading(_DML_DOCS, 'documents');
        ?>

        <div class="dm_filters">
            <?php 
        echo _DML_FILTER;
        ?>
            <input class="text_area" type="text" name="search" value="<?php 
        echo $search;
        ?>
" class="inputbox" onChange="document.adminForm.submit();" />
            <?php 
        echo $lists['catid'];
        ?>

            <span class="small">
                <?php 
        if ($number_pending > 0) {
            echo " [{$number_pending} " . _DML_DOCS_NOT_APPROVED . "] ";
        }
        if ($number_unpublished > 0) {
            echo " [{$number_unpublished} " . _DML_DOCS_NOT_PUBLISHED . "] ";
        }
        if ($number_unpublished < 1 && $number_pending < 1) {
            echo " [" . _DML_NO_PENDING_DOCS . "] ";
        }
        ?>
            </span>
        </div>

        <table class="adminlist">
          <thead>
          <tr>
            <th width="2%" align="left" >
            <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" />
            </th>
            <th width="15%" align="left">
            <a href="index2.php?option=com_docman&section=documents&sort=name"><?php 
        echo _DML_NAME;
        ?>
</a>
            </th>
            <th width="15%" align="left" >
            <a href="index2.php?option=com_docman&section=documents&sort=filename"><?php 
        echo _DML_FILE;
        ?>
</a>
            </th>
            <th width="15%" align="left">
            <a href="index2.php?option=com_docman&section=documents&sort=catsubcat"><?php 
        echo _DML_CATEGORY;
        ?>
</a>
            </th>
            <th width="10%" align="center">
            <a href="index2.php?option=com_docman&section=documents&sort=date"><?php 
        echo _DML_DATE;
        ?>
</a>
            </th>
            <th width="10%">
            <?php 
        echo _DML_OWNER;
        ?>
            </th>
            <th width="5%">
            <?php 
        echo _DML_PUBLISHED;
        ?>
            </th>
            <th width="5%">
            <?php 
        echo _DML_APPROVED;
        ?>
            </th>
            <th width="5%">
            <?php 
        echo _DML_SIZE;
        ?>
            </th>
            <th width="5%">
            <?php 
        echo _DML_HITS;
        ?>
            </th>
            <th width="5%" nowrap="nowrap">
            <?php 
        echo _DML_CHECKED_OUT;
        ?>
            </th>
          </tr>
          </thead>

          <tfoot><tr><td colspan="11"><?php 
        echo $pageNav->getListFooter();
        ?>
</td></tr></tfoot>

          <tbody>
          <?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $task = $row->published ? 'unpublish' : 'publish';
            $img = $row->published ? 'publish_g.png' : 'publish_x.png';
            $alt = $row->published ? _DML_PUBLISHED : _DML_UNPUBLISH;
            $file = new DOCMAN_File($row->dmfilename, $_DOCMAN->getCfg('dmpath'));
            ?>
<tr class="row<?php 
            echo $k;
            ?>
">
                <td width="20">
				<?php 
            echo mosHTML::idBox($i, $row->id, $row->checked_out && $row->checked_out != $my->id);
            ?>
				</td>
				<td width="15%">
			<?php 
            if ($row->checked_out && $row->checked_out != $my->id) {
                ?>
					<?php 
                echo $row->dmname;
                ?>
					&nbsp;[ <i><?php 
                echo _DML_CHECKED_OUT;
                ?>
</i> ]
			<?php 
            } else {
                ?>
					<a href="#edit" onclick="return listItemTask('cb<?php 
                echo $i;
                ?>
','edit')">
					<?php 
                echo $row->dmname;
                ?>
					</a>
					<?php 
            }
            ?>
				</td>
                <td>
                <?php 
            if ($file->exists()) {
                ?>
                    <a href="index2.php?option=com_docman&section=documents&task=download&bid=<?php 
                echo $row->id;
                ?>
" target="_blank">
                    <?php 
                echo DOCMAN_Utils::urlSnippet($row->dmfilename);
                ?>
</a>
               	<?php 
            } else {
                echo _DML_FILE_MISSING;
            }
            ?>
            	</td>
            	<td width="15%"><?php 
            echo $row->treename;
            ?>
</td>
               	<td width="10%" align="center"><?php 
            echo mosFormatDate($row->dmdate_published);
            ?>
</td>
               	<td align="center"><?php 
            echo DOCMAN_Utils::getUserName($row->dmowner);
            ?>
</td>
                <td width="10%" align="center">
					<a href="javascript: void(0);" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $task;
            ?>
')">
					<img src="images/<?php 
            echo $img;
            ?>
" border="0" alt="<?php 
            echo $alt;
            ?>
" />
					</a>
				</td>
			<?php 
            if (!$row->approved) {
                ?>
	            	<td width="5%" align="center"><a href="#approve" onClick="return listItemTask('cb<?php 
                echo $i;
                ?>
','approve')"><img src="images/publish_x.png" border=0 alt="approve" /></a></td>
	            <?php 
            } else {
                ?>
	            	<td width="5%" align="center"><img src="images/tick.png" /></td>
	            <?php 
            }
            ?>
	            <td width="5%" align="center">
	       	<?php 
            if ($file->exists()) {
                echo $file->getSize();
            }
            ?>
            </td>
            <td width="5%" align="center"><?php 
            echo $row->dmcounter;
            ?>
</td>
			<?php 
            if ($row->checked_out) {
                ?>
                	<td width="5%" align="center"><?php 
                echo $row->editor;
                ?>
</td>
            	<?php 
            } else {
                ?>
                <td width="5%" align="center">---</td>
                <?php 
            }
            ?>
</tr><?php 
            $k = 1 - $k;
        }
        ?>
        </tbody>

      </table>


      <input type="hidden" name="option" value="com_docman" />
      <input type="hidden" name="section" value="documents" />
      <input type="hidden" name="task" value="" />
      <input type="hidden" name="boxchecked" value="0" />
      <?php 
        echo DOCMAN_token::render();
        ?>
      </form>

   	  <?php 
        include_once $mosConfig_absolute_path . "/components/com_docman/footer.php";
    }