/**
  * @return string
  */
 public function getTeacherLink()
 {
     $link = null;
     if (api_is_allowed_to_edit()) {
         $url = api_get_path(WEB_PLUGIN_PATH) . 'courselegal/start.php?' . api_get_cidreq();
         $link = Display::url($this->get_lang('CourseLegal'), $url, array('class' => 'btn'));
     }
     return $link;
 }
 public function get_link()
 {
     $eval = $this->get_evaluation();
     // course/platform admin can go to the view_results page
     if (api_is_allowed_to_edit()) {
         return 'gradebook_view_result.php?selecteval=' . $eval->get_id();
     } elseif (ScoreDisplay::instance()->is_custom()) {
         return 'gradebook_statistics.php?selecteval=' . $eval->get_id();
     } else {
         return null;
     }
 }
 public function is_allowed_to_edit()
 {
     if (Request::is_student_view()) {
         return false;
     }
     $session_id = Request::get_session_id();
     if ($session_id != 0 && api_is_allowed_to_session_edit(false, true) == false) {
         return false;
     }
     if (!api_is_allowed_to_edit(false, true, true)) {
         return false;
     }
     return true;
 }
 /**
  * Toggle the student view action
  *
  * @Route("/toggle_student_view")
  * @Security("has_role('ROLE_TEACHER')")
  * @Method({"GET"})
  * @param Request $request
  *
  * @return Response
  */
 public function toggleStudentViewAction(Request $request)
 {
     if (!api_is_allowed_to_edit(false, false, false, false)) {
         return '';
     }
     $studentView = $request->getSession()->get('studentview');
     if (empty($studentView) || $studentView == 'studentview') {
         $request->getSession()->set('studentview', 'teacherview');
         return 'teacherview';
     } else {
         $request->getSession()->set('studentview', 'studentview');
         return 'studentview';
     }
 }
 public function is_allowed_to_edit()
 {
     if (Request::is_student_view()) {
         return false;
     }
     //$c_id = self::params()->get_c_id();
     //$id = self::params()->get_id();
     $session_id = Request::get_session_id();
     if ($session_id != 0 && api_is_allowed_to_session_edit(false, true) == false) {
         return false;
     }
     if (!api_is_allowed_to_edit(false, true, true)) {
         return false;
     }
     return true;
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function __construct($router, $toolbar = null, $config = array(), $prefix = null)
 {
     // Adding plugins depending of platform conditions
     $plugins = array();
     if (api_get_setting('document.show_glossary_in_documents') == 'ismanual') {
         $plugins[] = 'glossary';
     }
     if (api_get_setting('editor.youtube_for_students') == 'true') {
         $plugins[] = 'youtube';
     } else {
         if (api_is_allowed_to_edit() || api_is_platform_admin()) {
             $plugins[] = 'youtube';
         }
     }
     if (api_get_setting('editor.enabled_googlemaps') == 'true') {
         $plugins[] = 'leaflet';
     }
     if (api_get_setting('editor.math_asciimathML') == 'true') {
         $plugins[] = 'asciimath';
     }
     if (api_get_setting('editor.enabled_mathjax') == 'true') {
         $plugins[] = 'mathjax';
         $config['mathJaxLib'] = api_get_path(WEB_PATH) . 'web/assets/MathJax/MathJax.js?config=AM_HTMLorMML';
     }
     if (api_get_setting('editor.enabled_asciisvg') == 'true') {
         $plugins[] = 'asciisvg';
     }
     if (api_get_setting('editor.enabled_wiris') == 'true') {
         // Commercial plugin
         $plugins[] = 'ckeditor_wiris';
     }
     if (api_get_setting('editor.enabled_imgmap') == 'true') {
         $plugins[] = 'mapping';
     }
     /*if (api_get_setting('block_copy_paste_for_students') == 'true') {
           // Missing
       }*/
     if (api_get_setting('editor.more_buttons_maximized_mode') == 'true') {
         $plugins[] = 'toolbarswitch';
     }
     if (api_get_setting('editor.allow_spellcheck') == 'true') {
         $plugins[] = 'scayt';
     }
     $this->defaultPlugins = array_merge($this->defaultPlugins, $plugins);
     parent::__construct($router, $toolbar, $config, $prefix);
 }
 /**
  *
  * @param \Notebook\Notebook $notebook
  */
 function init($notebook = null)
 {
     $this->set_notebook($notebook);
     $defaults = array();
     $defaults['title'] = $notebook->title;
     $defaults['description'] = $notebook->description;
     $this->add_hidden('c_id', $notebook->c_id);
     $this->add_hidden('id', $notebook->id);
     $this->add_hidden('session_id', $notebook->session_id);
     $this->add_hidden(Request::PARAM_SEC_TOKEN, Access::instance()->get_token());
     $form_name = $notebook->id ? get_lang('ModifyNote') : get_lang('NoteAddNew');
     $this->add_header($form_name);
     $this->add_textfield('title', get_lang('NoteTitle'), $required = true, array('class' => 'span3'));
     if (api_is_allowed_to_edit()) {
         $toolbar = array('ToolbarSet' => 'Notebook', 'Width' => '100%', 'Height' => '300');
     } else {
         $toolbar = array('ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student');
     }
     $this->add_html_editor('description', get_lang('NoteComment'), true, api_is_allowed_to_edit(), $toolbar);
     $this->add_button('save', get_lang('Save'), array('class' => 'btn save'));
     $this->setDefaults($defaults);
 }
 /**
  * Get URL where to go to if the user clicks on the link.
  * First we go to exercise_jump.php and then to the result page.
  * Check this php file for more info.
  */
 public function get_link()
 {
     //status student
     $user_id = api_get_user_id();
     //$course_code = $this->get_course_code();
     $status_user = api_get_status_of_user_in_course($user_id, $this->course_id);
     $session_id = api_get_session_id();
     $url = api_get_path(WEB_PATH) . 'main/gradebook/exercise_jump.php?session_id=' . $session_id . '&cidReq=' . $this->get_course_code() . '&gradebook=view&exerciseId=' . $this->get_ref_id();
     if (!api_is_allowed_to_edit() && $this->calc_score(api_get_user_id()) == null || $status_user != 1) {
         $url .= '&doexercise=' . $this->get_ref_id();
     }
     return $url;
 }
Example #9
0
    /**
     * return true if toolbar has to be displayed for user
     * @return bool
     */
    public static function isToolBarDisplayedForUser()
    {
        //Toolbar
        $show_admin_toolbar = api_get_setting('show_admin_toolbar');
        $show_toolbar = false;

        switch ($show_admin_toolbar) {
            case 'do_not_show':
                break;
            case 'show_to_admin':
                if (api_is_platform_admin()) {
                    $show_toolbar = true;
                }
                break;
            case 'show_to_admin_and_teachers':
                if (api_is_platform_admin() || api_is_allowed_to_edit()) {
                    $show_toolbar = true;
                }
                break;
            case 'show_to_all':
                $show_toolbar = true;
                break;
        }
        return $show_toolbar;
    }
    private function build_edit_column($item)
    {
        $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
        $locked_status = $this->evaluation->get_locked();
        if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
            //api_is_course_admin()
            $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">' . Display::return_icon('edit.png', get_lang('Modify'), '', '22') . '</a>';
            $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', '22') . '</a>';
        }
        if ($this->evaluation->get_course_code() == null) {
            $edit_column .= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">
			<img src="../img/delete.gif" border="0" title="' . get_lang('Delete') . '" alt="" /></a>';
            $edit_column .= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&' . api_get_cidreq() . '">
		    <img src="../img/statistics.gif" width="17px" border="0" title="' . get_lang('Statistics') . '" alt="" /></a>';
        }
        // Evaluation's origin is a link
        if ($this->evaluation->get_category_id() < 0) {
            $link = LinkFactory::get_evaluation_link($this->evaluation->get_id());
            $doc_url = $link->get_view_url($item['id']);
            if ($doc_url != null) {
                $edit_column .= '&nbsp;<a href="' . $doc_url . '" target="_blank">' . '<img src="' . api_get_path(WEB_CODE_PATH) . 'img/link.gif" border="0" title="' . get_lang('OpenDocument') . '" alt="" />' . '</a>';
            }
        }
        return $edit_column;
    }
