/**
  * Handle the subscribe action.
  * 
  * @return bool
  */
 function action_subscribe_user()
 {
     $action = self::get('action');
     if ($action != self::ACTION_SUBSCRIBE) {
         return false;
     }
     $course_code = self::post(self::PARAM_SUBSCRIBE);
     if (empty($course_code)) {
         return false;
     }
     $registration_code = self::post(self::PARAM_PASSCODE);
     if ($this->subscribe_user($course_code, $registration_code)) {
         Display::display_confirmation_message(get_lang('EnrollToCourseSuccessful'));
         return;
     }
     if (!empty($registration_code)) {
         Display::display_error_message(get_lang('CourseRegistrationCodeIncorrect'));
     }
     $this->display_form($course_code);
     return true;
 }
Ejemplo n.º 2
0
if (!empty($my_folder_data['description'])) {
    echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
}

$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;

switch ($action) {
    case 'delete':
        $fileDeleted = deleteWorkItem($item_id, $courseInfo);

        if (!$fileDeleted) {
            Display::display_error_message(get_lang('YouAreNotAllowedToDeleteThisDocument'));
        } else {
            Display::display_confirmation_message(get_lang('TheDocumentHasBeenDeleted'));
        }
        break;
}

$result = getWorkDateValidationStatus($work_data);
echo $result['message'];
$check_qualification = intval($my_folder_data['qualification']);

