/**
     * This method return content html containing information about teachers and its position for showing it inside dashboard interface
     * it's important to use the name 'get_block' for beeing used from dashboard controller
     * @return array   column and content html
     */
    public function get_block()
    {
    	global $charset;
    	$column = 1;
    	$data   = array();
		$teacher_information_graph = $this->get_teachers_information_graph();
		$html = '
                <li class="widget color-blue" id="intro">
                    <div class="widget-head">
                        <h3>'.get_lang('TeachersInformationsGraph').'</h3>
                        <div class="widget-actions"><a onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;" href="index.php?action=disable_block&path='.$this->path.'">'.Display::return_icon('close.gif',get_lang('Close')).'</a></div>
                    </div>
                    <div class="widget-content" align="center">
                        <div style="padding:10px;"><strong>'.get_lang('TimeSpentOnThePlatformLastWeekByDay').'</strong></div>
                        '.$teacher_information_graph.'
                    </div>
                </li>
				';

    	$data['column'] = $column;
    	$data['content_html'] = $html;

    	return $data;

    }
Exemplo n.º 2
0
function lp_upload_quiz_main()
{
    // variable initialisation
    $lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : null;
    $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
    $form->addElement('header', get_lang('ImportExcelQuiz'));
    $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
    $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>';
    $form->addElement('label', '', $link);
    $table = new HTML_Table(array('class' => 'table'));
    $tableList = array(UNIQUE_ANSWER => get_lang('UniqueSelect'), MULTIPLE_ANSWER => get_lang('MultipleSelect'), FILL_IN_BLANKS => get_lang('FillBlanks'), MATCHING => get_lang('Matching'), FREE_ANSWER => get_lang('FreeAnswer'), GLOBAL_MULTIPLE_ANSWER => get_lang('GlobalMultipleAnswer'));
    $table->setHeaderContents(0, 0, get_lang('QuestionType'));
    $table->setHeaderContents(0, 1, '#');
    $row = 1;
    foreach ($tableList as $key => $label) {
        $table->setCellContents($row, 0, $label);
        $table->setCellContents($row, 1, $key);
        $row++;
    }
    $table = $table->toHtml();
    $form->addElement('label', get_lang('QuestionType'), $table);
    $form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score'));
    $form->addElement('html', '<div id="options" style="display:none">');
    $form->addElement('text', 'correct_score', get_lang('CorrectScore'));
    $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore'));
    $form->addElement('html', '</div>');
    $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
    $form->add_progress_bar();
    $form->addButtonUpload(get_lang('Upload'), 'submit_upload_quiz');
    // Display the upload field
    $form->display();
}
Exemplo n.º 3
0
function edit_filter($id, $url_params, $row)
{
    global $charset;
    $return = '<a href="specific_fields_add.php?action=edit&field_id=' . $row[0] . '">' . Display::return_icon('edit.gif', get_lang('Edit')) . '</a>';
    $return .= ' <a href="' . api_get_self() . '?action=delete&field_id=' . $row[0] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . "'" . ')) return false;">' . Display::return_icon('delete.gif', get_lang('Delete')) . '</a>';
    return $return;
}
 /**
  *
  * @param array $breadcrumbs
  */
 protected function setBreadcrumb($breadcrumbs)
 {
     $course = $this->getCourse();
     //$session =  $this->getSession();
     // Adding course breadcrumb.
     if (!empty($course)) {
         $courseBreadcrumb = array('name' => \Display::return_icon('home.png') . ' ' . $course->getTitle(), 'url' => array('route' => 'course', 'routeParameters' => array('cidReq' => $course->getCode(), 'id_session' => api_get_session_id())));
         array_unshift($breadcrumbs, $courseBreadcrumb);
     }
     $app = $this->app;
     $app['main_breadcrumb'] = function ($app) use($breadcrumbs) {
         /** @var  \Knp\Menu\MenuItem $menu */
         $menu = $app['knp_menu.factory']->createItem('root', array('childrenAttributes' => array('class' => 'breadcrumb', 'currentClass' => 'active')));
         if (!empty($breadcrumbs)) {
             foreach ($breadcrumbs as $item) {
                 if (empty($item['url'])) {
                     $item['url'] = array();
                 }
                 $menu->addChild($item['name'], $item['url']);
             }
         }
         return $menu;
     };
     $matcher = new Matcher();
     $voter = new \Knp\Menu\Silex\Voter\RouteVoter();
     $voter->setRequest($this->getRequest());
     $matcher->addVoter($voter);
     $renderer = new \Knp\Menu\Renderer\TwigRenderer($this->get('twig'), 'bread.tpl', $matcher);
     $bread = $renderer->render($this->get('main_breadcrumb'), array('template' => 'default/layout/bread.tpl'));
     $app['breadcrumbs'] = $bread;
 }
 /**
  * Displays the title + grid
  */
 public function display()
 {
     // action links
     $content = Display::actions(array(array('url' => 'event_type.php', 'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM))));
     $content .= Display::grid_html('event_email_template');
     return $content;
 }
    /**
     * This method return content html containing information about courses and its position for showing it inside dashboard interface
     * it's important to use the name 'get_block' for beeing used from dashboard controller
     * @return array   column and content html
     */
    public function get_block()
    {
        global $charset;
        $column = 2;
        $data = array();
        $content = $this->get_content_html();
        $html = '
		            <li class="widget color-green" id="intro">
		                <div class="widget-head">
		                    <h3>' . get_lang('CoursesInformation') . '</h3>
		                    <div class="widget-actions"><a onclick="javascript:if(!confirm(\'' . addslashes(
                api_htmlentities(
                    get_lang('ConfirmYourChoice'),
                    ENT_QUOTES,
                    $charset
                )
            ) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">' . Display::return_icon(
                'close.gif',
                get_lang('Close')
            ) . '</a></div>
		                </div>
		                <div class="widget-content">
		                   ' . $content . '
		                </div>
		            </li>
				';
        $data['column'] = $column;
        $data['content_html'] = $html;

        return $data;
    }
Exemplo n.º 7
0
 /**
  * Get the necessary javascript for this datepicker
  * @return string
  */
 private function getElementJS()
 {
     $js = null;
     $id = $this->getAttribute('id');
     $js .= "<script>\n            \$(function() {\n                /*\$('#{$id}').hide().datepicker({\n                    defaultDate: '" . $this->getValue() . "',\n                    dateFormat: 'yy-mm-dd',\n                    altField: '#{$id}_alt',\n                    altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",\n                    showOn: 'both',\n                    buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',\n                    buttonImageOnly: true,\n                    buttonText: '" . get_lang('SelectDate') . "',\n                    changeMonth: true,\n                    changeYear: true,\n                    yearRange: 'c-60y:c+5y'\n                });*/\n\n                 \$('#{$id}').datetimepicker({\n                    defaultDate: '" . $this->getValue() . "',\n                    format: 'YYYY-MM-DD'\n                });\n\n            });\n        </script>";
     return $js;
 }
Exemplo n.º 8
0
 /**
  * Displays the title + grid
  */
 public function display()
 {
     echo '<div class="actions" style="margin-bottom:20px">';
     echo '<a href="career_dashboard.php">' . Display::return_icon('back.png', get_lang('Back'), '', '32') . '</a>';
     echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('new_career.png', get_lang('Add'), '', '32') . '</a>';
     echo '</div>';
     echo Display::grid_html('careers');
 }
Exemplo n.º 9
0
 /**
  * Get the necessary javascript for this datepicker
  * @return string
  */
 private function getElementJS()
 {
     $js = null;
     $id = $this->getAttribute('id');
     //timeFormat: 'hh:mm'
     $js .= "<script>\n            \$(function() {\n                \$('#{$id}').hide().datetimepicker({\n                    defaultDate: '" . $this->getValue() . "',\n                    dateFormat: 'yy-mm-dd',\n                    timeFormat: 'HH:mm',\n                    altField: '#{$id}_alt',\n                    altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",\n                    altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\",\n                    altSeparator: \" " . get_lang('AtTime') . " \",\n                    altFieldTimeOnly: false,\n                    showOn: 'both',\n                    buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',\n                    buttonImageOnly: true,\n                    buttonText: '" . get_lang('SelectDate') . "'\n                });\n            });\n        </script>";
     return $js;
 }
Exemplo n.º 10
0
 protected function build_export_form_option($show_pdf = true)
 {
     $this->addElement('header', get_lang('ChooseFormat'));
     $this->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV (Comma-Separated Values)', 'csv');
     $this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml');
     $this->addElement('radio', 'file_type', Display::return_icon('info3.gif', get_lang('ToExportMustLockEvaluation')), 'PDF (Portable Document Format)', 'pdf', array('disabled'));
     $this->addElement('style_submit_button', 'submit', get_lang('Export'), 'class="upload"');
     $this->setDefaults(array('file_type' => 'csv'));
 }
Exemplo n.º 11
0
 /**
  * Displays the title + grid
  */
 public function display()
 {
     // action links
     echo '<div class="actions" style="margin-bottom:20px">';
     echo '<a href="grade_models.php">' . Display::return_icon('back.png', get_lang('Back'), '', '32') . '</a>';
     echo '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('add.png', get_lang('Add'), '', '32') . '</a>';
     echo '</div>';
     echo Display::grid_html('grade_model');
 }
Exemplo n.º 12
0
/**
 * Filter for sortable table to display edit icons for class
 */
function modify_filter($class_id)
{
    $class_id = Security::remove_XSS($class_id);
    $result = '<a href="class_information.php?id=' . $class_id . '">' . Display::return_icon('synthese_view.gif', get_lang('Info')) . '</a>';
    $result .= ' <a href="class_edit.php?idclass=' . $class_id . '">' . Display::return_icon('edit.png', get_lang('Edit')) . '</a>';
    $result .= ' <a href="subscribe_user2class.php?idclass=' . $class_id . '">' . Display::return_icon('add_multiple_users.gif', get_lang('AddUsersToAClass')) . '</a>';
    $result .= ' <a href="class_list.php?action=delete_class&amp;class_id=' . $class_id . '" onclick="javascript: if(!confirm(' . "'" . addslashes(get_lang("ConfirmYourChoice")) . "'" . ')) return false;">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>';
    return $result;
}
Exemplo n.º 13
0
 /**
  * Displays the title + grid
  */
 public function listing()
 {
     // action links
     $html = '<div class="actions">';
     //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
     $html .= '<a href="' . api_get_self() . '?action=add">' . Display::return_icon('add.png', get_lang('Add'), '', '32') . '</a>';
     $html .= '</div>';
     $html .= Display::grid_html('timelines');
     return $html;
 }
Exemplo n.º 14
0
/**
 * This function displays the form for import of the zip file with qti2
 */
function ch_qti2_display_form()
{
    $name_tools = get_lang('ImportQtiQuiz');
    $form = '<div class="actions">';
    $form .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'exercice/exercise.php?show=test&' . api_get_cidreq() . '">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    $form .= '</div>';
    $formValidator = new FormValidator('qti_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
    $formValidator->addElement('header', $name_tools);
    $formValidator->addElement('file', 'userFile', get_lang('DownloadFile'));
    $formValidator->addButtonImport(get_lang('Upload'));
    $form .= $formValidator->returnForm();
    echo $form;
}
Exemplo n.º 15
0
function lp_upload_quiz_main()
{
    // variable initialisation
    $lp_id = Security::remove_XSS($_GET['lp_id']);
    $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
    $form->addElement('header', get_lang('ImportExcelQuiz'));
    $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
    $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate'), null, 16) . get_lang('DownloadExcelTemplate');
    $form->addElement('advanced_settings', $link);
    //button send document
    $form->addElement('style_submit_button', 'submit_upload_quiz', get_lang('Send'), 'class="upload"');
    // Display the upload field
    $form->display();
}
Exemplo n.º 16
0
 public static function getTopMenu()
 {
     $menu_items = array();
     $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "auth/my_progress.php");
     $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH) . 'mySpace/?view=teacher');
     $menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), '#');
     $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH) . 'tracking/exams.php');
     $menu = null;
     foreach ($menu_items as $item) {
         $menu .= $item;
     }
     $menu .= '<br />';
     return $menu;
 }
