foreach ($periods as $pk => $p) {
     $td_id = 'level-target-' . $pk;
     $result .= '<td id="' . $td_id . '" class="tac">.</td>';
 }
 $result .= '</tr>';
 $result .= '</table></div>';
 //.draw-table
 $conf_key = forecasting::CONFIG_KEY_LEVELLING_RATIO_OUTSOURCING;
 $entry_os = '<input id="' . $conf_key . '" type="text" value="' . $forecasting_conf[$conf_key] . '" class="w040 tac" /> %';
 $conf_key = forecasting::CONFIG_KEY_LEVELLING_RATIO_INTERNAL;
 $entry_ptb = '<input id="' . $conf_key . '" type="text" value="' . $forecasting_conf[$conf_key] . '" class="w040 tac" /> %';
 $result .= '<div style="margin-top:20px;">' . '<h3>Default Allocation Ratio for Creating Levelling Orders</h3>' . '<table class="form" border="0" cellpadding="0" cellspacing="0">' . '<tr><td class="label">Outsourcing</td><td class="w080">' . $entry_os . '</td></tr>' . '<tr><td>Internal (PTB)</td><td>' . $entry_ptb . '</td></tr>' . '</table>' . '</div>';
 $ltf_cols_list = '';
 if (isset($forecasting_conf[forecasting::CONFIG_KEY_LEVELLING_COLLECTION_IDS]) && $forecasting_conf[forecasting::CONFIG_KEY_LEVELLING_COLLECTION_IDS] != '') {
     $cols_ltf_filter = 's.styles_id IN (' . $forecasting_conf[forecasting::CONFIG_KEY_LEVELLING_COLLECTION_IDS] . ')';
     $cols_ltf = $class_s->retrieveList('L', $cols_ltf_filter);
     foreach ($cols_ltf as $col) {
         $ltf_cols_list .= displayLTFCollection($col['styles_id'], $col['name'], $col['products']);
     }
     $cols_ltf_unlisted_filter = 's.styles_id NOT IN (' . $forecasting_conf[forecasting::CONFIG_KEY_LEVELLING_COLLECTION_IDS] . ')';
 } else {
     $cols_ltf_unlisted_filter = '';
 }
 $cols_ltf_unlisted = $class_s->retrieveList('L', $cols_ltf_unlisted_filter);
 $cols_ltf_combo_options = array();
 foreach ($cols_ltf_unlisted as $col) {
     $cols_ltf_combo_options[$col['styles_id']] = $col['name'] . ' (' . $col['products'] . ')';
 }
 $cols_ltf_combo = '<div id="level-col-add-block" style="display:none;">' . '<select id="level-col-combo">' . loadComboListFromArray($cols_ltf_combo_options) . '</select>' . '<input id="level-col-add" type="button" value="add" />' . '</div>';
 $ltf_cols_list .= '<div id="level-col-plus" class="ui-state-default' . ' ui-corner-all"><span class="ui-icon ui-icon-plus pointer">' . '</span></div>' . $cols_ltf_combo;
 $result .= '<div style="margin-top:20px;">' . '<h3>Product Attributes - Collection for LTF / Levelling</h3>' . '<div id="level-collections">' . $ltf_cols_list . '</div>' . '</div>';