if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {
    $type = 'simple';

    $columns = array(
        get_lang('Type'),
        get_lang('Title'),
        get_lang('Qualification'),
        if (count($users) == 0 || count($courses) == 0) {
            Display::display_error_message(get_lang('AtLeastOneUserAndOneCourse'));
        } else {
            $errorDrh = 0;
            foreach ($courses as $course_code) {
                foreach ($users as $user_id) {
                    $user = api_get_user_info($user_id);
                    if ($user['status'] != DRH) {
                        CourseManager::subscribe_user($user_id, $course_code);
                    } else {
                        $errorDrh = 1;
                    }
                }
            }
            if ($errorDrh == 0) {
                Display::display_confirmation_message(get_lang('UsersAreSubscibedToCourse'));
            } else {
                Display::display_error_message(get_lang('HumanResourcesManagerShouldNotBeRegisteredToCourses'));
            }
        }
    }
}
/* Display GUI */
if (empty($first_letter_user)) {
    $sql = "SELECT count(*) as nb_users FROM {$tbl_user}";
    $result = Database::query($sql);
    $num_row = Database::fetch_array($result);
    if ($num_row['nb_users'] > 1000) {
        //if there are too much users to gracefully handle with the HTML select list,
        // assign a default filter on users names
        $first_letter_user = '******';
Ejemplo n.º 4
0
// Security check
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
if (!$is_allowed_to_edit) {
    api_not_allowed(true);
}
// setting the tabs
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = "<script>\n\$(document).ready( function(){\n    \$('#user_custom_score').click(function() {\n        \$('#options').toggle();\n    });\n});\n</script>";
// Action handling
lp_upload_quiz_action_handling();
$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
// Display the header
Display::display_header(get_lang('ImportExcelQuiz'), 'Exercises');
if (isset($_GET['message'])) {
    if (in_array($_GET['message'], array('ExerciseEdited'))) {
        Display::display_confirmation_message(get_lang($_GET['message']));
    }
}
// display the actions
echo '<div class="actions">';
echo lp_upload_quiz_actions();
echo '</div>';
// the main content
lp_upload_quiz_main();
function lp_upload_quiz_actions()
{
    $return = '<a href="exercise.php?' . api_get_cidReq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    return $return;
}
function lp_upload_quiz_secondary_actions()
{
Ejemplo n.º 5
0
    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'))) {
        $my_message_history = Security::remove_XSS($_GET['message']);
        Display::display_confirmation_message(get_lang($my_message_history));
    }
}
echo '<div class="actions">';
echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' . Display::return_icon('back.png', get_lang('BackToResultList'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
?>

<table class="data_table">
	<tr class="row_odd">
		<th><?php 
echo get_lang('Question');
?>
</th>
		<th width="50px"><?php 
echo get_lang('Value');
Ejemplo n.º 6
0
 /**
  * Move a glossary term
  *
  * @param unknown_type $direction
  * @param unknown_type $glossary_id
  *
  * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium
  * @version januari 2009, dokeos 1.8.6
  */
 public static function move_glossary($direction, $glossary_id, $message = true)
 {
     // Database table definition
     $t_glossary = Database::get_course_table(TABLE_GLOSSARY);
     // sort direction
     if ($direction == 'up') {
         $sortorder = 'DESC';
     } else {
         $sortorder = 'ASC';
     }
     $course_id = api_get_course_int_id();
     $sql = "SELECT * FROM {$t_glossary}\n                WHERE c_id = {$course_id}\n                ORDER BY display_order {$sortorder}";
     $res = Database::query($sql);
     $found = false;
     while ($row = Database::fetch_array($res)) {
         if ($found && empty($next_id)) {
             $next_id = $row['glossary_id'];
             $next_display_order = $row['display_order'];
         }
         if ($row['glossary_id'] == $glossary_id) {
             $current_id = $glossary_id;
             $current_display_order = $row['display_order'];
             $found = true;
         }
     }
     $sql1 = "UPDATE {$t_glossary} SET display_order = '" . Database::escape_string($next_display_order) . "'\n                 WHERE c_id = {$course_id}  AND glossary_id = '" . Database::escape_string($current_id) . "'";
     $sql2 = "UPDATE {$t_glossary} SET display_order = '" . Database::escape_string($current_display_order) . "'\n                 WHERE c_id = {$course_id}  AND glossary_id = '" . Database::escape_string($next_id) . "'";
     Database::query($sql1);
     Database::query($sql2);
     if ($message) {
         Display::display_confirmation_message(get_lang('TermMoved'));
     }
 }
Ejemplo n.º 7
0
api_block_anonymous_users();
$stok = Security::get_token();
$courses_without_category = isset($courses_in_category[0]) ? $courses_in_category[0] : null;

?>

<!-- Actions: The menu with the different options in cathe course management -->
<div id="actions" class="actions">
    <?php if ($action != 'createcoursecategory') { ?>
	&nbsp;<a href="<?php echo api_get_self(); ?>?action=createcoursecategory"><?php echo Display::return_icon('new_folder.png', get_lang('CreateCourseCategory'),'','32'); ?></a>
    <?php } ?>
</div>

<?php
if (!empty($message)) {
    Display::display_confirmation_message($message, false);
}

// COURSES WITH CATEGORIES
if (!empty($user_course_categories)) {
       foreach ($user_course_categories as $row) {
           echo Display::page_subheader($row['title']);
           echo '<a name="category'.$row['id'].'"></a>';

           if (isset($_GET['categoryid']) && $_GET['categoryid'] == $row['id']) { ?>
            <!-- We display the edit form for the category -->

            <form name="edit_course_category" method="post" action="courses.php?action=<?php echo $action; ?>">
                <input type="hidden" name="edit_course_category" value="<?php echo $row['id']; ?>" />
                <input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
                <input type="text" name="title_course_category" value="<?php echo $row['title']; ?>" />
Ejemplo n.º 8
0
if (isset($type)) {
    $url = api_get_self() . '?type=1';
} else {
    $url = api_get_self();
}
if (isset($fromExercise) && $fromExercise > 0) {
    echo '<a href="admin.php?' . api_get_cidreq() . '&exerciseId=' . $fromExercise . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM) . '</a>';
    $titleAdd = get_lang('AddQuestionToTest');
} else {
    echo '<a href="exercice.php?' . api_get_cidReq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    echo "<a href='admin.php?exerciseId=0'>" . Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM) . "</a>";
    $titleAdd = get_lang('ManageAllQuestions');
}
echo '</div>';
if ($displayMessage != "") {
    Display::display_confirmation_message($displayMessage);
    $displayMessage = "";
}
// Form
echo '<form class="form-horizontal" name="question_pool" method="GET" action="' . $url . '">';
// Title
echo '<legend>' . $nameTools . ' - ' . $titleAdd . '</legend>';
if (isset($type)) {
    echo '<input type="hidden" name="type" value="1">';
}
echo '<input type="hidden" name="fromExercise" value="' . $fromExercise . '">';
// Session list, if sessions are used.
$sessionList = SessionManager::get_sessions_by_user(api_get_user_id(), api_is_platform_admin());
$tabAttrParam = array('class' => 'chzn-select', 'onchange' => 'submit_form(this)');
$labelFormRow = get_lang('Session');
$session_select_list = array();
 function display($return = false)
 {
     $result = $this->display_parameters($return);
     if ($this->perform_action()) {
         if ($return) {
             $result .= Display::return_confirmation_message(get_lang('Done'));
         } else {
             Display::display_confirmation_message(get_lang('Done'));
         }
     }
     $result .= $this->display_data($return);
     if ($return) {
         return $result;
     }
 }
Ejemplo n.º 10
0
                            Display::display_error_message(get_lang("CannotDeleteGlossary") . ':' . $term['id']);
                        }
                    }
                }
                //$data = Import::csv_to_array($_FILES['file']['tmp_name']);
                $data = Import::csv_reader($_FILES['file']['tmp_name']);
                $good = 0;
                $bad = 0;
                foreach ($data as $item) {
                    if (GlossaryManager::save_glossary(array('glossary_title' => $item['term'], 'glossary_comment' => $item['definition']), false)) {
                        $good++;
                    } else {
                        $bad++;
                    }
                }
                Display::display_confirmation_message(get_lang("TermsImported") . ':' . $good);
                if ($bad) {
                    Display::display_error_message(get_lang("TermsNotImported") . ':' . $bad);
                }
                GlossaryManager::display_glossary();
            }
            break;
        default:
            GlossaryManager::display_glossary();
            break;
    }
} else {
    GlossaryManager::display_glossary();
}
// Footer
Display::display_footer();
Ejemplo n.º 11
0
 /**
  * Uploads a document
  *
  * @param array $files the $_FILES variable
  * @param string $path
  * @param string $title
  * @param string $comment
  * @param int $unzip unzip or not the file
  * @param string $if_exists overwrite, rename or warn (default)
  * @param bool $index_document index document (search xapian module)
  * @param bool $show_output print html messages
  * @return array|bool
  */
 public static function upload_document($files, $path, $title = null, $comment = null, $unzip = 0, $if_exists = null, $index_document = false, $show_output = false, $fileKey = 'file')
 {
     $course_info = api_get_course_info();
     $sessionId = api_get_session_id();
     $course_dir = $course_info['path'] . '/document';
     $sys_course_path = api_get_path(SYS_COURSE_PATH);
     $base_work_dir = $sys_course_path . $course_dir;
     if (isset($files[$fileKey])) {
         $upload_ok = process_uploaded_file($files[$fileKey], $show_output);
         if ($upload_ok) {
             // File got on the server without problems, now process it
             $new_path = handle_uploaded_document($course_info, $files[$fileKey], $base_work_dir, $path, api_get_user_id(), api_get_group_id(), null, $unzip, $if_exists, $show_output, false, null, $sessionId);
             if ($new_path) {
                 $documentId = DocumentManager::get_document_id($course_info, $new_path, $sessionId);
                 if (!empty($documentId)) {
                     $table_document = Database::get_course_table(TABLE_DOCUMENT);
                     $params = array();
                     /*if ($if_exists == 'rename') {
                           // Remove prefix
                           $suffix = DocumentManager::getDocumentSuffix(
                               $course_info,
                               $sessionId,
                               api_get_group_id()
                           );
                           $new_path = basename($new_path);
                           $new_path = str_replace($suffix, '', $new_path);
                           error_log('renamed');
                           error_log($new_path);
                           $params['title'] = get_document_title($new_path);
                       } else {
                           if (!empty($title)) {
                               $params['title'] = get_document_title($title);
                           } else {
                               $params['title'] = get_document_title($files['file']['name']);
                           }
                       }*/
                     if (!empty($comment)) {
                         $params['comment'] = trim($comment);
                     }
                     Database::update($table_document, $params, array('id = ? AND c_id = ? ' => array($documentId, $course_info['real_id'])));
                 }
                 // Showing message when sending zip files
                 if ($new_path === true && $unzip == 1 && $show_output) {
                     Display::display_confirmation_message(get_lang('UplUploadSucceeded') . '<br />', false);
                 }
                 if ($index_document) {
                     self::index_document($documentId, $course_info['code'], null, $_POST['language'], $_REQUEST, $if_exists);
                 }
                 if (!empty($documentId) && is_numeric($documentId)) {
                     $documentData = self::get_document_data_by_id($documentId, $course_info['code'], false, $sessionId);
                     return $documentData;
                 }
             }
         }
     }
     return false;
 }
