function listByType($idDiscType) { $query = $this->con->genericQuery("select * from " . $this->table . " where fk_disc_type = " . $idDiscType . " and status=1"); $objReturn = array(); foreach ($query as $value) { $disc = new discipline(); $disc->open($value); $objReturn[] = $disc; } return $objReturn; }
function getDisciplinesUser($idUser, $idCountry) { $user = new user(); $country = new country(); $discipline_type = new disciplinetype(); $discipline = new discipline(); $html = ""; $htmlcontent = ""; $user->open($idUser); $list_discipline_types = $discipline_type->list_disc_types(); $country->open($idCountry); $count = 0; $html .= '<ul class="nav nav-tabs">'; $htmlcontent .= '<div class="control-group">'; $htmlcontent .= '<div class="controls form-inline">'; $htmlcontent .= '<div class="tab-content">'; foreach ($list_discipline_types as $item) { $count++; if ($count == 1) { $html .= '<li class="active">'; $htmlcontent .= '<div class="tab-pane fade in active" id="' . $item->id . '-' . $item->description . '">'; } else { $html .= '<li>'; $htmlcontent .= '<div class="tab-pane fade" id="' . $item->id . '-' . $item->description . '">'; } $html .= '<a data-toggle="tab" href="#' . $item->id . '-' . $item->description . '">' . $item->description . '</a>'; $html .= '</li>'; $list_discipline = $discipline->listByType($item->id); foreach ($list_discipline as $itemDisc) { $pricesDisc = ""; $htmlcontent .= '<label style="margin-left: 10px !important; margin-bottom: 20px !important; margin-bottom-right: 0px !important; width:210px;" class="checkbox">'; $htmlcontent .= '<input type="checkbox" data-form="uniform" name="discPrices[]" value="' . $itemDisc->id . '"'; foreach ($user->disciplines as $ud) { list($disc, $prices) = split(' - ', $ud); list($price_user, $price_company) = split('/', $prices); if ($disc == $itemDisc->id) { $htmlcontent = substr($htmlcontent, 0, -1); $htmlcontent .= ' - ' . $price_user . '/' . $price_company . '" checked'; $pricesDisc = ' - (' . $country->currency . ') ' . $price_user . '/' . $price_company; } } $htmlcontent .= ' />'; $htmlcontent .= $itemDisc->description . $pricesDisc; $htmlcontent .= '</label>'; } $htmlcontent .= '</div>'; } $htmlcontent .= '</div>'; $htmlcontent .= '</div>'; $htmlcontent .= '</div>'; $html .= '</ul>'; echo $html . $htmlcontent; }