Exemplo n.º 17
0
/**
 * This function updates the progress bar
 * @param div_id where the progress bar is displayed
 * @param upload_id the identifier given in the field UPLOAD_IDENTIFIER
 */
function updateProgress($div_id, $upload_id, $waitAfterupload = false)
{
    $objResponse = new xajaxResponse();
    $ul_info = uploadprogress_get_info($upload_id);
    $percent = intval($ul_info['bytes_uploaded'] * 100 / $ul_info['bytes_total']);
    if ($waitAfterupload && $ul_info['est_sec'] < 2) {
        $percent = 100;
        $objResponse->addAssign($div_id . '_label', 'innerHTML', get_lang('UploadFile') . ' : ' . $percent . ' %');
        $objResponse->addAssign($div_id . '_waiter_frame', 'innerHTML', Display::return_icon('progress_bar.gif'));
        $objResponse->addScript('clearInterval("myUpload.__progress_bar_interval")');
    }
    $objResponse->addAssign($div_id . '_label', 'innerHTML', get_lang('UploadFile') . ' : ' . $percent . ' %');
    $objResponse->addAssign($div_id . '_filled', 'style.width', $percent . '%');
    return $objResponse;
}
Exemplo n.º 18
0
/**
 * This function displays the form for import of the zip file with qti2
 * @param   string  Report message to show in case of error
 */
