예제 #1
0
 /**
  * Function that displays a list with al the resources that could be added to the learning path
  * @return string
  */
 public function display_resources()
 {
     $_course = api_get_course_info();
     // TODO: Don't use globals.
     $course_code = api_get_course_id();
     //Get all the docs
     $documents = $this->get_documents();
     //Get all the exercises
     $exercises = $this->get_exercises();
     // Get all the links
     $links = $this->get_links();
     //Get al the student publications
     $works = $this->get_student_publications();
     //Get al the forums
     $forums = $this->get_forums(null, $course_code);
     $headers = array(Display::return_icon('folder_document.png', get_lang('Documents'), array(), 64), Display::return_icon('quiz.png', get_lang('Quiz'), array(), 64), Display::return_icon('links.png', get_lang('Links'), array(), 64), Display::return_icon('works.png', get_lang('Works'), array(), 64), Display::return_icon('forum.png', get_lang('Forums'), array(), 64), Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array(), 64));
     echo Display::display_normal_message(get_lang('ClickOnTheLearnerViewToSeeYourLearningPath'));
     $chapter = $_SESSION['oLP']->display_item_form('chapter', get_lang('EnterDataNewChapter'), 'add_item');
     echo Display::tabs($headers, array($documents, $exercises, $links, $works, $forums, $chapter), 'resource_tab');
     return true;
 }
예제 #2
0
    }

    if (!empty($create_group_item)) {
        $social_right_content .= Display::div(
            $create_group_item,
            array('class' => 'span9')
        );
    }
    $headers = array(
        get_lang('Newest'),
        get_lang('Popular'),
        get_lang('MyGroups')
    );
    $social_right_content .= '<div class="span9">' . Display::tabs(
            $headers,
            array($newest_content, $popular_content, $my_group_content),
            'tab_browse'
        ) . '</div>';
}

$show_message = null;
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && $_REQUEST['msg'] == 'topic_deleted') {
    $show_message = Display::return_message(get_lang('Deleted'), 'success');
}

$tpl = new Template();
$tpl->set_help('Groups');
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
예제 #3
0
        if (api_is_allowed_to_edit(null, true)) {
            $create_group_item = '<a class="btn btn-default" href="' . api_get_path(WEB_PATH) . 'main/social/group_add.php">' . get_lang('CreateASocialGroup') . '</a>';
        }
    }
    if (count($grid_newest_groups) > 0) {
        $newest_content = Display::return_sortable_grid('mygroups', array(), $grid_newest_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, false));
    }
    if (count($grid_pop_groups) > 0) {
        $popular_content = Display::return_sortable_grid('mygroups', array(), $grid_pop_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, true, true));
    }
}
if (!empty($create_group_item)) {
    $social_right_content .= Display::page_subheader($create_group_item);
}
$headers = array(get_lang('Newest'), get_lang('Popular'), get_lang('MyGroups'));
$social_right_content .= Display::tabs($headers, array($newest_content, $popular_content, $my_group_content), 'tab_browse');
$show_message = null;
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'topic_deleted') {
    $show_message = Display::return_message(get_lang('Deleted'), 'success');
}
$tpl = new Template(null);
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu);
$show_menu = 'browse_groups';
if (isset($_GET['view']) && $_GET['view'] == 'mygroups') {
    $show_menu = $_GET['view'];
}
$social_menu_block = SocialManager::show_social_menu($show_menu);
$templateName = 'social/groups.tpl';
$tpl->setHelp('Groups');
$tpl->assign('message', $show_message);
예제 #4
0
/**
 * This function allows the platform admin to choose the default stylesheet
 * @author Patrick Cool <*****@*****.**>, Ghent University
 * @author Julio Montoya <*****@*****.**>, Chamilo
 */
