/**
  * Shows statistics about the time of last visit to each course.
  */
 public static function printCourseLastVisit()
 {
     $access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
     $current_url_id = api_get_current_access_url_id();
     $columns[0] = 'c_id';
     $columns[1] = 'access_date';
     $sql_order[SORT_ASC] = 'ASC';
     $sql_order[SORT_DESC] = 'DESC';
     $per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10;
     $page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1;
     $column = isset($_GET['column']) ? intval($_GET['column']) : 0;
     $date_diff = isset($_GET['date_diff']) ? intval($_GET['date_diff']) : 60;
     $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
     if (!in_array($direction, array(SORT_ASC, SORT_DESC))) {
         $direction = SORT_ASC;
     }
     $form = new FormValidator('courselastvisit', 'get');
     $form->addElement('hidden', 'report', 'courselastvisit');
     $form->addText('date_diff', get_lang('Days'), true);
     $form->addRule('date_diff', 'InvalidNumber', 'numeric');
     $form->addButtonSearch(get_lang('Search'), 'submit');
     if (!isset($_GET['date_diff'])) {
         $defaults['date_diff'] = 60;
     } else {
         $defaults['date_diff'] = Security::remove_XSS($_GET['date_diff']);
     }
     $form->setDefaults($defaults);
     $form->display();
     $values = $form->exportValues();
     $date_diff = $values['date_diff'];
     $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
     if (api_is_multiple_url_enabled()) {
         $sql = "SELECT * FROM {$table} t , {$access_url_rel_course_table} a\n                   WHERE\n                        t.c_id = a.c_id AND\n                        access_url_id='" . $current_url_id . "'\n                   GROUP BY c_id\n                   HAVING c_id <> ''\n                   AND DATEDIFF( '" . date('Y-m-d h:i:s') . "' , access_date ) <= " . $date_diff;
     } else {
         $sql = "SELECT * FROM {$table}\n                   GROUP BY c_id\n                   HAVING c_id <> ''\n                   AND DATEDIFF( '" . date('Y-m-d h:i:s') . "' , access_date ) <= " . $date_diff;
     }
     $sql .= ' ORDER BY ' . $columns[$column] . ' ' . $sql_order[$direction];
     $from = ($page_nr - 1) * $per_page;
     $sql .= ' LIMIT ' . $from . ',' . $per_page;
     echo '<p>' . get_lang('LastAccess') . ' &gt;= ' . $date_diff . ' ' . get_lang('Days') . '</p>';
     $res = Database::query($sql);
     if (Database::num_rows($res) > 0) {
         $courses = array();
         while ($obj = Database::fetch_object($res)) {
             $courseInfo = api_get_course_info_by_id($obj->c_id);
             if (empty($courseInfo)) {
                 continue;
             }
             $course = array();
             $course[] = '<a href="' . api_get_path(WEB_COURSE_PATH) . $courseInfo['code'] . '">' . $courseInfo['code'] . ' <a>';
             // Allow sort by date hiding the numerical date
             $course[] = '<span style="display:none;">' . $obj->access_date . '</span>' . api_convert_and_format_date($obj->access_date);
             $courses[] = $course;
         }
         $parameters['date_diff'] = $date_diff;
         $parameters['report'] = 'courselastvisit';
         $table_header[] = array(get_lang("CourseCode"), true);
         $table_header[] = array(get_lang("LastAccess"), true);
         Display::display_sortable_table($table_header, $courses, array('column' => $column, 'direction' => $direction), array(), $parameters);
     } else {
         echo get_lang('NoSearchResults');
     }
 }
    if ($form_sent == 1) {
        $usergroup->subscribe_courses_to_usergroup($id, $elements_posted);
        header('Location: usergroups.php');
        exit;
    }
}
// Filters
$filters = array(array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')), array('type' => 'text', 'name' => 'title', 'label' => get_lang('Title')));
$searchForm = new FormValidator('search', 'get', api_get_self() . '?id=' . $id);
$searchForm->addHeader(get_lang('AdvancedSearch'));
$renderer =& $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'id', $id);
foreach ($filters as $param) {
    $searchForm->addElement($param['type'], $param['name'], $param['label']);
}
$searchForm->addButtonSearch();
$filterData = array();
if ($searchForm->validate()) {
    $filterData = $searchForm->getSubmitValues();
}
$conditions = array();
if (!empty($filters) && !empty($filterData)) {
    foreach ($filters as $filter) {
        if (isset($filter['name']) && isset($filterData[$filter['name']])) {
            $value = $filterData[$filter['name']];
            if (!empty($value)) {
                $conditions[$filter['name']] = $value;
            }
        }
    }
}
$users_tracking_per_page = '';
if (isset($_GET['users_tracking_per_page'])) {
    $users_tracking_per_page = '&users_tracking_per_page=' . intval($_GET['users_tracking_per_page']);
}
echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&export=csv&' . $addional_param . $users_tracking_per_page . '">
' . Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</span>';
echo '</div>';
// Create a search-box.
$form = new FormValidator('search_simple', 'GET', api_get_path(WEB_CODE_PATH) . 'tracking/course_log_resources.php?' . api_get_cidreq() . '&id_session' . $session_id, '', array('class' => 'form-search'), false);
$renderer = $form->defaultRenderer();
$renderer->setCustomElementTemplate('<span>{element}</span>');
$form->addElement('text', 'keyword', get_lang('Keyword'));
$form->addElement('hidden', 'cidReq', api_get_course_id());
$form->addElement('hidden', 'id_session', $session_id);
$form->addButtonSearch(get_lang('SearchUsers'), 'submit');
echo '<div class="actions">';
$form->display();
echo '</div>';
$table = new SortableTable('resources', array('TrackingCourseLog', 'count_item_resources'), array('TrackingCourseLog', 'get_item_resources_data'), 5, 20, 'DESC');
$parameters = array('id_session' => $session_id, 'cidReq' => api_get_course_id());
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('Tool'));
$table->set_header(1, get_lang('EventType'));
$table->set_header(2, get_lang('Session'), false);
$table->set_header(3, get_lang('UserName'), true, 'width=65px');
$table->set_header(4, get_lang('IPAddress'), true, 'width=100px');
$table->set_header(5, get_lang('Document'), false);
$table->set_header(6, get_lang('Date'), true, 'width=190px');
$table->display();
Display::display_footer();
 /**
  * @param FormValidator $form
  * @return mixed
  */
 public static function setUserSearchForm($form)
 {
     global $_configuration;
     $form->addElement('text', 'keyword', get_lang('Keyword'));
     $form->addElement('select', 'active', get_lang('Status'), array(1 => get_lang('Active'), 0 => get_lang('Inactive')));
     if (isset($_configuration['save_user_last_login']) && $_configuration['save_user_last_login']) {
         $form->addElement('select', 'sleeping_days', get_lang('InactiveDays'), array('', 1 => 1, 5 => 5, 15 => 15, 30 => 30, 60 => 60, 90 => 90, 120 => 120));
     }
     $form->addButtonSearch(get_lang('Search'));
     return $form;
 }
 /**
  * Returns the search form
  * @return string
  */
 public static function getSearchForm()
 {
     $url = api_get_path(WEB_CODE_PATH) . 'group/group_overview.php?' . api_get_cidreq();
     $form = new FormValidator('search_groups', 'get', $url, null, array('class' => 'form-search'), FormValidator::LAYOUT_INLINE);
     $form->addHidden('cidReq', api_get_course_id());
     $form->addHidden('id_session', api_get_session_id());
     $form->addElement('text', 'keyword');
     $form->addButtonSearch();
     return $form->toHtml();
 }