function aiken_display_form($msg = '')
{
    $name_tools = get_lang('ImportAikenQuiz');
    $form = '<div class="actions">';
    $form .= '<a href="exercice.php?show=test">' . Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM) . '</a>';
    $form .= '</div>';
    $form .= $msg;
    $form_validator = new FormValidator('aiken_upload', 'post', api_get_self() . "?" . api_get_cidreq(), null, array('enctype' => 'multipart/form-data'));
    $form_validator->addElement('header', $name_tools);
    $form_validator->addElement('text', 'total_weight', get_lang('TotalWeight'));
    $form_validator->addElement('file', 'userFile', get_lang('DownloadFile'));
    $form_validator->addElement('style_submit_button', 'submit', get_lang('Send'), 'class="upload"');
    $form .= $form_validator->return_form();
    $form .= '<blockquote>' . get_lang('ImportAikenQuizExplanation') . '<br /><pre>' . get_lang('ImportAikenQuizExplanationExample') . '</pre></blockquote>';
    echo $form;
}
Exemplo n.º 19
0
 /**
  * @param FormValidator $form
  * @param int $fck_config
  */
 public function createForm(&$form, $fck_config = 0)
 {
     parent::createForm($form, $fck_config);
     if (!isset($_GET['editQuestion'])) {
         $form->addElement('file', 'imageUpload', array('<img src="' . Display::return_icon('hotspot.png', null, null, ICON_SIZE_BIG, false, true) . '" />', get_lang('UploadJpgPicture')));
         // setting the save button here and not in the question class.php
         // Saving a question
         $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
         //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
         $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif'));
         $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
     } else {
         // setting the save button here and not in the question class.php
         // Editing a question
         $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
     }
 }