function handle_stylesheets()
{
    global $_configuration;
    // Current style.
    $currentstyle = api_get_setting('stylesheets');
    $is_style_changeable = false;
    if ($_configuration['access_url'] != 1) {
        $style_info = api_get_settings('stylesheets', '', 1, 0);
        $url_info = api_get_access_url($_configuration['access_url']);
        if ($style_info[0]['access_url_changeable'] == 1 && $url_info['active'] == 1) {
            $is_style_changeable = true;
        }
    } else {
        $is_style_changeable = true;
    }
    $form = new FormValidator('stylesheet_upload', 'post', 'settings.php?category=Stylesheets#tabs-2');
    $form->addElement('text', 'name_stylesheet', get_lang('NameStylesheet'), array('size' => '40', 'maxlength' => '40'));
    $form->addRule('name_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
    $form->addElement('file', 'new_stylesheet', get_lang('UploadNewStylesheet'));
    $allowed_file_types = array('css', 'zip', 'jpeg', 'jpg', 'png', 'gif', 'ico', 'psd');
    $form->addRule('new_stylesheet', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')', 'filetype', $allowed_file_types);
    $form->addRule('new_stylesheet', get_lang('ThisFieldIsRequired'), 'required');
    $form->addButtonUpload(get_lang('Upload'), 'stylesheet_upload');
    $show_upload_form = false;
    if (!is_writable(CSS_UPLOAD_PATH)) {
        Display::display_error_message(CSS_UPLOAD_PATH . get_lang('IsNotWritable'));
    } else {
        // Uploading a new stylesheet.
        if ($_configuration['access_url'] == 1) {
            $show_upload_form = true;
        } else {
            if ($is_style_changeable) {
                $show_upload_form = true;
            }
        }
    }
    // Stylesheet upload.
    if (isset($_POST['stylesheet_upload'])) {
        if ($form->validate()) {
            $values = $form->exportValues();
            $picture_element = $form->getElement('new_stylesheet');
            $picture = $picture_element->getValue();
            $result = upload_stylesheet($values, $picture);
            // Add event to the system log.
            $user_id = api_get_user_id();
            $category = $_GET['category'];
            Event::addEvent(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
            if ($result) {
                Display::display_confirmation_message(get_lang('StylesheetAdded'));
            }
        }
    }
    $form_change = new FormValidator('stylesheet_upload', 'post', api_get_self() . '?category=Stylesheets', null, array('id' => 'stylesheets_id'));
    $list_of_names = array();
    $selected = '';
    $dirpath = '';
    $safe_style_dir = '';
    if ($handle = @opendir(CSS_UPLOAD_PATH)) {
        $counter = 1;
        while (false !== ($style_dir = readdir($handle))) {
            if (substr($style_dir, 0, 1) == '.') {
                // Skip directories starting with a '.'
                continue;
            }
            $dirpath = CSS_UPLOAD_PATH . $style_dir;
            if (is_dir($dirpath)) {
                if ($style_dir != '.' && $style_dir != '..') {
                    if (isset($_POST['style']) && (isset($_POST['preview']) || isset($_POST['download'])) && $_POST['style'] == $style_dir) {
                        $safe_style_dir = $style_dir;
                    } else {
                        if ($currentstyle == $style_dir || $style_dir == 'chamilo' && !$currentstyle) {
                            if (isset($_POST['style'])) {
                                $selected = Database::escape_string($_POST['style']);
                            } else {
                                $selected = $style_dir;
                            }
                        }
                    }
                    $show_name = ucwords(str_replace('_', ' ', $style_dir));
                    if ($is_style_changeable) {
                        $list_of_names[$style_dir] = $show_name;
                    }
                    $counter++;
                }
            }
        }
        closedir($handle);
    }
    // Sort styles in alphabetical order.
    asort($list_of_names);
    $select_list = array();
    foreach ($list_of_names as $style_dir => $item) {
        $select_list[$style_dir] = $item;
    }
    $styles =& $form_change->addElement('select', 'style', get_lang('NameStylesheet'), $select_list);
    $styles->setSelected($selected);
    if ($form_change->validate()) {
        // Submit stylesheets.
        if (isset($_POST['save'])) {
            store_stylesheets();
            Display::display_normal_message(get_lang('Saved'));
        }
        if (isset($_POST['download'])) {
            $arch = api_get_path(SYS_ARCHIVE_PATH) . $safe_style_dir . '.zip';
            $dir = api_get_path(SYS_CSS_PATH) . 'themes/' . $safe_style_dir;
            if (is_dir($dir)) {
                $zip = new PclZip($arch);
                // Remove path prefix except the style name and put file on disk
                $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($safe_style_dir)));
                //@TODO: use more generic script to download.
                $str = '<a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . str_replace(api_get_path(SYS_ARCHIVE_PATH), '', $arch) . '">' . get_lang('ClickHereToDownloadTheFile') . '</a>';
                Display::display_normal_message($str, false);
            } else {
                Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning'));
            }
        }
    }
    if ($is_style_changeable) {
        $group = [$form_change->addButtonSave(get_lang('SaveSettings'), 'save', true), $form_change->addButtonPreview(get_lang('Preview'), 'preview', true), $form_change->addButtonDownload(get_lang('Download'), 'download', true)];
        $form_change->addGroup($group);
        if ($show_upload_form) {
            echo '<script>
            $(function() {
                $( "#tabs" ).tabs();
            });
            </script>';
            echo Display::tabs(array(get_lang('Update'), get_lang('UploadNewStylesheet')), array($form_change->return_form(), $form->return_form()));
        } else {
            $form_change->display();
        }
    } else {
        $form_change->freeze();
    }
}
예제 #5
0
    $form->addElement('html', '<div class="label">' . get_lang('SearchFeatureDocumentLanguage') . '</div>');
    $form->addLabel(get_lang('Language'), api_get_languages_combo());
    $form->addElement('html', '</div><div class="sub-form">');
    $specific_fields = get_specific_field_list();
    foreach ($specific_fields as $specific_field) {
        $form->addElement('text', $specific_field['code'], $specific_field['name']);
    }
    $form->addElement('html', '</div>');
}
$form->addElement('radio', 'if_exists', get_lang('UplWhatIfFileExists'), get_lang('UplDoNothing'), 'nothing');
$form->addElement('radio', 'if_exists', '', get_lang('UplOverwriteLong'), 'overwrite');
$form->addElement('radio', 'if_exists', '', get_lang('UplRenameLong'), 'rename');
// Close the java script and avoid the footer up
$form->addElement('html', '</div>');
// Button upload document
$form->addButtonSend(get_lang('SendDocument'), 'submitDocument');
$form->add_real_progress_bar('DocumentUpload', 'file');
$fileExistsOption = api_get_setting('document.if_file_exists_option');
$defaultFileExistsOption = 'rename';
if (!empty($fileExistsOption)) {
    $defaultFileExistsOption = $fileExistsOption;
}
$defaults = array('index_document' => 'checked="checked"', 'if_exists' => $defaultFileExistsOption);
$form->setDefaults($defaults);
$simple_form = $form->returnForm();
$url = api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?' . api_get_cidreq() . '&a=upload_file&curdirpath=' . $path;
$multipleForm = new FormValidator('drag_drop', 'post', '#', array('enctype' => 'multipart/form-data'));
$multipleForm->addMultipleUpload($url);
$headers = array(get_lang('Upload'), get_lang('Upload') . ' (' . get_lang('Simple') . ')');
echo Display::tabs($headers, array($multipleForm->returnForm(), $form->returnForm()), 'tabs');
Display::display_footer();
예제 #6
0
}
// Sub headers
/*$sub_header = array(
    get_lang('AllLearningPaths'),
    get_lang('PerWeek'),
    get_lang('ByCourse')
);

// Sub headers data
$lpTab = Display::tabs(
    $sub_header,
    array(
        //Display::grid_html('list_default'),
        Display::grid_html('list_week'),
        //Display::grid_html('list_course')
    ),
    'sub_tab'
);*/
$coursesTab = Display::grid_html('courses');
$starTab = Display::grid_html('list_default');
$tabs = array($starTab, $coursesTab, Display::grid_html('list_course'), Display::grid_html('exercises'), $reportingTab);
$tabToHide = api_get_configuration_value('session_hide_tab_list');
if (!empty($tabToHide)) {
    foreach ($tabToHide as $columnId) {
        unset($headers[$columnId]);
        unset($tabs[$columnId]);
    }
}
// Main headers data
echo Display::tabs($headers, $tabs);
Display::display_footer();
예제 #7
0
$defaults = array('index_document' => 'checked="checked"');
$form->setDefaults($defaults);
$simple_form = $form->return_form();
$url = api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?a=upload_file';
$multiple_form = get_lang('ClickToSelectOrDragAndDropMultipleFilesOnTheUploadField') . '<br />';
//Adding icon replace the  <div>'.get_lang('UploadFiles').'</div> with this:
//<div style="width:50%;margin:0 auto;"> '.Display::div(Display::return_icon('folder_document.png', '', array(), 64), array('style'=>'float:left')).' '.get_lang('UploadFiles').'</div>
$multiple_form .= '
	<center>
	<form id="file_upload" action="' . $url . '" method="POST" enctype="multipart/form-data">
    	<input type="hidden" name="curdirpath" value="' . $path . '" />
    	<input type="file" name="file" multiple>
    	<button type="submit">Upload</button>
    	' . get_lang('UploadFiles') . '
	</form>
	</center>
	<table style="display:none; width:50%" class="files data_table">
		<tr>
			<th>' . get_lang('FileName') . '</th>
			<th>' . get_lang('Size') . '</th>
			<th>' . get_lang('Status') . '</th>
		</tr>
	</table>';
