Exemplo n.º 1
0
function display_text_form() {
    global $tool_content, $id, $langContent, $langAdd, $course_code;

    $tool_content .= "<div class='form-wrapper'><form class='form-horizontal' role='form' action='insert.php?course=$course_code' method='post'>
                      <input type='hidden' name='id' value='$id'>";
    $tool_content .= "<fieldset>
        " . rich_text_editor('comments', 4, 20, '') . "
	<br />
        <input class='btn btn-primary' type='submit' name='submit_text' value='$langAdd'>
	</fieldset>
	</form></div>";
}
Exemplo n.º 2
0
  ));    
 $tool_content .= "
      <div class='form-wrapper'>
          <form class='form-horizontal' role='form' method='post' action='$_SERVER[SCRIPT_NAME]?course=$course_code".(isset($_GET['modifyExercise']) ? "&amp;exerciseId=$exerciseId" : "&amp;NewExercise=Yes")."'>
           <fieldset>       
               <div class='form-group ".(Session::getError('exerciseTitle') ? "has-error" : "")."'>
                 <label for='exerciseTitle' class='col-sm-2 control-label'>$langExerciseName:</label>
                 <div class='col-sm-10'>
                   <input name='exerciseTitle' type='text' class='form-control' id='exerciseTitle' value='" . q($exerciseTitle) . "' placeholder='$langExerciseName'>
                   <span class='help-block'>".Session::getError('exerciseTitle')."</span>
                 </div>
               </div>
               <div class='form-group'>
                 <label for='exerciseDescription' class='col-sm-2 control-label'>$langExerciseDescription:</label>
                 <div class='col-sm-10'>
                 " . rich_text_editor('exerciseDescription', 4, 30, $exerciseDescription) . "
                 </div>
               </div>
               <div class='form-group'>
                   <label for='exerciseDescription' class='col-sm-2 control-label'>$langExerciseType:</label>
                   <div class='col-sm-10'>            
                       <div class='radio'>
                         <label>
                           <input type='radio' name='exerciseType' value='1' ".(($exerciseType <= 1)? 'checked' : '').">
                           $langSimpleExercise
                         </label>
                       </div>
                       <div class='radio'>
                         <label>
                           <input type='radio' name='exerciseType' value='2' ".(($exerciseType >= 2)? 'checked' : '').">
                           $langSequentialExercise
Exemplo n.º 3
0
    // --------------------------------
    // notify users
    // --------------------------------
    $subject_notify = "{$logo} - {$langNewForumNotify}";
    $category_id = forum_category($forum_id);
    $cat_name = category_name($category_id);
    $c = course_code_to_title($course_code);
    $name = uid_to_name($uid);
    $title = course_id_to_title($course_id);
    $forum_message = "-------- {$langBodyMessage} ({$langSender}: {$name})\n{$message}--------";
    $plain_forum_message = q(html2text($forum_message));
    $body_topic_notify = "{$langBodyForumNotify} {$langInForums} '" . q($forum_name) . "' \n                               {$langInCat} '" . q($cat_name) . "' {$langTo} {$langCourseS} '{$c}' <br /><br />" . q($forum_message) . "<br />\n                               <br />{$gunet}<br /><a href='{$urlServer}courses/{$course_code}'>{$urlServer}courses/{$course_code}</a>";
    $plain_body_topic_notify = "{$langBodyForumNotify} {$langInForums} '" . q($forum_name) . "' {$langInCat} '" . q($cat_name) . "' {$langTo} {$langCourseS} '{$c}' \n\n{$plain_forum_message} \n\n{$gunet}\n<a href='{$urlServer}courses/{$course_code}'>{$urlServer}courses/{$course_code}</a>";
    $linkhere = "&nbsp;<a href='{$urlServer}main/profile/emailunsubscribe.php?cid={$course_id}'>{$langHere}</a>.";
    $unsubscribe = "<br /><br />{$langNote}: " . sprintf($langLinkUnsubscribe, $title);
    $plain_body_topic_notify .= $unsubscribe . $linkhere;
    $body_topic_notify .= $unsubscribe . $linkhere;
    $sql = Database::get()->queryArray("SELECT DISTINCT user_id FROM forum_notify\n\t\t\tWHERE (forum_id = ?d OR cat_id = ?d)\n\t\t\tAND notify_sent = 1 AND course_id = ?d AND user_id != ?d", $forum_id, $category_id, $course_id, $uid);
    foreach ($sql as $r) {
        if (get_user_email_notification($r->user_id, $course_id)) {
            $emailaddr = uid_to_email($r->user_id);
            send_mail_multipart('', '', '', $emailaddr, $subject_notify, $plain_body_topic_notify, $body_topic_notify, $charset);
        }
    }
    // end of notification
    Session::Messages($langStored, 'alert-success');
    redirect_to_home_page("modules/forum/viewforum.php?course={$course_code}&forum={$forum_id}");
} else {
    $tool_content .= "\n    <div class='form-wrapper'>\n        <form class='form-horizontal' role='form' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;topic={$topic}&forum={$forum_id}' method='post'>\n        <fieldset>\n            <div class='form-group'>\n              <label for='subject' class='col-sm-2 control-label'>{$langSubject}:</label>\n              <div class='col-sm-10'>\n                <input type='text' name='subject' id='subject' class='form-control' maxlength='100'>\n              </div>\n            </div>   \n            <div class='form-group'>\n              <label for='message' class='col-sm-2 control-label'>{$langBodyMessage}:</label>\n              <div class='col-sm-10'>\n                " . rich_text_editor('message', 14, 50, '') . "\n              </div>\n            </div>\n            <div class='form-group'>\n              <div class='col-sm-10 col-sm-offset-2'>\n                <input class='btn btn-primary' type='submit' name='submit' value='{$langSubmit}'>\n                <a class='btn btn-default' href='viewforum.php?course={$course_code}&forum={$forum_id}'>{$langCancel}</a>\n              </div>\n            </div>            \n\t</fieldset>\n\t</form>\n    </div>";
}
draw($tool_content, 2, null, $head_content);
Exemplo n.º 4
0
        } else {
            $tool_content .= "></td>";
        }
        $tool_content .= "\n  <input type='hidden' name='reponse[1]' value='{$langCorrect}' />\n  <td>" . rich_text_editor("comment[1]", 4, 30, @$comment[1], true) . "</td>\n  <td><input type='text' name='weighting[1]' value=\"";
        if (isset($weighting[1])) {
            $tool_content .= q($weighting[1]);
        } else {
            $tool_content .= 0;
        }
        $tool_content .= "\" /></td></tr>";
        $tool_content .= "<tr>";
        $tool_content .= "\n                    <td valign='top'>{$langFalse}</td>\n                    <td valign='top'><input type='radio' value='2' name='correct' ";
        if (isset($correct) and $correct == 2) {
            $tool_content .= "checked='checked' /></td>";
        } else {
            $tool_content .= "></td>";
        }
        $tool_content .= "\n                    <input type='hidden' name='reponse[2]' value='{$langFalse}'>\n                  <td style='width:100%;'>" . rich_text_editor("comment[2]", 4, 40, @$comment[2]) . "</td>\n                    <td valign='top'><input type='text' name='weighting[2]' size='5' value=\"";
        if (isset($weighting[2])) {
            $tool_content .= q($weighting[2]);
        } else {
            $tool_content .= 0;
        }
        $tool_content .= "\" /></td></tr>";
        $tool_content .= "</table>";
    }
    $cancel_link = isset($exerciseId) ? "admin.php?course={$course_code}&exerciseId={$exerciseId}" : "question_pool.php?course={$course_code}";
    $submit_text = $answerType == FILL_IN_BLANKS && !isset($setWeighting) ? "{$langNext} &gt;" : $langCreate;
    $back_button = $answerType == FILL_IN_BLANKS && isset($setWeighting) ? "<input class='btn btn-primary' type='submit' name='buttonBack' value='&lt; {$langBack}'' />" : "";
    $tool_content .= "\n                    <div class='row'>\n                        <div class='col-sm-10 col-sm-offset-2'>\n                            {$back_button}\n                            <input class='btn btn-primary' type='submit' name='submitAnswers' value='{$submit_text}'>\n                            <a class='btn btn-default' href='{$cancel_link}'>{$langCancel}</a>\n                        </div>\n                    </div>\n               </fieldset>\n           </form>\n        </div>\n    </div>";
}
Exemplo n.º 5
0
} else {
    $body_mail = $email_title = '';
    // Display form to administrator
    $tool_content .= "<div class='form-wrapper'>
    <form class='form-horizontal' role='form' action='$_SERVER[SCRIPT_NAME]' method='post'>
    <fieldset>
        <div class='form-group'>
            <label for='email_title' class='col-sm-2 control-label'>$langTitle</label>
            <div class='col-sm-10'>
                <input class='form-control' type='text' name='email_title' value='$email_title' size='50' />
            </div>
        </div>
	<div class='form-group'>
	  <label for='body_mail' class='col-sm-2 control-label'>$typeyourmessage</label>
              <div class='col-sm-10'>
	      ".rich_text_editor('body_mail', 10, 20, $body_mail)."
              </div/>
	</div>
	<div class='form-group'>
	  <label for='sendTo' class='col-sm-2 control-label'>$langSendMessageTo</label>
            <div class='col-sm-10'>
                <select class='form-control' name='sendTo' id='sendTo'>
                    <option value='1'>$langProfOnly</option>
                    <option value='2'>$langStudentsOnly</option>
                    <option value='0'>$langToAllUsers</option>
                </select>	    
            </div>
        </div>
	<div class='col-sm-offset-2 col-sm-10'>	
	  <input class='btn btn-primary' type='submit' name='submit' value='" . q($langSend) . "'>          
        </div>	
Exemplo n.º 6
0
 }
 if (!isset($titleToModify)) {
     $titleToModify = '';
 }
 $tool_content .= "<div class='form-wrapper'>";
 $tool_content .= "<form role='form' class='form-horizontal' method='post' action='$_SERVER[SCRIPT_NAME]'>";
 if (isset($_GET['modify'])) {
     $tool_content .= "<input type='hidden' name='id' value='$id' />";
 }
 $tool_content .= "<div class='form-group'>";
 $tool_content .= "<label for='title' class='col-sm-2 control-label'>$langTitle:</label>
                     <div class='col-sm-10'><input class='form-control' type='text' name='title' value='$titleToModify' size='50' /></div>
                 </div>
                 <div class='form-group'>
                     <label for='newContent' class='col-sm-2 control-label'>$langAnnouncement:</label>
                 <div class='col-sm-10'>" . rich_text_editor('newContent', 5, 40, $contentToModify) . "</div></div>";
 $tool_content .= "<div class='form-group'><label class='col-sm-2 control-label'>$langLanguage:</label>";
 if (isset($_GET['modify'])) {
     if (isset($begindate)) {
         $start_checkbox = 'checked';
         $startdate = $begindate;
     } else {
         $start_checkbox = '';
         $startdate = date('d-m-Y H:i', strtotime('now'));
     }
     if (isset($enddate)) {
         $end_checkbox = 'checked';            
     } else {
         $end_checkbox = '';
         $enddate = date('d-m-Y H:i', strtotime('now +1 month'));
     }
Exemplo n.º 7
0
      $htmlPath
      $group_hidden_input
      $ebook_section_select
      $htmlFileName

      <div class='form-group".(Session::getError('file_title') ? " has-error" : "")."'>
        <label for='file_title' class='col-sm-2 control-label'>$langTitle:</label>
        <div class='col-sm-10'>
          <input type='text' class='form-control' id='file_title' name='file_title'$htmlTitle>
          <span class='help-block'>".Session::getError('file_title')."</span>    
        </div>
      </div>
      <div class='form-group'>
        <label for='file_title' class='col-sm-2 control-label'>$langContent:</label>
        <div class='col-sm-10'>"
          . rich_text_editor('file_content', 20, 40, $fileContent) .
        "</div>
      </div>
	
	<div class='form-group'>
        <div class='col-xs-offset-2 col-xs-10'>".
            form_buttons(array(
                array(
                    'text' => $langSave,
                    'value'=> $langSubmit
                ),
                array(
                    'href' => $backUrl,
                )
            ))
            ."</div>
Exemplo n.º 8
0
$require_current_course = true;
$require_editor = true;
$require_help = true;
$helpTopic = '';
require_once '../../include/baseTheme.php';
$pageName = $langEditWeek;
load_js('tools.js');
if (isset($_GET['edit'])) {
    // display form for editing course unit
    $id = $_GET['edit'];
    $cu = Database::get()->querySingle("SELECT id, title, comments FROM course_weekly_view WHERE id = ?d  AND course_id = ?d", $id, $course_id);
    if (!$cu) {
        $pageName = $langUnitUnknown;
        $tool_content .= "<div class='alert alert-danger'>{$langUnknownResType}</div>";
        draw($tool_content, 2, null, $head_content);
        exit;
    }
    $weektitle = " value='" . htmlspecialchars($cu->title, ENT_QUOTES) . "'";
    $weekdescr = $cu->comments;
    $week_id = $cu->id;
} else {
    $pageName = $langAddWeek;
    $weekdescr = $weektitle = '';
}
$action = "{$urlServer}courses/{$course_code}/";
$tool_content .= "<div class='form-wrapper'>\n        <form class='form-horizontal' role='form' method='post' action='{$action}' onsubmit=\"return checkrequired(this, 'weektitle');\">";
if (isset($week_id)) {
    $tool_content .= "<input type='hidden' name='week_id' value='{$week_id}'>";
}
$tool_content .= "<div class='form-group'>\n                    <label for='weekTitle' class='col-sm-2 control-label'>{$langWeekTitle}:</label>\n                    <div class='col-sm-10'>\n                        <input type='text' class='form-control' id='weekTitle' name='weektitle' {$weektitle}>\n                    </div>\n                  </div>\n            <div class='form-group'>\n                <label class='col-sm-2 control-label'>{$langUnitDescr}</label>\n                <div class='col-sm-10'>\n                    " . rich_text_editor('weekdescr', 10, 20, $weekdescr) . "\n                </div>\n            </div>\n            <div class='form-group'>\n                <div class='col-sm-offset-5 col-sm-12'>\n                    <input class='btn btn-primary' type='submit' name='edit_submitW' value='" . q($langSubmit) . "'>\n                </div>\n            </div>            \n        </form>\n    </div>";
draw($tool_content, 2, null, $head_content);
Exemplo n.º 9
0
         <table class='table'>
         <tr>
           <td colspan='2'><b>$langAnswer</b></td>
           <td class='text-center'><b>$langComment</b></td>
           <td class='text-center'><b>$langQuestionWeighting</b></td>
         </tr>
         <tr>
           <td valign='top' width='30'>$langCorrect</td>
           <td valign='top' width='1'><input type='radio' value='1' name='correct'$setChecked[1]></td>
           <td>" . rich_text_editor('comment[1]', 4, 30, @$comment[1], true) . "</td>
           <td><input class='form-control' type='text' name='weighting[1]' value='$setWeighting[1]'></td>
         </tr>
         <tr>
           <td>$langFalse</td>
           <td><input type='radio' value='2' name='correct'$setChecked[2]></td>
           <td>" . rich_text_editor("comment[2]", 4, 40, @$comment[2]) . "</td>
           <td><input class='form-control' type='text' name='weighting[2]' size='5' value='$setWeighting[2]'></td>
         </tr>
       </table>";
 }
 
 $cancel_link = isset($exerciseId) ? "admin.php?course=$course_code&exerciseId=$exerciseId" : "question_pool.php?course=$course_code";
 $submit_text = ($answerType == FILL_IN_BLANKS || $answerType == FILL_IN_BLANKS_TOLERANT) && !isset($setWeighting) ? "$langNext &gt;" : $langCreate;
 $back_button = ($answerType == FILL_IN_BLANKS || $answerType == FILL_IN_BLANKS_TOLERANT) && isset($setWeighting) ? "<input class='btn btn-primary' type='submit' name='buttonBack' value='&lt; $langBack'' />" : "";
 $tool_content .= "
                 <div class='row'>
                     <div class='col-sm-10 col-sm-offset-2'>
                         $back_button
                         <input class='btn btn-primary' type='submit' name='submitAnswers' value='$submit_text'>
                         <a class='btn btn-default' href='$cancel_link'>$langCancel</a>
                     </div>