Exemplo n.º 20
0
 function createForm(&$form, $fck_config = 0)
 {
     parent::createForm($form, $fck_config);
     if (!isset($_GET['editQuestion'])) {
         $renderer = $form->defaultRenderer();
         $form->addElement('file', 'imageUpload', array(Display::return_icon('hotspots.png'), get_lang('UploadJpgPicture')));
         // setting the save button here and not in the question class.php
         // Saving a question
         $form->addElement('style_submit_button', 'submitQuestion', get_lang('GoToQuestion'), 'class="' . $this->submitClass . '"');
         $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif'));
         $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
     } else {
         // setting the save button here and not in the question class.php
         // Editing a question
         $form->addElement('style_submit_button', 'submitQuestion', get_lang('ModifyExercise'), 'class="' . $this->submitClass . '"');
     }
 }
Exemplo n.º 21
0
 /**
  *
  * @return string
  */
 public function indexAction(Application $app, $id)
 {
     $actions = null;
     if (api_is_platform_admin()) {
         $actions = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/system_announcements.php">' . \Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32) . '</a>';
     }
     if (api_is_anonymous()) {
         $visibility = \SystemAnnouncementManager::VISIBLE_GUEST;
     } else {
         $visibility = api_is_allowed_to_create_course() ? \SystemAnnouncementManager::VISIBLE_TEACHER : \SystemAnnouncementManager::VISIBLE_STUDENT;
     }
     $content = \SystemAnnouncementManager::display_announcements_slider($visibility, $id);
     $app['template']->assign('content', $content);
     $app['template']->assign('actions', $actions);
     $response = $app['template']->renderLayout('layout_1_col.tpl');
     return new Response($response, 200, array());
 }
