[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * This file contains the definition for the renderable classes for the assignment 19 * 20 * @package mod_assign 21 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 27 /** 28 * This class wraps the submit for grading confirmation page 29 * @package mod_assign 30 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 */ 33 class assign_submit_for_grading_page implements renderable { 34 /** @var array $notifications is a list of notification messages returned from the plugins */ 35 public $notifications = array(); 36 /** @var int $coursemoduleid */ 37 public $coursemoduleid = 0; 38 /** @var moodleform $confirmform */ 39 public $confirmform = null; 40 41 /** 42 * Constructor 43 * @param string $notifications - Any mesages to display 44 * @param int $coursemoduleid 45 * @param moodleform $confirmform 46 */ 47 public function __construct($notifications, $coursemoduleid, $confirmform) { 48 $this->notifications = $notifications; 49 $this->coursemoduleid = $coursemoduleid; 50 $this->confirmform = $confirmform; 51 } 52 53 } 54 55 /** 56 * Implements a renderable message notification 57 * @package mod_assign 58 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 59 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 60 */ 61 class assign_gradingmessage implements renderable { 62 /** @var string $heading is the heading to display to the user */ 63 public $heading = ''; 64 /** @var string $message is the message to display to the user */ 65 public $message = ''; 66 /** @var int $coursemoduleid */ 67 public $coursemoduleid = 0; 68 /** @var int $gradingerror should be set true if there was a problem grading */ 69 public $gradingerror = null; 70 71 /** 72 * Constructor 73 * @param string $heading This is the heading to display 74 * @param string $message This is the message to display 75 * @param bool $gradingerror Set to true to display the message as an error. 76 * @param int $coursemoduleid 77 * @param int $page This is the current quick grading page 78 */ 79 public function __construct($heading, $message, $coursemoduleid, $gradingerror = false, $page = null) { 80 $this->heading = $heading; 81 $this->message = $message; 82 $this->coursemoduleid = $coursemoduleid; 83 $this->gradingerror = $gradingerror; 84 $this->page = $page; 85 } 86 87 } 88 89 /** 90 * Implements a renderable grading options form 91 * @package mod_assign 92 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 93 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 94 */ 95 class assign_form implements renderable { 96 /** @var moodleform $form is the edit submission form */ 97 public $form = null; 98 /** @var string $classname is the name of the class to assign to the container */ 99 public $classname = ''; 100 /** @var string $jsinitfunction is an optional js function to add to the page requires */ 101 public $jsinitfunction = ''; 102 103 /** 104 * Constructor 105 * @param string $classname This is the class name for the container div 106 * @param moodleform $form This is the moodleform 107 * @param string $jsinitfunction This is an optional js function to add to the page requires 108 */ 109 public function __construct($classname, moodleform $form, $jsinitfunction = '') { 110 $this->classname = $classname; 111 $this->form = $form; 112 $this->jsinitfunction = $jsinitfunction; 113 } 114 115 } 116 117 /** 118 * Implements a renderable user summary 119 * @package mod_assign 120 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 121 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 122 */ 123 class assign_user_summary implements renderable { 124 /** @var stdClass $user suitable for rendering with user_picture and fullname(). */ 125 public $user = null; 126 /** @var int $courseid */ 127 public $courseid; 128 /** @var bool $viewfullnames */ 129 public $viewfullnames = false; 130 /** @var bool $blindmarking */ 131 public $blindmarking = false; 132 /** @var int $uniqueidforuser */ 133 public $uniqueidforuser; 134 /** @var array $extrauserfields */ 135 public $extrauserfields; 136 /** @var bool $suspendeduser */ 137 public $suspendeduser; 138 139 /** 140 * Constructor 141 * @param stdClass $user 142 * @param int $courseid 143 * @param bool $viewfullnames 144 * @param bool $blindmarking 145 * @param int $uniqueidforuser 146 * @param array $extrauserfields 147 * @param bool $suspendeduser 148 */ 149 public function __construct(stdClass $user, 150 $courseid, 151 $viewfullnames, 152 $blindmarking, 153 $uniqueidforuser, 154 $extrauserfields, 155 $suspendeduser = false) { 156 $this->user = $user; 157 $this->courseid = $courseid; 158 $this->viewfullnames = $viewfullnames; 159 $this->blindmarking = $blindmarking; 160 $this->uniqueidforuser = $uniqueidforuser; 161 $this->extrauserfields = $extrauserfields; 162 $this->suspendeduser = $suspendeduser; 163 } 164 } 165 166 /** 167 * Implements a renderable feedback plugin feedback 168 * @package mod_assign 169 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 170 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 171 */ 172 class assign_feedback_plugin_feedback implements renderable { 173 /** @var int SUMMARY */ 174 const SUMMARY = 10; 175 /** @var int FULL */ 176 const FULL = 20; 177 178 /** @var assign_submission_plugin $plugin */ 179 public $plugin = null; 180 /** @var stdClass $grade */ 181 public $grade = null; 182 /** @var string $view */ 183 public $view = self::SUMMARY; 184 /** @var int $coursemoduleid */ 185 public $coursemoduleid = 0; 186 /** @var string returnaction The action to take you back to the current page */ 187 public $returnaction = ''; 188 /** @var array returnparams The params to take you back to the current page */ 189 public $returnparams = array(); 190 191 /** 192 * Feedback for a single plugin 193 * 194 * @param assign_feedback_plugin $plugin 195 * @param stdClass $grade 196 * @param string $view one of feedback_plugin::SUMMARY or feedback_plugin::FULL 197 * @param int $coursemoduleid 198 * @param string $returnaction The action required to return to this page 199 * @param array $returnparams The params required to return to this page 200 */ 201 public function __construct(assign_feedback_plugin $plugin, 202 stdClass $grade, 203 $view, 204 $coursemoduleid, 205 $returnaction, 206 $returnparams) { 207 $this->plugin = $plugin; 208 $this->grade = $grade; 209 $this->view = $view; 210 $this->coursemoduleid = $coursemoduleid; 211 $this->returnaction = $returnaction; 212 $this->returnparams = $returnparams; 213 } 214 215 } 216 217 /** 218 * Implements a renderable submission plugin submission 219 * @package mod_assign 220 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 221 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 222 */ 223 class assign_submission_plugin_submission implements renderable { 224 /** @var int SUMMARY */ 225 const SUMMARY = 10; 226 /** @var int FULL */ 227 const FULL = 20; 228 229 /** @var assign_submission_plugin $plugin */ 230 public $plugin = null; 231 /** @var stdClass $submission */ 232 public $submission = null; 233 /** @var string $view */ 234 public $view = self::SUMMARY; 235 /** @var int $coursemoduleid */ 236 public $coursemoduleid = 0; 237 /** @var string returnaction The action to take you back to the current page */ 238 public $returnaction = ''; 239 /** @var array returnparams The params to take you back to the current page */ 240 public $returnparams = array(); 241 242 /** 243 * Constructor 244 * @param assign_submission_plugin $plugin 245 * @param stdClass $submission 246 * @param string $view one of submission_plugin::SUMMARY, submission_plugin::FULL 247 * @param int $coursemoduleid - the course module id 248 * @param string $returnaction The action to return to the current page 249 * @param array $returnparams The params to return to the current page 250 */ 251 public function __construct(assign_submission_plugin $plugin, 252 stdClass $submission, 253 $view, 254 $coursemoduleid, 255 $returnaction, 256 $returnparams) { 257 $this->plugin = $plugin; 258 $this->submission = $submission; 259 $this->view = $view; 260 $this->coursemoduleid = $coursemoduleid; 261 $this->returnaction = $returnaction; 262 $this->returnparams = $returnparams; 263 } 264 } 265 266 /** 267 * Renderable feedback status 268 * @package mod_assign 269 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 270 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 271 */ 272 class assign_feedback_status implements renderable { 273 274 /** @var stding $gradefordisplay the student grade rendered into a format suitable for display */ 275 public $gradefordisplay = ''; 276 /** @var mixed the graded date (may be null) */ 277 public $gradeddate = 0; 278 /** @var mixed the grader (may be null) */ 279 public $grader = null; 280 /** @var array feedbackplugins - array of feedback plugins */ 281 public $feedbackplugins = array(); 282 /** @var stdClass assign_grade record */ 283 public $grade = null; 284 /** @var int coursemoduleid */ 285 public $coursemoduleid = 0; 286 /** @var string returnaction */ 287 public $returnaction = ''; 288 /** @var array returnparams */ 289 public $returnparams = array(); 290 291 /** 292 * Constructor 293 * @param string $gradefordisplay 294 * @param mixed $gradeddate 295 * @param mixed $grader 296 * @param array $feedbackplugins 297 * @param mixed $grade 298 * @param int $coursemoduleid 299 * @param string $returnaction The action required to return to this page 300 * @param array $returnparams The list of params required to return to this page 301 */ 302 public function __construct($gradefordisplay, 303 $gradeddate, 304 $grader, 305 $feedbackplugins, 306 $grade, 307 $coursemoduleid, 308 $returnaction, 309 $returnparams) { 310 $this->gradefordisplay = $gradefordisplay; 311 $this->gradeddate = $gradeddate; 312 $this->grader = $grader; 313 $this->feedbackplugins = $feedbackplugins; 314 $this->grade = $grade; 315 $this->coursemoduleid = $coursemoduleid; 316 $this->returnaction = $returnaction; 317 $this->returnparams = $returnparams; 318 } 319 } 320 321 /** 322 * Renderable submission status 323 * @package mod_assign 324 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 325 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 326 */ 327 class assign_submission_status implements renderable { 328 /** @var int STUDENT_VIEW */ 329 const STUDENT_VIEW = 10; 330 /** @var int GRADER_VIEW */ 331 const GRADER_VIEW = 20; 332 333 /** @var int allowsubmissionsfromdate */ 334 public $allowsubmissionsfromdate = 0; 335 /** @var bool alwaysshowdescription */ 336 public $alwaysshowdescription = false; 337 /** @var stdClass the submission info (may be null) */ 338 public $submission = null; 339 /** @var boolean teamsubmissionenabled - true or false */ 340 public $teamsubmissionenabled = false; 341 /** @var stdClass teamsubmission the team submission info (may be null) */ 342 public $teamsubmission = null; 343 /** @var stdClass submissiongroup the submission group info (may be null) */ 344 public $submissiongroup = null; 345 /** @var array submissiongroupmemberswhoneedtosubmit list of users who still need to submit */ 346 public $submissiongroupmemberswhoneedtosubmit = array(); 347 /** @var bool submissionsenabled */ 348 public $submissionsenabled = false; 349 /** @var bool locked */ 350 public $locked = false; 351 /** @var bool graded */ 352 public $graded = false; 353 /** @var int duedate */ 354 public $duedate = 0; 355 /** @var int cutoffdate */ 356 public $cutoffdate = 0; 357 /** @var array submissionplugins - the list of submission plugins */ 358 public $submissionplugins = array(); 359 /** @var string returnaction */ 360 public $returnaction = ''; 361 /** @var string returnparams */ 362 public $returnparams = array(); 363 /** @var int courseid */ 364 public $courseid = 0; 365 /** @var int coursemoduleid */ 366 public $coursemoduleid = 0; 367 /** @var int the view (STUDENT_VIEW OR GRADER_VIEW) */ 368 public $view = self::STUDENT_VIEW; 369 /** @var bool canviewfullnames */ 370 public $canviewfullnames = false; 371 /** @var bool canedit */ 372 public $canedit = false; 373 /** @var bool cansubmit */ 374 public $cansubmit = false; 375 /** @var int extensionduedate */ 376 public $extensionduedate = 0; 377 /** @var context context */ 378 public $context = 0; 379 /** @var bool blindmarking - Should we hide student identities from graders? */ 380 public $blindmarking = false; 381 /** @var string gradingcontrollerpreview */ 382 public $gradingcontrollerpreview = ''; 383 /** @var string attemptreopenmethod */ 384 public $attemptreopenmethod = 'none'; 385 /** @var int maxattempts */ 386 public $maxattempts = -1; 387 388 /** 389 * Constructor 390 * 391 * @param int $allowsubmissionsfromdate 392 * @param bool $alwaysshowdescription 393 * @param stdClass $submission 394 * @param bool $teamsubmissionenabled 395 * @param stdClass $teamsubmission 396 * @param int $submissiongroup 397 * @param array $submissiongroupmemberswhoneedtosubmit 398 * @param bool $submissionsenabled 399 * @param bool $locked 400 * @param bool $graded 401 * @param int $duedate 402 * @param int $cutoffdate 403 * @param array $submissionplugins 404 * @param string $returnaction 405 * @param array $returnparams 406 * @param int $coursemoduleid 407 * @param int $courseid 408 * @param string $view 409 * @param bool $canedit 410 * @param bool $cansubmit 411 * @param bool $canviewfullnames 412 * @param int $extensionduedate - Any extension to the due date granted for this user 413 * @param context $context - Any extension to the due date granted for this user 414 * @param bool $blindmarking - Should we hide student identities from graders? 415 * @param string $gradingcontrollerpreview 416 * @param string $attemptreopenmethod - The method of reopening student attempts. 417 * @param int $maxattempts - How many attempts can a student make? 418 */ 419 public function __construct($allowsubmissionsfromdate, 420 $alwaysshowdescription, 421 $submission, 422 $teamsubmissionenabled, 423 $teamsubmission, 424 $submissiongroup, 425 $submissiongroupmemberswhoneedtosubmit, 426 $submissionsenabled, 427 $locked, 428 $graded, 429 $duedate, 430 $cutoffdate, 431 $submissionplugins, 432 $returnaction, 433 $returnparams, 434 $coursemoduleid, 435 $courseid, 436 $view, 437 $canedit, 438 $cansubmit, 439 $canviewfullnames, 440 $extensionduedate, 441 $context, 442 $blindmarking, 443 $gradingcontrollerpreview, 444 $attemptreopenmethod, 445 $maxattempts) { 446 $this->allowsubmissionsfromdate = $allowsubmissionsfromdate; 447 $this->alwaysshowdescription = $alwaysshowdescription; 448 $this->submission = $submission; 449 $this->teamsubmissionenabled = $teamsubmissionenabled; 450 $this->teamsubmission = $teamsubmission; 451 $this->submissiongroup = $submissiongroup; 452 $this->submissiongroupmemberswhoneedtosubmit = $submissiongroupmemberswhoneedtosubmit; 453 $this->submissionsenabled = $submissionsenabled; 454 $this->locked = $locked; 455 $this->graded = $graded; 456 $this->duedate = $duedate; 457 $this->cutoffdate = $cutoffdate; 458 $this->submissionplugins = $submissionplugins; 459 $this->returnaction = $returnaction; 460 $this->returnparams = $returnparams; 461 $this->coursemoduleid = $coursemoduleid; 462 $this->courseid = $courseid; 463 $this->view = $view; 464 $this->canedit = $canedit; 465 $this->cansubmit = $cansubmit; 466 $this->canviewfullnames = $canviewfullnames; 467 $this->extensionduedate = $extensionduedate; 468 $this->context = $context; 469 $this->blindmarking = $blindmarking; 470 $this->gradingcontrollerpreview = $gradingcontrollerpreview; 471 $this->attemptreopenmethod = $attemptreopenmethod; 472 $this->maxattempts = $maxattempts; 473 } 474 } 475 476 /** 477 * Used to output the attempt history for a particular assignment. 478 * 479 * @package mod_assign 480 * @copyright 2012 Davo Smith, Synergy Learning 481 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 482 */ 483 class assign_attempt_history implements renderable { 484 485 /** @var array submissions - The list of previous attempts */ 486 public $submissions = array(); 487 /** @var array grades - The grades for the previous attempts */ 488 public $grades = array(); 489 /** @var array submissionplugins - The list of submission plugins to render the previous attempts */ 490 public $submissionplugins = array(); 491 /** @var array feedbackplugins - The list of feedback plugins to render the previous attempts */ 492 public $feedbackplugins = array(); 493 /** @var int coursemoduleid - The cmid for the assignment */ 494 public $coursemoduleid = 0; 495 /** @var string returnaction - The action for the next page. */ 496 public $returnaction = ''; 497 /** @var string returnparams - The params for the next page. */ 498 public $returnparams = array(); 499 /** @var bool cangrade - Does this user have grade capability? */ 500 public $cangrade = false; 501 /** @var string useridlistid - Id of the useridlist stored in cache, this plus rownum determines the userid */ 502 public $useridlistid = 0; 503 /** @var int rownum - The rownum of the user in the useridlistid - this plus useridlistid determines the userid */ 504 public $rownum = 0; 505 506 /** 507 * Constructor 508 * 509 * @param array $submissions 510 * @param array $grades 511 * @param array $submissionplugins 512 * @param array $feedbackplugins 513 * @param int $coursemoduleid 514 * @param string $returnaction 515 * @param array $returnparams 516 * @param bool $cangrade 517 * @param int $useridlistid 518 * @param int $rownum 519 */ 520 public function __construct($submissions, 521 $grades, 522 $submissionplugins, 523 $feedbackplugins, 524 $coursemoduleid, 525 $returnaction, 526 $returnparams, 527 $cangrade, 528 $useridlistid, 529 $rownum) { 530 $this->submissions = $submissions; 531 $this->grades = $grades; 532 $this->submissionplugins = $submissionplugins; 533 $this->feedbackplugins = $feedbackplugins; 534 $this->coursemoduleid = $coursemoduleid; 535 $this->returnaction = $returnaction; 536 $this->returnparams = $returnparams; 537 $this->cangrade = $cangrade; 538 $this->useridlistid = $useridlistid; 539 $this->rownum = $rownum; 540 } 541 } 542 543 /** 544 * Renderable header 545 * @package mod_assign 546 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 547 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 548 */ 549 class assign_header implements renderable { 550 /** @var stdClass the assign record */ 551 public $assign = null; 552 /** @var mixed context|null the context record */ 553 public $context = null; 554 /** @var bool $showintro - show or hide the intro */ 555 public $showintro = false; 556 /** @var int coursemoduleid - The course module id */ 557 public $coursemoduleid = 0; 558 /** @var string $subpage optional subpage (extra level in the breadcrumbs) */ 559 public $subpage = ''; 560 /** @var string $preface optional preface (text to show before the heading) */ 561 public $preface = ''; 562 /** @var string $postfix optional postfix (text to show after the intro) */ 563 public $postfix = ''; 564 565 /** 566 * Constructor 567 * 568 * @param stdClass $assign - the assign database record 569 * @param mixed $context context|null the course module context 570 * @param bool $showintro - show or hide the intro 571 * @param int $coursemoduleid - the course module id 572 * @param string $subpage - an optional sub page in the navigation 573 * @param string $preface - an optional preface to show before the heading 574 */ 575 public function __construct(stdClass $assign, 576 $context, 577 $showintro, 578 $coursemoduleid, 579 $subpage='', 580 $preface='', 581 $postfix='') { 582 $this->assign = $assign; 583 $this->context = $context; 584 $this->showintro = $showintro; 585 $this->coursemoduleid = $coursemoduleid; 586 $this->subpage = $subpage; 587 $this->preface = $preface; 588 $this->postfix = $postfix; 589 } 590 } 591 592 /** 593 * Renderable header related to an individual subplugin 594 * @package mod_assign 595 * @copyright 2014 Henning Bostelmann 596 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 597 */ 598 class assign_plugin_header implements renderable { 599 /** @var assign_plugin $plugin */ 600 public $plugin = null; 601 602 /** 603 * Header for a single plugin 604 * 605 * @param assign_plugin $plugin 606 */ 607 public function __construct(assign_plugin $plugin) { 608 $this->plugin = $plugin; 609 } 610 } 611 612 /** 613 * Renderable grading summary 614 * @package mod_assign 615 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 616 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 617 */ 618 class assign_grading_summary implements renderable { 619 /** @var int participantcount - The number of users who can submit to this assignment */ 620 public $participantcount = 0; 621 /** @var bool submissiondraftsenabled - Allow submission drafts */ 622 public $submissiondraftsenabled = false; 623 /** @var int submissiondraftscount - The number of submissions in draft status */ 624 public $submissiondraftscount = 0; 625 /** @var bool submissionsenabled - Allow submissions */ 626 public $submissionsenabled = false; 627 /** @var int submissionssubmittedcount - The number of submissions in submitted status */ 628 public $submissionssubmittedcount = 0; 629 /** @var int submissionsneedgradingcount - The number of submissions that need grading */ 630 public $submissionsneedgradingcount = 0; 631 /** @var int duedate - The assignment due date (if one is set) */ 632 public $duedate = 0; 633 /** @var int cutoffdate - The assignment cut off date (if one is set) */ 634 public $cutoffdate = 0; 635 /** @var int coursemoduleid - The assignment course module id */ 636 public $coursemoduleid = 0; 637 /** @var boolean teamsubmission - Are team submissions enabled for this assignment */ 638 public $teamsubmission = false; 639 640 /** 641 * constructor 642 * 643 * @param int $participantcount 644 * @param bool $submissiondraftsenabled 645 * @param int $submissiondraftscount 646 * @param bool $submissionsenabled 647 * @param int $submissionssubmittedcount 648 * @param int $cutoffdate 649 * @param int $duedate 650 * @param int $coursemoduleid 651 * @param int $submissionsneedgradingcount 652 * @param bool $teamsubmission 653 */ 654 public function __construct($participantcount, 655 $submissiondraftsenabled, 656 $submissiondraftscount, 657 $submissionsenabled, 658 $submissionssubmittedcount, 659 $cutoffdate, 660 $duedate, 661 $coursemoduleid, 662 $submissionsneedgradingcount, 663 $teamsubmission) { 664 $this->participantcount = $participantcount; 665 $this->submissiondraftsenabled = $submissiondraftsenabled; 666 $this->submissiondraftscount = $submissiondraftscount; 667 $this->submissionsenabled = $submissionsenabled; 668 $this->submissionssubmittedcount = $submissionssubmittedcount; 669 $this->duedate = $duedate; 670 $this->cutoffdate = $cutoffdate; 671 $this->coursemoduleid = $coursemoduleid; 672 $this->submissionsneedgradingcount = $submissionsneedgradingcount; 673 $this->teamsubmission = $teamsubmission; 674 } 675 } 676 677 /** 678 * Renderable course index summary 679 * @package mod_assign 680 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 681 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 682 */ 683 class assign_course_index_summary implements renderable { 684 /** @var array assignments - A list of course module info and submission counts or statuses */ 685 public $assignments = array(); 686 /** @var boolean usesections - Does this course format support sections? */ 687 public $usesections = false; 688 /** @var string courseformat - The current course format name */ 689 public $courseformatname = ''; 690 691 /** 692 * constructor 693 * 694 * @param boolean $usesections - True if this course format uses sections 695 * @param string $courseformatname - The id of this course format 696 */ 697 public function __construct($usesections, $courseformatname) { 698 $this->usesections = $usesections; 699 $this->courseformatname = $courseformatname; 700 } 701 702 /** 703 * Add a row of data to display on the course index page 704 * 705 * @param int $cmid - The course module id for generating a link 706 * @param string $cmname - The course module name for generating a link 707 * @param string $sectionname - The name of the course section (only if $usesections is true) 708 * @param int $timedue - The due date for the assignment - may be 0 if no duedate 709 * @param string $submissioninfo - A string with either the number of submitted assignments, or the 710 * status of the current users submission depending on capabilities. 711 * @param string $gradeinfo - The current users grade if they have been graded and it is not hidden. 712 */ 713 public function add_assign_info($cmid, $cmname, $sectionname, $timedue, $submissioninfo, $gradeinfo) { 714 $this->assignments[] = array('cmid'=>$cmid, 715 'cmname'=>$cmname, 716 'sectionname'=>$sectionname, 717 'timedue'=>$timedue, 718 'submissioninfo'=>$submissioninfo, 719 'gradeinfo'=>$gradeinfo); 720 } 721 722 723 } 724 725 726 /** 727 * An assign file class that extends rendererable class and is used by the assign module. 728 * 729 * @package mod_assign 730 * @copyright 2012 NetSpot {@link http://www.netspot.com.au} 731 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 732 */ 733 class assign_files implements renderable { 734 /** @var context $context */ 735 public $context; 736 /** @var string $context */ 737 public $dir; 738 /** @var MoodleQuickForm $portfolioform */ 739 public $portfolioform; 740 /** @var stdClass $cm course module */ 741 public $cm; 742 /** @var stdClass $course */ 743 public $course; 744 745 /** 746 * The constructor 747 * 748 * @param context $context 749 * @param int $sid 750 * @param string $filearea 751 * @param string $component 752 */ 753 public function __construct(context $context, $sid, $filearea, $component) { 754 global $CFG; 755 $this->context = $context; 756 list($context, $course, $cm) = get_context_info_array($context->id); 757 $this->cm = $cm; 758 $this->course = $course; 759 $fs = get_file_storage(); 760 $this->dir = $fs->get_area_tree($this->context->id, $component, $filearea, $sid); 761 762 $files = $fs->get_area_files($this->context->id, 763 $component, 764 $filearea, 765 $sid, 766 'timemodified', 767 false); 768 769 if (!empty($CFG->enableportfolios)) { 770 require_once($CFG->libdir . '/portfoliolib.php'); 771 if (count($files) >= 1 && 772 has_capability('mod/assign:exportownsubmission', $this->context)) { 773 $button = new portfolio_add_button(); 774 $callbackparams = array('cmid' => $this->cm->id, 775 'sid' => $sid, 776 'area' => $filearea, 777 'component' => $component); 778 $button->set_callback_options('assign_portfolio_caller', 779 $callbackparams, 780 'mod_assign'); 781 $button->reset_formats(); 782 $this->portfolioform = $button->to_html(PORTFOLIO_ADD_TEXT_LINK); 783 } 784 785 } 786 787 $this->preprocess($this->dir, $filearea, $component); 788 } 789 790 /** 791 * Preprocessing the file list to add the portfolio links if required. 792 * 793 * @param array $dir 794 * @param string $filearea 795 * @param string $component 796 * @return void 797 */ 798 public function preprocess($dir, $filearea, $component) { 799 global $CFG; 800 foreach ($dir['subdirs'] as $subdir) { 801 $this->preprocess($subdir, $filearea, $component); 802 } 803 foreach ($dir['files'] as $file) { 804 $file->portfoliobutton = ''; 805 if (!empty($CFG->enableportfolios)) { 806 $button = new portfolio_add_button(); 807 if (has_capability('mod/assign:exportownsubmission', $this->context)) { 808 $portfolioparams = array('cmid' => $this->cm->id, 'fileid' => $file->get_id()); 809 $button->set_callback_options('assign_portfolio_caller', 810 $portfolioparams, 811 'mod_assign'); 812 $button->set_format_by_file($file); 813 $file->portfoliobutton = $button->to_html(PORTFOLIO_ADD_ICON_LINK); 814 } 815 } 816 $path = '/' . 817 $this->context->id . 818 '/' . 819 $component . 820 '/' . 821 $filearea . 822 '/' . 823 $file->get_itemid() . 824 $file->get_filepath() . 825 $file->get_filename(); 826 $url = file_encode_url("$CFG->wwwroot/pluginfile.php", $path, true); 827 $filename = $file->get_filename(); 828 $file->fileurl = html_writer::link($url, $filename); 829 } 830 } 831 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |