Example #1
0
 public function export()
 {
     $postsList = $this->loadTopic($this->getTopicId());
     $topicInfo = get_topic_settings($this->getTopicId());
     $this->createPDF($topicInfo['topic_title']);
     $this->pdf->AddPage();
     $htmlContent = '<p>' . "\n" . '<table cellspacing="0" cellpadding="2" border="1">' . "\n" . '<tbody>' . "\n" . '<tr>' . "\n" . '<th colspan="2" style="font-weight: bold; background-color: #EDF1E3; color: #669933; border-bottom: 1px solid #96BB7A;">' . claro_utf8_encode($topicInfo['topic_title']) . '</th>' . '</tr>' . "\n";
     foreach ($postsList as $post) {
         $htmlContent .= '<tr>' . "\n" . '<td style="width: 150px; background-color: #EEEEEE;">' . "\n" . '<div style="font-weight: bold;">' . claro_utf8_encode($post['firstname'] . ' ' . $post['lastname'], get_conf('charset')) . '</div>' . "\n" . '<small>' . claro_html_localised_date(get_locale('dateTimeFormatLong'), datetime_to_timestamp($post['post_time'])) . '</small>' . "\n" . '</td>' . "\n" . '<td style="width: 354px;">' . claro_utf8_encode(claro_parse_user_text(strip_tags($post['post_text'])), get_conf('charset')) . '</td>' . "\n" . '</tr>' . "\n";
     }
     $htmlContent .= '</tbody>' . "\n" . '</table>' . "\n" . '</p>';
     //exit( claro_utf8_decode($htmlContent) );
     $this->pdf->writeHTML($htmlContent, true, 0, true, 0);
     switch ($this->output) {
         case 'screen':
             $this->pdf->Output(claro_utf8_encode($topicInfo['topic_id'] . '_' . $topicInfo['topic_title'] . '.pdf'), 'D');
             break;
         default:
             $path = get_conf('rootSys') . get_conf('tmpPathSys') . '/forum_export/';
             claro_mkdir($path);
             $this->pdf->Output($path . claro_utf8_encode(replace_dangerous_char($topicInfo['topic_id'] . '_' . $topicInfo['topic_title']) . '.pdf'), 'F');
             break;
     }
     return true;
 }
Example #2
0
 /**
  * notify by email the user of the reception of a message
  *
  * @param array of int: $userDataList user identificatin list
  * @param MessageToSend $message message envoy�
  * @param int $messageId identification of the message
  * 
  */
 public function notify($userDataList, $message, $messageId)
 {
     if (!get_conf('mailNotification', TRUE)) {
         return;
     }
     // sender name and email
     if ($message->getSender() == 0) {
         $userData = array('mail' => get_conf('no_reply_mail') ? get_conf('no_reply_mail') : get_conf('administrator_email'), 'firstName' => get_lang('Message from %platformName', array('%platformName' => get_conf('siteName'))), 'lastName' => '');
     } else {
         $userData = claro_get_current_user_data();
     }
     //************************************ IS MANAGER
     $stringManager = false;
     $courseManagers = claro_get_course_manager_id($message->getCourseCode());
     $nbrOfManagers = count($courseManagers);
     for ($countManager = 0; $countManager < $nbrOfManagers; $countManager++) {
         if ($message->getSender() == $courseManagers[$countManager]) {
             $courseData = claro_get_course_data($message->getCourseCode());
             $stringManager = get_block('Course manager of %course%(%courseCode%)', array('%course%' => $courseData['name'], '%courseCode%' => $courseData['officialCode']));
         }
     }
     //---------------------- email subject
     $emailSubject = '[' . get_conf('siteName');
     if (!is_null($message->getCourseCode())) {
         $courseData = claro_get_course_data($message->getCourseCode());
         if ($courseData) {
             $emailSubject .= ' - ' . $courseData['officialCode'];
         }
     }
     $emailSubject .= '] ' . $message->getSubject();
     //------------------------------subject
     /* $altBody = get_lang('If you can\'t read this message go to: ') . rtrim( get_path('rootWeb'), '/' ) . '/claroline/messaging/readmessage.php?messageId=' . $messageId . '&type=received' . "\n\n"
        . '-- '
        . claro_get_current_user_data('lastName') . " " . claro_get_current_user_data('firstName') . "\n"
        . $stringManager
        . "\n\n" . get_conf('siteName') ." <" . get_conf('rootWeb') . '>' . "\n"
        . '   ' . get_lang('Administrator') . ' : ' . get_conf('administrator_name') . ' <' . get_conf('administrator_email') . '>' . "\n"
        ; */
     //-------------------------BODY
     $msgContent = claro_parse_user_text($message->getMessage());
     $urlAppend = get_path('url');
     if (!empty($urlAppend)) {
         $msgContent = preg_replace('!href="' . get_path('url') . '!', 'href="' . rtrim(get_path('rootWeb'), '/') . '/', $msgContent);
         $msgContent = preg_replace('!\\>' . get_path('url') . '!', '>' . get_path('rootWeb'), $msgContent);
     } else {
         $msgContent = preg_replace('!href="/!', 'href="' . rtrim(get_path('rootWeb'), '/') . '/', $msgContent);
     }
     $emailBody = "<html><head></head><body>" . $msgContent . '<br /><br />' . '-- <br />' . get_lang('%firstName %lastName', array('%firstName' => $userData['firstName'], '%lastName' => $userData['lastName'])) . "<br />" . $stringManager . '<br /><br /><a href="' . get_conf('rootWeb') . '">' . get_conf('siteName') . '</a><br />' . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . get_lang('Administrator') . ': <a href="mailto:' . get_conf('administrator_email') . '">' . get_conf('administrator_name') . '</a><br />' . '</body></html>';
     //******************************** END BODY
     //******************************************
     if (empty($userData['mail']) || !is_well_formed_email_address($userData['mail'])) {
         // do not send email for a user with no mail address
         pushClaroMessage('Mail Notification Failed : User has no email or an invalid one : ' . var_export($userData, true) . '!');
         return claro_failure::set_failure(get_lang("Mail Notification Failed : You don't have any email address defined in your user profile or the defined email address is not valid."));
     }
     self::emailNotification($userDataList, $emailBody, $emailSubject, $userData['mail'], get_lang('%firstName %lastName', array('%firstName' => $userData['firstName'], '%lastName' => $userData['lastName'])));
 }