$nav_info = api_get_navigator();
if ($nav_info['name'] == 'Internet Explorer') {
    echo $simple_form;
} else {
    $headers = array(get_lang('Send'), get_lang('Send') . ' (' . get_lang('Simple') . ')');
    echo Display::tabs($headers, array($multiple_form, $simple_form), 'tabs');
}
Display::display_footer();
예제 #8
0
// Sub headers
$sub_header = array(
    get_lang('AllLearningPaths'),
    get_lang('PerWeek'),
    get_lang('ByCourse')
);

// Sub headers data
$lp_tabs = Display::tabs(
    $sub_header,
    array(
        Display::grid_html('list_default'),
        Display::grid_html('list_week'),
        Display::grid_html('list_course')
    ),
    'sub_tab'
);
$courses_tab =  Display::grid_html('courses');
// Main headers data
echo Display::tabs(
    $headers,
    array(
        $courses_tab,
        $lp_tabs,
        Display::grid_html('exercises'),
        $my_reporting
    )
);

Display::display_footer();
예제 #9
0
                } else {
                    $icon = '';
                }
                $userPicture = UserManager::getUserPicture($member['user_id']);
                $member_content .= '<div class="">';
                $member_name = Display::url(api_get_person_name(cut($member['firstname'], 15), cut($member['lastname'], 15)) . '&nbsp;' . $icon, $member['user_info']['profile_url']);
                $member_content .= Display::div('<img class="social-groups-image" src="' . $userPicture . '"/>&nbsp' . $member_name);
                $member_content .= '</div>';
            }
        }
    }
    if (!empty($create_thread_link)) {
        $create_thread_link = Display::div($create_thread_link, array('class' => 'pull-right'));
    }
    $headers = array(get_lang('Discussions'), get_lang('Members'));
    $social_right_content .= Display::tabs($headers, array($content, $member_content), 'tabs');
} else {
    // if I already sent an invitation message
    if (!in_array($role, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) {
        $social_right_content .= '<a class="btn" href="group_view.php?id=' . $group_id . '&action=join&u=' . api_get_user_id() . '">' . get_lang('JoinGroup') . '</a>';
    } elseif ($role == GROUP_USER_PERMISSION_PENDING_INVITATION) {
        $social_right_content .= '<a class="btn" href="group_view.php?id=' . $group_id . '&action=join&u=' . api_get_user_id() . '">' . get_lang('YouHaveBeenInvitedJoinNow') . '</a>';
    }
}
$tpl = new Template(null);
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, $user_id, 'groups', $group_id);
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('groups', $group_id);
$tpl->setHelp('Groups');
$tpl->assign('create_link', $create_thread_link);
예제 #10
0
 /**
  * Creates a list with all the documents in it
  * @param bool $showInvisibleFiles
  * @return string
  */
 public function get_documents($showInvisibleFiles = false)
 {
     $course_info = api_get_course_info();
     $sessionId = api_get_session_id();
     $documentTree = DocumentManager::get_document_preview($course_info, $this->lp_id, null, $sessionId, true, null, null, $showInvisibleFiles, true);
     $headers = array(get_lang('Files'), get_lang('NewDocument'), get_lang('Upload'));
     $form = new FormValidator('form_upload', 'POST', api_get_self() . '?' . $_SERVER['QUERY_STRING'], '', array('enctype' => "multipart/form-data"));
     $folders = DocumentManager::get_all_document_folders(api_get_course_info(), 0, true);
     DocumentManager::build_directory_selector($folders, '', array(), true, $form, 'directory_parent_id');
     $form->addElement('radio', 'if_exists', get_lang('UplWhatIfFileExists'), get_lang('UplDoNothing'), 'nothing');
     $form->addElement('radio', 'if_exists', '', get_lang('UplOverwriteLong'), 'overwrite');
     $form->addElement('radio', 'if_exists', '', get_lang('UplRenameLong'), 'rename');
     $form->setDefaults(['if_exists' => 'rename']);
     // Check box options
     $form->addElement('checkbox', 'unzip', get_lang('Options'), get_lang('Uncompress'));
     $url = api_get_path(WEB_AJAX_PATH) . 'document.ajax.php?' . api_get_cidreq() . '&a=upload_file&curdirpath=';
     $form->addMultipleUpload($url);
     $new = $this->display_document_form('add', 0);
     $tabs = Display::tabs($headers, array($documentTree, $new, $form->returnForm()), 'subtab');
     return $tabs;
 }