Ejemplo n.º 2
0
 function drawDetailTable($editable = true, $showImage = true, $columns = 1)
 {
     use_class('styles');
     $class_s = new styles();
     $design_id = $this->id;
     $original_products_id = $this->original_products_id;
     $element_id = $this->element_id;
     $prod_id_disabled = $this->original_products_id != '' ? ' readonly="readonly"' : '';
     $el_id_disabled = $this->element_id != '' ? ' readonly="readonly"' : '';
     $design_name = $this->name;
     $design_owner = ucfirst($this->owner_name);
     $attr_title = 'Product Attributes';
     if ($editable) {
         $sty_disabled = '';
         //$descat_disabled = ($showImage==='copy' || is_null($this->id) || $this->status=='1' || $this->status=='2' || $this->status=='11') ? '' : ' disabled="disabled"';
         $descat_disabled = ' disabled="disabled"';
         $prod_ref_hidden = true;
         $descat_hidden = '<input type="hidden" name="cat" value="' . $this->category . '" />';
         //used this to avoid cat value not submitted when its disabled
         #$destype_hidden = '<input type="hidden" name="type" value="'.$this->type.'" />';   //DISABLED (waiting status from design team need to activate or not)
         if ($showImage === 'copy' || is_null($this->id) || $this->status == '1' || $this->status == '2' || $this->status == '11') {
             $descat_disabled = '';
             $descat_hidden = '';
             $prod_id_disabled = '';
             $prod_ref_hidden = false;
             #$destype_hidden = '';  //DISABLED (waiting status from design team need to activate or not)
         }
         #$destype_disabled = $descat_disabled; //DISABLED (waiting status from design team need to activate or not)
         $destype_array[""] = 'Please select...';
         $descat_array[""] = 'Please select...';
         $destype_array = array_merge($destype_array, $this->getDesignType());
         $descat_array = array_merge($descat_array, $this->getDesignCategory());
         if (is_null($this->id)) {
             if ($this->category == 'R') {
                 $descat_array = array('R' => 'Recombination');
             } elseif ($this->category == 'W') {
                 $descat_array = array('W' => 'New Wax');
             } elseif ($this->category == 'E') {
                 $descat_array = array('E' => 'Revision');
             }
             //elseif($this->category=='V') $descat_array = array('V'=>'Variation');
             //elseif($this->category=='RV') $descat_array = array('R'=>'Recombination', 'V'=>'Variation');
         }
         $design_id = '<input type="text" name="designs_id" class="input" value="' . $design_id . '" readonly="readonly" />';
         $design_owner = '<input type="text" name="owner_name" class="input" value="' . $design_owner . '" disabled="disabled" />';
         $designtype_combo = '<select id="type" name="type" class="input"' . $destype_disabled . '>' . loadComboListFromArray($destype_array, '', $this->type, false) . '</select>';
         $designcat_combo = $descat_hidden . '<select id="cat" name="cat" class="input"' . $descat_disabled . '>' . loadComboListFromArray($descat_array, '', $this->category, false) . '</select>';
         $procat_combo = comboProductsCategory('procat', 'procat', $this->products_category_id, 'input');
         $probra_combo = comboProductsBrand('probra', 'probra', $this->products_brand_id, 'input');
         $original_products_id = '<input type="text" id="products_id" name="products_id" class="input" ' . $prod_id_disabled . ' value="' . $original_products_id . '" maxlength="32" />';
         $original_products_id .= '<br /><small class="notice">Seperate multiple ID by comma</small>';
         $element_id = '<input type="text" id="element_id" name="element_id" class="input" ' . $el_id_disabled . ' value="' . $element_id . '" maxlength="32" />';
         $design_name = '<input type="text" id="name" name="name" class="input" value="' . $design_name . '" /></td>';
         $target_price = '<input type="text" id="price" name="price" class="input" value="' . $this->target_price . '" /> <span class="notice">EUR</span>';
         $option_none = '<option value="0">Please select attribute...</option>';
         $attr_title .= ' <span class="notice smallText">(optional)</span>';
         $attr_collection = '<select name="styles_id_L" class="input"' . $sty_disabled . '>' . $option_none . $class_s->drawComboOptions($this->styles_id_L, 'L') . '</select>';
         //            $attr_fashiongrd = '<select name="styles_id_F" class="input"'.$sty_disabled.'>'.$option_none.$class_s->drawComboOptions($this->styles_id_F, 'F').'</select>';
         $design_structures = array(1 => 'Open', 2 => '100% Copy', 3 => 'Similar');
         $design_structure = '<select name="structure_id" class="input"' . $desstruct_disabled . '><option value="">Please select structure...</option>' . loadComboListFromArray($design_structures, null, $this->structure_id) . '</select>';
         $design_contents = array(1 => 'Open', 2 => '100% Copy', 3 => 'Similar', 4 => '30% Deviation MUST');
         $design_content = '<select name="content_id" class="input"' . $descont_disabled . '><option value="">Please select content...</option>' . loadComboListFromArray($design_contents, null, $this->content_id) . '</select>';
     } else {
         global $product_categories_name;
         global $products_brands_name;
         $sty_disabled = ' disabled="disabled"';
         $designtype_combo = $this->getDesignType($this->type);
         $designcat_combo = $this->getDesignCategory($this->category);
         $procat_combo = $product_categories_name[$this->products_category_id];
         $probra_combo = $product_brands_name[$this->products_brand_id];
         $original_products_id = '<a href="?open=product-detail&amp;products_id=' . $original_products_id . '">' . $original_products_id . '</a>';
         $element_id = '<a href="?open=element&amp;id=' . $element_id . '">' . $element_id . '</a>';
         $target_price = $this->target_price . ' EUR';
         $styles = $class_s->retrieveList('', "s.styles_id IN ({$this->styles_id_L}, {$this->styles_id_F})");
         $styles_name = array();
         foreach ($styles as $style) {
             $styles_name[$style['styles_id']] = $style['name'];
         }
         $attr_collection = $this->styles_id_L > '0' ? $styles_name[$this->styles_id_L] : '<span class="notice">Unset</span>';
         //            $attr_fashiongrd = ($this->styles_id_F>'0') ? $styles_name[$this->styles_id_F] : '<span class="notice">Unset</span>';
     }
     $content = '';
     if (!$editable && $showImage && $columns == 2) {
         $img = webImage($this->image_1, '80', '80', 'Image 1', 'img-border');
         $img .= $this->image_2 != '' ? '<br /><br />' . webImage($this->image_2, '80', '80', 'Image 2', 'img-border') : '';
         $img .= $this->image_3 != '' ? '<br /><br />' . webImage($this->image_3, '80', '80', 'Image 3', 'img-border') : '';
         $img .= $this->image_4 != '' ? '<br /><br />' . webImage($this->image_4, '80', '80', 'Image 4', 'img-border') : '';
         $content .= '<div style="float:left;margin:7px 5px 0 0;">' . $img . '</div>';
     }
     $content .= '<div><table class="form" border="0" cellpadding="0" cellspacing="0">';
     if (!is_null($this->id)) {
         if (!$editable && $showImage && $columns == 1) {
             //                $img1 = webImage($this->image_1, '150', '150', 'Main Image', 'img-border').' ';
             $img1 = webImage($this->image_1, '80', '80', 'Image 1', 'img-border') . ' ';
             //                $img2 = webImage($this->image_2, '150', '150', 'Additional Image', 'img-border');
             $img2 = webImage($this->image_2, '80', '80', 'Image 2', 'img-border');
             $img3 = webImage($this->image_3, '80', '80', 'Image 3', 'img-border');
             $img4 = webImage($this->image_4, '80', '80', 'Image 4', 'img-border');
             $content .= '<tr><td>' . $img1 . '</td><td>' . $img2 . '</td><td>' . $img3 . '</td>' . $img4 . '<td></td></tr>';
         }
         if ($editable !== 'copy') {
             $content .= '<tr><td>Design ID</td><td>' . $design_id . '</td></tr>';
         }
     }
     $content .= '<tr><td class="label">Design Created by</td><td>' . $design_owner . '</td></tr>';
     //$hide_ori_pid = ($this->category=='R' || $this->category=='V') ? false : true;
     //        echo "<pre>";var_dump($this);die();
     if ($prod_ref_hidden) {
         $hide_ori_pid = $prod_ref_hidden && $this->original_products_id != '' ? false : true;
     } else {
         $hide_ori_pid = $prod_ref_hidden;
     }
     $content .= '<tr><td class="label">Design Type</td><td width="230">' . $designtype_combo . '</td></tr>';
     $content .= '<tr><td class="label">Design Category</td><td width="230">' . $designcat_combo . '</td></tr>';
     $content .= '<tr id="oriprodid"' . ($hide_ori_pid ? ' style="display:none;' : '') . '"><td>Product ID (Original)</td><td>' . $original_products_id . '</td></tr>';
     $content .= '<tr><td>Element ID</td><td>' . $element_id . '</td></tr>';
     $content .= '<tr><td>Product Category</td><td>' . $procat_combo . '</td></tr>';
     $content .= '<tr><td>Product Brand</td><td>' . $probra_combo . '</td></tr>';
     $content .= '<tr><td>' . (is_null($this->id) ? 'New ' : '') . 'Design Name</td><td>' . $design_name . '</tr>';
     $content .= '<tr><td>Design Structure</td><td>' . $design_structure . '</td></tr>';
     $content .= '<tr><td>Design Content</td><td>' . $design_content . '</td></tr>';
     $content .= '<tr><td>Target Price</td><td>' . $target_price . '</td></tr>';
     $content .= '<tr><td colspan="2" class="bold" style="padding-top:20px;">' . $attr_title . '</td></tr>';
     $content .= '<tr><td>Collection</td><td>' . $attr_collection . '</td></tr>';
     //        $content .= '<tr><td>Fashion Grade</td><td>'.$attr_fashiongrd.'</td></tr>';
     if ($showImage === 'copy') {
         $status_combo = '<select name="status" class="input red bold">' . loadComboListFromArray($this->getDesignStatus(array('1', '2')), null, $this->status, false) . '</select>';
         $content .= '<tr><td class="red bold">NEW Status</td><td>' . $status_combo . '</td></tr>';
     }
     $content .= '</table></div>';
     return $content;
 }
