|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00010 require('includes/application_top.php'); 00011 00012 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 00013 00014 if (zen_not_null($action)) { 00015 switch ($action) { 00016 case 'insert': 00017 case 'save': 00018 if (isset($_GET['mID'])) $music_genre_id = zen_db_prepare_input($_GET['mID']); 00019 $music_genre_name = zen_db_prepare_input($_POST['music_genre_name']); 00020 00021 $sql_data_array = array('music_genre_name' => $music_genre_name); 00022 00023 if ($action == 'insert') { 00024 $insert_sql_data = array('date_added' => 'now()'); 00025 00026 $sql_data_array = array_merge($sql_data_array, $insert_sql_data); 00027 00028 zen_db_perform(TABLE_MUSIC_GENRE, $sql_data_array); 00029 $music_genre_id = zen_db_insert_id(); 00030 } elseif ($action == 'save') { 00031 $update_sql_data = array('last_modified' => 'now()'); 00032 00033 $sql_data_array = array_merge($sql_data_array, $update_sql_data); 00034 00035 zen_db_perform(TABLE_MUSIC_GENRE, $sql_data_array, 'update', "music_genre_id = '" . (int)$music_genre_id . "'"); 00036 } 00037 00038 zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'mID=' . $music_genre_id)); 00039 break; 00040 case 'deleteconfirm': 00041 // demo active test 00042 if (zen_admin_demo()) { 00043 $_GET['action']= ''; 00044 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 00045 zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'])); 00046 } 00047 $music_genre_id = zen_db_prepare_input($_POST['mID']); 00048 00049 $db->Execute("delete from " . TABLE_MUSIC_GENRE . " 00050 where music_genre_id = '" . (int)$music_genre_id . "'"); 00051 00052 if (isset($_POST['delete_products']) && ($_POST['delete_products'] == 'on')) { 00053 $products = $db->Execute("select products_id 00054 from " . TABLE_PRODUCT_MUSIC_EXTRA . " 00055 where music_genre_id = '" . (int)$music_genre_id . "'"); 00056 00057 while (!$products->EOF) { 00058 zen_remove_product($products->fields['products_id']); 00059 $products->MoveNext(); 00060 } 00061 } else { 00062 $db->Execute("update " . TABLE_PRODUCT_MUSIC_EXTRA . " 00063 set music_genre_id = '' 00064 where music_genre_id = '" . (int)$music_genre_id . "'"); 00065 } 00066 00067 zen_redirect(zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'])); 00068 break; 00069 } 00070 } 00071 ?> 00072 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00073 <html <?php echo HTML_PARAMS; ?>> 00074 <head> 00075 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00076 <title><?php echo TITLE; ?></title> 00077 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00078 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00079 <script language="javascript" src="includes/menu.js"></script> 00080 <script language="javascript" src="includes/general.js"></script> 00081 <script type="text/javascript"> 00082 <!-- 00083 function init() 00084 { 00085 cssjsmenu('navbar'); 00086 if (document.getElementById) 00087 { 00088 var kill = document.getElementById('hoverJS'); 00089 kill.disabled = true; 00090 } 00091 } 00092 // --> 00093 </script> 00094 </head> 00095 <body onload="init()"> 00096 <!-- header //--> 00097 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 00098 <!-- header_eof //--> 00099 00100 <!-- body //--> 00101 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00102 <tr> 00103 <!-- body_text //--> 00104 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00105 <tr> 00106 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00107 <tr> 00108 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00109 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 00110 </tr> 00111 </table></td> 00112 </tr> 00113 <tr> 00114 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00115 <tr> 00116 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00117 <tr class="dataTableHeadingRow"> 00118 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MUSIC_GENRE; ?></td> 00119 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 00120 </tr> 00121 <?php 00122 $music_genre_query_raw = "select * from " . TABLE_MUSIC_GENRE . " order by music_genre_name"; 00123 $music_genre_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $music_genre_query_raw, $music_genre_query_numrows); 00124 $music_genre = $db->Execute($music_genre_query_raw); 00125 00126 while (!$music_genre->EOF) { 00127 00128 if ((!isset($_GET['mID']) || (isset($_GET['mID']) && ($_GET['mID'] == $music_genre->fields['music_genre_id']))) && !isset($aInfo) && (substr($action, 0, 3) != 'new')) { 00129 $music_genre_products = $db->Execute("select count(*) as products_count 00130 from " . TABLE_PRODUCT_MUSIC_EXTRA . " 00131 where music_genre_id = '" . (int)$music_genre->fields['music_genre_id'] . "'"); 00132 00133 $aInfo_array = array_merge($music_genre->fields, $music_genre_products->fields); 00134 $aInfo = new objectInfo($aInfo_array); 00135 } 00136 00137 if (isset($aInfo) && is_object($aInfo) && ($music_genre->fields['music_genre_id'] == $aInfo->music_genre_id)) { 00138 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=edit') . '\'">' . "\n"; 00139 } else { 00140 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=edit') . '\'">' . "\n"; 00141 } 00142 ?> 00143 <td class="dataTableContent"><?php echo $music_genre->fields['music_genre_name']; ?></td> 00144 <td class="dataTableContent" align="right"> 00145 <?php echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?> 00146 <?php echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $music_genre->fields['music_genre_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?> 00147 <?php if (isset($aInfo) && is_object($aInfo) && ($music_genre->fields['music_genre_id'] == $aInfo->music_genre_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, zen_get_all_get_params(array('mID')) . 'mID=' . $music_genre->fields['music_genre_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> 00148 </td> 00149 </tr> 00150 <?php 00151 $music_genre->MoveNext(); 00152 } 00153 ?> 00154 <tr> 00155 <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00156 <tr> 00157 <td class="smallText" valign="top"><?php echo $music_genre_split->display_count($music_genre_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_MUSIC_GENRES); ?></td> 00158 <td class="smallText" align="right"><?php echo $music_genre_split->display_links($music_genre_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> 00159 </tr> 00160 </table></td> 00161 </tr> 00162 <?php 00163 if (empty($action)) { 00164 ?> 00165 <tr> 00166 <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td> 00167 </tr> 00168 <?php 00169 } 00170 ?> 00171 </table></td> 00172 <?php 00173 $heading = array(); 00174 $contents = array(); 00175 00176 switch ($action) { 00177 case 'new': 00178 $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_MUSIC_GENRE . '</b>'); 00179 00180 $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'action=insert', 'post', 'enctype="multipart/form-data"')); 00181 $contents[] = array('text' => TEXT_NEW_INTRO); 00182 $contents[] = array('text' => '<br>' . TEXT_MUSIC_GENRE_NAME . '<br>' . zen_draw_input_field('music_genre_name', '', zen_set_field_length(TABLE_MUSIC_GENRE, 'music_genre_name'))); 00183 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $_GET['mID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00184 break; 00185 case 'edit': 00186 $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_MUSIC_GENRE . '</b>'); 00187 00188 $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=save', 'post', 'enctype="multipart/form-data"')); 00189 $contents[] = array('text' => TEXT_EDIT_INTRO); 00190 $contents[] = array('text' => '<br />' . TEXT_MUSIC_GENRE_NAME . '<br>' . zen_draw_input_field('music_genre_name', htmlspecialchars($aInfo->music_genre_name, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_MUSIC_GENRE, 'music_genre_name'))); 00191 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00192 break; 00193 case 'delete': 00194 $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_MUSIC_GENRE . '</b>'); 00195 00196 $contents = array('form' => zen_draw_form('music_genre', FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('mID', $aInfo->music_genre_id)); 00197 $contents[] = array('text' => TEXT_DELETE_INTRO); 00198 $contents[] = array('text' => '<br><b>' . $aInfo->music_genre_name . '</b>'); 00199 00200 if ($aInfo->products_count > 0) { 00201 $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS); 00202 $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $aInfo->products_count)); 00203 } 00204 00205 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 00206 break; 00207 default: 00208 if (isset($aInfo) && is_object($aInfo)) { 00209 $heading[] = array('text' => '<b>' . $aInfo->music_genre_name . '</b>'); 00210 00211 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_MUSIC_GENRE, 'page=' . $_GET['page'] . '&mID=' . $aInfo->music_genre_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 00212 $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($aInfo->date_added)); 00213 if (zen_not_null($aInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($aInfo->last_modified)); 00214 $contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $aInfo->products_count); 00215 } 00216 break; 00217 } 00218 00219 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 00220 echo ' <td width="25%" valign="top">' . "\n"; 00221 00222 $box = new box; 00223 echo $box->infoBox($heading, $contents); 00224 00225 echo ' </td>' . "\n"; 00226 } 00227 ?> 00228 </tr> 00229 </table></td> 00230 </tr> 00231 </table></td> 00232 <!-- body_text_eof //--> 00233 </tr> 00234 </table> 00235 <!-- body_eof //--> 00236 00237 <!-- footer //--> 00238 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 00239 <!-- footer_eof //--> 00240 <br> 00241 </body> 00242 </html> 00243 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>