Example #11
0
/**
 * name of the language file that needs to be included
 */
$language_file = 'exercice';
//require_once '../inc/global.inc.php';
$urlMainExercise = api_get_path(WEB_CODE_PATH) . 'exercice/';
$this_section = SECTION_COURSES;
api_protect_course_script(true);
$show = isset($_GET['show']) && $_GET['show'] == 'result' ? 'result' : 'test';
// moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
/**
 * Libraries
 */
/* 	Constants and variables */
$is_allowedToEdit = api_is_allowed_to_edit(null, true);
$is_tutor = api_is_allowed_to_edit(true);
if (!$is_allowedToEdit) {
    header('Location: ' . $urlMainExercise . 'exercice.php?cidReq=' . Security::remove_XSS($_GET['cidReq']));
    exit;
}
$interbreadcrumb[] = array('url' => 'exercise_report.php', 'name' => get_lang('Exercices'));
$interbreadcrumb[] = array('url' => 'exercise_report.php' . '?filter=2', 'name' => get_lang('StudentScore'));
$interbreadcrumb[] = array('url' => 'exercise_history.php' . '?exe_id=' . intval($_GET['exe_id']), 'name' => get_lang('Details'));
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_EXERCICES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
Display::display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message'])) {
    if (in_array($_GET['message'], array('ExerciseEdited'))) {
<?php

/* For licensing terms, see /license.txt */
/**
 *	@package chamilo.group
 */
// Name of the language file that needs to be included
$language_file = 'group';
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);
if (!api_is_allowed_to_edit(false, true) || !(isset($_GET['id']) || isset($_POST['id']) || isset($_GET['action']) || isset($_POST['action']))) {
    api_not_allowed();
}
/**
 * Function to check the given max number of members per group
 */
function check_max_number_of_members($value)
{
    $max_member_no_limit = $value['max_member_no_limit'];
    if ($max_member_no_limit == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
        return true;
    }
    $max_member = $value['max_member'];
    return is_numeric($max_member);
}
/**
 * Function to check the number of groups per user
 */
