Exemplo n.º 1
0
        return evalcomix_object::fetch_all_helper('block_evalcomix_tools', 'evalcomix_tool', $params);
    }
    /**
     * Finds and returns a evalcomix_tool instance based on params.
     * @static
     *
     * @param array $params associative arrays varname=>value
     * @return object grade_item instance or false if none found.
     */
    public static function fetch($params)
    {
        return evalcomix_object::fetch_helper('block_evalcomix_tools', 'evalcomix_tool', $params);
    }
    /**
     * Called immediately after the object data has been inserted, updated, or
     * deleted in the database. Default does nothing, can be overridden to
     * hook in special behaviour.
     *
     * @param bool $deleted
     */
    function notify_changed($deleted)
    {
    }
    /**
	* @param int $courseid
	* @return array of tools. Key of array is 'id' and value of array is 'title' tool
	*/
    static function get_tools($courseid)
    {
        global $CFG;
        include_once $CFG->dirroot . '/blocks/evalcomix/classes/evalcomix_tool.php';
        include_once $CFG->dirroot . '/blocks/evalcomix/classes/evalcomix.php';
        $result = array();
        $params = array('courseid' => $courseid);
        if (!($environment = evalcomix::fetch($params))) {
            return $result;
        }
        $evxid = $environment->id;
        $params = array('evxid' => $evxid);
        $tools = evalcomix_tool::fetch_all($params);
        if (!is_array($tools)) {
            $tools = array();
     global $DB;
     $objectnew = new evalcomix_tool($this->evalcomix_tool[0]->id, $this->evalcomix_tool[0]->evxid, $this->evalcomix_tool[0]->title, $this->evalcomix_tool[0]->type, $this->evalcomix_tool[0]->idtool);
     $this->assertTrue(method_exists($objectnew, 'update'));
     $params = array('title' => 'helloeveryone', 'type' => 'rubric', 'idtool' => '12_plaSIMPLETEST');
     evalcomix_tool::set_properties($objectnew, $params);
     $this->assertTrue($objectnew->update());
 }