Ejemplo n.º 12
0
    } else {
        Display::display_icon('down_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
    }
    echo '	</td>';
    $question_counter++;
    if ($is_survey_type_1) {
        echo '<td>' . ($row['survey_group_pri'] == 0 ? get_lang('Secondary') : get_lang('Primary')) . '</td>';
        echo '<td>' . ($row['survey_group_pri'] == 0 ? $groups[$row['survey_group_sec1']] . '-' . $groups[$row['survey_group_sec2']] : $groups[$row['survey_group_pri']]) . '</td>';
    }
    echo '</tr>';
}
echo '</table>';
if ($is_survey_type_1) {
    echo '<br /><br /><b>' . get_lang('ManageGroups') . '</b><br /><br />';
    if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
        echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
    }
    if (in_array($_GET['sendmsg'], array('GroupNeedName'))) {
        echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
    }
    echo '<table border="0"><tr><td width="100">' . get_lang('Name') . '</td><td>' . get_lang('Description') . '</td></tr></table>';
    echo '<form action="' . api_get_path(WEB_CODE_PATH) . 'survey/survey.php?action=addgroup&survey_id=' . $survey_id . '" method="post">';
    if ($_GET['action'] == 'editgroup') {
        $sql = 'SELECT name,description FROM ' . $table_survey_question_group . ' WHERE id = ' . Database::escape_string($_GET['gid']) . ' AND survey_id = ' . Database::escape_string($survey_id) . ' limit 1';
        $rs = Database::query($sql);
        $editedrow = Database::fetch_array($rs, 'ASSOC');
        echo '<input type="text" maxlength="20" name="name" value="' . $editedrow['name'] . '" size="10" disabled>';
        echo '<input type="text" maxlength="150" name="description" value="' . $editedrow['description'] . '" size="40">';
        echo '<input type="hidden" name="group_id" value="' . Security::remove_XSS($_GET['gid']) . '">';
        echo '<input type="submit" value="' . get_lang('Save') . '"' . '<input type="button" value="' . get_lang('Cancel') . '" onclick="window.location.href = \'survey.php?survey_id=' . Security::remove_XSS($survey_id) . '\';" />';
    } else {
Ejemplo n.º 13
0
        }
    }
}
Display::display_header();
if (!empty($message)) {
    if (!empty($user_to_show)) {
        $userMessage = null;
        foreach ($user_to_show as $user) {
            if (!is_array($user)) {
                $user = array($user);
            }
            $user = array_filter($user);
            $userMessage .= implode(', ', $user) . "<br />";
        }
        if ($type == 'confirmation') {
            Display::display_confirmation_message($message . ': <br />' . $userMessage, false);
        } else {
            Display::display_warning_message($message . ':  <br />' . $userMessage, false);
        }
    } else {
        $empty_line_msg = $empty_line == 0 ? get_lang('ErrorsWhenImportingFile') : get_lang('ErrorsWhenImportingFile') . ': ' . get_lang('EmptyHeaderLine');
        Display::display_error_message($empty_line_msg);
    }
}
$form->display();
echo get_lang('CSVMustLookLike');
echo '<blockquote><pre>
    username;
    jdoe;
    jmontoya;