Example #13
0
require_once '../inc/global.inc.php';
//exit;
$document_id = $_GET['id'];
$courseCode = api_get_course_id();
if ($document_id) {
    $document_data = DocumentManager::get_document_data_by_id($document_id, $courseCode);
    if (empty($document_data)) {
        api_not_allowed();
    }
} else {
    api_not_allowed();
}
//Check user visibility
//$is_visible = DocumentManager::is_visible_by_id($document_id, $course_info, api_get_session_id(), api_get_user_id());
$is_visible = DocumentManager::check_visibility_tree($document_id, api_get_course_id(), api_get_session_id(), api_get_user_id(), api_get_group_id());
if (!api_is_allowed_to_edit() && !$is_visible) {
    api_not_allowed(true);
}
$header_file = $document_data['path'];
$pathinfo = pathinfo($header_file);
$show_web_odf = false;
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
    $show_web_odf = true;
}
$file_url_web = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $header_file;
if ($show_web_odf) {
    //$htmlHeadXtra[] = api_get_js('webodf/webodf.js');
    $htmlHeadXtra[] = api_get_js('wodotexteditor/wodotexteditor.js');
    $htmlHeadXtra[] = api_get_js('wodotexteditor/localfileeditor.js');
    $htmlHeadXtra[] = api_get_js('wodotexteditor/FileSaver.js');
 /**
  * Generate name column
  * @param unknown_type $item
  * @return string
  */
 private function build_name_link($item)
 {
     $view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
     //$session_id = api_get_session_id();
     switch ($item->get_item_type()) {
         // category
         case 'C':
             $prms_uri = '?selectcat=' . $item->get_id() . '&amp;view=' . Security::remove_XSS($_GET['view']);
             if (isset($_GET['isStudentView'])) {
                 if (isset($is_student) || isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview') {
                     $prms_uri = $prms_uri . '&amp;isStudentView=' . Security::remove_XSS($_GET['isStudentView']);
                 }
             }
             $cat = new Category();
             $show_message = $cat->show_message_resource_delete($item->get_course_code());
             return '&nbsp;<a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . $prms_uri . '">' . $item->get_name() . '</a>' . ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']' . $show_message : '');
             // evaluation
         // evaluation
         case 'E':
             $cat = new Category();
             $course_id = CourseManager::get_course_by_category($_GET['selectcat']);
             $show_message = $cat->show_message_resource_delete($course_id);
             // course/platform admin can go to the view_results page
             if (api_is_allowed_to_edit() && $show_message === false) {
                 if ($item->get_type() == 'presence') {
                     return '&nbsp;' . '<a href="gradebook_view_result.php?cidReq=' . $course_id . '&amp;selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
                 } else {
                     return '&nbsp;' . '<a href="gradebook_view_result.php?cidReq=' . $course_id . '&amp;selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>&nbsp;' . Display::label(get_lang('Evaluation'));
                 }
             } elseif (ScoreDisplay::instance()->is_custom() && $show_message === false) {
                 // students can go to the statistics page (if custom display enabled)
                 return '&nbsp;' . '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
             } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay::instance()->is_custom()) {
                 return '&nbsp;' . '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
             } else {
                 return '[' . get_lang('Evaluation') . ']&nbsp;&nbsp;' . $item->get_name() . $show_message;
             }
             // link
         // link
         case 'L':
             $cat = new Category();
             $course_id = CourseManager::get_course_by_category($_GET['selectcat']);
             $show_message = $cat->show_message_resource_delete($course_id);
             $url = $item->get_link();
             if (isset($url) && $show_message === false) {
                 $text = '&nbsp;<a href="' . $item->get_link() . '">' . $item->get_name() . '</a>';
             } else {
                 $text = $item->get_name();
             }
             $text .= "&nbsp;" . Display::label($item->get_type_name(), 'info') . $show_message;
             $cc = $this->currentcat->get_course_code();
             if (empty($cc)) {
                 $text .= '&nbsp;[<a href="' . api_get_path(REL_COURSE_PATH) . $item->get_course_code() . '/">' . $item->get_course_code() . '</a>]';
             }
             return $text;
     }
 }
}
$sys_course_path = api_get_path(SYS_COURSE_PATH);
//zip library for creation of the zipfile
require_once api_get_path(LIBRARY_PATH) . 'pclzip/pclzip.lib.php';
//Creating a ZIP file
$temp_zip_file = api_get_path(SYS_ARCHIVE_PATH) . api_get_unique_id() . ".zip";
$zip_folder = new PclZip($temp_zip_file);
$tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$prop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
//Put the files in the zip
//2 possibilities: admins get all files and folders in the selected folder (except for the deleted ones)
//normal users get only visible files that are in visible folders
//admins are allowed to download invisible files
$files = array();
$course_id = api_get_course_int_id();
if (api_is_allowed_to_edit()) {
    //Search for all files that are not deleted => visibility != 2
    $sql = "SELECT DISTINCT url, title, description, insert_user_id, insert_date, contains_file\n            FROM {$tbl_student_publication} AS work INNER JOIN {$prop_table} AS props\n                ON (\n                    props.c_id = {$course_id} AND\n                    work.c_id = {$course_id} AND\n                    work.id = props.ref\n                  )\n \t\t\tWHERE   props.tool='work' AND\n \t\t\t        work.parent_id = {$work_id} AND\n \t\t\t        work.filetype = 'file' AND\n \t\t\t        props.visibility<>'2' AND\n \t\t\t        work.active = 1 AND\n \t\t\t        work.post_group_id = {$groupId}\n            ";
} else {
    $courseInfo = api_get_course_info();
    allowOnlySubscribedUser(api_get_user_id(), $work_id, $courseInfo['real_id']);
    $userCondition = null;
    // All users
    if ($courseInfo['show_score'] == 0) {
        // Do another filter
    } else {
        // Only teachers
        $userCondition = " AND props.insert_user_id = " . api_get_user_id();
    }
    //for other users, we need to create a zipfile with only visible files and folders
    $sql = "SELECT DISTINCT url, title, description, insert_user_id, insert_date, contains_file\n            FROM {$tbl_student_publication} AS work INNER JOIN {$prop_table} AS props\n                ON (props.c_id = {$course_id} AND\n                    work.c_id = {$course_id} AND\n                    work.id = props.ref)\n           WHERE\n                    props.tool='work' AND\n                    work.accepted = 1 AND\n                    work.active = 1 AND\n                    work.parent_id = {$work_id} AND\n                    work.filetype = 'file' AND\n                    props.visibility = '1' AND\n                    work.post_group_id = {$groupId}\n                    {$userCondition}\n            ";
Example #16
0
 $thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG);
 echo '<tr>';
 echo '<td width="90%" class="thematic_advance_content" id="thematic_advance_content_id_' . $thematic_advance['id'] . '">';
 $edit_link = '';
 if (api_is_allowed_to_edit(null, true)) {
     $edit_link = Display::url(Display::return_icon('edit.png', get_lang('EditThematicAdvance'), [], ICON_SIZE_SMALL), 'index.php?' . api_get_cidreq() . '&' . http_build_query(['action' => 'thematic_advance_edit', 'thematic_id' => $thematic['id'], 'thematic_advance_id' => $thematic_advance['id'], 'display' => 'no_header']), ['class' => 'ajax', 'data-title' => get_lang('EditThematicAdvance')]);
     $edit_link .= '<a onclick="javascript:if(!confirm(\'' . get_lang('AreYouSureToDelete') . '\')) return false;" href="index.php?' . api_get_cidreq() . '&action=thematic_advance_delete&thematic_id=' . $thematic['id'] . '&thematic_advance_id=' . $thematic_advance['id'] . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a></center>';
     //Links
     $edit_link = Display::div(Display::div($edit_link, array('id' => 'thematic_advance_tools_' . $thematic_advance['id'], 'class' => 'thematic_advance_actions')), array('style' => 'height:20px;'));
 }
 $thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null;
 echo Display::div($thematic_advance_item, array('id' => 'thematic_advance_' . $thematic_advance['id']));
 echo $edit_link;
 echo '</td>';
 //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
 if (api_is_allowed_to_edit(null, true)) {
     if (empty($thematic_id)) {
         $checked = '';
         if ($last_done_thematic_advance == $thematic_advance['id']) {
             $checked = 'checked';
         }
         $style = '';
         if ($thematic_advance['done_advance'] == 1) {
             $style = ' style="background-color:#E5EDF9" ';
         } else {
             $style = ' style="background-color:#fff" ';
         }
         echo '<td id="td_done_thematic_' . $thematic_advance['id'] . '" ' . $style . '><center>';
         echo '<input type="radio" class="done_thematic" id="done_thematic_' . $thematic_advance['id'] . '" name="done_thematic" value="' . $thematic_advance['id'] . '" ' . $checked . ' onclick="update_done_thematic_advance(this.value)">';
         echo '</center></td>';
     } else {
Example #17
0
             $my_file_comment = Database::escape_string($_REQUEST['file_comment']);
             store_edited_agenda_item($my_id_attach, $my_file_comment);
             display_agenda_items();
         } else {
             $id = (int) $_GET['id'];
             show_add_form($id);
         }
     } else {
         display_agenda_items();
     }
     break;
 case "delete":
     $id = (int) $_GET['id'];
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id))) {
         // a coach can only delete an element belonging to his session
         if (api_is_allowed_to_edit() && !api_is_anonymous()) {
             if (!empty($id)) {
                 $res_del = delete_agenda_item($id);
                 if ($res_del) {
                     Display::display_normal_message(get_lang("AgendaDeleteSuccess"));
                 }
             }
         }
     }
     display_agenda_items();
     break;
 case "showhide":
     $id = (int) $_GET['id'];
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id))) {
         // a coach can only delete an element belonging to his session
         showhide_agenda_item($id);
Example #18
0
 /**
  * @param array $group_list
  * @param int $category_id
  */
 static function process_groups($group_list, $category_id = null)
 {
     global $origin, $charset;
     $category_id = intval($category_id);
     $totalRegistered = 0;
     $group_data = array();
     $user_info = api_get_user_info();
     $session_id = api_get_session_id();
     $user_id = $user_info['user_id'];
     $orig = isset($origin) ? $origin : null;
     foreach ($group_list as $this_group) {
         // Validation when belongs to a session
         $session_img = api_get_session_image($this_group['session_id'], $user_info['status']);
         // All the tutors of this group
         $tutorsids_of_group = self::get_subscribed_tutors($this_group['id'], true);
         // Create a new table-row
         $row = array();
         // Checkbox
         if (api_is_allowed_to_edit(false, true) && count($group_list) > 1) {
             $row[] = $this_group['id'];
         }
         // Group name
         if ((api_is_allowed_to_edit(false, true) || in_array($user_id, $tutorsids_of_group) || $this_group['is_member'] || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_FORUM) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_DOCUMENTS) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_CALENDAR) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_ANNOUNCEMENT) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_WORK) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_WIKI)) && !(api_is_course_coach() && intval($this_group['session_id']) != $session_id)) {
             $group_name = '<a href="group_space.php?cidReq=' . api_get_course_id() . '&amp;origin=' . $orig . '&amp;gidReq=' . $this_group['id'] . '">' . Security::remove_XSS($this_group['name']) . '</a> ';
             if (!empty($user_id) && !empty($this_group['id_tutor']) && $user_id == $this_group['id_tutor']) {
                 $group_name .= Display::label(get_lang('OneMyGroups'), 'success');
             } elseif ($this_group['is_member']) {
                 $group_name .= Display::label(get_lang('MyGroup'), 'success');
             }
             if (api_is_allowed_to_edit() && !empty($this_group['session_name'])) {
                 $group_name .= ' (' . $this_group['session_name'] . ')';
             }
             $group_name .= $session_img;
             $row[] = $group_name . '<br />' . stripslashes(trim($this_group['description']));
         } else {
             $row[] = $this_group['name'] . '<br />' . stripslashes(trim($this_group['description']));
         }
         // Tutor name
         $tutor_info = null;
         if (count($tutorsids_of_group) > 0) {
             foreach ($tutorsids_of_group as $tutor_id) {
                 $tutor = api_get_user_info($tutor_id);
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $tutor['username']), ENT_QUOTES);
                 if (api_get_setting('show_email_addresses') == 'true') {
                     $tutor_info .= Display::tag('span', Display::encrypted_mailto_link($tutor['mail'], api_get_person_name($tutor['firstName'], $tutor['lastName'])), array('title' => $username)) . ', ';
                 } else {
                     if (api_is_allowed_to_edit()) {
                         $tutor_info .= Display::tag('span', Display::encrypted_mailto_link($tutor['mail'], api_get_person_name($tutor['firstName'], $tutor['lastName'])), array('title' => $username)) . ', ';
                     } else {
                         $tutor_info .= Display::tag('span', api_get_person_name($tutor['firstName'], $tutor['lastName']), array('title' => $username)) . ', ';
                     }
                 }
             }
         }
         $tutor_info = api_substr($tutor_info, 0, api_strlen($tutor_info) - 2);
         $row[] = $tutor_info;
         // Max number of members in group
         $max_members = $this_group['maximum_number_of_members'] == self::MEMBER_PER_GROUP_NO_LIMIT ? ' ' : ' / ' . $this_group['maximum_number_of_members'];
         // Number of members in group
         $row[] = $this_group['number_of_members'] . $max_members;
         // Self-registration / unregistration
         if (!api_is_allowed_to_edit(false, true)) {
             if (self::is_self_registration_allowed($user_id, $this_group['id'])) {
                 $row[] = '<a class = "btn" href="group.php?' . api_get_cidreq() . '&category=' . $category_id . '&amp;action=self_reg&amp;group_id=' . $this_group['id'] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "'" . ')) return false;">' . get_lang('GroupSelfRegInf') . '</a>';
             } elseif (self::is_self_unregistration_allowed($user_id, $this_group['id'])) {
                 $row[] = '<a class = "btn" href="group.php?' . api_get_cidreq() . '&category=' . $category_id . '&amp;action=self_unreg&amp;group_id=' . $this_group['id'] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "'" . ')) return false;">' . get_lang('GroupSelfUnRegInf') . '</a>';
             } else {
                 $row[] = '-';
             }
         }
         $url = api_get_path(WEB_CODE_PATH) . 'group/';
         // Edit-links
         if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && intval($this_group['session_id']) != $session_id)) {
             $edit_actions = '<a href="' . $url . 'settings.php?' . api_get_cidreq(true, false) . '&gidReq=' . $this_group['id'] . '"  title="' . get_lang('Edit') . '">' . Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $edit_actions .= '<a href="' . $url . 'member_settings.php?' . api_get_cidreq(true, false) . '&gidReq=' . $this_group['id'] . '"  title="' . get_lang('GroupMembers') . '">' . Display::return_icon('user.png', get_lang('GroupMembers'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $edit_actions .= '<a href="' . $url . 'group_overview.php?action=export&type=xls&' . api_get_cidreq(true, false) . '&id=' . $this_group['id'] . '"  title="' . get_lang('ExportUsers') . '">' . Display::return_icon('export_excel.png', get_lang('Export'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             /*$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&amp;action=empty_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('EmptyGroup').'">'.
               Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';*/
             $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true, false) . '&category=' . $category_id . '&amp;action=fill_one&amp;id=' . $this_group['id'] . '" onclick="javascript: if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;" title="' . get_lang('FillGroup') . '">' . Display::return_icon('fill.png', get_lang('FillGroup'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true, false) . '&category=' . $category_id . '&amp;action=delete_one&amp;id=' . $this_group['id'] . '" onclick="javascript: if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;" title="' . get_lang('Delete') . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $row[] = $edit_actions;
         }
         if (!empty($this_group['nbMember'])) {
             $totalRegistered = $totalRegistered + $this_group['nbMember'];
         }
         $group_data[] = $row;
     }
     // end loop
     $table = new SortableTableFromArrayConfig($group_data, 1, 20, 'group_category_' . $category_id);
     $table->set_additional_parameters(array('category' => $category_id));
     $column = 0;
     if (api_is_allowed_to_edit(false, true) and count($group_list) > 1) {
         $table->set_header($column++, '', false);
     }
     $table->set_header($column++, get_lang('Groups'));
     $table->set_header($column++, get_lang('GroupTutor'));
     $table->set_header($column++, get_lang('Registered'), false);
     if (!api_is_allowed_to_edit(false, true)) {
         // If self-registration allowed
         $table->set_header($column++, get_lang('GroupSelfRegistration'), false);
     }
     if (api_is_allowed_to_edit(false, true)) {
         // Only for course administrator
         $table->set_header($column++, get_lang('Modify'), false);
         $form_actions = array();
         $form_actions['fill_selected'] = get_lang('FillGroup');
         $form_actions['empty_selected'] = get_lang('EmptyGroup');
         $form_actions['delete_selected'] = get_lang('Delete');
         if (count($group_list) > 1) {
             $table->set_form_actions($form_actions, 'group');
         }
     }
     $table->display();
 }
Example #19
0
                        echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;forum=' . Security::remove_XSS($my_forum) . '&amp;action=delete&amp;content=thread&id=' . $row['thread_id'] . $origin_string . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeleteCompleteThread'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
                    }
                    display_visible_invisible_icon('thread', $row['thread_id'], $row['visibility'], array('forum' => $my_forum, 'origin' => $origin, 'gidReq' => $groupId));
                    display_lock_unlock_icon('thread', $row['thread_id'], $row['locked'], array('forum' => $my_forum, 'origin' => $origin, 'gidReq' => api_get_group_id()));
                    echo '<a href="viewforum.php?' . api_get_cidreq() . '&amp;forum=' . Security::remove_XSS($my_forum) . '&amp;action=move&thread=' . $row['thread_id'] . $origin_string . '">' . Display::return_icon('move.png', get_lang('MoveThread'), array(), ICON_SIZE_SMALL) . '</a>';
                }
            }
            $iconnotify = 'send_mail.gif';
            if (is_array(isset($_SESSION['forum_notification']['thread']) ? $_SESSION['forum_notification']['thread'] : null)) {
                if (in_array($row['thread_id'], $_SESSION['forum_notification']['thread'])) {
                    $iconnotify = 'send_mail_checked.gif';
                }
            }
            $icon_liststd = 'user.png';
            if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
                echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;forum=' . Security::remove_XSS($my_forum) . '&amp;origin=' . $origin . '&amp;action=notify&amp;content=thread&id=' . $row['thread_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>';
            }
            if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
                echo '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&amp;forum=' . Security::remove_XSS($my_forum) . '&amp;origin=' . $origin . '&amp;action=liststd&amp;content=thread&id=' . $row['thread_id'] . '">' . Display::return_icon($icon_liststd, get_lang('StudentList'), array(), ICON_SIZE_SMALL) . '</a>';
            }
            echo '</td></tr>';
        }
        $counter++;
    }
}
echo '</table>';
echo isset($table_list) ? $table_list : '';
/* FOOTER */
if ($origin != 'learnpath') {
    Display::display_footer();
}
Example #20
0
                exit;
            } else {
                if (!empty($o_ppt->error)) {
                    $errorMessage = $o_ppt->error;
                } else {
                    $errorMessage = get_lang('OogieUnknownError');
                }
            }
        } else {
            $errorMessage = get_lang('OogieBadExtension');
        }
    }
}
Event::event_access_tool(TOOL_UPLOAD);
// check access permissions (edit permission is needed to add a document or a LP)
$is_allowed_to_edit = api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
    api_not_allowed(true);
}
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("Doc"));
$nameTools = get_lang("OogieConversionPowerPoint");
Display::display_header($nameTools);
$message = get_lang("WelcomeOogieConverter");
if (!empty($errorMessage)) {
    echo Display::return_message($errorMessage, 'warning', false);
}
$div_upload_limit = get_lang('UploadMaxSize') . ' : ' . ini_get('post_max_size');
$form = new FormValidator('upload_ppt', 'POST', '', '');
$form->addElement('header', get_lang("WelcomeOogieSubtitle"));
$form->addElement('html', Display::return_message($message, 'info', false));
$form->addElement('file', 'user_file', array(Display::return_icon('powerpoint_big.gif'), $div_upload_limit));
 /**
  * Get URL where to go to if the user clicks on the link.
  */
 public function get_link()
 {
     $url = api_get_path(WEB_PATH) . 'main/newscorm/lp_controller.php?cidReq=' . $this->get_course_code() . '&gradebook=view';
     $session_id = api_get_session_id();
     if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
         $url .= '&action=view&session_id=' . $session_id . '&lp_id=' . $this->get_ref_id();
     } else {
         $url .= '&action=build&session_id=' . $session_id . '&lp_id=' . $this->get_ref_id();
     }
     return $url;
 }
    }
    // Returning to the group area (note: this is inconsistent with the rest of chamilo)
    $cat = GroupManager::get_category_from_group($current_group['id']);
    if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
        Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
        header('Location: group.php?' . api_get_cidreq(true, false));
    } else {
        Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
        header('Location: group.php?' . api_get_cidreq(true, false) . '&category=' . $cat['id']);
    }
    exit;
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
    case 'empty':
        if (api_is_allowed_to_edit(false, true)) {
            GroupManager::unsubscribe_all_users($group_id);
            Display::display_confirmation_message(get_lang('GroupEmptied'));
        }
        break;
}
$defaults = $current_group;
$defaults['group_members'] = $selected_users;
$action = isset($_GET['action']) ? $_GET['action'] : '';
$defaults['action'] = $action;
if (!empty($_GET['keyword']) && !empty($_GET['submit'])) {
    $keyword_name = Security::remove_XSS($_GET['keyword']);
    echo '<br/>' . get_lang('SearchResultsFor') . ' <span style="font-style: italic ;"> ' . $keyword_name . ' </span><br>';
}
Display::display_header($nameTools, 'Group');
$form->setDefaults($defaults);
Example #23
0
/**
 * This function shows all the forms that are needed form adding /editing a new personal agenda item
 * when there is no $id passed in the function we are adding a new agenda item, if there is a $id
 * we are editing
 * attention: we have to check that the student is editing an item that belongs to him/her
 */
