コード例 #1
0
ファイル: scenario.action.php プロジェクト: GeoPvN/mspy
function GetPage($res = '')
{
    $data = '
	<div id="dialog-form">
	    <fieldset>
	    	<legend>ძირითადი ინფორმაცია</legend>
    
	    	<table class="dialog-form-table" style="margin:0 0 10px 0;">
				<tr>
					<td style="width: 170px;"><label for="name">სახელი</label></td>
					<td>
						<input type="text" id="name" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['scenario_name'] . '" />
					</td>
				</tr>
                <tr>
					<td style="width: 170px;"><label for="cat">კატეგორია</label></td>
					<td>
						<select style="width: 231px;" id="cat" class="idls object">' . GetCat($res[scenario_cat_id]) . '</select>
					</td>
				</tr>
			    <tr>
					<td style="width: 170px;"><label for="le_cat">ქვე-კატეგორია</label></td>
					<td>
						<select style="width: 231px;" id="le_cat" class="idls object">' . GetLeCat($res[scenario_cat_id], $res[scenario_le_cat_id]) . '</select>
					</td>
				</tr>
			</table>';
    if ($_REQUEST['quest_id'] != '') {
        if ($_REQUEST['quest_detail_id'] == '') {
            $data .= ' <div id="tabs" style="width: 98%; margin: 0 auto; margin-top: 25px;">
                            	<ul>
                            		<li><a href="#tab-0">დიალოგური ფანჯარა</a></li>
                            		<li><a href="#tab-1">კითხვების რიგითობა</a></li>
                            	</ul>
                            	<div id="tab-0">
    			        
    			                <div id="dt_example" class="inner-table">
    			                <div id="button_area">
                    			    <button id="add_button_detail">დამატება</button>
                    			    <button id="delete_button_detail">წაშლა</button>
                			    </div>
                			    <table class="" id="example2">
                    			    <thead >
                        			    <tr id="datatable_header">
                            			    <th style="display:none;">ID</th>
    			                            <th style="width: 60px;">#</th>
                            			    <th style="width: 100%;">დასახელება</th>
                            			    <th class="check">#</th>
                        			    </tr>
                    			    </thead>
                    			    <thead>
                        			    <tr class="search_header">
                            			    <th class="colum_hidden" style="display:none;"></th>		    
                            			    <th>
                            			    </th>
    			                            <th>
                            			         <input type="text" name="search_category" value="ფილტრი" class="search_init" />
                            			    </th>
                            			    <th>
                            			         <input type="checkbox" name="check-all" id="check-all-de">
                            			    </th>
                        			    </tr>
                    			    </thead>
                			    </table>
    			                </div>
    			             </div>
                        	<div id="tab-1">';
            $i = 1;
            $query = mysql_query("SELECT \t    `quest_1`.id,\r\n                                            \t\t\t        `quest_1`.`name`,\r\n                                            \t\t\t        `quest_1`.note,\r\n                                            \t\t\t        `scenario`.`name`\r\n                                \t\t\t        FROM        `scenario`\r\n                                \t\t\t        JOIN        scenario_detail ON scenario.id = scenario_detail.scenario_id\r\n                                \t\t\t        JOIN        quest_1 ON scenario_detail.quest_id = quest_1.id\r\n                                \t\t\t        WHERE       scenario.id = {$res['scenario_id']} AND scenario_detail.actived = 1\r\n                                \t\t\t        ORDER BY    scenario_detail.sort ASC");
            $query2 = mysql_query(" SELECT \t`destination`,\r\n                                            \t\t            `answer_id`\r\n                                            \t\t    FROM \t`scenario_destination`\r\n                                            \t\t    JOIN \t`scenario_detail` ON scenario_destination.scenario_detail_id = scenario_detail.id\r\n                                            \t\t    JOIN \t`scenario` ON scenario_detail.scenario_id = scenario.id\r\n                                            \t\t    WHERE \t`scenario`.id = {$res['scenario_id']} AND scenario_destination.destination != 0");
            while ($rame = mysql_fetch_array($query2)) {
                $destination .= ', ' . $rame[0];
                $answer_id .= ', ' . $rame[1];
            }
            $destination = substr($destination, 1);
            $answer_id = substr($answer_id, 1);
            //$row_scen = mysql_fetch_array($query);
            $data .= '<div id="dialog-form" style="width:102%; overflow-y:scroll; max-height:400px;">
                                <fieldset>
                                    <legend>კითხვები</legend>';
            while ($row = mysql_fetch_array($query)) {
                if ($answer_id == '') {
                    $answer_id = 0;
                }
                $query1 = mysql_query(" SELECT \tCASE \tWHEN quest_detail.quest_type_id = 1 THEN CONCAT('<tr><td style=\"width:707px; text-align:left;\"><input',IF(quest_detail.id in({$answer_id}) ,' checked',''), ' class=\"check_input\" style=\"float:left;\" type=\"checkbox\" name=\"checkbox', quest_1.id, '\" value=\"', quest_detail.id, '\"><label style=\"float:left; padding: 7px;\">', quest_detail.answer, '</label></td>')\r\n                                                    \t\t\t\t\t\t\tWHEN quest_detail.quest_type_id = 2 THEN CONCAT('<tr><td style=\"width:707px; text-align:left;\"><input value=\"\" class=\"inputtext\"style=\"float:left;\" type=\"text\" id=\"input|', quest_1.id, '|', quest_detail.id, '\" /> <label style=\"float:left; padding: 7px;\" for=\"input|', quest_1.id, '|', quest_detail.id, '\">',quest_detail.answer,'</label></td>')\r\n                                                    \t\t\t\t\t\t\tWHEN quest_detail.quest_type_id = 3 THEN CONCAT('<tr><td>',production.`name`,'</td><td>',production.`price`,'</td><td>',production.`description`,'</td><td>',production.`comment`,'</td><td><input class=\"prod_inp\" type=\"checkbox\" name=\"checkbox|', quest_1.id, '|',quest_detail.id, '\" value=\"', production.`id`, '\"></td></tr>')\r\n                                                    \t\t\t\t\t\t\tWHEN quest_detail.quest_type_id = 4 THEN CONCAT('<tr><td style=\"width:707px; text-align:left;\"><input',IF(quest_detail.id in({$answer_id}),' checked',''), ' class=\"radio_input\" style=\"float:left;\" type=\"radio\" name=\"radio', quest_1.id, '\" value=\"', quest_detail.id, '\"><label style=\"float:left; padding: 7px;\">', quest_detail.answer, '</label></td>')\r\n                                                    \t\t\t\t\t\t\tWHEN quest_detail.quest_type_id = 5 THEN CONCAT('<tr><td style=\"width:707px; text-align:left;\"><input value=\"\" class=\"date_input\"style=\"float:left;\" type=\"text\" id=\"input|', quest_1.id, '|', quest_detail.id, '\" /> <label style=\"float:left; padding: 7px;\" for=\"input|', quest_1.id, '|', quest_detail.id, '\">',quest_detail.answer,'</label></td>')\r\n                                                    \t\t\t\t\t\t\tWHEN quest_detail.quest_type_id = 6 THEN CONCAT('<tr><td style=\"width:707px; text-align:left;\"><input value=\"\" class=\"date_time_input\"style=\"float:left;\" type=\"text\" id=\"input|', quest_1.id, '|', quest_detail.id, '\" /> <label style=\"float:left; padding: 7px;\" for=\"input|', quest_1.id, '|', quest_detail.id, '\">',quest_detail.answer,'</label></td>')\r\n                                                    \t\t\t\t    END AS `ans`,\r\n                                                                \t\tquest_detail.quest_type_id,\r\n                \t\t\t    \t\t                                IF(quest_detail.id in({$answer_id}) ,quest_detail.id,'') AS `checked_quest`,\r\n                \t\t\t    \t\t                                scenario_detail.id as sc_id,\r\n                \t\t\t    \t\t                                quest_detail.id as as_id,\r\n                \t\t\t    \t\t                                scenario_destination.destination as dest\r\n                                                                FROM `quest_detail`\r\n                                                                JOIN  quest_1 ON quest_detail.quest_id = quest_1.id\r\n                                                                LEFT JOIN production ON quest_detail.product_id = production.id\r\n                                                                LEFT JOIN scenario_detail ON quest_1.id = scenario_detail.quest_id\r\n                \t\t\t    \t\t                        LEFT JOIN scenario_destination ON scenario_detail.id = scenario_destination.scenario_detail_id AND scenario_destination.answer_id = quest_detail.id\r\n                                                                LEFT JOIN scenario ON scenario_detail.scenario_id = scenario.id \r\n                                                                WHERE quest_detail.quest_id = {$row['0']} AND quest_detail.actived = 1 AND scenario.id = {$res['scenario_id']}\r\n                                                                GROUP BY quest_detail.id\r\n                                                                ORDER BY quest_1.id, quest_detail.quest_type_id ASC");
                $data .= '<textarea style="width: 704px; height:100px; resize: none; background: #EBF9FF;" class="idle">' . $row[2] . '</textarea>
                			    		<table class="dialog-form-table">
                			    		<tr>
                			    		<td style="font-weight:bold;">' . $i++ . '. ' . $row[1] . '</td>
                			    		</tr>
                			    		
                			    		';
                while ($row1 = mysql_fetch_array($query1)) {
                    $q_type = $row1[1];
                    $dest = $row1[5];
                    if ($row1[1] == 3) {
                        $tr .= $row1[0];
                        $data1 = ' <style>
                			    
                			    		#prod{
                			    		border:2px solid #85B1DE; width:100%;
                			    		}
                			    		#prod #prodtr{
                			    		background:#F2F2F2;
                			    }
                			    #prod th{
                			    width:0%; padding:5px; border:1px solid #85B1DE;
                                                      }
                			        #prod td{
                			        border:1px solid #85B1DE; padding:2px;
                                                      }
                                                      #prod tr{
                			                                                  background: #FEFEFE
                			    		}
                			    
                			    		</style>
                			    		<table id="prod">
                			    		<tr id="prodtr">
                			    		<th>დასახელება</th>
                			    		    <th>ფასი</th>
                			    		<th>აღწერა</th>
                			    		    <th>კომენტარი</th>
                			    		<th>#</th>
                			    		</tr>
                			    		' . $tr . '
                                                  </table>';
                    } else {
                        $data .= $row1[0];
                        $data .= '
                			    		                       <td style="float:left; width: 350px;"><select style="width: 231px;" id="scenarquest|' . $row1[3] . '|' . $row1[4] . '" class="idls object scenarquest">' . GetAlScenQuest($res[scenario_id], $dest) . '</select></td>
                			    		                   </tr>';
                    }
                }
                if ($q_type == 3) {
                    $data .= $data1;
                }
                $data .= '</table>
                                <hr><br>';
            }
            $data .= '</fieldset>
            		</div>';
            $data .= '</div>    			            
                            </div>
    			        ';
        }
    }
    if ($_REQUEST['quest_detail_id'] != '' || $_REQUEST['add_id'] != '') {
        $data .= ' <table class="dialog-form-table">  
			                    <tr>
                					<td style="width: 170px;"><label for="quest_id1">კითხვა</label></td>
                					<td>
                						<select style="width: 231px;" id="quest_id1" class="idls object">' . GetQuest($res['quest_id'], $_REQUEST['quest_detail_id']) . '</select>
                					</td>
                				</tr>                				
                			</table>';
    }
    $data .= '<!-- ID -->
			<input type="hidden" id="quest_id" value="' . $res['scenario_id'] . '" />
			<input type="hidden" id="quest_detail_id" value="' . $_REQUEST['quest_detail_id'] . '" />
			<input type="hidden" id="add_id" value="' . $_REQUEST['add_id'] . '" />
			<input type="hidden" id="dest_checker" value="0" />
        </fieldset>
    </div>
    ';
    return $data;
}
コード例 #2
0
ファイル: scenario.action.php プロジェクト: GeoPvN/epro
function GetPage($res = '')
{
    $data = '
        <!-- ID -->
			<input type="hidden" id="quest_id" value="' . $res['scenario_id'] . '" />
			<input type="hidden" id="quest_detail_id" value="' . $_REQUEST['id'] . '" />
			<input type="hidden" id="add_id" value="' . $_REQUEST['add_id'] . '" />
			<input type="hidden" id="dest_checker" value="0" /> <script>$("#cat,#le_cat,#quest_id1").chosen({ search_contains: true });$("#add-edit-form-answer,.add-edit-form-class,.add-edit-form-answer-class").css("overflow","visible")</script>
	<div id="dialog-form">
	    <fieldset>
	    	<legend>ძირითადი ინფორმაცია</legend>
    
	    	<table class="dialog-form-table" style="margin:0 0 10px 0;">
				<tr>
					<td style="width: 170px;"><label for="name">სახელი</label></td>
					<td>
						<textarea type="text" id="name" style="margin: 0px; width: 226px; resize:vertical;">' . $res['scenario_name'] . '</textarea>
					</td>
				</tr>
                <tr>
					<td style="width: 170px;"><label for="">კატეგორია</label></td>
					<td>
						<select style="width: 231px;" id="cat" class="idls object">' . GetCat($res[scenario_cat_id]) . '</select>
					</td>
				</tr>
			    <tr>
					<td style="width: 170px;"><label for="">ქვე-კატეგორია</label></td>
					<td>
						<select style="width: 231px;" id="le_cat" class="idls object">' . GetLeCat($res[scenario_cat_id], $res[scenario_le_cat_id]) . '</select>
					</td>
				</tr>
			</table>';
    if ($_REQUEST['id'] != '') {
        if ($_REQUEST['quest_detail_id'] == '') {
            $data .= ' <div id="taab" style="margin: 0 auto; margin-top: 25px;">
                            	<div id="callapp_tab">
                            		<span id="tab1">დიალოგური ფანჯარა</span>
                            		<span id="tab2">კითხვების რიგითობა</span>
    			                    <span id="tab3">შემოწმება</span>
                            	</div>
                            	<div id="tab_content_1">
    			        
    			                <div id="button_area">
                    			    <button id="add_button_detail">დამატება</button>
                    			    <button id="delete_button_detail">წაშლა</button>
                			    </div>
                			    <table class="display" id="table_quest" style="background-color: #FFF;">
                    			    <thead >
                        			    <tr id="datatable_header">
                            			    <th style="display:none;">ID</th>
    			                            <th style="width: 60px;">#</th>
                            			    <th style="width: 100%;">დასახელება</th>
                            			    <th class="check">&nbsp;</th>
                        			    </tr>
                    			    </thead>
                    			    <thead>
                        			    <tr class="search_header">
                            			    <th class="colum_hidden" style="display:none;">
                        			             <input style="width: 100%;" type="text" name="search_category" value="ფილტრი" class="search_init" />
                        			        </th>		    
                            			    <th>
    			                                 <input style="width: 100%;" type="text" name="search_category" value="ფილტრი" class="search_init" />
                            			    </th>
    			                            <th>
                            			         <input style="width: 100%;" type="text" name="search_category" value="ფილტრი" class="search_init" />
                            			    </th>
                            			    <th>
                            			         <div class="callapp_checkbox">
                                                    <input type="checkbox" id="check-all-de" name="check-all" />
                                                    <label for="check-all-de"></label>
                                                </div>
                            			    </th>
                        			    </tr>
                    			    </thead>
                			    </table>
    			             </div>
                        	<div id="tab_content_2">';
            $i = 1;
            $query = mysql_query("SELECT \t    `question`.id,\r\n                                            \t\t\t        `question`.`name`,\r\n                                            \t\t\t        `question`.note,\r\n                                            \t\t\t        `scenario`.`name`\r\n                                \t\t\t        FROM        `scenario`\r\n                                \t\t\t        JOIN        scenario_detail ON scenario.id = scenario_detail.scenario_id\r\n                                \t\t\t        JOIN        question ON scenario_detail.quest_id = question.id\r\n                                \t\t\t        WHERE       scenario.id = {$res['scenario_id']} AND scenario_detail.actived = 1\r\n                                \t\t\t        ORDER BY    scenario_detail.sort ASC");
            $query2 = mysql_query(" SELECT \t`destination`,\r\n                                            \t\t            `answer_id`\r\n                                            \t\t    FROM \t`scenario_destination`\r\n                                            \t\t    JOIN \t`scenario_detail` ON scenario_destination.scenario_detail_id = scenario_detail.id\r\n                                            \t\t    JOIN \t`scenario` ON scenario_detail.scenario_id = scenario.id\r\n                                            \t\t    WHERE \t`scenario`.id = {$res['scenario_id']} AND scenario_destination.destination != 0");
            while ($rame = mysql_fetch_array($query2)) {
                $destination .= ', ' . $rame[0];
                $answer_id .= ', ' . $rame[1];
            }
            $destination = substr($destination, 1);
            $answer_id = substr($answer_id, 1);
            //$row_scen = mysql_fetch_array($query);
            $data .= '<div id="dialog-form" style="width:102%; overflow-y:scroll; max-height:400px;">
                                <fieldset>
                                    <legend>კითხვები</legend>';
            while ($row = mysql_fetch_array($query)) {
                if ($answer_id == '') {
                    $answer_id = 0;
                }
                $query1 = mysql_query(" SELECT \tquestion.id as q_id,\r\n                                                                \t\tquestion_detail.quest_type_id,\r\n                \t\t\t    \t\t                                IF(question_detail.id in({$answer_id}) ,question_detail.id,'') AS `checked_quest`,\r\n                \t\t\t    \t\t                                scenario_detail.id as sc_id,\r\n                \t\t\t    \t\t                                question_detail.id as as_id,\r\n                \t\t\t    \t\t                                scenario_destination.destination as dest,\r\n                \t\t\t    \t\t                                question_detail.answer,\r\n                \t\t\t    \t\t                                scenario_handbook.name as seleqti\r\n                                                                FROM `question_detail`\r\n                                                                JOIN  question ON question_detail.quest_id = question.id\r\n                                                                LEFT JOIN scenario_detail ON question.id = scenario_detail.quest_id\r\n                \t\t\t    \t\t                        LEFT JOIN scenario_destination ON scenario_detail.id = scenario_destination.scenario_detail_id AND scenario_destination.answer_id = question_detail.id\r\n                                                                LEFT JOIN scenario ON scenario_detail.scenario_id = scenario.id \r\n                \t\t\t    \t\t                        LEFT JOIN scenario_handbook ON question_detail.answer = scenario_handbook.id \r\n                                                                WHERE question_detail.quest_id = {$row['0']} AND question_detail.actived = 1 AND scenario.id = {$res['scenario_id']}\r\n                                                                GROUP BY question_detail.id\r\n                                                                ORDER BY question.id, question_detail.quest_type_id ASC");
                $data .= '<textarea style="width: 704px; height:100px; resize: none; background: #EBF9FF;" class="idle">' . $row[2] . '</textarea>
                			    		<table class="dialog-form-table">
                			    		<tr>
                			    		<td style="font-weight:bold;">' . $i++ . '. ' . $row[1] . '</td>
                			    		</tr>
                			    		
                			    		';
                while ($row1 = mysql_fetch_array($query1)) {
                    $q_type = $row1[1];
                    $dest = $row1[5];
                    if ($row1[1] == 1) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input  class="check_input" style="float:left;" type="checkbox" name="checkbox' . $row1[0] . '" value="' . $row1[4] . '"><label style="float:left; padding: 7px;">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 2) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input value="" class="inputtext" style="float:left;" type="text" id="input' . $row1[0] . '|' . $row1[4] . '" /> <label style=\\"float:left; padding: 7px;\\" for=\\"input|' . $row1[0] . '|' . $row1[4] . '\\">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 4) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input class="radio_input" style="float:left;" type="radio" name="radio' . $row1[0] . '" value="' . $row1[4] . '"><label style=\\"float:left; padding: 7px;\\">' . $row1[6] . '</label></td>';
                    } elseif ($row1[1] == 5) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input value="" class="date_input" style="float:left;" type="text" id="input|' . $row1[0] . '|' . $row1[4] . '" /> <label style="float:left; padding: 7px;" for="input|' . $row1[0] . '|' . $row1[4] . '">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 6) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><input value="" class="date_time_input" style="float:left;" type="text" id="input|' . $row1[0] . '|' . $row1[4] . '" /> <label style="float:left; padding: 7px;" for="input|' . $row1[0] . '|' . $row1[4] . '">' . mysql_real_escape_string($row1[6]) . '</label></td>';
                    } elseif ($row1[1] == 7) {
                        $data .= '<tr><td style="width:707px; text-align:left;"><select class="hand_select" style="float:left;"  id="hand_select|' . $row1[0] . '|' . $row1[4] . '" ><option>' . $row1[7] . '</option></select> <label style="float:left; padding: 7px;" for="hand_select|' . $row1[0] . '|' . $row1[4] . '"></label></td>';
                    }
                    //$data .= $row1[0];
                    $data .= '
            			    		                       <td style="float:left; width: 350px;"><select style="width: 231px;" id="scenarquest|' . $row1[3] . '|' . $row1[4] . '" class="idls object scenarquest">' . GetAlScenQuest($res[scenario_id], $dest) . '</select></td>
            			    		                   </tr>';
                }
                $data .= '</table>
                                <hr><br>';
            }
            $data .= '</fieldset>
            		</div>';
            $data .= '</div>
                        	    <div id="tab_content_3">';
            $query = mysql_query("SELECT \t`question`.id,\r\n                                                    \t    `question`.`name`,\r\n                                                    \t    `question`.note,\r\n                                                    \t    `scenario`.`name`,\r\n                                                    \t    `scenario_detail`.id AS sc_det_id,\r\n                                                    \t    `scenario_detail`.`sort`\r\n                                        \t    FROM    `scenario`\r\n                                        \t    JOIN    scenario_detail ON scenario.id = scenario_detail.scenario_id\r\n                                        \t    JOIN    question ON scenario_detail.quest_id = question.id\r\n                                        \t    WHERE   scenario.id = {$res['scenario_id']} AND scenario_detail.actived = 1\r\n                                        \t    ORDER BY scenario_detail.sort ASC");
            $data .= '<button who="0" id="show_all_scenario" style="margin-bottom: 10px;float: right; margin-top: 15px;">ყველას ჩვენება</button>';
            while ($row = mysql_fetch_array($query)) {
                $last_q = mysql_query(" SELECT question_detail.id,question_detail.quest_id\r\n                                            \t        FROM `question_detail`\r\n                                            \t        JOIN scenario_detail ON scenario_detail.quest_id = question_detail.quest_id\r\n                                            \t        AND scenario_detail.scenario_id = {$res['scenario_id']}\r\n                                            \t        WHERE question_detail.quest_id = {$row['0']}");
                $data .= '<div style="margin-top: 15px;" class="quest_body ' . $row[5] . '" id="' . $row[0] . '">
		            <table class="dialog-form-table">
		    		<tr>
						<td style="font-weight:bold;">' . $row[5] . '. ' . $row[1] . ' <img onclick="imnote(\'' . $row[5] . '\')" style="border: none;padding: 0;margin-left: 8px;margin-top: -7px;cursor: pointer;" src="media/images/icons/kitxva.png" alt="14 ICON" height="24" width="24"></td>
		                </tr><tr style="display:none;" id="imnote_' . $row[5] . '" ><td>' . $row[2] . '</td></tr>
		                    ';
                while ($last_a = mysql_fetch_array($last_q)) {
                    $query1 = mysql_query(" SELECT CASE \tWHEN question_detail.quest_type_id = 1 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><input next_quest=\"',scenario_destination.destination,'\"  class=\"check_input\" ansver_val=\"',question_detail.answer,'\" style=\"float:left;\" type=\"checkbox\" name=\"checkbox', question_detail.quest_id, '\" id=\"checkbox', question_detail.id, '\" value=\"', question_detail.id, '\"><label for=\"checkbox', question_detail.id, '\" style=\"float:left; padding: 7px;white-space: pre-line;\">', question_detail.answer, '</label></td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 2 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"\" class=\"inputtext\"style=\"float:left;\"  type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 4 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><input next_quest=\"',scenario_destination.destination,'\" class=\"radio_input\" ansver_val=\"',question_detail.answer,'\" style=\"float:left;\" type=\"radio\" name=\"radio', question_detail.quest_id, '\" id=\"radio', question_detail.id, '\" value=\"', question_detail.id, '\"><label for=\"radio', question_detail.id, '\" style=\"float:left; padding: 7px;white-space: pre-line;\">', question_detail.answer, '</label></td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 5 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"\" class=\"date_input\"  style=\"float:left;\" type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 6 THEN CONCAT('<tr><td style=\"width:428px; text-align:left;\"><label style=\"float:left; padding: 7px 0;width: 428px;\" for=\"input|', question_detail.quest_id, '|', question_detail.id, '\">',question_detail.answer,'</label><input next_quest=\"',scenario_destination.destination,'\" value=\"\" class=\"date_time_input\"  style=\"float:left;\" type=\"text\" id=\"input|', question_detail.quest_id, '|', question_detail.id, '\" q_id=\"',question_detail.id,'\" /> </td></tr>')\r\n                                                            \t            WHEN question_detail.quest_type_id = 7 THEN question_detail.answer\r\n                                            \t                    END AS `ans`,\r\n                                                    \t            question_detail.quest_type_id,\r\n                                                    \t            scenario_handbook.`name`,\r\n                                                    \t            question_detail.quest_id,\r\n                                                    \t            question_detail.id,\r\n                                                    \t            scenario_destination.destination\r\n                                            \t            FROM question_detail\r\n                                            \t            JOIN scenario_detail ON scenario_detail.scenario_id = {$res['scenario_id']}\r\n                                            \t            JOIN scenario_destination ON scenario_detail.id = scenario_destination.scenario_detail_id AND scenario_destination.answer_id = {$last_a['0']}\r\n                                            \t            LEFT JOIN scenario_handbook ON question_detail.answer = scenario_handbook.id\r\n                                            \t            WHERE question_detail.id = {$last_a['0']} AND question_detail.quest_id = {$last_a['1']} AND scenario_detail.actived = 1\r\n                                            \t            ");
                    $g = 0;
                    while ($row1 = mysql_fetch_array($query1)) {
                        $q_type = $row1[1];
                        if ($q_type == 7) {
                            $data .= '  <tr>
                                                    <td style="width:428px; text-align:left;">
                                                    <label style="float:left; padding: 7px 0;width: 428px;" for="">' . $row1[2] . '</label>
                                                    <select class="hand_select" next_quest="' . $row1[5] . '" style="float:left;width: 235px;"  id="hand_select|' . $row1[3] . '|' . $row1[4] . '" >' . gethandbook($row1[0], '') . '</select>
                                                    </td>';
                        } else {
                            $data .= $row1[0];
                        }
                    }
                }
                $data .= '</table>
                    <hr><br></div>';
            }
            $data .= '
	  
	    <div style="margin-top: 15px; display: none;" class="last_quest">
        	<table class="dialog-form-table">
        		<tr>
        			<td style="font-weight:bold;">
        				არ დაგავიწყდეთ სტატუსის შეცვლა და შენახვის ღილაკზე დაკლიკება!
        			</td>
        		</tr>
        	</table>
        	<hr>
        	<br>
        </div>
	  
	    <button id="back_quest" back_id="0" style="float:left;">უკან</button><button id="next_quest" style="float:right;" next_id="0">წინ</button>
                        	
    			                
    			                 </div>
                        	    
                        	    
                        	        			            
                            </div>
    			        ';
        }
    }
    if ($_REQUEST['quest_detail_id'] != '' || $_REQUEST['add_id'] != '') {
        $data .= ' <table class="dialog-form-table">  
			                    <tr>
                					<td style="width: 170px;"><label for="quest_id1">კითხვა</label></td>
                					<td>
                						<select style="width: 231px;" id="quest_id1" class="idls object">' . GetQuest($res['quest_id'], $_REQUEST['id']) . '</select>
                					</td>
                				</tr>                				
                			</table>
                			<script>$("#name, #cat, #le_cat").prop("disabled", true);</script>';
    }
    $data .= '
        </fieldset>
    </div>
    ';
    return $data;
}