Exemplo n.º 22
0
 /**
  * Limit session resubscription when a Chamilo user is resubscribed to a session
  * @param HookCreateUserEventInterface $hook The hook
  */
 public function hookResubscribe(HookResubscribeEventInterface $hook)
 {
     $data = $hook->getEventData();
     if ($data['type'] === HOOK_EVENT_TYPE_PRE) {
         $resubscriptionLimit = Resubscription::create()->get('resubscription_limit');
         // Initialize variables as a calendar year by default
         $limitDateFormat = 'Y-01-01';
         $limitDate = gmdate($limitDateFormat);
         $resubscriptionOffset = "1 year";
         // No need to use a 'switch' with only two options so an 'if' is enough.
         // However this could change if the number of options increases
         if ($resubscriptionLimit === 'natural_year') {
             $limitDateFormat = 'Y-m-d';
             $limitDate = gmdate($limitDateFormat);
             $limitDate = gmdate($limitDateFormat, strtotime("{$limitDate} -{$resubscriptionOffset}"));
         }
         $join = " INNER JOIN " . Database::get_main_table(TABLE_MAIN_SESSION) . "ON id = session_id";
         // User sessions and courses
         $userSessions = Database::select('session_id, date_end', Database::get_main_table(TABLE_MAIN_SESSION_USER) . $join, array('where' => array('user_id = ? AND date_end >= ?' => array(api_get_user_id(), $limitDate)), 'order' => 'date_end DESC'));
         $userSessionCourses = array();
         foreach ($userSessions as $userSession) {
             $userSessionCourseResult = Database::select('c_id', Database::get_main_table(TABLE_MAIN_SESSION_COURSE), array('where' => array('session_id = ?' => array($userSession['session_id']))));
             foreach ($userSessionCourseResult as $userSessionCourse) {
                 if (!isset($userSessionCourses[$userSessionCourse['c_id']])) {
                     $userSessionCourses[$userSessionCourse['c_id']] = $userSession['date_end'];
                 }
             }
         }
         // Current session and courses
         $currentSessionCourseResult = Database::select('c_id', Database::get_main_table(TABLE_MAIN_SESSION_COURSE), array('where' => array('session_id = ?' => array($data['session_id']))));
         // Check if current course code matches with one of the users
         foreach ($currentSessionCourseResult as $currentSessionCourse) {
             if (isset($userSessionCourses[$currentSessionCourse['c_id']])) {
                 $endDate = $userSessionCourses[$currentSessionCourse['c_id']];
                 $resubscriptionDate = gmdate($limitDateFormat, strtotime($endDate . " +{$resubscriptionOffset}"));
                 $icon = Display::return_icon('students.gif', get_lang('Student'));
                 $canResubscribeFrom = sprintf(get_plugin_lang('CanResubscribeFromX', 'resubscription'), $resubscriptionDate);
                 throw new Exception(Display::label($icon . ' ' . $canResubscribeFrom, "info"));
             }
         }
     }
 }