Exemplo n.º 10
0
        validateUploadedFile($file_name, 2);
        $i = 0;
        while (is_file("{$webDir}/courses/{$course_code}/image/{$file_name}")) {
            $i++;
            $name = pathinfo($file_name, PATHINFO_FILENAME);
            $ext = get_file_extension($file_name);
            $file_name = "{$name}-{$i}.{$ext}";
        }
        move_uploaded_file($_FILES['course_image']['tmp_name'], "{$webDir}/courses/{$course_code}/image/{$file_name}");
        $extra_sql = ", course_image = ?s";
        array_push($db_vars, $file_name);
    }
    array_push($db_vars, $course_id);
    Database::get()->query("UPDATE course SET description = ?s, home_layout = ?d{$extra_sql} WHERE id = ?d", $db_vars);
    // update index
    require_once 'modules/search/indexer.class.php';
    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id);
    header("Location: {$urlServer}courses/{$course_code}");
    exit;
}
$head_content .= "\n    <script>\n        \$(function(){\n            \$('select[name=layout]').change(function ()\n            {\n                if(\$(this).val() == 1) {\n                    \$('#image_field').removeClass('hidden');\n                } else {\n                    \$('#image_field').addClass('hidden');\n                }\n            });          \n        });\n    </script>";
$layouts = array(1 => $langCourseLayout1, 2 => $langCourseLayout2, 3 => $langCourseLayout3);
$description = $course->description;
$layout = $course->home_layout;
if (isset($course->course_image)) {
    $course_image = "\n        <img src='{$urlAppend}courses/{$course_code}/image/{$course->course_image}' style='max-height:100px;max-width:150px;'> &nbsp&nbsp<a class='btn btn-xs btn-danger' href='{$_SERVER['SCRIPT_NAME']}?delete_image=true'>{$langDelete}</a>\n        <input type='hidden' name='course_image' value='{$course->course_image}'>\n    ";
} else {
    $course_image = "<input type='file' name='course_image' id='course_image'>";
}
$tool_content = action_bar(array(array('title' => $langBack, 'url' => $urlAppend . "courses/" . $course_code, 'icon' => 'fa-reply', 'level' => 'primary-label'))) . "\n    <div class='row'>\n        <div class='col-xs-12'>\n            <div class='form-wrapper'>\n                <form class='form-horizontal' role='form' method='post' action='editdesc.php?course={$course_code}' enctype='multipart/form-data'>\n                    <fieldset>\n                    <div class='form-group'>\n                        <label for='description' class='col-sm-2 control-label'>{$langCourseLayout}:</label>\n                        <div class='col-sm-10'>\n                            " . selection($layouts, 'layout', $layout, 'class="form-control"') . "\n                        </div>\n                    </div>\n                    <div id='image_field' class='form-group" . ($layout == 1 ? "" : " hidden") . "'>\n                        <label for='course_image' class='col-sm-2 control-label'>{$langCourseImage}:</label>\n                        <div class='col-sm-10'>\n                            {$course_image}\n                        </div>\n                    </div>                  \n                    <div class='form-group'>\n                        <label for='description' class='col-sm-2 control-label'>{$langDescription}:</label>\n                        <div class='col-sm-10'>\n                            " . rich_text_editor('description', 8, 20, $description) . "\n                        </div>\n                    </div>\n                    <div class='form-group'>\n                        <div class='col-sm-10 col-sm-offset-2'>\n                            <input class='btn btn-primary' type='submit' name='submit' value='{$langSubmit}'>\n                            <a href='{$urlAppend}courses/{$course_code}' class='btn btn-default'>{$langCancel}</a>\n                        </div>\n                    </div>\n                  </fieldset>\n                </form>\n    </div></div></div>";
draw($tool_content, 2, null, $head_content);
Exemplo n.º 11
0
            $contentToModify = "";
        }
        if (!isset($titleToModify)) {
            $titleToModify = "";
        }
        if (!isset($showFrom)) {
            $showFrom = "";
        }
        if (!isset($showUntil)) {
            $showUntil = "";
        }
        load_js('bootstrap-datepicker');
        $head_content .= "\n            <script type='text/javascript'>\n            \$(function() {\n                \$('#startdate').datepicker({\n                    format: 'dd-mm-yyyy',\n                    language: '{$language}',\n                    autoclose: true\n                });\n                \$('#enddate').datepicker({\n                    format: 'dd-mm-yyyy',\n                    language: '{$language}',\n                    autoclose: true\n                });\n            });" . "</script>";
        $tool_content .= action_bar(array(array('title' => $langBack, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}", 'icon' => 'fa-reply', 'level' => 'primary-label')));
        $tool_content .= "<div class='form-wrapper'>";
        $tool_content .= "<form class='form-horizontal' role='form' method='post' action='{$_SERVER['SCRIPT_NAME']}?course=" . $course_code . "' onsubmit=\"return checkrequired(this, 'antitle');\">\n        <fieldset>\n        <div class='form-group'>\n            <label for='AnnTitle' class='col-sm-2 control-label'>{$langAnnTitle}:</label>\n            <div class='col-sm-10'>\n                <input class='form-control' type='text' name='antitle' value='{$titleToModify}' size='50' />\n            </div>\n        </div>\n        <div class='form-group'>\n          <label for='AnnBody' class='col-sm-2 control-label'>{$langAnnBody}:</label>\n            <div class='col-sm-10'>" . rich_text_editor('newContent', 4, 20, $contentToModify) . "</div>\n        </div>\n        <div class='form-group'><label for='Email' class='col-sm-offset-2 col-sm-12 control-panel'>{$langEmailOption}:</label></div>\n        <div class='form-group'>\n            <div class='col-sm-offset-2 col-sm-10'>\n                <select class='form-control' name='recipients[]' multiple class='form-control' id='select-recipients'>";
        $course_users = Database::get()->queryArray("SELECT cu.user_id, CONCAT(u.surname, ' ', u.givenname) name, u.email FROM course_user cu JOIN user u ON cu.user_id=u.id WHERE cu.course_id = ?d AND u.email<>'' AND u.email IS NOT NULL ORDER BY u.surname, u.givenname", $course_id);
        foreach ($course_users as $cu) {
            $tool_content .= "<option value='" . q($cu->user_id) . "'>" . q($cu->name) . " (" . q($cu->email) . ")</option>";
        }
        $tool_content .= "</select>\n                <a href='#' id='selectAll'>{$langJQCheckAll}</a> | <a href='#' id='removeAll'>{$langJQUncheckAll}</a>\n            </div>\n        </div>\n        <div class='form-group'><label for='Email' class='col-sm-offset-2 col-sm-12 control-panel'>{$langAnnouncementActivePeriod}:</label></div>\n        \n        <div class='form-group'>\n            <label for='From' class='col-sm-2 control-label'>{$langFrom}:</label>\n            <div class='col-sm-10'><input class='form-control' type='text' name='startdate' id='startdate' value='{$showFrom}'></div>\n        </div>\n        <div class='form-group'>\n            <label for='From' class='col-sm-2 control-label'>{$langUntil}:</label>\n            <div class='col-sm-10'><input class='form-control' type='text' name='enddate' id='enddate' value='{$showUntil}'></div>\n        </div>\n        <div class='col-sm-offset-2 col-sm-10'>\n            <input class='btn btn-primary' type='submit' name='submitAnnouncement' value='" . q($langAdd) . "' />\n            <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' class='btn btn-default'>{$langCancel}</a>\n        </div>  \n        <input type='hidden' name='id' value='{$AnnouncementToModify}'>\n        </fieldset>\n        </form>\n        </div>";
    } else {
        if (isset($_GET['an_id'])) {
            $tool_content .= action_bar(array(array('title' => $langModify, 'url' => $_SERVER['SCRIPT_NAME'] . "?course=" . $course_code . "&amp;modify={$row->id}", 'icon' => 'fa-edit', 'level' => 'primary-label'), array('title' => $langDelete, 'url' => $_SERVER['SCRIPT_NAME'] . "?course=" . $course_code . "&amp;delete={$row->id}", 'icon' => 'fa-times', 'level' => 'primary', 'confirm' => $langSureToDelAnnounce)));
        } else {
            $tool_content .= action_bar(array(array('title' => $langAddAnn, 'url' => $_SERVER['SCRIPT_NAME'] . "?course=" . $course_code . "&amp;addAnnounce=1", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success')));
        }
    }
}
// end: teacher only
/* display announcements */
Exemplo n.º 12
0
function show_edit_assignment($id)
{
    global $tool_content, $m, $langEdit, $langBack, $course_code, $langCancel, $urlAppend, $works_url, $course_id, $head_content, $language, $langStudents, $langMove, $langWorkFile, $themeimg, $langDelWarnUserAssignment, $langLessOptions, $langMoreOptions, $langAutoJudgeInputNotSupported, $langAutoJudgeSum, $langAutoJudgeNewScenario, $langAutoJudgeEnable, $langAutoJudgeInput, $langAutoJudgeExpectedOutput, $langAutoJudgeOperator, $langAutoJudgeWeight, $langAutoJudgeProgrammingLanguage, $langAutoJudgeAssertions;
    load_js('bootstrap-datetimepicker');
    $head_content .= "<script type='text/javascript'>\n        \$(function() {\n            \$('#enddatepicker').datetimepicker({\n                format: 'dd-mm-yyyy hh:ii',\n                pickerPosition: 'bottom-left', language: '" . $language . "',\n                autoclose: true\n            });\n            \$('#hidden-opt-btn').on('click', function(e) {\n                e.preventDefault();\n                \$('#hidden-opt').collapse('toggle');\n            });\n            \$('#hidden-opt').on('shown.bs.collapse', function () {\n                \$('#hidden-opt-btn i').removeClass('fa-caret-down').addClass('fa-caret-up');\n                var caret = '<i class=\"fa fa-caret-up\"></i>';\n                \$('#hidden-opt-btn').html('{$langLessOptions} '+caret);\n            })\n            \$('#hidden-opt').on('hidden.bs.collapse', function () {\n                var caret = '<i class=\"fa fa-caret-down\"></i>';\n                \$('#hidden-opt-btn').html('{$langMoreOptions} '+caret);\n            })\n        });\n    </script>";
    $row = Database::get()->querySingle("SELECT * FROM assignment WHERE id = ?d", $id);
    if ($row->assign_to_specific) {
        //preparing options in select boxes for assigning to speficic users/groups
        $assignee_options = '';
        $unassigned_options = '';
        if ($row->group_submissions) {
            $assignees = Database::get()->queryArray("SELECT `group`.id AS id, `group`.name\n                                   FROM assignment_to_specific, `group`\n                                   WHERE `group`.id = assignment_to_specific.group_id AND assignment_to_specific.assignment_id = ?d", $id);
            $all_groups = Database::get()->queryArray("SELECT name,id FROM `group` WHERE course_id = ?d", $course_id);
            foreach ($assignees as $assignee_row) {
                $assignee_options .= "<option value='" . $assignee_row->id . "'>" . $assignee_row->name . "</option>";
            }
            $unassigned = array_udiff($all_groups, $assignees, function ($obj_a, $obj_b) {
                return $obj_a->id - $obj_b->id;
            });
            foreach ($unassigned as $unassigned_row) {
                $unassigned_options .= "<option value='{$unassigned_row->id}'>{$unassigned_row->name}</option>";
            }
        } else {
            $assignees = Database::get()->queryArray("SELECT user.id AS id, surname, givenname\n                                   FROM assignment_to_specific, user\n                                   WHERE user.id = assignment_to_specific.user_id AND assignment_to_specific.assignment_id = ?d", $id);
            $all_users = Database::get()->queryArray("SELECT user.id AS id, user.givenname, user.surname\n                                    FROM user, course_user\n                                    WHERE user.id = course_user.user_id\n                                    AND course_user.course_id = ?d AND course_user.status = 5\n                                    AND user.id", $course_id);
            foreach ($assignees as $assignee_row) {
                $assignee_options .= "<option value='{$assignee_row->id}'>{$assignee_row->surname} {$assignee_row->givenname}</option>";
            }
            $unassigned = array_udiff($all_users, $assignees, function ($obj_a, $obj_b) {
                return $obj_a->id - $obj_b->id;
            });
            foreach ($unassigned as $unassigned_row) {
                $unassigned_options .= "<option value='{$unassigned_row->id}'>{$unassigned_row->surname} {$unassigned_row->givenname}</option>";
            }
        }
    }
    if ((int) $row->deadline) {
        $deadline = date('d-m-Y H:i', strtotime($row->deadline));
    } else {
        $deadline = '';
    }
    $comments = trim($row->comments);
    $tool_content .= action_bar(array(array('title' => $langBack, 'level' => 'primary-label', 'url' => "{$_SERVER['PHP_SELF']}?course={$course_code}", 'icon' => 'fa-reply')));
    //Get possible validation errors
    $title_error = Session::getError('title');
    $max_grade_error = Session::getError('max_grade');
    $tool_content .= "\n    <div class='form-wrapper'>\n    <form class='form-horizontal' role='form' enctype='multipart/form-data' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' method='post' onsubmit='return check_weights();'>\n    <input type='hidden' name='id' value='{$id}' />\n    <input type='hidden' name='choice' value='do_edit' />\n    <fieldset>\n            <div class='form-group " . ($title_error ? "has-error" : "") . "'>\n                <label for='title' class='col-sm-2 control-label'>{$m['title']}:</label>\n                <div class='col-sm-10'>\n                  <input name='title' type='text' class='form-control' id='title' value='" . q($row->title) . "' placeholder='{$m['title']}'>\n                  <span class='help-block'>{$title_error}</span>\n                </div>\n            </div>\n            <div class='form-group'>\n                <label for='desc' class='col-sm-2 control-label'>{$m['description']}:</label>\n                <div class='col-sm-10'>\n                " . rich_text_editor('desc', 4, 20, $row->description) . "\n                </div>\n            </div>";
    if (!empty($comments)) {
        $tool_content .= "<div class='form-group'>\n                <label for='desc' class='col-sm-2 control-label'>{$m['comments']}:</label>\n                <div class='col-sm-10'>\n                " . rich_text_editor('comments', 5, 65, $comments) . "\n                </div>\n            </div>";
    }
    $tool_content .= "\n            <div class='col-sm-10 col-sm-offset-2 margin-top-fat margin-bottom-fat'>\n                <a id='hidden-opt-btn' class='btn btn-success btn-xs' href='#' style='text-decoration:none;'>{$langMoreOptions} <i class='fa fa-caret-down'></i></a>\n            </div>\n            <div class='collapse " . (Session::hasErrors() ? "in" : "") . "' id='hidden-opt'>\n                <div class='form-group'>\n                    <label for='userfile' class='col-sm-2 control-label'>{$langWorkFile}:</label>\n                    <div class='col-sm-10'>\n                      " . ($row->file_name ? "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;get={$row->id}&amp;file_type=1'>" . q($row->file_name) . "</a>" . "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;id={$id}&amp;choice=do_delete_file' onClick='return confirmation(\"{$m['WorkDeleteAssignmentFileConfirm']}\");'>\n                                     <img src='{$themeimg}/delete.png' title='{$m['WorkDeleteAssignmentFile']}' /></a>" : "<input type='file' id='userfile' name='userfile' />") . "\n                    </div>\n                </div>\n                <div class='form-group " . ($max_grade_error ? "has-error" : "") . "'>\n                    <label for='max_grade' class='col-sm-2 control-label'>{$m['max_grade']}:</label>\n                    <div class='col-sm-10'>\n                        <input name='max_grade' type='text' class='form-control' id='max_grade' value='{$row->max_grade}' placeholder='{$m['max_grade']}'>\n                        <span class='help-block'>{$max_grade_error}</span>\n                    </div>\n                </div>\n                <div class='form-group'>\n                    <label class='col-sm-2 control-label'>{$m['deadline']}:</label>\n                    <div class='col-sm-10'>\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' name='is_deadline' value='0' " . (!empty($deadline) ? "" : "checked") . " onclick='\$(\"#enddatepicker, #late_sub_row\").addClass(\"hide\");\$(\"#deadline\").val(\"\");'>\n                            {$m['no_deadline']}\n                          </label>\n                        </div>\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' name='is_deadline' value='1' " . (!empty($deadline) ? "checked" : "") . " onclick='\$(\"#enddatepicker, #late_sub_row\").removeClass(\"hide\")'>\n                            {$m['with_deadline']}\n                          </label>\n                        </div>\n                    </div>\n                </div>\n                <div class='input-append date form-group " . (!empty($deadline) ? "" : "hide") . "' id='enddatepicker' data-date='{$deadline}' data-date-format='dd-mm-yyyy'>\n                    <div class='col-xs-8 col-xs-offset-2'>\n                        <input class='form-control' name='WorkEnd' id='deadline' type='text' value='{$deadline}'>\n                    </div>\n                    <div class='col-xs-2'>\n                        <span class='add-on'><i class='fa fa-times'></i></span>\n                        <span class='add-on'><i class='fa fa-calendar'></i></span>\n                    </div>\n                    <div class='col-xs-10 col-xs-offset-2'>{$m['deadline_notif']}</div>\n                </div>\n                <div class='form-group " . (!empty($deadline) ? "" : "hide") . "' id='late_sub_row'>\n                    <div class='col-xs-10 col-xs-offset-2'>\n                        <div class='checkbox'>\n                          <label>\n                            <input type='checkbox' name='late_submission' value='1' " . ($row->late_submission ? 'checked' : '') . ">\n                            {$m['late_submission_enable']}\n                          </label>\n                        </div>\n                    </div>\n                </div>\n                <div class='form-group'>\n                    <label class='col-sm-2 control-label'>{$m['group_or_user']}:</label>\n                    <div class='col-sm-10'>\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' id='user_button' name='group_submissions' value='0' " . ($row->group_submissions == 1 ? '' : 'checked') . ">\n                            {$m['user_work']}\n                          </label>\n                        </div>\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' id='group_button' name='group_submissions' value='1' " . ($row->group_submissions == 1 ? 'checked' : '') . ">\n                            {$m['group_work']}\n                          </label>\n                        </div>\n                    </div>\n                </div>\n                <div class='form-group'>\n                    <label class='col-sm-2 control-label'>{$m['WorkAssignTo']}:</label>\n                    <div class='col-sm-10'>\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' id='assign_button_all' name='assign_to_specific' value='0' " . ($row->assign_to_specific == 1 ? '' : 'checked') . ">\n                            <span id='assign_button_all_text'>{$m['WorkToAllUsers']}</span>\n                          </label>\n                        </div>\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' id='assign_button_some' name='assign_to_specific' value='1' " . ($row->assign_to_specific == 1 ? 'checked' : '') . ">\n                            <span id='assign_button_some_text'>{$m['WorkToUser']}</span>\n                          </label>\n                        </div>\n                    </div>\n                </div>\n                <table id='assignees_tbl' class='table " . ($row->assign_to_specific == 1 ? '' : 'hide') . "'>\n                <tr class='title1'>\n                  <td id='assignees'>{$langStudents}</td>\n                  <td class='text-center'>{$langMove}</td>\n                  <td>{$m['WorkAssignTo']}</td>\n                </tr>\n                <tr>\n                  <td>\n                    <select id='assign_box' size='15' multiple>\n                    " . (isset($unassigned_options) ? $unassigned_options : '') . "\n                    </select>\n                  </td>\n                  <td class='text-center'>\n                    <input type='button' onClick=\"move('assign_box','assignee_box')\" value='   &gt;&gt;   ' /><br /><input type='button' onClick=\"move('assignee_box','assign_box')\" value='   &lt;&lt;   ' />\n                  </td>\n                  <td width='40%'>\n                    <select id='assignee_box' name='ingroup[]' size='15' multiple>\n                    " . (isset($assignee_options) ? $assignee_options : '') . "\n                    </select>\n                  </td>\n                </tr>\n                </table>";
    $auto_judge = $row->auto_judge;
    $lang = $row->lang;
    $tool_content .= "\n                <div class='form-group'>\n                    <label class='col-sm-2 control-label'>{$langAutoJudgeEnable}:</label>\n                    <div class='col-sm-10'>\n                        <div class='radio'><input type='checkbox' id='auto_judge' name='auto_judge' value='1' " . ($auto_judge == true ? "checked='1'" : '') . " /></div>\n                        <table>\n                            <thead>\n                                <tr>\n                                    <th>{$langAutoJudgeInput}</th>\n                                    <th>{$langAutoJudgeOperator}</th>\n                                    <th>{$langAutoJudgeExpectedOutput}</th>\n                                    <th>{$langAutoJudgeWeight}</th>\n                                    <th>" . $m['delete'] . "</th>\n                                </tr>\n                            </thead>\n                            <tbody>";
    $auto_judge_scenarios = $auto_judge == true ? unserialize($row->auto_judge_scenarios) : null;
    $connector = q(get_config('autojudge_connector'));
    $connector = new $connector();
    $rows = 0;
    $display = 'visible';
    if ($auto_judge_scenarios != null) {
        $scenariosCount = count($auto_judge_scenarios);
        foreach ($auto_judge_scenarios as $aajudge) {
            $tool_content .= "<tr>\n                                        <td><input type='text' value='" . htmlspecialchars($aajudge['input'], ENT_QUOTES) . "' name='auto_judge_scenarios[{$rows}][input]' " . ($connector->supportsInput() ? '' : 'readonly="readonly" placeholder="' . $langAutoJudgeInputNotSupported . '"') . " /></td>";
            $tool_content .= "<td>\n                                        <select name='auto_judge_scenarios[{$rows}][assertion]' class='auto_judge_assertion'>\n                                            <option value='eq'";
            if ($aajudge['assertion'] === 'eq') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['eq'] . "</option>\n                                            <option value='same'";
            if ($aajudge['assertion'] === 'same') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['same'] . "</option>\n                                            <option value='notEq'";
            if ($aajudge['assertion'] === 'notEq') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['notEq'] . "</option>\n                                            <option value='notSame'";
            if ($aajudge['assertion'] === 'notSame') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['notSame'] . "</option>\n                                            <option value='integer'";
            if ($aajudge['assertion'] === 'integer') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['integer'] . "</option>\n                                            <option value='float'";
            if ($aajudge['assertion'] === 'float') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['float'] . "</option>\n                                            <option value='digit'";
            if ($aajudge['assertion'] === 'digit') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['digit'] . "</option>\n                                            <option value='boolean'";
            if ($aajudge['assertion'] === 'boolean') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['boolean'] . "</option>\n                                            <option value='notEmpty'";
            if ($aajudge['assertion'] === 'notEmpty') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['notEmpty'] . "</option>\n                                            <option value='notNull'";
            if ($aajudge['assertion'] === 'notNull') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['notNull'] . "</option>\n                                            <option value='string'";
            if ($aajudge['assertion'] === 'string') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['string'] . "</option>\n                                            <option value='startsWith'";
            if ($aajudge['assertion'] === 'startsWith') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['startsWith'] . "</option>\n                                            <option value='endsWith'";
            if ($aajudge['assertion'] === 'endsWith') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['endsWith'] . "</option>\n                                            <option value='contains'";
            if ($aajudge['assertion'] === 'contains') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['contains'] . "</option>\n                                            <option value='numeric'";
            if ($aajudge['assertion'] === 'numeric') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['numeric'] . "</option>\n                                            <option value='isArray'";
            if ($aajudge['assertion'] === 'isArray') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['isArray'] . "</option>\n                                            <option value='true'";
            if ($aajudge['assertion'] === 'true') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['true'] . "</option>\n                                            <option value='false'";
            if ($aajudge['assertion'] === 'false') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['false'] . "</option>\n                                            <option value='isJsonString'";
            if ($aajudge['assertion'] === 'isJsonString') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['isJsonString'] . "</option>\n                                            <option value='isObject'";
            if ($aajudge['assertion'] === 'isObject') {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">" . $langAutoJudgeAssertions['isObject'] . "</option>\n                                        </select>\n                                    </td>";
            if (isset($aajudge['output'])) {
                $tool_content .= "<td><input type='text' value='" . htmlspecialchars($aajudge['output'], ENT_QUOTES) . "' name='auto_judge_scenarios[{$rows}][output]' class='auto_judge_output' /></td>";
            } else {
                $tool_content .= "<td><input type='text' value='' name='auto_judge_scenarios[{$rows}][output]' disabled='disabled' class='auto_judge_output' /></td>";
            }
            $tool_content .= "<td><input type='text' value='{$aajudge['weight']}' name='auto_judge_scenarios[{$rows}][weight]' class='auto_judge_weight'/></td>\n                                        <td><a href='#' class='autojudge_remove_scenario' style='display: " . ($rows <= 0 ? 'none' : 'visible') . ";'>X</a></td>\n                                    </tr>";
            $rows++;
        }
    } else {
        $tool_content .= "<tr>\n                                            <td><input type='text' name='auto_judge_scenarios[{$rows}][input]' /></td>\n                                            <td>\n                                                <select name='auto_judge_scenarios[{$rows}][assertion]' class='auto_judge_assertion'>\n                                                    <option value='eq' selected='selected'>" . $langAutoJudgeAssertions['eq'] . "</option>\n                                                    <option value='same'>" . $langAutoJudgeAssertions['same'] . "</option>\n                                                    <option value='notEq'>" . $langAutoJudgeAssertions['notEq'] . "</option>\n                                                    <option value='notSame'>" . $langAutoJudgeAssertions['notSame'] . "</option>\n                                                    <option value='integer'>" . $langAutoJudgeAssertions['integer'] . "</option>\n                                                    <option value='float'>" . $langAutoJudgeAssertions['float'] . "</option>\n                                                    <option value='digit'>" . $langAutoJudgeAssertions['digit'] . "</option>\n                                                    <option value='boolean'>" . $langAutoJudgeAssertions['boolean'] . "</option>\n                                                    <option value='notEmpty'>" . $langAutoJudgeAssertions['notEmpty'] . "</option>\n                                                    <option value='notNull'>" . $langAutoJudgeAssertions['notNull'] . "</option>\n                                                    <option value='string'>" . $langAutoJudgeAssertions['string'] . "</option>\n                                                    <option value='startsWith'>" . $langAutoJudgeAssertions['startsWith'] . "</option>\n                                                    <option value='endsWith'>" . $langAutoJudgeAssertions['endsWith'] . "</option>\n                                                    <option value='contains'>" . $langAutoJudgeAssertions['contains'] . "</option>\n                                                    <option value='numeric'>" . $langAutoJudgeAssertions['numeric'] . "</option>\n                                                    <option value='isArray'>" . $langAutoJudgeAssertions['isArray'] . "</option>\n                                                    <option value='true'>" . $langAutoJudgeAssertions['true'] . "</option>\n                                                    <option value='false'>" . $langAutoJudgeAssertions['false'] . "</option>\n                                                    <option value='isJsonString'>" . $langAutoJudgeAssertions['isJsonString'] . "</option>\n                                                    <option value='isObject'>" . $langAutoJudgeAssertions['isObject'] . "</option>\n                                                </select>\n                                            </td>\n                                            <td><input type='text' name='auto_judge_scenarios[{$rows}][output]' class='auto_judge_output' /></td>\n                                            <td><input type='text' name='auto_judge_scenarios[{$rows}][weight]' class='auto_judge_weight'/></td>\n                                            <td><a href='#' class='autojudge_remove_scenario' style='display: none;'>X</a></td>\n                                        </tr>\n                                ";
    }
    $tool_content .= "<tr>\n                                <td> </td>\n                                <td> </td>\n                                <td> </td>\n                                <td style='text-align:center;'> {$langAutoJudgeSum}: <span id='weights-sum'>0</span></td>\n                                <td> <input type='submit' value='{$langAutoJudgeNewScenario}' id='autojudge_new_scenario' /></td>\n                            </tr>\n                            </tbody>\n                        </table>\n                    </div>\n                </div>\n                <div class='form-group'>\n                  <label class='col-sm-2 control-label'>{$langAutoJudgeProgrammingLanguage}:</label>\n                  <div class='col-sm-10'>\n                    <select id='lang' name='lang'>";
    foreach ($connector->getSupportedLanguages() as $llang => $ext) {
        $tool_content .= "<option value='{$llang}' " . ($llang === $lang ? "selected='selected'" : "") . ">{$llang}</option>\n";
    }
    $tool_content .= "</select>\n                  </div>\n                </div>\n            </div>\n            <div class='col-sm-offset-2 col-sm-10'>\n                <input type='submit' class='btn btn-primary' name='do_edit' value='{$langEdit}' onclick=\"selectAll('assignee_box',true)\" />\n                <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' class='btn btn-default'>{$langCancel}</a>\n            </div>\n    </fieldset>\n    </form></div>";
}
Exemplo n.º 13
0
     }
     $gradebookActivityToModify = $id;
 } else {
     //new activity
     $gradebookActivityToModify = "";
     $activity_type = "";
     $date = date("Y-n-j", time());
 }
 if (!isset($contentToModify)) {
     $contentToModify = "";
 }
 @($tool_content .= "\n                                <div class='form-group'>\n                                    <label for='activity_type' class='col-sm-2 control-label'>{$langGradebookType}:</label>\n                                    <div class='col-sm-10'>\n                                        <select name='activity_type' class='form-control'>\n                                            <option value=''  " . typeSelected($activity_type, '') . " >-</option>\n                                            <option value='4' " . typeSelected($activity_type, 4) . " >" . $gradebook_exams . "</option>\n                                            <option value='2' " . typeSelected($activity_type, 2) . " >" . $gradebook_labs . "</option>\n                                            <option value='1' " . typeSelected($activity_type, 1) . " >" . $gradebook_oral . "</option>\n                                            <option value='3' " . typeSelected($activity_type, 3) . " >" . $gradebook_progress . "</option>\n                                            <option value='5' " . typeSelected($activity_type, 5) . " >" . $gradebook_other_type . "</option>\n                                        </select>\n                                    </div>\n                                </div>\n                                <div class='form-group'>\n                                    <label for='actTitle' class='col-sm-2 control-label'>{$langTitle}:</label>\n                                    <div class='col-sm-10'>\n                                        <input type='text' class='form-control' name='actTitle' value='{$titleToModify}'/>\n                                    </div>\n                                </div>\n                                <div class='form-group'>\n                                    <label for='date' class='col-sm-2 control-label'>{$langGradebookActivityDate2}:</label>\n                                    <div class='col-sm-10'>\n                                        <input type='text' class='form-control' name='date' value='" . datetime_remove_seconds($date) . "'/>\n                                    </div>\n                                </div>\n                                <div class='form-group'>\n                                    <label for='weight' class='col-sm-2 control-label'>{$langGradebookActivityWeight}:</label>\n                                    <div class='col-sm-10'>\n                                        <input type='text' class='form-control' name='weight' value='{$weight}' size='5' /> (" . weightleft($gradebook_id, '') . " % {$langGradebookActivityWeightLeft})\n                                    </div>\n                                </div>\n                                <div class='form-group'>\n                                    <label for='visible' class='col-sm-2 control-label'>{$langGradeVisible}</label>\n                                    <div class='col-sm-10'>\n                                        <input type='checkbox' class='form-control' id='visible' name='visible' value='1'");
 if ($visible) {
     $tool_content .= " checked";
 }
 $tool_content .= " /></div>\n                                </div>\n                                <div class='form-group'>\n                                    <label for='actDesc' class='col-sm-2 control-label'>{$langGradebookActivityWeight}:</label>\n                                    <div class='col-sm-10'>\n                                        " . rich_text_editor('actDesc', 4, 20, $contentToModify) . "\n                                    </div>\n                                </div>";
 if (isset($module_auto_id)) {
     //accept the auto booking mechanism
     $tool_content .= "<div class='form-group'>\n                                    <label for='weight' class='col-sm-2 control-label'>{$langGradebookInsAut}:</label> \n                                            <div class='col-sm-10'><input type='checkbox' class='form-control' value='1' name='auto' ";
     if ($auto) {
         $tool_content .= " checked";
     }
     $tool_content .= "\n                                        /></div>";
 }
 $tool_content .= "<div class='col-sm-offset-2 col-sm-10'>\n                                                <input class='btn btn-primary' type='submit' name='submitGradebookActivity' value='{$langAdd}' />\n                                            </div>";
 if (isset($_GET['modify'])) {
     $tool_content .= "<input type='hidden' name='id' value='" . $gradebookActivityToModify . "' />";
 } else {
     $tool_content .= " <input type='hidden' name='id' value='' />";
 }
 $tool_content .= "</fieldset>\n                        </form>\n                    </div>\n                </div>\n            </div>";
Exemplo n.º 14
0
        $navigation[] = array('url' => "admin.php?course={$course_code}&amp;pid={$pid}&amp;editQuestion={$question->pqid}", 'name' => $langPollManagement);
    } else {
        $pageName = $langNewQu;
    }
    $action_url = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;pid={$pid}" . (isset($_GET['modifyQuestion']) ? "&amp;modifyQuestion={$question->pqid}" : "&amp;newQuestion=yes");
    $action_url .= isset($_GET['questionType']) ? '&amp;questionType=label' : '';
    $tool_content .= action_bar(array(array('title' => $langBack, 'level' => 'primary-label', 'url' => "admin.php?course={$course_code}&pid={$pid}" . (isset($_GET['modifyQuestion']) ? "&editQuestion=" . $_GET['modifyQuestion'] : ""), 'icon' => 'fa-reply')));
    $questionName = Session::has('questionName') ? Session::get('questionName') : (isset($question) ? $question->question_text : '');
    $questionNameError = Session::getError('questionName');
    $questionNameErrorClass = $questionNameError ? "has-error" : "";
    $answerType = Session::has('answerType') ? Session::get('answerType') : (isset($question) ? $question->qtype : '');
    $questionScale = Session::has('questionScale') ? Session::get('questionScale') : (isset($question) ? $question->q_scale : 5);
    $questionScaleError = Session::getError('questionScale');
    $questionScaleErrorClass = $questionScaleError ? " has-error" : "";
    $questionScaleShowHide = $answerType == QTYPE_SCALE ? "" : " hidden";
    $tool_content .= "<div class='form-wrapper'><form class='form-horizontal' role='form' action='{$action_url}' method='post'>\r\n\t<fieldset>\r\n            <div class='form-group {$questionNameErrorClass}'>\r\n                <label for='questionName' class='col-sm-2 control-label'>" . (isset($_GET['questionType']) ? $langLabel : $langQuestion) . ":</label>\r\n                <div class='col-sm-10'>\r\n                  " . (isset($_GET['questionType']) || isset($question) && $question->qtype == QTYPE_LABEL ? rich_text_editor('questionName', 10, 10, $questionName) : "<input type='text' class='form-control' id='questionName' name='questionName' value='" . q($questionName) . "'>") . "\r\n                  <span class='help-block'>{$questionNameError}</span>    \r\n                </div>\r\n            </div>";
    if (isset($_GET['questionType']) || isset($question) && $question->qtype == QTYPE_LABEL) {
        $tool_content .= "<input type='hidden' name='answerType' value='" . QTYPE_LABEL . "'>";
    } else {
        $head_content .= "<script type='text/javascript'>\r\n        \$(function() {\r\n            \$('.answerType').change(function() {\r\n                if(\$(this).val()==5){\r\n                    \$('#questionScale').prop('disabled', false);\r\n                    \$('#questionScale').closest('div.form-group').removeClass('hidden');\r\n                } else {\r\n                    \$('#questionScale').prop('disabled', true);\r\n                    \$('#questionScale').closest('div.form-group').addClass('hidden');\r\n                }\r\n            });        \r\n        });\r\n        </script>";
        $tool_content .= "\r\n            <div class='form-group'>\r\n                <label for='answerType' class='col-sm-2 control-label'>{$langExerciseType}:</label>\r\n                <div class='col-sm-10'>            \r\n                    <div class='radio'>\r\n                      <label>\r\n                        <input type='radio' name='answerType' class='answerType' value='1' value='" . QTYPE_SINGLE . "' " . ($answerType == QTYPE_SINGLE || !isset($question) ? 'checked' : '') . ">\r\n                        " . $aType[QTYPE_SINGLE - 1] . "\r\n                      </label>\r\n                    </div>\r\n                    <div class='radio'>\r\n                      <label>\r\n                        <input type='radio' name='answerType' class='answerType' value='" . QTYPE_MULTIPLE . "' " . ($answerType == QTYPE_MULTIPLE ? 'checked' : '') . ">\r\n                        " . $aType[QTYPE_MULTIPLE - 1] . "\r\n                      </label>\r\n                    </div>\r\n                    <div class='radio'>\r\n                      <label>\r\n                        <input type='radio' name='answerType' class='answerType' value='" . QTYPE_FILL . "' " . ($answerType == QTYPE_FILL ? 'checked' : '') . ">\r\n                        " . $aType[QTYPE_FILL - 1] . "\r\n                      </label>\r\n                    </div>\r\n                    <div class='radio'>\r\n                      <label>\r\n                        <input type='radio' name='answerType' class='answerType' value='" . QTYPE_SCALE . "' " . ($answerType == QTYPE_SCALE ? 'checked' : '') . ">\r\n                        " . $aType[QTYPE_SCALE - 1] . "\r\n                      </label>\r\n                    </div>                    \r\n                </div>              \r\n            </div>\r\n            <div class='form-group{$questionScaleErrorClass}{$questionScaleShowHide}'>\r\n                <label for='questionName' class='col-sm-2 control-label'>{$langMax} {$langScale} (1-..):</label>\r\n                <div class='col-sm-10 col-md-3'>\r\n                    <input type='text' class='form-control' name='questionScale' id='questionScale' value='" . q($questionScale) . "'>\r\n                    <span class='help-block'>{$questionScaleError}</span>                    \r\n                </div>\r\n            </div>";
    }
    $tool_content .= "\r\n            <div class='col-md-10 col-md-offset-2'>\r\n                <input type='submit' class='btn btn-primary' name='submitQuestion' value='" . (isset($_GET['newQuestion']) ? $langCreate : $langModify) . "'>\r\n                <a href='admin.php?course={$course_code}&pid={$pid}" . (isset($_GET['modifyQuestion']) ? "&editQuestion=" . $_GET['modifyQuestion'] : "") . "' class='btn btn-default'>{$langCancel}</a>\r\n            </div>\r\n        </fieldset>\r\n    </form></div>";
    //Modify Answers
} elseif (isset($_GET['modifyAnswers'])) {
    $head_content .= "\r\n    <script>\r\n        \$(function() {\r\n            \$(poll_init);\r\n        });\r\n    </script>\r\n    ";
    $question_id = $_GET['modifyAnswers'];
    $question = Database::get()->querySingle('SELECT * FROM poll_question WHERE pid = ?d AND pqid = ?d', $pid, $question_id);
    $answers = Database::get()->queryArray("SELECT * FROM poll_question_answer\r\n\t\t\t\t\tWHERE pqid = ?d ORDER BY pqaid", $question->pqid);
    if (!$question || $question->qtype == QTYPE_LABEL || $question->qtype == QTYPE_FILL || $question->qtype == QTYPE_SCALE) {
        redirect_to_home_page("modules/questionnaire/admin.php?course={$course_code}&pid={$pid}");
Exemplo n.º 15
0
         <select name='category' id='questionCat' class='form-control'>
             $options
         </select>
     </div>
 </div>        
 <div class='form-group ".(Session::getError('questionName') ? "has-error" : "")."'>
     <label for='questionName' class='col-sm-2 control-label'>$langQuestion:</label>
     <div class='col-sm-10'>
       <input name='questionName' type='text' class='form-control' id='questionName' placeholder='$langQuestion' value='" . q($questionName) . "'>
       <span class='help-block'>".Session::getError('questionName')."</span>
     </div>
 </div>
 <div class='form-group'>
     <label for='questionDescription' class='col-sm-2 control-label'>$langQuestionDescription:</label>
     <div class='col-sm-10'>
       ". rich_text_editor('questionDescription', 4, 50, $questionDescription) ."
     </div>
 </div>
 <div class='form-group'>
     <label for='questionDifficulty' class='col-sm-2 control-label'>$langQuestionDiffGrade:</label>
     <div class='col-sm-10'>
         <input id='questionDifficulty' name='difficulty' data-slider-id='ex1Slider' type='text' data-slider-min='0' data-slider-max='5' data-slider-step='1' data-slider-value='$difficulty'/>                      
     </div>
     <div class='col-sm-1'>
     <span id='questionDifficultyValue' class='label label-default'></span>  
     </div>
 </div>            
 <div class='form-group'>
     <label for='imageUpload' class='col-sm-2 control-label'>".(($okPicture) ? $langReplacePicture : $langAddPicture).":</label>
     <div class='col-sm-10'>" .
       (($okPicture) ? "<img src='../../$picturePath/quiz-$questionId'><br><br>" : "") .
Exemplo n.º 16
0
            'level' => 'primary-label')),false);