</pre>
Ejemplo n.º 14
0
    } else {
        return false;
    }
}
</script>
<?php 
/* DISPLAY SECTION */
echo $_SESSION['oLP']->build_action_menu();
echo '<div class="row-fluid">';
echo '<div class="span4">';
// Build the tree with the menu items in it.
echo $_SESSION['oLP']->return_new_tree();
echo '</div>';
echo '<div class="span8">';
if (isset($is_success) && $is_success === true) {
    Display::display_confirmation_message(get_lang('ItemRemoved'));
} else {
    if ($is_new) {
        Display::display_normal_message(get_lang('LearnpathAdded'), false);
    }
    // Display::display_normal_message(get_lang('LPCreatedAddChapterStep'), false);
    $gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null;
    echo Display::page_subheader(get_lang('LearnPathAddedTitle'));
    echo '<ul id="lp_overview" class="thumbnails">';
    echo show_block('lp_controller.php?' . api_get_cidreq() . '&amp;gradebook=' . $gradebook . '&amp;action=add_item&amp;type=step&amp;lp_id=' . $_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png');
    //    echo show_block('lp_controller.php?'.api_get_cidreq().'&amp;gradebook='.$gradebook.'&amp;action=admin_view&amp;updateaudio=true&amp;lp_id=' . $_SESSION['oLP']->lp_id, get_lang("BasicOverview"), get_lang('BasicOverviewComment'), 'audio.png');
    echo show_block('lp_controller.php?' . api_get_cidreq() . '&amp;gradebook=' . $gradebook . '&amp;action=view&amp;lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png');
    //echo show_block('lp_controller.php?'.api_get_cidreq().'&amp;gradebook='.$gradebook.'&amp;action=edit&amp;lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Settings"), null, 'reference.png');
    echo '</ul>';
}
echo '</div>';
Ejemplo n.º 15
0
$course_id = GradebookUtils::get_course_id_by_link_id($my_selectcat);
$table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$table_evaluation = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$table_evaluated[LINK_EXERCISE] = array(TABLE_QUIZ_TEST, 'title', 'id', get_lang('Exercise'));
$table_evaluated[LINK_DROPBOX] = array(TABLE_DROPBOX_FILE, 'name', 'id', get_lang('Dropbox'));
$table_evaluated[LINK_STUDENTPUBLICATION] = array(TABLE_STUDENT_PUBLICATION, 'url', 'id', get_lang('Student_publication'));
$table_evaluated[LINK_LEARNPATH] = array(TABLE_LP_MAIN, 'name', 'id', get_lang('Learnpath'));
$table_evaluated[LINK_FORUM_THREAD] = array(TABLE_FORUM_THREAD, 'thread_title_qualify', 'thread_id', get_lang('Forum'));
$table_evaluated[LINK_ATTENDANCE] = array(TABLE_ATTENDANCE, 'attendance_title_qualify', 'id', get_lang('Attendance'));
$table_evaluated[LINK_SURVEY] = array(TABLE_SURVEY, 'code', 'survey_id', get_lang('Survey'));
$submitted = isset($_POST['submitted']) ? $_POST['submitted'] : '';
if ($submitted == 1) {
    Display::display_confirmation_message(get_lang('GradebookWeightUpdated')) . '<br /><br />';
    if (isset($_POST['evaluation'])) {
        $eval_log = new Evaluation();
    }
}
$output = '';
$my_cat = Category::load($my_selectcat);
$my_cat = $my_cat[0];
$parent_id = $my_cat->get_parent_id();
$parent_cat = Category::load($parent_id);
$my_category = array();
$cat = new Category();
$my_category = $cat->shows_all_information_an_category($my_selectcat);
$original_total = $my_category['weight'];
$masked_total = $parent_cat[0]->get_weight();
$sql = 'SELECT * FROM ' . $table_link . ' WHERE category_id = ' . $my_selectcat;
Ejemplo n.º 16
0
            $form->display();
        }
        break;
    case 'delete':
        // Action handling: delete
        if ($check) {
            $res = $career->delete($_GET['id']);
            if ($res) {
                Display::display_confirmation_message(get_lang('ItemDeleted'));
            }
        }
        $career->display();
        break;
    case 'copy':
        if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
            api_not_allowed();
        }
        if ($check) {
            $res = $career->copy($_GET['id'], true);
            //copy career and promotions inside
            if ($res) {
                Display::display_confirmation_message(get_lang('ItemCopied'));
            }
        }
        $career->display();
        break;
    default:
        $career->display();
        break;
}
Display::display_footer();
Ejemplo n.º 17
0
    $table->set_additional_parameters($parameters);
    $table->set_header(0, '', false, array('style' => 'width:20px;'));
    $table->set_header(1, get_lang('Title'), false);
    if (api_is_allowed_to_edit(null, true)) {
        $table->set_header(2, get_lang('Actions'), false, array('style' => 'text-align:center;width:40%;'));
        $table->set_form_actions(array('thematic_delete_select' => get_lang('DeleteAllThematics')));
    }
    $table->display();
} elseif ($action == 'thematic_details') {
    if (isset($_GET['thematic_plan_save_message']) && $_GET['thematic_plan_save_message'] == 'ok') {
        Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull'));
    }
    if (isset($last_id) && $last_id) {
        $link_to_thematic_plan = '<a href="index.php?' . api_get_cidreq() . '&action=thematic_plan_list&thematic_id=' . $last_id . '">' . Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL) . '</a>';
        $link_to_thematic_advance = '<a href="index.php?' . api_get_cidreq() . '&action=thematic_advance_list&thematic_id=' . $last_id . '">' . Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL) . '</a>';
        Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull') . '<br />' . sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'), $link_to_thematic_plan, $link_to_thematic_advance), false);
    }
    // display title
    if (!empty($thematic_id)) {
    } else {
        // display information
        $message = '<strong>' . get_lang('Information') . '</strong><br />';
        $message .= get_lang('ThematicDetailsDescription');
        Display::display_normal_message($message, false);
        echo '<br />';
    }
    // Display thematic data
    if (!empty($thematic_data)) {
        // display progress
        echo '<div style="text-align:right;"><h2>' . get_lang('Progress') . ': <span id="div_result">' . $total_average_of_advances . '</span> %</h2></div>';
        echo '<table width="100%" class="data_table">';
Ejemplo n.º 18
0
        unset($_SESSION['paged_questions']);
        unset($_SESSION['page_questions_sec']);
        $paged_questions_sec = array();
    } else {
        echo '<div id="survey_content" class="survey_content">'.get_lang('UpdateInformation').'</div>';
        // We unset the sessions
        unset($_SESSION['paged_questions']);
        unset($_SESSION['page_questions_sec']);
        $paged_questions_sec = array();
        $form->display();
    }
}

