function get_competences_filter() { $back_url = $this->back_url; $jump_url = $this->jump_url; $next_url = $this->next_url; require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $cmodel = new CompetencesAdm(); $lang =& DoceboLanguage::createInstance('report', 'framework'); YuiLib::load(); Util::get_js(Get::rel_path('lms') . '/admin/modules/report/competences_filter.js', true, true); addJs($GLOBALS['where_lms_relative'] . '/admin/modules/report/', 'competences_filter.js'); //back to columns category selection if (isset($_POST['undo_filter'])) { Util::jump_to($back_url); } if (Get::req('is_updating', DOTY_INT, 0) > 0) { $_SESSION['report_tempdata']['columns_filter'] = array('filters_list' => Get::req('rc_filter', DOTY_MIXED, array()), 'exclusive' => Get::req('rc_filter_exclusive', DOTY_INT, 0) > 0 ? true : false); } else { if (!isset($_SESSION['report_tempdata']['columns_filter'])) { $_SESSION['report_tempdata']['columns_filter'] = array('filters_list' => array(), 'exclusive' => true); } } $ref =& $_SESSION['report_tempdata']['columns_filter']; //filter setting done, go to next step if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) { $temp_url = $next_url; if (isset($_POST['pre_filter'])) { $temp_url .= '&show=1&nosave=1'; } if (isset($_POST['show_filter'])) { $temp_url .= '&show=1'; } Util::jump_to($temp_url); } $cats = $cmodel->getAllCategories(); $comps = $cmodel->getAllCompetences(); $optdata = array(array('name' => Lang::t('_COMPETENCES', 'competences'), 'rows' => array())); foreach ($comps as $key => $val) { //categories cycle $temp = array(); $temp['id'] = $val->id_competence; $temp['name'] = $val->name; //str_replace("'", "\'", $value); $temp['type'] = $val->type; $temp['typology'] = $val->typology; //$temp['score'] = $val->score; $optdata[0]['rows'][] = $temp; } $prevdata = $ref['filters_list']; //array(); $json = new Services_JSON(); $js_prevdata = $json->encode($prevdata); $js_optdata = str_replace("'", "\\'", $json->encode($optdata)); cout('<script type="text/javascript">' . 'optdata_JSON=\'' . $js_optdata . '\';' . 'rc_sel_opt_0=\'' . $lang->def('_COMPETENCES_DROPDOWN_NULL_SELECT') . '\';' . 'rc_remove_filter=\'' . $lang->def('_RESET') . '\';' . 'rc_initial_filters=' . $js_prevdata . ';' . 'YAHOO.util.Event.onDOMReady(rc_init);' . '</script>', 'page_head'); $clang = $this->lang; $sel = $ref['exclusive'] ? 1 : 0; $selected = ' checked="checked"'; $box = new ReportBox(); $box->title = $this->lang->def('_COMPETENCESFILTER_TITLE'); $box->description = $this->lang->def('_COMPETENCESFILTER_TITLE_DESC'); $box->body = Form::getBreakRow() . Form::getHidden('is_updating', 'is_updating', 1) . '<div id="rc_filter_list"></div>' . '<div class="fc_filter_line filter_corr">' . '<input type="radio" id="rc_filter_exclusive_and" name="rc_filter_exclusive" value="1" ' . ($sel > 0 ? $selected : '') . ' /> <label for="rc_filter_exclusive_and">' . $clang->def('_FILTER_ALL_CONDS') . '</label> ' . '<input type="radio" id="rc_filter_exclusive_or" name="rc_filter_exclusive" value="0" ' . ($sel == 0 ? $selected : '') . ' /> <label for="rc_filter_exclusive_or">' . $clang->def('_FILTER_ONE_COND') . '</label>' . '</div>' . '<div class="fc_filter_line">' . '<span class="yui-button yui-link-button" id="fc_addfilter"> <span class="first-child"> <a href="#" onclick="rc_addfilter();return false;">' . $clang->def('_NEW_FILTER') . '</a> </span> </span>' . '<span class="yui-button yui-link-button" id="fc_cancfilter"> <span class="first-child"> <a href="#" onclick="rc_resetfilters();return false;">' . $clang->def('_FILTER_RESET') . '</a> </span> </span>' . '</div>'; cout($box->get()); cout(Form::getBreakRow()); }