Ejemplo n.º 1
0
 //fill field
 $tour->retrieve($tour_id);
 ///get program line
 $result = $tour->get_tour_program_lines($tour_id);
 $lines = array();
 $allCountries = Country::get_list_countries($tour->deparment);
 while ($row = $db->fetchByAssoc($result)) {
     $line = array();
     $programs = array();
     $selectedKey = array();
     //countries
     $countries = explode(',', $row['countries']);
     //countries -> html select
     $list_countries = get_select_options_with_id($allCountries, $countries);
     //areas
     $allAreas = Tour::get_list_areas_by_countries($countries, 1);
     //paser base64 string -> json string -> array
     $areas = explode(',', $row['areas']);
     $list_areas = "<option value=''>--None--</option>";
     if ($areas && count($areas) > 0) {
         $list_areas = get_select_options_with_id($allAreas, $areas);
     }
     //cities
     $allCities = Tour::get_list_cities_by_areas($areas);
     $cities = explode(',', $row['destination']);
     $list_cities = "<option value=''>--None--</option>";
     if (count($cities) > 0) {
         $list_cities = get_select_options_with_id($allCities, $cities);
     }
     //location
     $allLocation = Tour::get_list_location_by_cities($cities);
Ejemplo n.º 2
0
    function getEditViewHTMLTourProgramLines()
    {
        global $sugar_config, $app_list_strings;
        $result = $this->get_tour_program_lines($this->id);
        $html = "";
        $count = 0;
        $allCountries = Country::get_list_countries($this->deparment);
        while ($row = $this->db->fetchByAssoc($result)) {
            $count++;
            //countries
            //paser base64 string -> json string -> array
            $countries = explode(',', $row['countries']);
            //countries -> html select
            $list_countries = get_select_options_with_id($allCountries, $countries);
            //areas
            $allAreas = Tour::get_list_areas_by_countries($countries, 1);
            //paser base64 string -> json string -> array
            $areas = explode(',', $row['areas']);
            $list_areas = "<option value=''>--None--</option>";
            if ($areas && count($areas) > 0) {
                $list_areas = get_select_options_with_id($allAreas, $areas);
            }
            //cities
            $allCities = Tour::get_list_cities_by_areas($areas);
            $cities = explode(',', $row['destination']);
            $list_cities = "<option value=''>--None--</option>";
            if (count($cities) > 0) {
                $list_cities = get_select_options_with_id($allCities, $cities);
            }
            //location
            $allLocation = Tour::get_list_location_by_cities($cities);
            $location = explode(',', $row['location']);
            $list_locations = "<option value=''>--None--</option>";
            if (count($allLocation) > 0) {
                foreach ($allLocation as $value) {
                    $selected = in_array($value['id'], $location) ? 'selected=""' : '';
                    $list_locations .= '<option value="' . $value['id'] . '" ' . $selected . ' data-description="' . $value['description'] . '">' . $value['name'] . '</option>';
                    //     get_select_options_with_id($allLocation, $location);
                }
            }
            $html .= '<tr id="TR_table_clone_' . $count . '" class="TR_table_clone">';
            $html .= '<td>';
            $html .= '<fieldset>';
            $html .= '<table  cellpadding="0" cellspacing="0" width="100%" class="tabForm">';
            $html .= '<tr>' . '<td colspan="8">' . '<h2 class="font_6 in_line">Date <span class="day_num">' . $count . '</span>:</h2>' . '</td>' . '</tr>';
            $html .= '<tr>';
            $html .= '<td class="dataLabel">Title:</td>';
            $html .= '<td class="dataField"><input type="text" name="title[]" size="35" id="title_' . $count . '" value="' . $row['title'] . '"/></td>';
            $html .= '<td class="dataLabel">&nbsp;</td>
                <td class="dataField" colspan="5">
                &nbsp;
                </td>';
            $html .= '</tr>';
            $html .= '<tr>
                <td class="dataLabel">
                Countries:
                </td>
                <td class="dataField">
                <select name="tour_program_countries[]" class="jk_list_countries" multiple="multiple" size="4">
                ' . $list_countries . '
                </select>
                <input type="hidden" value="' . count($countries) . '" name="tour_program_countries_count[]"/>
                </td>
                <td class="dataLabel">
                Areas:
                </td>
                <td class="dataField">
                <select name="tour_program_areas[]" class="jk_list_areas" multiple="multiple" size="4">
                ' . $list_areas . '
                </select>
                <input type="hidden" value="' . count($areas) . '" name="tour_program_areas_count[]"/>
                </td>
                <td class="dataLabel">
                Cities:
                </td>
                <td class="dataField">
                <select name="destinations[]" class="jk_list_destinations" multiple="multiple" size="4">
                ' . $list_cities . '
                </select>
                <input type="hidden" value="' . count($cities) . '" name="destination_selected_count[]"/>
                </td>
                <td class="dataLabel">
                <span>Locations:</span>

                </td>
                <td class="dataField">
                <select multiple="multiple" name="tour_program_locations[]" class="jk_list_locations" size="4"
                data-editorId="description_pro_' . $count . '">
                ' . $list_locations . '
                </select>
                <input type="hidden" value="' . count($location) . '" name="location_selected_count[]"/>
                </td>
                </tr>';
            $html .= '<tr>';
            $html .= '<td class="dataLabel">Notes</td>';
            $html .= '<td class="dataField" colspan="5"><input type="text" name="notes[]" size="35" id="notes_' . $count . '" value="' . $row['notes'] . '"/></td>';
            // $html .= '<td class="dataLabel">Picture</td>';
            $html .= ' <td class="dataLabel">' . 'Picture:' . '</td>';
            $html .= '<td class="dataField"><input type="file" name="uploadfile[]" id ="uploadfile" /> </td>';
            $html .= '</tr>';
            $html .= '<tr>';
            $html .= '<td class="dataLabel">Description</td>';
            $html .= '<td class="dataField" colspan="5"><textarea  class="jk_editor" cols="75" rows="15" id="description_pro_' . $count . '" name="description_pro[]">' . html_entity_decode($row['description'], ENT_COMPAT, 'UTF-8') . '</textarea> <input type="hidden" class="id" name="tour_program_id[]" id="tour_program_id_' . $count . '" value="' . $row['id'] . '"/>

                <input type="hidden" name="deleted[]" class="deleted" id="deleted_' . $count . '" value="0"/>
                <input type="hidden" name="images[]" id="images_' . $count . '" value="' . $row['picture'] . '"/> </td>';
            $html .= '<td class="dataLabel"></td>';
            if (!empty($row['picture'])) {
                $html .= '<td class="tour_program_image dataField"> <img src="modules/images/' . $row['picture'] . '" width="300" height="300"/> </td>';
            } else {
                $html .= '<td class="dataLabel tour_program_image">&nbsp;</td>';
            }
            $html .= '</tr>';
            $html .= '</table>';
            $html .= '</fieldset>';
            $html .= '</td>';
            $html .= '<td>';
            $html .= '<input type="button" class="btnAddRow" value="Add row"/>';
            $html .= '<input type="button" class="btnDelRow" value="Delete row"/>';
            $html .= '</td>';
            $html .= '</tr>';
        }
        //echo $html;
        return $html;
    }