Overview

Packages

  • ClipIt
    • clipit
      • api
    • urjc
      • backend
  • Elgg
    • Core
      • Access
      • Authentication
      • Cache
      • Caches
      • Core
      • DataMode
        • Site
      • DataModel
        • Annotations
        • Entities
        • Extender
        • File
        • Importable
        • Loggable
        • Notable
        • Object
        • User
      • DataStorage
      • Exception
      • Exceptions
        • Stub
      • FileStore
        • Disk
      • Groups
      • Helpers
      • HMAC
      • Memcache
      • Metadata
      • Navigation
      • ODD
      • Output
      • Plugins
        • Settings
      • Sessions
      • SocialModel
        • Friendable
        • Locatable
      • WebServicesAPI
      • Widgets
      • XML
      • XMLRPC
    • Exceptions
      • Stub
  • None
  • PHP

Classes

  • ClipitActivity
  • ClipitChat
  • ClipitComment
  • ClipitEvent
  • ClipitExample
  • ClipitFile
  • ClipitGroup
  • ClipitLA
  • ClipitLabel
  • ClipitPerformanceItem
  • ClipitPerformanceRating
  • ClipitPost
  • ClipitQuiz
  • ClipitQuizQuestion
  • ClipitQuizResult
  • ClipitRating
  • ClipitRemoteTrickyTopic
  • ClipitRemoteVideo
  • ClipitResource
  • ClipitSite
  • ClipitStoryboard
  • ClipitTag
  • ClipitTagRating
  • ClipitTask
  • ClipitTrickyTopic
  • ClipitUser
  • ClipitVideo
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * ClipIt - JuxtaLearn Web Space
 4:  * PHP version:     >= 5.2
 5:  * Creation date:   2013-10-10
 6:  * Last update:     $Date$
 7:  * @author          Pablo LlinĂ¡s Arnaiz <pebs74@gmail.com>, URJC JuxtaLearn Team
 8:  * @version         $Version$
 9:  * @link            http://www.juxtalearn.eu
10:  * @license         GNU Affero General Public License v3
11:  * @package         ClipIt
12:  * @subpackage      clipit_api
13:  */
14: 
15: /**
16:  * Learning Analytics instance and interface class, for working with the external Learning Analytics Toolkit.
17:  */
18: class ClipitLA extends UBItem {
19:     /**
20:      * @const string Elgg entity SUBTYPE for this class
21:      */
22:     const SUBTYPE = "ClipitLA";
23:     public $status_code = 0;
24:     public $metric_id = "";
25:     public $context = array();
26:     public $file_id = 0;
27:     public $metric_received = false;
28: 
29: 
30:     /**
31:      * Loads object parameters stored in Elgg
32:      *
33:      * @param ElggObject $elgg_object Elgg Object to load parameters from.
34:      */
35:     protected function copy_from_elgg($elgg_object) {
36:         parent::copy_from_elgg($elgg_object);
37:         $this->status_code = (int)$elgg_object->get("status_code");
38:         $this->metric_id = (string)$elgg_object->get("metric_id");
39:         $this->file_id = (int)$elgg_object->get("file_id");
40:         $this->metric_received = (bool)$elgg_object->get("metric_received");
41:         $this->context = unserialize((string)$elgg_object->get("context"));
42:     }
43: 
44:     /**
45:      * Copy $this file parameters into an Elgg File entity.
46:      *
47:      * @param ElggObject $elgg_object Elgg object instance to save $this to
48:      */
49:     protected function copy_to_elgg($elgg_object) {
50:         parent::copy_to_elgg($elgg_object);
51:         $elgg_object->set("status_code", (int)$this->status_code);
52:         $elgg_object->set("metric_id", (string)$this->metric_id);
53:         $elgg_object->set("file_id", (int)$this->file_id);
54:         $elgg_object->set("metric_received", (bool)$this->metric_received);
55:         $elgg_object->set("context", (string)serialize($this->context));
56:     }
57: 
58:     static function get_metric($metric_id, $context) {
59:         if(!$la_metrics_class = (string)elgg_get_config("la_metrics_class")){
60:             error_log("No metrics class!");
61:             return null;
62:         }
63: 
64:         $la_id = (int)$la_metrics_class::get_metric($metric_id, $context);
65:         if(empty($la_id)){
66:             error_log("No la_id");
67:             return null;
68:         }
69:         return new static($la_id);
70:     }
71: 
72:     static function save_metric($return_id, $data, $status_code) {
73:         $prop_value_array["data"] = $data;
74:         $la_file_id = ClipitFile::set_properties(null, $prop_value_array);
75:         $prop_value_array = array();
76:         $prop_value_array["file_id"] = $la_file_id;
77:         $prop_value_array["status_code"] = (int)$status_code;
78:         $prop_value_array["metric_received"] = true;
79:         return static::set_properties($return_id, $prop_value_array);
80:     }
81: }
API documentation generated by ApiGen 2.8.0