Beispiel #6
0
 $select_priority .= '<option value="NRM">' . $plugin->get_lang('PriorityNormal') . '</option>';
 $select_priority .= '<option value="HGH">' . $plugin->get_lang('PriorityHigh') . '</option>';
 $select_priority .= '<option value="LOW">' . $plugin->get_lang('PriorityLow') . '</option>';
 $select_priority .= "</select>";
 //select unread
 $select_unread = '<select  name = "keyword_unread" id="keyword_unread" >';
 $select_unread .= '<option value="">' . get_lang('All') . '</option>';
 $select_unread .= '<option value="yes">' . $plugin->get_lang('Unread') . '</option>';
 $select_unread .= '<option value="no">' . $plugin->get_lang('Read') . '</option>';
 $select_unread .= "</select>";
 // Create a search-box
 $form = new FormValidator('search_simple', 'get', '', '', null, false);
 $renderer =& $form->defaultRenderer();
 $renderer->setCustomElementTemplate('<span>{element}</span> ');
 $form->addElement('text', 'keyword', get_lang('Keyword'), 'size="25"');
 $form->addButtonSearch(get_lang('Search'), 'submit_simple');
 $form->addElement('static', 'search_advanced_link', null, '<a href="javascript://" class = "advanced-parameters" onclick="display_advanced_search_form();">' . '<span id="img_plus_and_minus">&nbsp;' . Display::return_icon('div_show.gif', get_lang('Show')) . ' ' . get_lang('AdvancedSearch') . '</span></a>');
 echo '<div class="actions" >';
 if (api_is_platform_admin()) {
     echo '<span class="fleft">' . '<a href="' . api_get_path(WEB_PLUGIN_PATH) . 'ticket/src/new_ticket.php">' . Display::return_icon('add.png', $plugin->get_lang('TckNew'), '', '32') . '</a>' . '<a href="' . api_get_self() . '?action=export' . $get_parameter . $get_parameter2 . '">' . Display::return_icon('export_excel.png', get_lang('Export'), '', '32') . '</a>' . '</span>';
 }
 $form->display();
 echo '</div>';
 echo '<form action="' . api_get_self() . '" method="get" name="advanced_search" id="advanced_search" display:"none">
         <div id="advanced_search_form" style="display: block;">
         <div>
            <div class="form_header">' . get_lang('AdvancedSearch') . '</div>
         </div>
         <table >
            <tbody>
               <tr>
 /**
  * Show the search form
  * @param string $query the value of the search box
  * @return string HTML form
  */
 public static function get_search_form($query)
 {
     $searchType = isset($_GET['search_type']) ? $_GET['search_type'] : null;
     $form = new FormValidator('search_user', 'get', api_get_path(WEB_PATH) . 'main/social/search.php', '', array(), FormValidator::LAYOUT_HORIZONTAL);
     $form->addText('q', get_lang('UsersGroups'), false);
     $options = array(0 => get_lang('Select'), 1 => get_lang('User'), 2 => get_lang('Group'));
     $form->addSelect('search_type', get_lang('Type'), $options, array('onchange' => 'javascript: extra_field_toogle();'));
     // Extra fields
     $extraFields = UserManager::get_extra_filtrable_fields();
     $defaults = [];
     if (is_array($extraFields) && count($extraFields) > 0) {
         foreach ($extraFields as $extraField) {
             $varName = 'field_' . $extraField['variable'];
             $options = [0 => get_lang('Select')];
             foreach ($extraField['data'] as $option) {
                 $checked = '';
                 if (isset($_GET[$varName])) {
                     if ($_GET[$varName] == $option[1]) {
                         $defaults[$option[1]] = true;
                     }
                 }
                 $options[$option[1]] = $option[1];
             }
             $form->addSelect($varName, $extraField['name'], $options);
         }
     }
     $defaults['search_type'] = intval($searchType);
     $defaults['q'] = api_htmlentities(Security::remove_XSS($query));
     $form->setDefaults($defaults);
     $form->addButtonSearch(get_lang('Search'));
     $js = '<script>
     extra_field_toogle();
     function extra_field_toogle() {
         if (jQuery("select[name=search_type]").val() != "1") { jQuery(".extra_field").hide(); } else { jQuery(".extra_field").show(); }
     }
     </script>';
     return $js . $form->returnForm();
 }
