diff --git a/load_search.php b/load_search.php new file mode 100644 index 0000000000..3c79bdd2bf --- /dev/null +++ b/load_search.php @@ -0,0 +1,178 @@ +addHeader(get_lang('LoadDiagnosis')); +if (!empty($userInfo)) { + if ($userInfo['status'] == DRH) { + $users = UserManager::get_users_followed_by_drh($userId); + if (!empty($users)) { + $userList = []; + foreach ($users as $user) { + $userList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); + } + $formSearch->addSelect('user_id', get_lang('User'), $userList); + } + } +} + +$formSearch->addButtonSearch(get_lang('Search'), 'save'); + +$form = new FormValidator('search', 'post', api_get_self().'&user_id='.$userToLoad); +$form->addHeader(get_lang('Diagnosis')); +$form->addHidden('user_id', $userToLoad); + +/** @var ExtraFieldSavedSearch $saved */ +$search = [ + 'user' => $userToLoad +]; + +$items = $em->getRepository('ChamiloCoreBundle:ExtraFieldSavedSearch')->findBy($search); +if (empty($items)) { + Display::addFlash(Display::return_message('NoData')); +} + +$extraField = new ExtraField('session'); +$extraFieldValue = new ExtraFieldValue('session'); +$extra = $extraField->addElements($form, '', [], true); + +$form->addButtonSearch(get_lang('Save'), 'save'); + +$result = SessionManager::getGridColumns('simple'); +$columns = $result['columns']; +$column_model = $result['column_model']; +$defaults = []; + +if (!empty($items)) { + /** @var ExtraFieldSavedSearch $item */ + foreach ($items as $item) { + $variable = 'extra_'.$item->getField()->getVariable(); + $defaults[$variable] = $item->getValue(); + } +} + +$form->setDefaults($defaults); + +$view = $form->returnForm(); +$filterToSend = ''; + +if ($form->validate()) { + $params = $form->getSubmitValues(); + // Search + $filters = []; + // Parse params. + foreach ($params as $key => $value) { + if (substr($key, 0, 6) != 'extra_' && substr($key, 0, 7) != '_extra_') { + continue; + } + if (!empty($value)) { + $filters[$key] = $value; + } + } + + $filterToSend = []; + if (!empty($filters)) { + $filterToSend = ['groupOp' => 'AND']; + if ($filters) { + $count = 1; + $countExtraField = 1; + foreach ($result['column_model'] as $column) { + if ($count > 5) { + if (isset($filters[$column['name']])) { + $defaultValues['jqg'.$countExtraField] = $filters[$column['name']]; + $filterToSend['rules'][] = ['field' => $column['name'], 'op' => 'cn', 'data' => $filters[$column['name']]]; + } + $countExtraField++; + } + $count++; + } + } + } +} + +$htmlHeadXtra[] =' +'; + + +if (!empty($filterToSend)) { + $filterToSend = json_encode($filterToSend); + $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&_force_search=true&rows=20&page=1&sidx=&sord=asc&filters2='.$filterToSend; +} else { + $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&_force_search=true&rows=20&page=1&sidx=&sord=asc'; +} + +// Autowidth +$extra_params['autowidth'] = 'true'; + +// height auto +$extra_params['height'] = 'auto'; +$extra_params['postData'] = array( + 'filters' => array( + "groupOp" => "AND", + "rules" => $result['rules'] + ) +); + +$action_links = 'function action_formatter(cellvalue, options, rowObject) { + return \''.Display::return_icon('add.png', get_lang('Subscribe'),'',ICON_SIZE_SMALL).''. + '\'; +}'; + +$htmlHeadXtra[] = api_get_jqgrid_js(); + +$griJs = Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); + +$grid = '
'; +$grid .= Display::grid_html('sessions'); +$grid .= '
'; + +$tpl = new Template(get_lang('Diagnosis')); + +if (empty($items)) { + $view = ''; + $grid = ''; + $griJs = ''; +} +$tpl->assign('form', $view); +$tpl->assign('form_search', $formSearch->returnForm()); +$tpl->assign('grid', $grid); +$tpl->assign('grid_js', $griJs); + +$content = $tpl->fetch('default/user_portal/search_extra_field.tpl'); +$tpl->assign('content', $content); +$tpl->display_one_col_template(); diff --git a/main/inc/ajax/model.ajax.php b/main/inc/ajax/model.ajax.php index 02ac4a136f..50872f2343 100755 --- a/main/inc/ajax/model.ajax.php +++ b/main/inc/ajax/model.ajax.php @@ -108,15 +108,20 @@ $search = isset($_REQUEST['_search']) ? $_REQUEST['_search'] : false; $forceSearch = isset($_REQUEST['_force_search']) ? $_REQUEST['_force_search'] : false; $extra_fields = array(); -if (($search || $forceSearch) && ($search !== 'false')) { +if ((isset($_REQUEST['filters2']) && $forceSearch) || ($search || $forceSearch) && ($search !== 'false')) { $whereCondition = ' 1 = 1 '; $whereConditionInForm = getWhereClause($searchField, $searchOperator, $searchString); if (!empty($whereConditionInForm)) { $whereCondition .= ' AND '.$whereConditionInForm; } + $filters = isset($_REQUEST['filters']) && !is_array($_REQUEST['filters']) ? json_decode($_REQUEST['filters']) : false; + if (isset($_REQUEST['filters2'])) { + $filters = json_decode($_REQUEST['filters2']); + } + if (!empty($filters)) { if (in_array($action, ['get_questions', 'get_sessions'])) { switch ($action) { @@ -145,11 +150,11 @@ if (($search || $forceSearch) && ($search !== 'false')) { $whereCondition .= $extraCondition; // Question field - $resultQuestion = $extraField->getExtraFieldRules($filters, 'question_'); $questionFields = $resultQuestion['extra_fields']; $condition_array = $resultQuestion['condition_array']; + $extraQuestionCondition = ''; if (!empty($condition_array)) { $extraQuestionCondition = ' AND ( '; $extraQuestionCondition .= implode($filters->groupOp, $condition_array); diff --git a/main/inc/lib/extra_field.lib.php b/main/inc/lib/extra_field.lib.php index a10166cb8e..6189091cf3 100755 --- a/main/inc/lib/extra_field.lib.php +++ b/main/inc/lib/extra_field.lib.php @@ -71,15 +71,28 @@ class ExtraField extends Model public $pageUrl; public $extraFieldType = 0; + public $table_field_options; + public $table_field_values; + public $table_field_tag; + public $table_field_rel_tag; + + public $handler_id; + public $primaryKey; + /** * @param string $type */ public function __construct($type) { $this->type = $type; + $this->table = Database::get_main_table(TABLE_EXTRA_FIELD); $this->table_field_options = Database::get_main_table(TABLE_EXTRA_FIELD_OPTIONS); $this->table_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); + $this->table_field_tag = Database::get_main_table(TABLE_MAIN_TAG); + $this->table_field_rel_tag = Database::get_main_table(TABLE_MAIN_EXTRA_FIELD_REL_TAG); + + $this->handler_id = 'item_id'; switch ($this->type) { case 'calendar_event': @@ -87,12 +100,15 @@ class ExtraField extends Model break; case 'course': $this->extraFieldType = EntityExtraField::COURSE_FIELD_TYPE; + $this->primaryKey = 'id'; break; case 'user': $this->extraFieldType = EntityExtraField::USER_FIELD_TYPE; break; case 'session': $this->extraFieldType = EntityExtraField::SESSION_FIELD_TYPE; + $this->handlerEntityId = 'sessionId'; + $this->primaryKey = 'id'; break; case 'question': $this->extraFieldType = EntityExtraField::QUESTION_FIELD_TYPE; @@ -364,9 +380,11 @@ class ExtraField extends Model * @param FormValidator $form * @param int $itemId * @param array $exclude variables of extra field to exclude + * @param bool $filter + * * @return array|bool */ - public function addElements($form, $itemId = 0, $exclude = []) + public function addElements($form, $itemId = 0, $exclude = [], $filter = false) { if (empty($form)) { return false; @@ -383,7 +401,11 @@ class ExtraField extends Model } } - $extraFields = $this->get_all(null, 'option_order'); + $conditions = []; + if ($filter) { + $conditions = ['filter = ?' => 1]; + } + $extraFields = $this->get_all($conditions, 'option_order'); $extra = $this->set_extra_fields_in_form( $form, $extraData, @@ -1980,6 +2002,7 @@ EOF; } } } + $options_by_double = array(); foreach ($double_fields as $double) { $my_options = $extraFieldOption->get_field_options_by_field( @@ -2005,8 +2028,7 @@ EOF; foreach ($extra_fields as $extra_info) { $extra_field_info = $extra_info['extra_field_info']; $inject_joins .= " INNER JOIN $this->table_field_values fv$counter - ON (s.".$this->primaryKey." = fv$counter.".$this->handler_id.") "; - + ON (s." . $this->primaryKey . " = fv$counter." . $this->handler_id . ") "; // Add options if (isset($extra_field_info['field_type']) && in_array( $extra_field_info['field_type'], @@ -2019,11 +2041,31 @@ EOF; ) { $options['where'] = str_replace( $extra_info['field'], - 'fv'.$counter.'.field_id = '.$extra_info['id'].' AND fvo'.$counter.'.option_value', + 'fv' . $counter . '.field_id = ' . $extra_info['id'] . ' AND fvo' . $counter . '.option_value', $options['where'] ); - $inject_joins .= " INNER JOIN $this->table_field_options fvo$counter ". - " ON (fv$counter.field_id = fvo$counter.field_id AND fv$counter.value = fvo$counter.option_value) "; + $inject_joins .= " + INNER JOIN $this->table_field_options fvo$counter + ON ( + fv$counter.field_id = fvo$counter.field_id AND + fv$counter.value = fvo$counter.option_value + ) + "; + } else if (isset($extra_field_info['field_type']) && + $extra_field_info['field_type'] == ExtraField::FIELD_TYPE_TAG + ) { + $options['where'] = str_replace( + $extra_info['field'], + 'tag' . $counter . '.tag ', + $options['where'] + ); + + $inject_joins .= " + INNER JOIN $this->table_field_rel_tag tag_rel$counter + ON (tag_rel$counter.field_id = ".$extra_info['id']." AND tag_rel$counter.item_id = s." . $this->primaryKey.") + INNER JOIN $this->table_field_tag tag$counter + ON (tag$counter.id = tag_rel$counter.tag_id) + "; } else { //text, textarea, etc $options['where'] = str_replace( @@ -2053,11 +2095,11 @@ EOF; } return array( - 'order' => $order, - 'limit' => $limit, - 'where' => $where, - 'inject_where' => $inject_where, - 'inject_joins' => $inject_joins, + 'order' => $order, + 'limit' => $limit, + 'where' => $where, + 'inject_where' => $inject_where, + 'inject_joins' => $inject_joins, 'field_value_to_join' => $field_value_to_join, 'inject_extra_fields' => $inject_extra_fields, ); @@ -2112,7 +2154,6 @@ EOF; $condition_array = array(); foreach ($filters->rules as $rule) { - if (strpos($rule->field, $stringToSearch) === false) { //normal fields $field = $rule->field; @@ -2126,10 +2167,9 @@ EOF; if (strpos($rule->field, '_second') === false) { //No _second $original_field = str_replace($stringToSearch, '', $rule->field); - $field_option = $this->get_handler_field_info_by_variable($original_field); + $field_option = $this->get_handler_field_info_by_field_variable($original_field); if ($field_option['field_type'] == ExtraField::FIELD_TYPE_DOUBLE_SELECT) { - if (isset($double_select[$rule->field])) { $data = explode('#', $rule->data); $rule->data = $data[1].'::'.$double_select[$rule->field]; diff --git a/main/inc/lib/extra_field_value.lib.php b/main/inc/lib/extra_field_value.lib.php index 1fcc17e951..53802410f9 100755 --- a/main/inc/lib/extra_field_value.lib.php +++ b/main/inc/lib/extra_field_value.lib.php @@ -80,7 +80,7 @@ class ExtraFieldValue extends Model foreach ($params as $key => $value) { $found = strpos($key, '__persist__'); - if ($found === FALSE) { + if ($found === false) { continue; } diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index 462ebd963e..224af1b5c1 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -410,7 +410,7 @@ class SessionManager $where .=" AND s.id_coach = $user_id "; } - $extra_field = new ExtraField('session'); + $extra_field = new \ExtraField('session'); $conditions = $extra_field->parseConditions($options); $inject_joins = $conditions['inject_joins']; $where .= $conditions['where']; @@ -425,17 +425,19 @@ class SessionManager if ($get_count == true) { $select = " SELECT count(*) as total_rows"; } else { - $select = - "SELECT DISTINCT ". - " s.name, ". - " s.display_start_date, ". - " s.display_end_date, ". - " access_start_date, ". - " access_end_date, ". - " s.visibility, ". - " s.session_category_id, ". - " $inject_extra_fields ". - " s.id "; + $select =" + SELECT DISTINCT + s.name, + s.display_start_date, + s.display_end_date, + access_start_date, + access_end_date, + s.visibility, + s.session_category_id, + $inject_extra_fields + s.id + " + ; $isMakingOrder = strpos($options['order'], 'category_name') === 0; } @@ -470,6 +472,7 @@ class SessionManager $query .= $order; $query .= $limit; +//echo $query; $result = Database::query($query); $categories = self::get_all_session_category(); diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 79906dab94..22b2e3ecd7 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -3027,6 +3027,7 @@ class UserManager } $admin_table = Database::get_main_table(TABLE_MAIN_ADMIN); $sql = "SELECT * FROM $admin_table WHERE user_id = $user_id"; + $res = Database::query($sql); return Database::num_rows($res) === 1; } diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index a57b8072a5..d70ba183f8 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -192,6 +192,8 @@ class IndexManager $html .= '
  • '.get_lang('Dashboard').'
  • '; } } + + $html .= ''; } @@ -912,6 +914,8 @@ class IndexManager $show_create_link = false; $show_course_link = false; + $userInfo = api_get_user_info(); + if ((api_get_setting('allow_users_to_create_courses') == 'false' && !api_is_platform_admin()) || api_is_student() ) { @@ -976,6 +980,14 @@ class IndexManager } } + $my_account_content .= '
  • '. + Display::return_icon('new-course.png', get_lang('Diagnosis')) . get_lang('Diagnosis').'
  • '; + + if ($userInfo['status'] == DRH) { + $my_account_content .= '
  • ' . + Display::return_icon('new-course.png', get_lang('ManageDiagnosis')) . get_lang('Diagnosis') . '
  • '; + } + $my_account_content .= ''; if (!empty($my_account_content)) { diff --git a/main/session/session_list.php b/main/session/session_list.php index f5faa65dbd..fa8a987f69 100644 --- a/main/session/session_list.php +++ b/main/session/session_list.php @@ -78,6 +78,55 @@ $(function() { }); '; +$result = SessionManager::getGridColumns($list_type); + +$columns = $result['columns']; +$column_model = $result['column_model']; + +// Autowidth +$extra_params['autowidth'] = 'true'; + +// height auto +$extra_params['height'] = 'auto'; +$extra_params['postData'] = array( + 'filters' => array( + "groupOp" => "AND", + "rules" => $result['rules'], + /*array( + array( "field" => "display_start_date", "op" => "gt", "data" => ""), + array( "field" => "display_end_date", "op" => "gt", "data" => "") + ),*/ + //'groups' => $groups + ) +); + +$defaultValues = []; + +$filters = isset($_GET['filters']) ? $_GET['filters'] : ''; +$filterToSend = []; +if (!empty($filters)) { + $filterToSend = ['groupOp' => 'AND']; + $filters = unserialize(urldecode($filters)); + if ($filters) { + $count = 1; + $countExtraField = 1; + foreach ($result['column_model'] as $column) { + if ($count > 5) { + if (isset($filters[$column['name']])) { + $defaultValues['jqg'.$countExtraField] = $filters[$column['name']]; + $filterToSend['rules'][] = ['field' => $column['name'], 'op' => 'cn', 'data' => $filters[$column['name']]]; + } + $countExtraField++; + } + $count++; + } + } +} + + +$defaultValues = json_encode($defaultValues); + + // jqgrid will use this URL to do the selects if (!empty($courseId)) { $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&course_id='.$courseId; @@ -98,30 +147,8 @@ if (isset($_REQUEST['id_category'])) { } } -$url .= '&list_type='.$list_type; - -$result = SessionManager::getGridColumns($list_type); - -$columns = $result['columns']; -$column_model = $result['column_model']; - -// Autowidth -$extra_params['autowidth'] = 'true'; -// height auto -$extra_params['height'] = 'auto'; - -$extra_params['postData'] =array( - 'filters' => array( - "groupOp" => "AND", - "rules" => $result['rules'], - /*array( - array( "field" => "display_start_date", "op" => "gt", "data" => ""), - array( "field" => "display_end_date", "op" => "gt", "data" => "") - ),*/ - //'groups' => $groups - ) -); +$url .= '&list_type='.$list_type; //With this function we can add actions to the jgrid (edit, delete, etc) $action_links = 'function action_formatter(cellvalue, options, rowObject) { @@ -167,7 +194,6 @@ $urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; function show_cols(grid, added_cols) { grid.showCol('name').trigger('reloadGrid'); for (key in added_cols) { - //console.log('show: ' + key); grid.showCol(key); }; } @@ -227,7 +253,7 @@ $urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; overlay : false, width: 'auto', caption: '', - formclass:'data_table', + formclass : 'data_table', onSearch : function() { var postdata = grid.jqGrid('getGridParam', 'postData'); @@ -242,10 +268,7 @@ $urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; if (subvalue.data == undefined) { } - //if (added_cols[value.field] == undefined) { added_cols[subvalue.field] = subvalue.field; - //} - //grid.showCol(value.field); }); } }); @@ -280,16 +303,28 @@ $urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; gbox.before(searchDialog); gbox.css({clear:"left"}); - //Select first elements by default + // Select first elements by default $('.input-elm').each(function(){ $(this).find('option:first').attr('selected', 'selected'); }); + var defaultValues = jQuery.parseJSON(''); + if (defaultValues) { + $('.input-elm').each(function() { + if (defaultValues.hasOwnProperty($(this).attr('id'))) { + $(this).val(defaultValues[$(this).attr('id')]); + } + }); + } + $('.delete-rule').each(function(){ $(this).click(function(){ - $('.input-elm').each(function(){ + /*$('.input-elm').each(function(){ $(this).find('option:first').attr('selected', 'selected'); - }); + });*/ + /*if (defaultValues.hasOwnProperty($(this).attr('id'))) { + $(this).val(defaultValues[$(this).attr('id')]); + }*/ }); }); }); diff --git a/main/template/default/user_portal/search_extra_field.tpl b/main/template/default/user_portal/search_extra_field.tpl new file mode 100644 index 0000000000..b0772c0123 --- /dev/null +++ b/main/template/default/user_portal/search_extra_field.tpl @@ -0,0 +1,12 @@ +{{ form_search }} + +{{ form }} + + + +{{ grid }} + diff --git a/search.php b/search.php new file mode 100644 index 0000000000..0575090a43 --- /dev/null +++ b/search.php @@ -0,0 +1,209 @@ +addHeader(get_lang('Diagnosis')); + +/** @var ExtraFieldSavedSearch $saved */ +$search = [ + 'user' => $userId +]; + +$items = $em->getRepository('ChamiloCoreBundle:ExtraFieldSavedSearch')->findBy($search); + +$extraField = new ExtraField('session'); +$extraFieldValue = new ExtraFieldValue('session'); +$extra = $extraField->addElements($form, '', [], true); + +$form->addButtonSave(get_lang('Save'), 'save'); +$form->addButtonSearch(get_lang('Search'), 'search'); + +$result = SessionManager::getGridColumns('simple'); +$columns = $result['columns']; +$column_model = $result['column_model']; + + +$defaults = []; + +if (!empty($items)) { + /** @var ExtraFieldSavedSearch $item */ + foreach ($items as $item) { + $variable = 'extra_'.$item->getField()->getVariable(); + $defaults[$variable] = $item->getValue(); + } +} + +$form->setDefaults($defaults); + +$view = $form->returnForm(); +$filterToSend = ''; + +if ($form->validate()) { + $params = $form->getSubmitValues(); + if (isset($params['save'])) { + // save + foreach ($params as $key => $value) { + $found = strpos($key, '__persist__'); + + if ($found === false) { + continue; + } + + $tempKey = str_replace('__persist__', '', $key); + if (!isset($params[$tempKey])) { + $params[$tempKey] = array(); + } + } + + // Parse params. + foreach ($params as $key => $value) { + if (substr($key, 0, 6) != 'extra_' && substr($key, 0, 7) != '_extra_') { + continue; + } + + $field_variable = substr($key, 6); + $extraFieldInfo = $extraFieldValue + ->getExtraField() + ->get_handler_field_info_by_field_variable($field_variable); + + if (!$extraFieldInfo) { + continue; + } + + $user = $em->getRepository('ChamiloUserBundle:User')->find($userId); + $extraFieldObj = $em->getRepository('ChamiloCoreBundle:ExtraField')->find($extraFieldInfo['id']); + + $search = [ + 'field' => $extraFieldObj, + 'user' => $user + ]; + + /** @var ExtraFieldSavedSearch $saved */ + $saved = $em->getRepository('ChamiloCoreBundle:ExtraFieldSavedSearch')->findOneBy($search); + + if ($saved) { + $saved + ->setField($extraFieldObj) + ->setUser($user) + ->setValue($value) + ; + $em->merge($saved); + + } else { + $saved = new ExtraFieldSavedSearch(); + $saved + ->setField($extraFieldObj) + ->setUser($user) + ->setValue($value) + ; + $em->persist($saved); + } + $em->flush(); + } + + Display::addFlash(Display::return_message(get_lang('Saved'))); + header("Location: ".api_get_self()); + exit; + } else { + // Search + $filters = []; + // Parse params. + foreach ($params as $key => $value) { + if (substr($key, 0, 6) != 'extra_' && substr($key, 0, 7) != '_extra_') { + continue; + } + if (!empty($value)) { + $filters[$key] = $value; + } + } + + $filterToSend = []; + if (!empty($filters)) { + $filterToSend = ['groupOp' => 'AND']; + if ($filters) { + $count = 1; + $countExtraField = 1; + foreach ($result['column_model'] as $column) { + if ($count > 5) { + if (isset($filters[$column['name']])) { + $defaultValues['jqg'.$countExtraField] = $filters[$column['name']]; + $filterToSend['rules'][] = ['field' => $column['name'], 'op' => 'cn', 'data' => $filters[$column['name']]]; + } + $countExtraField++; + } + $count++; + } + } + } + } +} + +$htmlHeadXtra[] =' +'; + + +if (!empty($filterToSend)) { + $filterToSend = json_encode($filterToSend); + $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&_force_search=true&rows=20&page=1&sidx=&sord=asc&filters2='.$filterToSend; +} else { + $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&_force_search=true&rows=20&page=1&sidx=&sord=asc'; +} + + + + + +// Autowidth +$extra_params['autowidth'] = 'true'; + +// height auto +$extra_params['height'] = 'auto'; +$extra_params['postData'] = array( + 'filters' => array( + "groupOp" => "AND", + "rules" => $result['rules'], + /*array( + array( "field" => "display_start_date", "op" => "gt", "data" => ""), + array( "field" => "display_end_date", "op" => "gt", "data" => "") + ),*/ + //'groups' => $groups + ) +); + +$action_links = 'function action_formatter(cellvalue, options, rowObject) { + return \''.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).''. + '\'; +}'; + +$htmlHeadXtra[] = api_get_jqgrid_js(); + +$griJs = Display::grid_js('sessions', $url, $columns, $column_model, $extra_params, array(), $action_links, true); + +$grid = '
    '; +$grid .= Display::grid_html('sessions'); +$grid .= '
    '; + +$tpl = new Template(get_lang('Diagnosis')); +$tpl->assign('form', $view); +$tpl->assign('grid', $grid); +$tpl->assign('grid_js', $griJs); +$content = $tpl->fetch('default/user_portal/search_extra_field.tpl'); +$tpl->assign('content', $content); +$tpl->display_one_col_template(); diff --git a/src/Chamilo/CoreBundle/Entity/ExtraFieldSavedSearch.php b/src/Chamilo/CoreBundle/Entity/ExtraFieldSavedSearch.php new file mode 100644 index 0000000000..2e3dfc9967 --- /dev/null +++ b/src/Chamilo/CoreBundle/Entity/ExtraFieldSavedSearch.php @@ -0,0 +1,166 @@ +id; + } + + /** + * @return ExtraField + */ + public function getField() + { + return $this->field; + } + + /** + * @param ExtraField $field + * @return ExtraFieldSavedSearch + */ + public function setField($field) + { + $this->field = $field; + return $this; + } + + /** + * @return User + */ + public function getUser() + { + return $this->user; + } + + /** + * @param User $user + * @return ExtraFieldSavedSearch + */ + public function setUser($user) + { + $this->user = $user; + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @param string $value + * @return ExtraFieldSavedSearch + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * @return \DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * @return ExtraFieldSavedSearch + */ + public function setCreatedAt($createdAt) + { + $this->createdAt = $createdAt; + return $this; + } + + /** + * @return \DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } + + /** + * @param \DateTime $updatedAt + * @return ExtraFieldSavedSearch + */ + public function setUpdatedAt($updatedAt) + { + $this->updatedAt = $updatedAt; + return $this; + } +}