$tool_content .= "<div class='form-wrapper'>
        <form class='form-horizontal' role='form' method='post' action='index.php?course=$course_code$actionAppend' onsubmit=\"return checkrequired(this, 'unittitle');\">";

if (isset($unit_id)) {
    $tool_content .= "<input type='hidden' name='unit_id' value='$unit_id'>";
}
$tool_content .= "<div class='form-group'>
                    <label for='unitTitle' class='col-sm-2 control-label'>$langTitle</label>
                    <div class='col-sm-10'>
                        <input type='text' class='form-control' id='unitTitle' name='unittitle' $unittitle>
                    </div>
                  </div>
            <div class='form-group'>
                <label for='unitdescr' class='col-sm-2 control-label'>$langUnitDescr</label>
                <div class='col-sm-10'>
                    " . rich_text_editor('unitdescr', 10, 20, $unitdescr) . "
                </div>
            </div>
            " . $tagsInput . "
            <div class='form-group'>
                <div class='col-sm-10 col-sm-offset-2'>
                    <input class='btn btn-primary' type='submit' name='edit_submit' value='" . q($langSubmit) . "'>
                </div>
            </div>            
        </form>
    </div>";

draw($tool_content, 2, null, $head_content);

Exemplo n.º 17
0
            $startdate = date('d-m-Y H:i', strtotime('now'));
            $enddate = date('d-m-Y', strtotime('now +1 week'));
        }
        $tool_content .= "<div class='form-wrapper'>";
        $tool_content .= "<form id='agendaform' class='form-horizontal' role='form' method='post' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}'>\n            <input type='hidden' id = 'id' name='id' value='{$id}'>" . "<input type='hidden' name='rep' id='rep' value='{$rep}'>";
        @($tool_content .= "\n            <div class='form-group'>\n                <label for='event_title' class='col-sm-2 control-label'>{$langTitle} :</label>\n                <div class='col-sm-10'>\n                    <input type='text' class='form-control' id='event_title' name='event_title' placeholder='{$langTitle}' value='" . q($event_title) . "'>\n                </div>\n            </div>\n            <div class='input-append date form-group' id='startdatecal' data-date='{$langDate}' data-date-format='dd-mm-yyyy'>\n                <label for='startdate' class='col-sm-2 control-label'>{$langDate} :</label>\n                <div class='col-xs-10 col-sm-9'>        \n                    <input class='form-control' name='startdate' id='startdate' type='text' value = '" . $startdate . "'>\n                </div>\n                <div class='col-xs-2 col-sm-1'>  \n                    <span class='add-on'><i class='fa fa-times'></i></span>\n                    <span class='add-on'><i class='fa fa-calendar'></i></span>\n                </div>\n            </div>\n            <div class='input-append bootstrap-timepicker form-group'>\n                <label for='durationcal' class='col-sm-2 control-label'>{$langDuration} <small>{$langInHour}</small></label>\n                <div class='col-xs-10 col-sm-9'>\n                    <input class='form-control' name='duration' id='durationcal' type='text' class='input-small' value='" . $duration . "'>\n                </div>\n                <div class='col-xs-2 col-sm-1'>\n                    <span class='add-on'><i class='icon-time'></i></span>\n                </div>\n            </div>");
        if (!isset($_GET['edit'])) {
            $tool_content .= "<div class='form-group'>\n                                    <label for='Repeat' class='col-sm-2 control-label'>{$langRepeat} {$langEvery}</label>\n                                <div class='col-sm-2'>\n                                    <select class='form-control' name='frequencynumber'>\n                                    <option value='0'>{$langSelectFromMenu}</option>";
            for ($i = 1; $i < 10; $i++) {
                $tool_content .= "<option value=\"{$i}\">{$i}</option>";
            }
            $tool_content .= "</select></div>";
            $tool_content .= "<div class='col-sm-2'>\n                        <select class='form-control' name='frequencyperiod'>\n                            <option value=\"D\">{$langSelectFromMenu}...</option>\n                            <option value=\"D\">{$langDays}</option>\n                            <option value=\"W\">{$langWeeks}</option>\n                            <option value=\"M\">{$langMonthsAbstract}</option>\n                        </select>\n                        </div>\n                    </div>";
            $tool_content .= "<div class='input-append date form-group' id='enddatecal' data-date='{$langDate}' data-date-format='dd-mm-yyyy'>\n                <label for='Enddate' class='col-sm-2 control-label'>{$langUntil} :</label>\n                    <div class='col-xs-10 col-sm-9'>\n                        <input class='form-control' name='enddate' id='enddate' type='text' value = '" . $enddate . "'>\n                    </div>\n                    <div class='col-xs-2 col-sm-1'>  \n                        <span class='add-on'><i class='fa fa-times'></i></span>\n                        <span class='add-on'><i class='fa fa-calendar'></i></span>\n                    </div>\n                </div>";
        }
        $tool_content .= "<div class='form-group'>\n                        <label for='Detail' class='col-sm-2 control-label'>{$langDetail} :</label>\n                        <div class='col-sm-10'>" . rich_text_editor('content', 4, 20, $content) . "</div>\n                      </div>            \n                      <div class='form-group'>\n                        <div class='col-sm-offset-2 col-sm-10'>\n                            <input type='button' class='btn btn-default' id='submitbtn' name='submitbtn' value='{$langAddModify}'>\n                        </div>\n                      </div>                \n            </form></div>";
    }
}
/* ---------------------------------------------
 *  End  of  prof only
 * ------------------------------------------- */
