Completed
Push — master ( 1db5db...8743f5 )
by Michael
06:44
created
blocks/bookshop_new.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -32,98 +32,98 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function b_bookshop_new_show($options)
34 34
 {
35
-    // '10|0';  // See 10 books, for all categories or a particular category
36
-    global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
-    $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
-    $tblLivres = $h_bookshop_books->getRecentBooks(0, $options[0], $options[1]);
40
-    if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
-        $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
-        $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
-        $tblTmp = array();
45
-        foreach ($tblLivres as $item) {
46
-            $tblTmp[]       = $item->getVar('book_cid');
47
-            $tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
-            $tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
-            $tbl_books_id[] = $item->getVar('book_id');
50
-        }
51
-        $tblTmp       = array_unique($tblTmp);
52
-        $tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
-        $tbl_tmp_lang = array_unique($tbl_tmp_lang);
35
+	// '10|0';  // See 10 books, for all categories or a particular category
36
+	global $xoopsConfig, $xoopsTpl;
37
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
+	$tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
+	$tblLivres = $h_bookshop_books->getRecentBooks(0, $options[0], $options[1]);
40
+	if (count($tblLivres) > 0) {
41
+		$url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
+		$block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
+		$xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
+		$tblTmp = array();
45
+		foreach ($tblLivres as $item) {
46
+			$tblTmp[]       = $item->getVar('book_cid');
47
+			$tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
+			$tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
+			$tbl_books_id[] = $item->getVar('book_id');
50
+		}
51
+		$tblTmp       = array_unique($tblTmp);
52
+		$tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
+		$tbl_tmp_lang = array_unique($tbl_tmp_lang);
54 54
 
55
-        sort($tbl_tmp_lang);
56
-        sort($tblTmp);
57
-        sort($tbl_tmp_vat);
58
-        sort($tbl_books_id);
55
+		sort($tbl_tmp_lang);
56
+		sort($tblTmp);
57
+		sort($tbl_tmp_vat);
58
+		sort($tbl_books_id);
59 59
 
60
-        // Get languages *******************************************
61
-        if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
-        }
60
+		// Get languages *******************************************
61
+		if (count($tbl_tmp_lang) > 0) {
62
+			$tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
+		}
64 64
 
65
-        // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
65
+		// Get the list of categories ****************************
66
+		$tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
67 67
 
68
-        // Get VAT ***********************************************
69
-        if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
-        }
68
+		// Get VAT ***********************************************
69
+		if (count($tbl_tmp_vat) > 0) {
70
+			$tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
+		}
72 72
 
73
-        // Get the authors, deuxi�me partie **************************
74
-        $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
-        if (count($tbl_auteurs) > 0) {
77
-            foreach ($tbl_auteurs as $item) {
78
-                $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
-                // Grouping data by book
80
-                $tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
-            }
82
-            $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
-            sort($tbl_tmp_auteurs);
84
-            // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
-        }
87
-        foreach ($tblLivres as $item) {
88
-            $tbl_tmp                            = array();
89
-            $tbl_tmp                            = $item->toArray();
90
-            $tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
-            $tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
-            $tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
-            $tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
-            $tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
73
+		// Get the authors, deuxi�me partie **************************
74
+		$tbl_books_auteurs = array();
75
+		$tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
+		if (count($tbl_auteurs) > 0) {
77
+			foreach ($tbl_auteurs as $item) {
78
+				$tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
+				// Grouping data by book
80
+				$tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
+			}
82
+			$tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
+			sort($tbl_tmp_auteurs);
84
+			// Then recovered the information from these authors / translators
85
+			$tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
+		}
87
+		foreach ($tblLivres as $item) {
88
+			$tbl_tmp                            = array();
89
+			$tbl_tmp                            = $item->toArray();
90
+			$tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
+			$tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
+			$tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
+			$tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
+			$tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
95 95
 
96
-            // Search for  authors / translators
97
-            $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
-            $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
-            foreach ($tbl_tmp2 as $oneauthor) {
101
-                $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
-                if ($oneauthor->getVar('ba_type') == 1) {
103
-                    $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
-                } else {
106
-                    $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
-                }
109
-            }
110
-            if (count($tbl_join1) > 0) {
111
-                $tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
-            }
113
-            if (count($tbl_join2) > 0) {
114
-                $tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
-            }
116
-            $tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
-            $tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
-            // Et on place le tout dans le template
119
-            $block['block_books'][] = $tbl_tmp;
120
-        }
96
+			// Search for  authors / translators
97
+			$tbl_join1         = $tbl_join2 = array();
98
+			$tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
+			$tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
+			foreach ($tbl_tmp2 as $oneauthor) {
101
+				$auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
+				if ($oneauthor->getVar('ba_type') == 1) {
103
+					$tbl_livre_auteurs[] = $auteur->toArray();
104
+					$tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
+				} else {
106
+					$tbl_livre_traducteurs[] = $auteur->toArray();
107
+					$tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
+				}
109
+			}
110
+			if (count($tbl_join1) > 0) {
111
+				$tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
+			}
113
+			if (count($tbl_join2) > 0) {
114
+				$tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
+			}
116
+			$tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
+			$tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
+			// Et on place le tout dans le template
119
+			$block['block_books'][] = $tbl_tmp;
120
+		}
121 121
 
122
-        return $block;
123
-    } else {    // The list of books is not found (it is not books sold in the stock books)
122
+		return $block;
123
+	} else {    // The list of books is not found (it is not books sold in the stock books)
124 124
 
125
-        return false;
126
-    }
125
+		return false;
126
+	}
127 127
 }
128 128
 
129 129
 /**
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
  */
134 134
 function b_bookshop_new_edit($options)
135 135
 {
136
-    // '10|0';  // Voir 10 livres, pour toutes les cat�gories
137
-    global $xoopsConfig;
138
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
-    include_once BOOKSHOP_PATH . 'class/tree.php';
140
-    $tblCategories         = array();
141
-    $tblCategories         = $h_bookshop_cat->GetAllCategories();
142
-    $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
143
-    $form                  = '';
144
-    $checkeds              = array('', '');
145
-    $checkeds[$options[1]] = 'checked';
146
-    $form .= "<table border='0'>";
147
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
148
-    //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149
-    $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
151
-    $form .= '</table>';
136
+	// '10|0';  // Voir 10 livres, pour toutes les cat�gories
137
+	global $xoopsConfig;
138
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
+	include_once BOOKSHOP_PATH . 'class/tree.php';
140
+	$tblCategories         = array();
141
+	$tblCategories         = $h_bookshop_cat->GetAllCategories();
142
+	$mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
143
+	$form                  = '';
144
+	$checkeds              = array('', '');
145
+	$checkeds[$options[1]] = 'checked';
146
+	$form .= "<table border='0'>";
147
+	$form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
148
+	//$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149
+	$select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
+	$form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
151
+	$form .= '</table>';
152 152
 
153
-    return $form;
153
+	return $form;
154 154
 }
155 155
 
156 156
 /**
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function b_bookshop_new_show_duplicatable($options)
161 161
 {
162
-    $options = explode('|', $options);
163
-    $block   = &b_bookshop_new_show($options);
162
+	$options = explode('|', $options);
163
+	$block   = &b_bookshop_new_show($options);
164 164
 
165
-    $tpl = new XoopsTpl();
166
-    $tpl->assign('block', $block);
167
-    $tpl->display('db:bookshop_block_new.tpl');
165
+	$tpl = new XoopsTpl();
166
+	$tpl->assign('block', $block);
167
+	$tpl->display('db:bookshop_block_new.tpl');
168 168
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 {
35 35
     // '10|0';  // See 10 books, for all categories or a particular category
36 36
     global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
37
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
38 38
     $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39 39
     $tblLivres = $h_bookshop_books->getRecentBooks(0, $options[0], $options[1]);
40 40
     if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
41
+        $url                  = BOOKSHOP_URL.'assets/css/bookshop.css';
42 42
         $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43 43
         $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44 44
         $tblTmp = array();
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 
60 60
         // Get languages *******************************************
61 61
         if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
62
+            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '('.implode(',', $tbl_tmp_lang).')', 'IN'), true);
63 63
         }
64 64
 
65 65
         // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
66
+        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '('.implode(',', $tblTmp).')', 'IN'), true);
67 67
 
68 68
         // Get VAT ***********************************************
69 69
         if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
70
+            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '('.implode(',', $tbl_tmp_vat).')', 'IN'), true);
71 71
         }
72 72
 
73 73
         // Get the authors, deuxi�me partie **************************
74 74
         $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
75
+        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '('.implode(',', $tbl_books_id).')', 'IN'), true);
76 76
         if (count($tbl_auteurs) > 0) {
77 77
             foreach ($tbl_auteurs as $item) {
78 78
                 $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83 83
             sort($tbl_tmp_auteurs);
84 84
             // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
85
+            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '('.implode(',', $tbl_tmp_auteurs).')', 'IN'), true);
86 86
         }
87 87
         foreach ($tblLivres as $item) {
88 88
             $tbl_tmp                            = array();
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 
96 96
             // Search for  authors / translators
97 97
             $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
98
+            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')]; // Returns a list of all authors / translators of a book
99 99
             $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100 100
             foreach ($tbl_tmp2 as $oneauthor) {
101 101
                 $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102 102
                 if ($oneauthor->getVar('ba_type') == 1) {
103 103
                     $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
104
+                    $tbl_join1[]         = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
105 105
                 } else {
106 106
                     $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
107
+                    $tbl_join2[]             = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
108 108
                 }
109 109
             }
110 110
             if (count($tbl_join1) > 0) {
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 {
136 136
     // '10|0';  // Voir 10 livres, pour toutes les cat�gories
137 137
     global $xoopsConfig;
138
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
-    include_once BOOKSHOP_PATH . 'class/tree.php';
138
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
139
+    include_once BOOKSHOP_PATH.'class/tree.php';
140 140
     $tblCategories         = array();
141 141
     $tblCategories         = $h_bookshop_cat->GetAllCategories();
142 142
     $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
     $checkeds              = array('', '');
145 145
     $checkeds[$options[1]] = 'checked';
146 146
     $form .= "<table border='0'>";
147
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
147
+    $form .= '<tr><td>'._MB_BOOKSHOP_BOOKS_CNT."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>";
148 148
     //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149 149
     $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
150
+    $form .= '<tr><td>'._MB_BOOKSHOP_CATEGORY.'</td><td>'.$select.'</td></tr>';
151 151
     $form .= '</table>';
152 152
 
153 153
     return $form;
Please login to merge, or discard this patch.
blocks/bookshop_promotion.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -32,98 +32,98 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function b_bookshop_promotion_show($options)
34 34
 {
35
-    // '10|0';  // See 10 books, for all categories or a particular category
36
-    global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
-    $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
-    $tblLivres = $h_bookshop_books->getPromotionalBooks(0, $options[0], $options[1]);
40
-    if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
-        $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
-        $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
-        $tblTmp = array();
45
-        foreach ($tblLivres as $item) {
46
-            $tblTmp[]       = $item->getVar('book_cid');
47
-            $tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
-            $tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
-            $tbl_books_id[] = $item->getVar('book_id');
50
-        }
51
-        $tblTmp       = array_unique($tblTmp);
52
-        $tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
-        $tbl_tmp_lang = array_unique($tbl_tmp_lang);
35
+	// '10|0';  // See 10 books, for all categories or a particular category
36
+	global $xoopsConfig, $xoopsTpl;
37
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
+	$tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
+	$tblLivres = $h_bookshop_books->getPromotionalBooks(0, $options[0], $options[1]);
40
+	if (count($tblLivres) > 0) {
41
+		$url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
+		$block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
+		$xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
+		$tblTmp = array();
45
+		foreach ($tblLivres as $item) {
46
+			$tblTmp[]       = $item->getVar('book_cid');
47
+			$tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
+			$tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
+			$tbl_books_id[] = $item->getVar('book_id');
50
+		}
51
+		$tblTmp       = array_unique($tblTmp);
52
+		$tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
+		$tbl_tmp_lang = array_unique($tbl_tmp_lang);
54 54
 
55
-        sort($tbl_tmp_lang);
56
-        sort($tblTmp);
57
-        sort($tbl_tmp_vat);
58
-        sort($tbl_books_id);
55
+		sort($tbl_tmp_lang);
56
+		sort($tblTmp);
57
+		sort($tbl_tmp_vat);
58
+		sort($tbl_books_id);
59 59
 
60
-        // Get languages *******************************************
61
-        if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
-        }
60
+		// Get languages *******************************************
61
+		if (count($tbl_tmp_lang) > 0) {
62
+			$tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
+		}
64 64
 
65
-        // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
65
+		// Get the list of categories ****************************
66
+		$tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
67 67
 
68
-        // Get VAT ***********************************************
69
-        if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
-        }
68
+		// Get VAT ***********************************************
69
+		if (count($tbl_tmp_vat) > 0) {
70
+			$tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
+		}
72 72
 
73
-        // Get the authors, second part **************************
74
-        $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
-        if (count($tbl_auteurs) > 0) {
77
-            foreach ($tbl_auteurs as $item) {
78
-                $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
-                // Grouping data by book
80
-                $tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
-            }
82
-            $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
-            sort($tbl_tmp_auteurs);
84
-            // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
-        }
87
-        foreach ($tblLivres as $item) {
88
-            $tbl_tmp                            = array();
89
-            $tbl_tmp                            = $item->toArray();
90
-            $tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
-            $tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
-            $tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
-            $tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
-            $tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
73
+		// Get the authors, second part **************************
74
+		$tbl_books_auteurs = array();
75
+		$tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
+		if (count($tbl_auteurs) > 0) {
77
+			foreach ($tbl_auteurs as $item) {
78
+				$tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
+				// Grouping data by book
80
+				$tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
+			}
82
+			$tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
+			sort($tbl_tmp_auteurs);
84
+			// Then recovered the information from these authors / translators
85
+			$tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
+		}
87
+		foreach ($tblLivres as $item) {
88
+			$tbl_tmp                            = array();
89
+			$tbl_tmp                            = $item->toArray();
90
+			$tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
+			$tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
+			$tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
+			$tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
+			$tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
95 95
 
96
-            // Search for  authors / translators
97
-            $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
-            $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
-            foreach ($tbl_tmp2 as $oneauthor) {
101
-                $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
-                if ($oneauthor->getVar('ba_type') == 1) {
103
-                    $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
-                } else {
106
-                    $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
-                }
109
-            }
110
-            if (count($tbl_join1) > 0) {
111
-                $tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
-            }
113
-            if (count($tbl_join2) > 0) {
114
-                $tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
-            }
116
-            $tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
-            $tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
-            // Et on place le tout dans le template
119
-            $block['block_books'][] = $tbl_tmp;
120
-        }
96
+			// Search for  authors / translators
97
+			$tbl_join1         = $tbl_join2 = array();
98
+			$tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
+			$tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
+			foreach ($tbl_tmp2 as $oneauthor) {
101
+				$auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
+				if ($oneauthor->getVar('ba_type') == 1) {
103
+					$tbl_livre_auteurs[] = $auteur->toArray();
104
+					$tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
+				} else {
106
+					$tbl_livre_traducteurs[] = $auteur->toArray();
107
+					$tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
+				}
109
+			}
110
+			if (count($tbl_join1) > 0) {
111
+				$tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
+			}
113
+			if (count($tbl_join2) > 0) {
114
+				$tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
+			}
116
+			$tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
+			$tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
+			// Et on place le tout dans le template
119
+			$block['block_books'][] = $tbl_tmp;
120
+		}
121 121
 
122
-        return $block;
123
-    } else {    // The list of books is not found (it is not books sold in the stock books)
122
+		return $block;
123
+	} else {    // The list of books is not found (it is not books sold in the stock books)
124 124
 
125
-        return false;
126
-    }
125
+		return false;
126
+	}
127 127
 }
128 128
 
129 129
 /**
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
  */
134 134
 function b_bookshop_promotion_edit($options)
135 135
 {
136
-    // '10|0';  // See 10 books, for all categories
137
-    global $xoopsConfig;
138
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
-    include_once BOOKSHOP_PATH . 'class/tree.php';
140
-    $tblCategories         = array();
141
-    $tblCategories         = $h_bookshop_cat->GetAllCategories();
142
-    $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
143
-    $form                  = '';
144
-    $checkeds              = array('', '');
145
-    $checkeds[$options[1]] = 'checked';
146
-    $form .= "<table border='0'>";
147
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
148
-    //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149
-    $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
151
-    $form .= '</table>';
136
+	// '10|0';  // See 10 books, for all categories
137
+	global $xoopsConfig;
138
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
+	include_once BOOKSHOP_PATH . 'class/tree.php';
140
+	$tblCategories         = array();
141
+	$tblCategories         = $h_bookshop_cat->GetAllCategories();
142
+	$mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
143
+	$form                  = '';
144
+	$checkeds              = array('', '');
145
+	$checkeds[$options[1]] = 'checked';
146
+	$form .= "<table border='0'>";
147
+	$form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
148
+	//$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149
+	$select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
+	$form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
151
+	$form .= '</table>';
152 152
 
153
-    return $form;
153
+	return $form;
154 154
 }
155 155
 
