function insert_db($db_name, $folder_name, $text)
{

    // TODO: The (global?) variable $_course has not been declared/initialized.
    $_course['dbName'] = $db_name;

    $doc_id = add_document_180($_course, '/' . $folder_name, 'folder', 0, api_ucfirst($text));
    api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', 1);
}
 /**
  * Move in template.lib
  */
 private function loadAdminMenu()
 {
     $template = $this->get('template');
     // Access restrictions.
     api_protect_admin_script(true);
     // @todo fix register/check version
     $message = null;
     if (!empty($_POST['Register'])) {
         register_site();
         $message = \Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
     }
     $blocks = array();
     $adminUrl = api_get_path(WEB_CODE_PATH) . 'admin/';
     /* Users */
     $blocks['users']['icon'] = \Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
     $blocks['users']['label'] = api_ucfirst(get_lang('Users'));
     if (api_is_platform_admin()) {
         $search_form = $this->getSearchForm($adminUrl . 'user_list.php')->return_form();
         $blocks['users']['search_form'] = $search_form;
         $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')));
         if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
             $items[] = array('url' => $adminUrl . 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
         }
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields'));
         $items[] = array('url' => api_get_path(WEB_PUBLIC_PATH) . 'admin/administrator/roles', 'label' => get_lang('Roles'));
     } else {
         $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')));
     }
     $blocks['users']['items'] = $items;
     $blocks['users']['extra'] = null;
     if (api_is_platform_admin()) {
         /* Courses */
         $blocks['courses']['icon'] = \Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
         $blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
         $search_form = $this->getSearchForm($adminUrl . 'course_list.php')->return_form();
         $blocks['courses']['search_form'] = $search_form;
         $items = array();
         $items[] = array('url' => $adminUrl . 'course_list.php', 'label' => get_lang('CourseList'));
         if (api_get_setting('course_validation') != 'true') {
             $items[] = array('url' => $adminUrl . 'course_add.php', 'label' => get_lang('AddCourse'));
         } else {
             $items[] = array('url' => $adminUrl . 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
             $items[] = array('url' => $adminUrl . 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
             $items[] = array('url' => $adminUrl . 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
         }
         $items[] = array('url' => $adminUrl . 'course_export.php', 'label' => get_lang('ExportCourses'));
         $items[] = array('url' => $adminUrl . 'course_import.php', 'label' => get_lang('ImportCourses'));
         $items[] = array('url' => $adminUrl . 'course_category.php', 'label' => get_lang('AdminCategories'));
         $items[] = array('url' => $adminUrl . 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
         $items[] = array('url' => $adminUrl . 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=question', 'label' => get_lang('ManageQuestionFields'));
         if (api_get_setting('gradebook_enable_grade_model') == 'true') {
             $items[] = array('url' => $adminUrl . 'grade_models.php', 'label' => get_lang('GradeModel'));
         }
         if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
             $items[] = array('url' => $adminUrl . 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
         }
         $blocks['courses']['items'] = $items;
         $blocks['courses']['extra'] = null;
         /* Platform */
         $blocks['platform']['icon'] = \Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
         $blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
         $form = $this->getSearchForm($adminUrl . 'settings.php');
         $form->addElement('hidden', 'category', 'search_setting');
         $search_form = $form->return_form();
         $blocks['platform']['search_form'] = $search_form;
         $items = array();
         $items[] = array('url' => $adminUrl . 'settings.php', 'label' => get_lang('PlatformConfigSettings'));
         $items[] = array('url' => $adminUrl . 'settings.php?category=Plugins', 'label' => get_lang('Plugins'));
         $items[] = array('url' => $adminUrl . 'settings.php?category=Regions', 'label' => get_lang('Regions'));
         $items[] = array('url' => $adminUrl . 'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
         $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda'));
         $items[] = array('url' => $adminUrl . 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
         $items[] = array('url' => $adminUrl . 'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
         $items[] = array('url' => $adminUrl . 'statistics/index.php', 'label' => get_lang('Statistics'));
         $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'mySpace/company_reports.php', 'label' => get_lang('Reports'));
         /* Event settings */
         if (api_get_setting('activate_email_template') == 'true') {
             $items[] = array('url' => $adminUrl . 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
         }
         if (api_get_multiple_access_url()) {
             if (api_is_global_platform_admin()) {
                 $items[] = array('url' => $adminUrl . 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
             }
         }
         if (api_get_setting('allow_reservation') == 'true') {
             //$items[] = array('url' => $adminUrl.'../reservation/m_category.php', 	'label' => get_lang('BookingSystem'));
         }
         if (api_get_setting('allow_terms_conditions') == 'true') {
             $items[] = array('url' => $adminUrl . 'legal_add.php', 'label' => get_lang('TermsAndConditions'));
         }
         $blocks['platform']['items'] = $items;
         $blocks['platform']['extra'] = null;
     }
     /* Sessions */
     $blocks['sessions']['icon'] = \Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
     $blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
     $search_form = $this->getSearchForm(api_get_path(WEB_CODE_PATH) . 'session/session_list.php')->return_form();
     $blocks['sessions']['search_form'] = $search_form;
     $items = array();
     $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_list.php', 'label' => get_lang('ListSession'));
     $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_add.php', 'label' => get_lang('AddSession'));
     $items[] = array('url' => 'session_category_list.php', 'label' => get_lang('ListSessionCategory'));
     $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_import.php', 'label' => get_lang('ImportSessionListXMLCSV'));
     if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
         $items[] = array('url' => $adminUrl . 'ldap_import_students_to_session.php', 'label' => get_lang('ImportLDAPUsersIntoSession'));
     }
     $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'session/session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
     $items[] = array('url' => $adminUrl . '../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
     if (api_is_platform_admin()) {
         if (is_dir(api_get_path(SYS_TEST_PATH) . 'datafiller/')) {
             // option only visible in development mode. Enable through code if required
             $items[] = array('url' => $adminUrl . 'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
         }
         $items[] = array('url' => $adminUrl . 'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
     }
     $items[] = array('url' => $adminUrl . 'usergroups.php', 'label' => get_lang('Classes'));
     $items[] = array('url' => $adminUrl . 'exercise_report.php', 'label' => get_lang('ExerciseReport'));
     $items[] = array('url' => $adminUrl . 'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields'));
     $blocks['sessions']['items'] = $items;
     $blocks['sessions']['extra'] = null;
     /* Settings */
     if (api_is_platform_admin()) {
         $blocks['settings']['icon'] = \Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_SMALL, false);
         $blocks['settings']['label'] = api_ucfirst(get_lang('System'));
         $items = array();
         $items[] = array('url' => $adminUrl . 'special_exports.php', 'label' => get_lang('SpecialExports'));
         if (!empty($_configuration['db_admin_path'])) {
             $items[] = array('url' => $_configuration['db_admin_path'], 'label' => get_lang('AdminDatabases') . ' (' . get_lang('DBManagementOnlyForServerAdmin') . ') ');
         }
         $items[] = array('url' => $adminUrl . 'system_status.php', 'label' => get_lang('SystemStatus'));
         if (is_dir(api_get_path(SYS_TEST_PATH) . 'datafiller/')) {
             $items[] = array('url' => $adminUrl . 'filler.php', 'label' => get_lang('DataFiller'));
         }
         $items[] = array('url' => $adminUrl . 'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
         $items[] = array('url' => $adminUrl . 'system_management.php', 'label' => get_lang('SystemManagement'));
         $blocks['settings']['items'] = $items;
         $blocks['settings']['extra'] = null;
         $blocks['settings']['search_form'] = null;
         //Skills
         if (api_get_setting('allow_skills_tool') == 'true') {
             $blocks['skills']['icon'] = \Display::return_icon('logo.png', get_lang('Skills'), array(), ICON_SIZE_SMALL, false);
             $blocks['skills']['label'] = get_lang('Skills');
             $items = array();
             //$items[] = array('url' => $adminUrl.'skills.php',           'label' => get_lang('SkillsTree'));
             $items[] = array('url' => $adminUrl . 'skills_wheel.php', 'label' => get_lang('SkillsWheel'));
             $items[] = array('url' => $adminUrl . 'skills_import.php', 'label' => get_lang('SkillsImport'));
             //$items[] = array('url' => $adminUrl.'skills_profile.php',   'label' => get_lang('SkillsProfile'));
             $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'social/skills_ranking.php', 'label' => get_lang('SkillsRanking'));
             $items[] = array('url' => $adminUrl . 'skills_gradebook.php', 'label' => get_lang('SkillsAndGradebooks'));
             $blocks['skills']['items'] = $items;
             $blocks['skills']['extra'] = null;
             $blocks['skills']['search_form'] = null;
         }
         /** Chamilo.org */
         $blocks['chamilo']['icon'] = \Display::return_icon('logo.png', 'Chamilo.org', array(), ICON_SIZE_SMALL, false);
         $blocks['chamilo']['label'] = 'Chamilo.org';
         $items = array();
         $items[] = array('url' => 'http://www.chamilo.org/', 'label' => get_lang('ChamiloHomepage'));
         $items[] = array('url' => 'http://www.chamilo.org/forum', 'label' => get_lang('ChamiloForum'));
         $items[] = array('url' => '../../documentation/installation_guide.html', 'label' => get_lang('InstallationGuide'));
         $items[] = array('url' => '../../documentation/changelog.html', 'label' => get_lang('ChangesInLastVersion'));
         $items[] = array('url' => '../../documentation/credits.html', 'label' => get_lang('ContributorsList'));
         $items[] = array('url' => '../../documentation/security.html', 'label' => get_lang('SecurityGuide'));
         $items[] = array('url' => '../../documentation/optimization.html', 'label' => get_lang('OptimizationGuide'));
         $items[] = array('url' => 'http://www.chamilo.org/extensions', 'label' => get_lang('ChamiloExtensions'));
         $items[] = array('url' => 'http://www.chamilo.org/en/providers', 'label' => get_lang('ChamiloOfficialServicesProviders'));
         $blocks['chamilo']['items'] = $items;
         $blocks['chamilo']['extra'] = null;
         $blocks['chamilo']['search_form'] = null;
     }
     $admin_ajax_url = api_get_path(WEB_AJAX_PATH) . 'admin.ajax.php';
     $template->assign('web_admin_ajax_url', $admin_ajax_url);
     $template->assign('blocks', $blocks);
 }
 */
$this_section = SECTION_COURSES;
api_protect_course_script();
require 'learnpath_functions.inc.php';
require 'resourcelinker.inc.php';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if (!$is_allowed_to_edit) {
    header('location:lp_controller.php?action=list&' . api_get_cidreq());
    exit;
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list?' . api_get_cidreq(), 'name' => get_lang('LearningPaths'));
$form = new FormValidator('lp_add_category', 'post', 'lp_controller.php?' . api_get_cidreq());
// Form title
$form->addElement('header', null, get_lang('AddLPCategory'));
// Title
$form->addElement('text', 'name', api_ucfirst(get_lang('Name')));
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'action', 'add_lp_category');
$form->addElement('hidden', 'c_id', api_get_course_int_id());
$form->addElement('hidden', 'id', 0);
$form->addButtonSave(get_lang('Save'));
if ($form->validate()) {
    $values = $form->getSubmitValues();
    if (!empty($values['id'])) {
        learnpath::updateCategory($values);
        $url = api_get_self() . '?action=list&' . api_get_cidreq();
        header('Location: ' . $url);
        exit;
    } else {
        learnpath::createCategory($values);
        $url = api_get_self() . '?action=list&' . api_get_cidreq();
Beispiel #4
0
$items[] = array('url' => $sessionPath . 'session_export.php', 'label' => get_lang('ExportSessionListXMLCSV'));
$items[] = array('url' => '../coursecopy/copy_course_session.php', 'label' => get_lang('CopyFromCourseInSessionToAnotherSession'));
if (api_is_platform_admin()) {
    // option only visible in development mode. Enable through code if required
    if (is_dir(api_get_path(SYS_TEST_PATH) . 'datafiller/')) {
        $items[] = array('url' => 'user_move_stats.php', 'label' => get_lang('MoveUserStats'));
    }
    $items[] = array('url' => 'career_dashboard.php', 'label' => get_lang('CareersAndPromotions'));
    $items[] = array('url' => 'extra_fields.php?type=session', 'label' => get_lang('ManageSessionFields'));
}
$blocks['sessions']['items'] = $items;
$blocks['sessions']['extra'] = null;
/* Settings */
if (api_is_platform_admin()) {
    $blocks['settings']['icon'] = Display::return_icon('settings.png', get_lang('System'), array(), ICON_SIZE_MEDIUM, false);
    $blocks['settings']['label'] = api_ucfirst(get_lang('System'));
    $blocks['settings']['class'] = 'block-admin-settings';
    $items = array();
    $items[] = array('url' => 'special_exports.php', 'label' => get_lang('SpecialExports'));
    $items[] = array('url' => 'system_status.php', 'label' => get_lang('SystemStatus'));
    if (is_dir(api_get_path(SYS_TEST_PATH) . 'datafiller/')) {
        $items[] = array('url' => 'filler.php', 'label' => get_lang('DataFiller'));
    }
    $items[] = array('url' => 'archive_cleanup.php', 'label' => get_lang('ArchiveDirCleanup'));
    $items[] = array('url' => 'resource_sequence.php', 'label' => get_lang('ResourcesSequencing'));
    if (isset($_configuration['db_manager_enabled']) && $_configuration['db_manager_enabled'] == true && api_is_global_platform_admin()) {
        $host = $_configuration['db_host'];
        $username = $_configuration['db_user'];
        $databaseName = $_configuration['main_database'];
        $items[] = array('url' => "db.php?username={$username}&db={$databaseName}&server={$host}", 'label' => get_lang('Database Manager'));
    }
/**
 * A callback for serving the function api_ucwords().
 * @param array $matches	Input array of matches corresponding to a single word
 * @return string			Returns a with first char of the word in uppercase
 */
function _api_utf8_ucwords_callback($matches)
{
    return $matches[2] . api_ucfirst(ltrim($matches[0]), 'UTF-8');
}
Beispiel #6
0
while ($row = Database::fetch_array($result, 'ASSOC')) {
    echo '<tr>';
    echo '	<td>' . $question_counter . '</td>';
    echo '	<td>';
    if (api_strlen($row['survey_question']) > 100) {
        echo api_substr(strip_tags($row['survey_question']), 0, 100) . ' ... ';
    } else {
        echo $row['survey_question'];
    }
    if ($row['type'] == 'yesno') {
        $tool_name = get_lang('YesNo');
    } else {
        if ($row['type'] == 'multiplechoice') {
            $tool_name = get_lang('UniqueSelect');
        } else {
            $tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
        }
    }
    echo '</td>';
    echo '	<td>' . $tool_name . '</td>';
    echo '	<td>' . $row['number_of_options'] . '</td>';
    echo '	<td>';
    echo '		<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/question.php?' . api_get_cidreq() . '&amp;action=edit&amp;type=' . $row['type'] . '&amp;survey_id=' . $survey_id . '&amp;question_id=' . $row['question_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
    echo '		<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey.php?' . api_get_cidreq() . '&amp;action=delete&amp;survey_id=' . $survey_id . '&amp;question_id=' . $row['question_id'] . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion") . '?', ENT_QUOTES, $charset)) . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
    if ($question_counter > 1) {
        echo '		<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey.php?' . api_get_cidreq() . '&amp;action=moveup&amp;survey_id=' . $survey_id . '&amp;question_id=' . $row['question_id'] . '">' . Display::return_icon('up.png', get_lang('MoveUp'), '', ICON_SIZE_SMALL) . '</a>';
    } else {
        Display::display_icon('up_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
    }
    if ($question_counter < $question_counter_max) {
        echo '		<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey.php?' . api_get_cidreq() . '&amp;action=movedown&amp;survey_id=' . $survey_id . '&amp;question_id=' . $row['question_id'] . '">' . Display::return_icon('down.png', get_lang('MoveDown'), '', ICON_SIZE_SMALL) . '</a>';
    /**
     * This function does the generic part of any survey question: the question field
     *
     * @author Patrick Cool <*****@*****.**>, Ghent University
     * @version January 2007
     *
     * @todo the form_text has to become a wysiwyg editor or adding a question_comment field
     * @todo consider adding a question_comment form element
     */
    function create_form($form_content)
    {
        global $survey_data;
        //$tool_name = '<img src="../img/'.self::icon_question($_GET['type']).'" alt="'.get_lang(ucfirst($_GET['type'])).'" title="'.get_lang(ucfirst($_GET['type'])).'" />';
        $tool_name = Display::return_icon(survey_manager::icon_question(Security::remove_XSS($_GET['type'])), get_lang(ucfirst(Security::remove_XSS($_GET['type']))), array('align' => 'middle', 'height' => '22px')) . ' ';
        if ($_GET['action'] == 'add') {
            $tool_name .= get_lang('AddQuestion');
        }
        if ($_GET['action'] == 'edit') {
            $tool_name .= get_lang('EditQuestion');
        }
        if ($_GET['type'] == 'yesno') {
            $tool_name .= ': ' . get_lang('YesNo');
        } else {
            if ($_GET['type'] == 'multiplechoice') {
                $tool_name .= ': ' . get_lang('UniqueSelect');
            } else {
                $tool_name .= ': ' . get_lang(api_ucfirst(Security::remove_XSS($_GET['type'])));
            }
        }
        $question_id = isset($_GET['question_id']) ? Security::remove_XSS($_GET['question_id']) : null;
        $this->html .= '<form class="form-horizontal" id="question_form" name="question_form" method="post" action="' . api_get_self() . '?action=' . Security::remove_XSS($_GET['action']) . '&type=' . Security::remove_XSS($_GET['type']) . '&survey_id=' . Security::remove_XSS($_GET['survey_id']) . '&question_id=' . $question_id . '">';
        $this->html .= '<legend>' . $tool_name . '</legend>';
        $this->html .= '		<input type="hidden" name="survey_id" id="survey_id" value="' . Security::remove_XSS($_GET['survey_id']) . '"/>';
        $this->html .= '		<input type="hidden" name="question_id" id="question_id" value="' . $question_id . '"/>';
        $this->html .= '		<input type="hidden" name="shared_question_id" id="shared_question_id" value="' . Security::remove_XSS($form_content['shared_question_id']) . '"/>';
        $this->html .= '		<input type="hidden" name="type" id="type" value="' . Security::remove_XSS($_GET['type']) . '"/>';
        // question field
        $this->html .= '	<div class="control-group">';
        $this->html .= '		<label class="control-label">';
        $this->html .= '			<span class="form_required">*</span> ' . get_lang('Question');
        $this->html .= '		</label>';
        $this->html .= '		<div class="controls">';
        $this->html .= api_return_html_area('question', Security::remove_XSS($form_content['question'], STUDENT), '', '', null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '120'));
        $this->html .= '		</div>';
        $this->html .= '	</div>';
        if ($survey_data['survey_type'] == 1) {
            $table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
            $sql = 'SELECT id,name FROM ' . $table_survey_question_group . ' WHERE survey_id = ' . (int) $_GET['survey_id'] . ' ORDER BY name';
            $rs = Database::query($sql);
            $glist = null;
            while ($row = Database::fetch_array($rs, 'NUM')) {
                $glist .= '<option value="' . $row[0] . '" >' . $row[1] . '</option>';
            }
            $grouplist = $grouplist1 = $grouplist2 = $glist;
            if (!empty($form_content['assigned'])) {
                $grouplist = str_replace('<option value="' . $form_content['assigned'] . '"', '<option value="' . $form_content['assigned'] . '" selected', $glist);
            }
            if (!empty($form_content['assigned1'])) {
                $grouplist1 = str_replace('<option value="' . $form_content['assigned1'] . '"', '<option value="' . $form_content['assigned1'] . '" selected', $glist);
            }
            if (!empty($form_content['assigned2'])) {
                $grouplist2 = str_replace('<option value="' . $form_content['assigned2'] . '"', '<option value="' . $form_content['assigned2'] . '" selected', $glist);
            }
            $this->html .= '	<tr><td colspan="">
			<fieldset style="border:1px solid black"><legend>' . get_lang('Condition') . '</legend>

			<b>' . get_lang('Primary') . '</b><br />
			' . '<input type="radio" name="choose" value="1" ' . ($form_content['choose'] == 1 ? 'checked' : '') . '><select name="assigned">' . $grouplist . '</select><br />';
            $this->html .= '
			<b>' . get_lang('Secondary') . '</b><br />
			' . '<input type="radio" name="choose" value="2" ' . ($form_content['choose'] == 2 ? 'checked' : '') . '><select name="assigned1">' . $grouplist1 . '</select> ' . '<select name="assigned2">' . $grouplist2 . '</select>' . '</fieldset><br />';
        }
        return $this->html;
    }
Beispiel #8
0
    echo $i;
    ?>
</option>
        <?php 
}
?>
          </select>
           <br />      <br />

            <?php 
echo get_lang('SessionVisibility');
?>
 <br />
            <select name="session_visibility" style="width:250px;">
                <?php 
$visibility_list = array(SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'), SESSION_VISIBLE => get_lang('SessionAccessible'), SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible')));
foreach ($visibility_list as $key => $item) {
    ?>
                <option value="<?php 
    echo $key;
    ?>
" <?php 
    if ($key == $infos['visibility']) {
        echo 'selected="selected"';
    }
    ?>
><?php 
    echo $item;
    ?>
</option>
                <?php 
Beispiel #9
0
    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'gradebook/index.php?' . api_get_cidreq(), 'name' => get_lang('ToolGradebook'));
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&' . api_get_cidreq(), 'name' => get_lang('LearningPaths'));
Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path');
echo '<div class="actions">';
echo '<a href="lp_controller.php?' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
Display::display_normal_message(get_lang('AddLpIntro'), false);
if ($_POST and empty($_REQUEST['lp_name'])) {
    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
$form = new FormValidator('lp_add', 'post', api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq());
// Form title
$form->addElement('header', get_lang('AddLpToStart'));
// Title
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LPName')), array('autofocus' => 'autofocus'));
$form->applyFilter('lp_name', 'html_filter');
$form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'post_time', time());
$form->addElement('hidden', 'action', 'add_lp');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id(), true);
$form->addElement('select', 'category_id', get_lang('Category'), $items);
// Start date
$form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
$form->addElement('html', '<div id="start_date_div" style="display:block;">');
$form->addElement('DatePicker', 'publicated_on', get_lang('PublicationDate'));
$form->addElement('html', '</div>');
//End date
$form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
Beispiel #10
0
        //Courses without sessions
        $i=1;
        foreach ($list as $key => $value) {
            if ( empty($value[2]) ) { //if out of any session
                $my_courses .=  $value[1];
                $my_courses .=  '<div id="social_content'.$i.'"'
                .' class="course_social_content" style="display:none" >s</div>';
                $i++;
            }
        }
        $my_courses .=  '</div>';        //social-content-training
        $socialRightInformation .=  SocialManager::social_wrapper_div($my_courses, 4);
    }


    $sessions =  '<div><h3>'.api_ucfirst(get_lang('MySessions')).'</h3></div>';
    $sessions .=  "<div class='social-content-training'>$htmlSessionList</div>";
    $socialRightInformation .=  SocialManager::social_wrapper_div($sessions, 4);


    // user feeds
    $user_feeds = SocialManager::get_user_feeds($user_id);
    if (!empty($user_feeds)) {
        $rss =  '<div><h3>'.get_lang('RSSFeeds').'</h3></div>';
        $rss .=  '<div class="social-content-training">'.$user_feeds.'</div>';
        $socialRightInformation .=  SocialManager::social_wrapper_div($rss, 4);
    }

    //--Productions
    $production_list =  UserManager::build_production_list($user_id);
    </tr>
    <tr>
    	<td>
    		<?php 
    echo api_ucfirst(get_lang('SessionVisibility'));
    ?>
 :
    	</td>
    	<td>
    		<?php 
    if ($session['visibility'] == 1) {
        echo get_lang('ReadOnly');
    } elseif ($session['visibility'] == 2) {
        echo get_lang('Visible');
    } elseif ($session['visibility'] == 3) {
        echo api_ucfirst(get_lang('Invisible'));
    }
    ?>
    	</td>
    </tr>
    <?php 
    $multiple_url_is_on = api_get_multiple_access_url();
    if ($multiple_url_is_on) {
        echo '<tr><td>';
        echo 'URL';
        echo '</td>';
        echo '<td>';
        $url_list = UrlManager::get_access_url_from_session($id_session);
        foreach ($url_list as $url_data) {
            echo $url_data['url'] . '<br />';
        }
echo '<script>
		function SendEx(num) { 
        
		  	if (num == -1) {	  	
		  		self.parent.window.location.href = "exercise_result.php?take_session=1&exerciseId=' . $exerciseId . '&num="+num+"&exerciseType=' . $exerciseType . '&origin=' . $origin . '&learnpath_item_id=' . $learnpath_item_id . '&learnpath_id=' . $learnpath_id . '"; 
		   		self.parent.tb_remove();  	
		  	} else {
                num -= 1;
		  		self.parent.window.location.href = "exercise_submit.php?tryagain=1&exerciseId=' . $exerciseId . '&num="+num+"&exerciseType=' . $exerciseType . '&origin=' . $origin . '&learnpath_item_id=' . $learnpath_item_id . '&learnpath_id=' . $learnpath_id . '"; 
		   		self.parent.tb_remove();
		  	}
		}
		</script>';
if ($links != '') {
    echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
    <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">' . api_ucfirst(get_lang('Close')) . '</a>
	<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1>';
    if ($answerType == HOT_SPOT_DELINEATION) {
        if ($organs_at_risk_hit > 0) {
            //$message='<p>'.get_lang('YourDelineation').'</p>';
            //$message.=$table_resume;
            $message .= '<br />' . get_lang('ResultIs') . ' <b>' . get_lang('Unacceptable') . '</b><br />';
            //if ($wrong_results) { }
            $message .= '<p style="color:#DC0A0A;"><b>' . get_lang('OARHit') . '</b></p>';
            $message .= '<p>' . $comment . '</p>';
        } else {
            $message = '<p>' . get_lang('YourDelineation') . '</p>';
            $message .= $table_resume;
            $message .= '<br />' . get_lang('ResultIs') . ' <b>' . $result_comment . '</b><br />';
            $message .= '<p>' . $comment . '</p>';
        }
Beispiel #13
0
</div><br />

<div id="container-9">
    <ul>
        <li><a href="<?php 
echo api_get_path(WEB_AJAX_PATH) . 'myspace.ajax.php?a=access_detail&type=day&course=' . $courseId . '&student=' . $user_id;
?>
"><span> <?php 
echo api_ucfirst(get_lang('Day'));
?>
</span></a></li>
        <li><a href="<?php 
echo api_get_path(WEB_AJAX_PATH) . 'myspace.ajax.php?a=access_detail&type=month&course=' . $courseId . '&student=' . $user_id;
?>
"><span> <?php 
echo api_ucfirst(get_lang('MinMonth'));
?>
</span></a></li>
    </ul>
</div>

<div id="cev_results" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
    <div class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"><?php 
echo get_lang('DateAndTimeOfAccess'), ' - ', get_lang('Duration');
?>
</div><br />
    <div id="cev_cont_results" >
    <div id="cev_slider" class="slider">
        <?php 
if ($result_to_print != "") {
    echo $result_to_print;
$action_images['search'] = 'search.gif';
///added for cloud
$action_images['cloud'] = '../scorm_cloud/img/cloud_icon_sm.gif';
// grabbing the categories
//$selectcategories = "SELECT DISTINCT category FROM ".$table_settings_current." WHERE category NOT IN ('stylesheets','Plugins')";
//$resultcategories = api_sql_query($selectcategories, __FILE__, __LINE__);
$resultcategories = api_get_settings_categories(array('stylesheets', 'Plugins', 'Templates', 'Search'));
echo "\n<div class=\"actions\">";
//while ($row = mysql_fetch_array($resultcategories))
foreach ($resultcategories as $row) {
    echo "\n\t<a href=\"" . api_get_self() . "?category=" . $row['category'] . "\">" . Display::return_icon($action_images[strtolower($row['category'])], api_ucfirst(get_lang($row['category']))) . api_ucfirst(get_lang($row['category'])) . "</a>";
}
echo "\n\t<a href=\"" . api_get_self() . "?category=Plugins\">" . Display::return_icon($action_images['plugins'], api_ucfirst(get_lang('Plugins'))) . api_ucfirst(get_lang('Plugins')) . "</a>";
echo "\n\t<a href=\"" . api_get_self() . "?category=stylesheets\">" . Display::return_icon($action_images['stylesheets'], api_ucfirst(get_lang('Stylesheets'))) . api_ucfirst(get_lang('Stylesheets')) . "</a>";
echo "\n\t<a href=\"" . api_get_self() . "?category=Templates\">" . Display::return_icon($action_images['templates'], api_ucfirst(get_lang('Templates'))) . api_ucfirst(get_lang('Templates')) . "</a>";
echo "\n\t<a href=\"" . api_get_self() . "?category=Search\">" . Display::return_icon($action_images['search'], api_ucfirst(get_lang('Search'))) . api_ucfirst(get_lang('Search')) . "</a>";
echo "\n</div>";
if (isset($_GET['category'])) {
    switch ($_GET['category']) {
        // displaying the extensions: plugins
        // this will be available to all the sites (access_urls)
        case 'Plugins':
            handle_plugins();
            break;
            // displaying the extensions: Stylesheets
        // displaying the extensions: Stylesheets
        case 'stylesheets':
            handle_stylesheets();
            break;
        case 'Search':
            handle_search();
Beispiel #15
0
     //Display::display_sortable_grid('shared_profile_mygroups', array(), $grid_my_groups, array('hide_navigation'=>true, 'per_page' => 2), $query_vars, false, array(true, true, true,false));
     $total = count($grid_my_groups);
     $i = 1;
     foreach ($grid_my_groups as $group) {
         $my_groups .= $group[0];
         if ($i < $total) {
             $my_groups .= ', ';
         }
         $i++;
     }
     $social_right_content .= SocialManager::social_wrapper_div($my_groups, 9);
 }
 // COURSES LIST
 $my_courses = null;
 if (isset($list) && !empty($list)) {
     $my_courses .= '<div><h3>' . api_ucfirst(get_lang('MyCourses')) . '</h3></div>';
     $my_courses .= '<div class="social-content-training">';
     //Courses without sessions
     $i = 1;
     foreach ($list as $value) {
         if (!empty($value)) {
             //if out of any session
             $my_courses .= $value;
             $my_courses .= '<div id="social_content' . $i . '" class="course_social_content" style="display:none" >s</div>';
             $i++;
         }
     }
     $my_courses .= '</div>';
     //social-content-training
     $social_right_content .= SocialManager::social_wrapper_div($my_courses, 9);
 }
Beispiel #16
0
//require_once '../inc/global.inc.php';
// the section (for the tabs)
$this_section = "session_my_space";
// variables
$user_id = api_get_user_id();
$course_id = api_get_course_id();
$courseId = api_get_course_int_id();
//YW Hack security to quick fix RolesRights bug
$is_allowed = true;
/* Libraries */
require_once api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'resourcelinker/resourcelinker.inc.php';
require_once api_get_path(SYS_CODE_PATH) . 'exercice/hotpotatoes.lib.php';
/* Header */
if ($uInfo) {
    $interbreadcrumb[] = array('url' => '../user/userInfo.php?uInfo=' . Security::remove_XSS($uInfo), "name" => api_ucfirst(get_lang('Users')));
}
$nameTools = get_lang('ToolName');
$htmlHeadXtra[] = "<style>\n/*<![CDATA[*/\n.secLine {background-color : #E6E6E6;}\n.content {padding-left : 15px;padding-right : 15px; }\n.specialLink{color : #0000FF;}\n/*]]>*/\n</style>\n<style media='print' type='text/css'>\n/*<![CDATA[*/\ntd {border-bottom: thin dashed gray;}\n/*]]>*/\n</style>";
Display::display_header($nameTools, "Tracking");
/*	Constants and variables */
$is_allowedToTrack = api_is_course_admin();
$is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $courseId);
// Database Table Definitions
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLEUSER = Database::get_main_table(TABLE_MAIN_USER);
$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
$tbl_learnpath_main = Database::get_course_table(TABLE_LP_MAIN);
$tbl_learnpath_item = Database::get_course_table(TABLE_LP_ITEM);
$tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW);
$tbl_learnpath_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
    /**
     * Gets the admin session list callback of the admin/session_list.php page
     * @param array $options order and limit keys
     * @return array
     */
    public static function get_sessions_admin($options)
    {
        $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
        $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
        $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
        $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
        $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);

        $where = ' WHERE 1=1 ';
        $user_id = api_get_user_id();

        $extraJoin = null;

        if (api_is_session_admin() &&
            api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
        ) {
            $where .= " AND (
                            s.session_admin_id = $user_id  OR
                            sru.id_user = '******' AND
                            sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
                            )
                      ";

            $extraJoin = " INNER JOIN $tbl_session_rel_user sru
                            ON sru.id_session = s.id ";
        }

        if (api_is_allowed_to_edit() && !api_is_platform_admin()) {
            $where.=" AND s.id_coach = $user_id ";
        }

        $coach_name = " CONCAT(u.lastname , ' ', u.firstname) as coach_name ";

        if (api_is_western_name_order()) {
            $coach_name = " CONCAT(u.firstname, ' ', u.lastname) as coach_name ";
        }

        $options['where'] = str_replace(
            array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
            array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
            , $options['where']
        );

        $options['where'] = str_replace("(  session_active = ':'  )", '1=1', $options['where']);

        $options['where'] = str_replace(
            array("AND session_active = '0'  )", " AND (  session_active = '0'  )"),
            array(') GROUP BY s.name HAVING session_active = 0 ', " GROUP BY s.name HAVING session_active = '0' "),
            $options['where']
        );

        $today = api_get_utc_datetime();
        $today = api_strtotime($today, 'UTC');
        $today = date('Y-m-d', $today);

        $courseCondition = null;
        if (strpos($options['where'], 'c.id')) {
            $table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
            $tableCourse = Database::get_main_table(TABLE_MAIN_COURSE);
            $courseCondition = " INNER JOIN $table course_rel_session ON (s.id = course_rel_session.id_session)
                                 INNER JOIN $tableCourse c ON (course_rel_session.course_code = c.code)
                                ";
        }

        $select = "SELECT DISTINCT * FROM (SELECT
                IF (
					(s.date_start <= '$today' AND '$today' <= s.date_end) OR
                    (s.nb_days_access_before_beginning > 0 AND DATEDIFF(s.date_start,'" . $today . "' " . ") <= s.nb_days_access_before_beginning) OR
                    (s.nb_days_access_after_end > 0 AND DATEDIFF('" . $today . "',s.date_end) <= s.nb_days_access_after_end) OR
                    (s.date_start  = '0000-00-00' AND s.date_end  = '0000-00-00' ) OR
					(s.date_start <= '$today' AND '0000-00-00' = s.date_end) OR
					('$today' <= s.date_end AND '0000-00-00' = s.date_start)
				, 1, 0)
				as session_active,
				s.name,
                nbr_courses,
                s.nbr_users,
                s.date_start,
                s.date_end,
                $coach_name,
                sc.name as category_name,
                s.visibility,
                u.user_id,
                s.id";

        $limit = null;
        if (!empty($options['limit'])) {
            $limit = " LIMIT " . $options['limit'];
        }

        if (!empty($options['where'])) {
            $where .= ' '.$options['where'];
        }

        $order = null;
        if (!empty($options['order'])) {
            $order = " ORDER BY " . $options['order'];
        }

        $query = "$select FROM $tbl_session s
				LEFT JOIN $tbl_session_category sc ON s.session_category_id = sc.id
				LEFT JOIN $tbl_user u ON s.id_coach = u.user_id
				$courseCondition
				$extraJoin
                $where $order $limit";

        if (api_is_multiple_url_enabled()) {
            $access_url_id = api_get_current_access_url_id();
            if ($access_url_id != -1) {
                $query = " $select
                           FROM $tbl_session s
                               LEFT JOIN  $tbl_session_category sc ON s.session_category_id = sc.id
                               LEFT JOIN $tbl_user u ON s.id_coach = u.user_id
                               INNER JOIN $table_access_url_rel_session ar ON ar.session_id = s.id AND ar.access_url_id = $access_url_id
                               $courseCondition
                               $extraJoin
				 $where $order $limit";
            }
        }

        $query .= ") AS session_table";

        $result = Database::query($query);
        $formatted_sessions = array();
        if (Database::num_rows($result)) {
            $sessions = Database::store_result($result);
            foreach ($sessions as $session) {
                $session['name'] = Display::url($session['name'], "resume_session.php?id_session=" . $session['id']);
                $session['coach_name'] = Display::url($session['coach_name'], "user_information.php?user_id=" . $session['user_id']);

                if ($session['date_start'] == '0000-00-00' && $session['date_end'] == '0000-00-00') {
                    //    $session['session_active'] = 1;
                }

                if ($session['session_active'] == 1) {
                    $session['session_active'] = Display::return_icon('accept.png', get_lang('Active'), array(), ICON_SIZE_SMALL);
                } else {
                    $session['session_active'] = Display::return_icon('error.png', get_lang('Inactive'), array(), ICON_SIZE_SMALL);
                }

                if ($session['date_start'] == '0000-00-00') {
                    $session['date_start'] = '';
                }
                if ($session['date_end'] == '0000-00-00') {
                    $session['date_end'] = '';
                }

                switch ($session['visibility']) {
                    case SESSION_VISIBLE_READ_ONLY: //1
                        $session['visibility'] = get_lang('SessionReadOnly');
                        break;
                    case SESSION_VISIBLE:           //2
                        $session['visibility'] = get_lang('SessionAccessible');
                        break;
                    case SESSION_INVISIBLE:         //3
                        $session['visibility'] = api_ucfirst(get_lang('SessionNotAccessible'));
                        break;
                }
                $formatted_sessions[] = $session;
            }
        }
        return $formatted_sessions;
    }
Beispiel #18
0
    $result .= '<h3>' . $output[0]['title'] . '</h3>' . "\n";
    $result .= '<table>';
    foreach ($output as $line) {
        $result .= '<tr>';
        $result .= '<td class="filler-report-data-init">' . $line['line-init'] . ' </td><td class="filler-report-data">' . $line['line-info'] . '</td>';
        $result .= '</tr>';
    }
    $result .= '</table>';
    $result .= '</div>';
    Display::display_normal_message($result, false);
}
?>
<div class="well_border">
  <h4><?php 
Display::display_icon('bug.gif', 'DataFiller');
echo ' ' . api_ucfirst(get_lang('DataFiller'));
?>
</h4>
  <div><?php 
echo get_lang('ThisSectionIsOnlyVisibleOnSourceInstalls');
?>
</div>
  <ul>
    <li><a href="filler.php?fill=users"><?php 
echo get_lang('FillUsers');
?>
</a></li>
    <li><a href="filler.php?fill=courses"><?php 
echo get_lang('FillCourses');
?>
</a></li>
Beispiel #19
0
$resultcategories[] = array('category' => 'Tuning');
$resultcategories[] = array('category' => 'Gradebook');
$resultcategories[] = array('category' => 'Timezones');
$resultcategories[] = array('category' => 'Tracking');
$resultcategories[] = array('category' => 'Search');
$resultcategories[] = array('category' => 'Stylesheets');
$resultcategories[] = array('category' => 'Templates');
$resultcategories[] = array('category' => 'Plugins');
$resultcategories[] = array('category' => 'LDAP');
$resultcategories[] = array('category' => 'CAS');
$resultcategories[] = array('category' => 'Shibboleth');
$resultcategories[] = array('category' => 'Facebook');
foreach ($resultcategories as $row) {
    $url = array();
    $url['url'] = api_get_self() . "?category=" . $row['category'];
    $url['content'] = Display::return_icon($action_images[strtolower($row['category'])], api_ucfirst(get_lang($row['category'])), '', ICON_SIZE_MEDIUM);
    if (strtolower($row['category']) == strtolower($_GET['category'])) {
        $url['active'] = true;
    }
    $action_array[] = $url;
}
echo Display::actions($action_array);
echo '<br />';
echo $form_search_html;
if ($watermark_deleted) {
    Display::display_normal_message(get_lang('FileDeleted'));
}
// Displaying the message that the settings have been stored.
if (isset($form) && $form->validate()) {
    Display::display_confirmation_message(get_lang('SettingsStored'));
    if (is_array($message)) {
Beispiel #20
0
function activate_end_date() {
    if(document.getElementById(\'end_date_div\').style.display == \'none\') {
        document.getElementById(\'end_date_div\').style.display = \'block\';
    } else {
        document.getElementById(\'end_date_div\').style.display = \'none\';
    }
}

</script>';
$defaults = array();
$form = new FormValidator('form1', 'post', 'lp_controller.php');
// Form title
$form->addElement('header', get_lang('EditLPSettings'));
// Title
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LearnpathTitle')), array('size' => 43));
$form->applyFilter('lp_name', 'html_filter');
$form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'lp_encoding');
$items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id(), true);
$form->addElement('select', 'category_id', get_lang('Category'), $items);
// Origin
/*
$origin_select = $form->addElement('select', 'lp_maker', get_lang('Origin'));
$lp_orig = $_SESSION['oLP']->get_maker();

include 'content_makers.inc.php';
foreach ($content_origins as $origin) {
    if ($lp_orig == $origin) {
        $s_selected_origin = $origin;
    }
 /**
  * Get the HTML-code which represents a form to select how many items a page
  * should contain.
  */
 public function get_page_select_form()
 {
     $total_number_of_items = $this->get_total_number_of_items();
     if ($total_number_of_items <= $this->default_items_per_page) {
         return '';
     }
     $result[] = '<form method="GET" action="' . api_get_self() . '" style="display:inline;">';
     $param[$this->param_prefix . 'direction'] = $this->direction;
     $param[$this->param_prefix . 'page_nr'] = $this->page_nr;
     $param[$this->param_prefix . 'column'] = $this->column;
     if (is_array($this->additional_parameters)) {
         $param = array_merge($param, $this->additional_parameters);
     }
     foreach ($param as $key => &$value) {
         $result[] = '<input type="hidden" name="' . $key . '" value="' . $value . '"/>';
     }
     $result[] = '<select name="' . $this->param_prefix . 'per_page" onchange="javascript: this.form.submit();">';
     for ($nr = 10; $nr <= min(50, $total_number_of_items); $nr += 10) {
         $result[] = '<option value="' . $nr . '" ' . ($nr == $this->per_page ? 'selected="selected"' : '') . '>' . $nr . '</option>';
     }
     // @todo no limits
     //if ($total_number_of_items < 500) {
     $result[] = '<option value="' . $total_number_of_items . '" ' . ($total_number_of_items == $this->per_page ? 'selected="selected"' : '') . '>' . api_ucfirst(get_lang('All')) . '</option>';
     //}
     $result[] = '</select>';
     $result[] = '<noscript>';
     $result[] = '<button class="btn save" type="submit">' . get_lang('Save') . '</button>';
     $result[] = '</noscript>';
     $result[] = '</form>';
     $result = implode("\n", $result);
     return $result;
 }
    /**
     * Generic part of any survey question: the question field
     * @param array $surveyData
     * @param array $formData
     *
     * @return FormValidator
     */
    public function createForm($surveyData, $formData)
    {
        $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
        $questionId = isset($_GET['question_id']) ? intval($_GET['question_id']) : null;
        $surveyId = isset($_GET['survey_id']) ? intval($_GET['survey_id']) : null;
        $toolName = Display::return_icon(SurveyManager::icon_question(Security::remove_XSS($_GET['type'])), get_lang(ucfirst(Security::remove_XSS($_GET['type']))), array('align' => 'middle', 'height' => '22px')) . ' ';
        if ($action == 'add') {
            $toolName .= get_lang('AddQuestion');
        }
        if ($action == 'edit') {
            $toolName .= get_lang('EditQuestion');
        }
        if ($_GET['type'] == 'yesno') {
            $toolName .= ': ' . get_lang('YesNo');
        } else {
            if ($_GET['type'] == 'multiplechoice') {
                $toolName .= ': ' . get_lang('UniqueSelect');
            } else {
                $toolName .= ': ' . get_lang(api_ucfirst(Security::remove_XSS($_GET['type'])));
            }
        }
        $sharedQuestionId = isset($formData['shared_question_id']) ? $formData['shared_question_id'] : null;
        $url = api_get_self() . '?action=' . $action . '&type=' . Security::remove_XSS($_GET['type']) . '&survey_id=' . $surveyId . '&question_id=' . $questionId . '&' . api_get_cidreq();
        $form = new FormValidator('question_form', 'post', $url);
        $form->addHeader($toolName);
        $form->addHidden('survey_id', $surveyId);
        $form->addHidden('question_id', $questionId);
        $form->addHidden('shared_question_id', Security::remove_XSS($sharedQuestionId));
        $form->addHidden('type', Security::remove_XSS($_GET['type']));
        $config = array('ToolbarSet' => 'SurveyQuestion', 'Width' => '100%', 'Height' => '120');
        $form->addHtmlEditor('question', get_lang('Question'), true, false, $config);
        // When survey type = 1??
        if ($surveyData['survey_type'] == 1) {
            $table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
            $sql = 'SELECT id,name FROM ' . $table_survey_question_group . '
                    WHERE survey_id = ' . (int) $_GET['survey_id'] . '
                    ORDER BY name';
            $rs = Database::query($sql);
            $glist = null;
            while ($row = Database::fetch_array($rs, 'NUM')) {
                $glist .= '<option value="' . $row[0] . '" >' . $row[1] . '</option>';
            }
            $grouplist = $grouplist1 = $grouplist2 = $glist;
            if (!empty($formData['assigned'])) {
                $grouplist = str_replace('<option value="' . $formData['assigned'] . '"', '<option value="' . $formData['assigned'] . '" selected', $glist);
            }
            if (!empty($formData['assigned1'])) {
                $grouplist1 = str_replace('<option value="' . $formData['assigned1'] . '"', '<option value="' . $formData['assigned1'] . '" selected', $glist);
            }
            if (!empty($formData['assigned2'])) {
                $grouplist2 = str_replace('<option value="' . $formData['assigned2'] . '"', '<option value="' . $formData['assigned2'] . '" selected', $glist);
            }
            $this->html .= '	<tr><td colspan="">
			<fieldset style="border:1px solid black"><legend>' . get_lang('Condition') . '</legend>

			<b>' . get_lang('Primary') . '</b><br />
			' . '<input type="radio" name="choose" value="1" ' . ($formData['choose'] == 1 ? 'checked' : '') . '><select name="assigned">' . $grouplist . '</select><br />';
            $this->html .= '
			<b>' . get_lang('Secondary') . '</b><br />
			' . '<input type="radio" name="choose" value="2" ' . ($formData['choose'] == 2 ? 'checked' : '') . '><select name="assigned1">' . $grouplist1 . '</select> ' . '<select name="assigned2">' . $grouplist2 . '</select>' . '</fieldset><br />';
            //$form->addRadio('choose', get_lang('Primary'));
            //$form->addRadio('choose', get_lang('Secondary'));
        }
        $this->setForm($form);
        return $form;
    }
 /**
  * Gets the admin session list callback of the session/session_list.php
  * page with all user/details in the right fomat
  * @param array
  * @result array Array of rows results
  * @asset ('a') === false
  */
 public static function get_sessions_admin_complete($options = array())
 {
     if (!is_array($options)) {
         return false;
     }
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
     $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $tbl_session_field_values = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_VALUES);
     $tbl_session_field_options = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_OPTIONS);
     $where = 'WHERE 1 = 1 ';
     $user_id = api_get_user_id();
     if (!api_is_platform_admin()) {
         if (api_is_session_admin() && api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false') {
             $where .= " AND s.session_admin_id = {$user_id} ";
         }
     }
     $coach_name = " CONCAT(u.lastname , ' ', u.firstname) as coach_name ";
     if (api_is_western_name_order()) {
         $coach_name = " CONCAT(u.firstname, ' ', u.lastname) as coach_name ";
     }
     $today = api_get_utc_datetime();
     $inject_extra_fields = null;
     $extra_fields = array();
     $extra_fields_info = array();
     //for now only sessions
     $extra_field = new ExtraField('session');
     $double_fields = array();
     $extra_field_option = new ExtraFieldOption('session');
     if (isset($options['extra'])) {
         $extra_fields = $options['extra'];
         if (!empty($extra_fields)) {
             foreach ($extra_fields as $extra) {
                 $inject_extra_fields .= " IF (fv.field_id = {$extra['id']}, fvo.option_display_text, NULL ) as {$extra['field']} , ";
                 if (isset($extra_fields_info[$extra['id']])) {
                     $info = $extra_fields_info[$extra['id']];
                 } else {
                     $info = $extra_field->get($extra['id']);
                     $extra_fields_info[$extra['id']] = $info;
                 }
                 if ($info['field_type'] == ExtraField::FIELD_TYPE_DOUBLE_SELECT) {
                     $double_fields[$info['id']] = $info;
                 }
             }
         }
     }
     $options_by_double = array();
     foreach ($double_fields as $double) {
         $my_options = $extra_field_option->get_field_options_by_field($double['id'], true);
         $options_by_double['extra_' . $double['field_variable']] = $my_options;
     }
     //sc.name as category_name,
     $select = "\n                SELECT * FROM (\n                    SELECT DISTINCT\n                         IF (\n                            (s.access_start_date <= '{$today}' AND '{$today}' < s.access_end_date) OR\n                            (s.access_start_date  = '0000-00-00 00:00:00' AND s.access_end_date  = '0000-00-00 00:00:00' ) OR\n                            (s.access_start_date  IS NULL AND s.access_end_date IS NULL) OR\n                            (s.access_start_date <= '{$today}' AND ('0000-00-00 00:00:00' = s.access_end_date OR s.access_end_date IS NULL )) OR\n                            ('{$today}' < s.access_end_date AND ('0000-00-00 00:00:00' = s.access_start_date OR s.access_start_date IS NULL) )\n                        , 1, 0) as session_active,\n                s.name,\n                s.nbr_courses,\n                s.nbr_users,\n                s.display_start_date,\n                s.display_end_date,\n                {$coach_name},\n                access_start_date,\n                access_end_date,\n                s.visibility,\n                u.user_id,\n                {$inject_extra_fields}\n                c.title as course_title,\n                s.id ";
     if (!empty($options['where'])) {
         if (!empty($options['extra'])) {
             $options['where'] = str_replace(' 1 = 1  AND', '', $options['where']);
             $options['where'] = str_replace('AND', 'OR', $options['where']);
             foreach ($options['extra'] as $extra) {
                 $options['where'] = str_replace($extra['field'], 'fv.field_id = ' . $extra['id'] . ' AND fvo.option_value', $options['where']);
             }
         }
         $options['where'] = str_replace('course_title', 'c.title', $options['where']);
         $where .= ' AND ' . $options['where'];
     }
     if (!empty($options['limit'])) {
         $where .= " LIMIT " . $options['limit'];
     }
     $query = "{$select} FROM {$tbl_session} s\n                    LEFT JOIN {$tbl_session_field_values} fv ON (fv.session_id = s.id)\n                    LEFT JOIN {$tbl_session_field_options} fvo ON (fv.field_id = fvo.field_id)\n                    LEFT JOIN {$tbl_session_rel_course} src ON (src.id_session = s.id)\n                    LEFT JOIN {$tbl_course} c ON (src.c_id = c.id)\n                    LEFT JOIN {$tbl_session_category} sc ON (s.session_category_id = sc.id)\n                    INNER JOIN {$tbl_user} u ON (s.id_coach = u.user_id) " . $where;
     if (api_is_multiple_url_enabled()) {
         $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             $where .= " AND ar.access_url_id = {$access_url_id} ";
             $query = "{$select}\n                    FROM {$tbl_session} s\n                    LEFT JOIN {$tbl_session_field_values} fv ON (fv.session_id = s.id)\n                    LEFT JOIN {$tbl_session_field_options} fvo ON (fv.field_id = fvo.field_id)\n                    LEFT JOIN {$tbl_session_rel_course} src ON (src.id_session = s.id)\n                    LEFT JOIN {$tbl_course} c ON (src.c_id = c.id)\n                    LEFT JOIN {$tbl_session_category} sc ON (s.session_category_id = sc.id)\n                    INNER JOIN {$tbl_user} u ON (s.id_coach = u.user_id)\n                    INNER JOIN {$table_access_url_rel_session} ar ON (ar.session_id = s.id)\n                    {$where}";
         }
     }
     $query .= ") AS session_table";
     if (!empty($options['order'])) {
         $query .= " ORDER BY " . $options['order'];
     }
     //error_log($query);
     //echo $query;
     $result = Database::query($query);
     $formatted_sessions = array();
     if (Database::num_rows($result)) {
         $sessions = Database::store_result($result, 'ASSOC');
         foreach ($sessions as $session) {
             $session_id = $session['id'];
             $session['name'] = Display::url($session['name'], "resume_session.php?id_session=" . $session['id']);
             $session['coach_name'] = Display::url($session['coach_name'], "user_information.php?user_id=" . $session['user_id']);
             if ($session['session_active'] == 1) {
                 $session['session_active'] = Display::return_icon('accept.png', get_lang('Active'), array(), ICON_SIZE_SMALL);
             } else {
                 $session['session_active'] = Display::return_icon('error.png', get_lang('Inactive'), array(), ICON_SIZE_SMALL);
             }
             $session = self::convert_dates_to_local($session);
             switch ($session['visibility']) {
                 case SESSION_VISIBLE_READ_ONLY:
                     //1
                     $session['visibility'] = get_lang('ReadOnly');
                     break;
                 case SESSION_VISIBLE:
                     //2
                 //2
                 case SESSION_AVAILABLE:
                     //4
                     $session['visibility'] = get_lang('Visible');
                     break;
                 case SESSION_INVISIBLE:
                     //3
                     $session['visibility'] = api_ucfirst(get_lang('Invisible'));
                     break;
             }
             //Cleaning double selects
             foreach ($session as $key => &$value) {
                 if (isset($options_by_double[$key]) || isset($options_by_double[$key . '_second'])) {
                     $options = explode('::', $value);
                 }
                 $original_key = $key;
                 if (strpos($key, '_second') === false) {
                 } else {
                     $key = str_replace('_second', '', $key);
                 }
                 if (isset($options_by_double[$key])) {
                     if (isset($options[0])) {
                         if (isset($options_by_double[$key][$options[0]])) {
                             if (strpos($original_key, '_second') === false) {
                                 $value = $options_by_double[$key][$options[0]]['option_display_text'];
                             } else {
                                 $value = $options_by_double[$key][$options[1]]['option_display_text'];
                             }
                         }
                     }
                 }
             }
             //Magic filter
             if (isset($formatted_sessions[$session_id])) {
                 $formatted_sessions[$session_id] = self::compare_arrays_to_merge($formatted_sessions[$session_id], $session);
             } else {
                 $formatted_sessions[$session_id] = $session;
             }
         }
     }
     return $formatted_sessions;
 }
Beispiel #24
0
    $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path');
echo '<div class="actions">';
echo '<a href="lp_controller.php?cidReq=' . $_course['sysCode'] . '">' . Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
Display::display_normal_message(get_lang('AddLpIntro'), false);
if ($_POST and empty($_REQUEST['lp_name'])) {
    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
}
$form = new FormValidator('lp_add', 'post', 'lp_controller.php');
// Form title
$form->addElement('header', null, get_lang('AddLpToStart'));
// Title
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LPName')), array('class' => 'span6'));
$form->applyFilter('lp_name', 'html_filter');
$form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'post_time', time());
$form->addElement('hidden', 'action', 'add_lp');
$advanced = '<a href="javascript://" onclick=" return advanced_parameters()"><span id="img_plus_and_minus"><div style="vertical-align:top;" >&nbsp;' . $showImg . '&nbsp;' . get_lang('AdvancedParameters') . '</div></span></a>';
$form->addElement('advanced_settings', $advanced);
$form->addElement('html', '<div id="options" style="display:none">');
$items = learnpath::get_category_from_course_into_select(api_get_course_int_id());
if (!empty($items)) {
    $items = array_merge(array(get_lang('SelectACategory')), $items);
}
$form->addElement('select', 'category_id', get_lang('Category'), $items);
//Start date
$form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
$form->addElement('html', '<div id="start_date_div" style="display:block;">');
Beispiel #25
0
 /**
  * @param $from
  * @param $number_of_items
  * @param $column
  * @param $direction
  * @return array
  */
 public static function get_item_resources_data($from, $number_of_items, $column, $direction)
 {
     $session_id = api_get_session_id();
     $course_id = api_get_course_int_id();
     $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $table_user = Database::get_main_table(TABLE_MAIN_USER);
     $table_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $session_id = intval($session_id);
     $sql = "SELECT\n                    tool as col0,\n                    lastedit_type as col1,\n                    ref as ref,\n                    user.username as col3,\n                    insert_date as col5,\n                    visibility as col6,\n                    user.user_id as user_id\n                FROM {$table_item_property} track_resource, {$table_user} user\n                WHERE\n                  track_resource.c_id = {$course_id} AND\n                  track_resource.insert_user_id = user.user_id AND\n                  session_id = {$session_id} ";
     if (isset($_GET['keyword'])) {
         $keyword = Database::escape_string(trim($_GET['keyword']));
         $sql .= " AND (\n    \t\t            user.username LIKE '%" . $keyword . "%' OR\n    \t\t            lastedit_type LIKE '%" . $keyword . "%' OR\n    \t\t            tool LIKE '%" . $keyword . "%'\n                     ) ";
     }
     $sql .= " AND tool IN (\n    \t            'document',\n    \t            'learnpath',\n    \t            'quiz',\n    \t            'glossary',\n    \t            'link',\n    \t            'course_description',\n    \t            'announcement',\n    \t            'thematic',\n    \t            'thematic_advance',\n    \t            'thematic_plan'\n                )";
     if ($column == 0) {
         $column = '0';
     }
     if ($column != '' && $direction != '') {
         if ($column != 2 && $column != 4) {
             $sql .= " ORDER BY col{$column} {$direction}";
         }
     } else {
         $sql .= " ORDER BY col5 DESC ";
     }
     $from = intval($from);
     $number_of_items = intval($number_of_items);
     $sql .= " LIMIT {$from}, {$number_of_items} ";
     $res = Database::query($sql);
     $resources = array();
     $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan');
     while ($row = Database::fetch_array($res)) {
         $ref = $row['ref'];
         $table_name = TrackingCourseLog::get_tool_name_table($row['col0']);
         $table_tool = Database::get_course_table($table_name['table_name']);
         $id = $table_name['id_tool'];
         $recorset = false;
         if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) {
             $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
             $sql = "SELECT thematic_id FROM {$table_tool}\n    \t\t\t        WHERE c_id = {$course_id} AND id = {$ref}";
             $rs_thematic = Database::query($sql);
             if (Database::num_rows($rs_thematic)) {
                 $row_thematic = Database::fetch_array($rs_thematic);
                 $thematic_id = $row_thematic['thematic_id'];
                 $sql = "SELECT session.id, session.name, user.username\n                            FROM {$tbl_thematic} t, {$table_session} session, {$table_user} user\n                            WHERE\n                              t.c_id = {$course_id} AND\n                              t.session_id = session.id AND\n                              session.id_coach = user.user_id AND\n                              t.id = {$thematic_id}";
                 $recorset = Database::query($sql);
             }
         } else {
             $sql = "SELECT session.id, session.name, user.username\n                          FROM {$table_tool} tool, {$table_session} session, {$table_user} user\n    \t\t\t          WHERE\n    \t\t\t              tool.c_id = {$course_id} AND\n    \t\t\t              tool.session_id = session.id AND\n    \t\t\t              session.id_coach = user.user_id AND\n    \t\t\t              tool.{$id} = {$ref}";
             $recorset = Database::query($sql);
         }
         if (!empty($recorset)) {
             $obj = Database::fetch_object($recorset);
             $name_session = '';
             $coach_name = '';
             if (!empty($obj)) {
                 $name_session = $obj->name;
                 $coach_name = $obj->username;
             }
             $url_tool = api_get_path(WEB_CODE_PATH) . $table_name['link_tool'];
             $row[0] = '';
             if ($row['col6'] != 2) {
                 if (in_array($row['col0'], $thematic_tools)) {
                     $exp_thematic_tool = explode('_', $row['col0']);
                     $thematic_tool_title = '';
                     if (is_array($exp_thematic_tool)) {
                         foreach ($exp_thematic_tool as $exp) {
                             $thematic_tool_title .= api_ucfirst($exp);
                         }
                     } else {
                         $thematic_tool_title = api_ucfirst($row['col0']);
                     }
                     $row[0] = '<a href="' . $url_tool . '?' . api_get_cidreq() . '&action=thematic_details">' . get_lang($thematic_tool_title) . '</a>';
                 } else {
                     $row[0] = '<a href="' . $url_tool . '?' . api_get_cidreq() . '">' . get_lang('Tool' . api_ucfirst($row['col0'])) . '</a>';
                 }
             } else {
                 $row[0] = api_ucfirst($row['col0']);
             }
             $row[1] = get_lang($row[1]);
             $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get());
             $row[5] = '';
             //@todo Improve this code please
             switch ($table_name['table_name']) {
                 case 'document':
                     $sql = "SELECT tool.title as title FROM {$table_tool} tool\n                                WHERE c_id = {$course_id} AND id = {$ref}";
                     $rs_document = Database::query($sql);
                     $obj_document = Database::fetch_object($rs_document);
                     $row[5] = $obj_document->title;
                     break;
                 case 'announcement':
                     $sql = "SELECT title FROM {$table_tool}\n                                WHERE c_id = {$course_id} AND id = {$ref}";
                     $rs_document = Database::query($sql);
                     $obj_document = Database::fetch_object($rs_document);
                     if ($obj_document) {
                         $row[5] = $obj_document->title;
                     }
                     break;
                 case 'glossary':
                     $sql = "SELECT name FROM {$table_tool}\n    \t\t\t\t\t        WHERE c_id = {$course_id} AND glossary_id = {$ref}";
                     $rs_document = Database::query($sql);
                     $obj_document = Database::fetch_object($rs_document);
                     if ($obj_document) {
                         $row[5] = $obj_document->name;
                     }
                     break;
                 case 'lp':
                     $sql = "SELECT name\n                                FROM {$table_tool} WHERE c_id = {$course_id} AND id = {$ref}";
                     $rs_document = Database::query($sql);
                     $obj_document = Database::fetch_object($rs_document);
                     $row[5] = $obj_document->name;
                     break;
                 case 'quiz':
                     $sql = "SELECT title FROM {$table_tool}\n                                WHERE c_id = {$course_id} AND id = {$ref}";
                     $rs_document = Database::query($sql);
                     $obj_document = Database::fetch_object($rs_document);
                     if ($obj_document) {
                         $row[5] = $obj_document->title;
                     }
                     break;
                 case 'course_description':
                     $sql = "SELECT title FROM {$table_tool}\n                                WHERE c_id = {$course_id} AND id = {$ref}";
                     $rs_document = Database::query($sql);
                     $obj_document = Database::fetch_object($rs_document);
                     if ($obj_document) {
                         $row[5] = $obj_document->title;
                     }
                     break;
                 case 'thematic':
                     $rs = Database::query("SELECT title FROM {$table_tool} WHERE c_id = {$course_id} AND id = {$ref}");
                     if (Database::num_rows($rs) > 0) {
                         $obj = Database::fetch_object($rs);
                         $row[5] = $obj->title;
                     }
                     break;
                 case 'thematic_advance':
                     $rs = Database::query("SELECT content FROM {$table_tool} WHERE c_id = {$course_id} AND id = {$ref}");
                     if (Database::num_rows($rs) > 0) {
                         $obj = Database::fetch_object($rs);
                         $row[5] = $obj->content;
                     }
                     break;
                 case 'thematic_plan':
                     $rs = Database::query("SELECT title FROM {$table_tool} WHERE c_id = {$course_id} AND id = {$ref}");
                     if (Database::num_rows($rs) > 0) {
                         $obj = Database::fetch_object($rs);
                         $row[5] = $obj->title;
                     }
                     break;
                 default:
                     break;
             }
             $row2 = $name_session;
             if (!empty($coach_name)) {
                 $row2 .= '<br />' . get_lang('Coach') . ': ' . $coach_name;
             }
             $row[2] = $row2;
             if (!empty($row['col3'])) {
                 $userInfo = api_get_user_info($row['user_id']);
                 $row['col3'] = Display::url($row['col3'], $userInfo['profile_url']);
                 $row[3] = $row['col3'];
                 $ip = TrackingUserLog::get_ip_from_user_event($row['user_id'], $row['col5'], true);
                 if (empty($ip)) {
                     $ip = get_lang('Unknown');
                 }
                 $row[4] = $ip;
             }
             $resources[] = $row;
         }
     }
     return $resources;
 }
        echo '</div>';
        ?>
                            </div>
                        </div>
                    </div>
                </div>
            <!-- insert link block -->


            <div class="panel-group" id="links-block" role="tablist" aria-multiselectable="true">
                <div class="panel panel-default">
                    <div class="panel-heading" role="tab" id="headingOne">
                        <h4 class="panel-title">
                            <a role="button" data-toggle="collapse" data-parent="#links-block" href="#links-list" aria-expanded="true" aria-controls="links-list">
                                <?php 
        echo api_ucfirst(get_lang('General'));
        ?>
                            </a>
                        </h4>
                    </div>
                    <div id="links-list" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                        <div class="panel-body">
                            <a href="<?php 
        echo $selfUrl;
        ?>
?action=insert_link"><?php 
        echo Display::return_icon('add.png', get_lang('InsertLink')) . '&nbsp;' . get_lang('InsertLink');
        ?>
                            </a>
                            <ul class="menulist">
                                <?php 
    public function make_lp($files = array())
    {
        global $_course;
        $previous = 0;
        $i = 0;

        if (!is_dir($this->base_work_dir.$this->created_dir))
            return false;

        foreach ($files as $file) {
            /* '||' is used as separator between fields:
                slide name (with accents) || file name (without accents) || all slide text (to be indexed).
            */
            list($slide_name, $file_name, $slide_body) = explode('||', $file);

            // Filename is utf8 encoded, but when we decode, some chars are not translated (like quote &rsquo;).
            // so we remove these chars by translating it in htmlentities and the reconvert it in want charset.
            $slide_name = api_htmlentities($slide_name, ENT_COMPAT, $this->original_charset);
            $slide_name = str_replace('&rsquo;', '\'', $slide_name);
            $slide_name = api_convert_encoding($slide_name, api_get_system_encoding(), $this->original_charset);
            $slide_name = api_html_entity_decode($slide_name, ENT_COMPAT, api_get_system_encoding());

            if ($this->take_slide_name === true) {
                $slide_name = str_replace('_', ' ', $slide_name);
                $slide_name = api_ucfirst($slide_name);
            } else {
                $slide_name = 'slide'.str_repeat('0', 2 - strlen($i)).$i;
            }

            $i++;
            // Add the png to documents.
            $document_id = add_document(
                $_course,
                $this->created_dir.'/'.urlencode($file_name),
                'file',
                filesize($this->base_work_dir.$this->created_dir.'/'.$file_name),
                $slide_name
            );

            api_item_property_update(
                $_course,
                TOOL_DOCUMENT,
                $document_id,
                'DocumentAdded',
                api_get_user_id(),
                0,
                0,
                null,
                null,
                api_get_session_id()
            );

            // Generating the thumbnail.
            $image = $this->base_work_dir.$this->created_dir .'/'. $file_name;

            $pattern = '/(\w+)\.png$/';
            $replacement = '${1}_thumb.png';
            $thumb_name = preg_replace($pattern, $replacement, $file_name);

            // Calculate thumbnail size.
            $image_size = api_getimagesize($image);
            $width  = $image_size['width'];
            $height = $image_size['height'];

            $thumb_width = 300;
            $thumb_height = floor($height * ($thumb_width / $width));

            $my_new_image = new Image($image);
            $my_new_image->resize($thumb_width, $thumb_height);
            $my_new_image->send_image($this->base_work_dir.$this->created_dir .'/'. $thumb_name, -1, 'png');

            // Adding the thumbnail to documents.
            $document_id_thumb = add_document(
                $_course,
                $this->created_dir.'/'.urlencode($thumb_name),
                'file',
                filesize($this->base_work_dir.$this->created_dir.'/'.$thumb_name),
                $slide_name
            );

            api_item_property_update($_course, TOOL_THUMBNAIL, $document_id_thumb, 'DocumentAdded', api_get_user_id(), 0, 0);

            // Create an html file.
            $html_file = $file_name.'.html';
            $fp = fopen($this->base_work_dir.$this->created_dir.'/'.$html_file, 'w+');

            $slide_src = api_get_path(REL_COURSE_PATH).$_course['path'].'/document/'.$this->created_dir.'/'.utf8_encode($file_name);
            $slide_src = str_replace('//', '/', $slide_src);
            fwrite($fp,
'<html>
    <head>
    </head>
    <body>
        <img src="'.$slide_src.'" />
    </body>
</html>');  // This indentation is to make the generated html files to look well.

            fclose($fp);
            $document_id = add_document(
                $_course,
                $this->created_dir.'/'.urlencode($html_file),
                'file',
                filesize($this->base_work_dir.$this->created_dir.'/'.$html_file),
                $slide_name
            );

            if ($document_id) {

                // Put the document in item_property update.
                api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', api_get_user_id(), 0, 0, null, null, api_get_session_id());

                $previous = $this->add_item(0, $previous, 'document', $document_id, $slide_name, '');
                if ($this->first_item == 0) {
                    $this->first_item = $previous;
                }
            }
            // Code for text indexing.
            if (api_get_setting('search_enabled') == 'true') {

                if (isset($_POST['index_document']) && $_POST['index_document']) {
                    $di = new ChamiloIndexer();
                    isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
                    $di->connectDb(NULL, NULL, $lang);
                    $ic_slide = new IndexableChunk();
                    $ic_slide->addValue('title', $slide_name);
                    $specific_fields = get_specific_field_list();
                    $all_specific_terms = '';
                    foreach ($specific_fields as $specific_field) {
                        if (isset($_REQUEST[$specific_field['code']])) {
                            $sterms = trim($_REQUEST[$specific_field['code']]);
                            $all_specific_terms .= ' '. $sterms;
                            if (!empty($sterms)) {
                                $sterms = explode(',', $sterms);
                                foreach ($sterms as $sterm) {
                                    $ic_slide->addTerm(trim($sterm), $specific_field['code']);
                                }
                            }
                        }
                    }
                    $slide_body = $all_specific_terms .' '. $slide_body;
                    $ic_slide->addValue('content', $slide_body);
                    /* FIXME:  cidReq:lp_id:doc_id al indexar  */
                    // Add a comment to say terms separated by commas.
                    $courseid = api_get_course_id();
                    $ic_slide->addCourseId($courseid);
                    $ic_slide->addToolId(TOOL_LEARNPATH);
                    $lp_id = $this->lp_id;
                    $xapian_data = array(
                        SE_COURSE_ID => $courseid,
                        SE_TOOL_ID => TOOL_LEARNPATH,
                        SE_DATA => array('lp_id' => $lp_id, 'lp_item' => $previous, 'document_id' => $document_id),
                        SE_USER => (int)api_get_user_id(),
                    );
                    $ic_slide->xapian_data = serialize($xapian_data);
                    $di->addChunk($ic_slide);
                    // Index and return search engine document id.
                    $did = $di->index();
                    if ($did) {
                        // Save it to db.
                        $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
                        $sql = 'INSERT INTO %s (id, course_code, tool_id, ref_id_high_level, ref_id_second_level, search_did)
                            VALUES (NULL , \'%s\', \'%s\', %s, %s, %s)';
                        $sql = sprintf($sql, $tbl_se_ref, api_get_course_id(), TOOL_LEARNPATH, $lp_id, $previous, $did);
                        Database::query($sql);
                    }
                }
            }
        }
    }
/* For licensing terms, see /license.txt */
/**
 * @package chamilo.plugin.ticket
 */
require_once '../config.php';
$plugin = TicketPlugin::create();
$ticket_id = intval($_POST['ticket_id']);
$history = TicketManager::get_assign_log($ticket_id);
?>
<table width="350px" border="0" cellspacing="2" cellpadding="2">
    <?php 
if (count($history) == 0) {
    ?>
        <tr>
            <td colspan="2"><?php 
    echo api_ucfirst('Sin Historial');
    ?>
</td>
        </tr>
        <?php 
}
?>
    <?php 
for ($k = 0; $k < count($history); $k++) {
    ?>
        <tr>
            <td width="125px"><?php 
    echo api_convert_encoding($history[$k]['assignuser'], 'UTF-8', $charset);
    ?>
</td>
            <td width="100px"><?php 
Beispiel #29
0
function activate_end_date() {
    if(document.getElementById(\'end_date_div\').style.display == \'none\') {
        document.getElementById(\'end_date_div\').style.display = \'block\';
    } else {
        document.getElementById(\'end_date_div\').style.display = \'none\';
    }
}

</script>';
$gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null;
$defaults = array();
$form = new FormValidator('form1', 'post', 'lp_controller.php');
// Form title
$form->addElement('header', get_lang('EditLPSettings'));
// Title
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LearnpathTitle')), array('class' => 'span5'));
$form->applyFilter('lp_name', 'html_filter');
$form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'lp_encoding');
$referer = isset($_REQUEST['referer']) ? Security::remove_XSS($_REQUEST['referer']) : null;
$form->addElement('hidden', 'referer', $referer);
$items = learnpath::get_category_from_course_into_select(api_get_course_int_id(), true);
$form->addElement('select', 'category_id', get_lang('Category'), $items);
//Hide toc frame
$hide_toc_frame = $form->addElement('checkbox', 'hide_toc_frame', null, get_lang('HideTocFrame'), array('onclick' => '$("#lp_layout_column").toggle()'));
if (api_get_setting('allow_course_theme') == 'true') {
    $mycourselptheme = api_get_course_setting('allow_learning_path_theme');
    if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
        //LP theme picker
        $theme_select = $form->addElement('select_theme', 'lp_theme', get_lang('Theme'));
        $form->applyFilter('lp_theme', 'trim');
/* For licensing terms, see /license.txt */

/**
 * @package chamilo.plugin.ticket
 */
$language_file = array('registration');
require_once '../config.php';
$plugin = TicketPlugin::create();

$ticket_id = intval($_POST['ticket_id']);
$history = TicketManager::get_assign_log($ticket_id);
?>
<table width="350px" border="0" cellspacing="2" cellpadding="2">
    <?php
    if (count($history) == 0) {
        ?>
        <tr>
            <td colspan="2"><?php echo api_ucfirst(('Sin Historial')); ?></td>
        </tr>
        <?php
    }
    ?>
    <?php for ($k = 0; $k < count($history); $k++) { ?>
        <tr>
            <td width="125px"><?php echo api_convert_encoding($history[$k]['assignuser'], 'UTF-8', $charset); ?></td>
            <td width="100px"><?php echo api_convert_encoding($history[$k]['assigned_date'], 'UTF-8', $charset); ?></td>
            <td width="125px"><?php echo api_convert_encoding($history[$k]['insertuser'], 'UTF-8', $charset); ?></td>
        </tr>
    <?php } ?>
</table>