function show_new_personal_item_form($id = "")
{
    global $year, $MonthsLong;
    $tbl_personal_agenda = Database::get_user_personal_table(TABLE_PERSONAL_AGENDA);
    // we construct the default time and date data (used if we are not editing a personal agenda item)
    //$today = getdate();
    $current_date = api_strtotime(api_get_local_time());
    $year = date('Y', $current_date);
    $month = date('m', $current_date);
    $day = date('d', $current_date);
    $hours = date('H', $current_date);
    $minutes = date('i', $current_date);
    //echo date('Y', $current_date);
    /*
    	$day = $today['mday'];
    	$month = $today['mon'];
    	$year = $today['year'];
    	$hours = $today['hours'];
    	$minutes = $today['minutes'];*/
    $content = stripslashes($content);
    $title = stripslashes($title);
    // if an $id is passed to this function this means we are editing an item
    // we are loading the information here (we do this after everything else
    // to overwrite the default information)
    if (strlen($id) > 0 && $id != strval(intval($id))) {
        return false;
        //potential SQL injection
    }
    if ($id != "") {
        $sql = "SELECT date, title, text FROM " . $tbl_personal_agenda . " WHERE user='******' AND id='" . $id . "'";
        $result = Database::query($sql);
        $aantal = Database::num_rows($result);
        if ($aantal != 0) {
            $row = Database::fetch_array($result);
            $row['date'] = api_get_local_time($row['date']);
            $year = substr($row['date'], 0, 4);
            $month = substr($row['date'], 5, 2);
            $day = substr($row['date'], 8, 2);
            $hours = substr($row['date'], 11, 2);
            $minutes = substr($row['date'], 14, 2);
            $title = $row['title'];
            $content = $row['text'];
        } else {
            return false;
        }
    }
    echo '<form method="post" action="myagenda.php?action=add_personal_agenda_item&id=' . $id . '" name="newedit_form">';
    echo '<div id="newedit_form">';
    echo '<h2>';
    echo $_GET['action'] == 'edit_personal_agenda_item' ? get_lang("ModifyPersonalCalendarItem") : get_lang("AddPersonalCalendarItem");
    echo '</h2>';
    echo '<div>';
    echo '<br/>';
    echo '' . get_lang("Date") . ':	';
    // ********** The form containing the days (0->31) ********** \\
    echo '<select name="frm_day">';
    // small loop for filling all the dates
    // 2do: the available dates should be those of the selected month => february is from 1 to 28 (or 29) and not to 31
    for ($i = 1; $i <= 31; $i++) {
        // values have to have double digits
        if ($i <= 9) {
            $value = "0" . $i;
        } else {
            $value = $i;
        }
        // the current day is indicated with [] around the date
        if ($value == $day) {
            echo '<option value=' . $value . ' selected>' . $i . '</option>';
        } else {
            echo '<option value=' . $value . '>' . $i . '</option>';
        }
    }
    echo '</select>';
    // ********** The form containing the months (jan->dec) ********** \\
    echo '<!-- month: january -> december -->';
    echo '<select name="frm_month">';
    for ($i = 1; $i <= 12; $i++) {
        // values have to have double digits
        if ($i <= 9) {
            $value = "0" . $i;
        } else {
            $value = $i;
        }
        // the current month is indicated with [] around the month name
        if ($value == $month) {
            echo '<option value=' . $value . ' selected>' . $MonthsLong[$i - 1] . '</option>';
        } else {
            echo '<option value=' . $value . '>' . $MonthsLong[$i - 1] . '</option>';
        }
    }
    echo '</select>';
    // ********** The form containing the years ********** \\
    echo '<!-- year -->';
    echo '<select name="frm_year">';
    echo '<option value=' . ($year - 1) . '>' . ($year - 1) . '</option>';
    echo '<option value=' . $year . ' selected>' . $year . '</option>';
    for ($i = 1; $i <= 5; $i++) {
        $value = $year + $i;
        echo '<option value=' . $value . '>' . $value . '</option>';
    }
    echo '</select>&nbsp;&nbsp;';
    echo "<a title=\"Kalender\" href=\"javascript:openCalendar('newedit_form', 'frm_')\">" . Display::return_icon('calendar_select.gif', get_lang('Select'), array('style' => 'vertical-align: middle;')) . "</a>";
    echo '&nbsp;&nbsp;';
    // ********** The form containing the hours  (00->23) ********** \\
    echo '<!-- time: hour -->';
    echo get_lang("Time") . ': ';
    echo '<select name="frm_hour">';
    for ($i = 1; $i <= 24; $i++) {
        // values have to have double digits
        if ($i <= 9) {
            $value = "0" . $i;
        } else {
            $value = $i;
        }
        // the current hour is indicated with [] around the hour
        if ($hours == $value) {
            echo '<option value=' . $value . ' selected>' . $value . '</option>';
        } else {
            echo '<option value=' . $value . '> ' . $value . ' </option>';
        }
    }
    echo '</select>';
    // ********** The form containing the minutes ********** \\
    echo "<select name=\"frm_minute\">";
    echo "<option value=\"" . $minutes . "\">" . $minutes . "</option>";
    echo "<option value=\"00\">00</option>";
    echo "<option value=\"05\">05</option>";
    echo "<option value=\"10\">10</option>";
    echo "<option value=\"15\">15</option>";
    echo "<option value=\"20\">20</option>";
    echo "<option value=\"25\">25</option>";
    echo "<option value=\"30\">30</option>";
    echo "<option value=\"35\">35</option>";
    echo "<option value=\"40\">40</option>";
    echo "<option value=\"45\">45</option>";
    echo "<option value=\"50\">50</option>";
    echo "<option value=\"55\">55</option>";
    echo '</select>';
    echo '</div><br/>';
    // ********** The title field ********** \\
    echo '<div>';
    echo '' . get_lang('Title') . ' : <input type="text" name="frm_title" size="50" value="' . $title . '" />';
    echo '</div>';
    // ********** The text field ********** \\
    echo '<br /><div class="formw">';
    require_once api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php";
    $oFCKeditor = new FCKeditor('frm_content');
    $oFCKeditor->Width = '80%';
    $oFCKeditor->Height = '200';
    if (!api_is_allowed_to_edit(null, true)) {
        $oFCKeditor->ToolbarSet = 'AgendaStudent';
    } else {
        $oFCKeditor->ToolbarSet = 'Agenda';
    }
    $oFCKeditor->Value = $content;
    $return = $oFCKeditor->CreateHtml();
    echo $return;
    echo '</div>';
    // ********** The Submit button********** \\
    echo '<div>';
    echo '<br /><button type="submit" class="add" name="Submit" value="' . get_lang('AddEvent') . '" >' . get_lang('AddEvent') . '</button>';
    echo '</div>';
    echo '</div>';
    echo '</form>';
}
Example #24
0
        //$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center','');
        $pdf->ezSetY(480);
        $pdf->ezText($certif_text, 28, array('justification' => 'center'));
        //$pdf->ezSetY(750);
        $pdf->ezSetY(50);
        $pdf->ezText($date, 18, array('justification' => 'center'));
        $pdf->ezSetY(580);
        $pdf->ezText($organization_name, 22, array('justification' => 'left'));
        $pdf->ezSetY(580);
        $pdf->ezText($portal_name, 22, array('justification' => 'right'));
        $pdf->ezStream();
    }
    exit;
} else {
    $cats = Category::load($category);
    $stud_id = api_is_allowed_to_edit() ? null : api_get_user_id();
    $allcat = $cats[0]->get_subcategories($stud_id);
    $alleval = $cats[0]->get_evaluations($stud_id);
    $alllink = $cats[0]->get_links($stud_id);
}
$addparams = array('selectcat' => $cats[0]->get_id());
if (isset($_GET['search'])) {
    $addparams['search'] = $keyword;
}
if (isset($_GET['studentoverview'])) {
    $addparams['studentoverview'] = '';
}
if (isset($allcat_info) && count($allcat_info) >= 0 && (isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search']) && strlen(trim($_GET['search'])) > 0) {
    $allcat = $allcat_info;
} else {
    $allcat = $allcat;
Example #25
0
    /**
     * Creates the form to create / edit a question
     * A subclass can redifine this function to add fields...
     *
     * @param \FormValidator $form the formvalidator instance (by reference)
     * @param array $fck_config
     */
    public function createForm(&$form, $fck_config = array())
    {
        $maxCategories = 1;
        $url = api_get_path(WEB_AJAX_PATH) . 'exercise.ajax.php?1=1';
        $js = null;
        if ($this->type != MEDIA_QUESTION) {
            $js = '<script>

            function check() {
                var counter = 0;
                $("#category_id option:selected").each(function() {
                    var id = $(this).val();
                    var name = $(this).text();
                    if (id != "" ) {
                        // if a media question was selected
                        $("#parent_id option:selected").each(function() {
                            var questionId = $(this).val();
                            if (questionId != 0) {
                                if (counter >= 1) {
                                    alert("' . addslashes(get_lang('YouCantAddAnotherCategory')) . '");
                                    $("#category_id").trigger("removeItem",[{ "value" : id}]);
                                    return;
                                }
                            }
                        });

                        $.ajax({
                            async: false,
                            url: "' . $url . '&a=exercise_category_exists",
                            data: "id="+id,
                            success: function(return_value) {
                                if (return_value == 0 ) {
                                    alert("' . addslashes(get_lang('CategoryDoesNotExists')) . '");
                                    // Deleting select option tag
                                    $("#category_id").find("option").remove();

                                    $(".holder li").each(function () {
                                        if ($(this).attr("rel") == id) {
                                            $(this).remove();
                                        }
                                    });
                                }
                            },
                        });
                    }
                    counter++;
                });
            }

            $(function() {
                $("#category_id").fcbkcomplete({
                    json_url: "' . $url . '&a=search_category_parent&type=all&filter_by_global=' . $this->exercise->getGlobalCategoryId() . '",
                    maxitems: "' . $maxCategories . '",
                    addontab: false,
                    input_min_size: 1,
                    cache: false,
                    complete_text:"' . get_lang('StartToType') . '",
                    firstselected: false,
                    onselect: check,
                    filter_selected: true,
                    newel: true
                });

                // Change select media
                $("#parent_id").change(function(){
                    $("#parent_id option:selected").each(function() {
                        var questionId = $(this).val();
                        if (questionId != 0) {
                            $.ajax({
                                async: false,
                                dataType: "json",
                                url: "' . $url . '&a=get_categories_by_media&questionId=' . $this->id . '&exerciseId=' . $this->exercise->id . '",
                                data: "mediaId="+questionId,
                                success: function(data) {
                                    if (data != -1) {
                                        var all = $("#category_id").trigger("selectAll");
                                        all.each(function(index, value) {
                                            var selected = $(value).find("option:selected");
                                            selected.each(function( indexSelect, valueSelect) {
                                                valueToRemove = $(valueSelect).val();
                                                $("#category_id").trigger("removeItem",[{ "value" : valueToRemove}]);
                                            });
                                        });

                                        if (data != 0) {
                                            $("#category_id").trigger("addItem",[{"title": data.title, "value": data.value}]);
                                        }
                                    }
                                },
                            });
                        } else {

                            // Removes all items
                            var all = $("#category_id").trigger("selectAll");
                            all.each(function(index, value) {
                                var selected = $(value).find("option:selected");
                                selected.each(function( indexSelect, valueSelect) {
                                    valueToRemove = $(valueSelect).val();
                                    $("#category_id").trigger("removeItem", [{ "value" : valueToRemove}]);
                                });
                            });
                        }
                    });
                });
            });

            // hub 13-12-2010
            function visiblerDevisibler(in_id) {
                if (document.getElementById(in_id)) {

                    if (document.getElementById(in_id).style.display == "none") {
                        document.getElementById(in_id).style.display = "block";
                        if (document.getElementById(in_id+"Img")) {
                            document.getElementById(in_id+"Img").html = "' . addslashes(Display::return_icon('div_hide.gif')) . '";
                        }
                    } else {
                        document.getElementById(in_id).style.display = "none";
                        if (document.getElementById(in_id+"Img")) {
                            document.getElementById(in_id+"Img").html = "dsdsds' . addslashes(Display::return_icon('div_show.gif')) . '";
                        }
                    }
                }
            }
            </script>';
            $form->addElement('html', $js);
        }
        // question name
        $form->addElement('text', 'questionName', get_lang('Question'), array('class' => 'span6'));
        $form->addRule('questionName', get_lang('GiveQuestion'), 'required');
        // Default content.
        $isContent = isset($_REQUEST['isContent']) ? intval($_REQUEST['isContent']) : null;
        // Question type
        $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : $this->selectType();
        $form->addElement('hidden', 'answerType', $answerType);
        // html editor
        $editor_config = array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '150');
        if (is_array($fck_config)) {
            $editor_config = array_merge($editor_config, $fck_config);
        }
        if (!api_is_allowed_to_edit(null, true)) {
            $editor_config['UserStatus'] = 'student';
        }
        $form->add_html_editor('questionDescription', get_lang('QuestionDescription'), false, false, $editor_config);
        // hidden values
        $my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
        $form->addElement('hidden', 'myid', $my_id);
        if ($this->type != MEDIA_QUESTION) {
            if ($this->exercise->fastEdition == false) {
                // Advanced parameters
                $form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
                $form->addElement('html', '<div id="advanced_params_options" style="display:none;">');
            }
            // Level (difficulty).
            $select_level = Question::get_default_levels();
            $form->addElement('select', 'questionLevel', get_lang('Difficulty'), $select_level);
            // Media question.
            $course_medias = Question::prepare_course_media_select(api_get_course_int_id());
            $form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias, array('id' => 'parent_id'));
            // Categories.
            $categoryJS = null;
            if (!empty($this->category_list)) {
                $trigger = '';
                foreach ($this->category_list as $category_id) {
                    if (!empty($category_id)) {
                        $cat = new Testcategory($category_id);
                        if ($cat->id) {
                            $trigger .= '$("#category_id").trigger("addItem",[{"title": "' . $cat->parent_path . '", "value": "' . $cat->id . '"}]);';
                        }
                    }
                }
                $categoryJS .= '<script>$(function() { ' . $trigger . ' });</script>';
            }
            $form->addElement('html', $categoryJS);
            $form->addElement('select', 'questionCategory', get_lang('Category'), array(), array('id' => 'category_id'));
            // Extra fields. (Injecting question extra fields!)
            $extraFields = new ExtraField('question');
            $extraFields->addElements($form, $this->id);
            if ($this->exercise->fastEdition == false) {
                $form->addElement('html', '</div>');
            }
        }
        // @todo why we need this condition??
        if ($this->setDefaultQuestionValues) {
            switch ($answerType) {
                case 1:
                    $this->question = get_lang('DefaultUniqueQuestion');
                    break;
                case 2:
                    $this->question = get_lang('DefaultMultipleQuestion');
                    break;
                case 3:
                    $this->question = get_lang('DefaultFillBlankQuestion');
                    break;
                case 4:
                    $this->question = get_lang('DefaultMathingQuestion');
                    break;
                case 5:
                    $this->question = get_lang('DefaultOpenQuestion');
                    break;
                case 9:
                    $this->question = get_lang('DefaultMultipleQuestion');
                    break;
            }
        }
        // default values
        $defaults = array();
        $defaults['questionName'] = $this->question;
        $defaults['questionDescription'] = $this->description;
        $defaults['questionLevel'] = $this->level;
        $defaults['questionCategory'] = $this->category_list;
        $defaults['parent_id'] = $this->parent_id;
        if (!empty($_REQUEST['myid'])) {
            $form->setDefaults($defaults);
        } else {
            if ($isContent == 1) {
                $form->setDefaults($defaults);
            }
        }
        if ($this->setDefaultValues) {
            $form->setDefaults($defaults);
        }
    }
