Example #1
0
 protected function _buildBranch($parent_id, $level = 0)
 {
     $result = $level === 0 && $this->parent_group_apply_to_root === true || $level > 0 ? $this->parent_group_start_string : null;
     if (isset($this->_data[$parent_id])) {
         foreach ($this->_data[$parent_id] as $category_id => $category) {
             $result .= '<div class="panel panel-default">';
             $result .= '  <div class="panel-heading">';
             $result .= '    <h2 class="panel-title">';
             $result .= '      <a data-toggle="collapse" data-parent="#accordion" href="#collapse_' . $category_id . '">';
             $result .= $category['selectors_name'];
             $result .= '      </a>';
             $result .= tep_draw_form('delete_css', FILENAME_BTS_CSS, 'selID=' . $category_id . '&action=deleteconfirm', 'post', 'class="pull-right"') . tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary') . '</form>';
             $result .= '    </h2>';
             $result .= '  </div>';
             $result .= '  <div id="collapse_' . $category_id . '" class="panel-collapse collapse">';
             $result .= '    <div class="panel-body">';
             $result .= tep_draw_form('css', FILENAME_BTS_CSS, 'selID=' . $category_id . '&action=save', 'post', 'id="' . $category_id . '"');
             $result .= TEXT_CSS_SELECTOR_NAME . ' ' . tep_draw_input_field('selectors_name', $category['selectors_name'], 'class="form-control"') . '<br />';
             $result .= '<table class="table table-hover table-striped table-bordered input_new_edit_fields_wrap">';
             $result .= '<tr><th>' . TEXT_PROPERTY_ELEMENT . '</td><th>' . TEXT_PROPERTY_VALUE . '</th><th><button id="' . $category_id . '" class="add_new_edit_field_button"> + </button></th></tr>';
             $properties = tep_get_properties($category_id);
             for ($i = 0, $n = sizeof($properties); $i < $n; $i++) {
                 $result .= '<tr id="' . $properties[$i]['properties_id'] . '">';
                 $result .= '  <td>' . tep_draw_input_field('property_element[' . $properties[$i]['properties_id'] . ']', tep_get_property_element($category_id, $properties[$i]['properties_id']), 'class="form-control"') . '</td>';
                 $result .= '  <td>' . tep_draw_input_field('property_value[' . $properties[$i]['properties_id'] . ']', tep_get_property_value($category_id, $properties[$i]['properties_id']), 'class="form-control"') . '</td>';
                 $result .= '  <td><a href="#" class="remove_new_edit_field">Remove</a></td>';
                 $result .= '</tr>';
             }
             $result .= '    </table>';
             $result .= '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_BTS_CSS));
             $result .= '    </form>';
             $result .= '    </div>';
             $result .= '  </div>';
             $result .= '</div>';
             if (isset($this->_data[$category_id]) && ($this->max_level == '0' || $this->max_level > $level + 1)) {
                 $result .= $this->_buildBranch($category_id, $level + 1);
             }
         }
     }
     $result .= $level === 0 && $this->parent_group_apply_to_root === true || $level > 0 ? $this->parent_group_end_string : null;
     return $result;
 }
Example #2
0
     $css_inputs_string .= '<tr><th>' . TEXT_PROPERTY_ELEMENT . '</td><th> : </th><th>' . TEXT_PROPERTY_VALUE . '</th><th><button class="add_field_button"> + </button></th></tr>';
     $css_inputs_string .= '<tr><td>' . tep_draw_input_field('property_element[]') . '</td><td>:</td><td>' . tep_draw_input_field('property_value[]') . '</td></tr>';
     $css_inputs_string .= '</table>';
     $contents[] = array('text' => '<br />' . $css_inputs_string);
     $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_BTS_CSS, 'page=' . $HTTP_GET_VARS['page'] . '&selID=' . $HTTP_GET_VARS['selID'])));
     break;
 case 'edit':
     $heading[] = array('text' => '<strong>' . TEXT_HEADING_EDIT_CSS . '</strong>');
     $contents = array('form' => tep_draw_form('css', FILENAME_BTS_CSS, 'page=' . $HTTP_GET_VARS['page'] . '&selID=' . $cssInfo->selectors_id . '&action=save', 'post'));
     $contents[] = array('text' => TEXT_EDIT_INTRO);
     $contents[] = array('text' => '<br />' . TEXT_CSS_SELECTOR_NAME . '<br />' . tep_draw_input_field('selectors_name', $cssInfo->selectors_name));
     $css_inputs_string = '<table class="input_new_edit_fields_wrap">';
     $css_inputs_string .= '<tr><th>' . TEXT_PROPERTY_ELEMENT . '</td><th> : </th><th>' . TEXT_PROPERTY_VALUE . '</th><th><button id="' . $cssInfo->selectors_id . '" class="add_new_edit_field_button"> + </button></th></tr>';
     $properties = tep_get_properties($cssInfo->selectors_id);
     for ($i = 0, $n = sizeof($properties); $i < $n; $i++) {
         $css_inputs_string .= '<tr id="' . $properties[$i]['properties_id'] . '"><td>' . tep_draw_input_field('property_element[' . $properties[$i]['properties_id'] . ']', tep_get_property_element($cssInfo->selectors_id, $properties[$i]['properties_id'])) . '</td><td>:</td><td> ' . tep_draw_input_field('property_value[' . $properties[$i]['properties_id'] . ']', tep_get_property_value($cssInfo->selectors_id, $properties[$i]['properties_id'])) . '</td><td><a href="#" class="remove_new_edit_field">Remove</a></td></tr>';
     }
     $css_inputs_string .= '</table>';
     $contents[] = array('text' => '<br />' . $css_inputs_string);
     $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_BTS_CSS, 'page=' . $HTTP_GET_VARS['page'] . '&selID=' . $cssInfo->selectors_id)));
     break;
 case 'delete':
     $heading[] = array('text' => '<strong>' . TEXT_HEADING_DELETE_CSS . '</strong>');
     $contents = array('form' => tep_draw_form('css', FILENAME_BTS_CSS, 'page=' . $HTTP_GET_VARS['page'] . '&selID=' . $cssInfo->selectors_id . '&action=deleteconfirm'));
     $contents[] = array('text' => TEXT_DELETE_INTRO);
     $contents[] = array('text' => '<br /><strong>' . $cssInfo->selectors_name . '</strong>');
     $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_DELETE, 'trash', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_BTS_CSS, 'page=' . $HTTP_GET_VARS['page'] . '&selID=' . $cssInfo->selectors_id)));
     break;
 default:
     if (isset($cssInfo) && is_object($cssInfo)) {
         $heading[] = array('text' => '<strong>' . $cssInfo->selectors_name . '</strong>');