156 156
 /**
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function b_bookshop_promotion_show_duplicatable($options)
161 161
 {
162
-    $options = explode('|', $options);
163
-    $block   = &b_bookshop_promotion_show($options);
162
+	$options = explode('|', $options);
163
+	$block   = &b_bookshop_promotion_show($options);
164 164
 
165
-    $tpl = new XoopsTpl();
166
-    $tpl->assign('block', $block);
167
-    $tpl->display('db:bookshop_block_promotion.tpl');
165
+	$tpl = new XoopsTpl();
166
+	$tpl->assign('block', $block);
167
+	$tpl->display('db:bookshop_block_promotion.tpl');
168 168
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 {
35 35
     // '10|0';  // See 10 books, for all categories or a particular category
36 36
     global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
37
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
38 38
     $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39 39
     $tblLivres = $h_bookshop_books->getPromotionalBooks(0, $options[0], $options[1]);
40 40
     if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
41
+        $url                  = BOOKSHOP_URL.'assets/css/bookshop.css';
42 42
         $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43 43
         $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44 44
         $tblTmp = array();
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 
60 60
         // Get languages *******************************************
61 61
         if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
62
+            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '('.implode(',', $tbl_tmp_lang).')', 'IN'), true);
63 63
         }
64 64
 
65 65
         // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
66
+        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '('.implode(',', $tblTmp).')', 'IN'), true);
67 67
 
68 68
         // Get VAT ***********************************************
69 69
         if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
70
+            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '('.implode(',', $tbl_tmp_vat).')', 'IN'), true);
71 71
         }
72 72
 
73 73
         // Get the authors, second part **************************
74 74
         $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
75
+        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '('.implode(',', $tbl_books_id).')', 'IN'), true);
76 76
         if (count($tbl_auteurs) > 0) {
77 77
             foreach ($tbl_auteurs as $item) {
78 78
                 $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83 83
             sort($tbl_tmp_auteurs);
84 84
             // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
85
+            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '('.implode(',', $tbl_tmp_auteurs).')', 'IN'), true);
86 86
         }
87 87
         foreach ($tblLivres as $item) {
88 88
             $tbl_tmp                            = array();
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 
96 96
             // Search for  authors / translators
97 97
             $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
98
+            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')]; // Returns a list of all authors / translators of a book
99 99
             $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100 100
             foreach ($tbl_tmp2 as $oneauthor) {
101 101
                 $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102 102
                 if ($oneauthor->getVar('ba_type') == 1) {
103 103
                     $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
104
+                    $tbl_join1[]         = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
105 105
                 } else {
106 106
                     $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
107
+                    $tbl_join2[]             = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
108 108
                 }
109 109
             }
110 110
             if (count($tbl_join1) > 0) {
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 {
136 136
     // '10|0';  // See 10 books, for all categories
137 137
     global $xoopsConfig;
138
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
-    include_once BOOKSHOP_PATH . 'class/tree.php';
138
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
139
+    include_once BOOKSHOP_PATH.'class/tree.php';
140 140
     $tblCategories         = array();
141 141
     $tblCategories         = $h_bookshop_cat->GetAllCategories();
142 142
     $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
     $checkeds              = array('', '');
145 145
     $checkeds[$options[1]] = 'checked';
146 146
     $form .= "<table border='0'>";
147
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
147
+    $form .= '<tr><td>'._MB_BOOKSHOP_BOOKS_CNT."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>";
148 148
     //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149 149
     $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
150
+    $form .= '<tr><td>'._MB_BOOKSHOP_CATEGORY.'</td><td>'.$select.'</td></tr>';
151 151
     $form .= '</table>';
152 152
 
153 153
     return $form;
Please login to merge, or discard this patch.
blocks/bookshop_best_sales.php 2 patches
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -32,107 +32,107 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function b_bookshop_bestsales_show($options)
34 34
 {
35
-    // '10|0';  // See 10 books, for all categories or category
36
-    global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
-    $tblBooks = $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = array();
39
-    $tblBooks = $h_bookshop_caddy->getMostSoldBooksInCategory($options[1], 0, $options[0]);
40
-    if (count($tblBooks) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
-        $block                = array();
43
-        $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
44
-        $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
45
-        // Retrieving books
46
-        $criteria = new Criteria('book_id', '(' . implode(',', array_values($tblBooks)) . ')', 'IN');
47
-        $criteria->setSort('book_title');
48
-        $tblLivres = $h_bookshop_books->getObjects($criteria, true);
49
-        if (count($tblLivres) > 0) {
50
-            $tblTmp = array();
51
-            foreach ($tblLivres as $item) {
52
-                $tblTmp[]       = $item->getVar('book_cid');
53
-                $tbl_tmp_vat[]  = $item->getVar('book_vat_id');
54
-                $tbl_tmp_lang[] = $item->getVar('book_lang_id');
55
-            }
56
-            $tblTmp       = array_unique($tblTmp);
57
-            $tbl_tmp_vat  = array_unique($tbl_tmp_vat);
58
-            $tbl_tmp_lang = array_unique($tbl_tmp_lang);
35
+	// '10|0';  // See 10 books, for all categories or category
36
+	global $xoopsConfig, $xoopsTpl;
37
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
+	$tblBooks = $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = array();
39
+	$tblBooks = $h_bookshop_caddy->getMostSoldBooksInCategory($options[1], 0, $options[0]);
40
+	if (count($tblBooks) > 0) {
41
+		$url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
+		$block                = array();
43
+		$block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
44
+		$xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
45
+		// Retrieving books
46
+		$criteria = new Criteria('book_id', '(' . implode(',', array_values($tblBooks)) . ')', 'IN');
47
+		$criteria->setSort('book_title');
48
+		$tblLivres = $h_bookshop_books->getObjects($criteria, true);
49
+		if (count($tblLivres) > 0) {
50
+			$tblTmp = array();
51
+			foreach ($tblLivres as $item) {
52
+				$tblTmp[]       = $item->getVar('book_cid');
53
+				$tbl_tmp_vat[]  = $item->getVar('book_vat_id');
54
+				$tbl_tmp_lang[] = $item->getVar('book_lang_id');
55
+			}
56
+			$tblTmp       = array_unique($tblTmp);
57
+			$tbl_tmp_vat  = array_unique($tbl_tmp_vat);
58
+			$tbl_tmp_lang = array_unique($tbl_tmp_lang);
59 59
 
60
-            sort($tbl_tmp_lang);
61
-            sort($tblTmp);
62
-            sort($tbl_tmp_vat);
60
+			sort($tbl_tmp_lang);
61
+			sort($tblTmp);
62
+			sort($tbl_tmp_vat);
63 63
 
64
-            // Get languages ***************************************
65
-            if (count($tbl_tmp_lang) > 0) {
66
-                $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
67
-            }
64
+			// Get languages ***************************************
65
+			if (count($tbl_tmp_lang) > 0) {
66
+				$tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
67
+			}
68 68
 
69
-            // Get the list of categories ************************
70
-            $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
69
+			// Get the list of categories ************************
70
+			$tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
71 71
 
72
-            // Get VAT *******************************************
73
-            if (count($tbl_tmp_vat) > 0) {
74
-                $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
75
-            }
72
+			// Get VAT *******************************************
73
+			if (count($tbl_tmp_vat) > 0) {
74
+				$tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
75
+			}
76 76
 
77
-            // Get the authors ***************************************
78
-            $tbl_books_auteurs = array();
79
-            $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', array_values($tblBooks)) . ')', 'IN'), true);
80
-            if (count($tbl_auteurs) > 0) {
81
-                foreach ($tbl_auteurs as $item) {
82
-                    $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
83
-                    // Grouping data by book
84
-                    $tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
85
-                }
86
-                $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
87
-                sort($tbl_tmp_auteurs);
88
-                // Then get the information from these authors / translators
89
-                $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
90
-            }
91
-            foreach ($tblLivres as $item) {
92
-                $tbl_tmp                            = array();
93
-                $tbl_tmp                            = $item->toArray();
94
-                $tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
95
-                $tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
96
-                $tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
97
-                $tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
98
-                $tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
77
+			// Get the authors ***************************************
78
+			$tbl_books_auteurs = array();
79
+			$tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', array_values($tblBooks)) . ')', 'IN'), true);
80
+			if (count($tbl_auteurs) > 0) {
81
+				foreach ($tbl_auteurs as $item) {
82
+					$tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
83
+					// Grouping data by book
84
+					$tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
85
+				}
86
+				$tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
87
+				sort($tbl_tmp_auteurs);
88
+				// Then get the information from these authors / translators
89
+				$tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
90
+			}
91
+			foreach ($tblLivres as $item) {
92
+				$tbl_tmp                            = array();
93
+				$tbl_tmp                            = $item->toArray();
94
+				$tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
95
+				$tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
96
+				$tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
97
+				$tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
98
+				$tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
99 99
 
100
-                // Search for  authors / translators
101
-                $tbl_join1         = $tbl_join2 = array();
102
-                $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
103
-                $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
104
-                foreach ($tbl_tmp2 as $oneauthor) {
105
-                    $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
106
-                    if ($oneauthor->getVar('ba_type') == 1) {
107
-                        $tbl_livre_auteurs[] = $auteur->toArray();
108
-                        $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
109
-                    } else {
110
-                        $tbl_livre_traducteurs[] = $auteur->toArray();
111
-                        $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
112
-                    }
113
-                }
114
-                if (count($tbl_join1) > 0) {
115
-                    $tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
116
-                }
117
-                if (count($tbl_join2) > 0) {
118
-                    $tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
119
-                }
120
-                $tbl_tmp['book_authors']     = $tbl_livre_auteurs;
121
-                $tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
100
+				// Search for  authors / translators
101
+				$tbl_join1         = $tbl_join2 = array();
102
+				$tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
103
+				$tbl_livre_auteurs = $tbl_livre_traducteurs = array();
104
+				foreach ($tbl_tmp2 as $oneauthor) {
105
+					$auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
106
+					if ($oneauthor->getVar('ba_type') == 1) {
107
+						$tbl_livre_auteurs[] = $auteur->toArray();
108
+						$tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
109
+					} else {
110
+						$tbl_livre_traducteurs[] = $auteur->toArray();
111
+						$tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
112
+					}
113
+				}
114
+				if (count($tbl_join1) > 0) {
115
+					$tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
116
+				}
117
+				if (count($tbl_join2) > 0) {
118
+					$tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
119
+				}
120
+				$tbl_tmp['book_authors']     = $tbl_livre_auteurs;
121
+				$tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
122 122
 
123
-                // Et on place le tout dans le template
124
-                $block['block_books'][] = $tbl_tmp;
125
-            }
123
+				// Et on place le tout dans le template
124
+				$block['block_books'][] = $tbl_tmp;
125
+			}
126 126
 
127
-            return $block;
128
-        } else {    // The list of books is not found (it is not books sold in the stock books)
127
+			return $block;
128
+		} else {    // The list of books is not found (it is not books sold in the stock books)
129 129
 
130
-            return false;
131
-        }
132
-    } else {    // No books sold in this category
130
+			return false;
131
+		}
132
+	} else {    // No books sold in this category
133 133
 
134
-        return false;
135
-    }
134
+		return false;
135
+	}
136 136
 }
137 137
 
138 138
 /**
@@ -144,24 +144,24 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function b_bookshop_bestsales_edit($options)
146 146
 {
147
-    // '10|0';  // See 10 books, for all categories
148
-    global $xoopsConfig;
149
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
150
-    include_once BOOKSHOP_PATH . 'class/tree.php';
151
-    $tblCategories         = array();
152
-    $tblCategories         = $h_bookshop_cat->GetAllCategories();
153
-    $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
154
-    $form                  = '';
155
-    $checkeds              = array('', '');
156
-    $checkeds[$options[1]] = 'checked';
157
-    $form .= "<table border='0'>";
158
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
159
-    //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
160
-    $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
161
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
162
-    $form .= '</table>';
147
+	// '10|0';  // See 10 books, for all categories
148
+	global $xoopsConfig;
149
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
150
+	include_once BOOKSHOP_PATH . 'class/tree.php';
151
+	$tblCategories         = array();
152
+	$tblCategories         = $h_bookshop_cat->GetAllCategories();
153
+	$mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
154
+	$form                  = '';
155
+	$checkeds              = array('', '');
156
+	$checkeds[$options[1]] = 'checked';
157
+	$form .= "<table border='0'>";
158
+	$form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
159
+	//$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
160
+	$select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
161
+	$form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
162
+	$form .= '</table>';
163 163
 
164
-    return $form;
164
+	return $form;
165 165
 }
166 166
 
167 167
 /**
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function b_bookshop_bestsales_duplicatable($options)
172 172
 {
173
-    $options = explode('|', $options);
174
-    $block   = &b_bookshop_bestsales_show($options);
173
+	$options = explode('|', $options);
174
+	$block   = &b_bookshop_bestsales_show($options);
175 175
 
176
-    $tpl = new XoopsTpl();
177
-    $tpl->assign('block', $block);
178
-    $tpl->display('db:bookshop_block_bestsales.tpl');
176
+	$tpl = new XoopsTpl();
177
+	$tpl->assign('block', $block);
178
+	$tpl->display('db:bookshop_block_bestsales.tpl');
179 179
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 {
35 35
     // '10|0';  // See 10 books, for all categories or category
36 36
     global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
37
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
38 38
     $tblBooks = $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = array();
39 39
     $tblBooks = $h_bookshop_caddy->getMostSoldBooksInCategory($options[1], 0, $options[0]);
40 40
     if (count($tblBooks) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
41
+        $url                  = BOOKSHOP_URL.'assets/css/bookshop.css';
42 42
         $block                = array();
43 43
         $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
44 44
         $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
45 45
         // Retrieving books
46
-        $criteria = new Criteria('book_id', '(' . implode(',', array_values($tblBooks)) . ')', 'IN');
46
+        $criteria = new Criteria('book_id', '('.implode(',', array_values($tblBooks)).')', 'IN');
47 47
         $criteria->setSort('book_title');
48 48
         $tblLivres = $h_bookshop_books->getObjects($criteria, true);
49 49
         if (count($tblLivres) > 0) {
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 
64 64
             // Get languages ***************************************
65 65
             if (count($tbl_tmp_lang) > 0) {
66
-                $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
66
+                $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '('.implode(',', $tbl_tmp_lang).')', 'IN'), true);
67 67
             }
68 68
 
69 69
             // Get the list of categories ************************
70
-            $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
70
+            $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '('.implode(',', $tblTmp).')', 'IN'), true);
71 71
 
72 72
             // Get VAT *******************************************
73 73
             if (count($tbl_tmp_vat) > 0) {
74
-                $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
74
+                $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '('.implode(',', $tbl_tmp_vat).')', 'IN'), true);
75 75
             }
76 76
 
77 77
             // Get the authors ***************************************
78 78
             $tbl_books_auteurs = array();
79
-            $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', array_values($tblBooks)) . ')', 'IN'), true);
79
+            $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '('.implode(',', array_values($tblBooks)).')', 'IN'), true);
80 80
             if (count($tbl_auteurs) > 0) {
81 81
                 foreach ($tbl_auteurs as $item) {
82 82
                     $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
87 87
                 sort($tbl_tmp_auteurs);
88 88
                 // Then get the information from these authors / translators
89
-                $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
89
+                $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '('.implode(',', $tbl_tmp_auteurs).')', 'IN'), true);
90 90
             }
91 91
             foreach ($tblLivres as $item) {
92 92
                 $tbl_tmp                            = array();
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
 
100 100
                 // Search for  authors / translators
101 101
                 $tbl_join1         = $tbl_join2 = array();
102
-                $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
102
+                $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')]; // Returns a list of all authors / translators of a book
103 103
                 $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
104 104
                 foreach ($tbl_tmp2 as $oneauthor) {
105 105
                     $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
106 106
                     if ($oneauthor->getVar('ba_type') == 1) {
107 107
                         $tbl_livre_auteurs[] = $auteur->toArray();
108
-                        $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
+                        $tbl_join1[]         = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
109 109
                     } else {
110 110
                         $tbl_livre_traducteurs[] = $auteur->toArray();
111
-                        $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
111
+                        $tbl_join2[]             = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
112 112
                     }
113 113
                 }
114 114
                 if (count($tbl_join1) > 0) {
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 {
147 147
     // '10|0';  // See 10 books, for all categories
148 148
     global $xoopsConfig;
149
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
150
-    include_once BOOKSHOP_PATH . 'class/tree.php';
149
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
150
+    include_once BOOKSHOP_PATH.'class/tree.php';
151 151
     $tblCategories         = array();
152 152
     $tblCategories         = $h_bookshop_cat->GetAllCategories();
153 153
     $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
     $checkeds              = array('', '');
156 156
     $checkeds[$options[1]] = 'checked';
157 157
     $form .= "<table border='0'>";
158
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
158
+    $form .= '<tr><td>'._MB_BOOKSHOP_BOOKS_CNT."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>";
159 159
     //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
160 160
     $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
161
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
161
+    $form .= '<tr><td>'._MB_BOOKSHOP_CATEGORY.'</td><td>'.$select.'</td></tr>';
162 162
     $form .= '</table>';
163 163
 
164 164
     return $form;
Please login to merge, or discard this patch.
blocks/bookshop_rated.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -32,98 +32,98 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function b_bookshop_rated_show($options)
34 34
 {
35
-    // '10|0';  // See 10 books, for all categories or a particular category
36
-    global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
-    $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
-    $tblLivres = $h_bookshop_books->getBestRatedBooks(0, $options[0], $options[1]);
40
-    if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
-        $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
-        $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
-        $tblTmp = array();
45
-        foreach ($tblLivres as $item) {
46
-            $tblTmp[]       = $item->getVar('book_cid');
47
-            $tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
-            $tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
-            $tbl_books_id[] = $item->getVar('book_id');
50
-        }
51
-        $tblTmp       = array_unique($tblTmp);
52
-        $tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
-        $tbl_tmp_lang = array_unique($tbl_tmp_lang);
35
+	// '10|0';  // See 10 books, for all categories or a particular category
36
+	global $xoopsConfig, $xoopsTpl;
37
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
+	$tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
+	$tblLivres = $h_bookshop_books->getBestRatedBooks(0, $options[0], $options[1]);
40
+	if (count($tblLivres) > 0) {
41
+		$url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
+		$block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
+		$xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
+		$tblTmp = array();
45
+		foreach ($tblLivres as $item) {
46
+			$tblTmp[]       = $item->getVar('book_cid');
47
+			$tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
+			$tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
+			$tbl_books_id[] = $item->getVar('book_id');
50
+		}
51
+		$tblTmp       = array_unique($tblTmp);
52
+		$tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
+		$tbl_tmp_lang = array_unique($tbl_tmp_lang);
54 54
 
55
-        sort($tbl_tmp_lang);
56
-        sort($tblTmp);
57
-        sort($tbl_tmp_vat);
58
-        sort($tbl_books_id);
55
+		sort($tbl_tmp_lang);
56
+		sort($tblTmp);
57
+		sort($tbl_tmp_vat);
58
+		sort($tbl_books_id);
59 59
 
60
-        // Get languages *******************************************
61
-        if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
-        }
60
+		// Get languages *******************************************
61
+		if (count($tbl_tmp_lang) > 0) {
62
+			$tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
+		}
64 64
 
65
-        // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
65
+		// Get the list of categories ****************************
66
+		$tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
67 67
 
68
-        // Get VAT ***********************************************
69
-        if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
-        }
68
+		// Get VAT ***********************************************
69
+		if (count($tbl_tmp_vat) > 0) {
70
+			$tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
+		}
72 72
 
73
-        // Get the authors, deuxi�me partie **************************
74
-        $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
-        if (count($tbl_auteurs) > 0) {
77
-            foreach ($tbl_auteurs as $item) {
78
-                $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
-                // Grouping data by book
80
-                $tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
-            }
82
-            $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
-            sort($tbl_tmp_auteurs);
84
-            // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
-        }
87
-        foreach ($tblLivres as $item) {
88
-            $tbl_tmp                            = array();
89
-            $tbl_tmp                            = $item->toArray();
90
-            $tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
-            $tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
-            $tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
-            $tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
-            $tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
73
+		// Get the authors, deuxi�me partie **************************
74
+		$tbl_books_auteurs = array();
75
+		$tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
+		if (count($tbl_auteurs) > 0) {
77
+			foreach ($tbl_auteurs as $item) {
78
+				$tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
+				// Grouping data by book
80
+				$tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
+			}
82
+			$tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
+			sort($tbl_tmp_auteurs);
84
+			// Then recovered the information from these authors / translators
85
+			$tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
+		}
87
+		foreach ($tblLivres as $item) {
88
+			$tbl_tmp                            = array();
89
+			$tbl_tmp                            = $item->toArray();
90
+			$tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
+			$tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
+			$tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
+			$tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
+			$tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
95 95
 
96
-            // Search for  authors / translators
97
-            $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
-            $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
-            foreach ($tbl_tmp2 as $oneauthor) {
101
-                $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
-                if ($oneauthor->getVar('ba_type') == 1) {
103
-                    $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
-                } else {
106
-                    $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
-                }
109
-            }
110
-            if (count($tbl_join1) > 0) {
111
-                $tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
-            }
113
-            if (count($tbl_join2) > 0) {
114
-                $tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
-            }
116
-            $tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
-            $tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
-            // Et on place le tout dans le template
119
-            $block['block_books'][] = $tbl_tmp;
120
-        }
96
+			// Search for  authors / translators
97
+			$tbl_join1         = $tbl_join2 = array();
98
+			$tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
+			$tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
+			foreach ($tbl_tmp2 as $oneauthor) {
101
+				$auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
+				if ($oneauthor->getVar('ba_type') == 1) {
103
+					$tbl_livre_auteurs[] = $auteur->toArray();
104
+					$tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
+				} else {
106
+					$tbl_livre_traducteurs[] = $auteur->toArray();
107
+					$tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
+				}
109
+			}
110
+			if (count($tbl_join1) > 0) {
111
+				$tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
+			}
113
+			if (count($tbl_join2) > 0) {
114
+				$tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
+			}
116
+			$tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
+			$tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
+			// Et on place le tout dans le template
119
+			$block['block_books'][] = $tbl_tmp;
120
+		}
121 121
 
122
-        return $block;
123
-    } else {    // The list of books is not found (it is not books sold in the stock books)
122
+		return $block;
123
+	} else {    // The list of books is not found (it is not books sold in the stock books)
124 124
 
125
-        return false;
126
-    }
125
+		return false;
126
+	}
127 127
 }
128 128
 
129 129
 /**
@@ -135,24 +135,24 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function b_bookshop_rated_edit($options)
137 137
 {
138
-    // '10|0';  // See 10 books, for all categories
139
-    global $xoopsConfig;
140
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
141
-    include_once BOOKSHOP_PATH . 'class/tree.php';
142
-    $tblCategories         = array();
143
-    $tblCategories         = $h_bookshop_cat->GetAllCategories();
144
-    $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
145
-    $form                  = '';
146
-    $checkeds              = array('', '');
147
-    $checkeds[$options[1]] = 'checked';
148
-    $form .= "<table border='0'>";
149
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
150
-    //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
151
-    $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
152
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
153
-    $form .= '</table>';
138
+	// '10|0';  // See 10 books, for all categories
139
+	global $xoopsConfig;
140
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
141
+	include_once BOOKSHOP_PATH . 'class/tree.php';
142
+	$tblCategories         = array();
143
+	$tblCategories         = $h_bookshop_cat->GetAllCategories();
144
+	$mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
145
+	$form                  = '';
146
+	$checkeds              = array('', '');
147
+	$checkeds[$options[1]] = 'checked';
148
+	$form .= "<table border='0'>";
149
+	$form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
150
+	//$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
151
+	$select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
152
+	$form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
153
+	$form .= '</table>';
154 154
 
155
-    return $form;
155
+	return $form;
156 156
 }
157 157
 
158 158
 /**
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
  */
