Example #1
0
    /**
     * The function showBooks seems to be the main "Books" screen on admin side of Joomla
     **/
    static function showBooks($option, $rows_book, &$clist, &$lendlist, &$userlist, &$publist, &$search, &$pageNav, &$sort_arr, $search_for_list, $order_let)
    {
        global $my, $mosConfig_live_site, $session;
        global $mainframe, $templateDir, $doc;
        // for J 1.6
        $doc->addScript($mosConfig_live_site . '/components/com_booklibrary/includes/functions.js');
        $doc->addStyleSheet($mosConfig_live_site . '/components/com_booklibrary/includes/booklibrary.css');
        $html = "<div class='book_manager_caption' ><img src='./components/com_booklibrary/images/cfg.png' alt ='Config' />" . _BOOKLIBRARY_SHOW . "</div>";
        $app = JFactory::getApplication();
        $app->JComponentTitle = $html;
        $script_content = '';
        // for J 1.6
        $script_content .= "function before_print_check() \n";
        $script_content .= " { \n";
        $script_content .= "  var add = document.getElementsByName('bid[]'); \n";
        $script_content .= "  var count=0;    \n";
        $script_content .= "  for(var i=0;i<add.length;i++) \n";
        $script_content .= "  { \n";
        $script_content .= "      if(add[i].checked) \n";
        $script_content .= "        { \n";
        $script_content .= "         count++; \n";
        $script_content .= "         break; \n";
        $script_content .= "       } \n";
        $script_content .= "   } \n";
        $script_content .= "  if(count == 0) \n";
        $script_content .= "    {\n";
        $script_content .= "     alert('Please choose some books'); \n";
        $script_content .= "     exit; \n";
        $script_content .= "    } \n";
        $script_content .= "  else \n";
        $script_content .= "   {\n";
        $script_content .= "    document.adminForm.target = '_blank' ; \n";
        $script_content .= "    document.adminForm.task.value='print_books'; \n";
        $script_content .= "    document.adminForm.submit(); \n";
        $script_content .= "  }\n";
        $script_content .= "}\n";
        $doc->addScriptDeclaration($script_content);
        ?>

        <form id="adminForm" action="index.php" method="post" name="adminForm" class="bl_admin_books">
            <table class="admin10" cellpadding="4" cellspacing="0" border="0" width="100%">
                <tr>
                    <!--<td width="30%">
                            <img src="./components/com_booklibrary/images/cfg.png" align="right" alt="Config" />
                        </td>-->

                <?php 
        if (version_compare(JVERSION, "3.0.0", "ge")) {
            ?>
                    <table class="admin11" width="100%">
                        <tr>
                            <td>
                                <div class="btn-group pull-right hidden-phone">
                                    <label for="limit" class="element-invisible"><?php 
            echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');
            ?>
</label>
            <?php 
            echo $pageNav->getLimitBox();
            ?>
                                </div>
                            </td>
                        </tr>
                    </table>
        <?php 
        }
        ?>

                <td width="68%" class="book_manager_caption" valign='bottom' ></td>
                <!--********   begin add for button print in Manager Books   *******************-->
                <!--******   end add for button print in Manager Books   *******************-->
                </tr>
            </table>

            <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist my_table bl_admin_books_top_table_with_search_ans_orders">
                <!-- added search by field back - 20150818 - Ralph deGennaro -->
                <tr>
                    <td><label><?php 
        echo _BOOKLIBRARY_SHOW_SEARCH;
        ?>
</label></td>
                    <td>
                        <input type="text" name="search" value="<?php 
        echo $search;
        ?>
" class="inputbox" />
                    </td>
                    <td>
                        <label><?php 
        echo _BOOKLIBRARY_SHOW_SEARCH_FOR;
        ?>
</label>
                    </td>
                    <td>
            <?php 
        echo $search_for_list;
        ?>
                        <input class="my_btn" type="submit" name="go" value="<?php 
        echo _BOOKLIBRARY_SHOW_SEARCH_GO;
        ?>
" >
                    </td>
                </tr>
                <tr>
                    <td><?php 
        echo $publist;
        ?>
</td>
                    <td><?php 
        echo $lendlist;
        ?>
</td>
                    <td><?php 
        echo $userlist;
        ?>
</td>
                    <td><?php 
        echo $clist;
        ?>
</td>
                </tr>
            </table>

        <?php 
        /* if(version_compare(JVERSION, '3.0', 'lt'))
           echo 'onClick="checkAll('.count( $rows_book ).');"';
           else
           echo 'onClick="Joomla.checkAll(this);"'; */
        ?>

            <table cellpadding="4" cellspacing="0" border="0" width="100%" class="my_table
                   my_table-bordered my_table-hover adminlist bl_admin_books_main_table">
                <tr>
                    <th width="4%">
                        <input type="checkbox" name="toggle" value="" onClick="Joomla.checkAll(this);" />
                    </th>
                    <th width="4%">id</th>
                    <th width="8%" align = "center" class="title" nowrap="nowrap">
        <?php 
        echo _BOOKLIBRARY_LABEL_BOOKID;
        ?>
                    </th>
                    <th width="12%" align = "center"  class="title" nowrap="nowrap">
        <?php 
        echo HTML_booklibrary::sort_head(_BOOKLIBRARY_LABEL_ISBN, 'isbn', $sort_arr);
        ?>
                    </th>
                    <!-- added dewey decimal code - 20150818 - Ralph deGennaro -->
                    <th width="12%" align = "center"  class="title" nowrap="nowrap">
                        <?php 
        echo HTML_booklibrary::sort_head(_BOOKLIBRARY_LABEL_DDCCODE, 'ddccode', $sort_arr);
        ?>
                    </th>
                    <th width="12%" align = "center" class="title" nowrap="nowrap">
        <?php 
        echo HTML_booklibrary::sort_head(_BOOKLIBRARY_LABEL_TITLE, 'title', $sort_arr);
        ?>
                    </th>
                    <!--<th align = "center" class="title" width="5%" nowrap="nowrap" colspan="2">
        <?php 
        echo _BOOKLIBRARY_LABEL_LINE;
        ?>
                    </th>-->
                    <!-- don't need informationFrom - 20150820 - Ralph deGennaro -->
                    <!--
                    <th width="12%" align = "center" class="title" nowrap="nowrap">
        <?php 
        echo _BOOKLIBRARY_LABEL_FETCH_INFO;
        ?>
                    </th>
                    -->
                    <th width="12%" align = "center" class="title" nowrap="nowrap">
        <?php 
        echo HTML_booklibrary::sort_head(_BOOKLIBRARY_LABEL_CATEGORY, 'category', $sort_arr);
        ?>
                    </th>
                    <th width="8%" align = "center" class="title" nowrap="nowrap">
        <?php 
        echo HTML_booklibrary::sort_head_let($order_let);
        ?>
                    </th>
                    <th width="8%" align = "center" class="title" nowrap="nowrap">
        <?php 
        echo _BOOKLIBRARY_LABEL_HITS;
        ?>
                    </th>
                    <!-- don't need user - 20150820 - Ralph deGennaro -->
                    <!--
                    <th width="12%" align = "center" class="title" nowrap="nowrap">
        <?php 
        echo _BOOKLIBRARY_LABEL_TYPE_USER;
        ?>
                    </th>
                    -->
                    <th width="8%" align = "center"  class="title" nowrap="nowrap">
        <?php 
        echo _BOOKLIBRARY_LABEL_PUBLIC;
        ?>
                    </th>
                    <th width="8%" align = "center" class="title" nowrap="nowrap">
                <?php 
        echo _BOOKLIBRARY_LABEL_APPROVED;
        ?>
                    </th>
                    <!-- add two columns for lendee info - 20150820 - Ralph deGennaro -->
                    <th width="12%" align = "center" class="title" nowrap="nowrap">
                      <?php 
        echo _BOOKLIBRARY_LABEL_LENDEECODE;
        ?>
                    </th>
                    <th width="12%" align = "center" class="title" nowrap="nowrap">
                      <?php 
        echo _BOOKLIBRARY_LABEL_LENDEEFULLNAME;
        ?>
                    </th>
                </tr>

        <?php 
        for ($i = 0, $n = count($rows_book); $i < $n; $i++) {
            $row = $rows_book[$i];
            ?>

                    <tr class="row<?php 
            echo $i % 2;
            ?>
">
                        <td align="left">
            <?php 
            if ($row->checked_out && $row->checked_out != $my->id) {
                ?>
                                &nbsp;
            <?php 
            } else {
                echo mosHTML::idBox($i, $row->id, $row->checked_out && $row->checked_out != $my->id, 'bid');
            }
            ?>
                        </td>
                        <td align = "center" ><?php 
            echo $row->id;
            ?>
</td>
                        <td align = "center"><?php 
            echo $row->bookid;
            ?>
</td>
                        <td align="center">
                            <a href="#edit" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','edit')">
                            <?php 
            echo $row->isbn;
            ?>
                            </a>
                        </td>
                        <!-- added dewey decimal code - 20150818 - Ralph deGennaro -->
                        <td align="center">
                            <a href="#edit" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','edit')">
                                <?php 
            echo $row->ddccode;
            ?>
                            </a>
                        </td>
                        <td align="left">
                            <a href="#edit" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','edit')">
            <?php 
            echo $row->title;
            ?>
                            </a>
                        </td>
                        <!-- don't need informationFrom - 20150820 - Ralph deGennaro -->
                        <!--
                        <td align="center">
            <?php 
            echo mosBooklibraryWS::getWsNameById($row->informationFrom);
            ?>
                        </td>
                        -->
                        <td align = "center"><?php 
            echo $row->category;
            ?>
</td>
                        <td align = "center" style="text-align:center;">
                        <?php 
            if ($row->lend_from == null) {
                ?>
                                <a class="my_btn my_btn-success" href="javascript: void(0);" onClick="return listItemTask('cb<?php 
                echo $i;
                ?>
','lend')">
                                    <img style="vertical-align:middle;" src="<?php 
                echo $mosConfig_live_site;
                ?>
/components/com_booklibrary/images/next.png"/>
                                </a>
                        <?php 
            } else {
                ?>
                                <a class="my_btn my_btn-warning" href="javascript: void(0);" onClick="return listItemTask('cb<?php 
                echo $i;
                ?>
','lend_return')">
                                    <img style="vertical-align:middle;" src="<?php 
                echo $mosConfig_live_site;
                ?>
/components/com_booklibrary/images/back.png"/>
                                </a>
                                <?php 
            }
            ?>
                        </td>
                        <td align = "center"><?php 
            echo $row->hits;
            ?>
</td>
                                <?php 
            //print_r($row);exit;
            ?>
                        <!-- don't need user - 20150820 - Ralph deGennaro -->
                        <!--
                        <td align="center"><?php 
            echo $row->owner_name;
            ?>
</td>
                        -->
            <?php 
            $task = $row->published ? 'unpublish' : 'publish';
            $alt = $row->published ? 'Unpublish' : 'Publish';
            $img = $row->published ? 'ok.png' : 'remove.png';
            $task1 = $row->approved ? 'unapprove' : 'approve';
            $alt1 = $row->approved ? 'Unapproved' : 'Approved';
            $img1 = $row->approved ? 'ok.png' : 'remove.png';
            ?>
                        <td align="center">
                            <a href="javascript: void(0);" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $task;
            ?>
')">
                        <?php 
            if (version_compare(JVERSION, "1.6.0", "lt")) {
                ?>
                                    <img src="<?php 
                echo $mosConfig_live_site . "/components/com_booklibrary/images/" . $img;
                ?>
" border="0" alt="<?php 
                echo $alt;
                ?>
" />
                        <?php 
            } else {
                ?>
                                    <img src="<?php 
                echo $mosConfig_live_site . "/components/com_booklibrary/images/" . $img;
                ?>
" border="0" alt="<?php 
                echo $alt;
                ?>
" />
                        <?php 
            }
            ?>
                            </a>
                        </td>
                        <td align="center">
                            <a href="javascript: void(0);" onClick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $task1;
            ?>
')">
            <?php 
            if (version_compare(JVERSION, "1.6.0", "lt")) {
                ?>
                                    <img src="<?php 
                echo $mosConfig_live_site . "/components/com_booklibrary/images/" . $img1;
                ?>
" border="0" alt="<?php 
                echo $alt1;
                ?>
" />
                    <?php 
            } else {
                ?>
                                    <img src="<?php 
                echo $mosConfig_live_site . "/components/com_booklibrary/images/" . $img1;
                ?>
" border="0" alt="<?php 
                echo $alt1;
                ?>
" />
                    <?php 
            }
            ?>
                        </td>
                        <!-- add two columns for lendee info - 20150820 - Ralph deGennaro -->
                        <td align = "center"><?php 
            echo $row->lendeecode;
            ?>
</td>
                        <td align = "center"><?php 
            echo $row->lendeefullname;
            ?>
</td>
                    </tr>
            <?php 
        }
        //end for
        ?>
                <tr class="for_paginator">
                    <td colspan = "14"><?php 
        echo $pageNav->getListFooter();
        ?>
</td>
                </tr>
            </table>
            <input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
            <input type="hidden" name="task" value="" />
            <input type="hidden" name="boxchecked" value="0" />
        </form>

    <?php 
    }