// Displaying the survey thanks message
if (isset($_POST['finish_survey'])) {
    Display::display_confirmation_message(get_lang('SurveyFinished'));
    echo $survey_data['survey_thanks'];

    survey_manager::update_survey_answered(
        $survey_data,
        $survey_invitation['user'],
        $survey_invitation['survey_code']
    );
    unset($_SESSION['paged_questions']);
    unset($_SESSION['page_questions_sec']);
    Display :: display_footer();
    exit();
}

// Sets the random questions
$shuffle = '';
Ejemplo n.º 19
0
        $interbreadcrumb[] = array('url' => "blog.php?blog_id={$blog_id}", 'name' => Blog::get_blog_title($blog_id));
        Display::display_header($nameTools, 'Blogs');
        break;
    case 'execute_task':
        $nameTools = get_lang('ExecuteThisTask');
        $interbreadcrumb[] = array('url' => "blog.php?blog_id={$blog_id}", 'name' => Blog::get_blog_title($blog_id));
        Display::display_header($nameTools, 'Blogs');
        break;
    default:
        $nameTools = Blog::get_blog_title($blog_id);
        Display::display_header($nameTools, 'Blogs');
}
// feedback messages
if (!empty($return_message)) {
    if ($return_message['type'] == 'confirmation') {
        Display::display_confirmation_message($return_message['message']);
    }
    if ($return_message['type'] == 'error') {
        Display::display_error_message($return_message['message']);
    }
}
// actions
echo '<div class=actions>';
?>
	<a href="<?php 