Example #3
0
 public function renderContent()
 {
     // Init linker
     FromKernel::uses('core/linker.lib');
     ResourceLinker::init();
     $output = '';
     $output .= '<dl id="portletAbout">' . "\n";
     $toolIntroIterator = new ToolIntroductionIterator($this->courseCode);
     if (count($toolIntroIterator) > 0) {
         $introList = '';
         foreach ($toolIntroIterator as $introItem) {
             if ($introItem->getVisibility() == 'SHOW') {
                 // Display attached resources (if any)
                 $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => $introItem->getId()));
                 $currentLocator->setModuleLabel('CLINTRO');
                 $currentLocator->setResourceId($introItem->getId());
                 $resources = ResourceLinker::renderLinkList($currentLocator);
                 // Prepare the render
                 $introList .= '<dt>' . "\n" . '</dt>' . "\n" . '<dd' . (!$toolIntroIterator->hasNext() ? ' class="last"' : '') . '>' . "\n" . claro_parse_user_text($introItem->getContent()) . "\n" . $resources . (claro_is_allowed_to_edit() ? '<div class="manageTools"><a
                                 href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLTI') . '/index.php?cmd=rqEd&amp;id=' . $introItem->getId())) . '"
                                 title="' . get_lang('Edit this item') . '">
                                 <img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '" />
                             </a>
                             
                             <a
                                 href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLTI') . '/index.php?cmd=exDel&amp;id=' . $introItem->getId())) . '"
                                 title="' . get_lang('Delete this item') . '">
                                 <img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />
                             </a></div>' : '') . '</dd>' . "\n";
             }
         }
     }
     if (count($toolIntroIterator) == 0 || empty($introList)) {
         $output .= '<dt></dt>' . '<dd>' . "\n" . ' ' . get_lang('No headline') . '. ' . (claro_is_allowed_to_edit() ? '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLTI') . '/index.php?cmd=rqAdd')) . '">' . get_lang('Would you like to add one ?') . '</a>' . "\n" : '') . '</dd>' . "\n";
     } else {
         $output .= $introList;
     }
     $output .= '</dl>';
     return $output;
 }
Example #4
0
 /**
  * display the input hidden field depending on what was submitted in exercise submit form
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @return string html code for display of feedback for this answer
  */
 public function getAnswerFeedbackHtml()
 {
     $imgOnHtml = '<img src="' . get_icon_url('radio_on') . '" alt="(X)" />';
     $imgOffHtml = '<img src="' . get_icon_url('radio_off') . '" alt="( )" />';
     $html = '<table width="100%">' . "\n\n" . '<tr style="font-style:italic;font-size:small;">' . "\n" . '<td align="center" valign="top" width="5%">' . get_lang('Your choice') . '</td>' . "\n" . '<td align="center" valign="top" width="5%">' . get_lang('Expected choice') . '</td>' . "\n" . '<td valign="top" width="45%">' . get_lang('Answer') . '</td>' . "\n" . '<td valign="top" width="45%">' . get_lang('Comment') . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td align="center" width="5%">' . ($this->response == 'TRUE' ? $imgOnHtml : $imgOffHtml) . '</td>' . "\n" . '<td align="center" width="5%">' . ($this->correctAnswer == 'TRUE' ? $imgOnHtml : $imgOffHtml) . '</td>' . "\n" . '<td width="45%">' . get_lang('True') . '</td>' . "\n" . '<td width="45%">' . claro_parse_user_text($this->trueFeedback) . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td align="center" width="5%">' . ($this->response == 'FALSE' ? $imgOnHtml : $imgOffHtml) . '</td>' . "\n" . '<td align="center" width="5%">' . ($this->correctAnswer == 'FALSE' ? $imgOnHtml : $imgOffHtml) . '</td>' . "\n" . '<td width="45%">' . get_lang('False') . '</td>' . "\n" . '<td width="45%">' . claro_parse_user_text($this->falseFeedback) . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n" . '<p><small>' . get_lang('True/False') . '</small></p>' . "\n";
     return $html;
 }