162 162
 function b_bookshop_rated_show_duplicatable($options)
163 163
 {
164
-    $options = explode('|', $options);
165
-    $block   = &b_bookshop_rated_show($options);
164
+	$options = explode('|', $options);
165
+	$block   = &b_bookshop_rated_show($options);
166 166
 
167
-    $tpl = new XoopsTpl();
168
-    $tpl->assign('block', $block);
169
-    $tpl->display('db:bookshop_block_rated.tpl');
167
+	$tpl = new XoopsTpl();
168
+	$tpl->assign('block', $block);
169
+	$tpl->display('db:bookshop_block_rated.tpl');
170 170
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 {
35 35
     // '10|0';  // See 10 books, for all categories or a particular category
36 36
     global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
37
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
38 38
     $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39 39
     $tblLivres = $h_bookshop_books->getBestRatedBooks(0, $options[0], $options[1]);
40 40
     if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
41
+        $url                  = BOOKSHOP_URL.'assets/css/bookshop.css';
42 42
         $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43 43
         $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44 44
         $tblTmp = array();
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 
60 60
         // Get languages *******************************************
61 61
         if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
62
+            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '('.implode(',', $tbl_tmp_lang).')', 'IN'), true);
63 63
         }
64 64
 
65 65
         // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
66
+        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '('.implode(',', $tblTmp).')', 'IN'), true);
67 67
 
68 68
         // Get VAT ***********************************************
69 69
         if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
70
+            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '('.implode(',', $tbl_tmp_vat).')', 'IN'), true);
71 71
         }
72 72
 
73 73
         // Get the authors, deuxi�me partie **************************
74 74
         $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
75
+        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '('.implode(',', $tbl_books_id).')', 'IN'), true);
76 76
         if (count($tbl_auteurs) > 0) {
77 77
             foreach ($tbl_auteurs as $item) {
78 78
                 $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83 83
             sort($tbl_tmp_auteurs);
84 84
             // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
85
+            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '('.implode(',', $tbl_tmp_auteurs).')', 'IN'), true);
86 86
         }
87 87
         foreach ($tblLivres as $item) {
88 88
             $tbl_tmp                            = array();
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 
96 96
             // Search for  authors / translators
97 97
             $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
98
+            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')]; // Returns a list of all authors / translators of a book
99 99
             $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100 100
             foreach ($tbl_tmp2 as $oneauthor) {
101 101
                 $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102 102
                 if ($oneauthor->getVar('ba_type') == 1) {
103 103
                     $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
104
+                    $tbl_join1[]         = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
105 105
                 } else {
106 106
                     $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
107
+                    $tbl_join2[]             = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
108 108
                 }
109 109
             }
110 110
             if (count($tbl_join1) > 0) {
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 {
138 138
     // '10|0';  // See 10 books, for all categories
139 139
     global $xoopsConfig;
140
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
141
-    include_once BOOKSHOP_PATH . 'class/tree.php';
140
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
141
+    include_once BOOKSHOP_PATH.'class/tree.php';
142 142
     $tblCategories         = array();
143 143
     $tblCategories         = $h_bookshop_cat->GetAllCategories();
144 144
     $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
     $checkeds              = array('', '');
147 147
     $checkeds[$options[1]] = 'checked';
148 148
     $form .= "<table border='0'>";
149
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
149
+    $form .= '<tr><td>'._MB_BOOKSHOP_BOOKS_CNT."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>";
150 150
     //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
151 151
     $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
152
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
152
+    $form .= '<tr><td>'._MB_BOOKSHOP_CATEGORY.'</td><td>'.$select.'</td></tr>';
153 153
     $form .= '</table>';
154 154
 
155 155
     return $form;
Please login to merge, or discard this patch.
blocks/bookshop_random.php 2 patches
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -32,98 +32,98 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function b_bookshop_random_show($options)
34 34
 {
35
-    // '10|0';  // See 10 books, for all categories or a particular category
36
-    global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
-    $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
-    $tblLivres = $h_bookshop_books->getRandomBooks(0, $options[0], $options[1]);
40
-    if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
-        $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
-        $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
-        $tblTmp = array();
45
-        foreach ($tblLivres as $item) {
46
-            $tblTmp[]       = $item->getVar('book_cid');
47
-            $tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
-            $tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
-            $tbl_books_id[] = $item->getVar('book_id');
50
-        }
51
-        $tblTmp       = array_unique($tblTmp);
52
-        $tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
-        $tbl_tmp_lang = array_unique($tbl_tmp_lang);
35
+	// '10|0';  // See 10 books, for all categories or a particular category
36
+	global $xoopsConfig, $xoopsTpl;
37
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
38
+	$tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39
+	$tblLivres = $h_bookshop_books->getRandomBooks(0, $options[0], $options[1]);
40
+	if (count($tblLivres) > 0) {
41
+		$url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
42
+		$block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43
+		$xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44
+		$tblTmp = array();
45
+		foreach ($tblLivres as $item) {
46
+			$tblTmp[]       = $item->getVar('book_cid');
47
+			$tbl_tmp_vat[]  = $item->getVar('book_vat_id');
48
+			$tbl_tmp_lang[] = $item->getVar('book_lang_id');
49
+			$tbl_books_id[] = $item->getVar('book_id');
50
+		}
51
+		$tblTmp       = array_unique($tblTmp);
52
+		$tbl_tmp_vat  = array_unique($tbl_tmp_vat);
53
+		$tbl_tmp_lang = array_unique($tbl_tmp_lang);
54 54
 
55
-        sort($tbl_tmp_lang);
56
-        sort($tblTmp);
57
-        sort($tbl_tmp_vat);
58
-        sort($tbl_books_id);
55
+		sort($tbl_tmp_lang);
56
+		sort($tblTmp);
57
+		sort($tbl_tmp_vat);
58
+		sort($tbl_books_id);
59 59
 
60
-        // Get languages *******************************************
61
-        if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
-        }
60
+		// Get languages *******************************************
61
+		if (count($tbl_tmp_lang) > 0) {
62
+			$tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
63
+		}
64 64
 
65
-        // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
65
+		// Get the list of categories ****************************
66
+		$tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
67 67
 
68
-        // Get VAT ***********************************************
69
-        if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
-        }
68
+		// Get VAT ***********************************************
69
+		if (count($tbl_tmp_vat) > 0) {
70
+			$tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
71
+		}
72 72
 
73
-        // Get the authors, deuxi�me partie **************************
74
-        $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
-        if (count($tbl_auteurs) > 0) {
77
-            foreach ($tbl_auteurs as $item) {
78
-                $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
-                // Grouping data by book
80
-                $tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
-            }
82
-            $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
-            sort($tbl_tmp_auteurs);
84
-            // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
-        }
87
-        foreach ($tblLivres as $item) {
88
-            $tbl_tmp                            = array();
89
-            $tbl_tmp                            = $item->toArray();
90
-            $tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
-            $tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
-            $tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
-            $tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
-            $tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
73
+		// Get the authors, deuxi�me partie **************************
74
+		$tbl_books_auteurs = array();
75
+		$tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
76
+		if (count($tbl_auteurs) > 0) {
77
+			foreach ($tbl_auteurs as $item) {
78
+				$tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
79
+				// Grouping data by book
80
+				$tbl_books_auteurs[$item->getVar('ba_book_id')][] = $item;
81
+			}
82
+			$tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83
+			sort($tbl_tmp_auteurs);
84
+			// Then recovered the information from these authors / translators
85
+			$tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
86
+		}
87
+		foreach ($tblLivres as $item) {
88
+			$tbl_tmp                            = array();
89
+			$tbl_tmp                            = $item->toArray();
90
+			$tbl_tmp['book_category']           = $tblCategories[$item->getVar('book_cid')];
91
+			$tbl_tmp['book_language']           = $tbl_lang[$item->getVar('book_lang_id')];
92
+			$tbl_tmp['book_vat_rate']           = $tbl_vat[$item->getVar('book_vat_id')];
93
+			$tbl_tmp['book_price_ttc']          = bookshop_getTTC($item->getVar('book_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
94
+			$tbl_tmp['book_discount_price_ttc'] = bookshop_getTTC($item->getVar('book_discount_price'), $tbl_vat[$item->getVar('book_vat_id')]->getVar('vat_rate'));
95 95
 
96
-            // Search for  authors / translators
97
-            $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
-            $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
-            foreach ($tbl_tmp2 as $oneauthor) {
101
-                $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
-                if ($oneauthor->getVar('ba_type') == 1) {
103
-                    $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
-                } else {
106
-                    $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
-                }
109
-            }
110
-            if (count($tbl_join1) > 0) {
111
-                $tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
-            }
113
-            if (count($tbl_join2) > 0) {
114
-                $tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
-            }
116
-            $tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
-            $tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
-            // Et on place le tout dans le template
119
-            $block['block_books'][] = $tbl_tmp;
120
-        }
96
+			// Search for  authors / translators
97
+			$tbl_join1         = $tbl_join2 = array();
98
+			$tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
99
+			$tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100
+			foreach ($tbl_tmp2 as $oneauthor) {
101
+				$auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102
+				if ($oneauthor->getVar('ba_type') == 1) {
103
+					$tbl_livre_auteurs[] = $auteur->toArray();
104
+					$tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
105
+				} else {
106
+					$tbl_livre_traducteurs[] = $auteur->toArray();
107
+					$tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
108
+				}
109
+			}
110
+			if (count($tbl_join1) > 0) {
111
+				$tbl_tmp['book_joined_authors'] = implode(', ', $tbl_join1);
112
+			}
113
+			if (count($tbl_join2) > 0) {
114
+				$tbl_tmp['book_joined_translators'] = implode(',', $tbl_join2);
115
+			}
116
+			$tbl_tmp['book_authors']     = $tbl_livre_auteurs;
117
+			$tbl_tmp['book_translators'] = $tbl_livre_traducteurs;
118
+			// Et on place le tout dans le template
119
+			$block['block_books'][] = $tbl_tmp;
120
+		}
121 121
 
122
-        return $block;
123
-    } else {    // The list of books is not found (it is not books sold in the stock books)
122
+		return $block;
123
+	} else {    // The list of books is not found (it is not books sold in the stock books)
124 124
 
125
-        return false;
126
-    }
125
+		return false;
126
+	}
127 127
 }
128 128
 
129 129
 /**
@@ -133,24 +133,24 @@  discard block
 block discarded – undo
133 133
  */
134 134
 function b_bookshop_random_edit($options)
135 135
 {
136
-    // '10|0';  // See 10 books, for all categories
137
-    global $xoopsConfig;
138
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
-    include_once BOOKSHOP_PATH . 'class/tree.php';
140
-    $tblCategories         = array();
141
-    $tblCategories         = $h_bookshop_cat->GetAllCategories();
142
-    $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
143
-    $form                  = '';
144
-    $checkeds              = array('', '');
145
-    $checkeds[$options[1]] = 'checked';
146
-    $form .= "<table border='0'>";
147
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
148
-    //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149
-    $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
151
-    $form .= '</table>';
136
+	// '10|0';  // See 10 books, for all categories
137
+	global $xoopsConfig;
138
+	include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
+	include_once BOOKSHOP_PATH . 'class/tree.php';
140
+	$tblCategories         = array();
141
+	$tblCategories         = $h_bookshop_cat->GetAllCategories();
142
+	$mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
143
+	$form                  = '';
144
+	$checkeds              = array('', '');
145
+	$checkeds[$options[1]] = 'checked';
146
+	$form .= "<table border='0'>";
147
+	$form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
148
+	//$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149
+	$select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
+	$form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
151
+	$form .= '</table>';
152 152
 
153
-    return $form;
153
+	return $form;
154 154
 }
155 155
 
156 156
 /**
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
  */
160 160
 function b_bookshop_random_show_duplicatable($options)
161 161
 {
162
-    $options = explode('|', $options);
163
-    $block   = &b_bookshop_random_show($options);
162
+	$options = explode('|', $options);
163
+	$block   = &b_bookshop_random_show($options);
164 164
 
165
-    $tpl = new XoopsTpl();
166
-    $tpl->assign('block', $block);
167
-    $tpl->display('db:bookshop_block_random.tpl');
165
+	$tpl = new XoopsTpl();
166
+	$tpl->assign('block', $block);
167
+	$tpl->display('db:bookshop_block_random.tpl');
168 168
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 {
35 35
     // '10|0';  // See 10 books, for all categories or a particular category
36 36
     global $xoopsConfig, $xoopsTpl;
37
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
37
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
38 38
     $tblLivres = $tblCategories = $tblTmp = $tbl_tmp_vat = $tbl_vat = $tbl_tmp_lang = $block = $tbl_books_id = array();
39 39
     $tblLivres = $h_bookshop_books->getRandomBooks(0, $options[0], $options[1]);
40 40
     if (count($tblLivres) > 0) {
41
-        $url                  = BOOKSHOP_URL . 'assets/css/bookshop.css';
41
+        $url                  = BOOKSHOP_URL.'assets/css/bookshop.css';
42 42
         $block['nostock_msg'] = bookshop_getmoduleoption('nostock_msg');
43 43
         $xoopsTpl->assign('xoops_module_header', "<link rel=\"stylesheet\" type=\"text/css\" href=\"$url\" />");
44 44
         $tblTmp = array();
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 
60 60
         // Get languages *******************************************
61 61
         if (count($tbl_tmp_lang) > 0) {
62
-            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '(' . implode(',', $tbl_tmp_lang) . ')', 'IN'), true);
62
+            $tbl_lang = $h_bookshop_lang->getObjects(new Criteria('lang_id', '('.implode(',', $tbl_tmp_lang).')', 'IN'), true);
63 63
         }
64 64
 
65 65
         // Get the list of categories ****************************
66
-        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
66
+        $tblCategories = $h_bookshop_cat->getObjects(new Criteria('cat_cid', '('.implode(',', $tblTmp).')', 'IN'), true);
67 67
 
68 68
         // Get VAT ***********************************************
69 69
         if (count($tbl_tmp_vat) > 0) {
70
-            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '(' . implode(',', $tbl_tmp_vat) . ')', 'IN'), true);
70
+            $tbl_vat = $h_bookshop_vat->getObjects(new Criteria('vat_id', '('.implode(',', $tbl_tmp_vat).')', 'IN'), true);
71 71
         }
72 72
 
73 73
         // Get the authors, deuxi�me partie **************************
74 74
         $tbl_books_auteurs = array();
75
-        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '(' . implode(',', $tbl_books_id) . ')', 'IN'), true);
75
+        $tbl_auteurs       = $h_bookshop_booksauthors->getObjects(new Criteria('ba_book_id', '('.implode(',', $tbl_books_id).')', 'IN'), true);
76 76
         if (count($tbl_auteurs) > 0) {
77 77
             foreach ($tbl_auteurs as $item) {
78 78
                 $tbl_tmp_auteurs[] = $item->getVar('ba_auth_id');
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $tbl_tmp_auteurs = array_unique($tbl_tmp_auteurs);
83 83
             sort($tbl_tmp_auteurs);
84 84
             // Then recovered the information from these authors / translators
85
-            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tbl_tmp_auteurs) . ')', 'IN'), true);
85
+            $tbl_infos_auteurs = $h_bookshop_authors->getObjects(new Criteria('auth_id', '('.implode(',', $tbl_tmp_auteurs).')', 'IN'), true);
86 86
         }
