function ChangePortfByProf($curr_prof_id, $prof_id, $id1 = 0, $id2 = 0, $id3 = 0) { global $session; session_start(); $objResponse = new xajaxResponse(); $prof_id = intval($prof_id); $curr_prof_id = intval($curr_prof_id); $user_id = get_uid(false); // Работы. $obj_portfolio = new portfolio(); $portf_works = $obj_portfolio->GetPortfProf(get_uid(false), $prof_id); if (!$portf_works) { $portf_works = array(); } // Признак того, что работ > 30 $portf_more = count($portf_works) > 30; $html_works = ''; $js_works = 'cur_prof = ' . $prof_id . ";\n"; $js_works .= "works_ids = new Array();\n"; $js_works .= "works_names = new Array();\n"; $js_works .= "works_prevs = new Array();\n"; $js_works .= "works_picts = new Array();\n"; $js_works .= "works_links = new Array();\n"; $i = 0; foreach ($portf_works as $key => $value) { ++$i; if ($i == MAX_WORKS_IN_LIST + 1) { $html_works .= '<div id="more_works" style="font-size:11px;visibility:visible;display:none;">'; } $html_works .= '<div id="portfolio_work_' . $value['id'] . '" style="font-size:100%">'; $html_works .= '<input type="checkbox" class="checkbox" id="ps_portfolio_work_' . $value['id'] . '" name="ps_portfolio_work_' . $value['id'] . '" value="0" '; //if (in_array($value['id'], array($id1, $id2, $id3))) //{ // $html_works .= ' checked="checked" disabled="disabled"> ' . $value['name']; if ($value['id'] == $id1) { $html_works .= ' checked="checked" onclick="clear_work(1, ' . $value['id'] . ');">' . $value['name']; } else { if ($value['id'] == $id2) { $html_works .= ' checked="checked" onclick="clear_work(2, ' . $value['id'] . ');">' . $value['name']; } else { if ($value['id'] == $id3) { $html_works .= ' checked="checked" onclick="clear_work(3, ' . $value['id'] . ');">' . $value['name']; } else { $html_works .= ' onClick="add_work(' . $value['id'] . ');"> <a href="javascript:void(null);" onClick="add_work(' . $value['id'] . ');" class="blue">' . $value['name'] . '</a>'; } } } $html_works .= '</div>'; $js_works .= 'works_ids[' . $value['id'] . "] = '" . $value['id'] . "';\n"; $js_works .= 'works_names[' . $value['id'] . "] = '" . trim(addslashes($value['name'])) . "';\n"; $js_works .= 'works_prevs[' . $value['id'] . "] = '" . $value['prev_pict'] . "';\n"; $js_works .= 'works_picts[' . $value['id'] . "] = '" . $value['pict'] . "';\n"; $js_works .= 'works_links[' . $value['id'] . "] = '" . $value['link'] . "';\n"; } if ($i >= MAX_WORKS_IN_LIST + 1) { $html_works .= '</div>'; $html_works .= '<div id="show_more_works" style="font-size:100%;margin-top:12px;"><a href="javascript:void(null)" onClick="document.getElementById(\'show_more_works\').style.display=\'none\';document.getElementById(\'more_works\').style.display=\'block\';" class="blue" style="font-weight:bold;"><img src="/images/triangle_grey.gif" alt="" width="4" height="11" border="0" style="margin-right:4px;" />Остальные работы</a>'; } // Профессии $obj_profession = new professions(); $prof_names = $obj_profession->GetChangeProfNames($curr_prof_id, $prof_id); $objResponse->script($js_works); $objResponse->assign('portfolio_works', 'innerHTML', $html_works); $objResponse->assign('profession_' . $prof_id, 'innerHTML', $prof_names['new_name']); $objResponse->assign('profession_' . $curr_prof_id, 'innerHTML', '<a href="javascript:void(null);" onClick="if (ajaxFlag){ ajaxFlag=0; xajax_ChangePortfByProf(cur_prof, ' . $curr_prof_id . ', $(' . "'" . 'ps_work_1_id' . "'" . ').value, $(' . "'" . 'ps_work_2_id' . "'" . ').value, $(' . "'" . 'ps_work_3_id' . "'" . ').value);}" class="blue">' . $prof_names['old_name'] . '</a>'); $objResponse->script('ajaxFlag=1;'); return $objResponse; }