public static function tagInput($id = null) { global $langTags, $head_content, $course_code; // initialize the tags $answer = ''; if (isset($id)) { require_once 'modules/tags/moduleElement.class.php'; $moduleTag = new ModuleElement($id); $tags_init = $moduleTag->getTags(); foreach ($tags_init as $key => $tag) { $arrayTemp = "{id:\"" . js_escape($tag) . "\" , text:\"" . js_escape($tag) . "\"},"; $answer = $answer . $arrayTemp; } } $head_content .= " <script> $(function () { $('#tags').select2({ minimumInputLength: 2, tags: true, tokenSeparators: [', '], createSearchChoice: function(term, data) { if ($(data).filter(function() { return this.text.localeCompare(term) === 0; }).length === 0) { return { id: term, text: term }; } }, ajax: { url: '../tags/feed.php', dataType: 'json', data: function(term, page) { return { course: '" . js_escape($course_code) . "', q: term }; }, results: function(data, page) { return {results: data}; } } }); $('#tags').select2('data', [".$answer."]); }); </script>"; $input_field = " <div class='form-group'> <label for='tags' class='col-sm-2 control-label'>$langTags:</label> <div class='col-sm-10'> <input type='hidden' id='tags' class='form-control' name='tags' value=''> </div> </div> "; return $input_field; }
/** * Display the specified resource. * GET /studentmodulemarksinputs/{id} * * @param int $id * @return Response */ public function show($course) { // $courses_id = DB::table('application_courses')->where('name', '=', $course)->first()->id; $registered_students = DB::table('student_course_enrolments')->where('course_name', '=', intval($courses_id))->select('san')->groupBy('san')->get(); return View::make('studentModuleMarksInputs.index')->with('modules', DB::table('modules')->where('course_id', '=', $courses_id)->get())->with('elements', ModuleElement::lists('name', 'id'))->with('students', $registered_students)->with('course_id', $courses_id)->with('markers', ModuleMarker::lists('name', 'name')); }
} if ($link['previous'] != ' ' or $link['next'] != ' ') { $tool_content .= " <div class='row'> <div class='col-md-12'> <div class='panel panel-default'> <div class='panel-body'> $link[previous] $link[next] </div> </div> </div> </div>"; } $moduleTag = new ModuleElement($id); $tags_list = $moduleTag->showTags(); $tool_content .= " <div class='row'> <div class='col-md-12'> <div class='panel panel-default'> <div class='panel-heading'> <h3 class='panel-title'>$pageName</h3> </div> <div class='panel-body'>$comments"; if (!empty($tags_list)) { $tool_content .= " <div> $langTags: $tags_list </div>
/** * * @global type $langCourseUnitModified * @global type $langCourseUnitAdded * @global null $maxorder * @global type $course_id * @global type $course_code * @global type $webDir * @return type */ function handle_unit_info_edit() { global $langCourseUnitModified, $langCourseUnitAdded, $maxorder, $course_id, $course_code, $webDir; require_once 'modules/tags/moduleElement.class.php'; $title = $_REQUEST['unittitle']; $descr = $_REQUEST['unitdescr']; if (isset($_REQUEST['unit_id'])) { // update course unit $unit_id = $_REQUEST['unit_id']; Database::get()->query("UPDATE course_units SET\n title = ?s,\n comments = ?s\n WHERE id = ?d AND course_id = ?d", $title, $descr, $unit_id, $course_id); // tags if (isset($_POST['tags'])) { $tagsArray = explode(',', $_POST['tags']); $moduleTag = new ModuleElement($unit_id); $moduleTag->syncTags($tagsArray); } $successmsg = $langCourseUnitModified; } else { // add new course unit $order = $maxorder + 1; $q = Database::get()->query("INSERT INTO course_units SET\n title = ?s, comments = ?s, visible = 1,\n `order` = ?d, course_id = ?d", $title, $descr, $order, $course_id); $successmsg = $langCourseUnitAdded; $unit_id = $q->lastInsertID; // tags if (isset($_POST['tags'])) { $tagsArray = explode(',', $_POST['tags']); $moduleTag = new ModuleElement($unit_id); $moduleTag->attachTags($tagsArray); } } // update index require_once 'modules/search/indexer.class.php'; Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_UNIT, $unit_id); Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_COURSE, $course_id); // refresh course metadata require_once 'modules/course_metadata/CourseXML.php'; CourseXMLElement::refreshCourse($course_id, $course_code); Session::Messages($successmsg, 'alert-success'); redirect_to_home_page("modules/units/index.php?course={$course_code}&id={$unit_id}"); }
function assignment_details($id, $row) { global $tool_content, $is_editor, $course_code, $themeimg, $m, $langDaysLeft, $langDays, $langWEndDeadline, $langNEndDeadLine, $langNEndDeadline, $langEndDeadline, $langDelAssign, $langAddGrade, $langZipDownload, $langTags, $langSaved, $langGraphResults, $langWorksDelConfirm, $langWorkFile, $course_id, $langEditChange; if ($is_editor) { $tool_content .= action_bar(array( array( 'title' => $langAddGrade, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$id&choice=add", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success' ), array( 'title' => $langZipDownload, 'icon' => 'fa-file-archive-o', 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&download=$id", 'level' => 'primary' ), array( 'title' => $langGraphResults, 'icon' => 'fa-bar-chart', 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$id&disp_results=true" ), array( 'title' => $m['WorkUserGroupNoSubmission'], 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$id&disp_non_submitted=true", 'icon' => 'fa-minus-square' ), array( 'title' => $langDelAssign, 'icon' => 'fa-times', 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$id&choice=do_delete", 'button-class' => "btn-danger", 'confirm' => "$langWorksDelConfirm" ) )); } $deadline = (int)$row->deadline ? nice_format($row->deadline, true) : $m['no_deadline']; if ($row->time > 0) { $deadline_notice = "<br><span>($langDaysLeft " . format_time_duration($row->time) . ")</span>"; } elseif ((int)$row->deadline) { $deadline_notice = "<br><span class='text-danger'>$langEndDeadline</span>"; } $moduleTag = new ModuleElement($id); $tool_content .= " <div class='panel panel-action-btn-primary'> <div class='panel-heading'> <div class='pull-right'> ". (($is_editor) ? action_button(array( array( 'title' => $langEditChange, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$id&choice=edit", 'level' => 'primary-label', 'icon' => 'fa-edit' ) )) : "")." </div> <h3 class='panel-title'> $m[WorkInfo] </h3> </div> <div class='panel-body'> <div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$m[title]:</strong> </div> <div class='col-sm-9'> " . q($row->title) . " </div> </div>"; if (!empty($row->description)) { $tool_content .= "<div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$m[description]:</strong> </div> <div class='col-sm-9'> $row->description </div> </div>"; } if (!empty($row->comments)) { $tool_content .= "<div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$m[comments]:</strong> </div> <div class='col-sm-9'> $row->comments </div> </div>"; } if (!empty($row->file_name)) { $tool_content .= "<div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$langWorkFile:</strong> </div> <div class='col-sm-9'> <a href='$_SERVER[SCRIPT_NAME]?course=$course_code&get=$row->id&file_type=1'>$row->file_name</a> </div> </div>"; } $tool_content .= " <div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$m[max_grade]:</strong> </div> <div class='col-sm-9'> $row->max_grade </div> </div> <div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$m[start_date]:</strong> </div> <div class='col-sm-9'> " . nice_format($row->submission_date, true) . " </div> </div> <div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$m[deadline]:</strong> </div> <div class='col-sm-9'> $deadline ".(isset($deadline_notice) ? $deadline_notice : "")." </div> </div> <div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$m[group_or_user]:</strong> </div> <div class='col-sm-9'> ".(($row->group_submissions == '0') ? $m['user_work'] : $m['group_work'])." </div> </div>"; $tags_list = $moduleTag->showTags(); if ($tags_list) $tool_content .= " <div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$langTags:</strong> </div> <div class='col-sm-9'> $tags_list </div> </div> "; $tool_content .= " </div> </div>"; }
public function getElementsByModuleID() { $module_id = Input::get('option'); return ModuleElement::where('module_id', '=', $module_id)->lists('name', 'id'); }