class AssignmentManager extends BaseManager

Core assignment manager

Methods

object
save(object $obj)

Save handler, because DRY

Paginator
getPaginator(integer $page = 1, integer $limit = 50)

Helps paginate models using the query bulder. Bit more complicated than the native array method, but works better for larger data sets

boolean
restDelete(number $id)

Delete an object with rest

restCreate(array $data)

Create a new object

restUpdate(int $id, array $data)

Update an existing object

mixed
find(mixed $parameters = null)

Find assignment

mixed
findFirst(mixed $params = null)

Find first based on params

mixed
findFirstById(mixed $params = null)

Find first content by ID

object
findFirstByUuid(string $uuid)

Find first item by given UUID

findFirstBySrn(string $srn)

Find first instance by SRN

findDueBetween($after, $before)

No description

create(array $input, mixed $user = false)

Create new assignment. Accepts: * slug * abstract * content * notes * due_at - int or string * users - array of assigned users * children - array of assigned content items

update(int $id, array $input, mixed $user = false)

Update assignment. Accepts: * slug * abstract * content * notes * due_at - int or string * users - array of assigned users * children - array of assigned content items

boolean
delete(integer $id)

Remove assignment. This does not remove associated children

updateDue(integer $id, mixed $time)

Update only the due date for the assignment

updatePublish(integer $id, mixed $time)

Update only the publish time of assignment. This will also update associated children's published time.

Details

in BaseManager at line line 23
object save(object $obj)

Save handler, because DRY

Parameters

object $obj Model to be saved

Return Value

object Model

Exceptions

Exception Json encoded string of validation errors

in BaseManager at line line 60
Paginator getPaginator(integer $page = 1, integer $limit = 50)

Helps paginate models using the query bulder. Bit more complicated than the native array method, but works better for larger data sets

Because it's based on Phalcon's QueryBuilder, it supports a fluent filtering interface:

    $manager = $this->foo_manager;
    $items = $manager->getPaginator(1, 20)
        ->orderBy('created_at desc')
        ->where('name = :name:', array('name' => $name))
        ->andWhere('type = :type:', array('type' => $type))
        ->paginate();

    echo json_encode($items);

Parameters

integer $page Current page
integer $limit Per page limit

Return Value

Paginator

in BaseManager at line line 80
boolean restDelete(number $id)

Delete an object with rest

Parameters

number $id

Return Value

boolean

Exceptions

Exception

in BaseManager at line line 103
restCreate(array $data)

Create a new object

Parameters

array $data

in BaseManager at line line 117
restUpdate(int $id, array $data)

Update an existing object

Parameters

int $id
array $data

at line line 25
mixed find(mixed $parameters = null)

Find assignment

Parameters

mixed $parameters

Return Value

mixed

at line line 35
mixed findFirst(mixed $params = null)

Find first based on params

Parameters

mixed $params

Return Value

mixed

at line line 45
mixed findFirstById(mixed $params = null)

Find first content by ID

Parameters

mixed $params

Return Value

mixed

at line line 55
object findFirstByUuid(string $uuid)

Find first item by given UUID

Parameters

string $uuid

Return Value

object ContentModel

at line line 65
Assignment findFirstBySrn(string $srn)

Find first instance by SRN

Parameters

string $srn SRN

Return Value

Assignment

at line line 75
findDueBetween($after, $before)

Parameters

$after
$before

at line line 97
Assignment create(array $input, mixed $user = false)

Create new assignment. Accepts: * slug * abstract * content * notes * due_at - int or string * users - array of assigned users * children - array of assigned content items

Parameters

array $input Assignment data
mixed $user Creating user ID or object

Return Value

Assignment

Exceptions

Exception if unable to parse due date

at line line 257
Assignment update(int $id, array $input, mixed $user = false)

Update assignment. Accepts: * slug * abstract * content * notes * due_at - int or string * users - array of assigned users * children - array of assigned content items

Keep in mind Users and Children are overwritten, not added to existing collection

Parameters

int $id Assignment ID
array $input Assignment data
mixed $user Creating user ID or object

Return Value

Assignment

Exceptions

Exception if unable to find assignment or parse date

at line line 486
boolean delete(integer $id)

Remove assignment. This does not remove associated children

Parameters

integer $id Assignment id

Return Value

boolean

Exceptions

Exception if unable to load assignment

at line line 514
Assignment updateDue(integer $id, mixed $time)

Update only the due date for the assignment

Parameters

integer $id Assignment ID
mixed $time timestamp or date string

Return Value

Assignment

Exceptions

Exception If unable to load assignment or parse date

at line line 538
Assignment updatePublish(integer $id, mixed $time)

Update only the publish time of assignment. This will also update associated children's published time.

Parameters

integer $id Assignment ID
mixed $time Timestamp or date string

Return Value

Assignment

Exceptions

Exception If unable to load assignment or parse date