87 87
         foreach ($tblLivres as $item) {
88 88
             $tbl_tmp                            = array();
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 
96 96
             // Search for  authors / translators
97 97
             $tbl_join1         = $tbl_join2 = array();
98
-            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')];    // Returns a list of all authors / translators of a book
98
+            $tbl_tmp2          = $tbl_books_auteurs[$item->getVar('book_id')]; // Returns a list of all authors / translators of a book
99 99
             $tbl_livre_auteurs = $tbl_livre_traducteurs = array();
100 100
             foreach ($tbl_tmp2 as $oneauthor) {
101 101
                 $auteur = $tbl_infos_auteurs[$oneauthor->getVar('ba_auth_id')];
102 102
                 if ($oneauthor->getVar('ba_type') == 1) {
103 103
                     $tbl_livre_auteurs[] = $auteur->toArray();
104
-                    $tbl_join1[]         = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
104
+                    $tbl_join1[]         = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
105 105
                 } else {
106 106
                     $tbl_livre_traducteurs[] = $auteur->toArray();
107
-                    $tbl_join2[]             = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
107
+                    $tbl_join2[]             = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
108 108
                 }
109 109
             }
110 110
             if (count($tbl_join1) > 0) {
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 {
136 136
     // '10|0';  // See 10 books, for all categories
137 137
     global $xoopsConfig;
138
-    include XOOPS_ROOT_PATH . '/modules/bookshop/include/common.php';
139
-    include_once BOOKSHOP_PATH . 'class/tree.php';
138
+    include XOOPS_ROOT_PATH.'/modules/bookshop/include/common.php';
139
+    include_once BOOKSHOP_PATH.'class/tree.php';
140 140
     $tblCategories         = array();
141 141
     $tblCategories         = $h_bookshop_cat->GetAllCategories();
142 142
     $mytree                = new Bookshop_XoopsObjectTree($tblCategories, 'cat_cid', 'cat_pid');
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
     $checkeds              = array('', '');
145 145
     $checkeds[$options[1]] = 'checked';
146 146
     $form .= "<table border='0'>";
147
-    $form .= '<tr><td>' . _MB_BOOKSHOP_BOOKS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "' /></td></tr>";
147
+    $form .= '<tr><td>'._MB_BOOKSHOP_BOOKS_CNT."</td><td><input type='text' name='options[]' id='options' value='".$options[0]."' /></td></tr>";
148 148
     //$form .= '<tr><td>'._MB_BOOKSHOP_SORT_ORDER."</td><td><input type='radio' name='options[]' id='options[]' value='0' ".$checkeds[0]." />"._MB_BOOKSHOP_SORT_1." <input type='radio' name='options[]' id='options[]' value='1' ".$checkeds[1]." />"._MB_BOOKSHOP_SORT_2.'</td></tr>';
149 149
     $select = $mytree->makeSelBox('options[]', 'cat_title', '-', $options[1], _MB_BOOKSHOP_ALL_CATEGORIES);
150
-    $form .= '<tr><td>' . _MB_BOOKSHOP_CATEGORY . '</td><td>' . $select . '</td></tr>';
150
+    $form .= '<tr><td>'._MB_BOOKSHOP_CATEGORY.'</td><td>'.$select.'</td></tr>';
151 151
     $form .= '</table>';
152 152
 
153 153
     return $form;
Please login to merge, or discard this patch.
rate-book.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -32,106 +32,106 @@
 block discarded – undo
32 32
 // Les tests **************************************************************************************
33 33
 // Peut on voter ?
34 34
 if (bookshop_getmoduleoption('ratebooks') == 0) {
35
-    bookshop_redirect(_BOOKSHOP_NORATE, 'index.php', 5);
35
+	bookshop_redirect(_BOOKSHOP_NORATE, 'index.php', 5);
36 36
 }
37 37
 // Find the book #
38 38
 if (isset($_GET['book_id'])) {
39
-    $book_id = (int)$_GET['book_id'];
39
+	$book_id = (int)$_GET['book_id'];
40 40
 } elseif (isset($_POST['book_id'])) {
41
-    $book_id = (int)$_POST['book_id'];
41
+	$book_id = (int)$_POST['book_id'];
42 42
 } else {
43
-    bookshop_redirect(_BOOKSHOP_ERROR1, 'index.php', 5);
43
+	bookshop_redirect(_BOOKSHOP_ERROR1, 'index.php', 5);
44 44
 }
45 45
 // The book exists?
46 46
 $book = null;
47 47
 $book = $h_bookshop_books->get($book_id);
48 48
 if (!is_object($book)) {
49
-    bookshop_redirect(_BOOKSHOP_ERROR1, 'index.php', 5);
49
+	bookshop_redirect(_BOOKSHOP_ERROR1, 'index.php', 5);
50 50
 }
51 51
 
52 52
 //  The book is it online?
53 53
 if ($book->getVar('book_online') == 0) {
54
-    bookshop_redirect(_BOOKSHOP_ERROR2, 'index.php', 5);
54
+	bookshop_redirect(_BOOKSHOP_ERROR2, 'index.php', 5);
55 55
 }
56 56
 
57 57
 // The book is published?
58 58
 if (bookshop_getmoduleoption('show_unpublished') == 0 && $book->getVar('book_submitted') > time()) {
59
-    bookshop_redirect(_BOOKSHOP_ERROR3, 'index.php', 5);
59
+	bookshop_redirect(_BOOKSHOP_ERROR3, 'index.php', 5);
60 60
 }
61 61
 
62 62
 // Should we view the books even when not in stock?
63 63
 if (bookshop_getmoduleoption('nostock_display') == 0 && $book->getVar('book_stock') == 0) {
64
-    if (xoops_trim(bookshop_getmoduleoption('nostock_display')) != '') {
65
-        bookshop_redirect(bookshop_getmoduleoption('nostock_display'), 'index.php', 5);
66
-    }
64
+	if (xoops_trim(bookshop_getmoduleoption('nostock_display')) != '') {
65
+		bookshop_redirect(bookshop_getmoduleoption('nostock_display'), 'index.php', 5);
66
+	}
67 67
 }
68 68
 
69 69
 //  End of the tests, if it is still there is that everything is good **************************************
70 70
 if (!empty($_POST['btnsubmit'])) {            // The form was submited
71
-    $GLOBALS['current_category'] = -1;
72
-    if (!is_object($xoopsUser)) {
73
-        $ratinguser = 0;
74
-    } else {
75
-        $ratinguser = $xoopsUser->getVar('uid');
76
-    }
77
-    $ip      = bookshop_IP();
78
-    $canRate = true;
79
-    if ($ratinguser != 0) {
80
-        $criteria = new CriteriaCompo();
81
-        $criteria->add(new Criteria('vote_book_id', $book->getVar('book_id'), '='));
82
-        $criteria->add(new Criteria('vote_uid', $ratinguser, '='));
83
-        $cnt = 0;
84
-        $cnt = $h_bookshop_votedata->getCount($criteria);
85
-        if ($cnt > 0) {
86
-            $canRate = false;
87
-        }
88
-    } else {
89
-        $anonwaitdays = 1;
90
-        $yesterday    = (time() - (86400 * $anonwaitdays));
91
-        $criteria     = new CriteriaCompo();
92
-        $criteria->add(new Criteria('vote_book_id', $book->getVar('book_id'), '='));
93
-        $criteria->add(new Criteria('vote_uid', 0, '='));
94
-        $criteria->add(new Criteria('vote_ratinghostname', $ip, '='));
95
-        $criteria->add(new Criteria('vote_ratingtimestamp', $yesterday, '>'));
96
-        $cnt = $h_bookshop_votedata->getCount($criteria);
97
-        if ($cnt > 0) {
98
-            $canRate = false;
99
-        }
100
-    }
101
-    if ($canRate) {
102
-        if ($_POST['rating'] == '--') {
103
-            bookshop_redirect(_BOOKSHOP_NORATING, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 4);
104
-        }
105
-        $book_vote_data = $h_bookshop_votedata->create(true);
106
-        $book_vote_data->setVar('vote_book_id', $book->getVar('book_id'));
107
-        $book_vote_data->setVar('vote_uid', $ratinguser);
108
-        $book_vote_data->setVar('vote_rating', (int)$_POST['rating']);
109
-        $book_vote_data->setVar('vote_ratinghostname', $ip);
110
-        $book_vote_data->setVar('vote_ratingtimestamp', time());
111
-        $h_bookshop_votedata->insert($book_vote_data);
112
-        // Calcul du nombre de votes et du total des votes pour mettre � jour les informations du livre
113
-        $totalVotes = 0;
114
-        $sumRating  = 0;
115
-        $ret        = 0;
116
-        $ret        = $h_bookshop_votedata->getCountRecordSumRating($book->getVar('book_id'), $totalVotes, $sumRating);
71
+	$GLOBALS['current_category'] = -1;
72
+	if (!is_object($xoopsUser)) {
73
+		$ratinguser = 0;
74
+	} else {
75
+		$ratinguser = $xoopsUser->getVar('uid');
76
+	}
77
+	$ip      = bookshop_IP();
78
+	$canRate = true;
79
+	if ($ratinguser != 0) {
80
+		$criteria = new CriteriaCompo();
81
+		$criteria->add(new Criteria('vote_book_id', $book->getVar('book_id'), '='));
82
+		$criteria->add(new Criteria('vote_uid', $ratinguser, '='));
83
+		$cnt = 0;
84
+		$cnt = $h_bookshop_votedata->getCount($criteria);
85
+		if ($cnt > 0) {
86
+			$canRate = false;
87
+		}
88
+	} else {
89
+		$anonwaitdays = 1;
90
+		$yesterday    = (time() - (86400 * $anonwaitdays));
91
+		$criteria     = new CriteriaCompo();
92
+		$criteria->add(new Criteria('vote_book_id', $book->getVar('book_id'), '='));
93
+		$criteria->add(new Criteria('vote_uid', 0, '='));
94
+		$criteria->add(new Criteria('vote_ratinghostname', $ip, '='));
95
+		$criteria->add(new Criteria('vote_ratingtimestamp', $yesterday, '>'));
96
+		$cnt = $h_bookshop_votedata->getCount($criteria);
97
+		if ($cnt > 0) {
98
+			$canRate = false;
99
+		}
100
+	}
101
+	if ($canRate) {
102
+		if ($_POST['rating'] == '--') {
103
+			bookshop_redirect(_BOOKSHOP_NORATING, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 4);
104
+		}
105
+		$book_vote_data = $h_bookshop_votedata->create(true);
106
+		$book_vote_data->setVar('vote_book_id', $book->getVar('book_id'));
107
+		$book_vote_data->setVar('vote_uid', $ratinguser);
108
+		$book_vote_data->setVar('vote_rating', (int)$_POST['rating']);
109
+		$book_vote_data->setVar('vote_ratinghostname', $ip);
110
+		$book_vote_data->setVar('vote_ratingtimestamp', time());
111
+		$h_bookshop_votedata->insert($book_vote_data);
112
+		// Calcul du nombre de votes et du total des votes pour mettre � jour les informations du livre
113
+		$totalVotes = 0;
114
+		$sumRating  = 0;
115
+		$ret        = 0;
116
+		$ret        = $h_bookshop_votedata->getCountRecordSumRating($book->getVar('book_id'), $totalVotes, $sumRating);
117 117
 
118
-        $finalrating = $sumRating / $totalVotes;
119
-        $finalrating = number_format($finalrating, 4);
120
-        $h_bookshop_books->updateRating($book_id, $finalrating, $totalVotes);
121
-        $ratemessage = _BOOKSHOP_VOTEAPPRE . '<br>' . sprintf(_BOOKSHOP_THANKYOU, $xoopsConfig['sitename']);
122
-        bookshop_redirect($ratemessage, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 2);
123
-    } else {
124
-        bookshop_redirect(_BOOKSHOP_VOTEONCE, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 5);
125
-    }
118
+		$finalrating = $sumRating / $totalVotes;
119
+		$finalrating = number_format($finalrating, 4);
120
+		$h_bookshop_books->updateRating($book_id, $finalrating, $totalVotes);
121
+		$ratemessage = _BOOKSHOP_VOTEAPPRE . '<br>' . sprintf(_BOOKSHOP_THANKYOU, $xoopsConfig['sitename']);
122
+		bookshop_redirect($ratemessage, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 2);
123
+	} else {
124
+		bookshop_redirect(_BOOKSHOP_VOTEONCE, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 5);
125
+	}
126 126
 } else {    // Affichage du formulaire
127
-    $GLOBALS['current_category']  = $book->getVar('book_cid');
128
-    $xoopsOption['template_main'] = 'bookshop_rate_book.tpl';
129
-    include_once XOOPS_ROOT_PATH . '/header.php';
130
-    $xoopsTpl->assign('mod_pref', $mod_pref);    // Module Preferences
131
-    $xoopsTpl->assign('book', $book->toArray());
132
-    $title = _BOOKSHOP_RATETHISBOOK . ' : ' . strip_tags($book->getVar('book_title')) . ' - ' . bookshop_get_module_name();
133
-    bookshop_set_metas($title, $title);
134
-    bookshop_setCSS();
127
+	$GLOBALS['current_category']  = $book->getVar('book_cid');
128
+	$xoopsOption['template_main'] = 'bookshop_rate_book.tpl';
129
+	include_once XOOPS_ROOT_PATH . '/header.php';
130
+	$xoopsTpl->assign('mod_pref', $mod_pref);    // Module Preferences
131
+	$xoopsTpl->assign('book', $book->toArray());
132
+	$title = _BOOKSHOP_RATETHISBOOK . ' : ' . strip_tags($book->getVar('book_title')) . ' - ' . bookshop_get_module_name();
133
+	bookshop_set_metas($title, $title);
134
+	bookshop_setCSS();
135 135
 }
136 136
 
137 137
 include_once XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 /**
27 27
  * Affichage d'un livre
28 28
  */
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 
31 31
 $book_id = 0;
32 32
 // Les tests **************************************************************************************
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     }
101 101
     if ($canRate) {
102 102
         if ($_POST['rating'] == '--') {
103
-            bookshop_redirect(_BOOKSHOP_NORATING, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 4);
103
+            bookshop_redirect(_BOOKSHOP_NORATING, BOOKSHOP_URL.'book.php?book_id='.$book->getVar('book_id'), 4);
104 104
         }
105 105
         $book_vote_data = $h_bookshop_votedata->create(true);
106 106
         $book_vote_data->setVar('vote_book_id', $book->getVar('book_id'));
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
         $finalrating = $sumRating / $totalVotes;
119 119
         $finalrating = number_format($finalrating, 4);
120 120
         $h_bookshop_books->updateRating($book_id, $finalrating, $totalVotes);
121
-        $ratemessage = _BOOKSHOP_VOTEAPPRE . '<br>' . sprintf(_BOOKSHOP_THANKYOU, $xoopsConfig['sitename']);
122
-        bookshop_redirect($ratemessage, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 2);
121
+        $ratemessage = _BOOKSHOP_VOTEAPPRE.'<br>'.sprintf(_BOOKSHOP_THANKYOU, $xoopsConfig['sitename']);
122
+        bookshop_redirect($ratemessage, BOOKSHOP_URL.'book.php?book_id='.$book->getVar('book_id'), 2);
123 123
     } else {
124
-        bookshop_redirect(_BOOKSHOP_VOTEONCE, BOOKSHOP_URL . 'book.php?book_id=' . $book->getVar('book_id'), 5);
124
+        bookshop_redirect(_BOOKSHOP_VOTEONCE, BOOKSHOP_URL.'book.php?book_id='.$book->getVar('book_id'), 5);
125 125
     }
126 126
 } else {    // Affichage du formulaire
127 127
     $GLOBALS['current_category']  = $book->getVar('book_cid');
128 128
     $xoopsOption['template_main'] = 'bookshop_rate_book.tpl';
129
-    include_once XOOPS_ROOT_PATH . '/header.php';
130
-    $xoopsTpl->assign('mod_pref', $mod_pref);    // Module Preferences
129
+    include_once XOOPS_ROOT_PATH.'/header.php';
130
+    $xoopsTpl->assign('mod_pref', $mod_pref); // Module Preferences
131 131
     $xoopsTpl->assign('book', $book->toArray());
132
-    $title = _BOOKSHOP_RATETHISBOOK . ' : ' . strip_tags($book->getVar('book_title')) . ' - ' . bookshop_get_module_name();
132
+    $title = _BOOKSHOP_RATETHISBOOK.' : '.strip_tags($book->getVar('book_title')).' - '.bookshop_get_module_name();
133 133
     bookshop_set_metas($title, $title);
134 134
     bookshop_setCSS();
135 135
 }
136 136
 
137
-include_once XOOPS_ROOT_PATH . '/footer.php';
137
+include_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
invoice.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -33,27 +33,27 @@  discard block
 block discarded – undo
33 33
 include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
34 34
 
35 35
 if (isset($_GET['command'])) {
36
-    $cmd_id = (int)$_GET['command'];
36
+	$cmd_id = (int)$_GET['command'];
37 37
 } else {
38
-    bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
38
+	bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
39 39
 }
40 40
 if (isset($_GET['pass'])) {
41
-    $pass = $_GET['pass'];
41
+	$pass = $_GET['pass'];
42 42
 } else {
43
-    bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
43
+	bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
44 44
 }
45 45
 $commande = null;
46 46
 $commande = $h_bookshop_commands->get($cmd_id);
47 47
 if (!is_object($commande)) {
48
-    bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
48
+	bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
49 49
 }
50 50
 // Check password
51 51
 if ($pass != $commande->getVar('cmd_password')) {
52
-    bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
52
+	bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
53 53
 }
54 54
 
55 55
 if ($commande->getVar('cmd_state') != COMMAND_STATE_VALIDATED) {    // Commande non valid�e
56
-    bookshop_redirect(_BOOKSHOP_ERROR12, 'index.php', 6);
56
+	bookshop_redirect(_BOOKSHOP_ERROR12, 'index.php', 6);
57 57
 }
58 58
 
59 59
 $dec      = bookshop_getmoduleoption('decimals_count');
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 // Retrieve the associated caddy  ************************************************************************************
67 67
 $tblCaddy = $h_bookshop_caddy->getObjects(new Criteria('caddy_cmd_id', $cmd_id, '='), true);
68 68
 if (count($tblCaddy) == 0) {
69
-    bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
69
+	bookshop_redirect(_BOOKSHOP_ERROR11, 'index.php', 6);
70 70
 }
71 71
 foreach ($tblCaddy as $item) {
72
-    $tblTmp[] = $item->getVar('caddy_book_id');
72
+	$tblTmp[] = $item->getVar('caddy_book_id');
73 73
 }
74 74
 // Search books ***********************************************************************************************
75 75
 $tblBooks = $h_bookshop_books->getObjects(new Criteria('book_id', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 $tblTmp2 = $h_bookshop_booksauthors->getObjects($criteria, true);
84 84
 $tblTmp  = array();
85 85
 foreach ($tblTmp2 as $item) {
86
-    $tblTmp[]                                  = $item->getVar('ba_auth_id');
87
-    $tblTmpAuth[$item->getVar('ba_book_id')][] = $item;
86
+	$tblTmp[]                                  = $item->getVar('ba_auth_id');
87
+	$tblTmpAuth[$item->getVar('ba_book_id')][] = $item;
88 88
 }
89 89
 $tblAuthors = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
90 90
 
@@ -96,22 +96,22 @@  discard block
 block discarded – undo
96 96
 
97 97
 // Loop through the caddy  ************************************************************************************************
98 98
 foreach ($tblCaddy as $itemCaddy) {
99
-    $tblTmp  = array();
100
-    $item    = $tblBooks[$itemCaddy->getVar('caddy_book_id')];
101
-    $tblTmp  = $item->toArray();
102
-    $tblTmp2 = $tblTmpAuth[$itemCaddy->getVar('caddy_book_id')];
103
-    $tblJoin = array();
104
-    foreach ($tblTmp2 as $item2) {
105
-        $auteur    = $tblAuthors[$item2->getVar('ba_auth_id')];
106
-        $tblJoin[] = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
107
-    }
108
-    if (count($tblJoin) > 0) {
109
-        $tblTmp['book_joined_authors'] = implode(', ', $tblJoin);
110
-    }
111
-    $tblTmp['book_price_ttc']       = sprintf('%0.' . bookshop_getmoduleoption('decimals_count') . 'f', $itemCaddy->getVar('caddy_price'));
112
-    $tblTmp['book_shipping_amount'] = sprintf('%0.' . bookshop_getmoduleoption('decimals_count') . 'f', $itemCaddy->getVar('caddy_shipping'));
113
-    $tblTmp['book_qty']             = $itemCaddy->getVar('caddy_qte');
114
-    $xoopsTpl->append('books', $tblTmp);
99
+	$tblTmp  = array();
100
+	$item    = $tblBooks[$itemCaddy->getVar('caddy_book_id')];
101
+	$tblTmp  = $item->toArray();
102
+	$tblTmp2 = $tblTmpAuth[$itemCaddy->getVar('caddy_book_id')];
103
+	$tblJoin = array();
104
+	foreach ($tblTmp2 as $item2) {
105
+		$auteur    = $tblAuthors[$item2->getVar('ba_auth_id')];
106
+		$tblJoin[] = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
107
+	}
108
+	if (count($tblJoin) > 0) {
109
+		$tblTmp['book_joined_authors'] = implode(', ', $tblJoin);
110
+	}
111
+	$tblTmp['book_price_ttc']       = sprintf('%0.' . bookshop_getmoduleoption('decimals_count') . 'f', $itemCaddy->getVar('caddy_price'));
112
+	$tblTmp['book_shipping_amount'] = sprintf('%0.' . bookshop_getmoduleoption('decimals_count') . 'f', $itemCaddy->getVar('caddy_shipping'));
113
+	$tblTmp['book_qty']             = $itemCaddy->getVar('caddy_qte');
114
+	$xoopsTpl->append('books', $tblTmp);
115 115
 }
116 116
 
117 117
 $xoopsTpl->assign('commandAmountTTC', sprintf('%0.' . $dec . 'f', $commande->getVar('cmd_total')));        // Tax amount of the order
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 /**
27 27
  * Visualization of an invoice on the screen
28 28
  */
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 $GLOBALS['current_category']  = -1;
31 31
 $xoopsOption['template_main'] = 'bookshop_bill.tpl';
32
-include_once XOOPS_ROOT_PATH . '/header.php';
33
-include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
32
+include_once XOOPS_ROOT_PATH.'/header.php';
33
+include_once XOOPS_ROOT_PATH.'/class/xoopslists.php';
34 34
 
35 35
 if (isset($_GET['command'])) {
36 36
     $cmd_id = (int)$_GET['command'];
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
     $tblTmp[] = $item->getVar('caddy_book_id');
73 73
 }
74 74
 // Search books ***********************************************************************************************
75
-$tblBooks = $h_bookshop_books->getObjects(new Criteria('book_id', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
75
+$tblBooks = $h_bookshop_books->getObjects(new Criteria('book_id', '('.implode(',', $tblTmp).')', 'IN'), true);
76 76
 
77 77
 // Search Authors  **********************************************************************************************
78 78
 // We did not include translators for this part
79 79
 $tblAuthors = $tblTmpAuth = array();
80 80
 $criteria   = new CriteriaCompo();
81
-$criteria->add(new Criteria('ba_book_id', '(' . implode(',', $tblTmp) . ')', 'IN'));
81
+$criteria->add(new Criteria('ba_book_id', '('.implode(',', $tblTmp).')', 'IN'));
82 82
 $criteria->add(new Criteria('ba_type', 1, '='));
83 83
 $tblTmp2 = $h_bookshop_booksauthors->getObjects($criteria, true);
84 84
 $tblTmp  = array();
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     $tblTmp[]                                  = $item->getVar('ba_auth_id');
87 87
     $tblTmpAuth[$item->getVar('ba_book_id')][] = $item;
88 88
 }
89
-$tblAuthors = $h_bookshop_authors->getObjects(new Criteria('auth_id', '(' . implode(',', $tblTmp) . ')', 'IN'), true);
89
+$tblAuthors = $h_bookshop_authors->getObjects(new Criteria('auth_id', '('.implode(',', $tblTmp).')', 'IN'), true);
90 90
 
91 91
 // Ordering information ***************************************************************************************
92 92
 $tblTmp                       = $commande->toArray();
@@ -103,22 +103,22 @@  discard block
 block discarded – undo
103 103
     $tblJoin = array();
104 104
     foreach ($tblTmp2 as $item2) {
105 105
         $auteur    = $tblAuthors[$item2->getVar('ba_auth_id')];
106
-        $tblJoin[] = $auteur->getVar('auth_firstname') . ' ' . $auteur->getVar('auth_name');
106
+        $tblJoin[] = $auteur->getVar('auth_firstname').' '.$auteur->getVar('auth_name');
107 107
     }
108 108
     if (count($tblJoin) > 0) {
109 109
         $tblTmp['book_joined_authors'] = implode(', ', $tblJoin);
110 110
     }
111
-    $tblTmp['book_price_ttc']       = sprintf('%0.' . bookshop_getmoduleoption('decimals_count') . 'f', $itemCaddy->getVar('caddy_price'));
112
-    $tblTmp['book_shipping_amount'] = sprintf('%0.' . bookshop_getmoduleoption('decimals_count') . 'f', $itemCaddy->getVar('caddy_shipping'));
111
+    $tblTmp['book_price_ttc']       = sprintf('%0.'.bookshop_getmoduleoption('decimals_count').'f', $itemCaddy->getVar('caddy_price'));
112
+    $tblTmp['book_shipping_amount'] = sprintf('%0.'.bookshop_getmoduleoption('decimals_count').'f', $itemCaddy->getVar('caddy_shipping'));
113 113
     $tblTmp['book_qty']             = $itemCaddy->getVar('caddy_qte');
114 114
     $xoopsTpl->append('books', $tblTmp);
115 115
 }
116 116
 
117
-$xoopsTpl->assign('commandAmountTTC', sprintf('%0.' . $dec . 'f', $commande->getVar('cmd_total')));        // Tax amount of the order
118
-$xoopsTpl->assign('shippingAmount', sprintf('%0.' . $dec . 'f', $commande->getVar('cmd_shipping')));    // VAT amount of shipping cost
119
-$xoopsTpl->assign('discountsDescription', nl2br($commande->getVar('cmd_text')));                    // List of discounts given
117
+$xoopsTpl->assign('commandAmountTTC', sprintf('%0.'.$dec.'f', $commande->getVar('cmd_total'))); // Tax amount of the order
118
+$xoopsTpl->assign('shippingAmount', sprintf('%0.'.$dec.'f', $commande->getVar('cmd_shipping'))); // VAT amount of shipping cost
119
+$xoopsTpl->assign('discountsDescription', nl2br($commande->getVar('cmd_text'))); // List of discounts given
120 120
 
121 121
 bookshop_setCSS();
122
-$title = _BOOKSHOP_BILL . ' - ' . bookshop_get_module_name();
122
+$title = _BOOKSHOP_BILL.' - '.bookshop_get_module_name();
123 123
 bookshop_set_metas($title, $title);
124
-include_once XOOPS_ROOT_PATH . '/footer.php';
124
+include_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
caddy.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 
36 36
 $op = 'default';
37 37
 if (isset($_POST['op'])) {
38
-    $op = $_POST['op'];
38
+	$op = $_POST['op'];
39 39
 } elseif (isset($_GET['op'])) {
40
-    $op = $_GET['op'];
40
+	$op = $_GET['op'];
41 41
 }
42 42
 
43 43
 $book_id = 0;
44 44
 if (isset($_POST['book_id'])) {
45
-    $book_id = $_POST['book_id'];
45
+	$book_id = $_POST['book_id'];
46 46
 } elseif (isset($_GET['book_id'])) {
47
-    $book_id = $_GET['book_id'];
47
+	$book_id = $_GET['book_id'];
48 48
 }
49 49
 
50 50
 $xoopsTpl->assign('op', $op);
@@ -56,93 +56,93 @@  discard block
 block discarded – undo
56 56
 // ********************************************************************************************************************
57 57
 function listCaddie()
58 58
 {
59
-    global $xoopsTpl, $h_bookshop_caddy;
60
-    $cartForTemplate      = array();
61
-    $emptyCart            = false;
62
-    $shippingAmount       = 0;
63
-    $commandAmount        = 0;
64
-    $vatAmount            = 0;
65
-    $goOn                 = '';
66
-    $commandAmountTTC     = 0;
67
-    $discountsDescription = array();
68
-
69
-    $h_bookshop_caddy->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription);
70
-    $dec = bookshop_getmoduleoption('decimals_count');
71
-
72
-    $xoopsTpl->assign('emptyCart', $emptyCart);                                            // Empty shopping cart??
73
-    $xoopsTpl->assign('caddieProducts', $cartForTemplate);                                //  Products in the cart
74
-    $xoopsTpl->assign('shippingAmount', sprintf('%0.' . $dec . 'f', $shippingAmount));        // Shipping Cost
75
-    $xoopsTpl->assign('commandAmount', sprintf('%0.' . $dec . 'f', $commandAmount));        // Net amount of the order
76
-    $xoopsTpl->assign('vatAmount', sprintf('%0.' . $dec . 'f', $vatAmount));                // Amount of VAT
77
-    $xoopsTpl->assign('goOn', $goOn);                                                    // Address use to continue its purchases
78
-    $xoopsTpl->assign('commandAmountTTC', sprintf('%0.' . $dec . 'f', $commandAmountTTC));    // Amount of tax control
79
-    $xoopsTpl->assign('discountsDescription', $discountsDescription);                    // List of discounts granted
59
+	global $xoopsTpl, $h_bookshop_caddy;
60
+	$cartForTemplate      = array();
61
+	$emptyCart            = false;
62
+	$shippingAmount       = 0;
63
+	$commandAmount        = 0;
64
+	$vatAmount            = 0;
65
+	$goOn                 = '';
66
+	$commandAmountTTC     = 0;
67
+	$discountsDescription = array();
68
+
69
+	$h_bookshop_caddy->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription);
70
+	$dec = bookshop_getmoduleoption('decimals_count');
71
+
72
+	$xoopsTpl->assign('emptyCart', $emptyCart);                                            // Empty shopping cart??
73
+	$xoopsTpl->assign('caddieProducts', $cartForTemplate);                                //  Products in the cart
74
+	$xoopsTpl->assign('shippingAmount', sprintf('%0.' . $dec . 'f', $shippingAmount));        // Shipping Cost
75
+	$xoopsTpl->assign('commandAmount', sprintf('%0.' . $dec . 'f', $commandAmount));        // Net amount of the order
76
+	$xoopsTpl->assign('vatAmount', sprintf('%0.' . $dec . 'f', $vatAmount));                // Amount of VAT
77
+	$xoopsTpl->assign('goOn', $goOn);                                                    // Address use to continue its purchases
78
+	$xoopsTpl->assign('commandAmountTTC', sprintf('%0.' . $dec . 'f', $commandAmountTTC));    // Amount of tax control
79
+	$xoopsTpl->assign('discountsDescription', $discountsDescription);                    // List of discounts granted
80 80
 }
81 81
 
82 82
 // ********************************************************************************************************************
83 83
 // ********************************************************************************************************************
84 84
 // ********************************************************************************************************************
85 85
 switch ($op) {
86
-    // ****************************************************************************************************************
87
-    case 'update':    // Update quantities
88
-        // ****************************************************************************************************************
89
-        $h_bookshop_caddy->updateQuantites();
90
-        listCaddie();
91
-        break;
92
-
93
-    // ****************************************************************************************************************
94
-    case 'delete':    // Delete an item
95
-        // ****************************************************************************************************************
96
-        $book_id--;
97
-        $h_bookshop_caddy->deleteProduct($book_id);
98
-        listCaddie();
99
-        break;
100
-
101
-    // ****************************************************************************************************************
102
-    case 'addbook':    // Add  a book
103
-        // ****************************************************************************************************************
104
-        if ($book_id == 0) {
105
-            bookshop_redirect(_BOOKSHOP_ERROR9, 'index.php', 4);
106
-        }
107
-
108
-        $book = null;
109
-        $book = $h_bookshop_books->get($book_id);
110
-        if (!is_object($book)) {
111
-            bookshop_redirect(_BOOKSHOP_ERROR9, 'index.php', 4);
112
-        }
113
-        if ($book->getVar('book_online') == 0) {
114
-            bookshop_redirect(_BOOKSHOP_ERROR2, 'index.php', 4);
115
-        }
116
-
117
-        if ($book->getVar('book_stock') - 1 >= 0) {
118
-            $h_bookshop_caddy->addProduct($book_id, 1);
119
-            $url = BOOKSHOP_URL . 'caddy.php';
120
-            header("Location: $url");
121
-        } else {
122
-            bookshop_redirect(_BOOKSHOP_PROBLEM_QTY, 'index.php', 5);    // Plus de stock !
123
-        }
124
-        listCaddie();
125
-        break;
126
-
127
-    // ****************************************************************************************************************
128
-    case 'empty':    // Empty content of the shopping cart
129
-        // ****************************************************************************************************************
130
-        $h_bookshop_caddy->emptyCart();
131
-        listCaddie();
132
-        break;
133
-
134
-    // ****************************************************************************************************************
135
-    case 'default':    // Default Action
136
-        // ****************************************************************************************************************
137
-        listCaddie();
138
-        break;
86
+	// ****************************************************************************************************************
87
+	case 'update':    // Update quantities
88
+		// ****************************************************************************************************************
89
+		$h_bookshop_caddy->updateQuantites();
90
+		listCaddie();
91
+		break;
92
+
93
+	// ****************************************************************************************************************
94
+	case 'delete':    // Delete an item
95
+		// ****************************************************************************************************************
96
+		$book_id--;
97
+		$h_bookshop_caddy->deleteProduct($book_id);
98
+		listCaddie();
99
+		break;
100
+
101
+	// ****************************************************************************************************************
102
+	case 'addbook':    // Add  a book
103
+		// ****************************************************************************************************************
104
+		if ($book_id == 0) {
105
+			bookshop_redirect(_BOOKSHOP_ERROR9, 'index.php', 4);
106
+		}
107
+
108
+		$book = null;
109
+		$book = $h_bookshop_books->get($book_id);
110
+		if (!is_object($book)) {
111
+			bookshop_redirect(_BOOKSHOP_ERROR9, 'index.php', 4);
112
+		}
113
+		if ($book->getVar('book_online') == 0) {
114
+			bookshop_redirect(_BOOKSHOP_ERROR2, 'index.php', 4);
115
+		}
116
+
117
+		if ($book->getVar('book_stock') - 1 >= 0) {
118
+			$h_bookshop_caddy->addProduct($book_id, 1);
119
+			$url = BOOKSHOP_URL . 'caddy.php';
120
+			header("Location: $url");
121
+		} else {
122
+			bookshop_redirect(_BOOKSHOP_PROBLEM_QTY, 'index.php', 5);    // Plus de stock !
123
+		}
124
+		listCaddie();
125
+		break;
126
+
127
+	// ****************************************************************************************************************
128
+	case 'empty':    // Empty content of the shopping cart
129
+		// ****************************************************************************************************************
130
+		$h_bookshop_caddy->emptyCart();
131
+		listCaddie();
132
+		break;
133
+
134
+	// ****************************************************************************************************************
135
+	case 'default':    // Default Action
136
+		// ****************************************************************************************************************
137
+		listCaddie();
138
+		break;
139 139
 }
140 140
 
141 141
 bookshop_setCSS();
142 142
 if (file_exists(BOOKSHOP_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php')) {
143
-    include_once BOOKSHOP_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php';
143
+	include_once BOOKSHOP_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php';
144 144
 } else {
145
-    include_once BOOKSHOP_PATH . 'language/english/modinfo.php';
145
+	include_once BOOKSHOP_PATH . 'language/english/modinfo.php';
146 146
 }
147 147
 
148 148
 $title = _MI_BOOKSHOP_SMNAME1 . ' - ' . bookshop_get_module_name();
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 /**
27 27
  * Affichage et gestion du caddy
28 28
  */
29
-include __DIR__ . '/header.php';
29
+include __DIR__.'/header.php';
30 30
 $GLOBALS['current_category']  = -1;
31 31
 $xoopsOption['template_main'] = 'bookshop_caddy.tpl';
32
-include_once XOOPS_ROOT_PATH . '/header.php';
32
+include_once XOOPS_ROOT_PATH.'/header.php';
33 33
 
34
-$xoopsTpl->assign('mod_pref', $mod_pref);    // Module Preferences
34
+$xoopsTpl->assign('mod_pref', $mod_pref); // Module Preferences
35 35
 
36 36
 $op = 'default';
37 37
 if (isset($_POST['op'])) {
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
     $h_bookshop_caddy->computeCart($cartForTemplate, $emptyCart, $shippingAmount, $commandAmount, $vatAmount, $goOn, $commandAmountTTC, $discountsDescription);
70 70
     $dec = bookshop_getmoduleoption('decimals_count');
71 71
 
72
-    $xoopsTpl->assign('emptyCart', $emptyCart);                                            // Empty shopping cart??
73
-    $xoopsTpl->assign('caddieProducts', $cartForTemplate);                                //  Products in the cart
74
-    $xoopsTpl->assign('shippingAmount', sprintf('%0.' . $dec . 'f', $shippingAmount));        // Shipping Cost
75
-    $xoopsTpl->assign('commandAmount', sprintf('%0.' . $dec . 'f', $commandAmount));        // Net amount of the order
76
-    $xoopsTpl->assign('vatAmount', sprintf('%0.' . $dec . 'f', $vatAmount));                // Amount of VAT
77
-    $xoopsTpl->assign('goOn', $goOn);                                                    // Address use to continue its purchases
78
-    $xoopsTpl->assign('commandAmountTTC', sprintf('%0.' . $dec . 'f', $commandAmountTTC));    // Amount of tax control
79
-    $xoopsTpl->assign('discountsDescription', $discountsDescription);                    // List of discounts granted
72
+    $xoopsTpl->assign('emptyCart', $emptyCart); // Empty shopping cart??
73
+    $xoopsTpl->assign('caddieProducts', $cartForTemplate); //  Products in the cart
74
+    $xoopsTpl->assign('shippingAmount', sprintf('%0.'.$dec.'f', $shippingAmount)); // Shipping Cost
75
+    $xoopsTpl->assign('commandAmount', sprintf('%0.'.$dec.'f', $commandAmount)); // Net amount of the order
76
+    $xoopsTpl->assign('vatAmount', sprintf('%0.'.$dec.'f', $vatAmount)); // Amount of VAT
77
+    $xoopsTpl->assign('goOn', $goOn); // Address use to continue its purchases
78
+    $xoopsTpl->assign('commandAmountTTC', sprintf('%0.'.$dec.'f', $commandAmountTTC)); // Amount of tax control
79
+    $xoopsTpl->assign('discountsDescription', $discountsDescription); // List of discounts granted
80 80
 }
81 81
 
82 82
 // ********************************************************************************************************************
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 
117 117
         if ($book->getVar('book_stock') - 1 >= 0) {
118 118
             $h_bookshop_caddy->addProduct($book_id, 1);
119
-            $url = BOOKSHOP_URL . 'caddy.php';
119
+            $url = BOOKSHOP_URL.'caddy.php';
120 120
             header("Location: $url");
121 121
         } else {
122
-            bookshop_redirect(_BOOKSHOP_PROBLEM_QTY, 'index.php', 5);    // Plus de stock !
122
+            bookshop_redirect(_BOOKSHOP_PROBLEM_QTY, 'index.php', 5); // Plus de stock !
123 123
         }
124 124
         listCaddie();
125 125
         break;
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 }
140 140
 
141 141
 bookshop_setCSS();
142
-if (file_exists(BOOKSHOP_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php')) {
143
-    include_once BOOKSHOP_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php';
142
+if (file_exists(BOOKSHOP_PATH.'language/'.$xoopsConfig['language'].'/modinfo.php')) {
143
+    include_once BOOKSHOP_PATH.'language/'.$xoopsConfig['language'].'/modinfo.php';
144 144
 } else {
145
-    include_once BOOKSHOP_PATH . 'language/english/modinfo.php';
145
+    include_once BOOKSHOP_PATH.'language/english/modinfo.php';
146 146
 }
147 147
 
148
-$title = _MI_BOOKSHOP_SMNAME1 . ' - ' . bookshop_get_module_name();
148
+$title = _MI_BOOKSHOP_SMNAME1.' - '.bookshop_get_module_name();
149 149
 bookshop_set_metas($title, $title);
150
-include_once XOOPS_ROOT_PATH . '/footer.php';
150
+include_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
class/bookshop_books.php 2 patches
Indentation   +556 added lines, -556 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 include_once XOOPS_ROOT_PATH . '/kernel/object.php';
30 30
 if (!class_exists('Bookshop_XoopsPersistableObjectHandler')) {
31
-    include_once XOOPS_ROOT_PATH . '/modules/bookshop/class/PersistableObjectHandler.php';
31
+	include_once XOOPS_ROOT_PATH . '/modules/bookshop/class/PersistableObjectHandler.php';
32 32
 }
33 33
 
34 34
 /**
@@ -36,111 +36,111 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class bookshop_books extends Bookshop_Object
38 38
 {
39
-    public function __construct()
40
-    {
41
-        $this->initVar('book_id', XOBJ_DTYPE_INT, null, false);
42
-        $this->initVar('book_cid', XOBJ_DTYPE_INT, null, false);
43
-        $this->initVar('book_title', XOBJ_DTYPE_TXTBOX, null, false);
44
-        $this->initVar('book_lang_id', XOBJ_DTYPE_INT, null, false);
45
-        $this->initVar('book_number', XOBJ_DTYPE_TXTBOX, null, false);
46
-        $this->initVar('book_tome', XOBJ_DTYPE_TXTBOX, null, false);
47
-        $this->initVar('book_format', XOBJ_DTYPE_TXTBOX, null, false);
48
-        $this->initVar('book_url', XOBJ_DTYPE_TXTBOX, null, false);
49
-        $this->initVar('book_image_url', XOBJ_DTYPE_TXTBOX, null, false);
50
-        $this->initVar('book_thumb_url', XOBJ_DTYPE_TXTBOX, null, false);
51
-        $this->initVar('book_submitter', XOBJ_DTYPE_INT, null, false);
52
-        $this->initVar('book_online', XOBJ_DTYPE_INT, null, false);
53
-        $this->initVar('book_date', XOBJ_DTYPE_TXTBOX, null, false);
54
-        $this->initVar('book_submitted', XOBJ_DTYPE_INT, null, false);
55
-        $this->initVar('book_hits', XOBJ_DTYPE_INT, null, false);
56
-        $this->initVar('book_rating', XOBJ_DTYPE_INT, null, false);
57
-        $this->initVar('book_votes', XOBJ_DTYPE_INT, null, false);
58
-        $this->initVar('book_comments', XOBJ_DTYPE_INT, null, false);
59
-        $this->initVar('book_price', XOBJ_DTYPE_TXTBOX, null, false);
60
-        $this->initVar('book_shipping_price', XOBJ_DTYPE_TXTBOX, null, false);
61
-        $this->initVar('book_discount_price', XOBJ_DTYPE_TXTBOX, null, false);
62
-        $this->initVar('book_stock', XOBJ_DTYPE_INT, null, false);
63
-        $this->initVar('book_alert_stock', XOBJ_DTYPE_INT, null, false);
64
-        $this->initVar('book_summary', XOBJ_DTYPE_TXTAREA, null, false);
65
-        $this->initVar('book_description', XOBJ_DTYPE_TXTAREA, null, false);
66
-        $this->initVar('book_attachment', XOBJ_DTYPE_TXTBOX, null, false);
67
-        $this->initVar('book_isbn', XOBJ_DTYPE_TXTBOX, null, false);
68
-        $this->initVar('book_ean', XOBJ_DTYPE_TXTBOX, null, false);
69
-        $this->initVar('book_vat_id', XOBJ_DTYPE_INT, null, false);
70
-        $this->initVar('book_pages', XOBJ_DTYPE_INT, null, false);
71
-        $this->initVar('book_pages_collection', XOBJ_DTYPE_INT, null, false);
72
-        $this->initVar('book_volumes_count', XOBJ_DTYPE_INT, null, false);
73
-        $this->initVar('book_recommended', XOBJ_DTYPE_TXTBOX, null, false);
74
-        $this->initVar('book_metakeywords', XOBJ_DTYPE_TXTBOX, null, false);
75
-        $this->initVar('book_metadescription', XOBJ_DTYPE_TXTBOX, null, false);
76
-        $this->initVar('book_metatitle', XOBJ_DTYPE_TXTBOX, null, false);
77
-        // Pour autoriser le html
78
-        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
79
-    }
80
-
81
-    /**
39
+	public function __construct()
40
+	{
41
+		$this->initVar('book_id', XOBJ_DTYPE_INT, null, false);
42
+		$this->initVar('book_cid', XOBJ_DTYPE_INT, null, false);
43
+		$this->initVar('book_title', XOBJ_DTYPE_TXTBOX, null, false);
44
+		$this->initVar('book_lang_id', XOBJ_DTYPE_INT, null, false);
45
+		$this->initVar('book_number', XOBJ_DTYPE_TXTBOX, null, false);
46
+		$this->initVar('book_tome', XOBJ_DTYPE_TXTBOX, null, false);
47
+		$this->initVar('book_format', XOBJ_DTYPE_TXTBOX, null, false);
48
+		$this->initVar('book_url', XOBJ_DTYPE_TXTBOX, null, false);
49
+		$this->initVar('book_image_url', XOBJ_DTYPE_TXTBOX, null, false);
50
+		$this->initVar('book_thumb_url', XOBJ_DTYPE_TXTBOX, null, false);
51
+		$this->initVar('book_submitter', XOBJ_DTYPE_INT, null, false);
52
+		$this->initVar('book_online', XOBJ_DTYPE_INT, null, false);
53
+		$this->initVar('book_date', XOBJ_DTYPE_TXTBOX, null, false);
54
+		$this->initVar('book_submitted', XOBJ_DTYPE_INT, null, false);
55
+		$this->initVar('book_hits', XOBJ_DTYPE_INT, null, false);
56
+		$this->initVar('book_rating', XOBJ_DTYPE_INT, null, false);
57
+		$this->initVar('book_votes', XOBJ_DTYPE_INT, null, false);
58
+		$this->initVar('book_comments', XOBJ_DTYPE_INT, null, false);
59
+		$this->initVar('book_price', XOBJ_DTYPE_TXTBOX, null, false);
60
+		$this->initVar('book_shipping_price', XOBJ_DTYPE_TXTBOX, null, false);
61
+		$this->initVar('book_discount_price', XOBJ_DTYPE_TXTBOX, null, false);
62
+		$this->initVar('book_stock', XOBJ_DTYPE_INT, null, false);
63
+		$this->initVar('book_alert_stock', XOBJ_DTYPE_INT, null, false);
64
+		$this->initVar('book_summary', XOBJ_DTYPE_TXTAREA, null, false);
65
+		$this->initVar('book_description', XOBJ_DTYPE_TXTAREA, null, false);
66
+		$this->initVar('book_attachment', XOBJ_DTYPE_TXTBOX, null, false);
67
+		$this->initVar('book_isbn', XOBJ_DTYPE_TXTBOX, null, false);
68
+		$this->initVar('book_ean', XOBJ_DTYPE_TXTBOX, null, false);
69
+		$this->initVar('book_vat_id', XOBJ_DTYPE_INT, null, false);
70
+		$this->initVar('book_pages', XOBJ_DTYPE_INT, null, false);
71
+		$this->initVar('book_pages_collection', XOBJ_DTYPE_INT, null, false);
72
+		$this->initVar('book_volumes_count', XOBJ_DTYPE_INT, null, false);
73
+		$this->initVar('book_recommended', XOBJ_DTYPE_TXTBOX, null, false);
74
+		$this->initVar('book_metakeywords', XOBJ_DTYPE_TXTBOX, null, false);
75
+		$this->initVar('book_metadescription', XOBJ_DTYPE_TXTBOX, null, false);
76
+		$this->initVar('book_metatitle', XOBJ_DTYPE_TXTBOX, null, false);
77
+		// Pour autoriser le html
78
+		$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
79
+	}
80
+
81
+	/**
82 82
 	 * Indique si le livre courant est recommandé.
83
-     *
84
-     * @param bool $withDescription
85
-     *
86
-     * @return bool|string
87
-     */
88
-    public function isRecommended($withDescription = false)
89
-    {
90
-        if ($this->getVar('book_recommended') != '0000-00-00') {
91
-            return $withDescription ? _YES : true;
92
-        } else {
93
-            return $withDescription ? _NO : false;
94
-        }
95
-    }
96
-
97
-    /**
83
+	 *
84
+	 * @param bool $withDescription
85
+	 *
86
+	 * @return bool|string
87
+	 */
88
+	public function isRecommended($withDescription = false)
89
+	{
90
+		if ($this->getVar('book_recommended') != '0000-00-00') {
91
+			return $withDescription ? _YES : true;
92
+		} else {
93
+			return $withDescription ? _NO : false;
94
+		}
95
+	}
96
+
97
+	/**
98 98
 	 * Place le livre courant dans l'état "recommandé"
99
-     */
100
-    public function setRecommended()
101
-    {
102
-        $this->setVar('book_recommended', date('Y-m-d'));
103
-    }
99
+	 */
100
+	public function setRecommended()
101
+	{
102
+		$this->setVar('book_recommended', date('Y-m-d'));
103
+	}
104 104
 
105
-    /**
105
+	/**
106 106
 	 * Enlève "l'attribut" recommandé d'un livre
107
-     */
108
-    public function unsetRecommended()
109
-    {
110
-        $this->setVar('book_recommended', '0000-00-00');
111
-    }
107
+	 */
108
+	public function unsetRecommended()
109
+	{
110
+		$this->setVar('book_recommended', '0000-00-00');
111
+	}
112 112
 
113
-    /**
113
+	/**
114 114
 	 * Renvoie l'image qui indique si le livre est recommandé ou pas.
115
-     */
116
-    public function recommendedPicture()
117
-    {
118
-        if ($this->isRecommended()) {
119
-            return "<img src='" . BOOKSHOP_IMAGES_URL . "heart.png' alt='" . _BOOKSHOP_IS_RECOMMENDED . "' />&nbsp;";
120
-        } else {
121
-            return "<img src='" . BOOKSHOP_IMAGES_URL . "blank.gif' alt='' />";
122
-        }
123
-    }
124
-
125
-    /**
126
-     * @param string $format
127
-     *
128
-     * @return array
129
-     */
130
-    public function toArray($format = 's')
131
-    {
132
-        $ret = array();
133
-        foreach ($this->vars as $k => $v) {
134
-            $ret[$k] = $this->getVar($k, $format);
135
-        }
136
-        $ret['book_tooltip']             = bookshop_make_infotips($this->getVar('book_description'));
137
-        $ret['book_url_rewrited']        = BookshopBookshop_booksHandler::GetBookLink($this->getVar('book_id'), $this->getVar('book_title'));
138
-        $ret['book_href_title']          = bookshop_makeHrefTitle($this->getVar('book_title'));
139
-        $ret['book_recommended']         = $this->isRecommended();
140
-        $ret['book_recommended_picture'] = $this->recommendedPicture();
141
-
142
-        return $ret;
143
-    }
115
+	 */
116
+	public function recommendedPicture()
117
+	{
118
+		if ($this->isRecommended()) {
119
+			return "<img src='" . BOOKSHOP_IMAGES_URL . "heart.png' alt='" . _BOOKSHOP_IS_RECOMMENDED . "' />&nbsp;";
120
+		} else {
121
+			return "<img src='" . BOOKSHOP_IMAGES_URL . "blank.gif' alt='' />";
122
+		}
123
+	}
124
+
125
+	/**
126
+	 * @param string $format
127
+	 *
128
+	 * @return array
129
+	 */
130
+	public function toArray($format = 's')
131
+	{
132
+		$ret = array();
133
+		foreach ($this->vars as $k => $v) {
134
+			$ret[$k] = $this->getVar($k, $format);
135
+		}
136
+		$ret['book_tooltip']             = bookshop_make_infotips($this->getVar('book_description'));
137
+		$ret['book_url_rewrited']        = BookshopBookshop_booksHandler::GetBookLink($this->getVar('book_id'), $this->getVar('book_title'));
138
+		$ret['book_href_title']          = bookshop_makeHrefTitle($this->getVar('book_title'));
139
+		$ret['book_recommended']         = $this->isRecommended();
140
+		$ret['book_recommended_picture'] = $this->recommendedPicture();
141
+
142
+		return $ret;
143
+	}
144 144
 }
145 145
 
146 146
 /**
@@ -148,529 +148,529 @@  discard block
 block discarded – undo
148 148
  */
149 149
 class BookshopBookshop_booksHandler extends Bookshop_XoopsPersistableObjectHandler
150 150
 {
151
-    /**
152
-     * @param $db
153
-     */
154
-    public function __construct($db)
155
-    {    //                                             Table               Classe           Id
156
-        parent::__construct($db, 'bookshop_books', 'bookshop_books', 'book_id');
157
-    }
158
-
159
-    /**
160
-     * Renvoie la liste des x livres les plus vus par les visiteurs
161
-     *
151
+	/**
152
+	 * @param $db
153
+	 */
154
+	public function __construct($db)
155
+	{    //                                             Table               Classe           Id
156
+		parent::__construct($db, 'bookshop_books', 'bookshop_books', 'book_id');
157
+	}
158
+
159
+	/**
160
+	 * Renvoie la liste des x livres les plus vus par les visiteurs
161
+	 *
162 162
 	 * @param integer $start		Début des données
163 163
 	 * @param integer $limit		Nombre maximum d'enregistrements à renvoyer
164 164
 	 * @param integer $category Identifiant de la catégorie (évenutellement)
165
-     * @return array   Tableau de livres (sous la forme d'objets)
166
-     */
167
-    public function getMostViewedBooks($start = 0, $limit = 0, $category = 0)
168
-    {
169
-        $tbl_datas = array();
170
-        $criteria  = new CriteriaCompo();
171
-        $criteria->add(new Criteria('book_online', 1, '='));
165
+	 * @return array   Tableau de livres (sous la forme d'objets)
166
+	 */
167
+	public function getMostViewedBooks($start = 0, $limit = 0, $category = 0)
168
+	{
169
+		$tbl_datas = array();
170
+		$criteria  = new CriteriaCompo();
171
+		$criteria->add(new Criteria('book_online', 1, '='));
172 172
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
173
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
174
-        }
175
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
176
-            $criteria->add(new Criteria('book_stock', 0, '>'));
177
-        }
178
-        if (is_array($category)) {
179
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
180
-        } elseif ($category != 0) {
181
-            $criteria->add(new Criteria('book_cid', (int)$category, '='));
182
-        }
173
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
174
+		}
175
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
176
+			$criteria->add(new Criteria('book_stock', 0, '>'));
177
+		}
178
+		if (is_array($category)) {
179
+			$criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
180
+		} elseif ($category != 0) {
181
+			$criteria->add(new Criteria('book_cid', (int)$category, '='));
182
+		}
183 183
 		// On se limite aux livres qui ont été vraiment vus !
184
-        $criteria->add(new Criteria('book_hits', 0, '>'));
185
-        $criteria->setLimit($limit);
186
-        $criteria->setStart($start);
187
-        $criteria->setSort('book_hits');
188
-        $criteria->setOrder('DESC');
189
-        $tbl_datas =& $this->getObjects($criteria, true);
184
+		$criteria->add(new Criteria('book_hits', 0, '>'));
185
+		$criteria->setLimit($limit);
186
+		$criteria->setStart($start);
187
+		$criteria->setSort('book_hits');
188
+		$criteria->setOrder('DESC');
189
+		$tbl_datas =& $this->getObjects($criteria, true);
190 190
 
191
-        return $tbl_datas;
192
-    }
191
+		return $tbl_datas;
192
+	}
193 193
 