echo api_get_self();
?>
?blog_id=<?php 
echo $blog_id;
?>
" title="<?php 
Ejemplo n.º 20
0
 /**
  * Used to delete a link or a category
  * @author Patrick Cool <*****@*****.**>, Ghent University
  * @param int $id
  * @param string $type The type of item to delete
  * @return bool
  */
 public static function deletelinkcategory($id, $type)
 {
     $courseInfo = api_get_course_info();
     $tbl_link = Database::get_course_table(TABLE_LINK);
     $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
     $course_id = $courseInfo['real_id'];
     $id = intval($id);
     if (empty($id)) {
         return false;
     }
     $result = false;
     switch ($type) {
         case 'link':
             // -> Items are no longer physically deleted,
             // but the visibility is set to 2 (in item_property).
             // This will make a restore function possible for the platform administrator.
             $sql = "UPDATE {$tbl_link} SET on_homepage='0'\n                        WHERE c_id = {$course_id} AND id='" . $id . "'";
             Database::query($sql);
             api_item_property_update($courseInfo, TOOL_LINK, $id, 'delete', api_get_user_id());
             self::delete_link_from_search_engine(api_get_course_id(), $id);
             Display::display_confirmation_message(get_lang('LinkDeleted'));
             $result = true;
             break;
         case 'category':
             // First we delete the category itself and afterwards all the links of this category.
             $sql = "DELETE FROM " . $tbl_categories . "\n                        WHERE c_id = {$course_id} AND id='" . $id . "'";
             Database::query($sql);
             $sql = "DELETE FROM " . $tbl_link . "\n                        WHERE c_id = {$course_id} AND category_id='" . $id . "'";
             Database::query($sql);
             api_item_property_update($courseInfo, TOOL_LINK_CATEGORY, $id, 'delete', api_get_user_id());
             Display::addFlash(Display::return_message(get_lang('CategoryDeleted')));
             $result = true;
             break;
     }
     return $result;
 }
