[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_module/mod_shop/inc/ -> edit.products.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  $BE['HEADER']['optionselect.js']        = getJavaScriptSourceLink('include/inc_js/optionselect.js');
  32  
  33  ?>
  34  <h1 class="title" style="margin-bottom:10px"><?php echo $BLM['prod_edit'] ?></h1>
  35  
  36  <form action="<?php 
  37  
  38      echo shop_url( array('controller=prod', 'edit='.$plugin['data']['shopprod_id']) ) 
  39  
  40  ?>" method="post" class="editform" onsubmit="selectAllOptions(this.shopprod_images);">
  41  
  42  <input type="hidden" name="shopprod_id" value="<?php echo $plugin['data']['shopprod_id'] ?>" />
  43  <table border="0" cellpadding="0" cellspacing="0" width="100%" summary="">
  44  
  45      <tr> 
  46          <td align="right" class="chatlist"><?php echo $BL['be_cnt_last_edited']  ?>:&nbsp;</td>
  47          <td class="v10" width="410"><?php 
  48          
  49          echo html_specialchars(date($BL['be_fprivedit_dateformat'], $plugin['data']['shopprod_changedate'])) ;
  50          
  51          if(!empty($plugin['data']['shopprod_createdate'])) {
  52          ?>        
  53          &nbsp;&nbsp;&nbsp;<span class="chatlist"><?php echo $BL['be_fprivedit_created']  ?>:</span> 
  54          <?php 
  55                  echo html_specialchars(date($BL['be_fprivedit_dateformat'], strtotime($plugin['data']['shopprod_createdate'])));
  56          }
  57          
  58          ?></td>
  59      </tr>
  60      
  61      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td></tr>
  62  
  63      <tr> 
  64          <td align="right" class="chatlist"><?php echo $BLM['shopprod_ordernumber'] ?>:&nbsp;</td>
  65          <td><table cellpadding="0" cellspacing="0" border="0" summary="">
  66          
  67              <tr>
  68                  <td><input name="shopprod_ordernumber" type="text" id="shopprod_ordernumber" class="v12 width125 bold<?php 
  69          
  70          //error class
  71          if(!empty($plugin['error']['shopprod_ordernumber'])) echo ' errorInputText';
  72          
  73          ?>" value="<?php echo html_specialchars($plugin['data']['shopprod_ordernumber']) ?>" size="30" maxlength="20" /></td>
  74          
  75                  <td align="right" class="chatlist width100"><?php echo $BLM['shopprod_model'] ?>:&nbsp;</td>
  76                  <td><input name="shopprod_model" type="text" id="shopprod_model" class="v12 width170" value="<?php echo html_specialchars($plugin['data']['shopprod_model']) ?>" size="30" maxlength="200" /></td>
  77          
  78                  </tr>
  79                  
  80              </table></td>
  81      </tr>
  82  
  83      
  84      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td></tr>    
  85      
  86      <tr> 
  87          <td align="right" class="chatlist"><?php echo $BLM['shopprod_name1'] ?>:&nbsp;</td>
  88          <td><input name="shopprod_name1" type="text" id="shopprod_name1" class="v12 width400 bold<?php 
  89          
  90          //error class
  91          if(!empty($plugin['error']['shopprod_name1'])) echo ' errorInputText';
  92          
  93          ?>" value="<?php echo html_specialchars($plugin['data']['shopprod_name1']) ?>" size="30" maxlength="200" /></td>
  94      </tr>
  95      
  96      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="3" /></td></tr>
  97      
  98      <tr> 
  99          <td align="right" class="chatlist"><?php echo $BLM['shopprod_name2'] ?>:&nbsp;</td>
 100          <td><input name="shopprod_name2" type="text" id="shopprod_name2" class="v12 width400" value="<?php echo html_specialchars($plugin['data']['shopprod_name2']) ?>" size="30" maxlength="200" /></td>
 101      </tr>
 102      
 103      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="3" /></td></tr>
 104      
 105      <tr> 
 106          <td align="right" class="chatlist"><?php echo $BLM['shopprod_weight'] ?>:&nbsp;</td>
 107          <td><table cellpadding="0" cellspacing="0" border="0" summary="">
 108          
 109              <tr>
 110              
 111                  <td><input name="shopprod_weight" type="text" id="shopprod_weight" class="v12 width125 right" value="<?php
 112  
 113              echo number_format($plugin['data']['shopprod_weight'], 3, $BLM['dec_point'], $BLM['thousands_sep']);
 114  
 115          ?>" size="30" maxlength="200" /></td>
 116          
 117              <td class="chatlist">&nbsp;<?php
 118              
 119              if( ! $plugin['data']['shop_pref_unit_weight'] = _getConfig('shop_pref_unit_weight') ) {
 120                  $plugin['data']['shop_pref_unit_weight'] = 'kg';
 121                  _setConfig('shop_pref_unit_weight',     $plugin['data']['shop_pref_unit_weight'],     'module_shop');
 122              }
 123              echo html_specialchars($plugin['data']['shop_pref_unit_weight']);
 124              
 125              ?></td>
 126          
 127              </tr>
 128              </table></td>
 129  
 130      </tr>
 131  
 132      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td></tr>    
 133      
 134      
 135      <tr> 
 136          <td align="right" class="chatlist"><?php echo $BLM['shopprod_price'] ?>:&nbsp;</td>
 137          <td><table cellpadding="0" cellspacing="0" border="0" summary="">
 138          
 139              <tr>
 140              
 141                  <td><input name="shopprod_price" type="text" id="shopprod_price" class="v12 width125 bold right<?php
 142          
 143              if(!empty($plugin['error']['shopprod_price'])) echo ' errorInputText';
 144          
 145              ?>" value="<?php
 146          
 147              $dec_lenght = strlen(strrchr($plugin['data']['shopprod_price'],'.')) - 1;
 148              if($dec_lenght < 2) $dec_lenght = 2;
 149              echo number_format($plugin['data']['shopprod_price'], $dec_lenght, $BLM['dec_point'], $BLM['thousands_sep']);
 150  
 151          ?>" size="30" maxlength="200" /></td>
 152              
 153              <td>&nbsp;</td>
 154              <td width="25" align="right"><input type="checkbox" name="shopprod_netgross" id="shopprod_netgross" value="1"<?php is_checked(1, $plugin['data']['shopprod_netgross']) ?>  title="<?php echo $BLM['shopprod_netgross_info'] ?>" /></td>
 155              <td width="75"><label for="shopprod_netgross" title="<?php echo $BLM['shopprod_netgross_info'] ?>"><?php echo $BLM['shopprod_netgross'] ?></label>&nbsp;&nbsp;&nbsp;</td>
 156          
 157              <td class="chatlist"><?php echo $BLM['shopprod_vat'] ?>:&nbsp;</td>
 158              <td><select name="shopprod_vat" id="shopprod_id" class="v12">
 159  
 160      <?php
 161      
 162      if( ! $plugin['data']['shop_pref_vat'] = _getConfig('shop_pref_vat') ) {
 163          $plugin['data']['shop_pref_vat'] = array('0.00');
 164          _setConfig('shop_pref_vat',     $plugin['data']['shop_pref_vat'],     'module_shop');
 165      }
 166      
 167      $add_option = '';
 168      $add_vat    = array();
 169      
 170      foreach( $plugin['data']['shop_pref_vat'] as $value ) {
 171          echo '<option value="'.$value.'"';
 172          if($plugin['data']['shopprod_vat'] == $value) {
 173              echo ' selected="selected"';
 174          } elseif( ! empty($plugin['data']['shopprod_vat']) && ! in_array($plugin['data']['shopprod_vat'], $plugin['data']['shop_pref_vat']) ) {
 175              $plugin['data']['shop_pref_vat'][] = $plugin['data']['shopprod_vat'];
 176              natsort($plugin['data']['shop_pref_vat']);
 177              _setConfig('shop_pref_vat',     $plugin['data']['shop_pref_vat'],     'module_shop');
 178              
 179              $add_option .= LF . '<option value="'.$plugin['data']['shopprod_vat'].'" selected="selected">';
 180              $add_option .= number_format($plugin['data']['shopprod_vat'], 2, $BLM['dec_point'], $BLM['thousands_sep']);
 181              $add_option .= '</option>';
 182          }
 183          echo '>';
 184          echo number_format($value, 2, $BLM['dec_point'], $BLM['thousands_sep']);
 185          echo '</option>' . LF;
 186      }
 187      echo $add_option;
 188      
 189      ?>
 190  
 191              </select></td>
 192              
 193              <td>&nbsp;%</td>
 194              
 195          
 196          </tr>
 197                  
 198              </table></td>
 199      
 200      </tr>
 201      
 202      
 203      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td></tr>
 204      
 205      <tr> 
 206          <td align="right" class="chatlist tdtop4"><?php echo $BLM['shopprod_size'] ?>:&nbsp;</td>
 207          <td><table cellpadding="0" cellspacing="0" border="0" summary="">
 208          
 209              <tr>
 210                  <td><textarea name="shopprod_size" type="text" id="shopprod_size" class="v12 width125" rows="5" cols="15"><?php echo html_specialchars($plugin['data']['shopprod_size']) ?></textarea></td>
 211          
 212                  <td align="right" class="chatlist width100 tdtop4"><?php echo $BLM['shopprod_color'] ?>:&nbsp;</td>
 213                  <td><textarea name="shopprod_color" type="text" id="shopprod_color" class="v12 width170" rows="5" cols="15"><?php echo html_specialchars($plugin['data']['shopprod_color']) ?></textarea></td>
 214          
 215                  </tr>
 216                  
 217              </table></td>
 218      </tr>
 219      
 220      
 221      
 222  
 223  <tr><td colspan="2" class="rowspacer7x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 224  
 225  
 226      <tr> 
 227          <td align="right" class="chatlist tdbottom3"><?php echo $BLM['shopprod_description0'] ?>:&nbsp;</td>
 228          <td>&nbsp;</td>
 229      </tr>
 230      <tr>
 231          <td colspan="2" class="tdbottom4"><?php
 232  
 233          $wysiwyg_editor = array(
 234              'value'        => $plugin['data']['shopprod_description0'],
 235              'field'        => 'shopprod_description0',
 236              'height'    => '250px',
 237              'width'        => '536px',
 238              'rows'        => '10',
 239              'editor'    => $_SESSION["WYSIWYG_EDITOR"],
 240              'lang'        => 'en'
 241          );
 242          
 243          include (PHPWCMS_ROOT.'/include/inc_lib/wysiwyg.editor.inc.php');
 244          
 245          ?></td>
 246      </tr>
 247  
 248      <tr> 
 249          <td align="right" class="chatlist tdbottom3"><?php echo $BL['be_cnt_description'] ?>:&nbsp;</td>
 250          <td>&nbsp;</td>
 251      </tr>
 252      <tr>
 253          <td colspan="2" class="tdbottom4"><?php
 254  
 255          $wysiwyg_editor = array(
 256              'value'        => $plugin['data']['shopprod_description1'],
 257              'field'        => 'shopprod_description1',
 258              'height'    => '250px',
 259              'width'        => '536px',
 260              'rows'        => '10',
 261              'editor'    => $_SESSION["WYSIWYG_EDITOR"],
 262              'lang'        => 'en'
 263          );
 264          
 265          include (PHPWCMS_ROOT.'/include/inc_lib/wysiwyg.editor.inc.php');
 266          
 267          ?></td>
 268      </tr>
 269      
 270      <tr> 
 271          <td align="right" class="chatlist tdtop4"><?php echo $BLM['shopprod_description1'] ?>:&nbsp;</td>
 272          <td colspan="2" class="tdbottom3"><textarea name="shopprod_description2" id="shopprod_description2" rows="5" class="v12 width400"><?php echo html_specialchars($plugin['data']['shopprod_description2']) ?></textarea></td>
 273      </tr>
 274      
 275      <tr> 
 276          <td align="right" class="chatlist tdtop4"><?php echo $BLM['shopprod_description2'] ?>:&nbsp;</td>
 277          <td colspan="2"><textarea name="shopprod_description3" id="shopprod_description3" rows="5" class="v12 width400"><?php echo html_specialchars($plugin['data']['shopprod_description3']) ?></textarea></td>
 278      </tr>
 279      
 280  
 281  <tr><td colspan="2" class="rowspacer7x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 282  
 283  <tr>
 284      <td align="right" valign="top" class="chatlist tdtop4"><?php echo $BL['be_cnt_image'] ?>:&nbsp;</td>
 285      <td valign="top" class="tdbottom3"><table border="0" cellpadding="0" cellspacing="0" summary="">
 286      <tr>
 287          <td valign="top"><select name="shopprod_images[]" size="<?php 
 288          
 289      $img_count = isset($plugin['data']['shopprod_images']) && is_array($plugin['data']['shopprod_images']) ? count($plugin['data']['shopprod_images']) : 0;        
 290          
 291      echo $img_count+5 
 292          
 293          ?>" multiple="multiple" class="f11 width360" id="shopprod_images">
 294  <?php
 295  
 296  $img_thumbs = '';
 297  
 298  if($img_count) {
 299  
 300      // browse images and list available
 301      // will be visible only when aceessible
 302      foreach($plugin['data']['shopprod_images'] as $key => $value) {
 303      
 304          // 0   :1       :2   :3        :4    :5     :6      :7       :8
 305          // dbid:filename:hash:extension:width:height:caption:position:zoom
 306          $thumb_image = get_cached_image(
 307                          array(    "target_ext"    =>    $plugin['data']['shopprod_images'][$key]['f_ext'],
 308                                  "image_name"    =>    $plugin['data']['shopprod_images'][$key]['f_hash'] . '.' . $content['image_list']['images'][$key]['f_ext'],
 309                                  "thumb_name"    =>    md5(    $plugin['data']['shopprod_images'][$key]['f_hash'].
 310                                                              $phpwcms["img_list_width"].
 311                                                              $phpwcms["img_list_height"].
 312                                                              $phpwcms["sharpen_level"]
 313                                                          )
 314                                )
 315                              );
 316  
 317          if($thumb_image != false) {
 318          
 319              // image found
 320              echo '<option value="' . $plugin['data']['shopprod_images'][$key]['f_id'] . '">';
 321              $img_name = html_specialchars($plugin['data']['shopprod_images'][$key]['f_name']);
 322              echo $img_name . '</option>'.LF;
 323  
 324              if($imgx == 4) {
 325                  $img_thumbs .= '<br /><img src="img/leer.gif" alt="" border="0" width="1" height="2" /><br />';
 326                  $imgx = 0;
 327              }
 328              if($imgx) {
 329                  $img_thumbs .= '<img src="img/leer.gif" alt="" border="0" width="2" height="1" />';
 330              }
 331              $img_thumbs .= '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] .'" border="0" '.$thumb_image[3].' alt="'.$img_name.'" title="'.$img_name.'" />';
 332  
 333              $plugin['data']['shopprod_caption'][] = html_specialchars($plugin['data']['shopprod_images'][$key]['caption']);
 334  
 335              $imgx++;
 336          }
 337  
 338      }
 339  
 340  }
 341  
 342  ?>
 343            </select></td>
 344                    <td valign="top"><img src="img/leer.gif" alt="" width="5" height="1" /></td>
 345                    <td valign="top">
 346                    <a href="#" title="<?php echo $BL['be_cnt_openimagebrowser'] ?>" onclick="tmt_winOpen('filebrowser.php?opt=5&amp;target=nolist','imageBrowser','width=380,height=300,left=8,top=8,scrollbars=yes,resizable=yes',1);return false;"><img src="img/button/open_image_button.gif" alt="" width="20" height="15" border="0" /></a>
 347                    <br /><img src="img/leer.gif" alt="" width="1" height="4" /><br /><a href="#" title="<?php echo $BL['be_cnt_sortup'] ?>" onclick="moveOptionUp(img_field);return false;"><img src="img/button/image_pos_up.gif" alt="" width="10" height="9" border="0" /></a><a href="#" title="<?php echo $BL['be_cnt_sortdown'] ?>" onclick="moveOptionDown(img_field);return false;"><img src="img/button/image_pos_down.gif" alt="" width="10" height="9" border="0" /></a>
 348                    <br /><img src="img/leer.gif" alt="" width="1" height="4" /><br /><a href="#" onclick="removeSelectedOptions(img_field);return false;" title="<?php echo $BL['be_cnt_delimage'] ?>"><img src="img/button/del_image_button1.gif" alt="" width="20" height="15" border="0" /></a></td>
 349        </tr>
 350                </table>
 351  <?php
 352  
 353      if($img_thumbs) { 
 354          echo '
 355          <table border="0" cellspacing="0" cellpadding="0" summary="">
 356          <tr>
 357                  <td style="padding:5px 0 5px 0;">'.$img_thumbs.'</td>
 358              </tr>
 359          </table>';
 360      }
 361  
 362  ?></td>
 363                </tr>
 364                
 365      <tr>
 366          <td align="right" valign="top" class="chatlist tdtop4"><?php echo $BL['be_cnt_caption'] ?>:&nbsp;</td>
 367          <td valign="top"><textarea name="shopprod_caption" cols="40" rows="<?php echo $img_count+5 ?>" wrap="off" class="f11 width400" id="shopprod_caption"><?php echo implode(' '.LF, $plugin['data']['shopprod_caption']) ?></textarea></td>
 368      </tr>
 369      
 370      <tr><td colspan="2" class="rowspacer7x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 371  
 372      <tr> 
 373          <td align="right" class="chatlist"><?php echo $BLM['shopprod_url'] ?>:&nbsp;</td>
 374          <td><input name="shopprod_url" type="text" id="shopprod_url" class="v12 width400" value="<?php echo html_specialchars($plugin['data']['shopprod_url']) ?>" size="30" maxlength="250" /></td>
 375      </tr>
 376  
 377      <tr><td colspan="2" class="rowspacer7x7"><img src="img/leer.gif" alt="" width="1" height="1" /></td></tr>
 378      
 379      
 380      <tr>
 381          <td align="right" class="chatlist tdtop3"><?php echo $BLM['prod_cat'] ?>:&nbsp;</td>
 382          <td><table cellpadding="0" cellspacing="0" border="0" summary="">
 383          
 384              <tr>
 385                  <td><select name="shopprod_category[]" size="7" multiple="multiple" class="v12 width400" id="shopprod_category">
 386          <?php 
 387          $t = array();
 388          foreach($plugin['data']['categories'] as $value) {
 389          
 390              echo '<option value="'.$value['cat_id'].'"';
 391              if(in_array($value['cat_id'], $plugin['data']['shopprod_category'])) {
 392                  echo ' selected="selected"';
 393                  $t[] = $value['category'];
 394              }
 395              if($value['cat_status'] == 0) {
 396                  echo ' style="font-style:italic;"';
 397              }
 398              echo '>';
 399              if($value['cat_pid']) {
 400                  echo '&nbsp;&nbsp;&nbsp;';
 401              }
 402              echo html_specialchars($value['cat_name']).'</option>'.LF;
 403          
 404          }
 405          
 406          ?>
 407              </select></td>
 408              </tr>
 409          <?php    if(count($t)) {        ?>
 410              <tr>
 411                  <td class="tdtop3 v10"><?php echo nl2br(html_specialchars(implode(', ', $t))) ?></td>
 412              </tr>
 413          <?php    }    ?>
 414  
 415          </table></td>        
 416          
 417      </tr>
 418      
 419      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td></tr>
 420      
 421      
 422      <tr> 
 423          <td align="right" class="chatlist"><?php echo $BLM['shopprod_tag'] ?>:&nbsp;</td>
 424          <td><input name="shopprod_tag" type="text" id="shopprod_tag" class="v12 width400" value="<?php echo html_specialchars( trim($plugin['data']['shopprod_tag'], ',') ) ?>" size="30" maxlength="250" /></td>
 425      </tr>
 426      
 427      
 428      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="18" /></td></tr>
 429      
 430      <tr>
 431          <td align="right" class="chatlist"><?php echo $BL['be_ftptakeover_status'] ?>:&nbsp;</td>
 432          <td><table border="0" cellpadding="0" cellspacing="0" summary="">        
 433              <tr>
 434                  <td><input type="checkbox" name="shopprod_status" id="shopprod_status" value="1"<?php is_checked($plugin['data']['shopprod_status'], 1) ?> /></td>
 435                  <td><label for="shopprod_status"><?php echo $BL['be_cnt_activated'] ?></label>&nbsp;&nbsp;&nbsp;</td>
 436                  <td><input type="checkbox" name="shopprod_listall" id="shopprod_listall" value="1"<?php is_checked($plugin['data']['shopprod_listall'], 1) ?> /></td>
 437                  <td><label for="shopprod_listall"><?php echo $BLM['shopprod_listall'] ?></label></td>
 438              </tr>
 439          </table></td>
 440      </tr>
 441      
 442      <tr><td colspan="2"><img src="img/leer.gif" alt="" width="1" height="10" /></td>
 443      </tr>
 444      <tr> 
 445          <td>&nbsp;</td>
 446          <td>
 447              <input name="submit" type="submit" class="button10" value="<?php echo empty($plugin['data']['shopprod_id']) ? $BL['be_admin_fcat_button2'] : $BL['be_article_cnt_button1'] ?>" />
 448              <input name="save" type="submit" class="button10" value="<?php echo $BL['be_article_cnt_button3'] ?>" />
 449              &nbsp;&nbsp;&nbsp;&nbsp;
 450              <input name="close" type="submit" class="button10" value="<?php echo $BL['be_admin_struct_close'] ?>" />
 451          </td>
 452      </tr>
 453  </table>
 454  </form>
 455  <script language="javascript" type="text/javascript">
 456  <!--
 457  var img_field = getObjectById('shopprod_images');
 458  //-->
 459  </script>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7