Example #5
0
     if (!current_user_is_allowed_to_send_message_to_user($userId)) {
         claro_die("Not Allowed");
     }
     $typeRecipient = 'user';
     $userRecipient = $userId;
     $groupRecipient = '';
     $courseRecipient = '';
     if (isset($_REQUEST['messageId'])) {
         if (can_answer_message((int) $_REQUEST['messageId'])) {
             $responseTo = (int) $_REQUEST['messageId'];
             $messageParent = ReceivedMessage::fromId((int) $_REQUEST['messageId'], claro_get_current_user_id());
             if (!isset($_REQUEST['subject'])) {
                 $subject = get_lang('RE:') . ' ' . strip_tags($messageParent->getSubject());
             }
             if (!isset($_REQUEST['message'])) {
                 $message = "<br /><br />----------------------------------------------------<br />" . get_lang('%firstName %lastName', array('%firstName' => claro_htmlspecialchars($messageParent->getSenderFirstName()), '%lastName' => claro_htmlspecialchars($messageParent->getSenderLastName()))) . ' ' . get_lang('wrote') . ':<br />' . claro_parse_user_text($messageParent->getMessage());
             }
         } else {
             claro_die(get_lang('Not allowed'));
         }
     } else {
         $responseTo = '';
     }
     $addForm = TRUE;
 }
 if ($_REQUEST['cmd'] == 'rqMessageToCourse') {
     if (!claro_is_in_a_course()) {
         claro_die(get_lang('You are not in a course'));
     }
     if (!current_user_is_allowed_to_send_message_to_current_course()) {
         claro_die(get_lang('Not allowed'));
Example #6
0
} else {
    foreach ($searchResultList as $thisPost) {
        // PREVENT USER TO CONSULT POST FROM A GROUP THEY ARE NOT ALLOWED
        if (!is_null($thisPost['group_id']) && $is_groupPrivate && !(in_array($thisPost['group_id'], $userGroupList) || in_array($thisPost['group_id'], $tutorGroupList) || claro_is_course_manager())) {
            continue;
        } else {
            // notify if is new message
            $post_time = datetime_to_timestamp($thisPost['post_time']);
            if ($post_time < $last_visit) {
                $class = ' class="item"';
            } else {
                $class = ' class="item hot"';
            }
            // get user picture
            $userData = user_get_properties($thisPost['poster_id']);
            $picturePath = user_get_picture_path($userData);
            if ($picturePath && file_exists($picturePath)) {
                $pictureUrl = user_get_picture_url($userData);
            } else {
                $pictureUrl = null;
            }
            $out .= '<div id="post' . $thisPost['post_id'] . '" class="threadPost">' . '<div class="threadPostInfo">' . (!is_null($pictureUrl) ? '<div class="threadPosterPicture"><img src="' . $pictureUrl . '" alt=" " /></div>' : '') . "\n" . '<b>' . $thisPost['firstname'] . ' ' . $thisPost['lastname'] . '</b> ' . '<br />' . '<small>' . claro_html_localised_date(get_locale('dateTimeFormatLong'), $post_time) . '</small>' . "\n";
            $out .= '  </div>' . "\n" . '<div class="threadPostContent">' . "\n" . '<img src="' . get_icon_url('topic') . '" alt="" />' . '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $thisPost['topic_id'])) . '">' . claro_htmlspecialchars($thisPost['topic_title']) . '</a>' . "\n" . '<span class="threadPostIcon ' . $class . '"><img src="' . get_icon_url('post') . '" alt="" /></span><br />' . "\n" . claro_parse_user_text($thisPost['post_text']) . "\n";
            $out .= '</div>' . "\n" . '<div class="spacer"></div>' . "\n\n" . '</div>' . "\n";
        }
        // end else if ( ! is_null($thisPost['group_id'])
    }
}
// end for each
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
Example #7
0
 /**
  * display the input hidden field depending on what was submitted in exercise submit form
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @return string html code for display of feedback for this answer
  */
 public function getAnswerFeedbackHtml()
 {
     $html = '<table width="100%">' . "\n\n" . '<tr height:style="font-weight:italic;font-size:small;">' . "\n" . '<td valign="top">' . get_lang('Answer') . '</td>' . "\n" . '</tr>' . "\n\n";
     // get all enclosed answers
     $blankList = array();
     foreach ($this->answerList as $answer) {
         // filter slashes as they are modifiers in preg expressions
         $blankList[] = '/\\[' . preg_quote($this->answerDecode($this->addslashesEncodedBrackets($answer)), '/') . '\\]/';
     }
     $answerCount = count($blankList);
     // build replacement
     $replacementList = array();
     for ($i = 0; $i < $answerCount; $i++) {
         if (empty($this->response[$i])) {
             // no response for this blank
             $userAnswer = '&nbsp;&nbsp;&nbsp;&nbsp;';
         } elseif ($this->isResponseCorrect($this->response[$i], $this->answerDecode($this->answerList[$i]))) {
             // user answer is ok
             $userAnswer = claro_htmlspecialchars($this->answerDecode($this->response[$i]));
         } else {
             // incorrect response
             $userAnswer = '<span class="error"><s>' . claro_htmlspecialchars($this->answerDecode($this->response[$i])) . '</s></span>';
         }
         //
         $correctAnswer = claro_htmlspecialchars($this->answerDecode($this->answerList[$i]));
         $replacementList[] = str_replace('$', '\\$', '[' . $userAnswer . ' / <span class="correct"><b>' . $correctAnswer . '</b></span>]' . "\n");
     }
     // apply replacement on answer
     // use preg_replace instead of str_replace because if there is several blanks
     // with same correct value using str_replace will replace each occurence by the 1st one he found
     $displayedAnswer = preg_replace($blankList, $replacementList, claro_parse_user_text($this->answerDecode($this->answerText)), 1);
     $html = '<table width="100%">' . "\n\n" . '<tr height:style="font-weight:italic;font-size:small;">' . "\n" . '<td valign="top">' . get_lang('Answer') . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td>' . "\n" . $displayedAnswer . "\n" . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n" . '<p><small>' . get_lang('Fill in blanks') . '</small></p>' . "\n";
     return $html;
 }
Example #8
0
 /**
  * Export the text with missing words.
  *
  * As a side effect, it stores two lists in the class :
  * the missing words and their respective weightings.
  *
  * @author Amand Tihon <*****@*****.**>
  */
 function export()
 {
     // get all enclosed answers
     foreach ($this->answerList as $answer) {
         $blankList[] = '[' . $answer . ']';
     }
     $answerCount = count($blankList);
     // build replacement
     $replacementList = array();
     if ($this->type == LISTBOX_FILL) {
         // build the list shown in list box
         // prepare option list using good and wrong answers
         $allAnswerList = array_merge($this->answerList, $this->wrongAnswerList);
         // alphabetical sort of the list
         natcasesort($allAnswerList);
         $optionList[''] = '';
         foreach ($allAnswerList as $answer) {
             $optionList[claro_htmlspecialchars($answer)] = claro_htmlspecialchars($answer);
         }
         for ($i = 0; $i < $answerCount; $i++) {
             $identifier = 'fill_' . $this->questionId . '_' . $i;
             $attr['id'] = 'scorm_' . getIdCounter();
             $replacementList[] = claro_html_form_select($identifier, $optionList, null, $attr);
         }
     } else {
         for ($i = 0; $i < $answerCount; $i++) {
             $identifier = 'fill_' . $this->questionId . '_' . $i;
             $scormIdentifier = 'scorm_' . getIdCounter();
             $replacementList[] = "\n" . ' <input type="text" name="' . $identifier . '" id="' . $scormIdentifier . '" size="10" value="" /> ' . "\n";
         }
     }
     // apply replacement on answer
     $displayedAnswer = str_replace($blankList, $replacementList, claro_parse_user_text(htmlspecialchars_decode($this->answerText)));
     // some javascript must be added for that kind of questions
     $out = '<script type="text/javascript" language="javascript">' . "\n";
     // Add the data for fillAnswerList
     for ($i = 0; $i < $answerCount; $i++) {
         $out .= "    fillAnswerList['fill_" . $this->questionId . "_" . $i . "'] = new Array('" . $this->answerList[$i] . "', '" . $this->gradeList[$i] . "');\n";
     }
     $out .= '</script>' . "\n" . '<table width="100%">' . "\n\n" . '<tr>' . "\n" . '<td>' . "\n" . $displayedAnswer . "\n" . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n" . '<p><small>' . get_lang('Fill in blanks') . '</small></p>' . "\n";
     return $out;
 }
Example #9
0
        ?>
 id="item<?php 
        echo $description['id'];
        ?>
">
        <img src="<?php 
        echo get_icon_url('icon');
        ?>
" alt="" />
        <?php 
        echo claro_htmlspecialchars($description['title']);
        ?>
    </h1>
    <div class="content">
        <?php 
        echo claro_parse_user_text($description['content']);
        ?>
    </div>
    
    <?php 
        if (claro_is_allowed_to_edit()) {
            ?>
    <div class="manageTools">
        <a href="<?php 
            echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqEdit&amp;descId=' . (int) $description['id']));
            ?>
">
            <img src="<?php 
            echo get_icon_url('edit');
            ?>
" alt="<?php 
Example #10
0
 if ($dispWrkForm) {
     /**
      * ASSIGNMENT INFOS
      */
     $out .= '<p>' . "\n" . '<small>' . "\n" . '<b>' . get_lang('Title') . '</b> : ' . "\n" . $assignment->getTitle() . '<br />' . "\n" . get_lang('<b>From</b> %start_date <b>until</b> %end_date', array('%start_date' => claro_html_localised_date(get_locale('dateTimeFormatLong'), $assignment->getStartDate()), '%end_date' => claro_html_localised_date(get_locale('dateTimeFormatLong'), $assignment->getEndDate()))) . '<br />' . "\n" . '<b>' . get_lang('Submission type') . '</b> : ' . "\n";
     if ($assignment->getSubmissionType() == 'TEXT') {
         $out .= get_lang('Text only (text required, no file)');
     } elseif ($assignment->getSubmissionType() == 'TEXTFILE') {
         $out .= get_lang('Text with attached file (text required, file optional)');
     } else {
         $out .= get_lang('File (file required, description text optional)');
     }
     $out .= '<br />' . "\n" . '<b>' . get_lang('Submission visibility') . '</b> : ' . "\n" . ($assignment->getDefaultSubmissionVisibility() == 'VISIBLE' ? get_lang('Visible for all users') : get_lang('Only visible for teacher(s) and submitter(s)')) . '<br />' . "\n" . '<b>' . get_lang('Assignment type') . '</b> : ' . "\n" . ($assignment->getAssignmentType() == 'INDIVIDUAL' ? get_lang('Individual') : get_lang('Groups')) . '<br />' . "\n" . '<b>' . get_lang('Allow late upload') . '</b> : ' . "\n" . ($assignment->getAllowLateUpload() == 'YES' ? get_lang('Users can submit after end date') : get_lang('Users can not submit after end date')) . '</small>' . "\n" . '</p>' . "\n";
     // description of assignment
     if (trim($assignment->getDescription()) != '') {
         $out .= '<b><small>' . get_lang('Description') . '</small></b><br />' . "\n" . '<blockquote>' . "\n" . '<small>' . "\n" . claro_parse_user_text($assignment->getDescription()) . '</small>' . "\n" . '</blockquote>' . "\n" . '<br />' . "\n";
     }
     $out .= '<h4>' . $txtForFormTitle . '</h4>' . "\n" . '<p><a class="backLink" href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['SCRIPT_NAME'] . '?authId=' . $_REQUEST['authId'] . '&assigId=' . $assignmentId)) . '">' . get_lang('Back') . '</a></p>' . "\n" . '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?assigId=' . $assignmentId . '&authId=' . $_REQUEST['authId'] . '" enctype="multipart/form-data">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="cmd" value="' . $cmdToSend . '" />' . "\n" . claro_form_relay_context();
     if (isset($_REQUEST['wrkId'])) {
         $out .= '<input type="hidden" name="wrkId" value="' . $_REQUEST['wrkId'] . '" />' . "\n";
     } elseif (isset($_REQUEST['gradedWrkId'])) {
         $out .= '<input type="hidden" name="gradedWrkId" value="' . $_REQUEST['gradedWrkId'] . '" />' . "\n";
     }
     $out .= '<fieldset>' . "\n" . '<dl>' . "\n" . '<dt><label for="wrkTitle">' . get_lang('Title') . '&nbsp;<span class="required">*</span></label></dt>' . "\n" . '<dd><input type="text" name="wrkTitle" id="wrkTitle" size="50" maxlength="200" value="' . claro_htmlspecialchars($form['wrkTitle']) . '" /></dd>' . "\n" . '<dt><label for="wrkAuthors">' . get_lang('Author(s)') . '&nbsp;<span class="required">*</span></label></dt>' . "\n" . '<dd><input type="text" name="wrkAuthors" id="wrkAuthors" size="50" maxlength="200" value="' . claro_htmlspecialchars($form['wrkAuthors']) . '" /></dd>' . "\n";
     // display the list of groups of the user
     if ($assignment->getAssignmentType() == "GROUP" && !empty($userGroupList) || claro_is_course_manager() && claro_is_in_a_group()) {
         $out .= '<dt><label for="wrkGroup">' . get_lang('Group') . '</label></dt>' . "\n";
         if (claro_is_in_a_group()) {
             $out .= '<dd>' . "\n" . '<input type="hidden" name="wrkGroup" value="' . claro_get_current_group_id() . '" />' . claro_get_current_group_data('name') . '</dd>' . "\n";
         } elseif (isset($_REQUEST['authId'])) {
             $out .= '<dd>' . "\n" . '<input type="hidden" name="wrkGroup" value="' . $_REQUEST['authId'] . '" />' . $userGroupList[$_REQUEST['authId']]['name'] . '</dd>' . "\n";
Example #11
0
        ?>
    </h1>
    
    <div class="content">
        <?php 
        if (!empty($announcement['title'])) {
            ?>
<h2><?php 
            echo claro_htmlspecialchars($announcement['title']);
            ?>
</h2><?php 
        }
        ?>
        <?php 
        if (!empty($announcement['content'])) {
            echo claro_parse_user_text($announcement['content']);
        }
        ?>
    </div>
    
    <?php 
        if (!empty($announcement['currentLocator'])) {
            ?>
    <?php 
            echo ResourceLinker::renderLinkList($announcement['currentLocator']);
            ?>
    
    <?php 
        }
        ?>
    
Example #12
0
/**
 * This function is used to display the list of document available in the course
 * It also displays the form used to add selected document in the learning path
 *
 * @param string $dialogBox Error or confirmation text
 * @return nothing
 * @author Piraux S�bastien <*****@*****.**>
 * @author Lederer Guillaume <*****@*****.**>
 */
function display_my_documents($dialogBox)
{
    global $is_allowedToEdit;
    global $curDirName;
    global $curDirPath;
    global $parentDir;
    global $fileList;
    /**
     * DISPLAY
     */
    $out = '';
    $out .= '<!-- display_my_documents output -->' . "\n";
    $dspCurDirName = claro_htmlspecialchars($curDirName);
    $cmdCurDirPath = rawurlencode($curDirPath);
    $cmdParentDir = rawurlencode($parentDir);
    $out .= '<br />' . '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
    /*--------------------------------------
      DIALOG BOX SECTION
      --------------------------------------*/
    $colspan = 4;
    if (!empty($dialogBox)) {
        $_dialogBox = new DialogBox();
        $_dialogBox->form($dialogBox);
        $out .= $_dialogBox->render();
    }
    /*--------------------------------------
      CURRENT DIRECTORY LINE
      --------------------------------------*/
    /* GO TO PARENT DIRECTORY */
    if ($curDirName) {
        $out .= '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exChDir&amp;file=' . $cmdParentDir . '">' . "\n" . '<img src="' . get_icon_url('parent') . '" hspace="5" alt="" /> ' . "\n" . '<small>' . get_lang('Up') . '</small>' . "\n" . '</a>' . "\n";
    }
    /* CURRENT DIRECTORY */
    $out .= '<table class="claroTable emphaseLine">' . '<thead>';
    // If the $curDirName is empty, we're in the root point
    // and there is'nt a dir name to display
    if ($curDirName) {
        $out .= '<!-- current dir name -->' . "\n" . '<tr>' . "\n" . '<th class="superHeader" colspan="' . $colspan . '" align="left">' . "\n" . '<img src="' . get_icon_url('opendir') . '" vspace=2 hspace=5 alt="" /> ' . "\n" . $dspCurDirName . "\n" . '</td>' . "\n" . '</tr>' . "\n";
    }
    $out .= '<tr align="center" valign="top">' . "\n" . '<th width="10%">' . get_lang('Add module(s)') . '</th>' . "\n" . '<th>' . get_lang('Name') . '</th>' . "\n" . '<th>' . get_lang('Size') . '</th>' . "\n" . '<th>' . get_lang('Date') . '</th>' . "\n" . '</tr>' . '</thead>' . '<tbody>' . "\n";
    /*--------------------------------------
      DISPLAY FILE LIST
      --------------------------------------*/
    if ($fileList) {
        $iterator = 0;
        while (list($fileKey, $fileName) = each($fileList['name'])) {
            $dspFileName = claro_htmlspecialchars($fileName);
            $cmdFileName = str_replace("%2F", "/", rawurlencode($curDirPath . "/" . $fileName));
            if ($fileList['visibility'][$fileKey] == "i") {
                if ($is_allowedToEdit) {
                    $style = ' class="invisible"';
                } else {
                    $style = "";
                    continue;
                    // skip the display of this file
                }
            } else {
                $style = "";
            }
            if ($fileList['type'][$fileKey] == A_FILE) {
                $image = choose_image($fileName);
                $size = format_file_size($fileList['size'][$fileKey]);
                $date = format_date($fileList['date'][$fileKey]);
                if ($GLOBALS['is_Apache'] && get_conf('secureDocumentDownload')) {
                    // slash argument method - only compatible with Apache
                    $doc_url = $cmdFileName;
                } else {
                    // question mark argument method, for IIS ...
                    $doc_url = '?url=' . $cmdFileName;
                }
                $urlFileName = get_path('clarolineRepositoryWeb') . 'backends/download.php' . $doc_url;
            } elseif ($fileList['type'][$fileKey] == A_DIRECTORY) {
                $image = 'folder';
                $size = '&nbsp;';
                $date = '&nbsp;';
                $urlFileName = $_SERVER['PHP_SELF'] . '?openDir=' . $cmdFileName;
            }
            $out .= '<tr ' . $style . '>' . "\n";
            if ($fileList['type'][$fileKey] == A_FILE) {
                $iterator++;
                $out .= '<td style="vertical-align:top; text-align: center;">' . '<input type="checkbox" name="insertDocument_' . $iterator . '" id="insertDocument_' . $iterator . '" value="' . $curDirPath . "/" . $fileName . '" />' . '</td>' . "\n";
            } else {
                $out .= '<td>&nbsp;</td>';
            }
            $out .= '<td>' . '<a href="' . $urlFileName . '" ' . $style . '>' . '<img src="' . get_icon_url($image) . '" hspace="5" alt="" /> ' . $dspFileName . '</a>';
            // Comments
            if ($fileList['comment'][$fileKey] != "") {
                $fileList['comment'][$fileKey] = claro_htmlspecialchars($fileList['comment'][$fileKey]);
                $fileList['comment'][$fileKey] = claro_parse_user_text($fileList['comment'][$fileKey]);
                $out .= '<div class="comment">' . $fileList['comment'][$fileKey] . '</div>' . "\n";
            }
            $out .= '</td>' . "\n" . '<td><small>' . $size . '</small></td>' . "\n" . '<td><small>' . $date . '</small></td>' . "\n";
            /* NB : Before tracking implementation the url above was simply
             * "<a href=\"",$urlFileName,"\"",$style,">"
             */
            $out .= '</tr>' . "\n";
        }
        // end each ($fileList)
        // form button
        $out .= '</tbody>' . '</table>' . "\n\n" . '<input type="hidden" name="openDir" value="' . $curDirPath . '" />' . "\n" . '<input type="hidden" name="maxDocForm" value ="' . $iterator . '" />' . "\n" . '<input type="submit" name="submitInsertedDocument" value="' . get_lang('Add selection') . '" />';
    } else {
        $out .= '<tr>' . "\n" . '<td colspan="2" align="center">' . get_lang('There is no document for the moment') . '</td>' . "\n" . '</tr>' . "\n" . '</tbody>' . '</table>' . "\n\n";
    }
    $out .= '</form>' . "\n" . '<br /><br />' . '<!-- end of display_my_documents output -->' . "\n";
    return $out;
}
Example #13
0
    $output .= claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '<br />' . "\n" . '</form>' . "\n\n";
}
if ($intro_dispDefault) {
    $sql = "SELECT `id`, `rank`, `content`, `visibility`\n            FROM `" . $TBL_INTRODUCTION . "`\n            WHERE `tool_id` <= 0\n            ORDER BY rank ASC";
    $textIntroList = claro_sql_query_fetch_all($sql);
    $introListCount = count($textIntroList);
    if ($introListCount == 0 && $intro_editAllowed) {
        $output .= '<div class="HelpText">' . "\n" . get_block('blockIntroCourse') . "\n" . '</div>' . "\n";
    } else {
        foreach ($textIntroList as $thisIntroKey => $thisTextIntro) {
            $introId = $thisTextIntro['id'];
            $introVisibility = $thisTextIntro['visibility'];
            if ($introVisibility == 'SHOW' || $intro_editAllowed) {
                $cssClass = $introVisibility == 'HIDE' ? ' invisible' : '';
                $cssClass = $intro_editAllowed ? ' editable' : '';
                $intro_content = claro_parse_user_text($thisTextIntro['content']);
                $section = '';
                if (trim(strip_tags($intro_content, '<img><embed><object>')) != '') {
                    $section .= $intro_content . "\n";
                } elseif ($intro_editAllowed) {
                    $section .= '<div style="text-align:center;background-color:silver;margin:3px;">' . get_lang('This zone is empty') . '</div>' . "\n";
                }
                $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => $thisTextIntro['id']));
                $section .= ResourceLinker::renderLinkList($currentLocator);
                if ($intro_dispCommand) {
                    $section .= '<div class="toolbar">' . "\n";
                    $section .= '<a class="claroCmd" href="' . htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?introCmd=rqEd&amp;introId=' . $introId)) . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '" />' . '</a>' . "\n" . '<a class="claroCmd" href="' . htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?introCmd=exDel&amp;introId=' . $introId)) . '" ' . 'onclick="javascript:if(!confirm(\'' . clean_str_for_javascript(get_lang('Confirm Operation') . ' : ' . get_lang('Delete')) . '\')) ' . 'return false;">' . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . '</a>' . "\n";
                    if ($thisIntroKey > 0) {
                        $section .= '<a class="claroCmd" href="' . htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?introCmd=exMvUp&amp;introId=' . $introId)) . '">' . '<img src="' . get_icon_url('move_up') . '" alt="' . get_lang('Move up') . '" />' . '</a> ';
                    }
                    if ($thisIntroKey + 1 < $introListCount) {
Example #14
0
             $results[$i][$detail['answer']]['nbr']++;
         }
         // for each blank we need to compute the number of answers
         if (!isset($fillInBlanksTotal[$i])) {
             $fillInBlanksTotal[$i] = 1;
         } else {
             $fillInBlanksTotal[$i]++;
         }
         // change blank number until we have meet all blank for the same answer
         if ($i == $nbrBlanks) {
             $i = 1;
         } else {
             $i++;
         }
     }
     $displayedStatement = $question->getDescription() . '<br /><br />' . "\n" . '<i>' . claro_parse_user_text($question->answer->answerDecode($answerText)) . '</i>' . "\n";
 } elseif ($question->getType() == 'MATCHING') {
     $displayedStatement = $question->getDescription();
     // get left and right proposals
     $leftList = $question->answer->leftList;
     $rightList = $question->answer->rightList;
     $nbrColumn = 0;
     // at least one column for headers
     $nbrRow = 0;
     // at least one row for headers
     foreach ($rightList as $rightElt) {
         $nbrColumn++;
         // right column , will be displayed in top headers
         $columnTitlePosition[$rightElt['code']] = $nbrColumn;
         // to know in which column is which id
         $results[0][$nbrColumn] = $rightElt['answer'];
 /**
  * display the input hidden field depending on what was submitted in exercise submit form
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @return string html code for display of feedback for this answer
  */
 public function getAnswerFeedbackHtml()
 {
     global $imgRepositoryWeb;
     if ($this->multipleAnswer) {
         $questionTypeLang = get_lang('Multiple choice (Multiple answers)');
         $imgOnHtml = '<img src="' . get_icon_url('checkbox_on') . '" alt="[X]" />';
         $imgOffHtml = '<img src="' . get_icon_url('checkbox_off') . '" alt="[ ]" />';
     } else {
         $questionTypeLang = get_lang('Multiple choice (Unique answer)');
         $imgOnHtml = '<img src="' . get_icon_url('radio_on') . '" alt="(X)" />';
         $imgOffHtml = '<img src="' . get_icon_url('radio_off') . '" alt="( )" />';
     }
     $html = '<table width="100%">' . "\n\n" . '<tr style="font-style:italic;font-size:small;">' . "\n" . '<td align="center" valign="top" width="5%">' . get_lang('Your choice') . '</td>' . "\n" . '<td align="center" valign="top" width="5%">' . get_lang('Expected choice') . '</td>' . "\n" . '<td valign="top" width="45%">' . get_lang('Answer') . '</td>' . "\n" . '<td valign="top" width="45%">' . get_lang('Comment') . '</td>' . "\n" . '</tr>' . "\n\n";
     foreach ($this->answerList as $answer) {
         $isSelected = array_key_exists($answer['id'], $this->response);
         $html .= '<tr>' . "\n" . '<td align="center" width="5%">' . ($isSelected ? $imgOnHtml : $imgOffHtml) . '</td>' . "\n" . '<td align="center" width="5%">' . ($answer['correct'] ? $imgOnHtml : $imgOffHtml) . '</td>' . "\n" . '<td width="45%">' . claro_parse_user_text($answer['answer']) . '</td>' . "\n" . '<td width="45%">' . (get_conf('showAllFeedbacks') || ($isSelected || $answer['correct']) ? claro_parse_user_text($answer['comment']) : '&nbsp;') . '</td>' . "\n" . '</tr>' . "\n\n";
     }
     $html .= '</table>' . "\n" . '<p><small>' . $questionTypeLang . '</small></p>' . "\n";
     return $html;
 }
Example #16
0
  </div>
  <div class="threadPostContent">
    <?php 
    $itemClass = claro_is_user_authenticated() && $this->claro_notifier->is_a_notified_ressource(claro_get_current_course_id(), $this->claro_notifier->get_notification_date(claro_get_current_user_id()), claro_get_current_user_id(), claro_get_current_group_id(), claro_get_current_tool_id(), $this->forum_id . "-" . $this->topic_id . "-" . $thisPost['post_id']) ? 'item hot' : 'item';
    ?>
    <span class="threadPostIcon <?php 
    echo $itemClass;
    ?>
">
        <img src="<?php 
    echo get_icon_url('post');
    ?>
" alt="" />
    </span><br />
    <?php 
    echo claro_parse_user_text($thisPost['post_text']);
    ?>
    <?php 
    if ($this->is_post_allowed) {
        ?>
        <p>
        <a class="claroCmd" href="<?php 
        echo claro_htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $thisPost['topic_id'] . '&amp;post=' . $thisPost['post_id'] . '&amp;cmd=rqPost&amp;mode=quote'));
        ?>
">
            <img src="<?php 
        echo get_icon_url('post');
        ?>
" alt="<?php 
        echo get_lang('Quote');
        ?>
Example #17
0
 /**
  * Get html to display one message with clickable links
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @param array $message('unixPostTime','message','lastname','firstname','isCourseCreator')
  * @return string html output for $message
  */
 private function renderSingleMsg($message)
 {
     $userName = $message['firstname'] . ' ' . $message['lastname'];
     if (strlen($userName) > get_conf('max_nick_length')) {
         $userName = $message['firstname'] . ' ' . $message['lastname'][0] . '.';
     }
     // transform url to clickable links
     $chatLine = claro_parse_user_text($message['message']);
     $html = '';
     $html .= '<span class="clchat_msgDate">' . claro_html_localised_date('%H:%M:%S', $message['unixPostTime']) . '&nbsp;|</span>' . ' <span class="clchat_userName">' . $userName . '</span>&nbsp;: ' . $chatLine . "\n";
     return $html;
 }
Example #18
0
                } elseif ($courseContext) {
                    /* VISIBILITY COMMAND */
                    if ($thisFile['visibility'] == "i") {
                        $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exChVis&amp;file=' . $cmdFileName . '&amp;vis=v')) . '">' . '<img src="' . get_icon_url('invisible') . '" alt="' . get_lang('Make visible') . '" />' . '</a>';
                    } else {
                        $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=exChVis&amp;file=' . $cmdFileName . '&amp;vis=i')) . '">' . '<img src="' . get_icon_url('visible') . '" alt="' . get_lang('Make invisible') . '" />' . '</a>';
                    }
                }
                $out .= '</td>' . "\n";
            }
            // end if($is_allowedToEdit)
            $out .= '</tr>' . "\n";
            /* COMMENTS */
            if ($thisFile['comment'] != '') {
                $thisFile['comment'] = claro_htmlspecialchars($thisFile['comment']);
                $thisFile['comment'] = claro_parse_user_text($thisFile['comment']);
                $out .= '<tr align="left">' . "\n" . '<td colspan="' . $colspan . '">' . '<div class="comment">' . $thisFile['comment'] . '</div>' . '</td>' . "\n" . '</tr>' . "\n";
            }
        }
        // end each ($fileList)
    } else {
        $out .= '<tr align="left">' . "\n" . '<td colspan="' . $colspan . '">' . '<div class="comment">' . get_lang('Nothing to display') . '</div>' . '</td>' . "\n" . '</tr>';
    }
    $out .= '</tbody>' . "\n" . '</table>' . "\n";
}
// END ELSE VIEW IMAGE
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
// call the garbage collector to remove temporary files
$tmpZipPath = get_conf('cldoc_customTmpPath', '');
if (empty($tmpZipPath)) {
Example #19
0
             $out .= '<tr>' . '<td>' . "\n";
             $out .= $question->getQuestionFeedbackHtml();
             $out .= '</td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . '<td align="right">' . "\n" . '<strong>' . get_lang('Score') . ' : ' . $questionResult[$i] . '/' . $questionGrade[$i] . '</strong>' . '</td>' . "\n" . '</tr>' . "\n\n";
         }
         $questionIterator++;
         $i++;
     }
     $out .= '</table>' . "\n\n";
 } else {
     $dialogBox->info(get_lang('No question to display') . '<br />' . '<a href="' . claro_htmlspecialchars(Url::Contextualize('./exercise.php')) . '">&lt;&lt; ' . get_lang('Back') . '</a>');
 }
 //  Display results
 if ($recordResults) {
     $out .= $dialogBoxResults->render();
     if (!is_null($exercise->getQuizEndMessage())) {
         $out .= '<blockquote>' . "\n" . claro_parse_user_text($exercise->getQuizEndMessage()) . "\n" . '</blockquote>' . "\n";
     }
 }
 if ($exercise->getShuffle() && $exercise->getUseSameShuffle() && isset($_SESSION['lastRandomQuestionList'])) {
     $out .= '<div style="font-weight: bold;">' . "\n" . '<a href="' . claro_htmlspecialchars(Url::Contextualize('exercise.php?exId=' . $exercise->getId() . '&cmd=exSaveQwz' . ($inLP ? '&calledFrom=CLLP&embedded=true' : ''))) . '">' . get_lang('Save this questions list') . '</a>' . '</div>';
 }
 // Display Finish/Continue
 $out .= '<div class="centerContent">' . "\n";
 if (!$inLP) {
     if ($recordResults) {
         $out .= '<input type="submit" value="' . get_lang('Finish') . '" />';
     }
 } elseif (!$exercise->getQuizEndMessage()) {
     $out .= get_lang('Exercise done, choose a module in the list to continue.');
 }
 $out .= '</div>' . "\n";