194
-    /**
194
+	/**
195 195
 	 * Renvoie la liste des x livres les mieux notés par les visiteurs
196
-     *
196
+	 *
197 197
 	 * @param integer $start		Début des données
198 198
 	 * @param integer $limit		Nombre maximum d'enregistrements à renvoyer
199 199
 	 * @param integer $category Identifiant de la catégorie (évenutellement)
200
-     * @return array   Tableau de livres (sous la forme d'objets)
201
-     */
202
-    public function getBestRatedBooks($start = 0, $limit = 0, $category = 0)
203
-    {
204
-        $tbl_datas = array();
205
-        $criteria  = new CriteriaCompo();
206
-        $criteria->add(new Criteria('book_online', 1, '='));
200
+	 * @return array   Tableau de livres (sous la forme d'objets)
201
+	 */
202
+	public function getBestRatedBooks($start = 0, $limit = 0, $category = 0)
203
+	{
204
+		$tbl_datas = array();
205
+		$criteria  = new CriteriaCompo();
206
+		$criteria->add(new Criteria('book_online', 1, '='));
207 207
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
208
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
209
-        }
210
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
211
-            $criteria->add(new Criteria('book_stock', 0, '>'));
212
-        }
213
-        if (is_array($category)) {
214
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
215
-        } elseif ($category != 0) {
216
-            $criteria->add(new Criteria('book_cid', (int)$category, '='));
217
-        }
218
-        $criteria->setLimit($limit);
219
-        $criteria->setStart($start);
220
-        $criteria->setSort('book_rating');
221
-        $criteria->setOrder('DESC');
222
-        $tbl_datas =& $this->getObjects($criteria, true);
223
-
224
-        return $tbl_datas;
225
-    }
226
-
227
-    /**
208
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
209
+		}
210
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
211
+			$criteria->add(new Criteria('book_stock', 0, '>'));
212
+		}
213
+		if (is_array($category)) {
214
+			$criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
215
+		} elseif ($category != 0) {
216
+			$criteria->add(new Criteria('book_cid', (int)$category, '='));
217
+		}
218
+		$criteria->setLimit($limit);
219
+		$criteria->setStart($start);
220
+		$criteria->setSort('book_rating');
221
+		$criteria->setOrder('DESC');
222
+		$tbl_datas =& $this->getObjects($criteria, true);
223
+
224
+		return $tbl_datas;
225
+	}
226
+
227
+	/**
228 228
 	 * Renvoie la liste des x derniers livres recommandés
229
-     *
229
+	 *
230 230
 	 * @param integer $start		Indice de départ
231 231
 	 * @param integer $limit		Nombre maximum d'enregistrements à renvoyer
232 232
 	 * @param integer $category Identifiant de la catégorie (évenutellement)
233
-     * @return array   Tableau de livres (sous la forme d'objets)
234
-     */
235
-    public function getRecentRecommendedBooks($start = 0, $limit = 0, $category = 0)
236
-    {
237
-        $tbl_datas = array();
238
-        $criteria  = new CriteriaCompo();
239
-        $criteria->add(new Criteria('book_online', 1, '='));
240
-        $criteria->add(new Criteria('book_recommended', '0000-00-00', '<>'));
233
+	 * @return array   Tableau de livres (sous la forme d'objets)
234
+	 */
235
+	public function getRecentRecommendedBooks($start = 0, $limit = 0, $category = 0)
236
+	{
237
+		$tbl_datas = array();
238
+		$criteria  = new CriteriaCompo();
239
+		$criteria->add(new Criteria('book_online', 1, '='));
240
+		$criteria->add(new Criteria('book_recommended', '0000-00-00', '<>'));
241 241
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
242
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
243
-        }
244
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
245
-            $criteria->add(new Criteria('book_stock', 0, '>'));
246
-        }
247
-        if (is_array($category)) {
248
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
249
-        } elseif ($category != 0) {
250
-            $criteria->add(new Criteria('book_cid', (int)$category, '='));
251
-        }
252
-        $criteria->setLimit($limit);
253
-        $criteria->setStart($start);
254
-        $criteria->setSort('book_recommended');
255
-        $criteria->setOrder('DESC');
256
-        $tbl_datas =& $this->getObjects($criteria, true);
257
-
258
-        return $tbl_datas;
259
-    }
260
-
261
-    /**
242
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
243
+		}
244
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
245
+			$criteria->add(new Criteria('book_stock', 0, '>'));
246
+		}
247
+		if (is_array($category)) {
248
+			$criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
249
+		} elseif ($category != 0) {
250
+			$criteria->add(new Criteria('book_cid', (int)$category, '='));
251
+		}
252
+		$criteria->setLimit($limit);
253
+		$criteria->setStart($start);
254
+		$criteria->setSort('book_recommended');
255
+		$criteria->setOrder('DESC');
256
+		$tbl_datas =& $this->getObjects($criteria, true);
257
+
258
+		return $tbl_datas;
259
+	}
260
+
261
+	/**
262 262
 	 * Renvoie le nombre total de livres recommandés
263
-     *
263
+	 *
264 264
 	 * @return integer Le nombre total de livres recommandés
265
-     */
266
-    public function getRecommendedCount()
267
-    {
268
-        $criteria = new CriteriaCompo();
269
-        $criteria->add(new Criteria('book_online', 1, '='));
270
-        $criteria->add(new Criteria('book_recommended', '0000-00-00', '<>'));
265
+	 */
266
+	public function getRecommendedCount()
267
+	{
268
+		$criteria = new CriteriaCompo();
269
+		$criteria->add(new Criteria('book_online', 1, '='));
270
+		$criteria->add(new Criteria('book_recommended', '0000-00-00', '<>'));
271 271
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
272
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
273
-        }
274
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
275
-            $criteria->add(new Criteria('book_stock', 0, '>'));
276
-        }
272
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
273
+		}
274
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
275
+			$criteria->add(new Criteria('book_stock', 0, '>'));
276
+		}
277 277
 
