Skip to content

Commit

Permalink
Merge pull request #74 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: slate v2.1.11
  • Loading branch information
themightychris authored Oct 6, 2016
2 parents 3e15264 + 2b5ddb0 commit b49c2b4
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 0 deletions.
45 changes: 45 additions & 0 deletions php-classes/Slate/Progress/AbstractReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Slate\Progress;

use Slate\People\Student;


abstract class AbstractReport extends \VersionedRecord
{
// ActiveRecord configuration
public static $singularNoun = 'report';
public static $pluralNoun = 'reports';
public static $updateOnDuplicateKey = true;

public static $fields = [
'StudentID' => [
'type' => 'uint',
'index' => true
],
'Status' => [
'type' => 'enum',
'values' => ['draft', 'published'],
'default' => 'draft'
],
];

public static $relationships = [
'Student' => [
'type' => 'one-one',
'class' => Student::class
]
];

public static $searchConditions = [
'StudentID' => [
'qualifiers' => ['student-id'],
'points' => 2,
'sql' => 'StudentID=%u'
]
];

public static $dynamicFields = [
'Student'
];
}
54 changes: 54 additions & 0 deletions php-classes/Slate/Progress/AbstractSectionTermReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace Slate\Progress;

use Slate\Courses\Section;
use Slate\Term;


abstract class AbstractSectionTermReport extends AbstractReport
{
// ActiveRecord configuration
public static $singularNoun = 'section term report';
public static $pluralNoun = 'section term reports';

public static $fields = [
'SectionID' => [
'type' => 'uint',
'index' => true
],
'TermID' => [
'type' => 'uint',
'index' => true
]
];

public static $relationships = [
'Section' => [
'type' => 'one-one',
'class' => Section::class
],
'Term' => [
'type' => 'one-one',
'class' => Term::class
]
];

public static $searchConditions = [
'SectionID' => [
'qualifiers' => ['narrative-id'],
'points' => 2,
'sql' => 'ID=%u'
],
'TermID' => [
'qualifiers' => ['term-id'],
'points' => 2,
'sql' => 'TermID=%u'
]
];

public static $dynamicFields = [
'Section',
'Term'
];
}
29 changes: 29 additions & 0 deletions php-classes/Slate/Progress/SectionInterimReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Slate\Progress;


class SectionInterimReport extends AbstractSectionTermReport
{
public static $tableName = 'section_interim_reports';
public static $singularNoun = 'section interim report';
public static $pluralNoun = 'section interim reports';
public static $collectionRoute = '/progress/section-interim-reports';

public static $defaultClass = __CLASS__;
public static $subClasses = [__CLASS__];

public static $fields = [
'Notes' => [
'type' => 'clob',
'default' => null
]
];

public static $indexes = [
'StudentSectionTerm' => [
'fields' => ['StudentID', 'SectionID', 'TermID'],
'unique' => true
]
];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Slate\Progress;


class SectionInterimReportsRequestHandler extends \RecordsRequestHandler
{
public static $recordClass = SectionInterimReport::class;
}
13 changes: 13 additions & 0 deletions php-classes/Slate/Progress/SectionTermReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Slate\Progress;


/**
* TODO: Refactor narratives into SectionTermReport
*/
class SectionTermReport extends AbstractSectionTermReport
{


}
3 changes: 3 additions & 0 deletions php-config/Git.config.d/slate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'originBranch' => 'development',
'workingBranch' => 'development',
'trees' => [
'content-blocks',
'dwoo-plugins',
'event-handlers',
'html-templates' => [
Expand All @@ -29,6 +30,8 @@
],
'php-config' => [
'exclude' => [
'#^/Site.config.d(/|$)#', // don't sync local site config

// from emergence-saml2 layer:
'#^/Emergence/Connectors/SAML2\.config\.php$#',
'#^/SAML2/Compat/ContainerSingleton\.config\.php$#',
Expand Down
3 changes: 3 additions & 0 deletions site-root/progress/section-interim-reports.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

Slate\Progress\SectionInterimReportsRequestHandler::handleRequest();

0 comments on commit b49c2b4

Please sign in to comment.