" method="post" ng-submit="add($event)"> <div class="panel col-md-6" style="margin-top: 20px;"> <div class="panel-heading"> <div class="panel-title">Create Course</div> </div> <div class="panel-body"> <div class="control-group"> <label for="name">Name of course</label> <input ng-model="name" class="form-control" type="text" required="required" name="name" id="name" placeholder="Name of Course" /> </div> <div class="control-group"> <button type="submit" class="btn btn-primary" style="margin-top: 20px;">Create</button> </div> </div> </div> </form> </div> </div> </div> <div class = "course-data hidden"> <?php $obj = new Course(); echo json_encode($obj->getList(array('id', 'course_name'))); ?> </div> <script> $(document).ready(function(){ $("[data-toggle='tooltip'").tooltip(); }); </script>
function getListAdmin(Course $obj) { return $obj->getList(array('id', 'course_name')); }
function showCourse() { global $connector; $page = "course.php"; $course = new Course(); $course->setConnector($connector); if ($_POST['operation']) { list($operation, $params) = explode("#", $_POST['operation']); switch ($operation) { case 'saveChanges': $course->storeFormValues($_POST); $error_msg = $course->insert(); if ($error_msg) { $result['edit'] = $course; } break; case 'delete': $error_msg = $course->delete($params); break; case 'edit': $result['edit'] = $course->getById($params); break; case 'editChanges': $course->storeFormValues($_POST); $error_msg = $course->update(); break; default: $error_msg = "Operazione non valida"; } if ($error_msg != "") { $result["errorMessage"] = $error_msg; } elseif ($operation != 'edit') { $result["statusMessage"] = "Operazione completata!"; } } if (isset($_POST['search'])) { $result["courses"] = $course->search($_POST['search']); } else { $result["courses"] = $course->getList(); } $page = "course.php"; include_once BASE_PATH . "template.php"; }
<?php $obj = new QuestionBank(); $course = new Course(); $course_list = $course->getList(array('id', 'course_name')); ?> <div class="container" ng-element-ready = "createTable()"> <div class="row"> <a href="manage-question" ng-hide="create" ng-click="create = true" class="btn btn-primary btn-lg fx-fade-up fx-dur-0">Create Question Bank</a> <a href="manage-question" ng-show="create" ng-click="create = false" class="btn btn-primary btn-lg fx-fade-up fx-dur-0">Back</a> </div> <div class="row"> <div ng-hide="create"> <table class="table table-bordered table-bordered" id="qb_table"> <thead> <tr> <th>#</th><th>Name</th><th>Course</th><th></th> </tr> </thead> <tbody> <tr ng-repeat="qb in qbs"> <td>{{$index+1}}</td> <td>{{qb.name}}</td> <td>{{qb.course_name}}</td> <td> <a href="add-question/{{qb.id}}" class="btn btn-primary" data-toggle="tooltip" title="Add questions"><span class="fa fa-plus"></span></a> <a href="#" class="btn btn-info" data-toggle="tooltip" title="Edit exam info"><span class="fa fa-edit"></span></a> <a href="manage-question" class="btn btn-danger delete" data-toggle="tooltip" title="Delete Question Bank" ng-click="delete($event, qb.id)"><span class="fa fa-times"></span></a> </td> </tr> </tbody>