278
-        return $this->getCount($criteria);
279
-    }
278
+		return $this->getCount($criteria);
279
+	}
280 280
 
281
-    /**
281
+	/**
282 282
 	 * Renvoie la liste des x derniers livres parus toutes catégories confondues ou dans une catégorie spécifique
283
-     *
283
+	 *
284 284
 	 * @param integer $start		Début des données
285 285
 	 * @param integer $limit		Nombre maximum d'enregistrements à renvoyer
286 286
 	 * @param integer $category Identifiant de la catégorie (évenutellement)
287
-     * @param  string  $sortField
288
-     * @return array   Tableau de livres (sous la forme d'objets)
289
-     */
290
-    public function getRecentBooks($start = 0, $limit = 0, $category = 0, $sortField = 'book_submitted DESC, book_title')
291
-    {
292
-        $tbl_datas = array();
293
-        $criteria  = new CriteriaCompo();
294
-        $criteria->add(new Criteria('book_online', 1, '='));
287
+	 * @param  string  $sortField
288
+	 * @return array   Tableau de livres (sous la forme d'objets)
289
+	 */
290
+	public function getRecentBooks($start = 0, $limit = 0, $category = 0, $sortField = 'book_submitted DESC, book_title')
291
+	{
292
+		$tbl_datas = array();
293
+		$criteria  = new CriteriaCompo();
294
+		$criteria->add(new Criteria('book_online', 1, '='));
295 295
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
296
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
297
-        }
298
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
299
-            $criteria->add(new Criteria('book_stock', 0, '>'));
300
-        }
301
-        if (is_array($category)) {
302
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
303
-        } elseif ($category > 0) {
304
-            $criteria->add(new Criteria('book_cid', (int)$category, '='));
305
-        }
306
-        $criteria->setLimit($limit);
307
-        $criteria->setStart($start);
308
-        $criteria->setSort($sortField);
309
-        $tbl_datas =& $this->getObjects($criteria, true);
310
-
311
-        return $tbl_datas;
312
-    }
313
-
314
-    /**
315
-     * @param     $startingDate
316
-     * @param     $endingDate
317
-     * @param int $category
318
-     * @param int $start
319
-     * @param int $limit
320
-     *
321
-     * @return array
322
-     */
323
-    public function getBooksForNewsletter($startingDate, $endingDate, $category = 0, $start = 0, $limit = 0)
324
-    {
325
-        $tblDatas = array();
326
-        $criteria = new CriteriaCompo();
327
-        $criteria->add(new Criteria('book_online', 1, '='));
328
-        $criteria->add(new Criteria('book_submitted', $startingDate, '>='));
329
-        $criteria->add(new Criteria('book_submitted', $endingDate, '<='));
296
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
297
+		}
298
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
299
+			$criteria->add(new Criteria('book_stock', 0, '>'));
300
+		}
301
+		if (is_array($category)) {
302
+			$criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
303
+		} elseif ($category > 0) {
304
+			$criteria->add(new Criteria('book_cid', (int)$category, '='));
305
+		}
306
+		$criteria->setLimit($limit);
307
+		$criteria->setStart($start);
308
+		$criteria->setSort($sortField);
309
+		$tbl_datas =& $this->getObjects($criteria, true);
310
+
311
+		return $tbl_datas;
312
+	}
313
+
314
+	/**
315
+	 * @param     $startingDate
316
+	 * @param     $endingDate
317
+	 * @param int $category
318
+	 * @param int $start
319
+	 * @param int $limit
320
+	 *
321
+	 * @return array
322
+	 */
323
+	public function getBooksForNewsletter($startingDate, $endingDate, $category = 0, $start = 0, $limit = 0)
324
+	{
325
+		$tblDatas = array();
326
+		$criteria = new CriteriaCompo();
327
+		$criteria->add(new Criteria('book_online', 1, '='));
328
+		$criteria->add(new Criteria('book_submitted', $startingDate, '>='));
329
+		$criteria->add(new Criteria('book_submitted', $endingDate, '<='));
330 330
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
331
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
332
-        }
333
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
334
-            $criteria->add(new Criteria('book_stock', 0, '>'));
335
-        }
336
-        if (is_array($category)) {
337
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
338
-        } elseif ($category > 0) {
339
-            $criteria->add(new Criteria('book_cid', (int)$category, '='));
340
-        }
341
-        $criteria->setLimit($limit);
342
-        $criteria->setStart($start);
343
-        $criteria->setSort('book_title');
344
-        $tblDatas =& $this->getObjects($criteria, true);
345
-
346
-        return $tblDatas;
347
-    }
348
-
349
-    /**
331
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
332
+		}
333
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
334
+			$criteria->add(new Criteria('book_stock', 0, '>'));
335
+		}
336
+		if (is_array($category)) {
337
+			$criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
338
+		} elseif ($category > 0) {
339
+			$criteria->add(new Criteria('book_cid', (int)$category, '='));
340
+		}
341
+		$criteria->setLimit($limit);
342
+		$criteria->setStart($start);
343
+		$criteria->setSort('book_title');
344
+		$tblDatas =& $this->getObjects($criteria, true);
345
+
346
+		return $tblDatas;
347
+	}
348
+
349
+	/**
350 350
 	 * Renvoie le nombre total de livres publiés dans la base en tenant compte des préférences du module
351
-     *
351
+	 *
352 352
 	 * @param intefer $book_cid Catégorie du livre
353 353
 	 * @return integer Le nombre de livres publiés
354
-     */
355
-    public function getTotalPublishedBooksCount($book_cid = 0)
356
-    {
357
-        $criteria = new CriteriaCompo();
358
-        $criteria->add(new Criteria('book_online', 1, '='));
354
+	 */
355
+	public function getTotalPublishedBooksCount($book_cid = 0)
356
+	{
357
+		$criteria = new CriteriaCompo();
358
+		$criteria->add(new Criteria('book_online', 1, '='));
359 359
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
360
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
361
-        }
362
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
363
-            $criteria->add(new Criteria('book_stock', 0, '>'));
364
-        }
365
-        if ($book_cid > 0) {
366
-            $criteria->add(new Criteria('book_cid', (int)$book_cid, '='));
367
-        }
368
-
369
-        return $this->getCount($criteria);
370
-    }
371
-
372
-    /**
360
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
361
+		}
362
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
363
+			$criteria->add(new Criteria('book_stock', 0, '>'));
364
+		}
365
+		if ($book_cid > 0) {
366
+			$criteria->add(new Criteria('book_cid', (int)$book_cid, '='));
367
+		}
368
+
369
+		return $this->getCount($criteria);
370
+	}
371
+
372
+	/**
373 373
 	 * Récupération de l'ID et du titre d'une série de livres répondants à un critère
374
-     *
374
+	 *
375 375
 	 * @param object $criteria	critère de sélection
376 376
 	 * @return array Tableau dont la clé = ID livre et la valeur le titre du livre
377
-     */
378
-    public function getIdTitle($criteria)
379
-    {
380
-        global $myts;
381
-        $ret = array();
382
-        $sql = 'SELECT book_id, book_title FROM ' . $this->table;
383
-        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
384
-            $sql .= ' ' . $criteria->renderWhere();
385
-            if ($criteria->getSort() != '') {
386
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
387
-            }
388
-            $limit = $criteria->getLimit();
389
-            $start = $criteria->getStart();
390
-        }
391
-        $result = $this->db->query($sql, $limit, $start);
392
-        if (!$result) {
393
-            return $ret;
394
-        }
395
-        while ($myrow = $this->db->fetchArray($result)) {
396
-            $ret[$myrow['book_id']] = $myts->htmlSpecialChars($myrow['book_title']);
397
-        }
398
-
399
-        return $ret;
400
-    }
401
-
402
-    /**
377
+	 */
378
+	public function getIdTitle($criteria)
379
+	{
380
+		global $myts;
381
+		$ret = array();
382
+		$sql = 'SELECT book_id, book_title FROM ' . $this->table;
383
+		if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
384
+			$sql .= ' ' . $criteria->renderWhere();
385
+			if ($criteria->getSort() != '') {
386
+				$sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
387
+			}
388
+			$limit = $criteria->getLimit();
389
+			$start = $criteria->getStart();
390
+		}
391
+		$result = $this->db->query($sql, $limit, $start);
392
+		if (!$result) {
393
+			return $ret;
394
+		}
395
+		while ($myrow = $this->db->fetchArray($result)) {
396
+			$ret[$myrow['book_id']] = $myts->htmlSpecialChars($myrow['book_title']);
397
+		}
398
+
399
+		return $ret;
400
+	}
401
+
402
+	/**
403 403
 	 * Renvoie l'URL à utiliser pour accéder à un livre en tenant compte des préférences du module
404
-     *
405
-     * @param  integer $book_id    Identifiant du livre
406
-     * @param  string  $book_title Titre du livre
407
-     * @return string  L'URL
408
-     */
409
-    public static function GetBookLink($book_id, $book_title)
410
-    {
411
-        $url = '';
412
-        if (bookshop_getmoduleoption('urlrewriting') == 1) {    // On utilise l'url rewriting
413
-            $url = BOOKSHOP_URL . 'book-' . $book_id . bookshop_makeSEOurl($book_title) . '.html';
414
-        } else {    // Pas d'utilisation de l'url rewriting
415
-            $url = BOOKSHOP_URL . 'book.php?book_id=' . $book_id;
416
-        }
417
-
418
-        return $url;
419
-    }
420
-
421
-    /**
404
+	 *
405
+	 * @param  integer $book_id    Identifiant du livre
406
+	 * @param  string  $book_title Titre du livre
407
+	 * @return string  L'URL
408
+	 */
409
+	public static function GetBookLink($book_id, $book_title)
410
+	{
411
+		$url = '';
412
+		if (bookshop_getmoduleoption('urlrewriting') == 1) {    // On utilise l'url rewriting
413
+			$url = BOOKSHOP_URL . 'book-' . $book_id . bookshop_makeSEOurl($book_title) . '.html';
414
+		} else {    // Pas d'utilisation de l'url rewriting
415
+			$url = BOOKSHOP_URL . 'book.php?book_id=' . $book_id;
416
+		}
417
+
418
+		return $url;
419
+	}
420
+
421
+	/**
422 422
 	 * Mise à jour du compteur de lectures du livre
423
-     *
423
+	 *
424 424
 	 * @param integer $book_id L'identifiant du livre dont il faut mettre à jour le compteur de lectures
425 425
 	 * @return boolean Le résultat de la mise à jour
426
-     */
427
-    public function addCounter($book_id)
428
-    {
429
-        $sql = 'UPDATE ' . $this->table . ' SET book_hits = book_hits + 1 WHERE book_id= ' . (int)$book_id;
430
-
431
-        return $this->db->queryF($sql);
432
-    }
433
-
434
-    /**
435
-     * Mise � jour de la notation d'un livre
436
-     *
437
-     * @param  integer $book_id Identifiant du livre
438
-     * @param  float   $rating  la notation
439
-     * @param  integer $votes   Le nombre de votes du livre
426
+	 */
427
+	public function addCounter($book_id)
428
+	{
429
+		$sql = 'UPDATE ' . $this->table . ' SET book_hits = book_hits + 1 WHERE book_id= ' . (int)$book_id;
430
+
431
+		return $this->db->queryF($sql);
432
+	}
433
+
434
+	/**
435
+	 * Mise � jour de la notation d'un livre
436
+	 *
437
+	 * @param  integer $book_id Identifiant du livre
438
+	 * @param  float   $rating  la notation
439
+	 * @param  integer $votes   Le nombre de votes du livre
440 440
 	 * @return boolean Le résultat de la mise à jour
441
-     */
442
-    public function updateRating($book_id, $rating, $votes)
443
-    {
444
-        $sql = 'UPDATE ' . $this->table . " SET book_rating = $rating, book_votes = $votes WHERE book_id = " . (int)$book_id;
441
+	 */
442
+	public function updateRating($book_id, $rating, $votes)
443
+	{
444
+		$sql = 'UPDATE ' . $this->table . " SET book_rating = $rating, book_votes = $votes WHERE book_id = " . (int)$book_id;
445 445
 
446
-        return $this->db->queryF($sql);
447
-    }
446
+		return $this->db->queryF($sql);
447
+	}
448 448
 