/**
 * Display the search form for the forum and display the search results
 * @return void display an HTML search results
 * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium
 * @version march 2008, dokeos 1.8.5
 */
function forum_search()
{
    // Initialize the object.
    $form = new FormValidator('forumsearch', 'post', 'forumsearch.php?' . api_get_cidreq());
    // Setting the form elements.
    $form->addElement('header', '', get_lang('ForumSearch'));
    $form->addElement('text', 'search_term', get_lang('SearchTerm'), array('autofocus'));
    $form->applyFilter('search_term', 'html_filter');
    $form->addElement('static', 'search_information', '', get_lang('ForumSearchInformation'));
    $form->addButtonSearch(get_lang('Search'));
    // Setting the rules.
    $form->addRule('search_term', get_lang('ThisFieldIsRequired'), 'required');
    $form->addRule('search_term', get_lang('TooShort'), 'minlength', 3);
    // Validation or display.
    if ($form->validate()) {
        $values = $form->exportValues();
        $form->setDefaults($values);
        $form->display();
        // Display the search results.
        display_forum_search_results(stripslashes($values['search_term']));
    } else {
        $form->display();
    }
}
 /**
  * This is the main function that displays the list or the table with all
  * the glossary terms
  * @param  string  View ('table' or 'list'). Optional parameter.
  * Defaults to 'table' and prefers glossary_view from the session by default.
  * @return void
  * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium
  * @version januari 2009, dokeos 1.8.6
  */
 public static function display_glossary($view = 'table')
 {
     // This function should always be called with the corresponding
     // parameter for view type. Meanwhile, use this cheap trick.
     $glossaryView = Session::read('glossary_view');
     if (empty($glossaryView)) {
         Session::write('glossary_view', $view);
     }
     // action links
     //echo '<div class="actions">';
     $actionsLeft = '';
     if (api_is_allowed_to_edit(null, true)) {
         $actionsLeft .= '<a href="index.php?' . api_get_cidreq() . '&action=addglossary&msg=add?' . api_get_cidreq() . '">' . Display::return_icon('new_glossary_term.png', get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM) . '</a>';
     }
     $actionsLeft .= '<a href="index.php?' . api_get_cidreq() . '&action=export">' . Display::return_icon('export_csv.png', get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>';
     if (api_is_allowed_to_edit(null, true)) {
         $actionsLeft .= '<a href="index.php?' . api_get_cidreq() . '&action=import">' . Display::return_icon('import_csv.png', get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM) . '</a>';
     }
     $actionsLeft .= '<a href="index.php?' . api_get_cidreq() . '&action=export_to_pdf">' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
     if (isset($_SESSION['glossary_view']) && $_SESSION['glossary_view'] == 'table' or !isset($_SESSION['glossary_view'])) {
         $actionsLeft .= '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=list">' . Display::return_icon('view_detailed.png', get_lang('ListView'), '', ICON_SIZE_MEDIUM) . '</a>';
     } else {
         $actionsLeft .= '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=table">' . Display::return_icon('view_text.png', get_lang('TableView'), '', ICON_SIZE_MEDIUM) . '</a>';
     }
     /* BUILD SEARCH FORM */
     $form = new FormValidator('search', 'get', api_get_self() . '?' . api_get_cidreq(), '', array(), FormValidator::LAYOUT_INLINE);
     $form->addText('keyword', '', false, array('class' => 'col-md-2'));
     $form->addElement('hidden', 'cidReq', api_get_course_id());
     $form->addElement('hidden', 'id_session', api_get_session_id());
     $form->addButtonSearch(get_lang('Search'));
     $actionsRight = $form->returnForm();
     $toolbar = Display::toolbarAction('toolbar-document', array(0 => $actionsLeft, 1 => $actionsRight));
     echo $toolbar;
     if ($glossaryView == 'table') {
         $table = new SortableTable('glossary', array('GlossaryManager', 'get_number_glossary_terms'), array('GlossaryManager', 'get_glossary_data'), 0);
         //$table->set_header(0, '', false);
         $table->set_header(0, get_lang('TermName'), true);
         $table->set_header(1, get_lang('TermDefinition'), true);
         if (api_is_allowed_to_edit(null, true)) {
             $table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions'));
             $table->set_column_filter(2, array('GlossaryManager', 'actions_filter'));
         }
         $table->display();
     }
     if ($glossaryView == 'list') {
         GlossaryManager::display_glossary_list();
     }
 }
/* View */
$template = new Template(get_lang('GradebookListOfStudentsCertificates'));
if (Session::has('reportErrorMessage')) {
    $template->assign('errorMessage', Session::read('reportErrorMessage'));
}
$searchBySessionCourseDateForm = new FormValidator('certificate_report_form', 'post', api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php');
$searchBySessionCourseDateForm->addSelect('session', get_lang('Sessions'), $sessions, ['id' => 'session']);
$searchBySessionCourseDateForm->addSelect('course', get_lang('Courses'), $courses, ['id' => 'course']);
$searchBySessionCourseDateForm->addGroup([$searchBySessionCourseDateForm->createElement('select', 'month', null, $months, ['id' => 'month']), $searchBySessionCourseDateForm->createElement('text', 'year', null, ['id' => 'year', 'placeholder' => get_lang('Year')])], null, get_lang('Date'));
$searchBySessionCourseDateForm->addButtonSearch();
$searchBySessionCourseDateForm->setDefaults(['session' => $selectedSession, 'course' => $selectedCourse, 'month' => $selectedMonth, 'year' => $selectedYear]);
if (api_is_student_boss()) {
    foreach ($userList as $studentId) {
        $students[$studentId] = api_get_user_info($studentId)['complete_name_with_username'];
    }
    $searchByStudentForm = new FormValidator('certificate_report_form', 'post', api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php');
    $searchByStudentForm->addSelect('student', get_lang('Students'), $students, ['id' => 'student']);
    $searchByStudentForm->addButtonSearch();
    $searchByStudentForm->setDefaults(['student' => $selectedStudent]);
    $template->assign('searchByStudentForm', $searchByStudentForm->returnForm());
}
$template->assign('searchBySessionCourseDateForm', $searchBySessionCourseDateForm->returnForm());
$template->assign('sessions', $sessions);
$template->assign('courses', $courses);
$template->assign('months', $months);
$template->assign('exportAllLink', $exportAllLink);
$template->assign('certificateStudents', $certificateStudents);
$content = $template->fetch("default/gradebook/certificate_report.tpl");
$template->assign('content', $content);
$template->display_one_col_template();
Session::erase('reportErrorMessage');
Beispiel #11
0
if (empty($_GET['category'])) {
    $_GET['category'] = 'Platform';
}
$watermark_deleted = false;
if (isset($_GET['delete_watermark'])) {
    $watermark_deleted = PDF::delete_watermark();
    Display::addFlash(Display::return_message(get_lang('FileDeleted')));
}
if (isset($_GET['action']) && $_GET['action'] == 'delete_grading') {
    $id = intval($_GET['id']);
    api_delete_setting_option($id);
}
$form_search = new FormValidator('search_settings', 'get', api_get_self(), null, array(), FormValidator::LAYOUT_INLINE);
$form_search->addElement('text', 'search_field');
$form_search->addElement('hidden', 'category', 'search_setting');
$form_search->addButtonSearch(get_lang('Search'), 'submit_button');
$form_search->setDefaults(array('search_field' => isset($_REQUEST['search_field']) ? $_REQUEST['search_field'] : null));
$form_search_html = $form_search->returnForm();
$url_id = api_get_current_access_url_id();
$settings = null;
function get_settings($category = null)
{
    $url_id = api_get_current_access_url_id();
    $settings_by_access_list = array();
    if ($url_id == 1) {
        $settings = api_get_settings($category, 'group', $url_id);
    } else {
        $url_info = api_get_access_url($url_id);
        if ($url_info['active'] == 1) {
            // The default settings of Chamilo
            $settings = api_get_settings($category, 'group', 1, 0);
Beispiel #12
0
 /**
  * @param string $action
  */
 public function getSearchPages($action)
 {
     echo '<div class="actions">' . get_lang('SearchPages') . '</div>';
     if (isset($_GET['mode_table'])) {
         if (!isset($_GET['SearchPages_table_page_nr'])) {
             $_GET['search_term'] = isset($_POST['search_term']) ? $_POST['search_term'] : '';
             $_GET['search_content'] = isset($_POST['search_content']) ? $_POST['search_content'] : '';
             $_GET['all_vers'] = isset($_POST['all_vers']) ? $_POST['all_vers'] : '';
         }
         self::display_wiki_search_results($_GET['search_term'], $_GET['search_content'], $_GET['all_vers']);
     } else {
         // initiate the object
         $form = new FormValidator('wiki_search', 'post', api_get_self() . '?cidReq=' . api_get_course_id() . '&action=' . api_htmlentities($action) . '&session_id=' . api_get_session_id() . '&group_id=' . api_get_group_id() . '&mode_table=yes1');
         // Setting the form elements
         $form->addText('search_term', get_lang('SearchTerm'), true, array('autofocus' => 'autofocus'));
         $form->addElement('checkbox', 'search_content', null, get_lang('AlsoSearchContent'));
         $form->addElement('checkbox', 'all_vers', null, get_lang('IncludeAllVersions'));
         $form->addButtonSearch(get_lang('Search'), 'SubmitWikiSearch');
         // setting the rules
         $form->addRule('search_term', get_lang('TooShort'), 'minlength', 3);
         //TODO: before fixing the pagination rules worked, not now
         if ($form->validate()) {
             $form->display();
             $values = $form->exportValues();
             self::display_wiki_search_results($values['search_term'], $values['search_content'], $values['all_vers']);
         } else {
             $form->display();
         }
     }
 }
Beispiel #13
0
                 $message = Display::return_message(urldecode($_GET['msg']));
             }
             break;
         default:
             break;
     }
 }
 if (isset($_GET['delete_course'])) {
     CourseManager::delete_course($_GET['delete_course']);
     $obj_cat = new Category();
     $obj_cat->update_category_delete($_GET['delete_course']);
 }
 // Create a search-box
 $form = new FormValidator('search_simple', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
 $form->addElement('text', 'keyword', null, array('id' => 'course-search-keyword'));
 $form->addButtonSearch(get_lang('SearchCourse'));
 $advanced = '<a class="btn btn-default" href="' . api_get_path(WEB_CODE_PATH) . 'admin/course_list.php?search=advanced"><em class="fa fa-search"></em> ' . get_lang('AdvancedSearch') . '</a>';
 // Create a filter by session
 $sessionFilter = new FormValidator('course_filter', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
 $url = api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_session';
 $sessionSelect = $sessionFilter->addElement('select_ajax', 'session_name', get_lang('SearchCourseBySession'), null, array('url' => $url));
 if (!empty($sessionId)) {
     $sessionInfo = SessionManager::fetch($sessionId);
     $sessionSelect->addOption($sessionInfo['name'], $sessionInfo['id'], ['selected' => 'selected']);
 }
 $courseListUrl = api_get_self();
 $actions .= '<div class="row">';
 $actions .= '<div class="col-md-2">';
 $actions .= '<a href="course_add.php">' . Display::return_icon('new_course.png', get_lang('AddCourse'), '', ICON_SIZE_MEDIUM) . '</a> ';
 if (api_get_setting('course_validation') == 'true') {
     $actions .= '<a href="course_request_review.php">' . Display::return_icon('course_request_pending.png', get_lang('ReviewCourseRequests'), '', ICON_SIZE_MEDIUM) . '</a>';
Beispiel #14
0
 /**
  * @param FormValidator $form
  * @return mixed
  */
 public static function setUserSearchForm($form)
 {
     $form->addElement('text', 'keyword', get_lang('Keyword'));
     $form->addElement('select', 'active', get_lang('Status'), array(1 => get_lang('Active'), 0 => get_lang('Inactive')));
     $form->addElement('select', 'sleeping_days', get_lang('InactiveDays'), array('', 1 => 1, 5 => 5, 15 => 15, 30 => 30, 60 => 60, 90 => 90, 120 => 120));
     $form->addButtonSearch(get_lang('Search'));
     return $form;
 }
if ($form->validate()) {
    $data = $form->getSubmitValues();
    $filter = intval($data['filter']);
    if (!empty($filter)) {
        $condition = array('status = ? AND id = ? ' => array(1, $filter));
    }
}
$careers = $career->get_all(array('status = ?' => 1));
//only status =1
$career_select_list = array();
$career_select_list[0] = ' -- ' . get_lang('Select') . ' --';
foreach ($careers as $item) {
    $career_select_list[$item['id']] = $item['name'];
}
$form->addSelect('filter', get_lang('Career'), $career_select_list, array('id' => 'filter_1'));
$form->addButtonSearch(get_lang('Filter'));
// action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="careers.php">' . Display::return_icon('career.png', get_lang('Careers'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="promotions.php">' . Display::return_icon('promotion.png', get_lang('Promotions'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$form->display();
$careers = $career->get_all($condition);
//only status =1
$column_count = 3;
$i = 0;
$grid_js = '';
$career_array = array();
if (!empty($careers)) {
    foreach ($careers as $career_item) {
Beispiel #16
0
$form->addText('keyword_email', get_lang('Email'), false);
$form->addText('keyword_officialcode', get_lang('OfficialCode'), false);
$status_options = array();
$status_options['%'] = get_lang('All');
$status_options[STUDENT] = get_lang('Student');
$status_options[COURSEMANAGER] = get_lang('Teacher');
$status_options[DRH] = get_lang('Drh');
$status_options[SESSIONADMIN] = get_lang('SessionsAdmin');
$status_options[PLATFORM_ADMIN] = get_lang('Administrator');
$form->addElement('select', 'keyword_status', get_lang('Profile'), $status_options);
$active_group = array();
$active_group[] = $form->createElement('checkbox', 'keyword_active', '', get_lang('Active'));
$active_group[] = $form->createElement('checkbox', 'keyword_inactive', '', get_lang('Inactive'));
$form->addGroup($active_group, '', get_lang('ActiveAccount'), '<br/>', false);
$form->addElement('checkbox', 'check_easy_passwords', null, get_lang('CheckEasyPasswords'));
$form->addButtonSearch(get_lang('SearchUsers'));
$defaults = array();
$defaults['keyword_active'] = 1;
$defaults['keyword_inactive'] = 1;
$form->setDefaults($defaults);
$form->addElement('html', '</div>');
$form = $form->returnForm();
$table = new SortableTable('users', 'get_number_of_users', 'get_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
$table->set_additional_parameters($parameters);
$table->set_header(0, '', false, 'width="18px"');
$table->set_header(1, get_lang('Photo'), false);
$table->set_header(2, get_lang('OfficialCode'));
if (api_is_western_name_order()) {
    $table->set_header(3, get_lang('FirstName'));
    $table->set_header(4, get_lang('LastName'));
} else {
Beispiel #17
0
        }
    }
    $actionsRight = '';
    if (count($a_sessions) > 0) {
        $actionsRight = Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick' => 'javascript: window.print();'));
        $actionsRight .= Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self() . '?export=csv');
    }
    $toolbar = Display::toolbarAction('toolbar-session', $content = array(0 => $actionsLeft, 1 => $actionsRight));
    echo $toolbar;
    echo Display::page_header(get_lang('YourSessionsList'));
} else {
    $a_sessions = Tracking::get_sessions_coached_by_user($id_coach);
}
$form = new FormValidator('search_course', 'get', api_get_path(WEB_CODE_PATH) . 'mySpace/session.php');
$form->addElement('text', 'keyword', get_lang('Keyword'));
$form->addButtonSearch(get_lang('Search'));
$keyword = '';
if ($form->validate()) {
    $keyword = $form->getSubmitValue('keyword');
}
$form->setDefaults(array('keyword' => $keyword));
$url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_sessions_tracking&keyword=' . Security::remove_XSS($keyword);
$columns = array(get_lang('Title'), get_lang('Date'), get_lang('NbCoursesPerSession'), get_lang('NbStudentPerSession'), get_lang('Details'));
// Column config
$columnModel = array(array('name' => 'name', 'index' => 'name', 'width' => '255', 'align' => 'left'), array('name' => 'date', 'index' => 'date', 'width' => '150', 'align' => 'left', 'sortable' => 'false'), array('name' => 'course_per_session', 'index' => 'course_per_session', 'width' => '150', 'sortable' => 'false'), array('name' => 'student_per_session', 'index' => 'student_per_session', 'width' => '100', 'sortable' => 'false'), array('name' => 'details', 'index' => 'details', 'width' => '100', 'sortable' => 'false'));
$extraParams = array('autowidth' => 'true', 'height' => 'auto');
$js = '<script>
    $(function() {
        ' . Display::grid_js('session_tracking', $url, $columns, $columnModel, $extraParams, array(), null, true) . '
    });
</script>';
Beispiel #18
0
 /**
  * @param string $url
  *
  * @return FormValidator
  */
 public static function getSearchForm($url)
 {
     $form = new FormValidator('search', 'post', $url, null, [], FormValidator::LAYOUT_INLINE);
     $form->addElement('text', 'keyword');
     $form->addButtonSearch(get_lang('Search'));
     return $form;
 }