Ejemplo n.º 21
0
    $interbreadcrumb[] = array("url" => "exercise.php?" . api_get_cidreq(), "name" => get_lang('Exercises'));
    $objExerciseTmp = new Exercise();
    if ($objExerciseTmp->read($exercise_id)) {
        $nameTools = get_lang('Results') . ': ' . $objExerciseTmp->name;
    }
}
Display::display_header($nameTools);
// Clean all results for this test before the selected date
if (($is_allowedToEdit || $is_tutor || api_is_coach()) && isset($_GET['delete_before_date']) && $locked == false) {
    // ask for the date
    $check = Security::check_token('get');
    if ($check) {
        $objExerciseTmp = new Exercise();
        if ($objExerciseTmp->read($exercise_id)) {
            $count = $objExerciseTmp->clean_results(true, $_GET['delete_before_date'] . ' 23:59:59');
            Display::display_confirmation_message(sprintf(get_lang('XResultsCleaned'), $count));
        }
    }
}
// Security token to protect deletion
$token = Security::get_token();
$actions = Display::div($actions, array('class' => 'actions'));
$extra = '<script>
    $(document).ready(function() {
        $( "#dialog:ui-dialog" ).dialog( "destroy" );
        $( "#dialog-confirm" ).dialog({
                autoOpen: false,
                show: "blind",
                resizable: false,
                height:300,
                modal: true
        switch ($values['action']) {
            case 'add':
                $announcement_id = SystemAnnouncementManager::add_announcement($values['title'], $values['content'], $values['range_start'], $values['range_end'], $values['visible_teacher'], $values['visible_student'], $values['visible_guest'], $values['lang'], $sendMail, empty($values['add_to_calendar']) ? false : true, empty($values['send_email_test']) ? false : true);
                if ($announcement_id !== false) {
                    SystemAnnouncementManager::announcement_for_groups($announcement_id, array($values['group']));
                    Display::display_confirmation_message(get_lang('AnnouncementAdded'));
                } else {
                    $show_announcement_list = false;
                    $form->display();
                }
                break;
            case 'edit':
                $sendMailTest = isset($values['send_email_test']) ? $values['send_email_test'] : null;
                if (SystemAnnouncementManager::update_announcement($values['id'], $values['title'], $values['content'], $values['range_start'], $values['range_end'], $values['visible_teacher'], $values['visible_student'], $values['visible_guest'], $values['lang'], $sendMail, $sendMailTest)) {
                    SystemAnnouncementManager::announcement_for_groups($values['id'], array($values['group']));
                    Display::display_confirmation_message(get_lang('AnnouncementUpdated'));
                } else {
                    $show_announcement_list = false;
                    $form->display();
                }
                break;
            default:
                break;
        }
        $show_announcement_list = true;
    } else {
        $form->display();
        $show_announcement_list = false;
    }
}
if ($show_announcement_list) {
        Category::deleteAllCertificates($cat_id);
        break;
}
$course_code = api_get_course_id();
$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradebookListOfStudentsCertificates'));
$this_section = SECTION_COURSES;
Display::display_header('');
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
    $check = Security::check_token('get');
    if ($check) {
        $certificate = new Certificate($_GET['certificate_id']);
        $result = $certificate->delete(true);
        Security::clear_token();
        if ($result == true) {
            Display::display_confirmation_message(get_lang('CertificateRemoved'));
        } else {
            Display::display_error_message(get_lang('CertificateNotRemoved'));
        }
    }
}
$token = Security::get_token();
echo Display::page_header(get_lang('GradebookListOfStudentsCertificates'));
//@todo replace all this code with something like get_total_weight()
$cats = Category::load($cat_id, null, null, null, null, null, false);
if (!empty($cats)) {
    //with this fix the teacher only can view 1 gradebook
    if (api_is_platform_admin()) {
        $stud_id = api_is_allowed_to_edit() ? null : api_get_user_id();
    } else {
        $stud_id = api_get_user_id();
Ejemplo n.º 24
0
            $errors = import_pdfs($courses, $subDir);
            if (count($errors) == 0) {
                error_log('Course intros imported successfully in ' . __FILE__ . ', line ' . __LINE__);
            }
        }
    }
}
if (count($errors) != 0) {
    $error_message = '<ul>';
    foreach ($errors as $index => $error_course) {
        $error_message .= '<li>' . get_lang('Course') . ': ' . $error_course['Title'] . ' (' . $error_course['Code'] . ')</li>';
    }
    $error_message .= '</ul>';
    Display::display_normal_message($error_message, false);
} elseif ($_POST['formSent']) {
    Display::display_confirmation_message('CourseIntroductionsAllImportesSuccessfully', false);
}
?>
    <form method="post" action="<?php 
echo api_get_self();
?>
" enctype="multipart/form-data" style="margin: 0px;">
        <legend><?php 
echo $tool_name;
?>
</legend>
        <div class="control-group">
            <label><?php 
echo get_lang('ImportZipFileLocation');
?>
</label>
Ejemplo n.º 25
0
            } else {
                echo '<div id="column1" class="col-md-6">';
                echo '&nbsp;';
                echo '</div>';
            }
            // blocks for column 2
            if (in_array('column_2', $columns_name)) {
                // blocks for column 1
                echo '<div id="column2" class="col-md-6">';
                foreach ($columns['column_2'] as $content) {
                    echo $content;
                }
                echo '</div>';
            } else {
                echo '<div id="column2" class="col-md-6">';
                echo '&nbsp;';
                echo '</div>';
            }
        }
        echo '</div>';
    } else {
        echo '<div style="margin-top:20px;">' . get_lang('YouHaveNotEnabledBlocks') . '</div>';
    }
} else {
    // block dashboard list
    if (isset($success)) {
        Display::display_confirmation_message(get_lang('BlocksHaveBeenUpdatedSuccessfully'));
    }
    $user_id = api_get_user_id();
    DashboardManager::display_user_dashboard_list($user_id);
}
Ejemplo n.º 26
0
/**
 * form to add a category
 * @todo move to TestCategory.class.php
 * @param string $action
 */
