Location: PHPKode > scripts > ontoProdukt > viewer.class.php
<?
  /**
 * Třída viewer
 * ______________ 
 * slouží pro zobrazení sady formulářů. Pokud jsou 
 * k dispozici data, tak je zobrazím
 *  
 * @version		1.0
 * @author 		Václav Mareš
 */


 class viewer {

  /**
 * Zobrazení formuláře pro popis společnosti.
 */  
  var $translation;
  var $url_main_page;
  var $official_name;
  var $title;

  
  function CompanyDescription($translation) 
  {
  $this->translation = $translation;
  echo "
    <fieldset>
      <legend accesskey='d'>$translation[COMPANY_DESCRIPTION_LEGEND]</legend>
      <table>
      <tr>
        <td>$translation[URL_MAIN_PAGE]</td>
        <td>
          <input type='text' id='curl' name='url_main_page' size='25'  class='required url' value='"; if ($this->url_main_page != "") echo $this->url_main_page; else echo "http://"; echo "'> 
          <a href='./index.php#link' style='text-decoration: none'>?</a>
        </td>
      </tr>
      <tr>
        <td>$translation[OFFICIAL_NAME]</td>
        <td>
          <input type='text' name='official_name' id='cname' size='25' class='required' minlength='2' value='$this->official_name'>
          <a href='./index.php#title' style='text-decoration: none'>?</a>
        </td>
      </tr>
      <tr>
        <td>$translation[COMPANY_EMAIL]</td>
        <td>        
          <input type='text' name='companyEmail' id='cemail' size='25' class='required email' value='$this->companyEmail'>
           <a href='./index.php#title' style='text-decoration: none'></a>
        </td>
      </tr>
      <tr>
        <td>$translation[COMPANY_STREET_ADRES]</td>
        <td>
          <input type='text' name='street_address' id='cnstreet' size='25' class='required' minlength='2' value='";echo $this->company_adres[0]; echo "'>
          <a href='./index.php#street_address' style='text-decoration: none'>?</a> 
        </td>
      </tr>
      <tr>
        <td>$translation[COMPANY_CITY_ADRES]</td>
        <td>
          <input type='text' name='locality' id='cnlocality' size='25' class='required' minlength='2' value='";echo $this->company_adres[1]; echo "'>
           <a href='./index.php#street_address' style='text-decoration: none'>?</a>
        </td>
      <tr>
       <td>$translation[COMPANY_COUNTRY_ADRES]</td>
       <td>";
          require_once  "req/listOfCountrys.php";
            echo " <a href='./index.php#country_name' style='text-decoration: none'>?</a>
        </td>
      </tr>
      <tr>
        <td>$translation[POSTAL_CODE]</td><td><input type='cePostalCode'  size='10' name='postal_code' class='required postalCode' value='";echo $this->company_adres[3]; echo "'>
          <a href='./index.php#postal_code' style='text-decoration: none'>?</a>
        </td>
      </tr>
      <td colspan='2'>$translation[COMPANY_DESCRIPTION]<br>
        <textarea rows='10' cols='40' name='companyDescription' class='required' minlength2='20' maxlength='512'>$this->companyDescription
        </textarea>
      </td>
    </table>
    </fieldset>";
    } 
 
    
  /**
 * Zobrazení formuláře pro popis produktu.
 */
 
  function XMLProductDescription($translation) 
  { 
  if ($this->id == "") $id = $this->absent_id; //feed neobsahuje id (generované automaticky z parseru)
  if ($this->absent_id == "") $id = $this->id ; //id předané z feedu
    echo "
     <div id='$id'>    
      <fieldset>
        <legend accesskey='p'>$translation[PRODUCT_DESCRIPTION_NEXT_LEGEND]&nbsp;$id</legend> 
          <br>$translation[CATEGORY_TEXT]<br>"; 
            require  'req/category.php';
            echo "     
        <table>    
          <tbody>    
            <tr>
              <td>$translation[PRODUCTNAME_MAIN_NAME]</td>
              <td><input type='text' value='$this->title' name='name$id' class='required' minlength='3'></td>  
            </tr> 
            <tr>
              <td>$translation[PRODUCTNAME_SHORT_NAME]</td>
              <td><input type='text' value='$this->productname' name='productname$id'  minlength='3'></td>  
            </tr> 
            <tr>
              <td>$translation[PRODUCTNAME_LONG_NAME]</td>
              <td><input type='text' value='$this->productnameext' name='productnameext$id'  minlength='3'></td>  
            </tr>  
            <tr>
              <td>$translation[PRICE]</td>
              <td><input type='text' value='$this->price' name='price$id' size='2' class='required price'></td>               
            </tr>
            <tr>
              <td>$translation[VAT]</td>
              <td><input type='text' value='$this->vat' name='vat$id' size='2' class='required price'></td>               
            </tr> 
            <tr>
              <td>$translation[PRICE_VAT]</td>
              <td><input type='text' value='$this->price_vat' name='tax_rate$id' size='2' class='price'></td>               
            </tr>  
            <tr>
              <td>$translation[DUES]</td>    
              <td><input type='text' value='$this->dues' name='dues$id'/></td>
            </tr>
            <tr>    
              <td>$translation[DELIVERY_DATE]</td>    
              <td><input type='text' value='$this->delivery_date' name='delivery_date$id'/></td>
            </tr>
            <tr>    
              <td>$translation[SHOP_DEPOT]</td>    
              <td><input type='text' value='$this->shop_depots' name='shop_depots$id'/></td>
            </tr>
            <tr>    
              <td>$translation[FIRMY_CZ]</td>    
              <td><input type='text' value='$this->firmy_cz' name='firmy_cz$id'/></td>
            </tr>
            <tr>  
              <td>$translation[MANUFACTURER]</td>    
              <td><input type='text' value='$this->manufacturer' name='manufacturer$id'/></td>
            </tr>
            <tr>    
              <td>$translation[EAN]</td>  <!--pro knihy např. ISBN -->    
              <td><input type='text' value='$this->ean' name='ean$id'/></td>
            </tr>
            <tr>    
              <td>$translation[VARIANT]</td>    
              <td><input type='text' value='$this->variant' name='variant$id'/></td>
              <!-- <td>Přidat variantu</td> -->
            </tr>  
            <tr>
              <td>$translation[PRODUCT_NUMBER]</td> 
              <td><input type='text' name='code$id' value='$this->code'></td>
            </tr> 
            <tr> 
              <td>$translation[PRODUCT_URL] *</td>    
              <td><input type='text' value='"; if ($this->link != "") echo $this->link; else echo "http://"; echo "' name='product_url$id' class='required url'></td>   <!-- v případě, že nedošlo k předání hodnoty URL zobrazím pouze http://-->
            </tr>  
            <tr>    
              <td>$translation[PRODUCT_IMAGE_URL]</td> <!-- formát XML zboží.cz nevyžaduje odkaz na obrázek produktu -->   
              <td><input type='text' value='"; if ($this->image_url != "") echo $this->image_url; else echo "http://"; echo "' name='image_url$id' class='url'></td>    
            </tr>
            <tr>
              <td>$translation[PRODUCT_CONDITION]</td>
              <td>
              <select name='quality$id' style='width:100px;'>
                <option value='new' ";if ($this->condition == "new") echo "selected"; echo "> $translation[PRODUCT_CONDITION_NEW]</option>  
                <option value='bazaar' ";if ($this->condition == "Bazaar" or $this->condition == "bazaar" or $this->condition == "Used" or $this->condition == "Refurbished") echo "selected"; echo "> $translation[PRODUCT_CONDITION_BAZAAR]</option> <!-- v případě, že parsruji feed v jiném formátu, než XML zbozi.cz, tak musím ušetřit položku condition => Used, Bazzar, bazzar..--->
              </select> 
              </td>
            </tr> 
            </tr>
              <td>$translation[TOLLFREE]</td>
              <td><input type='text' name='tollfree$id' size='2' value='$this->tollfree'></td>          
            </tr>    
            <tr>    
              <td colspan='2'>$translation[PRODUCT_DESCRIPTION]<br>
                <textarea rows='10' cols='40' name='productDescription$id' class='required' minlength2='20' maxlength='512'>$this->description</textarea>
              </td>
            </tr>
          </tbody>
        </table>
      </fieldset>
          <div align='right'>";
          if ($id != "1"){
          ?>            
              <a onclick="RemoveProdukt('<? echo $id; ?>')"  href="javascript:;">odstranit</a><? }echo "
          </div> 
    </div>";
  }
  
  function Heureka_XMLProductDescription($translation) 
  { 
  if ($this->id == "") $id = $this->absent_id; //feed neobsahuje id (generované automaticky z parseru)
  if ($this->absent_id == "") $id = $this->id ; //id předané z feedu
    echo "
     <div id='$id'>    
      <fieldset>
        <legend accesskey='p'>$translation[PRODUCT_DESCRIPTION_NEXT_LEGEND]&nbsp;$id</legend> 
          <br>$translation[CATEGORY_TEXT]<br>"; 
            require  'req/category.php';
            echo "     
        <table>    
          <tbody>    
            <tr>
              <td>$translation[PRODUCTNAME_MAIN_NAME]</td>
              <td><input type='text' value='$this->title' name='name$id' class='required' minlength='3'></td>  
            </tr>  
            <tr>
              <td>$translation[PRICE]</td>
              <td><input type='text' value='$this->price' name='price$id' size='2' class='required price'></td>               
            </tr>
            <tr>
              <td>$translation[VAT]</td>
              <td><input type='text' value='$this->vat' name='vat$id' size='2' class='required price'></td>               
            </tr> 
            <tr>
              <td>$translation[PRICE_VAT]</td>
              <td><input type='text' value='$this->price_vat' name='tax_rate$id' size='2' class='price'></td>               
            </tr>  
            <tr>
              <td>$translation[DUES]</td>    
              <td><input type='text' value='$this->dues' name='dues$id'/></td>
            </tr>
            <tr>    
              <td>$translation[DELIVERY_DATE]</td>    
              <td><input type='text' value='$this->delivery_date' name='delivery_date$id'/></td>
            </tr>
            <tr>  
              <td>$translation[MANUFACTURER]</td>    
              <td><input type='text' value='$this->manufacturer' name='manufacturer$id'/></td>
            </tr>
            <tr>    
              <td>$translation[EAN]</td>  <!--pro knihy např. ISBN -->    
              <td><input type='text' value='$this->ean' name='ean$id'/></td>
            </tr>
            <tr>    
              <td>$translation[HEUREKA_VARIANT]</td> <!--více variant by šlo řešit pomocí nějakého oddělovače -->   
              <td><input type='text' value='$this->variant' name='variant$id'/></td>
              <!-- <td>Přidat variantu</td> -->
            </tr>
            <tr>    
              <td>$translation[VAL]</td>
                  <td><input type='text' name='val$id' size='2' value='$this->val'></td>
               </td>
            </tr>    
            <tr> 
              <td>$translation[PRODUCT_URL] *</td>    
              <td><input type='text' value='"; if ($this->link != "") echo $this->link; else echo "http://"; echo "' name='product_url$id' class='required url'></td>   <!-- v případě, že nedošlo k předání hodnoty URL zobrazím pouze http://-->
            </tr>  
            <tr>    
              <td>$translation[PRODUCT_IMAGE_URL_NESSERY]</td> <!-- formát XML zboží.cz nevyžaduje odkaz na obrázek produktu -->   
              <td><input type='text' value='"; if ($this->image_url != "") echo $this->image_url; else echo "http://"; echo "' name='image_url$id' class='required url'></td>    
            </tr>
            <tr>
              <td>$translation[PRODUCT_CONDITION]</td>
              <td>
              <select name='quality$id' style='width:100px;'>
                <option value='new' ";if ($this->condition == "new") echo "selected"; echo "> $translation[PRODUCT_CONDITION_NEW]</option>  
                <option value='bazaar' ";if ($this->condition == "Bazaar" or $this->condition == "bazaar" or $this->condition == "Used" or $this->condition == "Refurbished") echo "selected"; echo "> $translation[PRODUCT_CONDITION_BAZAAR]</option> <!-- v případě, že parsruji feed v jiném formátu, než XML zbozi.cz, tak musím ušetřit položku condition => Used, Bazzar, bazzar..--->
              </select> 
              </td>
            </tr> 

            <tr>    
              <td>$translation[ISBN]</td>
                  <td><input type='text' name='isbn$id' value='$this->isbn'></td>
               </td>
            </tr> 
            <tr>    
              <td colspan='2'>$translation[PRODUCT_DESCRIPTION]<br>
                <textarea rows='10' cols='40' name='productDescription$id' class='required' minlength2='20' maxlength='512'>$this->description</textarea>
              </td>
            </tr>      
          </tbody>
        </table>
      </fieldset>
          <div align='right'>";
          if ($id != "1"){
          ?>            
              <a onclick="RemoveProdukt('<? echo $id; ?>')"  href="javascript:;">odstranit</a><? }echo "
          </div> 
    </div>";
  }

  function RSS2ProductDescription($translation) 
  {
  if ($this->id == "") $id = $this->absent_id; //feed neobsahuje id (generované automaticky z parseru)
  if ($this->absent_id == "") $id = $this->id ; //id předané z feedu
  echo "
  <div id='$id '>    
  <fieldset>
      <legend accesskey='p'>$translation[PRODUCT_DESCRIPTION_NEXT_LEGEND] &nbsp;$id </legend> 
        <br>$translation[CATEGORY_TEXT]<br>";
          require  "req/category.php";
          echo "   
      <table>    
        <tbody>    
          <tr>
            <td>$translation[PRODUCTNAME_MAIN_NAME]</td>
            <td><input type='text' value='$this->title' name='name$id' class='required' minlength='3'></td>  
          </tr>  
          <tr>
            <td>$translation[PRICE]</td>
            <td><input type='text' value='$this->price' name='price$id' size='2' class='required price'></td>               
          </tr>  
          <tr>    
            <td>$translation[MANUFACTURER]</td>    
            <td><input type='text' value='$this->manufacturer' name='manufacturer$id'/></td>
          </tr>
          <tr>    
            <td>$translation[PRODUCT_NUMBER]</td>    
            <td><input type='text' value='$this->code' name='upc$id'/></td>
          </tr>
          <tr> 
            <td>$translation[ISBN]</td>  
            <td><input type='text' value='$this->mpn' name='code$id'/></td>
          </tr> 
          <tr> 
            <td>$translation[PRODUCT_URL]</td>    
            <td><input type='text' value='"; if ($this->link != "") echo $this->link; else echo "http://"; echo "' name='product_url$id' class='url'></td>    
          </tr>  
          <tr>    
            <td>$translation[PRODUCT_IMAGE_URL] *</td>    
            <td><input type='text' value='"; if ($this->image_url != "") echo $this->image_url; else echo "http://"; echo "' name='image_url$id' class='required url'></td>    
          </tr>
          <tr> 
            <td>$translation[QUANTITY]</td>    
            <td><input type='text' name='quantity$id' size='2' value='$this->quantity'></td>    
          </tr> 
          <tr> 
            <td>$translation[PRODUCT_CONDITION]</td>
            <td>
            <select name='quality$id' style='width:100px;'>    
              <option value='New'";if ($this->condition == "New") echo "selected"; echo "> $translation[PRODUCT_CONDITION_NEW]</option>  
              <option value='Used'";if ($this->condition == "Bazaar" or $this->condition == "bazaar" or $this->condition == "Used") echo "selected"; echo "> $translation[PRODUCT_CONDITION_BAZAAR]</option>
              <option value='Refurbished'";if ($this->condition == "Refurbished") echo "selected"; echo "> $translation[PRODUCT_CONDITION_REFURBISHED]</option> 
            </select> 
            </td>
          </tr>   
          <tr>    
            <td colspan='2'>$translation[PRODUCT_DESCRIPTION]<br>
              <textarea rows='10' cols='40' name='productDescription$id' class='required' minlength2='20' maxlength='512'>$this->description</textarea>
            </td>
          </tr>
        </tbody>
      </table>
    </fieldset>
          <div align='right'>";
          if ($id  != "1"){
          ?>            
              <a onclick="RemoveProdukt('<?echo $id;?>')"  href="javascript:;">odstranit</a><? }echo "
          </div> 
    </div>
     ";
  }
  

  
  function RDF_OPProductDescription($translation) 
  {
  if ($this->id == "") $id = $this->absent_id; //feed neobsahuje id (generované automaticky z parseru)
  if ($this->absent_id == "") $id = $this->id ; //id předané z feedu
  echo "
  <div id='$id'>    
  <fieldset>
      <legend accesskey='p'>$translation[PRODUCT_DESCRIPTION_NEXT_LEGEND]&nbsp; $id</legend> 
        <br>$translation[CATEGORY_TEXT]<br>"; 
          require  "req/category.php";
          echo "  
      <table>    
        <tbody>    
          <tr>
            <td>$translation[PRODUCTNAME]</td>
            <td><input type='text' value='$this->title' name='name$id' class='required' minlength='3'></td>  
          </tr>  
          <tr>
            <td>$translation[PRICE_CZ]</td>
            <td><input type='text' value='$this->price' name='price$id' size='2' class='required price'></td>               
          </tr>
          <tr>    
            <td>$translation[CODE]</td>    
            <td><input type='text' value='$this->code' name='code$id'></td>    
          </tr>   
          <tr> 
            <td>$translation[PRODUCT_URL] *</td>    
            <td><input type='text' value='"; if ($this->link != "") echo $this->link; else echo "http://"; echo "' name='product_url$id' class='required url'></td>    
          </tr>  
          <tr>    
            <td>$translation[PRODUCT_IMAGE_URL]</td>    
            <td><input type='text' value='"; if ($this->image_url != "") echo $this->image_url; else echo "http://"; echo "' name='image_url$id' class='url'></td>    
          </tr>
  
          <tr>    
            <td>$translation[QUANTITY]</td>    
            <td><input type='text' value='$this->quantity' name='quantity$id' size='2'></td>    
          </tr>
          <tr> 
            <td>$translation[PRODUCT_CONDITION]</td>
            <td>
            <select name='quality$id' style='width:100px;'>    
              <option value='New'";if ($this->condition == "New") echo "selected"; echo "> $translation[PRODUCT_CONDITION_NEW]</option>  
              <option value='Bazaar'";if ($this->condition == "Bazaar" or $this->condition == "bazaar" or $this->condition == "Used") echo "selected"; echo "> $translation[PRODUCT_CONDITION_BAZAAR]</option>
              <option value='Refurbished'";if ($this->condition == "Refurbished") echo "selected"; echo "> $translation[PRODUCT_CONDITION_REFURBISHED]</option> 
            </select>
            </td>
          </tr>   
          <tr>    
            <td colspan='2'>$translation[PRODUCT_DESCRIPTION]<br>
              <textarea rows='10' cols='40' name='productDescription$id' class='required' minlength2='20' maxlength='512'>$this->description</textarea>
            </td>
          </tr>
        </tbody>
      </table>
    </fieldset>
    </div>";
  }
  
  function AddProduktLabel($type)
  { 
    echo "<div id='myDiv'></div>   <!--v případě kliknutní na přidat produkt sem bude vloženo nového pole s popisem produktu-->
           <input type='hidden' name='value' value='";if ($this->id == "") echo $this->absent_id; else echo $this->id; echo "' id='theValue' />   <!--předání posledního vypsaného ID produktu-->
           <input type='hidden' name='product_count'  id='theValue' />
          <p><a href='javascript:;' onclick='AddProdukt$type();'>Přidat produkt</a></p>";
  }   
  
    
  function BusinessDescription($translation) 
  {
  echo "
    <fieldset>
        <legend accesskey='p'>$translation[BUSINESS_DESCRIPTION_LEGEND]</legend>
        <table>
            <tr>
              <td>$translation[BUSINESS_PARTNERS]</td>
              <td colspan='2'><input type='checkbox' class='checkbox' name='businessPartners[]' value='End_Users' validate='required:true, minlength:1' checked>$translation[BUSINESS_PARTNER_END_USERS]</td>  
            </tr>
            <tr>
               <td></td> 
               <td colspan='2'>  
                  <input type='checkbox' class='checkbox' name='businessPartners[]' value='Business'>$translation[BUSINESS_PARTNER_BUSINESS]                                          
                  <input type='checkbox' class='checkbox' name='businessPartners[]' value='Public_Institutions'>$translation[BUSINESS_PARTNER_BUSINESS_PUBLIC_INSTITUTIONS] <!--Å¡koly, Å¡kolky...atd -->   
               </td>      
            </tr>
            <tr>
               <td>
                <label for='businessPartners[]' class='error'>$translation[BUSINESS_DESCRIPTION_ERROR_LEGEND]</label>
               </td>
            </tr> 
        </table>
      </fieldset>";
  }
    
    
  function DeliveryDescription($translation) 
  {
  echo "        
      <fieldset>
        <legend accesskey='p'>$translation[DELIVERY_DESCRIPTION_LEGEND]</legend>
        <table>
            <tr>
              <td>$translation[TYP_OF_DELIVERY]</td>
              <td colspan='2'>
                <input type='checkbox' class='checkbox' name='deliverer[]' value='CzechPost_office' validate='required:true, minlength:1' checked>$translation[CZECH_POST]<br> 
              </td>
            </tr>
              <td></td>
              <td colspan='2'>
                <input type='checkbox' class='checkbox' name='deliverer[]' value='UPS' >$translation[UPS]<br>  
                <input type='checkbox' class='checkbox' name='deliverer[]' value='DHL' >$translation[DHL]<br>                                        
                <input type='checkbox' class='checkbox' name='deliverer[]' value='Personal_Pick_Up'>$translation[PERSONAL_PICK_UP]  
                <input type='checkbox' class='checkbox' name='deliverer[]' value='DeliverySeller'>$translation[DELIVERY_SELLER]      
              </td>
            </tr>
            <tr>
               <td>
                 <label for='deliverer[]' class='error'>$translation[DELIVERY_DESCRIPTION_ERROR_LEGEND]</label>
               </td>
            </tr>   
        </table>
      </fieldset> 		
      </tr>   
    </table>
    </fieldset>";
  } 
  

}


?> 
Return current item: ontoProdukt