Exemplo n.º 23
0
function lp_upload_quiz_main()
{
    // variable initialisation
    $lp_id = isset($_GET['lp_id']) ? Security::remove_XSS($_GET['lp_id']) : null;
    $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
    $form->addElement('header', get_lang('ImportExcelQuiz'));
    $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
    $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>';
    $form->addElement('label', '', $link);
    $form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score'));
    $form->addElement('html', '<div id="options" style="display:none">');
    $form->addElement('text', 'correct_score', get_lang('CorrectScore'));
    $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore'));
    $form->addElement('html', '</div>');
    $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
    $form->add_progress_bar();
    $form->addButtonUpload(get_lang('Send'), 'submit_upload_quiz');
    // Display the upload field
    $form->display();
}
    /**
     * This method return content html containing information about sessions and its position for showing it inside dashboard interface
     * it's important to use the name 'get_block' for beeing used from dashboard controller
     * @return array   column and content html
     */
    public function get_block()
    {
        global $charset;
        $column = 1;
        $data = array();
        $evaluations_base_courses_graph = $this->get_evaluations_base_courses_graph();
        $evaluations_courses_in_sessions_graph = $this->get_evaluations_courses_in_sessions_graph();
        $html = '<li class="widget color-orange" id="intro">
                    <div class="widget-head">
                        <h3>' . get_lang('EvaluationsGraph') . '</h3>
                        <div class="widget-actions"><a onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">' . Display::return_icon('close.gif', get_lang('Close')) . '</a></div>
                    </div>
                    <div class="widget-content" align="center">';
        if (empty($evaluations_base_courses_graph) && empty($evaluations_courses_in_sessions_graph)) {
            $html .= '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
        } else {
            // display evaluations base courses graph
            if (!empty($evaluations_base_courses_graph)) {
                foreach ($evaluations_base_courses_graph as $course_code => $img_html) {
                    $html .= '<div><strong>' . $course_code . '</strong></div>';
                    $html .= $img_html;
                }
            }
            // display evaluations base courses graph
            if (!empty($evaluations_courses_in_sessions_graph)) {
                foreach ($evaluations_courses_in_sessions_graph as $session_id => $courses) {
                    $session_name = api_get_session_name($session_id);
                    $html .= '<div><strong>' . $session_name . ':' . get_lang('Evaluations') . '</strong></div>';
                    foreach ($courses as $course_code => $img_html) {
                        $html .= '<div><strong>' . $course_code . '</strong></div>';
                        $html .= $img_html;
                    }
                }
            }
        }
        $html .= '</div>
			     </li>';
        $data['column'] = $column;
        $data['content_html'] = $html;
        return $data;
    }