예제 #11
0
if (!empty($selectedGroupChoices)) {
    $defaults['groups'] = $selectedGroupChoices;
}
$form->setDefaults($defaults);
$tpl = new Template();
$currentUser = $em->getRepository('ChamiloUserBundle:User')->find(api_get_user_id());
if ($form->validate()) {
    $values = $form->getSubmitValues();
    // Subscribing users
    $users = isset($values['users']) ? $values['users'] : [];
    $userForm = isset($values['user_form']) ? $values['user_form'] : [];
    if (!empty($userForm)) {
        $em->getRepository('ChamiloCourseBundle:CItemProperty')->subscribeUsersToItem($currentUser, 'learnpath', $course, $session, $lpId, $users);
        Display::addFlash(Display::return_message(get_lang('Updated')));
    }
    // Subscribing groups
    $groups = isset($values['groups']) ? $values['groups'] : [];
    $groupForm = isset($values['group_form']) ? $values['group_form'] : [];
    if (!empty($groupForm)) {
        $em->getRepository('ChamiloCourseBundle:CItemProperty')->subscribeGroupsToItem($currentUser, 'learnpath', $course, $session, $lpId, $groups);
        Display::addFlash(Display::return_message(get_lang('Updated')));
    }
    header("Location: {$url}");
    exit;
} else {
    $headers = [get_lang('SubscribeUsersToLp'), get_lang('SubscribeGroupsToLp')];
    $tabs = Display::tabs($headers, [$formUsers->toHtml(), $form->toHtml()]);
    $tpl->assign('tabs', $tabs);
}
$layout = $tpl->get_template('learnpath/subscribe_users.tpl');
$tpl->display($layout);
/**
* this function displays the form to upload a new item to the dropbox.
*
* @author Patrick Cool <*****@*****.**>, Ghent University
* @version march 2006
*/
function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategory, $view)
{
    $course_info = api_get_course_info();
    $_user = api_get_user_info();
    $is_courseAdmin = api_is_course_admin();
    $is_courseTutor = api_is_course_tutor();
    $origin = isset($_GET['origin']) ? $_GET['origin'] : null;
    $token = Security::get_token();
    $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
    $form = new FormValidator('sent_form', 'post', api_get_self() . '?view_received_category=' . $viewReceivedCategory . '&view_sent_category=' . $viewSentCategory . '&view=' . $view . '&' . api_get_cidreq(), null, array('enctype' => 'multipart/form-data', 'onsubmit' => 'javascript: return checkForm(this);'));
    $form->addElement('header', get_lang('UploadNewFile'));
    $form->addElement('hidden', 'MAX_FILE_SIZE', dropbox_cnf('maxFilesize'));
    $form->addElement('hidden', 'dropbox_unid', $dropbox_unid);
    $form->addElement('hidden', 'sec_token', $token);
    $form->addElement('hidden', 'origin', $origin);
    $form->addElement('file', 'file', get_lang('UploadFile'), array('onChange' => 'javascript: checkfile(this.value);'));
    if (dropbox_cnf('allowOverwrite')) {
        $form->addElement('checkbox', 'cb_overwrite', null, get_lang('OverwriteFile'), array('id' => 'cb_overwrite'));
    }
    // List of all users in this course and all virtual courses combined with it
    if (api_get_session_id()) {
        $complete_user_list_for_dropbox = array();
        if (api_get_setting('dropbox.dropbox_allow_student_to_student') == 'true' || $_user['status'] != STUDENT) {
            $complete_user_list_for_dropbox = CourseManager::get_user_list_from_course_code($course_info['code'], api_get_session_id(), null, null, 0);
        }
        $complete_user_list2 = CourseManager::get_coach_list_from_course_code($course_info['code'], api_get_session_id());
        $generalCoachList = array();
        $courseCoachList = array();
        foreach ($complete_user_list2 as $coach) {
            if ($coach['type'] == 'general_coach') {
                $generalCoachList[] = $coach;
            } else {
                $courseCoachList[] = $coach;
            }
        }
        $hideCourseCoach = api_get_setting('dropbox_hide_course_coach');
        if ($hideCourseCoach == 'false') {
            $complete_user_list_for_dropbox = array_merge($complete_user_list_for_dropbox, $courseCoachList);
        }
        $hideGeneralCoach = api_get_setting('dropbox_hide_general_coach');
        if ($hideGeneralCoach == 'false') {
            $complete_user_list_for_dropbox = array_merge($complete_user_list_for_dropbox, $generalCoachList);
        }
    } else {
        if (api_get_setting('dropbox.dropbox_allow_student_to_student') == 'true' || $_user['status'] != STUDENT) {
            $complete_user_list_for_dropbox = CourseManager::get_user_list_from_course_code($course_info['code'], api_get_session_id());
        } else {
            $complete_user_list_for_dropbox = CourseManager::getTeacherListFromCourse($course_info['real_id'], false);
        }
    }
    if (!empty($complete_user_list_for_dropbox)) {
        foreach ($complete_user_list_for_dropbox as $k => $e) {
            $complete_user_list_for_dropbox[$k] = $e + array('lastcommafirst' => api_get_person_name($e['firstname'], $e['lastname']));
        }
        $complete_user_list_for_dropbox = TableSort::sort_table($complete_user_list_for_dropbox, 'lastcommafirst');
    }
    /*
        Create the options inside the select box:
        List all selected users their user id as value and a name string as display
    */
    $current_user_id = '';
    $options = array();
    $userGroup = new UserGroup();
    foreach ($complete_user_list_for_dropbox as $current_user) {
        if (($dropbox_person->isCourseTutor || $dropbox_person->isCourseAdmin || dropbox_cnf('allowStudentToStudent') || $current_user['status'] != 5 || $current_user['is_tutor'] == 1) && $current_user['user_id'] != $_user['user_id']) {
            // Don't include yourself.
            if ($current_user['user_id'] == $current_user_id) {
                continue;
            }
            $userId = $current_user['user_id'];
            $userInfo = api_get_user_info($userId);
            if ($userInfo['status'] != INVITEE) {
                $groupNameListToString = '';
                if (!empty($groups)) {
                    $groupNameList = array_column($groups, 'name');
                    $groupNameListToString = ' - [' . implode(', ', $groupNameList) . ']';
                }
                $groups = $userGroup->getUserGroupListByUser($userId);
                $full_name = $userInfo['complete_name'] . $groupNameListToString;
                $current_user_id = $current_user['user_id'];
                $options['user_' . $current_user_id] = $full_name;
            }
        }
    }
    /*
     * Show groups
     */
    if (($dropbox_person->isCourseTutor || $dropbox_person->isCourseAdmin) && dropbox_cnf('allowGroup') || dropbox_cnf('allowStudentToStudent')) {
        $complete_group_list_for_dropbox = GroupManager::get_group_list(null, dropbox_cnf('courseId'));
        if (count($complete_group_list_for_dropbox) > 0) {
            foreach ($complete_group_list_for_dropbox as $current_group) {
                if ($current_group['number_of_members'] > 0) {
                    $options['group_' . $current_group['id']] = 'G: ' . $current_group['name'] . ' - ' . $current_group['number_of_members'] . ' ' . get_lang('Users');
                }
            }
        }
    }
    if (dropbox_cnf('allowJustUpload')) {
        $options['user_' . $_user['user_id']] = get_lang('JustUploadInSelect');
    }
    $form->addSelect('recipients', get_lang('SendTo'), $options, array('multiple' => 'multiple', 'size' => '10'));
    $form->addButtonUpload(get_lang('Upload'), 'submitWork');
    $headers = array(get_lang('Upload'), get_lang('Upload') . ' (' . get_lang('Simple') . ')');
    $multipleForm = new FormValidator('sent_multiple', 'post', '#', null, array('enctype' => 'multipart/form-data', 'id' => 'fileupload'));
    $multipleForm->addSelect('recipients', get_lang('SendTo'), $options, array('multiple' => 'multiple', 'size' => '10', 'id' => 'recipient_form'));
    $url = api_get_path(WEB_AJAX_PATH) . 'dropbox.ajax.php?' . api_get_cidreq() . '&a=upload_file&id=';
    $multipleForm->addHtml('<div id="multiple_form" style="display:none">');
    $multipleForm->addMultipleUpload($url);
    $multipleForm->addHtml('</div>');
    echo Display::tabs($headers, array($multipleForm->returnForm(), $form->returnForm()), 'tabs');
}
예제 #13
0
        $reportingTab = Display::return_message(get_lang('NoDataAvailable'), 'warning');
    }
}
// Main headers
$headers = array(Display::return_icon('moderator_star.png'), get_lang('Courses'), get_lang('LearningPaths'));
if (!api_is_anonymous()) {
    $headers[] = get_lang('MyQCM');
    $headers[] = get_lang('MyStatistics');
}
// Sub headers
/*$sub_header = array(
    get_lang('AllLearningPaths'),
    get_lang('PerWeek'),
    get_lang('ByCourse')
);

// Sub headers data
$lpTab = Display::tabs(
    $sub_header,
    array(
        //Display::grid_html('list_default'),
        Display::grid_html('list_week'),
        //Display::grid_html('list_course')
    ),
    'sub_tab'
);*/
$coursesTab = Display::grid_html('courses');
$starTab = Display::grid_html('list_default');
// Main headers data
echo Display::tabs($headers, array($starTab, $coursesTab, Display::grid_html('list_course'), Display::grid_html('exercises'), $reportingTab));
Display::display_footer();
예제 #14
0
 /**
  * Function that displays a list with al the resources that
  * could be added to the learning path
  * @return string
  */
 public function display_resources()
 {
     $learnPath = self::getCurrentLpFromSession();
     $course_code = api_get_course_id();
     // Get all the docs.
     $documents = $this->get_documents(true);
     // Get all the exercises.
     $exercises = $this->get_exercises();
     // Get all the links.
     $links = $this->get_links();
     // Get al the student publications.
     $works = $this->get_student_publications();
     // Get al the forums.
     $forums = $this->get_forums(null, $course_code);
     $headers = array(Display::return_icon('folder_document.png', get_lang('Documents'), array(), ICON_SIZE_BIG), Display::return_icon('quiz.png', get_lang('Quiz'), array(), ICON_SIZE_BIG), Display::return_icon('links.png', get_lang('Links'), array(), ICON_SIZE_BIG), Display::return_icon('works.png', get_lang('Works'), array(), ICON_SIZE_BIG), Display::return_icon('forum.png', get_lang('Forums'), array(), ICON_SIZE_BIG), Display::return_icon('add_learnpath_section.png', get_lang('NewChapter'), array(), ICON_SIZE_BIG));
     echo Display::display_normal_message(get_lang('ClickOnTheLearnerViewToSeeYourLearningPath'));
     $chapter = $learnPath->display_item_form('chapter', get_lang('EnterDataNewChapter'), 'add_item');
     echo Display::tabs($headers, array($documents, $exercises, $links, $works, $forums, $chapter), 'resource_tab');
     return true;
 }