Plugin Directory

Changeset 657976


Ignore:
Timestamp:
01/24/2013 12:30:37 PM (13 years ago)
Author:
raido357
Message:

Method and class for grade handling. Has not been tested yet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dippler/trunk/classes/dippler-learner-manager.php

    r616851 r657976  
    6161    }
    6262   
     63    /*
     64     * Get learner grades
     65     *
     66     * @return Array
     67     */
     68   
     69    function getCourseGrade() {
     70        if ( $client == $this->getClient() && $learner_id > 0 ) {
     71            $arg = $this->compileArgs( array( 'action' => 'LOAD_GRADE', 'data' => $this->gradeID_XML() ) );
     72            $resp = new DipplerXML( $client->learnerManager( $arg ) );
     73            if ( $resp->getStatusCode() >= 0 ) {
     74                return new DipplerGrade( $resp );
     75            }
     76        }
     77        return array();
     78    }
     79   
     80    /*
     81     * Get grade ID XML
     82     *
     83     * @return String
     84     */
     85   
     86    function gradeID_XML() {
     87        $data = "<grade>";
     88        $data = "<course_id>".$this->course_id."</course_id>";
     89        $data .= "<user_id>".$this->getUserID()."</user_id>";
     90        $data .= "</grade>";
     91        return DIPPLER_XML_ROOT.$data;
     92    }
     93   
    6394    /**
    6495     * Return learner ID XML
     
    172203    }
    173204}
     205
     206/*
     207 * Dippler course grade class
     208 */
     209
     210class DipplerGrade {
     211
     212    private $data = array();
     213   
     214    /*
     215     * Constructor, store input data in the variable
     216     */
     217     
     218    function __construct( $_data = array() ) {
     219        $this->data = $_data;
     220    }
     221   
     222    /*
     223     * Get grade value
     224     *
     225     * @return Mixed
     226     */
     227   
     228    function getValue(){
     229        return $this->grade;
     230    }
     231   
     232    /*
     233     * Get feedback
     234     *
     235     * @return String
     236     */
     237   
     238    function getFeedback() {
     239        return $this->feedback;
     240    }
     241   
     242    /*
     243     * Get grade created date
     244     *
     245     * @return String
     246     */
     247   
     248    function getCreated() {
     249        return $this->created;
     250    }
     251   
     252    /*
     253     * Get grade created date
     254     *
     255     * @return String
     256     */
     257   
     258    function getModified() {
     259        return $this->modified;
     260    }
     261   
     262   
     263    /**
     264     * Get magic method override
     265     *
     266     * @return Local variable for XML node from post, if isSet
     267     */
     268     
     269    function __get( $node ) {
     270        if ( isSet( $this->data->{$node} ) ) {
     271            return (string) $this->data->{$node};
     272        }
     273        //Return local class variable
     274        if ( isSet( $this->{$node} ) ) {
     275            return $this->{$node};
     276        }
     277        return false;
     278    }
     279}
    174280?>
Note: See TracChangeset for help on using the changeset viewer.