Exemplo n.º 25
0
function display_form()
{
    $html = '';
    $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
    // Actions
    // Link back to the documents overview
    $actionsLeft = '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
    $html .= Display::toolbarAction('toolbar-copysession', array(0 => $actionsLeft));
    $html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'), 'warning');
    $html .= '<form class="form-horizontal" name="formulaire" method="post" action="' . api_get_self() . '" >';
    $html .= '<div class="form-group">';
    // origin
    $html .= '<label class="col-sm-2 control-label">' . get_lang('OriginCoursesFromSession') . ': </label>';
    $html .= '<div class="col-sm-5">' . make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')) . '</div>';
    $html .= '<div class="col-sm-5" id="ajax_list_courses_origin">';
    $html .= '<select id="origin" class="form-control" name="SessionCoursesListOrigin[]" ></select>';
    $html .= '</div></div>';
    //destination
    $html .= '<div class="form-group">';
    $html .= '<label class="col-sm-2 control-label">' . get_lang('DestinationCoursesFromSession') . ': </label>';
    $html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">';
    $html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
    $html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option></select ></div>';
    $html .= '<div class="col-sm-5" id="ajax_list_courses_destination">';
    $html .= '<select id="destination" class="form-control" name="SessionCoursesListDestination[]" ></select>';
    $html .= '</div></div>';
    $options = '<div class="radio"><label><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
    $options .= get_lang('FullCopy') . '</label></div>';
    $options .= '<div class="radio"><label><input type="radio" id="copy_option_2" name="copy_option" value="select_items" disabled="disabled"/>';
    $options .= ' ' . get_lang('LetMeSelectItems') . '</label></div>';
    $options .= '<div class="checkbox"><label><input type="checkbox" id="copy_base_content_id" name="copy_only_session_items" />' . get_lang('CopyOnlySessionItems') . '</label></div>';
    $html .= Display::panel($options, get_lang('TypeOfCopy'));
    $html .= '<div class="form-group"><div class="col-sm-12">';
    $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;"><em class="fa fa-files-o"></em> ' . get_lang('CopyCourse') . '</button>';
    // Add Security token
    $html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">';
    $html .= '</div></div>';
    $html .= '</form>';
    echo $html;
}
Exemplo n.º 26
0
function display_form()
{
    $html = '';
    $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
    // Actions
    $html .= '<div class="actions">';
    // Link back to the documents overview
    $html .= '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
    $html .= '</div>';
    $html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'));
    $html .= '<form name="formulaire" method="post" action="' . api_get_self() . '" >';
    $html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
    // origin
    $html .= '<tr><td width="15%"><b>' . get_lang('OriginCoursesFromSession') . ':</b></td>';
    $html .= '<td width="10%" align="left">' . make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')) . '</td>';
    $html .= '<td width="50%"><div id="ajax_list_courses_origin">';
    $html .= '<select id="origin" name="SessionCoursesListOrigin[]"  style="width:380px;"></select></div></td></tr>';
    //destination
    $html .= '<tr><td width="15%"><b>' . get_lang('DestinationCoursesFromSession') . ':</b></td>';
    $html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">';
    $html .= '<select name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
    $html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option></select ></div></td>';
    $html .= '<td width="50%">';
    $html .= '<div id="ajax_list_courses_destination">';
    $html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>';
    $html .= '</tr></table>';
    $html .= '<h4>' . get_lang('TypeOfCopy') . '</h4>';
    $html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
    $html .= get_lang('FullCopy') . '</label><br/>';
    $html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items" disabled="disabled"/>';
    $html .= ' ' . get_lang('LetMeSelectItems') . '</label><br/>';
    $html .= '<label class="checkbox"><input type="checkbox" id="copy_base_content_id" name="copy_only_session_items" />' . get_lang('CopyOnlySessionItems') . '</label><br /><br/>';
    $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;"><i class="fa fa-files-o"></i> ' . get_lang('CopyCourse') . '</button>';
    // Add Security token
    $html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">';
    $html .= '</form>';
    echo $html;
}
 /**
  * This method return content html containing information about teachers and its position for showing it inside dashboard interface
  * it's important to use the name 'get_block' for beeing used from dashboard controller
  * @return array   column and content html
  */
 public function get_block()
 {
     global $charset;
     $column = 1;
     $data = array();
     /*if (api_is_platform_admin()) {
     			$teacher_content_html = $this->get_teachers_content_html_for_platform_admin();
     		} else if (api_is_drh()) {*/
     $teacher_content_html = $this->get_teachers_content_html_for_drh();
     //}
     $html = '<li class="widget color-blue" id="intro">
                 <div class="widget-head">
                     <h3>' . get_lang('TeachersInformationsList') . '</h3>
                     <div class="widget-actions"><a onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;" href="index.php?action=disable_block&path=' . $this->path . '">' . Display::return_icon('close.gif', get_lang('Close')) . '</a></div>
                 </div>
                 <div class="widget-content">
                     ' . $teacher_content_html . '
                 </div>
             </li>';
     $data['column'] = $column;
     $data['content_html'] = $html;
     return $data;
 }