Ejemplo n.º 3
0
 /**
  * Draw list of all attributes of a product for 1 specific attribute group. To add behavior for adding and removing attributes,
  * be sure to include the javascript behavior with function drawAttributesJSBehavior(). Javascript needed to be attached
  * only once even if you call drawAttributes function several times in 1 module.
  * @global Object $class_s styles object, will be auto created if none found
  * @param Int $products_id Product ID
  * @param String $attr_group Attribute Group
  * @return String html string of all attributes
  */
 function drawAttributes($products_id, $attr_group)
 {
     global $class_s;
     if (!is_object($class_s)) {
         use_class('styles');
         $class_s = new styles();
     }
     $attributes = $class_s->retrieveList($attr_group, "shp.products_id='{$products_id}'");
     $total_attrs = count($attributes);
     $icon_add_style = $total_attrs == 0 ? 'display:none;' : '';
     $form_style = $total_attrs == 0 ? '' : 'display:none;';
     $result = '<div id="attr-' . $products_id . '-' . $attr_group . '" class="attr-form-parent">';
     //add (plus) icon floating right, please only use one (left/right)
     //$result .= '<div style="float:right;'.$icon_add_style.'" title="Click to add" class="btn-attr-add ui-state-default ui-corner-all"><span class="ui-icon ui-icon-plus pointer"></span></div>';
     $result .= '<div class="attr-form" style="margin-bottom:5px;' . $form_style . '">';
     $result .= '<select class="cmb-attr-form input">';
     $result .= '<option value="0">Add New ' . $class_s->groups[$attr_group] . '...</option>';
     $result .= $class_s->drawComboOptions('', $attr_group, null, '', 'sd.name');
     $result .= '</select>';
     $result .= '</div>';
     // .attr-form
     $result .= '<div class="attr-list" style="float:left;">';
     foreach ($attributes as $attr) {
         $result .= $this->drawSingleAttribute($products_id, $attr['styles_id'], $attr['name'], $attr_group);
     }
     //add (plus) icon floating left, please only use one (left/right)
     $result .= '<div style="float:left;margin:1px 0 0 2px;' . $icon_add_style . '" title="Click to add" class="btn-attr-add ui-state-default ui-corner-all"><span class="ui-icon ui-icon-plus pointer"></span></div>';
     $result .= '</div>';
     $result .= '</div>';
     // #attr-{products_id}-{attr_group}
     return $result;
 }