Esempio n. 1
0
function showComment($_detail_id)
{
    global $dbs;
    require SIMBIO . 'simbio_GUI/paging/simbio_paging.inc.php';
    $_list_comment = '';
    $_recs_each_page = 3;
    $_pages_each_set = 10;
    $_all_recs = 0;
    if (isset($_GET['page']) && $_GET['page'] > 1) {
        $page = $_GET['page'];
    } else {
        $page = 1;
    }
    $_sql = "Select c.comment, m.member_name, c.input_date from comment AS c\n\t\t LEFT JOIN biblio AS b ON b.biblio_id = c.biblio_id\n\t\t LEFT JOIN member AS m ON m.member_id = c.member_id\n\t\t WHERE b.biblio_id =" . $_detail_id . " ORDER BY c.last_update DESC";
    $commlist = $dbs->query($_sql);
    if ($commlist) {
        $_all_recs = $commlist->num_rows;
    }
    if ($_all_recs > 0) {
        $_page = ($page - 1) * $_recs_each_page;
        $_sql .= " Limit " . $_page . ", " . $_recs_each_page;
        $commlist = $dbs->query($_sql);
        $_list_comment .= '<div class="comment-found">' . $_all_recs . __(' comments available') . '</div>';
        while ($_data = $commlist->fetch_assoc()) {
            $_list_comment .= '<div class="comments">';
            $_list_comment .= '<div class="comment-member">' . $_data['member_name'] . __(' at ') . $_data['input_date'] . __(' write') . '</div>';
            $_list_comment .= '<div class="comment-content">' . $_data['comment'] . '</div>';
            $_list_comment .= '</div>';
        }
        $_list_comment .= '<div class="comment-found">' . simbio_paging::paging($_all_recs, $_recs_each_page, $int_pages_each_set = 10, '', '_self') . '</div>';
    }
    if (isset($_SESSION['mid'])) {
        // Comment form
        $_forms = '<form method="post" action="index.php?p=show_detail&id=' . $_detail_id . '" class="comment-form">';
        $_forms .= simbio_form_element::textField('textarea', 'comment', '', 'placeholder="Add your comment" class="comment-input"') . '<br />';
        $_forms .= '<input type="submit" name="SaveComment" value="Save comment" class="button">';
        $_forms .= '</form>';
        return $_list_comment . $_forms;
    } else {
        return $_list_comment;
    }
}
 /**
  * Modified method to make HTML output more friendly to printer
  *
  * @param   object  $obj_db
  * @param   integer $int_num2show
  * @return  string
  */
 protected function makeOutput($int_num2show = 30)
 {
     // remove invisible field
     parent::removeInvisibleField();
     // disable row highlight
     $this->highlight_row = false;
     // get fields array and set the table header
     $this->setHeader($this->grid_result_fields);
     $_record_row = 1;
     // data loop
     foreach ($this->grid_result_rows as $_data) {
         // alternate the row color
         $_row_class = $_record_row % 2 == 0 ? 'alterCellPrinted' : 'alterCellPrinted2';
         // append array to table
         $this->appendTableRow($_data);
         // field style modification
         foreach ($this->grid_result_fields as $_idx => $_fld) {
             // checking for special field width value set by column_width property array
             $_row_attr = 'valign="top"';
             $_classes = $_row_class;
             if (isset($this->column_width[$_idx])) {
                 $_row_attr .= ' style="width: ' . $this->column_width[$_idx] . ';"';
             }
             $this->setCellAttr($_record_row, $_idx, $_row_attr . ' class="' . $_classes . '"');
         }
         $_record_row++;
     }
     // init buffer return var
     $_buffer = '';
     // create paging
     if ($this->num_rows > $int_num2show) {
         $this->paging_set = simbio_paging::paging($this->num_rows, $int_num2show, 10, '', 'reportView');
     } else {
         $this->paging_set = '&nbsp;';
     }
     $_buffer .= '<div class="printPageInfo"><strong>' . $this->num_rows . '</strong> ' . __('record(s) found. Currently displaying page') . ' ' . $this->current_page . ' (' . $int_num2show . ' ' . __('record each page') . ')</div>' . "\n";
     //mfc
     $_buffer .= $this->printTable();
     return $_buffer;
 }
 /**
  * Method to make an output of document records
  *
  * @return  string
  */
 protected function makeOutput()
 {
     global $sysconf;
     // init the result buffer
     $_buffer = '';
     // keywords from last search
     $_keywords = '';
     // loop data
     $_i = 0;
     if (!$this->resultset) {
         return '<div class="errorBox">Query error : ' . $this->query_error . '</div>';
     }
     if (isset($_GET['keywords'])) {
         $_keywords = urlencode(trim(urldecode($_GET['keywords'])));
     }
     // include biblio list HTML template callback
     include SB . $sysconf['template']['dir'] . '/' . $sysconf['template']['theme'] . '/biblio_list_template.php';
     $settings = '';
     $settings = get_object_vars($this);
     $settings['keywords'] = $_keywords;
     while ($_biblio_d = $this->resultset->fetch_assoc()) {
         $_buffer .= biblio_list_format($this->obj_db, $_biblio_d, $_i, $settings, $return_back);
         $_i++;
     }
     // free resultset memory
     $this->resultset->free_result();
     // paging
     if ($this->num_rows > $this->num2show) {
         $_paging = '<div class="biblioPaging">' . simbio_paging::paging($this->num_rows, $this->num2show, 5) . '</div>';
     } else {
         $_paging = '';
     }
     $_biblio_list = '';
     $_is_member_logged_in = utility::isMemberLogin() && $this->enable_mark;
     if ($_paging) {
         $_biblio_list .= $_paging;
     }
     if ($_is_member_logged_in) {
         $_submit = '<div class="biblioMarkFormAction"><input type="submit" name="markBiblio" value="' . __('Put marked selection into basket') . '" /></div>';
         $_biblio_list .= '<form class="biblioMarkForm" method="post" action="index.php?p=member#biblioBasket">';
         $_biblio_list .= $_submit;
     }
     $_biblio_list .= $_buffer;
     if ($_is_member_logged_in) {
         $_biblio_list .= $_submit;
         $_biblio_list .= '</form>';
     }
     if ($_paging) {
         $_biblio_list .= $_paging;
     }
     return $_biblio_list;
 }
    /**
     * Method to make an output of document records
     *
     * @return  string
     */
    protected function makeOutput()
    {
        global $sysconf;
        // init the result buffer
        $_buffer = '';
        // loop data
        $_i = 0;
        if (!$this->resultset) {
            return '<div style="border: 1px dotted #FF0000; color: #FF0000; padding: 5px; margin: 5px;">Query error : ' . $this->query_error . '</div>';
        }
        while ($_biblio_d = $this->resultset->fetch_assoc()) {
            $_biblio_d['title'] = '<a href="' . $sysconf['baseurl'] . 'index.php?p=show_detail&id=' . $_biblio_d['biblio_id'] . '" title="' . __('Record Detail') . '">' . $_biblio_d['title'] . '</a>';
            // label
            if ($this->show_labels and !empty($_biblio_d['labels'])) {
                $arr_labels = @unserialize($_biblio_d['labels']);
                if ($arr_labels !== false) {
                    foreach ($arr_labels as $label) {
                        if (!isset($this->label_cache[$label[0]]['name'])) {
                            $_label_q = $this->obj_db->query('SELECT label_name, label_desc, label_image FROM mst_label AS lb
	                            WHERE lb.label_name=\'' . $label[0] . '\'');
                            $_label_d = $_label_q->fetch_row();
                            $this->label_cache[$label[0]] = array('name' => $_label_d[0], 'desc' => $_label_d[1], 'image' => $_label_d[2]);
                        }
                        if (isset($label[1]) && $label[1]) {
                            $_biblio_d['title'] .= ' <a href="' . $label[1] . '" target="_blank"><img src="' . SENAYAN_WEB_ROOT_DIR . IMAGES_DIR . '/labels/' . $this->label_cache[$label[0]]['image'] . '" title="' . $this->label_cache[$label[0]]['desc'] . '" align="middle" class="labels" border="0" /></a>';
                        } else {
                            $_biblio_d['title'] .= ' <img src="' . SENAYAN_WEB_ROOT_DIR . IMAGES_DIR . '/labels/' . $this->label_cache[$label[0]]['image'] . '" title="' . $this->label_cache[$label[0]]['desc'] . '" align="middle" class="labels" />';
                        }
                    }
                }
            }
            // button
            $_biblio_d['detail_button'] = '<a href="' . $sysconf['baseurl'] . 'index.php?p=show_detail&id=' . $_biblio_d['biblio_id'] . '" class="detailLink" title="' . __('Record Detail') . '">' . __('Record Detail') . '</a>';
            if ($this->xml_detail) {
                $_biblio_d['xml_button'] = '<a href="' . $sysconf['baseurl'] . 'index.php?p=show_detail&inXML=true&id=' . $_biblio_d['biblio_id'] . '" class="xmlDetailLink" title="View Detail in XML Format" target="_blank">XML Detail</a>';
            } else {
                $_biblio_d['xml_button'] = '';
            }
            // cover images var
            $_image_cover = '';
            if (!empty($_biblio_d['image']) && !defined('LIGHTWEIGHT_MODE')) {
                $_biblio_d['image'] = urlencode($_biblio_d['image']);
                $images_loc = 'images/docs/' . $_biblio_d['image'];
                if (file_exists($images_loc)) {
                    $_image_cover = 'style="background-image: url(./lib/phpthumb/phpThumb.php?src=../../' . $images_loc . '&w=42); background-repeat: no-repeat;"';
                }
            }
            $_alt_list = $_i % 2 == 0 ? 'alterList' : 'alterList2';
            $_buffer .= '<div class="item ' . $_alt_list . '" ' . $_image_cover . '>' . $_biblio_d['title'] . '<br />';
            // query the author
            $_author_q = $this->obj_db->query('SELECT a.author_name FROM biblio_author AS ba
                LEFT JOIN biblio AS b ON ba.biblio_id=b.biblio_id
                LEFT JOIN mst_author AS a ON ba.author_id=a.author_id WHERE ba.biblio_id=' . $_biblio_d['biblio_id']);
            // concat author data
            $_authors = '';
            while ($_author_d = $_author_q->fetch_row()) {
                $_authors .= $_author_d[0] . ' - ';
            }
            if ($_authors) {
                // replace the last strip
                $_authors = substr_replace($_authors, '', -3);
                $_buffer .= '<div class="subItem authorField"><b>' . __('Author(s)') . '</b> : ' . $_authors . '</div>';
            }
            # checking custom file
            if ($this->enable_custom_frontpage and $this->custom_fields) {
                foreach ($this->custom_fields as $_field => $_field_opts) {
                    if ($_field_opts[0] == 1) {
                        if ($_field == 'edition') {
                            $_buffer .= '<div class="customField editionField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['edition'] . '</div>';
                        } else {
                            if ($_field == 'isbn_issn') {
                                $_buffer .= '<div class="customField isbnField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['isbn_issn'] . '</div>';
                            } else {
                                if ($_field == 'collation') {
                                    $_buffer .= '<div class="customField collationField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['collation'] . '</div>';
                                } else {
                                    if ($_field == 'series_title') {
                                        $_buffer .= '<div class="customField seriesTitleField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['series_title'] . '</div>';
                                    } else {
                                        if ($_field == 'call_number') {
                                            $_buffer .= '<div class="customField callNumberField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['call_number'] . '</div>';
                                        } else {
                                            if ($_field == 'availability') {
                                                // get total number of this biblio items/copies
                                                $_item_q = $this->obj_db->query('SELECT COUNT(*) FROM item WHERE biblio_id=' . $_biblio_d['biblio_id']);
                                                $_item_c = $_item_q->fetch_row();
                                                // get total number of currently borrowed copies
                                                $_borrowed_q = $this->obj_db->query('SELECT COUNT(*) FROM loan AS l INNER JOIN item AS i' . ' ON l.item_code=i.item_code WHERE l.is_lent=1 AND l.is_return=0 AND i.biblio_id=' . $_biblio_d['biblio_id']);
                                                $_borrowed_c = $_borrowed_q->fetch_row();
                                                // total available
                                                $_total_avail = $_item_c[0] - $_borrowed_c[0];
                                                if ($_total_avail < 1) {
                                                    $_buffer .= '<div class="customField availabilityField"><b>' . $_field_opts[1] . '</b> : <strong style="color: #FF0000;">none copy available</strong></div>';
                                                } else {
                                                    $_buffer .= '<div class="customField availabilityField"><b>' . $_field_opts[1] . '</b> : ' . $_total_avail . ' copies available for loan</div>';
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $_buffer .= '<div class="subItem">' . $_biblio_d['detail_button'] . ' ' . $_biblio_d['xml_button'] . '</div>';
            $_buffer .= "</div>\n";
            $_i++;
        }
        // free resultset memory
        $this->resultset->free_result();
        // paging
        if ($this->num_rows > $this->num2show) {
            $_paging = '<hr width="97%" size="1" />' . "\n";
            $_paging .= '<div style="text-align: center;">' . simbio_paging::paging($this->num_rows, $this->num2show, 5) . '</div>';
        } else {
            $_paging = '';
        }
        return $_buffer . $_paging;
    }
 /**
  * Method to format an output of datagrid
  *
  * @param   integer $int_num2show
  * @return  string
  */
 protected function makeOutput($int_num2show = 30)
 {
     // remove invisible fields
     $this->removeInvisibleField();
     // get fields array and set the table header
     $this->setHeader($this->grid_result_fields);
     // data loop
     foreach ($this->grid_result_rows as $_data) {
         // append array to table
         $this->appendTableRow($_data);
     }
     // init buffer return var
     $_buffer = '';
     // create paging
     $_paging = null;
     if ($this->num_rows > $int_num2show && !$this->disable_paging) {
         $_paging = simbio_paging::paging($this->num_rows, $int_num2show, 5);
     }
     // iframe
     $_iframe = '';
     // setting form target
     $_target = '_self';
     if ($this->using_AJAX) {
         $_target = 'submitExec';
         $_iframe = '<iframe name="submitExec" style="visibility: hidden; width: 100%; height: 0;"></iframe>' . "\n";
         // below is for debugging purpose only
         // $_iframe = '<iframe name="submitExec" style="visibility: visible; width: 100%; height: 300px;"></iframe>'."\n";
     }
     // if editable
     if ($this->editable) {
         $_buffer .= '<form action="' . $this->chbox_form_URL . '" name="' . $this->table_name . '" id="' . $this->table_name . '" target="' . $_target . '" method="post" style="display: inline;">' . "\n";
         $_check_all = __('Check All');
         $_uncheck_all = __('Uncheck All');
         // action buttons group
         $_button_grp = '<table cellspacing="0" cellpadding="5" style="background-color: #dcdcdc; width: 100%;"><tr>';
         // if checkbox is include then show button
         if ($this->chbox_property) {
             $_button_grp .= '<td><input type="button" onclick="chboxFormSubmit(\'' . $this->table_name . '\', \'' . $this->chbox_confirm_msg . '\')" value="' . $this->chbox_action_button . '" class="button" /> ' . '<input type="button" value="' . $_check_all . '" class="check-all button" /> ' . '<input type="button" value="' . $_uncheck_all . '" class="uncheck-all button" /> ' . '</td>';
         }
         // paging
         if ($_paging) {
             $_button_grp .= '<td align="right">' . $_paging . "\n" . '</td>';
         }
         $_button_grp .= '</tr></table>' . "\n";
         // table grid
         $_buffer .= $_button_grp . $this->printTable() . $_button_grp . '<input type="hidden" name="itemAction" value="true" />' . '<input type="hidden" name="lastQueryStr" value="' . $_SERVER['QUERY_STRING'] . '" />' . "\n" . '</form>' . "\n" . $_iframe;
     } else {
         // paging
         $_button_grp = '';
         if ($_paging) {
             $_button_grp .= '<table cellspacing="0" cellpadding="5" class="notprinted" style="background-color: #dcdcdc; width: 100%;">' . '<tr><td align="right">' . $_paging . "\n" . '</td></tr></table>';
         }
         $_buffer .= $_button_grp . $this->printTable() . $_button_grp;
     }
     return $_buffer;
 }
 /**
  * Method to make an output of document records
  *
  * @return  string
  */
 protected function makeOutput()
 {
     global $sysconf;
     // init the result buffer
     $_buffer = '';
     // keywords from last search
     $_keywords = '';
     // loop data
     $_i = 0;
     if (!$this->resultset) {
         return '<div class="errorBox">Query error : ' . $this->query_error . '</div>';
     }
     if (isset($_GET['keywords'])) {
         $_keywords = urlencode(trim(urldecode($_GET['keywords'])));
     }
     while ($_biblio_d = $this->resultset->fetch_assoc()) {
         $_detail_link = SWB . 'index.php?p=show_detail&id=' . $_biblio_d['biblio_id'] . '&keywords=' . $_keywords;
         $_title_plain = $_biblio_d['title'];
         $_biblio_d['title'] = '<a href="' . $_detail_link . '" class="titleField" itemprop="name" property="name" title="' . __('View record detail description for this title') . '">' . $_biblio_d['title'] . '</a>';
         // label
         if ($this->show_labels and !empty($_biblio_d['labels'])) {
             $arr_labels = @unserialize($_biblio_d['labels']);
             if ($arr_labels !== false) {
                 foreach ($arr_labels as $label) {
                     if (!isset($this->label_cache[$label[0]]['name'])) {
                         $_label_q = $this->obj_db->query('SELECT label_name, label_desc, label_image FROM mst_label AS lb
               WHERE lb.label_name=\'' . $label[0] . '\'');
                         $_label_d = $_label_q->fetch_row();
                         $this->label_cache[$label[0]] = array('name' => $_label_d[0], 'desc' => $_label_d[1], 'image' => $_label_d[2]);
                     }
                     if (isset($label[1]) && $label[1]) {
                         $_biblio_d['title'] .= ' <a href="' . $label[1] . '" target="_blank"><img src="' . SWB . IMAGES_DIR . '/labels/' . $this->label_cache[$label[0]]['image'] . '" title="' . $this->label_cache[$label[0]]['desc'] . '" alt="' . $this->label_cache[$label[0]]['desc'] . '" align="middle" class="labels" border="0" /></a>';
                     } else {
                         $_biblio_d['title'] .= ' <img src="' . SWB . IMG . '/labels/' . $this->label_cache[$label[0]]['image'] . '" title="' . $this->label_cache[$label[0]]['desc'] . '" alt="' . $this->label_cache[$label[0]]['desc'] . '" align="middle" class="labels" />';
                     }
                 }
             }
         }
         // button
         $_biblio_d['detail_button'] = '<a href="' . $_detail_link . '" class="detailLink" title="' . __('View record detail description for this title') . '">' . __('Record Detail') . '</a>';
         if ($this->xml_detail) {
             $_biblio_d['xml_button'] = '<a href="' . $_detail_link . '&inXML=true" class="xmlDetailLink" title="View record detail description in XML Format" target="_blank">XML Detail</a>';
         } else {
             $_biblio_d['xml_button'] = '';
         }
         // cover images var
         $_image_cover = '';
         if (!empty($_biblio_d['image']) && !defined('LIGHTWEIGHT_MODE')) {
             $_biblio_d['image'] = urlencode($_biblio_d['image']);
             $images_loc = '../../images/docs/' . $_biblio_d['image'];
             if ($sysconf['tg']['type'] == 'minigalnano') {
                 $thumb_url = './lib/minigalnano/createthumb.php?filename=' . urlencode($images_loc) . '&width=90';
                 $_image_cover = '<img src="' . $thumb_url . '" class="img-thumbnail" itemprop="image" />';
             }
         }
         $_alt_list = $_i % 2 == 0 ? 'alterList' : 'alterList2';
         $_buffer .= '<div class="item biblioRecord" itemscope itemtype="http://schema.org/Book" vocab="http://schema.org/" typeof="Book"><div class="cover-list">' . $_image_cover . '</div>';
         $_buffer .= '<div class="detail-list"><h4>' . $_biblio_d['title'] . '</h4>';
         // concat author data
         $_authors = isset($_biblio_d['author']) ? $_biblio_d['author'] : self::getAuthors($this->obj_db, $_biblio_d['biblio_id'], true);
         $_buffer .= '<div class="author" itemprop="author" property="author" itemscope itemtype="http://schema.org/Person">';
         if ($_authors) {
             $_authors_string = '';
             foreach ($_authors as $author) {
                 $_authors_string .= '<span class="author-name" itemprop="name" property="name">' . $author . '</span> - ';
             }
             $_authors_string = substr_replace($_authors_string, '', -2);
             $_buffer .= $_authors_string;
             // $_buffer .= '<div class="author" itemprop="author"><b>'.__('Author(s)').'</b> : '.$_authors.'</div>';
         }
         $_buffer .= '</div>';
         # checking custom file
         if ($this->enable_custom_frontpage and $this->custom_fields) {
             foreach ($this->custom_fields as $_field => $_field_opts) {
                 if ($_field_opts[0] == 1) {
                     if ($_field == 'edition') {
                         $_buffer .= '<div class="customField editionField" itemprop="bookEdition" property="bookEdition"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['edition'] . '</div>';
                     } else {
                         if ($_field == 'isbn_issn') {
                             $_buffer .= '<div class="customField isbnField" itemprop="isbn" property="isbn"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['isbn_issn'] . '</div>';
                         } else {
                             if ($_field == 'collation') {
                                 $_buffer .= '<div class="customField collationField" itemprop="numberOfPages" property="numberOfPages"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['collation'] . '</div>';
                             } else {
                                 if ($_field == 'series_title') {
                                     $_buffer .= '<div class="customField seriesTitleField" itemprop="alternativeHeadline" property="alternativeHeadline"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['series_title'] . '</div>';
                                 } else {
                                     if ($_field == 'call_number') {
                                         $_buffer .= '<div class="customField callNumberField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['call_number'] . '</div>';
                                     } else {
                                         if ($_field == 'availability' && !$this->disable_item_data) {
                                             // get total number of this biblio items/copies
                                             $_item_q = $this->obj_db->query('SELECT COUNT(*) FROM item WHERE biblio_id=' . $_biblio_d['biblio_id']);
                                             $_item_c = $_item_q->fetch_row();
                                             // get total number of currently borrowed copies
                                             $_borrowed_q = $this->obj_db->query('SELECT COUNT(*) FROM loan AS l INNER JOIN item AS i' . ' ON l.item_code=i.item_code WHERE l.is_lent=1 AND l.is_return=0 AND i.biblio_id=' . $_biblio_d['biblio_id']);
                                             $_borrowed_c = $_borrowed_q->fetch_row();
                                             // total available
                                             $_total_avail = $_item_c[0] - $_borrowed_c[0];
                                             if ($_total_avail < 1) {
                                                 $_buffer .= '<div class="customField availabilityField"><b>' . $_field_opts[1] . '</b> : <strong style="color: #f00;">' . __('none copy available') . '</strong></div>';
                                             } else {
                                                 $this->item_availability_message = $_total_avail . ' copies available for loan';
                                                 $_buffer .= '<div class="customField availabilityField"><b>' . $_field_opts[1] . '</b> : ' . $this->item_availability_message . '</div>';
                                             }
                                         } else {
                                             if ($_field == 'node_id' && $this->disable_item_data) {
                                                 $_buffer .= '<div class="customField locationField"><b>' . $_field_opts[1] . '</b> : ' . $sysconf['node'][$_biblio_d['node_id']]['name'] . '</div>';
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         // checkbox for marking collection
         $_check_mark = utility::isMemberLogin() && $this->enable_mark ? ' <input type="checkbox" id="biblioCheck' . $_i . '" name="biblio[]" class="biblioCheck" value="' . $_biblio_d['biblio_id'] . '" /> <label for="biblioCheck' . $_i . '">' . __('mark this') . '</label>' : '';
         $_buffer .= '<div class="subItem">' . $_biblio_d['detail_button'] . ' ' . $_biblio_d['xml_button'] . $_check_mark . '</div>';
         if ($sysconf['social_shares']) {
             // share buttons
             $_detail_link_encoded = urlencode('http://' . $_SERVER['SERVER_NAME'] . $_detail_link);
             $_share_btns = "\n" . '<ul class="share-buttons">' . '<li>' . __('Share to') . ': </li>' . '<li><a href="http://www.facebook.com/sharer.php?u=' . $_detail_link_encoded . '" title="Facebook" target="_blank"><img src="./images/default/fb.gif" alt="Share this title to Facebook" /></a></li>' . '<li><a href="http://twitter.com/share?url=' . $_detail_link_encoded . '&text=' . urlencode($_title_plain) . '" title="Twitter" target="_blank"><img src="./images/default/tw.gif" alt="Share this title to Twitter" /></a></li>' . '<li><a href="https://plus.google.com/share?url=' . $_detail_link_encoded . '" title="Google Plus" target="_blank"><img src="./images/default/gplus.gif" alt="Share this title to Google Plus" /></a></li>' . '<li><a href="http://www.digg.com/submit?url=' . $_detail_link_encoded . '" title="Digg It" target="_blank"><img src="./images/default/digg.gif" alt="Share this title to  Digg It" /></a></li>' . '<li><a href="http://reddit.com/submit?url=' . $_detail_link_encoded . '&title=' . urlencode($_title_plain) . '" title="Reddit" target="_blank"><img src="./images/default/rdit.gif" alt="Share this title to Reddit" /></a></li>' . '<li><a href="http://www.linkedin.com/shareArticle?mini=true&url=' . $_detail_link_encoded . '" title="LinkedIn" target="_blank"><img src="./images/default/lin.gif" alt="Share this title to LinkedIn" /></a></li>' . '<li><a href="http://www.stumbleupon.com/submit?url=' . $_detail_link_encoded . '&title=' . urlencode($_title_plain) . '" title="Stumbleupon" target="_blank"><img src="./images/default/su.gif" alt="Share this title to StumbleUpon" /></a></li>' . '</ul>' . "\n";
             $_buffer .= $_share_btns;
         }
         $_buffer .= "</div></div>\n";
         $_i++;
     }
     // free resultset memory
     $this->resultset->free_result();
     // paging
     if ($this->num_rows > $this->num2show) {
         $_paging = '<div class="biblioPaging">' . simbio_paging::paging($this->num_rows, $this->num2show, 5) . '</div>';
     } else {
         $_paging = '';
     }
     $_biblio_list = '';
     $_is_member_logged_in = utility::isMemberLogin() && $this->enable_mark;
     if ($_paging) {
         $_biblio_list .= $_paging;
     }
     if ($_is_member_logged_in) {
         $_submit = '<div class="biblioMarkFormAction"><input type="submit" name="markBiblio" value="' . __('Put marked selection into basket') . '" /></div>';
         $_biblio_list .= '<form class="biblioMarkForm" method="post" action="index.php?p=member#biblioBasket">';
         $_biblio_list .= $_submit;
     }
     $_biblio_list .= $_buffer;
     if ($_is_member_logged_in) {
         $_biblio_list .= $_submit;
         $_biblio_list .= '</form>';
     }
     if ($_paging) {
         $_biblio_list .= $_paging;
     }
     return $_biblio_list;
 }
    /**
     * Method to make an output of document records
     *
     * @return  string
     */
    protected function makeOutput()
    {
        global $sysconf;
        // init the result buffer
        $_buffer = '';
        // loop data
        $_i = 0;
        if (!$this->resultset) {
            return '<div style="border: 1px dotted #f00; color: #f00; padding: 5px; margin: 5px;">Query error : ' . $this->query_error . '</div>';
        }
        while ($_biblio_d = $this->resultset->fetch_assoc()) {
            $_biblio_d['title'] = '<a href="' . $sysconf['baseurl'] . 'index.php?p=show_detail&id=' . $_biblio_d['biblio_id'] . '" class="titleField" title="' . __('Record Detail') . '">' . $_biblio_d['title'] . '</a>';
            // label
            if ($this->show_labels and !empty($_biblio_d['labels'])) {
                $arr_labels = @unserialize($_biblio_d['labels']);
                if ($arr_labels !== false) {
                    foreach ($arr_labels as $label) {
                        if (!isset($this->label_cache[$label[0]]['name'])) {
                            $_label_q = $this->obj_db->query('SELECT label_name, label_desc, label_image FROM mst_label AS lb
	                        WHERE lb.label_name=\'' . $label[0] . '\'');
                            $_label_d = $_label_q->fetch_row();
                            $this->label_cache[$label[0]] = array('name' => $_label_d[0], 'desc' => $_label_d[1], 'image' => $_label_d[2]);
                        }
                        if (isset($label[1]) && $label[1]) {
                            $_biblio_d['title'] .= ' <a href="' . $label[1] . '" target="_blank"><img src="' . SENAYAN_WEB_ROOT_DIR . IMAGES_DIR . '/labels/' . $this->label_cache[$label[0]]['image'] . '" title="' . $this->label_cache[$label[0]]['desc'] . '" align="middle" class="labels" border="0" /></a>';
                        } else {
                            $_biblio_d['title'] .= ' <img src="' . SENAYAN_WEB_ROOT_DIR . IMAGES_DIR . '/labels/' . $this->label_cache[$label[0]]['image'] . '" title="' . $this->label_cache[$label[0]]['desc'] . '" align="middle" class="labels" />';
                        }
                    }
                }
            }
            // button
            $_biblio_d['detail_button'] = '<a href="' . $sysconf['baseurl'] . 'index.php?p=show_detail&id=' . $_biblio_d['biblio_id'] . '" class="detailLink" title="' . __('Record Detail') . '">' . __('Record Detail') . '</a>';
            if ($this->xml_detail) {
                $_biblio_d['xml_button'] = '<a href="' . $sysconf['baseurl'] . 'index.php?p=show_detail&inXML=true&id=' . $_biblio_d['biblio_id'] . '" class="xmlDetailLink" title="View Detail in XML Format" target="_blank">XML Detail</a>';
            } else {
                $_biblio_d['xml_button'] = '';
            }
            // cover images var
            $_image_cover = '';
            if (!empty($_biblio_d['image']) && !defined('LIGHTWEIGHT_MODE')) {
                $_biblio_d['image'] = urlencode($_biblio_d['image']);
                $images_loc = 'images/docs/' . $_biblio_d['image'];
                #$cache_images_loc = 'images/cache/'.$_biblio_d['image'];
                if ($sysconf['tg']['type'] == 'phpthumb') {
                    $_image_cover = 'style="background-image: url(./lib/phpthumb/phpThumb.php?src=' . $sysconf['tg']['relative_url'] . '' . $images_loc . '&w=42); background-repeat: no-repeat;"';
                } elseif ($sysconf['tg']['type'] == 'minigalnano') {
                    $_image_cover = 'style="background-image: url(./lib/minigalnano/createthumb.php?filename=' . $sysconf['tg']['relative_url'] . '' . $images_loc . '&width=42); background-repeat: no-repeat;"';
                } else {
                    $_image_cover = 'style="background-image: url(./lib/phpthumb/phpThumb.php?src=' . $sysconf['tg']['relative_url'] . '' . $images_loc . '&w=42); background-repeat: no-repeat;"';
                }
            }
            $_alt_list = $_i % 2 == 0 ? 'alterList' : 'alterList2';
            $_buffer .= '<div class="item ' . $_alt_list . '" ' . $_image_cover . '>' . $_biblio_d['title'] . '<br />';
            // concat author data
            $_authors = isset($_biblio_d['author']) ? $_biblio_d['author'] : self::getAuthors($this->obj_db, $_biblio_d['biblio_id']);
            if ($_authors) {
                $_buffer .= '<div class="subItem authorField"><b>' . __('Author(s)') . '</b> : ' . $_authors . '</div>';
            }
            # checking custom file
            if ($this->enable_custom_frontpage and $this->custom_fields) {
                foreach ($this->custom_fields as $_field => $_field_opts) {
                    if ($_field_opts[0] == 1) {
                        if ($_field == 'edition') {
                            $_buffer .= '<div class="customField editionField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['edition'] . '</div>';
                        } else {
                            if ($_field == 'isbn_issn') {
                                $_buffer .= '<div class="customField isbnField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['isbn_issn'] . '</div>';
                            } else {
                                if ($_field == 'collation') {
                                    $_buffer .= '<div class="customField collationField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['collation'] . '</div>';
                                } else {
                                    if ($_field == 'series_title') {
                                        $_buffer .= '<div class="customField seriesTitleField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['series_title'] . '</div>';
                                    } else {
                                        if ($_field == 'call_number') {
                                            $_buffer .= '<div class="customField callNumberField"><b>' . $_field_opts[1] . '</b> : ' . $_biblio_d['call_number'] . '</div>';
                                        } else {
                                            if ($_field == 'availability' && !$this->disable_item_data) {
                                                // get total number of this biblio items/copies
                                                $_item_q = $this->obj_db->query('SELECT COUNT(*) FROM item WHERE biblio_id=' . $_biblio_d['biblio_id']);
                                                $_item_c = $_item_q->fetch_row();
                                                // get total number of currently borrowed copies
                                                $_borrowed_q = $this->obj_db->query('SELECT COUNT(*) FROM loan AS l INNER JOIN item AS i' . ' ON l.item_code=i.item_code WHERE l.is_lent=1 AND l.is_return=0 AND i.biblio_id=' . $_biblio_d['biblio_id']);
                                                $_borrowed_c = $_borrowed_q->fetch_row();
                                                // total available
                                                $_total_avail = $_item_c[0] - $_borrowed_c[0];
                                                if ($_total_avail < 1) {
                                                    $_buffer .= '<div class="customField availabilityField"><b>' . $_field_opts[1] . '</b> : <strong style="color: #f00;">' . __('none copy available') . '</strong></div>';
                                                } else {
                                                    $this->item_availability_message = $_total_avail . ' copies available for loan';
                                                    $_buffer .= '<div class="customField availabilityField"><b>' . $_field_opts[1] . '</b> : ' . $this->item_availability_message . '</div>';
                                                }
                                            } else {
                                                if ($_field == 'node_id' && $this->disable_item_data) {
                                                    $_buffer .= '<div class="customField locationField"><b>' . $_field_opts[1] . '</b> : ' . $sysconf['node'][$_biblio_d['node_id']]['name'] . '</div>';
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            // checkbox for marking collection
            $_check_mark = utility::isMemberLogin() && $this->enable_mark ? ' <input type="checkbox" id="biblioCheck' . $_i . '" name="biblio[]" class="biblioCheck" value="' . $_biblio_d['biblio_id'] . '" /> <label for="biblioCheck' . $_i . '">' . __('mark this') . '</label>' : '';
            $_buffer .= '<div class="subItem">' . $_biblio_d['detail_button'] . ' ' . $_biblio_d['xml_button'] . $_check_mark . '</div>';
            $_buffer .= "</div>\n";
            $_i++;
        }
        // free resultset memory
        $this->resultset->free_result();
        // paging
        if ($this->num_rows > $this->num2show) {
            $_paging = '<div class="biblioPaging">' . simbio_paging::paging($this->num_rows, $this->num2show, 5) . '</div>';
        } else {
            $_paging = '';
        }
        $_biblio_list = '';
        $_is_member_logged_in = utility::isMemberLogin() && $this->enable_mark;
        if ($_paging) {
            $_biblio_list .= $_paging;
            $_biblio_list .= '<hr width="98%" size="1" />';
        }
        if ($_is_member_logged_in) {
            $_submit = '<div class="biblioMarkFormAction"><input type="submit" class="button markBiblio" name="markBiblio" value="' . __('Put marked selection into basket') . '" /></div>';
            $_biblio_list .= '<form class="biblioMarkForm" method="post" action="index.php?p=member#biblioBasket">';
            $_biblio_list .= $_submit;
        }
        $_biblio_list .= $_buffer;
        if ($_is_member_logged_in) {
            $_biblio_list .= $_submit;
            $_biblio_list .= '</form>';
        }
        if ($_paging) {
            $_biblio_list .= '<hr width="98%" size="1" />';
            $_biblio_list .= $_paging;
        }
        return $_biblio_list;
    }
Esempio n. 8
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */
require_once LIB . 'content.inc.php';
require SIMBIO . 'simbio_GUI/paging/simbio_paging.inc.php';
require_once SB . $sysconf['template']['dir'] . '/' . $sysconf['template']['theme'] . '/news_template.php';
$page_title = __('Library News');
$keywords = null;
if (isset($_GET['keywords'])) {
    $keywords = trim($_GET['keywords']);
}
$content = new Content();
$total = 0;
$content_list = $content->getContents($dbs, 10, $total, $keywords);
if ($total > 0) {
    echo '<div class="alert alert-info">' . __(sprintf('We have %d news for you!', $total)) . '</div>';
} else {
    echo '<div class="alert alert-warning">' . __('Sorry, we don\'t have any news for you yet.') . '</div>';
}
foreach ($content_list as $c) {
    $summary = Content::createSummary($c['content_desc'], 300);
    echo news_list_tpl($c['content_title'], $c['content_path'], $c['last_update'], $summary);
}
echo simbio_paging::paging($total, $sysconf['news']['num_each_page'], 5);