Exemplo n.º 28
0
 function addAction(Application $app)
 {
     $timeline = new Timeline();
     $url = $app['url_generator']->generate('add');
     $form = $timeline->return_item_form($url, 'edit');
     // The validation or display
     if ($form->validate()) {
         $values = $form->exportValues();
         $values['type'] = 0;
         $values['status'] = 0;
         $my_timeline = new CTimeline();
         $my_timeline->setCId(api_get_course_int_id());
         $my_timeline->setHeadline($values['headline']);
         $my_timeline->setType($values['type']);
         $my_timeline->setStartDate($values['start_date']);
         $my_timeline->setEndDate($values['end_date']);
         $my_timeline->setText($values['text']);
         $my_timeline->setMedia($values['media']);
         $my_timeline->setMediaCredit($values['media_credit']);
         $my_timeline->setMediaCaption($values['media_caption']);
         $my_timeline->setTitleSlide($values['title_slide']);
         $my_timeline->setParentId($values['parent_id']);
         $my_timeline->setStatus($values['status']);
         $app['orm.em']->persist($my_timeline);
         $app['orm.em']->flush();
         $message = Display::return_message(sprintf(get_lang('ItemUpdated'), $values['name']), 'confirmation');
         //$app['session']->setFlash('error', $message);
         return $app->redirect($app['url_generator']->generate('view', array('id' => $my_timeline->getId())), 201);
     } else {
         $actions = '<a href="' . $app['url_generator']->generate('index') . '">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>';
         $content = $form->return_form();
     }
     $app['template']->assign('content', $content);
     $response = $app['template']->render_layout('layout_1_col.tpl');
     return new Response($response, 200, array());
 }
Exemplo n.º 29
0
 $max_numbers_of_group = 4;
 if (is_array($results) && count($results) > 0) {
     $i = 1;
     foreach ($results as $result) {
         if ($i > $max_numbers_of_group) {
             break;
         }
         $id = $result['id'];
         $url_open = '<a href="group_view.php?id=' . $id . '">';
         $url_close = '</a>';
         $icon = '';
         $name = cut($result['name'], CUT_GROUP_NAME, true);
         if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {
             $icon = Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style' => 'vertical-align:middle;width:16px;height:16px;'));
         } elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {
             $icon = Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style' => 'vertical-align:middle;width:16px;height:16px;'));
         }
         $count_users_group = count($userGroup->get_all_users_by_group($id));
         if ($count_users_group == 1) {
             $count_users_group = $count_users_group . ' ' . get_lang('Member');
         } else {
             $count_users_group = $count_users_group . ' ' . get_lang('Members');
         }
         $item_name = $url_open . $name . $icon . $url_close;
         $item_actions = '';
         $grid_my_groups[] = array($item_name, $url_open . $result['picture'] . $url_close, $item_actions);
         $i++;
     }
 }
 // Block My Groups
 if (count($grid_my_groups) > 0) {
Exemplo n.º 30
0
            $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php">' . Display::return_icon('message_new.png', get_lang('ComposeMessage')) . '</a>';
            $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php">' . Display::return_icon('inbox.png', get_lang('Inbox')) . '</a>';
            $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/outbox.php">' . Display::return_icon('outbox.png', get_lang('Outbox')) . '</a>';
        }
        $social_right_content .= '</div>';
    }
}
// LEFT COLUMN
$social_left_content = null;
if (api_get_setting('social.allow_social_tool') == 'true') {
    //Block Social Menu
    $social_menu_block = SocialManager::show_social_menu('messages');
    $social_right_content .= '<div class="row">';
    $social_right_content .= '<div class="col-md-12">';
    $social_right_content .= '<div class="actions">';
    $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/inbox.php?f=social">' . Display::return_icon('back.png', get_lang('Back'), array(), 32) . '</a>';
    $social_right_content .= '</div>';
    $social_right_content .= '</div>';
    $social_right_content .= '<div class="col-md-12">';
}
// MAIN CONTENT
if (!isset($_POST['compose'])) {
    if (isset($_GET['re_id'])) {
        $social_right_content .= show_compose_reply_to_message($_GET['re_id'], api_get_user_id());
    } elseif (isset($_GET['send_to_user'])) {
        $social_right_content .= show_compose_to_user($_GET['send_to_user']);
    } else {
        $social_right_content .= show_compose_to_any(api_get_user_id());
    }
} else {
    $restrict = false;