449
-    /**
449
+	/**
450 450
 	 * Mise à jour du nombre de commentaires d'un livre
451
-     *
452
-     * @param integer $book_id       Identifiant du livre
453
-     * @param integer $commentsCount Nombre total de commentaires
454
-     */
455
-    public function updateCommentsCount($book_id, $commentsCount)
456
-    {
457
-        $book = null;
458
-        $book =& $this->get($book_id);
459
-        if (is_object($book)) {
460
-            $criteria = new Criteria('book_id', $book_id, '=');
461
-            $this->updateAll('book_comments', $commentsCount, $criteria, true);
462
-        }
463
-    }
464
-
465
-    /**
466
-     * Renvoie x livres au hasard
467
-     *
451
+	 *
452
+	 * @param integer $book_id       Identifiant du livre
453
+	 * @param integer $commentsCount Nombre total de commentaires
454
+	 */
455
+	public function updateCommentsCount($book_id, $commentsCount)
456
+	{
457
+		$book = null;
458
+		$book =& $this->get($book_id);
459
+		if (is_object($book)) {
460
+			$criteria = new Criteria('book_id', $book_id, '=');
461
+			$this->updateAll('book_comments', $commentsCount, $criteria, true);
462
+		}
463
+	}
464
+
465
+	/**
466
+	 * Renvoie x livres au hasard
467
+	 *
468 468
 	 * @param integer $start		Début des données
469 469
 	 * @param integer $limit		Nombre maximum d'enregistrements à renvoyer
470 470
 	 * @param integer $category Identifiant de la catégorie (évenutellement)
471
-     * @return array   Tableau de livres (sous la forme d'objets)
472
-     */
473
-    public function getRandomBooks($start = 0, $limit = 0, $category = 0)
474
-    {
475
-        $tbl_datas = array();
476
-        $criteria  = new CriteriaCompo();
477
-        $criteria->add(new Criteria('book_online', 1, '='));
471
+	 * @return array   Tableau de livres (sous la forme d'objets)
472
+	 */
473
+	public function getRandomBooks($start = 0, $limit = 0, $category = 0)
474
+	{
475
+		$tbl_datas = array();
476
+		$criteria  = new CriteriaCompo();
477
+		$criteria->add(new Criteria('book_online', 1, '='));
478 478
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
479
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
480
-        }
481
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
482
-            $criteria->add(new Criteria('book_stock', 0, '>'));
483
-        }
484
-        if (is_array($category)) {
485
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
486
-        } elseif ($category != 0) {
487
-            $criteria->add(new Criteria('book_cid', (int)$category, '='));
488
-        }
489
-        $criteria->setLimit($limit);
490
-        $criteria->setStart($start);
491
-        $criteria->setSort('RAND()');
492
-        $tbl_datas =& $this->getObjects($criteria, true);
493
-
494
-        return $tbl_datas;
495
-    }
496
-
497
-    /**
498
-     * Renvoie x livres en promo
499
-     *
479
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
480
+		}
481
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
482
+			$criteria->add(new Criteria('book_stock', 0, '>'));
483
+		}
484
+		if (is_array($category)) {
485
+			$criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
486
+		} elseif ($category != 0) {
487
+			$criteria->add(new Criteria('book_cid', (int)$category, '='));
488
+		}
489
+		$criteria->setLimit($limit);
490
+		$criteria->setStart($start);
491
+		$criteria->setSort('RAND()');
492
+		$tbl_datas =& $this->getObjects($criteria, true);
493
+
494
+		return $tbl_datas;
495
+	}
496
+
497
+	/**
498
+	 * Renvoie x livres en promo
499
+	 *
500 500
 	 * @param integer $start		Début des données
501 501
 	 * @param integer $limit		Nombre maximum d'enregistrements à renvoyer
502 502
 	 * @param integer $category Identifiant de la catégorie (évenutellement)
503
-     * @return array   Tableau de livres (sous la forme d'objets)
504
-     */
505
-    public function getPromotionalBooks($start = 0, $limit = 0, $category = 0)
506
-    {
507
-        $tbl_datas = array();
508
-        $criteria  = new CriteriaCompo();
509
-        $criteria->add(new Criteria('book_online', 1, '='));
503
+	 * @return array   Tableau de livres (sous la forme d'objets)
504
+	 */
505
+	public function getPromotionalBooks($start = 0, $limit = 0, $category = 0)
506
+	{
507
+		$tbl_datas = array();
508
+		$criteria  = new CriteriaCompo();
509
+		$criteria->add(new Criteria('book_online', 1, '='));
510 510
 		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
511
-            $criteria->add(new Criteria('book_submitted', time(), '<='));
512
-        }
513
-        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
514
-            $criteria->add(new Criteria('book_stock', 0, '>'));
515
-        }
516
-        if (is_array($category)) {
517
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
518
-        } elseif ($category != 0) {
519
-            $criteria->add(new Criteria('book_cid', (int)$category, '='));
520
-        }
521
-        $criteria->add(new Criteria('book_discount_price', 0, '>'));
522
-        $criteria->setLimit($limit);
523
-        $criteria->setStart($start);
524
-        $criteria->setSort('book_title');
525
-        $criteria->setOrder('DESC');
526
-        $tbl_datas =& $this->getObjects($criteria, true);
527
-
528
-        return $tbl_datas;
529
-    }
530
-
531
-    /**
532
-     * Renvoie les livres dont les stocks sont bas
533
-     *
511
+			$criteria->add(new Criteria('book_submitted', time(), '<='));
512
+		}
513
+		if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
514
+			$criteria->add(new Criteria('book_stock', 0, '>'));
515
+		}
516
+		if (is_array($category)) {
517
+			$criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
518
+		} elseif ($category != 0) {
519
+			$criteria->add(new Criteria('book_cid', (int)$category, '='));
520
+		}
521
+		$criteria->add(new Criteria('book_discount_price', 0, '>'));
522
+		$criteria->setLimit($limit);
523
+		$criteria->setStart($start);
524
+		$criteria->setSort('book_title');
525
+		$criteria->setOrder('DESC');
526
+		$tbl_datas =& $this->getObjects($criteria, true);
527
+
528
+		return $tbl_datas;
529
+	}
530
+
531
+	/**
532
+	 * Renvoie les livres dont les stocks sont bas
533
+	 *
534 534
 	 * @param integer $start		Début des données
535 535
 	 * @param integer $limit		Nombre maximum d'enregistrements à renvoyer
536
-     * @return array   Tableau de livres (sous la forme d'objets)
537
-     */
538
-    public function getLowStocks($start = 0, $limit = 0)
539
-    {
540
-        $ret = array();
541
-        $sql = 'SELECT * FROM ' . $this->table . ' WHERE book_online = 1';
542
-        if (bookshop_getmoduleoption('show_unpublished') == 0) {    // Ne pas afficher les livres qui ne sont pas publi�s
543
-            $sql .= ' AND book_submitted <= ' . time();
544
-        }
545
-        $sql .= ' AND book_stock <= book_alert_stock ';
546
-        $sql .= ' AND book_alert_stock > 0';
547
-        $sql .= ' ORDER BY book_stock';
548
-        $result = $this->db->query($sql, $limit, $start);
549
-        if (!$result) {
550
-            return $ret;
551
-        }
552
-
553
-        $ret = $this->convertResultSet($result, true, true);
554
-
555
-        return $ret;
556
-    }
557
-
558
-    /**
536
+	 * @return array   Tableau de livres (sous la forme d'objets)
537
+	 */
538
+	public function getLowStocks($start = 0, $limit = 0)
539
+	{
540
+		$ret = array();
541
+		$sql = 'SELECT * FROM ' . $this->table . ' WHERE book_online = 1';
542
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {    // Ne pas afficher les livres qui ne sont pas publi�s
543
+			$sql .= ' AND book_submitted <= ' . time();
544
+		}
545
+		$sql .= ' AND book_stock <= book_alert_stock ';
546
+		$sql .= ' AND book_alert_stock > 0';
547
+		$sql .= ' ORDER BY book_stock';
548
+		$result = $this->db->query($sql, $limit, $start);
549
+		if (!$result) {
550
+			return $ret;
551
+		}
552
+
553
+		$ret = $this->convertResultSet($result, true, true);
554
+
555
+		return $ret;
556
+	}
557
+
558
+	/**
559 559
 	 * Retourne le nombre de livres dont la quantité en stock est inférieure ou égale à la quantité d'alerte
560
-     *
561
-     * @return array|bool
562
-     */
563
-    public function getLowStocksCount()
564
-    {
565
-        $ret = array();
566
-        $sql = 'SELECT Count(*) as cpt FROM ' . $this->table . ' WHERE book_online = 1';
567
-        if (bookshop_getmoduleoption('show_unpublished') == 0) {    // Ne pas afficher les livres qui ne sont pas publi�s
568
-            $sql .= ' AND book_submitted <= ' . time();
569
-        }
570
-        $sql .= ' AND book_stock <= book_alert_stock ';
571
-        $sql .= ' AND book_alert_stock > 0';
572
-        $result = $this->db->query($sql);
573
-        if (!$result) {
574
-            return $ret;
575
-        }
576
-        $count = 0;
577
-        list($count) = $this->db->fetchRow($result);
578
-
579
-        return $count;
580
-    }
581
-
582
-    /**
560
+	 *
561
+	 * @return array|bool
562
+	 */
563
+	public function getLowStocksCount()
564
+	{
565
+		$ret = array();
566
+		$sql = 'SELECT Count(*) as cpt FROM ' . $this->table . ' WHERE book_online = 1';
567
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {    // Ne pas afficher les livres qui ne sont pas publi�s
568
+			$sql .= ' AND book_submitted <= ' . time();
569
+		}
570
+		$sql .= ' AND book_stock <= book_alert_stock ';
571
+		$sql .= ' AND book_alert_stock > 0';
572
+		$result = $this->db->query($sql);
573
+		if (!$result) {
574
+			return $ret;
575
+		}
576
+		$count = 0;
577
+		list($count) = $this->db->fetchRow($result);
578
+
579
+		return $count;
580
+	}
581
+
582
+	/**
583 583
 	 * Augmente les quantités en stock d'un livre
584
-     *
584
+	 *
585 585
 	 * @param object $book Objet livre
586 586
 	 * @param $quantity $quantity Quantité à rajouter
587
-     *
588
-     * @return bool
589
-     */
590
-    public function increaseStock(XoopsObject $book, $quantity = 1)
591
-    {
592
-        $book->setVar('book_stock', $book->getVar('book_stock') + 1);
593
-        $this->insert($book, true);
594
-
595
-        return true;
596
-    }
597
-
598
-    /**
587
+	 *
588
+	 * @return bool
589
+	 */
590
+	public function increaseStock(XoopsObject $book, $quantity = 1)
591
+	{
592
+		$book->setVar('book_stock', $book->getVar('book_stock') + 1);
593
+		$this->insert($book, true);
594
+
595
+		return true;
596
+	}
597
+
598
+	/**
599 599
 	 * Diminue les quantités en stock d'un livre
600
-     *
601
-     * @param XoopsObject  $book     Objet livre
600
+	 *
601
+	 * @param XoopsObject  $book     Objet livre
602 602
 	 * @param $quantity $quantity Quantité à soustraire
603
-     *
604
-     * @return bool
605
-     */
606
-    public function decreaseStock(XoopsObject $book, $quantity = 1)
607
-    {
608
-        if ($book->getVar('book_stock') - $quantity > 0) {
609
-            $book->setVar('book_stock', $book->getVar('book_stock') - $quantity);
610
-            $this->insert($book, true);
611
-        } else {
612
-            $book->setVar('book_stock', 0);
613
-        }
614
-
615
-        return true;
616
-    }
617
-
618
-    /**
603
+	 *
604
+	 * @return bool
605
+	 */
606
+	public function decreaseStock(XoopsObject $book, $quantity = 1)
607
+	{
608
+		if ($book->getVar('book_stock') - $quantity > 0) {
609
+			$book->setVar('book_stock', $book->getVar('book_stock') - $quantity);
610
+			$this->insert($book, true);
611
+		} else {
612
+			$book->setVar('book_stock', 0);
613
+		}
614
+
615
+		return true;
616
+	}
617
+
618
+	/**
619 619
 	 * Indique si la quantité d'alerte d'un livre est atteinte
620
-     *
620
+	 *
621 621
 	 * @param object $book L'objet livre concerné
622 622
 	 * @return boolean Vrai si la quantité d'alerte est atteinte, sinon faux
623
-     */
624
-    public function isAlertStockReached(&$book)
625
-    {
626
-        if ($book->getVar('book_stock') < $book->getVar('book_alert_stock')) {
627
-            return true;
628
-        } else {
629
-            return false;
630
-        }
631
-    }
632
-
633
-    /**
623
+	 */
624
+	public function isAlertStockReached(&$book)
625
+	{
626
+		if ($book->getVar('book_stock') < $book->getVar('book_alert_stock')) {
627
+			return true;
628
+		} else {
629
+			return false;
630
+		}
631
+	}
632
+
633
+	/**
634 634
 	 * Méthode chargée de vérifier si le stock d'alerte est atteint et si c'est le cas, d'envoyer une alerte
635
-     *
635
+	 *
636 636
 	 * @param object $book Livre dont il faut faire la vérification
637 637
 	 * @return boolean vrai si l'alerte à du être générée sinon faux
638
-     */
639
-    public function verifyLowStock(&$book)
640
-    {
641
-        if ($this->isAlertStockReached($book)) {
642
-            $msg                    = array();
643
-            $msg['BOOK_NAME']       = $book->getVar('book_title');
644
-            $msg['ACTUAL_QUANTITY'] = $book->getVar('book_stock');
645
-            $msg['ALERT_QUANTITY']  = $book->getVar('book_alert_stock');
646
-            $msg['PUBLIC_URL']      = static::GetBookLink($book->getVar('book_id'), $book->getVar('book_title'));
647
-            $msg['ADMIN_URL']       = BOOKSHOP_URL . 'admin/index.php?op=editbook&id=' . $book->getVar('book_id');
648
-            bookshop_send_email_from_tpl('shop_lowstock.tpl', bookshop_getEmailsFromGroup(bookshop_getmoduleoption('stock_alert_email')), _BOOKSHOP_STOCK_ALERT, $msg);
649
-
650
-            return true;
651
-        } else {
652
-            return false;
653
-        }
654
-    }
655
-
656
-    /**
638
+	 */
639
+	public function verifyLowStock(&$book)
640
+	{
641
+		if ($this->isAlertStockReached($book)) {
642
+			$msg                    = array();
643
+			$msg['BOOK_NAME']       = $book->getVar('book_title');
644
+			$msg['ACTUAL_QUANTITY'] = $book->getVar('book_stock');
645
+			$msg['ALERT_QUANTITY']  = $book->getVar('book_alert_stock');
646
+			$msg['PUBLIC_URL']      = static::GetBookLink($book->getVar('book_id'), $book->getVar('book_title'));
647
+			$msg['ADMIN_URL']       = BOOKSHOP_URL . 'admin/index.php?op=editbook&id=' . $book->getVar('book_id');
648
+			bookshop_send_email_from_tpl('shop_lowstock.tpl', bookshop_getEmailsFromGroup(bookshop_getmoduleoption('stock_alert_email')), _BOOKSHOP_STOCK_ALERT, $msg);
649
+
650
+			return true;
651
+		} else {
652
+			return false;
653
+		}
654
+	}
655
+
656
+	/**
657 657
 	 * Renvoie la plus petite date de création d'un livre ainsi que la "plus grande" date de création d'un livre
658
-     *
658
+	 *
659 659
 	 * @param integer $minDate Date mini (parmètre de sortie)
660 660
 	 * @param integer $maxDate Date maxi (paramètre de sortie)
661 661
 	 * @return boolean Vrai si on a pu récupérer ces valeurs, faux sinon
662
-     */
663
-    public function getMinMaxPublishedDate(&$minDate, &$maxDate)
664
-    {
665
-        $sql    = 'SELECT Min(book_submitted) as minDate, Max(book_submitted) as maxDate FROM ' . $this->table . ' WHERE book_online=1';
666
-        $result = $this->db->query($sql);
667
-        if (!$result) {
668
-            return false;
669
-        }
670
-        $myrow   = $this->db->fetchArray($result);
671
-        $minDate = $myrow['minDate'];
672
-        $maxDate = $myrow['maxDate'];
673
-
674
-        return true;
675
-    }
662
+	 */
663
+	public function getMinMaxPublishedDate(&$minDate, &$maxDate)
664
+	{
665
+		$sql    = 'SELECT Min(book_submitted) as minDate, Max(book_submitted) as maxDate FROM ' . $this->table . ' WHERE book_online=1';
666
+		$result = $this->db->query($sql);
667
+		if (!$result) {
668
+			return false;
669
+		}
670
+		$myrow   = $this->db->fetchArray($result);
671
+		$minDate = $myrow['minDate'];
672
+		$maxDate = $myrow['maxDate'];
673
+
674
+		return true;
675
+	}
676 676
 }
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
 defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