// display action bar
if (!isset($_GET['addEvent']) && !isset($_GET['edit'])) {
    $tool_content .= action_bar(array(array('title' => $langAddEvent, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;addEvent=1", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success', 'show' => $is_editor), array('title' => $langiCalExport, 'url' => "icalendar.php?c={$course_id}", 'icon' => 'fa-calendar', 'level' => 'primary')));
    $cal_content_list = event_list_view();
    $tool_content .= '' . '<div id="calendar_wrapper" class="row">
                    <div class="col-md-12">
                        <div class="row calendar-header">
                        <div class="col-md-12">
                        <div id="calendar-header">
                            <div class="pull-right form-inline">
Exemplo n.º 18
0
function showQuestion(&$objQuestionTmp, $exerciseResult = array())
{
    global $tool_content, $picturePath, $langNoAnswer, $langQuestion, $langColumnA, $langColumnB, $langMakeCorrespond, $langInfoGrades, $i, $exerciseType, $nbrQuestions, $langInfoGrade;
    $questionId = $objQuestionTmp->id;
    $questionWeight = $objQuestionTmp->selectWeighting();
    $answerType = $objQuestionTmp->selectType();
    $message = $langInfoGrades;
    if (intval($questionWeight) == $questionWeight) {
        $questionWeight = intval($questionWeight);
    }
    if ($questionWeight == 1) {
        $message = $langInfoGrade;
    }
    $questionName = $objQuestionTmp->selectTitle();
    $questionDescription = $objQuestionTmp->selectDescription();
    $questionDescription_temp = $questionDescription;
    $questionTypeWord = $objQuestionTmp->selectTypeWord($answerType);
    $tool_content .= "\n            <div class='panel panel-success'>\n              <div class='panel-heading'>\n                <h3 class='panel-title'>{$langQuestion} : {$i} ({$questionWeight} {$message})" . ($exerciseType == 2 ? " / " . $nbrQuestions : "") . "</h3>\n              </div>\n              <div class='panel-body'>\n                    <h4>{$questionName} <br> \n                        <small>{$questionTypeWord}</small>\n                    </h4>\n                    {$questionDescription_temp}\n                    <div class='text-center'>\n                        " . (file_exists($picturePath . '/quiz-' . $questionId) ? "<img src='../../{$picturePath}/quiz-{$questionId}'>" : "") . "\n                    </div>";
    // construction of the Answer object
    $objAnswerTmp = new Answer($questionId);
    $nbrAnswers = $objAnswerTmp->selectNbrAnswers();
    if ($answerType == FREE_TEXT) {
        $text = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : '';
        $tool_content .= rich_text_editor('choice[' . $questionId . ']', 14, 90, $text);
    }
    if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER || $answerType == TRUE_FALSE) {
        $tool_content .= "<input type='hidden' name='choice[{$questionId}]' value='0' />";
    }
    // only used for the answer type "Matching"
    if ($answerType == MATCHING && $nbrAnswers > 0) {
        $cpt1 = 'A';
        $cpt2 = 1;
        $Select = array();
        $tool_content .= "\n                      <table class='table-default'>\n                      <tr>\n                        <th>{$langColumnA}</th>\n                        <th>{$langMakeCorrespond}</th>\n                        <th>{$langColumnB}</th>\n                      </tr>";
    }
    if ($answerType == FILL_IN_BLANKS) {
        $tool_content .= "<div class='form-inline'>";
    }
    for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
        $answer = $objAnswerTmp->selectAnswer($answerId);
        $answer = mathfilter($answer, 12, '../../courses/mathimg/');
        $answerCorrect = $objAnswerTmp->isCorrect($answerId);
        if ($answerType == FILL_IN_BLANKS) {
            // splits text and weightings that are joined with the character '::'
            list($answer) = explode('::', $answer);
            // replaces [blank] by an input field
            $replace_callback = function () use($questionId, $exerciseResult) {
                static $id = 0;
                $id++;
                $value = isset($exerciseResult[$questionId][$id]) ? 'value = ' . $exerciseResult[$questionId][$id] : '';
                return "<input type='text' name='choice[{$questionId}][{$id}]' {$value}>";
            };
            $answer = preg_replace_callback('/\\[[^]]+\\]/', $replace_callback, standard_text_escape($answer));
        }
        // unique answer
        if ($answerType == UNIQUE_ANSWER) {
            $checked = isset($exerciseResult[$questionId]) && $exerciseResult[$questionId] == $answerId ? 'checked="checked"' : '';
            $tool_content .= "\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' name='choice[{$questionId}]' value='{$answerId}' {$checked}>\n                            " . standard_text_escape($answer) . "\n                          </label>\n                        </div>";
        } elseif ($answerType == MULTIPLE_ANSWER) {
            $checked = isset($exerciseResult[$questionId][$answerId]) && $exerciseResult[$questionId][$answerId] == 1 ? 'checked="checked"' : '';
            $tool_content .= "\n                        <div class='checkbox'>\n                          <label>\n                            <input type='checkbox' name='choice[{$questionId}][{$answerId}]' value='1' {$checked}>\n                            " . standard_text_escape($answer) . "\n                          </label>\n                        </div>";
        } elseif ($answerType == FILL_IN_BLANKS) {
            $tool_content .= $answer;
        } elseif ($answerType == MATCHING) {
            if (!$answerCorrect) {
                // options (A, B, C, ...) that will be put into the list-box
                $Select[$answerId]['Lettre'] = $cpt1++;
                // answers that will be shown at the right side
                $Select[$answerId]['Reponse'] = standard_text_escape($answer);
            } else {
                $tool_content .= "\n\t\t\t\t    <tr>\n\t\t\t\t      <td><b>{$cpt2}.</b> " . standard_text_escape($answer) . "</td>\n\t\t\t\t      <td><div align='left'>\n\t\t\t\t       <select name='choice[{$questionId}][{$answerId}]'>\n\t\t\t\t\t <option value='0'>--</option>";
                // fills the list-box
                foreach ($Select as $key => $val) {
                    $selected = isset($exerciseResult[$questionId][$answerId]) && $exerciseResult[$questionId][$answerId] == $key ? 'selected="selected"' : '';
                    $tool_content .= "\n\t\t\t\t\t<option value=\"" . q($key) . "\" {$selected}>{$val['Lettre']}</option>";
                }
                $tool_content .= "</select></div></td><td width='200'>";
                if (isset($Select[$cpt2])) {
                    $tool_content .= '<b>' . q($Select[$cpt2]['Lettre']) . '.</b> ' . $Select[$cpt2]['Reponse'];
                } else {
                    $tool_content .= '&nbsp;';
                }
                $tool_content .= "</td></tr>";
                $cpt2++;
                // if the left side of the "matching" has been completely shown
                if ($answerId == $nbrAnswers) {
                    // if it remains answers to shown at the right side
                    while (isset($Select[$cpt2])) {
                        $tool_content .= "\n                                              <tr class='even'>\n                                                <td colspan='2'>\n                                                  <table width='100%'>\n                                                  <tr>\n                                                  <td width='200'>&nbsp;</td>\n                                                  <td width='100'>&nbsp;</td>\n                                                  <td width='200' valign='top'>" . "<b>" . q($Select[$cpt2]['Lettre']) . ".</b> " . q($Select[$cpt2]['Reponse']) . "\n                                                  </td>\n                                                  </tr>\n                                                  </table>\n                                                </td>\n                                              </tr>";
                        $cpt2++;
                    }
                    // end while()
                }
                // end if()
            }
        } elseif ($answerType == TRUE_FALSE) {
            $checked = isset($exerciseResult[$questionId]) && $exerciseResult[$questionId] == $answerId ? 'checked="checked"' : '';
            $tool_content .= "\n                        <div class='radio'>\n                          <label>\n                            <input type='radio' name='choice[{$questionId}]' value='{$answerId}' {$checked}>\n                            " . standard_text_escape($answer) . "\n                          </label>\n                        </div>";
        }
    }
    // end for()
    if ($answerType == MATCHING && $nbrAnswers > 0) {
        $tool_content .= "</table>";
    }
    if ($answerType == FILL_IN_BLANKS) {
        $tool_content .= "</div>";
    }
    if (!$nbrAnswers && $answerType != FREE_TEXT) {
        $tool_content .= "<div class='alert alert-danger'>{$langNoAnswer}</div>";
    }
    $tool_content .= "          \n                </div>\n            </div>";
    // destruction of the Answer object
    unset($objAnswerTmp);
    // destruction of the Question object
    unset($objQuestionTmp);
    return $nbrAnswers;
}
Exemplo n.º 19
0
                            </div>";
 }
 $tool_content .= "
 <div class='form-wrapper'>
     <form class='form-horizontal' role='form' method='post' action='$_SERVER[SCRIPT_NAME]?$url_params' onsubmit=\"return checkrequired(this, 'blogPostTitle');\">
     <fieldset>
     <div class='form-group'>
         <label for='blogPostTitle' class='col-sm-2 control-label'>$langBlogPostTitle:</label>
         <div class='col-sm-10'>
             <input class='form-control' type='text' name='blogPostTitle' id='blogPostTitle' value='".q($post->getTitle())."' placeholder='$langBlogPostTitle'>
         </div>
     </div>
     <div class='form-group'>
         <label for='newContent' class='col-sm-2 control-label'>$langBlogPostBody:</label>
         <div class='col-sm-10'>
             ".rich_text_editor('newContent', 4, 20, $post->getContent())."
         </div>
     </div>
     $commenting_setting
     <div class='form-group'>
         <div class='col-sm-10 col-sm-offset-2'>".
             form_buttons(array(
                 array(
                     'text'  =>  $langSave,
                     'name'  =>  'submitBlogPost',
                     'value' =>  $langModifBlogPost
                 ),
                 array(
                     'href'  =>  "$_SERVER[SCRIPT_NAME]?$url_params&amp;action=showBlog"
                 )
             ))
Exemplo n.º 20
0
     $object_selected = null;    
 $tool_content .= "
 <div class='form-wrapper'>
     <form id='myeventform' class='form-horizontal' role='form' method='post' action='$_SERVER[SCRIPT_NAME]' style='display:inline'>
     <input type='hidden' id='id' name='id' value='$eventToModify'>
     <input type='hidden' name='rep' id='rep' value='$applytogroup'>
     <div class='form-group'>
       <label for='newTitle' class='col-sm-2 control-label'>$langEventTitle:</label>
       <div class='col-sm-10'>
            <input class='form-control' type='text' name='newTitle' id='newTitle' value='$titleToModify' placeholder='$langEventTitle'>
       </div>
     </div>
     <div class='form-group'>
       <label for='newContent' class='col-sm-2 control-label'>$langEventBody:</label>
       <div class='col-sm-10'>
            " . rich_text_editor('newContent', 4, 20, $contentToModify) . "
       </div>
     </div>
     <div class='input-append date form-group' name='startdatecal' data-date='$langDate' data-date-format='dd-mm-yyyy'>
           <label for='startdate' class='col-sm-2 control-label'>$langDate:</label>
           <div class='col-sm-10'>
               <div class='input-group'>
                  <input class='form-control' type='text' name='startdate' id='startdate' value='$datetimeToModify'>
                  <div class='input-group-addon'><span class='add-on'><i class='fa fa-calendar fa-fw'></i></span></i></div>
               </div>
           </div>
     </div>
     <div class='input-append bootstrap-timepicker form-group'>
         <label for='durationcal' class='col-sm-2 control-label'>$langDuration <small>$langInHour</small></label>
         <div class='col-sm-10'>
             <div class='input-group add-on'>
Exemplo n.º 21
0
      <div class='col-sm-10'>
          " . @text_area('definition', 4, 60, $definition) . "
          <span class='help-block'>".Session::getError('definition')."</span>    
      </div>
 </div>
 <div class='form-group".(Session::getError('url') ? " has-error" : "")."'>
      <label for='url' class='col-sm-2 control-label'>$langGlossaryUrl: </label>
      <div class='col-sm-10'>
          <input type='text' class='form-control' id='url' name='url' value='$url'>
          <span class='help-block'>".Session::getError('url')."</span>     
      </div>
 </div>
 <div class='form-group'>
      <label for='notes' class='col-sm-2 control-label'>$langCategoryNotes: </label>
      <div class='col-sm-10'>
          " . @rich_text_editor('notes', 4, 60, $notes) . "
      </div>
 </div>
 $category_selection
 <div class='form-group'>    
      <div class='col-sm-10 col-sm-offset-2'>".form_buttons(array(
                  array(
                      'text' => $langSave,
                      'value'=> $submit_value,
                      'name' => 'submit'
                  ),
                  array(
                      'href' => $base_url,
                  )
              ))."</div>
  </div>