function add_category_form($action)
{
    $action = Security::remove_XSS($action);
    // initiate the object
    $form = new FormValidator('note', 'post', api_get_self() . '?action=' . $action);
    // Setting the form elements
    $form->addElement('header', get_lang('AddACategory'));
    $form->addElement('text', 'category_name', get_lang('CategoryName'), array('size' => '95'));
    $form->addHtmlEditor('category_description', get_lang('CategoryDescription'), false, false, array('ToolbarSet' => 'test_category', 'Height' => '200'));
    $form->addButtonCreate(get_lang('AddTestCategory'), 'SubmitNote');
    // setting the rules
    $form->addRule('category_name', get_lang('ThisFieldIsRequired'), 'required');
    // The validation or display
    if ($form->validate()) {
        $check = Security::check_token('post');
        if ($check) {
            $values = $form->exportValues();
            $v_name = Security::remove_XSS($values['category_name'], COURSEMANAGER);
            $v_description = Security::remove_XSS($values['category_description'], COURSEMANAGER);
            $objcat = new TestCategory(0, $v_name, $v_description);
            if ($objcat->addCategoryInBDD()) {
                Display::display_confirmation_message(get_lang('AddCategoryDone'));
            } else {
                Display::display_confirmation_message(get_lang('AddCategoryNameAlreadyExists'));
            }
        }
        Security::clear_token();
    } else {
        display_goback();
        $token = Security::get_token();
        $form->addElement('hidden', 'sec_token');
        $form->setConstants(array('sec_token' => $token));
        $form->display();
    }
}
Ejemplo n.º 27
0
    $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);
echo GroupManager::getSettingBar('member');
$form->display();
Ejemplo n.º 28
0
/**
 * Responses to AJAX calls
 */
//require_once '../global.inc.php';
$action = $_GET['a'];
switch ($action) {
    case 'send_message':
        $subject = isset($_REQUEST['subject']) ? trim($_REQUEST['subject']) : null;
        $messageContent = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : null;
        if (empty($subject) || empty($messageContent)) {
            echo Display::display_error_message(get_lang('ErrorSendingMessage'));
            exit;
        }
        $result = MessageManager::send_message($_REQUEST['user_id'], $subject, $messageContent);
        if ($result) {
            echo Display::display_confirmation_message(get_lang('MessageHasBeenSent'));
        } else {
            echo Display::display_error_message(get_lang('ErrorSendingMessage'));
        }
        break;
    case 'send_invitation':
        $subject = isset($_REQUEST['subject']) ? trim($_REQUEST['subject']) : null;
        $invitationContent = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : null;
        SocialManager::send_invitation_friend_user($_REQUEST['user_id'], $subject, $invitationContent);
        break;
    case 'find_users':
        if (api_is_anonymous()) {
            echo '';
            break;
        }
        $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
Ejemplo n.º 29
0
    Display::display_confirmation_message(get_lang('CategoryEdited'), false);
}
if (isset($_GET['editeval'])) {
    Display::display_confirmation_message(get_lang('EvaluationEdited'), false);
}
if (isset($_GET['linkedited'])) {
    Display::display_confirmation_message(get_lang('LinkEdited'), false);
}
if (isset($_GET['nolinkitems'])) {
    Display::display_warning_message(get_lang('NoLinkItems'), false);
}
if (isset($_GET['addallcat'])) {
    Display::display_normal_message(get_lang('AddAllCat'), false);
}
if (isset($confirmation_message)) {
    Display::display_confirmation_message($confirmation_message, $filter_confirm_msg);
}
if (isset($warning_message)) {
    Display::display_warning_message($warning_message, $filter_warning_msg);
}
if (isset($move_form)) {
    Display::display_normal_message($move_form->toHtml(), false);
}
// LOAD DATA & DISPLAY TABLE                             -
$is_platform_admin = api_is_platform_admin();
$is_course_admin = api_is_allowed_to_edit();
//load data for category, evaluation and links
if (!isset($_GET['selectcat']) || empty($_GET['selectcat'])) {
    $category = 0;
} else {
    $category = Security::remove_XSS($_GET['selectcat']);
Ejemplo n.º 30
0
         Display::display_confirmation_message(get_lang('BlogStored'));
     }
 }
 if (!empty($_POST['edit_blog_submit']) and !empty($_POST['blog_name'])) {
     if (strlen(trim($_POST['blog_name'])) > 0) {
         Blog::edit_blog($get_blog_id, $get_blog_name, $get_blog_subtitle);
         Display::display_confirmation_message(get_lang('BlogEdited'));
     }
 }
 if (isset($_GET['action']) && $_GET['action'] == 'visibility') {
     Blog::change_blog_visibility(intval($_GET['blog_id']));
     Display::display_confirmation_message(get_lang('VisibilityChanged'));
 }
 if (isset($_GET['action']) && $_GET['action'] == 'delete') {
     Blog::delete_blog(intval($_GET['blog_id']));
     Display::display_confirmation_message(get_lang('BlogDeleted'));
 }
 /*
 	DISPLAY
 */
 //api_display_tool_title($nameTools);
 //api_introductionsection(TOOL_BLOG);
 if (isset($_GET['action']) && $_GET['action'] == 'add') {
     // we show the form if
     // 1. no post data
     // 2. there is post data and one of the required form elements is empty
     if (!$_POST or !empty($_POST) and (empty($_POST['new_blog_submit']) or empty($_POST['blog_name']))) {
         // if there is post data there is certainly an error in the form
         /*if ($_POST){
         			Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
         		}*/