28 28
 
29
-include_once XOOPS_ROOT_PATH . '/kernel/object.php';
29
+include_once XOOPS_ROOT_PATH.'/kernel/object.php';
30 30
 if (!class_exists('Bookshop_XoopsPersistableObjectHandler')) {
31
-    include_once XOOPS_ROOT_PATH . '/modules/bookshop/class/PersistableObjectHandler.php';
31
+    include_once XOOPS_ROOT_PATH.'/modules/bookshop/class/PersistableObjectHandler.php';
32 32
 }
33 33
 
34 34
 /**
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     public function recommendedPicture()
117 117
     {
118 118
         if ($this->isRecommended()) {
119
-            return "<img src='" . BOOKSHOP_IMAGES_URL . "heart.png' alt='" . _BOOKSHOP_IS_RECOMMENDED . "' />&nbsp;";
119
+            return "<img src='".BOOKSHOP_IMAGES_URL."heart.png' alt='"._BOOKSHOP_IS_RECOMMENDED."' />&nbsp;";
120 120
         } else {
121
-            return "<img src='" . BOOKSHOP_IMAGES_URL . "blank.gif' alt='' />";
121
+            return "<img src='".BOOKSHOP_IMAGES_URL."blank.gif' alt='' />";
122 122
         }
123 123
     }
124 124
 
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
         $tbl_datas = array();
170 170
         $criteria  = new CriteriaCompo();
171 171
         $criteria->add(new Criteria('book_online', 1, '='));
172
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
172
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
173 173
             $criteria->add(new Criteria('book_submitted', time(), '<='));
174 174
         }
175 175
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
176 176
             $criteria->add(new Criteria('book_stock', 0, '>'));
177 177
         }
178 178
         if (is_array($category)) {
179
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
179
+            $criteria->add(new Criteria('book_cid', '('.implode(',', $category).')', 'IN'));
180 180
         } elseif ($category != 0) {
181 181
             $criteria->add(new Criteria('book_cid', (int)$category, '='));
182 182
         }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $criteria->setStart($start);
187 187
         $criteria->setSort('book_hits');
188 188
         $criteria->setOrder('DESC');
189
-        $tbl_datas =& $this->getObjects($criteria, true);
189
+        $tbl_datas = & $this->getObjects($criteria, true);
190 190
 
191 191
         return $tbl_datas;
192 192
     }
@@ -204,14 +204,14 @@  discard block
 block discarded – undo
204 204
         $tbl_datas = array();
205 205
         $criteria  = new CriteriaCompo();
206 206
         $criteria->add(new Criteria('book_online', 1, '='));
207
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
207
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
208 208
             $criteria->add(new Criteria('book_submitted', time(), '<='));
209 209
         }
210 210
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
211 211
             $criteria->add(new Criteria('book_stock', 0, '>'));
212 212
         }
213 213
         if (is_array($category)) {
214
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
214
+            $criteria->add(new Criteria('book_cid', '('.implode(',', $category).')', 'IN'));
215 215
         } elseif ($category != 0) {
216 216
             $criteria->add(new Criteria('book_cid', (int)$category, '='));
217 217
         }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         $criteria->setStart($start);
220 220
         $criteria->setSort('book_rating');
221 221
         $criteria->setOrder('DESC');
222
-        $tbl_datas =& $this->getObjects($criteria, true);
222
+        $tbl_datas = & $this->getObjects($criteria, true);
223 223
 
224 224
         return $tbl_datas;
225 225
     }
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
         $criteria  = new CriteriaCompo();
239 239
         $criteria->add(new Criteria('book_online', 1, '='));
240 240
         $criteria->add(new Criteria('book_recommended', '0000-00-00', '<>'));
241
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
241
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
242 242
             $criteria->add(new Criteria('book_submitted', time(), '<='));
243 243
         }
244 244
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
245 245
             $criteria->add(new Criteria('book_stock', 0, '>'));
246 246
         }
247 247
         if (is_array($category)) {
248
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
248
+            $criteria->add(new Criteria('book_cid', '('.implode(',', $category).')', 'IN'));
249 249
         } elseif ($category != 0) {
250 250
             $criteria->add(new Criteria('book_cid', (int)$category, '='));
251 251
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $criteria->setStart($start);
254 254
         $criteria->setSort('book_recommended');
255 255
         $criteria->setOrder('DESC');
256
-        $tbl_datas =& $this->getObjects($criteria, true);
256
+        $tbl_datas = & $this->getObjects($criteria, true);
257 257
 
258 258
         return $tbl_datas;
259 259
     }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         $criteria = new CriteriaCompo();
269 269
         $criteria->add(new Criteria('book_online', 1, '='));
270 270
         $criteria->add(new Criteria('book_recommended', '0000-00-00', '<>'));
271
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
271
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
272 272
             $criteria->add(new Criteria('book_submitted', time(), '<='));
273 273
         }
274 274
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
@@ -292,21 +292,21 @@  discard block
 block discarded – undo
292 292
         $tbl_datas = array();
293 293
         $criteria  = new CriteriaCompo();
294 294
         $criteria->add(new Criteria('book_online', 1, '='));
295
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
295
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
296 296
             $criteria->add(new Criteria('book_submitted', time(), '<='));
297 297
         }
298 298
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
299 299
             $criteria->add(new Criteria('book_stock', 0, '>'));
300 300
         }
301 301
         if (is_array($category)) {
302
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
302
+            $criteria->add(new Criteria('book_cid', '('.implode(',', $category).')', 'IN'));
303 303
         } elseif ($category > 0) {
304 304
             $criteria->add(new Criteria('book_cid', (int)$category, '='));
305 305
         }
306 306
         $criteria->setLimit($limit);
307 307
         $criteria->setStart($start);
308 308
         $criteria->setSort($sortField);
309
-        $tbl_datas =& $this->getObjects($criteria, true);
309
+        $tbl_datas = & $this->getObjects($criteria, true);
310 310
 
311 311
         return $tbl_datas;
312 312
     }
@@ -327,21 +327,21 @@  discard block
 block discarded – undo
327 327
         $criteria->add(new Criteria('book_online', 1, '='));
328 328
         $criteria->add(new Criteria('book_submitted', $startingDate, '>='));
329 329
         $criteria->add(new Criteria('book_submitted', $endingDate, '<='));
330
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
330
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
331 331
             $criteria->add(new Criteria('book_submitted', time(), '<='));
332 332
         }
333 333
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
334 334
             $criteria->add(new Criteria('book_stock', 0, '>'));
335 335
         }
336 336
         if (is_array($category)) {
337
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
337
+            $criteria->add(new Criteria('book_cid', '('.implode(',', $category).')', 'IN'));
338 338
         } elseif ($category > 0) {
339 339
             $criteria->add(new Criteria('book_cid', (int)$category, '='));
340 340
         }
341 341
         $criteria->setLimit($limit);
342 342
         $criteria->setStart($start);
343 343
         $criteria->setSort('book_title');
344
-        $tblDatas =& $this->getObjects($criteria, true);
344
+        $tblDatas = & $this->getObjects($criteria, true);
345 345
 
346 346
         return $tblDatas;
347 347
     }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     {
357 357
         $criteria = new CriteriaCompo();
358 358
         $criteria->add(new Criteria('book_online', 1, '='));
359
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
359
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
360 360
             $criteria->add(new Criteria('book_submitted', time(), '<='));
361 361
         }
362 362
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
     {
380 380
         global $myts;
381 381
         $ret = array();
382
-        $sql = 'SELECT book_id, book_title FROM ' . $this->table;
382
+        $sql = 'SELECT book_id, book_title FROM '.$this->table;
383 383
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
384
-            $sql .= ' ' . $criteria->renderWhere();
384
+            $sql .= ' '.$criteria->renderWhere();
385 385
             if ($criteria->getSort() != '') {
386
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
386
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
387 387
             }
388 388
             $limit = $criteria->getLimit();
389 389
             $start = $criteria->getStart();
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
     {
411 411
         $url = '';
412 412
         if (bookshop_getmoduleoption('urlrewriting') == 1) {    // On utilise l'url rewriting
413
-            $url = BOOKSHOP_URL . 'book-' . $book_id . bookshop_makeSEOurl($book_title) . '.html';
413
+            $url = BOOKSHOP_URL.'book-'.$book_id.bookshop_makeSEOurl($book_title).'.html';
414 414
         } else {    // Pas d'utilisation de l'url rewriting
415
-            $url = BOOKSHOP_URL . 'book.php?book_id=' . $book_id;
415
+            $url = BOOKSHOP_URL.'book.php?book_id='.$book_id;
416 416
         }
417 417
 
418 418
         return $url;
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      */
427 427
     public function addCounter($book_id)
428 428
     {
429
-        $sql = 'UPDATE ' . $this->table . ' SET book_hits = book_hits + 1 WHERE book_id= ' . (int)$book_id;
429
+        $sql = 'UPDATE '.$this->table.' SET book_hits = book_hits + 1 WHERE book_id= '.(int)$book_id;
430 430
 
431 431
         return $this->db->queryF($sql);
432 432
     }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
      */
442 442
     public function updateRating($book_id, $rating, $votes)
443 443
     {
444
-        $sql = 'UPDATE ' . $this->table . " SET book_rating = $rating, book_votes = $votes WHERE book_id = " . (int)$book_id;
444
+        $sql = 'UPDATE '.$this->table." SET book_rating = $rating, book_votes = $votes WHERE book_id = ".(int)$book_id;
445 445
 
446 446
         return $this->db->queryF($sql);
447 447
     }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     public function updateCommentsCount($book_id, $commentsCount)
456 456
     {
457 457
         $book = null;
458
-        $book =& $this->get($book_id);
458
+        $book = & $this->get($book_id);
459 459
         if (is_object($book)) {
460 460
             $criteria = new Criteria('book_id', $book_id, '=');
461 461
             $this->updateAll('book_comments', $commentsCount, $criteria, true);
@@ -475,21 +475,21 @@  discard block
 block discarded – undo
475 475
         $tbl_datas = array();
476 476
         $criteria  = new CriteriaCompo();
477 477
         $criteria->add(new Criteria('book_online', 1, '='));
478
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
478
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
479 479
             $criteria->add(new Criteria('book_submitted', time(), '<='));
480 480
         }
481 481
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
482 482
             $criteria->add(new Criteria('book_stock', 0, '>'));
483 483
         }
484 484
         if (is_array($category)) {
485
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
485
+            $criteria->add(new Criteria('book_cid', '('.implode(',', $category).')', 'IN'));
486 486
         } elseif ($category != 0) {
487 487
             $criteria->add(new Criteria('book_cid', (int)$category, '='));
488 488
         }
489 489
         $criteria->setLimit($limit);
490 490
         $criteria->setStart($start);
491 491
         $criteria->setSort('RAND()');
492
-        $tbl_datas =& $this->getObjects($criteria, true);
492
+        $tbl_datas = & $this->getObjects($criteria, true);
493 493
 
494 494
         return $tbl_datas;
495 495
     }
@@ -507,14 +507,14 @@  discard block
 block discarded – undo
507 507
         $tbl_datas = array();
508 508
         $criteria  = new CriteriaCompo();
509 509
         $criteria->add(new Criteria('book_online', 1, '='));
510
-		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
510
+		if (bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
511 511
             $criteria->add(new Criteria('book_submitted', time(), '<='));
512 512
         }
513 513
         if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
514 514
             $criteria->add(new Criteria('book_stock', 0, '>'));
515 515
         }
516 516
         if (is_array($category)) {
517
-            $criteria->add(new Criteria('book_cid', '(' . implode(',', $category) . ')', 'IN'));
517
+            $criteria->add(new Criteria('book_cid', '('.implode(',', $category).')', 'IN'));
518 518
         } elseif ($category != 0) {
519 519
             $criteria->add(new Criteria('book_cid', (int)$category, '='));
520 520
         }
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
         $criteria->setStart($start);
524 524
         $criteria->setSort('book_title');
525 525
         $criteria->setOrder('DESC');
526
-        $tbl_datas =& $this->getObjects($criteria, true);
526
+        $tbl_datas = & $this->getObjects($criteria, true);
527 527
 
528 528
         return $tbl_datas;
529 529
     }
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
     public function getLowStocks($start = 0, $limit = 0)
539 539
     {
540 540
         $ret = array();
541
-        $sql = 'SELECT * FROM ' . $this->table . ' WHERE book_online = 1';
541
+        $sql = 'SELECT * FROM '.$this->table.' WHERE book_online = 1';
542 542
         if (bookshop_getmoduleoption('show_unpublished') == 0) {    // Ne pas afficher les livres qui ne sont pas publi�s
543
-            $sql .= ' AND book_submitted <= ' . time();
543
+            $sql .= ' AND book_submitted <= '.time();
544 544
         }
545 545
         $sql .= ' AND book_stock <= book_alert_stock ';
546 546
         $sql .= ' AND book_alert_stock > 0';
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
     public function getLowStocksCount()
564 564
     {
565 565
         $ret = array();
566
-        $sql = 'SELECT Count(*) as cpt FROM ' . $this->table . ' WHERE book_online = 1';
566
+        $sql = 'SELECT Count(*) as cpt FROM '.$this->table.' WHERE book_online = 1';
567 567
         if (bookshop_getmoduleoption('show_unpublished') == 0) {    // Ne pas afficher les livres qui ne sont pas publi�s
568
-            $sql .= ' AND book_submitted <= ' . time();
568
+            $sql .= ' AND book_submitted <= '.time();
569 569
         }
570 570
         $sql .= ' AND book_stock <= book_alert_stock ';
571 571
         $sql .= ' AND book_alert_stock > 0';
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
             $msg['ACTUAL_QUANTITY'] = $book->getVar('book_stock');
645 645
             $msg['ALERT_QUANTITY']  = $book->getVar('book_alert_stock');
646 646
             $msg['PUBLIC_URL']      = static::GetBookLink($book->getVar('book_id'), $book->getVar('book_title'));
647
-            $msg['ADMIN_URL']       = BOOKSHOP_URL . 'admin/index.php?op=editbook&id=' . $book->getVar('book_id');
647
+            $msg['ADMIN_URL']       = BOOKSHOP_URL.'admin/index.php?op=editbook&id='.$book->getVar('book_id');
648 648
             bookshop_send_email_from_tpl('shop_lowstock.tpl', bookshop_getEmailsFromGroup(bookshop_getmoduleoption('stock_alert_email')), _BOOKSHOP_STOCK_ALERT, $msg);
649 649
 
650 650
             return true;
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
      */
663 663
     public function getMinMaxPublishedDate(&$minDate, &$maxDate)
664 664
     {
665
-        $sql    = 'SELECT Min(book_submitted) as minDate, Max(book_submitted) as maxDate FROM ' . $this->table . ' WHERE book_online=1';
665
+        $sql    = 'SELECT Min(book_submitted) as minDate, Max(book_submitted) as maxDate FROM '.$this->table.' WHERE book_online=1';
666 666
         $result = $this->db->query($sql);
667 667
         if (!$result) {
668 668
             return false;
Please login to merge, or discard this patch.