Exemplo n.º 22
0
}
//create blog post form
if ($action == "createPost") {
    if ($blog->permCreate($is_editor, $stud_allow_create, $uid)) {
        $tool_content .= "\r\n        <div class='form-wrapper'>\r\n            <form class='form-horizontal' role='form' method='post' action='{$_SERVER['SCRIPT_NAME']}?course=" . $course_code . "' onsubmit=\"return checkrequired(this, 'blogPostTitle');\">\r\n            <fieldset>\r\n                <div class='form-group'>\r\n                    <label for='blogPostTitle' class='col-sm-2 control-label'>{$langBlogPostTitle}:</label>\r\n                    <div class='col-sm-10'>\r\n                        <input class='form-control' type='text' name='blogPostTitle' id='blogPostTitle' placeholder='{$langBlogPostTitle}'>\r\n                    </div>\r\n                </div>\r\n                <div class='form-group'>\r\n                    <label for='newContent' class='col-sm-2 control-label'>{$langBlogPostBody}:</label>\r\n                    <div class='col-sm-10'>\r\n                        " . rich_text_editor('newContent', 4, 20, '') . "\r\n                    </div>\r\n                </div> \r\n                <div class='form-group'>\r\n                    <div class='col-sm-10 col-sm-offset-2'>\r\n                        <input class='btn btn-primary' type='submit' name='submitBlogPost' value='{$langAdd}'>\r\n                        <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=showBlog' class='btn btn-default'>{$langCancel}</a>\r\n                    </div>\r\n                </div>          \r\n                <input type='hidden' name='action' value='savePost' />\r\n            </fieldset>\r\n            </form>\r\n        </div>";
    } else {
        Session::Messages($langBlogPostNotAllowedCreate);
        redirect_to_home_page("modules/blog/index.php?course={$course_code}");
    }
}
//edit blog post form
if ($action == "editPost") {
    $post = new BlogPost();
    if ($post->loadFromDB($pId)) {
        if ($post->permEdit($is_editor, $stud_allow_create, $uid)) {
            $tool_content .= "\r\n            <div class='form-wrapper'>\r\n                <form class='form-horizontal' role='form' method='post' action='{$_SERVER['SCRIPT_NAME']}?course=" . $course_code . "' onsubmit=\"return checkrequired(this, 'blogPostTitle');\">\r\n                <fieldset>\r\n                <div class='form-group'>\r\n                    <label for='blogPostTitle' class='col-sm-2 control-label'>{$langBlogPostTitle}:</label>\r\n                    <div class='col-sm-10'>\r\n                        <input class='form-control' type='text' name='blogPostTitle' id='blogPostTitle' value='" . q($post->getTitle()) . "' placeholder='{$langBlogPostTitle}'>\r\n                    </div>\r\n                </div>\r\n                <div class='form-group'>\r\n                    <label for='newContent' class='col-sm-2 control-label'>{$langBlogPostBody}:</label>\r\n                    <div class='col-sm-10'>\r\n                        " . rich_text_editor('newContent', 4, 20, '', $post->getContent()) . "\r\n                    </div>\r\n                </div>\r\n                <div class='form-group'>\r\n                    <div class='col-sm-10 col-sm-offset-2'>\r\n                        <input class='btn btn-primary' type='submit' name='submitBlogPost' value='{$langModifBlogPost}'>\r\n                        <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;action=showBlog' class='btn btn-default'>{$langCancel}</a>\r\n                    </div>\r\n                </div>              \r\n                <input type='hidden' name='action' value='savePost'>\r\n                <input type='hidden' name='pId' value='" . $post->getId() . "'>\r\n                </fieldset>\r\n            </form>\r\n        </div>";
        } else {
            Session::Messages($langBlogPostNotAllowedEdit);
            redirect_to_home_page("modules/blog/index.php?course={$course_code}");
        }
    } else {
        Session::Messages($langBlogPostNotFound);
        redirect_to_home_page("modules/blog/index.php?course={$course_code}");
    }
}
//save blog post
if ($action == "savePost") {
    if (isset($_POST['submitBlogPost']) && $_POST['submitBlogPost'] == $langAdd) {
        if ($blog->permCreate($is_editor, $stud_allow_create, $uid)) {
            $post = new BlogPost();
            if ($post->create($_POST['blogPostTitle'], purify($_POST['newContent']), $uid, $course_id)) {
Exemplo n.º 23
0
/**
 * @brief edit resource
 * @global type $id
 * @global type $urlServer
 * @global type $langTitle
 * @global type $langDescr 
 * @global type $langContents
 * @global type $langModify
 * @global type $course_code
 * @param type $resource_id
 * @return string
 */
function edit_res($resource_id)
{
    global $id, $urlServer, $langTitle, $langDescr, $langContents, $langModify, $course_code;
    $ru = Database::get()->querySingle("SELECT id, title, comments, type FROM unit_resources WHERE id = ?d", $resource_id);
    $restitle = " value='" . htmlspecialchars($ru->title, ENT_QUOTES) . "'";
    $rescomments = $ru->comments;
    $resource_id = $ru->id;
    $resource_type = $ru->type;
    $content = "<div class='form-wrapper'>";
    $content .= "<form class='form-horizontal' role='form' method='post' action='{$urlServer}modules/units/?course={$course_code}'>" . "<fieldset>" . "<input type='hidden' name='id' value='{$id}'>" . "<input type='hidden' name='resource_id' value='{$resource_id}'>";
    if ($resource_type != 'text') {
        $content .= "<div class='form-group'>                   \n                <label class='col-sm-2 control-label'>{$langTitle}:</label>\n                <div class='col-sm-10'><input type='text' name='restitle' size='50' maxlength='255' {$restitle}></div>\n                </div>";
        $message = $langDescr;
    } else {
        $message = $langContents;
    }
    $content .= "<div class='form-group'><label class='col-sm-2 control-label'>{$message}:</label>\n                              <div class='col-sm-10'>" . rich_text_editor('rescomments', 4, 20, $rescomments) . "</div>\n                </div>                         \n                <div class='col-sm-offset-2 col-sm-10'><input class='btn btn-primary' type='submit' name='edit_res_submit' value='{$langModify}'></div>\n                </fieldset>\n                </form></div>";
    return $content;
}
Exemplo n.º 24
0
     $id = intval($_GET['modify']);
     //all activity data (check if it is in this attendance)
     $mofifyActivity = Database::get()->querySingle("SELECT * FROM attendance_activities WHERE id = ?d AND attendance_id = ?d", $id, $attendance_id);
     $titleToModify = $mofifyActivity->title;
     $contentToModify = $mofifyActivity->description;
     $attendanceActivityToModify = $id;
     $date = $mofifyActivity->date;
     $module_auto_id = $mofifyActivity->module_auto_id;
     $auto = $mofifyActivity->auto;
 } else {
     //new activity
     $attendanceActivityToModify = "";
     $titleToModify = '';
     $contentToModify = '';
 }
 $tool_content .= "<div class='form-group'>\n                                <label for='actTitle' class='col-sm-2 control-label'>{$langTitle}:</label>\n                                <div class='col-sm-10'>\n                                    <input class='form-control' type='text' name='actTitle' value='{$titleToModify}' />\n                                </div>\n                            </div>\n                            <div class='form-group'>\n                                <label for='date' class='col-sm-2 control-label'>{$langAttendanceActivityDate}:</label>\n                                <div class='col-sm-10'>\n                                    <input class='form-control' type='text' name='date' value='" . @datetime_remove_seconds($date) . "'>\n                                </div>\n                            </div>\n                            <div class='form-group'>\n                                <label for='actDesc' class='col-sm-2 control-label'>{$langDescription}:</label>\n                                <div class='col-sm-10'>\n                                    " . rich_text_editor('actDesc', 4, 20, $contentToModify) . "\n                                </div>\n                            </div>";
 if (isset($module_auto_id) and $module_auto_id) {
     //accept the auto booking mechanism
     $tool_content .= "<div class='form-group'>\n                                <label for='actDesc' class='col-sm-2 control-label'>{$langAttendanceAutoBook}:</label>\n                                        <div class='col-sm-10'>\n                                        <input class='form-control' type='checkbox' value='1' name='auto' ";
     if ($auto) {
         $tool_content .= " checked";
     }
     $tool_content .= " /></div></div>";
 }
 $tool_content .= "\n                            <div class='form-group'>\n                                <div class='col-sm-offset-2 col-sm-10'>\n                                    <input class='btn btn-primary' type='submit' name='submitAttendanceActivity' value='{$langAdd}' />\n                                </div>\n                            </div>";
 if (isset($_GET['modify'])) {
     $tool_content .= "\n                                                <input type='hidden' name='id' value='" . $attendanceActivityToModify . "' />";
 }
 $tool_content .= "</fieldset>\n                    </form>\n                </div>\n            </div>\n        </div>";
 //do not show the activities list
 $showAttendanceActivities = 0;
Exemplo n.º 25
0
                 </div>
             ";
     $tool_content .= "<div class='input-append date' id='enddatecal' data-date='$langDate' data-date-format='dd-mm-yyyy'>
         <label for='Enddate' class='col-sm-2 control-label'>$langUntil :</label>
             <div class='col-sm-4'>
                 <div class='input-group'>
                     <input class='form-control' name='enddate' id='enddate' type='text' value = '" .$enddate . "'>
                     <div class='input-group-addon'><span class='add-on'><i class='fa fa-calendar fa-fw'></i></span></i></div>
                 </div>
             </div>
         </div>
       </div>";
 /**** end of recursion paramneters *****/
  $tool_content .= "<div class='form-group'>
                 <label for='Detail' class='col-sm-2 control-label'>$langDetail :</label>
                 <div class='col-sm-10'>" . rich_text_editor('content', 4, 20, $content) . "</div>
               </div>            
               <div class='form-group'>
                 <div class='col-sm-offset-2 col-sm-10'>".
                     form_buttons(array(
                         array(
                             'text'  => $langSave,
                             'name'  => 'submitbtn',
                             'value' => $langAddModify
                         ),
                         array(
                             'href' => "index.php?course=$course_code",
                         )
                     ))
                     ."
                 </div>
Exemplo n.º 26
0
 // display add announcement command
 $navigation[] = array("url" => "{$_SERVER['SCRIPT_NAME']}", "name" => $langAdminAn);
 if (!isset($contentToModify)) {
     $contentToModify = '';
 }
 if (!isset($titleToModify)) {
     $titleToModify = '';
 }
 $tool_content .= "<div class='form-wrapper'>";
 $tool_content .= "<form role='form' class='form-horizontal' method='post' action='{$_SERVER['SCRIPT_NAME']}'>";
 if (isset($_GET['modify'])) {
     $tool_content .= "<input type='hidden' name='id' value='{$id}' />";
 }
 $tool_content .= "<fieldset>";
 $tool_content .= "<div class='form-group'>";
 $tool_content .= "<label for='title' class='col-sm-2 control-label'>{$langTitle}:</label>\n                        <div class='col-sm-10'><input type='text' name='title' value='{$titleToModify}' size='50' /></div>\n                    </div>\n                    <div class='form-group'>\n                        <label for='newContent' class='col-sm-2 control-label'>{$langAnnouncement}:</label>\n                    <div class='col-sm-10'>" . rich_text_editor('newContent', 5, 40, $contentToModify) . "</div></div>";
 $tool_content .= "<div class='form-group'><label class='col-sm-2 control-label'>{$langLanguage}:</label>";
 if (isset($_GET['modify'])) {
     if (isset($begindate)) {
         $start_checkbox = 'checked';
         $startdate = $begindate;
     } else {
         $start_checkbox = '';
         $startdate = date('d-m-Y H:i', strtotime('now'));
     }
     if (isset($enddate)) {
         $end_checkbox = 'checked';
     } else {
         $end_checkbox = '';
         $enddate = date('d-m-Y H:i', strtotime('now +1 month'));
     }
Exemplo n.º 27
0
/**
 * @param string $code
 * @param string $title
 * @param string $prof
 * @param string $lang
 * @param string $type - can be null
 * @param int $vis
 * @param string $desc
 * @param mixed $faculty - can be null
 */
function course_details_form($code, $title, $prof, $lang, $type, $vis, $desc, $faculty) {
    global $langInfo1, $langInfo2, $langCourseCode, $langLanguage, $langTitle,
    $langCourseDescription, $langFaculty, $langCourseVis,
    $langTeacher, $langUsersWillAdd,
    $langOk, $langAll, $langsTeachers, $langMultiRegType,
    $langNone, $langOldValue, $treeObj, $langBack, $course_code;

    list($tree_js, $tree_html) = $treeObj->buildCourseNodePicker();
    if ($type) {
        if (isset($GLOBALS['lang' . $type])) {
            $type_label = ' (' . $GLOBALS['lang' . $type] . ')';
        } else {
            $type_label = ' (' . $type . ')';
        }
    } else {
        $type_label = '';
    }
    if (is_array($faculty)) {
        foreach ($faculty as $entry) {
            $old_faculty_names[] = q(Hierarchy::unserializeLangField($entry['name']));
        }
        $old_faculty = implode('<br>', $old_faculty_names);
    } else {
        $old_faculty = q(Hierarchy::unserializeLangField($faculty) . $type_label);
    }
    $formAction = $_SERVER['SCRIPT_NAME'];
    if (isset($GLOBALS['course_code'])) {
        $formAction .= '?course=' . $GLOBALS['course_code'];
    }
    return action_bar(array(
        array('title' => $langBack,
              'url' => "index.php?course=$course_code",
              'icon' => 'fa-reply',
              'level' => 'primary-label'))) . "
        <div class='alert alert-info'>$langInfo1 <br> $langInfo2</div>
                <div class='row'>
                <div class='col-md-12'>
                <div class='form-wrapper' >
                <form class='form-horizontal' role='form' action='$formAction' method='post' onsubmit='return validateNodePickerForm();' >

                    <div class='form-group'>
                        <label for='course_code' class='col-sm-3 control-label'>$langCourseCode:</label>
                        <div class='col-sm-9'>
                            <input type='text' class='form-control' id='course_code' name='course_code' value='" . q($code) . "'>
                        </div>
                    </div>
                    <div class='form-group'>
                        <label for='course_code' class='col-sm-3 control-label'>$langLanguage:</label>
                        <div class='col-sm-9'>
                            " . lang_select_options('course_lang') . "
                        </div>
                    </div>
                    <div class='form-group'>
                        <label for='course_title' class='col-sm-3 control-label'>$langTitle:</label>
                        <div class='col-sm-9'>
                            <input class='form-control' type='text' id='course_title' name='course_title' value='" . q($title) . "' />
                        </div>
                    </div>

                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langCourseDescription:</label>
                        <div class='col-sm-9'>
                            " . rich_text_editor('course_desc', 10, 40, purify($desc)) . "
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langFaculty:</label>
                        <div class='col-sm-9'>
                            " . $tree_html . "<br>$langOldValue: <i>$old_faculty</i>
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langCourseVis:</label>
                        <div class='col-sm-9'>
                            " . visibility_select($vis) . "
                        </div>
                    </div>
                    <div class='form-group'>
                        <label for='course_prof' class='col-sm-3 control-label'>$langTeacher:</label>
                        <div class='col-sm-9'>
                            <input class='form-control' type='text' id='course_prof' name='course_prof' value='" . q($prof) . "' size='50' />
                        </div>
                    </div>
                    <div class='form-group'>
                    <label class='col-sm-3 control-label'>$langUsersWillAdd:</label>

                        <div class='col-sm-9'>
                            <input type='radio' name='add_users' value='all' id='add_users_all' checked='checked'>
                           $langAll<br>
                           <input type='radio' name='add_users' value='prof' id='add_users_prof'>
                           $langsTeachers<br>
                           <input type='radio' name='add_users' value='none' id='add_users_none'>
                           $langNone
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-sm-3 control-label'>$langMultiRegType:</label>
                        <div class='col-sm-9'>
                            <input type='checkbox' name='create_users' value='1' id='create_users' checked='checked'>
                        </div>
                    </div>
                    <div class='form-group'>
                        <div class='col-sm-offset-3 col-sm-9'>
                        <input class='btn btn-primary' type='submit' name='create_restored_course' value='$langOk' />
                      <input type='hidden' name='restoreThis' value='" . q($_POST['restoreThis']) . "' />
                          </div>
                    </div>
                " . generate_csrf_token_form_field() . "
                </form>
                </div>
                </div>
                </div>
    ";
}
Exemplo n.º 28
0
function commentBox($type, $mode)
{
    global $is_editor, $langModify, $langSubmit, $langAdd, $langConfirmYourChoice, $langDefaultLearningPathComment, $langDefaultModuleComment, $langDefaultModuleAddedComment, $langDelete, $course_code, $course_id;
    // will be set 'true' if the comment has to be displayed
    $dsp = false;
    $output = "";
    // those vars will be used to build sql queries according to the comment type
    switch ($type) {
        case MODULE_:
            $defaultTxt = $langDefaultModuleComment;
            $col_name = 'comment';
            $tbl_name = 'lp_module';
            if (isset($_REQUEST['module_id'])) {
                $module_id = $_REQUEST['module_id'];
            } else {
                $module_id = $_SESSION['lp_module_id'];
            }
            $where_cond = "`module_id` = " . intval($module_id) . " AND `course_id` = " . intval($course_id);
            break;
        case LEARNINGPATH_:
            $defaultTxt = $langDefaultLearningPathComment;
            $col_name = 'comment';
            $tbl_name = 'lp_learnPath';
            $where_cond = '`learnPath_id` = ' . intval($_SESSION['path_id']) . " AND `course_id` = " . intval($course_id);
            break;
        case LEARNINGPATHMODULE_:
            $defaultTxt = $langDefaultModuleAddedComment;
            $col_name = 'specificComment';
            $tbl_name = 'lp_rel_learnPath_module';
            $where_cond = "`learnPath_id` = " . intval($_SESSION['path_id']) . " AND `module_id` = " . intval($_SESSION['lp_module_id']);
            break;
    }
    // update mode
    // allow to chose between
    // - update and show the comment and the pencil and the delete cross (UPDATE_)
    // - update and nothing displayed after form sent (UPDATENOTSHOWN_)
    if (($mode == UPDATE_ || $mode == UPDATENOTSHOWN_) && $is_editor) {
        if (isset($_POST['insertCommentBox'])) {
            Database::get()->query("UPDATE {$tbl_name} SET {$col_name} = ?s WHERE " . $where_cond . "", $_POST['insertCommentBox']);
            if ($mode == UPDATE_) {
                $dsp = true;
            } else {
                if ($mode == UPDATENOTSHOWN_) {
                    $dsp = false;
                }
            }
        } else {
            // display form
            // get info to fill the form in
            $sql = "SELECT `" . $col_name . "`\n                       FROM `" . $tbl_name . "`\n                      WHERE " . $where_cond;
            $oldComment = Database::get()->querySingle($sql)->{$col_name};
            $output .= "<form method='POST' action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}'>\n                " . rich_text_editor('insertCommentBox', 1, 50, $oldComment) . "\n                <input type='hidden' name='cmd' value='update{$col_name}' />\n                <input class='btn btn-primary' type='submit' value={$langSubmit} /></form>";
        }
    }
    // delete mode
    if ($mode == DELETE_ && $is_editor) {
        $sql = "UPDATE `" . $tbl_name . "`\n                 SET `" . $col_name . "` = ''\n                 WHERE " . $where_cond;
        Database::get()->query($sql);
        $dsp = TRUE;
    }
    // display mode only or display was asked by delete mode or update mode
    if ($mode == DISPLAY_ || $dsp == TRUE) {
        $sql = "SELECT `" . $col_name . "`\n                FROM `" . $tbl_name . "`\n                WHERE " . $where_cond;
        $result = Database::get()->querySingle($sql);
        $currentComment = $result && !empty($result->{$col_name}) ? $result->{$col_name} : false;
        // display nothing if this is default comment and not an admin
        if ($currentComment == $defaultTxt && !$is_editor) {
            return $output;
        }
        if (empty($currentComment)) {
            // if no comment and user is admin : display link to add a comment
            if ($is_editor) {
                $output .= '<a href="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&amp;cmd=update' . $col_name . '">' . $langAdd . '</a>';
            }
        } else {
            // display comment
            $output .= q($currentComment);
            // display edit and delete links if user as the right to see it
            if ($is_editor) {
                $output .= '&nbsp;&nbsp;&nbsp;' . icon('fa-edit', $langModify, $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&amp;cmd=update' . $col_name . "") . '<a href="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&amp;cmd=del' . $col_name . '" ' . ' onclick="javascript:if(!confirm(\'' . clean_str_for_javascript($langConfirmYourChoice) . '\')) return false;">' . "\n" . icon('fa-times', $langDelete) . "</a>";
            }
        }
    }
    return $output;
}
Exemplo n.º 29
0
 <div class='form-group'>
     <label for='prof_names' class='col-sm-2 control-label'>$langTeachers:</label>
     <div class='col-sm-10'>
           <input class='form-control' type='text' name='prof_names' id='prof_names' value='" . q($prof_names) . "'>
     </div>
 </div>
 <div class='form-group'>
     <label for='localize' class='col-sm-2 control-label'>$langLanguage:</label>
     <div class='col-sm-10'>
           " . lang_select_options('localize', "class='form-control'") . "
     </div>
 </div>
 <div class='form-group'>
     <label for='description' class='col-sm-2 control-label'>$langDescrInfo <small>$langOptional</small>:</label>
     <div class='col-sm-10'>
           ".  rich_text_editor('description', 4, 20, @$description)."
     </div>
 </div>
 <div class='form-group'>
     <label class='col-sm-2 control-label'>$langCourseFormat:</label>
     <div class='col-sm-10'>
         <div class='radio'>
           <label>
             <input type='radio' name='view_type' value='simple' id='simple'>
             $langCourseSimpleFormat
           </label>
         </div>
         <div class='radio'>
           <label>
             <input type='radio' name='view_type' value='units' id='units' checked>
             $langWithCourseUnits
Exemplo n.º 30
0
            if ($comment && $comment->comment) {
                $tool_content .= "<form method='post' action='" . $_SERVER['SCRIPT_NAME'] . "?course=$course_code'>
                    <div class='table-responsive'>
                    <table class='table-default'>
                    <tr><th class='left' colspan='2'>$langComments:</th></tr>
                    <tr><td colspan='2'>" . rich_text_editor('comment', 2, 60, $comment->comment) . "
                    <input type='hidden' name='cmd' value='exComment'>
                    <input type='hidden' name='module_id' value='$module_id'>
                    </td></tr>
                    <tr><td><input class='btn btn-primary' type='submit' value='$langImport'>
                    </td></tr></table></div>
                    </form>";
            } else {
                $tool_content .= "<form method='post' action='" . $_SERVER['SCRIPT_NAME'] . "?course=$course_code'>\n"
                        . '<table class="table-default"><tr><td>' . ""
                        . rich_text_editor('comment', 2, 30, '')
                        . "</td></tr></table>\n"
                        . "<input type='hidden' name='cmd' value='exComment'>\n"
                        . "<input type='hidden' name='module_id' value='$module_id'>\n"
                        . "<input class='btn btn-primary' type='submit' value='$langOk'>\n"
                        . "<br /><br />"
                        . "</form>";
            }
        } // else no module_id
        break;

    //make update to change the comment in the database for this module
    case "exComment":
        if (isset($_POST['comment']) && is_string($_POST['comment']) && isset($_POST['module_id']) && is_numeric($_POST['module_id'])) {
            Database::get()->query("UPDATE `lp_module`
                    SET `comment` = ?s