class CourseObjectPoll in Course 6
Same name and namespace in other branches
- 7.2 modules/course_poll/course_poll.classes.inc \CourseObjectPoll
- 7 modules/course_poll/course_poll.classes.inc \CourseObjectPoll
Parent class for poll tracking.
Hierarchy
- class \CourseHandler
- class \CourseObject
- class \CourseObjectNode
- class \CourseObjectPoll
- class \CourseObjectNode
- class \CourseObject
Expanded class hierarchy of CourseObjectPoll
1 string reference to 'CourseObjectPoll'
- course_poll_course_handlers in modules/
course_poll/ course_poll.module - Implements hook_course_handlers().
File
- modules/
course_poll/ course_poll.classes.inc, line 6
View source
class CourseObjectPoll extends CourseObjectNode {
function getTakeType() {
return 'content';
}
/**
* Take or view the results of a poll. Wrapper for poll_view().
*/
function take() {
poll_view($this->node);
return drupal_render($this->node->content['body']);
}
public function create() {
$poll = new stdClass();
$poll->choice[0]['chtext'] = 'Yes';
$poll->choice[1]['chtext'] = 'No';
$poll->type = 'poll';
$poll->title = $this
->getTitle();
$poll->uid = $this->user->uid;
$poll->active = 1;
node_save($poll);
$this
->setNode($poll);
}
public function getReports() {
return array(
'results' => array(
'title' => 'Results',
),
'all' => array(
'title' => 'List votes',
),
);
}
public function getReport($key) {
module_load_include('inc', 'poll', 'poll.pages');
switch ($key) {
case 'results':
return array(
'title' => t('Poll results'),
'content' => poll_view_results($this->node, NULL, NULL, NULL),
);
case 'all':
return array(
'title' => 'All votes',
'content' => poll_votes($this->node),
);
}
}
/**
* Remove poll votes for this user.
*/
function unEnroll() {
db_query('DELETE FROM {poll_votes} WHERE nid = %d AND uid = %d', $this->node->nid, $this
->getCourse()
->getUser()->uid);
db_query("UPDATE {poll_choices} SET chvotes = chvotes - 1 WHERE nid = %d AND chorder = %d", $this->node->nid, $this->node->vote);
}
function getNodeTypes() {
return array(
'poll',
);
}
function getCloneAbility() {
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CourseHandler:: |
private | property | ||
CourseHandler:: |
protected | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
public | property | ||
CourseHandler:: |
final public | function | Merge an array of options onto the existing options. | |
CourseHandler:: |
public | function | Get an array of access messages. | |
CourseHandler:: |
protected | function | Return an array of database fields. This determines what fields should be serialized instead of stored. | |
CourseHandler:: |
function | |||
CourseHandler:: |
final public | function | Get an option stored in this CourseObject. | |
CourseHandler:: |
private | function | Merge arrays with replace, not append. | |
CourseHandler:: |
public | function | Set an access message to be displayed along with the course object when it is in the outline. For example, "This activity will open on XYZ" or "Please complete Step 1 to take this activity." | |
CourseHandler:: |
final public | function | Set an option for this handler. | |
CourseHandler:: |
final public | function | Set this entire handler's options. | |
CourseObject:: |
private | property | ||
CourseObject:: |
private | property | ||
CourseObject:: |
protected | property | ||
CourseObject:: |
public | function | Access functionality for course objects. | |
CourseObject:: |
function | Get the object component for this course object. | ||
CourseObject:: |
function | Get the Course that contains this CourseObject. | ||
CourseObject:: |
function | Get the course node ID this CourseObject belongs to. | ||
CourseObject:: |
public | function | Get this course object's fulfillment object. | |
CourseObject:: |
function | Get the instance ID. This could be the external component ID, a Node ID... | ||
CourseObject:: |
public static | function | Return the number of occurances that can be in a course at the same time. For example, the design of the Certificate module can only have 1 set of mappings per node. The same goes for Course Credit. We may also want a course object that can only be… | 2 |
CourseObject:: |
function | Get the module that provides this course object. | ||
CourseObject:: |
public | function |
Get options, with session options having precedence. Overrides CourseHandler:: |
|
CourseObject:: |
public | function |
Get core options summary. Overrides CourseHandler:: |
2 |
CourseObject:: |
public | function | Get the user's status in this course object. | 1 |
CourseObject:: |
function | |||
CourseObject:: |
public | function | Return the URL to the course object router. | |
CourseObject:: |
public | function | Specify whether fulfillment uses asynchronous polling. | 2 |
CourseObject:: |
public | function | ||
CourseObject:: |
function | Is this object graded? | 2 | |
CourseObject:: |
public | function | Is this course object required for course completion? | |
CourseObject:: |
function | Checks the temporary status of a course object. | ||
CourseObject:: |
private | function | ||
CourseObject:: |
public | function | Override navigation links. | 1 |
CourseObject:: |
public | function | Overrides a course outline list item. | 1 |
CourseObject:: |
function | Give the course object a chance do asynchronous polling and set completion on demand. | ||
CourseObject:: |
public | function | Get all course object implementations of getOptionsSummary(). | |
CourseObject:: |
function | Set the object component for this course object. | ||
CourseObject:: |
public | function | Set the Course for this CourseObject. | |
CourseObject:: |
function | Set the internal course object ID. | ||
CourseObject:: |
function | Set this object's instance ID. | ||
CourseObject:: |
function | Set the module that provides this course object. | ||
CourseObject:: |
function | Set the user fulfilling/creating this course object. | ||
CourseObject:: |
final public | function | Take a course object. | |
CourseObjectNode:: |
protected | property | ||
CourseObjectNode:: |
public | function |
Destroy the node instance. Overrides CourseObject:: |
|
CourseObjectNode:: |
function |
Freeze data to persist over cloning/exporting. Overrides CourseObject:: |
||
CourseObjectNode:: |
public | function |
Get the URL to edit this course object, if any. Overrides CourseObject:: |
|
CourseObjectNode:: |
public | function |
Get the URL to take this course object, if any. Overrides CourseObject:: |
1 |
CourseObjectNode:: |
public | function |
Return a list of warning strings about this handler. Overrides CourseHandler:: |
2 |
CourseObjectNode:: |
function |
Grant access to course content before going to it. Overrides CourseObject:: |
||
CourseObjectNode:: |
public | function | ||
CourseObjectNode:: |
public | function |
Define configuration elements and their defaults. Overrides CourseObject:: |
3 |
CourseObjectNode:: |
public | function |
Default options form for all course objects. Overrides CourseObject:: |
5 |
CourseObjectNode:: |
public | function |
Save object configs to cache. Overrides CourseObject:: |
2 |
CourseObjectNode:: |
public | function |
Validate the options form. Check the node type. Overrides CourseObject:: |
|
CourseObjectNode:: |
function |
Duration expired (or something) - CourseObject is telling us so. Overrides CourseObject:: |
||
CourseObjectNode:: |
function |
On object write, set privacy on this node. Overrides CourseObject:: |
||
CourseObjectNode:: |
public | function | Set the node and instance ID (node ID) of this CourseObjectNode. | |
CourseObjectNode:: |
function |
Thaw data frozen from an earlier export/clone. Overrides CourseObject:: |
3 | |
CourseObjectNode:: |
public | function |
Construct a course object from a database record. Overrides CourseObject:: |
|
CourseObjectPoll:: |
public | function |
Creates a course object. Overrides CourseObjectNode:: |
|
CourseObjectPoll:: |
function |
Returns an translated error message if this object has issues with cloning. Overrides CourseObjectNode:: |
||
CourseObjectPoll:: |
function |
Return a list of valid node types. Overrides CourseObjectNode:: |
||
CourseObjectPoll:: |
public | function |
Let the course object provide its own reports. Overrides CourseObject:: |
|
CourseObjectPoll:: |
public | function |
Let the course object provide its own reports. Overrides CourseObject:: |
|
CourseObjectPoll:: |
function |
Simple node course object behavior is to just redirect to the node. Overrides CourseObjectNode:: |
||
CourseObjectPoll:: |
function |
Take or view the results of a poll. Wrapper for poll_view(). Overrides CourseObject:: |
||
CourseObjectPoll:: |
function |
Remove poll votes for this user. Overrides CourseObject:: |