Example #20
0
/**
 * transform content in a html display
 * @param  - string $string string to htmlize
 * @return  - string htmlized
 */
function htmlize($phrase)
{
    // TODO use textile project here
    return claro_parse_user_text(claro_htmlspecialchars($phrase));
}
Example #21
0
        ?>
    </h1>
    
    <div class="content">
        <?php 
        if (!empty($event['title'])) {
            ?>
<h2><?php 
            echo claro_htmlspecialchars($event['title']);
            ?>
</h2><?php 
        }
        ?>
        <?php 
        if (!empty($event['content'])) {
            echo claro_parse_user_text($event['content']);
        }
        ?>
    </div>
    
    <?php 
        echo ResourceLinker::renderLinkList($event['currentLocator']);
        ?>
    
    <?php 
        if (claro_is_allowed_to_edit()) {
            ?>
    <div class="manageTools">
        <a href="<?php 
            echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqEdit&amp;id=' . $event['id']));
            ?>
Example #22
0
echo get_lang('Anonymous attempts') . '&nbsp;: ' . ($this->exercise->getAnonymousAttempts() == 'ALLOWED' ? get_lang('Allowed : do not record usernames in tracking, anonymous users can do the exercise.') : get_lang('Not allowed : record usernames in tracking, anonymous users cannot do the exercise.'));
?>
</li>
            <li><?php 
echo get_lang('Show answers') . '&nbsp;: ';
switch ($this->exercise->getShowAnswers()) {
    case 'ALWAYS':
        echo get_lang('Yes');
        break;
    case 'LASTTRY':
        echo get_lang('After last allowed attempt');
        break;
    case 'NEVER':
        echo get_lang('Never');
        break;
}
?>
            </li>
            <li><?php 
echo get_lang('Quiz end message') . '&nbsp;: ';
?>
                <blockquote><?php 
echo claro_parse_user_text($this->exercise->getQuizEndMessage());
?>
</blockquote>
            </li>
        </ul>
    </div>
</div>
<br/>
Example #23
0
 /**
  * get html required to display the question
  *
  * @author Sebastien Piraux <*****@*****.**>
  * @param string $value
  */
 public function getQuestionHtml($exerciseId = null)
 {
     $html = '<p>' . '<strong>' . $this->title . '</strong>' . "\n" . '</p>' . "\n" . '<blockquote>' . "\n" . claro_parse_user_text($this->description) . "\n" . '</blockquote>' . "\n\n";
     if (!empty($this->attachment)) {
         $html .= claro_html_media_player($this->questionDirWeb . $this->attachment, $this->getAttachmentUrl());
     }
     return $html;
 }
Example #24
0
<!-- $Id: item.tpl.php 14314 2012-11-07 09:09:19Z zefredz $ -->

<?php 
if ($this->intro->getVisibility() == 'SHOW' || claro_is_allowed_to_edit()) {
    ?>
<div class="item<?php 
    if ($this->intro->getVisibility() != 'SHOW') {
        ?>
 hidden<?php 
    }
    ?>
">
    <div class="content">
        <p><?php 
    echo claro_parse_user_text($this->intro->getContent());
    ?>
</p>
        
        <?php 
    echo ResourceLinker::renderLinkList($this->rsLocator);
    ?>
    </div>
    
    <?php 
    if (claro_is_allowed_to_edit()) {
        ?>
    <div class="manageTools">
        <a
            href="<?php 
        echo claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqEd&amp;id=' . $this->intro->getId()));
        ?>
Example #25
0
 /**
  * diplay a received message
  *
  * @param ReceivedMessage $message Message to display
  * @param string $action list of action autorised on the message
  * @return string HTML source
  */
 private static function displayReceivedMessage($message, $action)
 {
     $content = '<div id="im_message">' . "\n" . '<h4 class="header">' . claro_htmlspecialchars($message->getSubject()) . '</h4>' . "\n" . '<div class="imInfoBlock">' . "\n" . '<div class="imCmdList">' . $action . '</div>' . "\n\n" . '<div class="imInfo">' . "\n" . ' <span class="imInfoTitle">' . get_lang('Sender') . ' : </span>' . "\n" . ' <span class="imInfoValue">';
     $isAllowed = current_user_is_allowed_to_send_message_to_user($message->getSender());
     if ($isAllowed) {
         $content .= '<a href="sendmessage.php?cmd=rqMessageToUser&amp;userId=' . $message->getSender() . '">';
     }
     $content .= get_lang('%firstName %lastName', array('%firstName' => claro_htmlspecialchars($message->getSenderFirstName()), '%lastName' => claro_htmlspecialchars($message->getSenderLastName())));
     if ($isAllowed) {
         $content .= "</a>";
     }
     $isManager = FALSE;
     $isAdmin = claro_is_user_platform_admin($message->getSender());
     if (!is_null($message->getCourseCode())) {
         $isManager = claro_is_user_course_manager($message->getSender(), $message->getCourseCode());
     }
     if ($isManager) {
         $content .= '&nbsp;<img src="' . get_icon_url('manager') . '" alt="" />';
     } elseif ($isAdmin) {
         $content .= '&nbsp;<img src="' . get_icon_url('platformadmin') . '" alt="" />';
     } else {
         $content .= '&nbsp;<img src="' . get_icon_url('user') . '" alt="" />';
     }
     $content .= '' . ' </span>' . "\n" . '</div>' . "\n\n" . '<div class="imInfo">' . "\n" . '<span class="imInfoTitle">' . get_lang('Date') . ' : </span>' . "\n" . '<span class="imInfoValue">' . claro_html_localised_date(get_locale('dateTimeFormatLong'), strtotime($message->getSendTime())) . '</span>' . "\n" . '</div>' . "\n\n";
     if (!is_null($message->getCourseCode())) {
         $content .= '<div class="imInfo">' . "\n" . ' <span class="imInfoTitle">' . get_lang('Course') . '</span>' . "\n" . ' <span class="imInfoValue">' . "\n";
         $courseData = claro_get_course_data($message->getCourseCode());
         if ($courseData) {
             $content .= claro_htmlspecialchars($courseData['officialCode']) . ' - ' . claro_htmlspecialchars($courseData['name']);
         } else {
             $content .= '?';
         }
         $content .= ' </span>' . "\n" . '</div>' . "\n\n";
         if (!is_null($message->getGroupId())) {
             $content .= '<div class="imInfo">' . "\n" . ' <span class="imInfoTitle">' . get_lang('Group') . ' : </span>' . "\n" . ' <span class="imInfoValue">' . "\n";
             $groupData = claro_get_group_data(array(CLARO_CONTEXT_COURSE => $message->getCourseCode(), CLARO_CONTEXT_GROUP => $message->getGroupId()));
             if ($groupData) {
                 $content .= $groupData['name'];
             } else {
                 $content .= '?';
             }
             $content .= ' </span>' . "\n" . '</div>' . "\n\n";
         }
         if (!is_null($message->getToolsLabel())) {
             $content .= '<div class="imInfo">' . "\n" . ' <span class="imInfoTitle">' . get_lang('Tool') . ' : </span>' . "\n" . ' <span class="imInfoValue">' . "\n";
             $md = get_module_data($message->getToolsLabel());
             if ($md) {
                 $content .= get_lang($md['moduleName']);
             } else {
                 $content .= '?';
             }
             $content .= ' </span>' . "\n" . '</div>' . "\n\n";
         }
     }
     $body = $message->getMessage();
     $body = claro_html_sanitize_all($body);
     $content .= '</div>' . "\n" . '<div class="imContent">' . claro_parse_user_text($body) . '</div>' . "\n" . '</div>' . "\n\n";
     return $content;
 }
Example #26
0
    $out .= get_lang('Text only (text required, no file)');
} elseif ($assignment->getSubmissionType() == 'TEXTFILE') {
    $out .= get_lang('Text with attached file (text required, file optional)');
} else {
    $out .= get_lang('File (file required, description text optional)');
}
$out .= '<br />' . "\n" . '<b>' . get_lang('Submission visibility') . '</b> : ' . "\n" . ($assignment->getDefaultSubmissionVisibility() == 'VISIBLE' ? get_lang('Visible for all users') : get_lang('Only visible for teacher(s) and submitter(s)')) . '<br />' . "\n" . '<b>' . get_lang('Assignment type') . '</b> : ' . "\n" . ($assignment->getAssignmentType() == 'INDIVIDUAL' ? get_lang('Individual') : get_lang('Groups')) . '<br />' . "\n" . '<b>' . get_lang('Allow late upload') . '</b> : ' . "\n" . ($assignment->getAllowLateUpload() == 'YES' ? get_lang('Users can submit after end date') : get_lang('Users can not submit after end date')) . '</small>' . "\n" . '</p>' . "\n";
// description of assignment
if ($assignment->getDescription() != '') {
    $out .= '<b><small>' . get_lang('Description') . '</small></b>' . "\n" . '<blockquote>' . "\n" . '<small>' . "\n" . claro_parse_user_text($assignment->getDescription()) . '</small>' . "\n" . '</blockquote>' . "\n" . '<br />' . "\n";
}
// show to authenticated and anonymous users
if ($textOrFilePresent && ($showAfterEndDate || $showAfterPost)) {
    $out .= '<fieldset>' . "\n" . '<legend>' . '<b>' . get_lang('Feedback') . '</b>' . '</legend>';
    if ($assignment->getAutoFeedbackText() != '') {
        $out .= claro_parse_user_text($assignment->getAutoFeedbackText());
    }
    if ($assignment->getAutoFeedbackFilename() != '') {
        $target = get_conf('open_submitted_file_in_new_window') ? 'target="_blank"' : '';
        $out .= '<p><a href="' . claro_htmlspecialchars(Url::Contextualize($assignment->getAssigDirWeb() . $assignment->getAutoFeedbackFilename())) . '" ' . $target . '>' . $assignment->getAutoFeedbackFilename() . '</a></p>';
    }
    $out .= '</fieldset>' . '<br />' . "\n";
}
if ($is_allowedToEditAll) {
    // Submission download requested
    if ($cmd == 'rqDownload' && (claro_is_platform_admin() || get_conf('allow_download_all_submissions'))) {
        require_once $includePath . '/lib/form.lib.php';
        $downloadForm = '<strong>' . get_lang('Download') . '</strong>' . "\n" . '<form action="' . get_module_url('CLWRK') . '/export.php?assigId=' . $req['assignmentId'] . '" method="POST">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="cmd" value="exDownload" />' . "\n" . '<input type="radio" name="downloadMode" id="downloadMode_from" value="from" checked /><label for="downloadMode_from">' . get_lang('Submissions posted or modified after date :') . '</label><br />' . "\n" . claro_html_date_form('day', 'month', 'year', time(), 'long') . ' ' . claro_html_time_form('hour', 'minute', time() - fmod(time(), 86400) - 3600) . '<small>' . get_lang('(d/m/y hh:mm)') . '</small>' . '<br /><br />' . "\n" . '<input type="radio" name="downloadMode" id="downloadMode_all" value="all" /><label for="downloadMode_all">' . get_lang('All submissions') . '</label><br /><br />' . "\n" . '<input type="checkbox" name="downloadOnlyCurrentMembers" id="downloadOnlyCurrentMembers_id" value="yes" checked="checked" /><label for="downloadOnlyCurrentMembers_id">' . get_lang('Download only submissions from current course members') . '</label><br /><br />' . "\n" . '<input type="checkbox" name="downloadScore" id="downloadScore_id" value="yes" checked="checked" /><label for="downloadScore_id">' . get_lang('Download score') . '</label><br /><br />' . "\n" . '<input type="submit" value="' . get_lang('OK') . '" />&nbsp;' . "\n" . claro_html_button('work_list.php?assigId=' . $req['assignmentId'], get_lang('Cancel')) . '</form>' . "\n";
        $dialogBox->form($downloadForm);
    }
}
Example #27
0
             foreach ($question['answerList'] as $answer) {
                 if ($answers) {
                     $answers .= "/";
                 }
                 $answers .= $answer;
             }
             for ($j = 0; $j < $answerCount; $j++) {
                 $replacementList[] = str_replace('$', '\\$', ' [ ' . $answers . ' ] ');
             }
     }
     $blankList = array();
     foreach ($question['answerList'] as $answer) {
         // filter slashes as they are modifiers in preg expressions
         $blankList[] = '/\\[' . preg_quote($answer, '/') . '\\]/';
     }
     $displayedAnswer = preg_replace($blankList, $replacementList, claro_parse_user_text($question['answerText']), 1);
     $htmlcontent .= '<tr>' . "\n" . '<td colspan="2" style="background-color: #EEE;">' . $displayedAnswer . '</td>' . "\n" . '</tr>' . "\n";
     break;
 case 'MATCHING':
     foreach ($question['leftList'] as $ql) {
         $ql['answer'] .= ' [';
         $_qr = '';
         foreach ($question['rightList'] as $qr) {
             if ($_qr) {
                 $_qr .= ' , ';
             }
             $_qr .= $qr['answer'];
         }
         $ql['answer'] .= $_qr;
         $ql['answer'] .= '] ';
         $htmlcontent .= '<tr>' . "\n" . '<td colspan="2" style="background-color: #EEE;">' . claro_htmlspecialchars(strip_tags($ql['answer'])) . '</td>' . "\n" . '</tr>' . "\n";