Example #26
0
                            $html .= return_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility']);
                            $html .= return_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked']);
                            $html .= return_up_down_icon('forum', $forum['forum_id'], $forumsInCategory);
                        }
                        $iconnotify = 'notification_mail_na.png';
                        $session_forum_notification = isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : false;
                        if (is_array($session_forum_notification)) {
                            if (in_array($forum['forum_id'], $session_forum_notification)) {
                                $iconnotify = 'notification_mail.png';
                            }
                        }
                        if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
                            $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=notify&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe'), null, ICON_SIZE_SMALL) . '</a>';
                        }
                        $html .= '</div>';
                        $html .= '</div>';
                        $html .= '</div>';
                        $html .= '</div>';
                        $html .= '</div>';
                        $html .= '</div>';
                    }
                    echo $html;
                }
            }
        } else {
            echo '<div class="alert alert-warning">' . get_lang('NoForumInThisCategory') . '</div>' . (api_is_allowed_to_edit(false, true) ? '<div>' : '</div>') . '</div>';
        }
        echo '</div>';
    }
}
Display::display_footer();
Example #27
0
if (api_is_in_group()) {
    $group_properties = GroupManager::get_group_properties($groupId);
    // Level correction for group documents.
    if (!empty($group_properties['directory'])) {
        $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
    }
}
$relative_url = '';
for ($i = 0; $i < $count_dir; $i++) {
    $relative_url .= '../';
}
// We do this in order to avoid the condition in html_editor.php ==> if ($this -> fck_editor->Config['CreateDocumentWebDir']=='' || $this -> fck_editor->Config['CreateDocumentDir']== '')
if ($relative_url == '') {
    $relative_url = '/';
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$html_editor_config = array('ToolbarSet' => $is_allowed_to_edit ? 'Documents' : 'DocumentsStudent', 'Width' => '100%', 'Height' => '500', 'FullPage' => true, 'InDocument' => true, 'CreateDocumentDir' => $relative_url, 'CreateDocumentWebDir' => empty($group_properties['directory']) ? api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/' : api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document' . $group_properties['directory'] . '/', 'BaseHref' => api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $dir);
if ($is_certificate_mode) {
    $html_editor_config['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/';
    $html_editor_config['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/';
    $html_editor_config['BaseHref'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $dir;
}
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
if (!is_dir($filepath)) {
    $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
    $dir = '/';
}
if (!$is_certificate_mode) {
    $req_gid = null;
    if (api_is_in_group()) {
        $req_gid = '&amp;gidReq=' . $groupId;
Example #28
0
    /**
     * Creates a link to surveys with contextual JS list with all the surveys in it
     *
     * @modified 2010.10.12 - adding css classes and simple a tag
     * @return string
     */
    function get_survey()
    {
        global $charset;
        $table_survey = Database::get_course_table(TABLE_SURVEY);
        $survey_lang_var = api_convert_encoding(get_lang('Survey'), $charset, api_get_system_encoding());
        $newsurvey_lang_var = api_convert_encoding(get_lang('CreateANewSurvey'), $charset, api_get_system_encoding());
        $close_lang_var = api_convert_encoding(get_lang('Close'), $charset, api_get_system_encoding());
        $return = '<a href="#" onclick="javascript:popup(\'popUpDiv4\');" class="big_button four_buttons rounded grey_border survey_button">' . $survey_lang_var . '</a>';
        $return .= '<div id="popUpDiv4" class="author_popup gradient rounded_10 grey_border" style="display:none;">' . '<span class="title">' . $survey_lang_var . '</span>' . '<a href="#" class="close" onclick="javascript:popup(\'popUpDiv4\');">' . $close_lang_var . '</a>';
        $return .= '<div id="resDoc" class="content">';
        $add_condition = "";
        if (api_is_allowed_to_edit()) {
            $add_condition = " AND author = '" . api_get_user_id() . "' ";
        }
        $sql = "SELECT survey_id,title FROM {$table_survey} WHERE session_id = '" . api_get_session_id() . "' {$add_condition}";
        $rs = Database::query($sql, __FILE__, __LINE__);
        $a_survey = array();
        while ($row = Database::fetch_array($rs)) {
            $a_survey[] = $row;
        }
        foreach ($a_survey as $survey) {
            $return .= '<div class="lp_resource_element">';
            if (!empty($survey['survey_id'])) {
                $return .= '<img alt="" src="../img/survey_little.png" style="margin-right:5px;" title="" />';
                $return .= '<a style="cursor:hand" style="vertical-align:middle"></a>
									<a href="' . api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_SURVEY . '&amp;survey_id=' . $survey['survey_id'] . '&amp;lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . api_convert_encoding($survey['title'], $charset, api_get_system_encoding()) . '</a>';
            }
            $return .= '</div>';
        }
        $return .= '<br/>';
        $return .= '<div class="lp_resource_element">';
        $return .= Display::return_icon('pixel.gif', '', array('class' => 'actionplaceholdericon actionnewlist', 'style' => 'margin-right:5px;', 'title' => ''));
        $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'survey/create_new_survey.php?' . api_get_cidreq() . '&action=add&lp_id=' . $this->lp_id . '" title="' . $newsurvey_lang_var . '">' . $newsurvey_lang_var . '</a>';
        $return .= '</div>';
        $return .= '</div>';
        $return .= '</div>';
        return $return;
    }
Example #29
0
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0) {
    api_not_allowed();
}
if (empty($_SESSION['oLP'])) {
    api_not_allowed(true);
}
$debug = 0;
if ($debug) {
    error_log('------ Entering lp_impress.php -------');
}
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/impress/impress-demo.css');
$list = $_SESSION['oLP']->get_toc();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
if ($is_allowed_to_edit) {
    echo '<div style="position: fixed; top: 0px; left: 0px; pointer-events: auto;width:100%">';
    global $interbreadcrumb;
    $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
    $interbreadcrumb[] = array('url' => api_get_self() . "?action=add_item&type=step&lp_id=" . $_SESSION['oLP']->lp_id . "&isStudentView=false", 'name' => $_SESSION['oLP']->get_name());
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
    echo return_breadcrumb($interbreadcrumb, null, null);
    echo '</div>';
}
$html = '';
$step = 1;
foreach ($list as $toc) {
    $x = 1000 * $step;
    //data-scale="'.$step.'"
    //data-x="850" data-y="3000" data-rotate="90" data-scale="5"
Example #30
0
 /**
  * Update action icons column
  *
  * @param integer $glossary_id
  * @param array   Parameters to use to affect links
  * @param array   The line of results from a query on the glossary table
  * @return string HTML string for the action icons columns
  *
  * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium
  * @version januari 2009, dokeos 1.8.6
  */
 public static function actions_filter($glossary_id, $url_params, $row)
 {
     $glossary_id = $row[2];
     $return = '<a href="' . api_get_self() . '?action=edit_glossary&amp;glossary_id=' . $glossary_id . '&' . api_get_cidreq() . '&msg=edit">' . Display::return_icon('edit.png', get_lang('Edit'), '', 22) . '</a>';
     $glossary_data = GlossaryManager::get_glossary_information($glossary_id);
     $glossary_term = $glossary_data['glossary_title'];
     if (api_is_allowed_to_edit(null, true)) {
         if ($glossary_data['session_id'] == api_get_session_id()) {
             $return .= '<a href="' . api_get_self() . '?action=delete_glossary&amp;glossary_id=' . $glossary_id . '&' . api_get_cidreq() . '" onclick="return confirmation(\'' . $glossary_term . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', 22) . '</a>';
         } else {
             $return = get_lang('EditionNotAvailableFromSession');
         }
     }
     return $return;
 }