$this->assertEqual($title, $objectnew->title);
        $this->assertEqual($type, $objectnew->type);
        $this->assertEqual($idtool, $objectnew->idtool);
        unset($objectnew);
    }
    /**
	* Fetch all objects with a required not existing param
	*/
    /**
	* Fetch all objects. Return an array with the required params
	*/
    public function testFetchAllOK()
    {
        $params = array('title' => 'hola');
        $result = evalcomix_tool::fetch_all($params);
        //This assert fail... why?? Dont' recognize type 'array'...
        $this->assertType('array', $result);
예제 #3
0
/*if(is_siteadmin($USER) || has_capability('block/evalcomix:edit',$context)){
		echo '		
			<form name="formulario" method="get" action="'. $CFG->wwwroot.'/blocks/evalcomix/assessment/index.php">
				<input type=hidden name=id value=' . $COURSE->id .'>
				<SELECT NAME=select onchange="submit()">		
						<option value="0">Notas de EvalCOMIX con notas de Moodle
						<option value="1">Sólo notas de EvalCOMIX
				</SELECT>
			</form>
			<script language=javascript>document.formulario.select.options['.$selection.'].selected = true;</script>				
		';
	}*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Comprobamos si existen instrumentos modificados con evaluaciones asociadas /////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($toollist = evalcomix_tool::fetch_all(array('evxid' => $environment->id))) {
    $newgrades = webservice_evalcomix_client::get_assessments_modified(array('tools' => $toollist));
    if (!empty($newgrades)) {
        include_once $CFG->dirroot . '/blocks/evalcomix/classes/evalcomix_assessments.php';
        include_once $CFG->dirroot . '/blocks/evalcomix/classes/evalcomix_grades.php';
        $toolids = array();
        foreach ($tasks as $task) {
            if ($assessments = evalcomix_assessments::fetch_all(array('taskid' => $task->id))) {
                foreach ($assessments as $assessment) {
                    $activity = $task->instanceid;
                    $module = evalcomix_tasks::get_type_task($activity);
                    $mode = grade_report_evalcomix::get_type_evaluation($assessment->studentid, $courseid, $assessment->assessorid);
                    $str = $courseid . '_' . $module . '_' . $activity . '_' . $assessment->studentid . '_' . $assessment->assessorid . '_' . $mode . '_' . MOODLE_NAME;
                    $assessmentid = md5($str);
                    if (isset($newgrades[$assessmentid])) {
                        $grade = $newgrades[$assessmentid]->grade;
        $response = $curl->get($serverurl);
        if ($response && $curl->getHttpCode() >= 200 && $curl->getHttpCode() < 400) {
            if ($xml = simplexml_load_string($response)) {
                if ((string) $xml->status == 'success') {
                    return (string) $xml->description;
                } else {
                    return 0;
                }
            } else {
                return 0;
            }
        } else {
            throw new Exception('SG: Bad Response');
        }
    }
    public static function generate_token()
    {
        return md5(uniqid());
    }
    /**
	* @param string $params['courseid']
	* @param array $params['module'] module names
	* @param array $params['activity'] activity IDs
	* @param array $params['student'] student IDs
	* @param array $params['assessor'] assessor IDs
	* @param array $params['mode'] [teacher | self | peer]
	* @param string $params['lms'] lms name
	 * @return xml document with data assessments
	 */
    public static function get_ws_xml_tools($params = array())
    {
        defined('GET_TOOLS') || die('EvalCOMIX is not configured');
예제 #5
0
     global $DB;
     if (!empty($this->id)) {
         debugging("Tool object already exists!");
         return false;
     }
     $this->timecreated = time();
     $data = $this->get_record_data();
     $this->id = $DB->insert_record($this->table, $data);
     // set all object properties from real db data
     $this->update_from_db();
     $this->notify_changed(false);
     return $this->id;
 }
 /**
  * Updates this object in the Database, based on its object variables. ID must be set.
  * @param string $source from where was the object updated (mod/forum, manual, etc.)
  * @return boolean success
  */
 public function update()
 {
     global $DB;
     if (empty($this->id)) {
         debugging('Can not update tool object, no id!');
         return false;
예제 #6
0
 /**
  * @return array of course tools by [taskid][modality]
  */
 function load_tools()
 {
     $result = array();
     if ($evalcomix = evalcomix::fetch(array('courseid' => $this->courseid))) {
         if ($tools = evalcomix_tool::fetch_all(array('evxid' => $evalcomix->id))) {
             foreach ($tools as $tool) {
                 if ($modes = evalcomix_modes::fetch_all(array('toolid' => $tool->id))) {
                     foreach ($modes as $mode) {
                         $taskid = $mode->taskid;
                         $modality = $mode->modality;
                         $result[$taskid][$modality] = $tool;
                     }
                 }
             }
         }
     }
     return $result;
 }
    /**
	*Fetch all objects 
	*/
    public function testFetchAll()
    {
        $params = array('title' => 'titulo de la escala2');
        $result = evalcomix_tool::fetch_all($params);
예제 #8
0
	<script type="text/javascript">
		function urledit(u, nombre, edit){
			win2 = window.open(u, nombre, "menubar=0,location=0,scrollbars,resizable,width=780,height=500");
			checkChildedit(edit);
		}
		function checkChildedit(edit) {
			if (win2.closed) {
			 window.location.replace("' . $CFG->wwwroot . '/blocks/evalcomix/tool/index.php?id=' . $courseid . '&edit=" + edit);
		
				/*window.location.href = "' . $CFG->wwwroot . '/blocks/evalcomix/tool/index.php?id=' . $courseid . '&edit=" + edit;*/
		}
		else setTimeout("checkChildedit(\'"+edit+"\')",1);
		}
	</script>
';
include_once $CFG->dirroot . '/blocks/evalcomix/javascript/popup.php';
include_once $CFG->dirroot . '/blocks/evalcomix/classes/evalcomix_tool.php';
include_once $CFG->dirroot . '/blocks/evalcomix/classes/evalcomix.php';
include_once $CFG->dirroot . '/blocks/evalcomix/classes/webservice_evalcomix_client.php';
if ($tid) {
    $tooldelete = evalcomix_tool::fetch(array('id' => $tid));
    if ($tooldelete) {
        $response = webservice_evalcomix_client::get_ws_deletetool($tooldelete->idtool);
        $tooldelete->delete();
    }
}
if (isset($edit) && $edit != '' && $edit != 'undefined') {
    $tool = evalcomix_tool::fetch(array('idtool' => $edit));
    //llamada para obtener datos y actualizar. Por lo general
    $response = webservice_evalcomix_client::get_ws_list_tool($course->id, $tool->idtool);
    if ($response != false) {
 /**
  * Fetch all objects. Return an array with the required params
  */
 public function test_fetchall_ok()
 {
     $params = array('title' => 'hola');
     $result = evalcomix_tool::fetch_all($params);
     $this->assertIsA($result, 'array');
 }