Public Member Functions

ilObjHACPTracking Class Reference

Inheritance diagram for ilObjHACPTracking:
Collaboration diagram for ilObjHACPTracking:

Public Member Functions

 ilObjHACPTracking ($ref_id, $obj_id)
 Constructor public.
 getparam ($ref_id, $obj_id, $version, $aicc_data)
 putparam ($ref_id, $obj_id, $version, $aicc_data)
 exitau ($ref_id, $obj_id, $version, $aicc_data)
 startau ($ref_id, $obj_id, $version, $aicc_data)
 parseAICCData ($string)

Detailed Description

Definition at line 7 of file class.ilObjHACPTracking.php.


Member Function Documentation

ilObjHACPTracking::exitau ( ref_id,
obj_id,
version,
aicc_data 
)

Definition at line 87 of file class.ilObjHACPTracking.php.

References $obj_id, and $ref_id.

                                                                {
                $response=new ilHACPResponse($ref_id, $obj_id);
                $response->sendOk();
        }

ilObjHACPTracking::getparam ( ref_id,
obj_id,
version,
aicc_data 
)

Definition at line 41 of file class.ilObjHACPTracking.php.

References $obj_id, and $ref_id.

                                                                  {
                //if (empty($aicc_data)) {
                //      $this->startau($ref_id, $obj_id, $version, $aicc_data);
                //      return;
                //}
                
                $response=new ilHACPResponse($ref_id, $obj_id);
                $response->sendParam(); 
                
/*              
                $fp=fopen("./content/hacp.log", "a+");
                fputs($fp, "getparam ref_id=$ref_id, obj_id=$obj_id, aicc_data=$aicc_data\n");  
                fclose($fp);    
*/
        }

ilObjHACPTracking::ilObjHACPTracking ( ref_id,
obj_id 
)

Constructor public.

Definition at line 13 of file class.ilObjHACPTracking.php.

References $command, $ilias, $key, $obj_id, $ref_id, and exit.

        {
                global $ilias, $HTTP_POST_VARS;
                global $ilDB, $ilUser;
                
        
                //just to make sure to extract only this parameter 
                $mainKeys=array("command", "version", "session_id", "aicc_data");
                $postVars=array_change_key_case($HTTP_POST_VARS, CASE_LOWER);
                foreach($mainKeys as $key) {
                        $$key=$postVars[$key];
                }
                
                //only allowed commands
                $command=strtolower($command);
                $allowedCommands=array("getparam", "putparam", "exitau");
                if (!in_array($command, $allowedCommands)) {
                        exit;
                }
/*                      
                $fp=fopen("./content/hacp.log", "a+");
                fputs($fp, "$command ref_id=$ref_id, obj_id=$obj_id\n");        
                fclose($fp);                    
*/              
                $this->$command($ref_id, $obj_id, $version, $aicc_data);
                
        }

ilObjHACPTracking::parseAICCData ( string  ) 

Definition at line 97 of file class.ilObjHACPTracking.php.

References $data.

Referenced by putparam().

                                        {
                $data=array();
                if (!empty($string)) {
                        $lines=explode("\n", $string);
                        for($i=0;$i<count($lines);$i++) {
                                $line=trim($lines[$i]);
                                if (empty($line) || substr($line,0,1)==";" || substr($line,0,1)=="#"){
                                        continue;
                                }
                                if (substr($line,0,1)=="[") {
                                        $block=substr($line,1,-1);
                                        continue;
                                }
                                if (empty($block))
                                        continue;
                                
                                if (substr_count($line, "=")==0)
                                        $data[strtolower("cmi.".$block)]=$line;
                                else if (substr_count($line, "=")==1) {
                                        $line=explode("=", $line);
                                        $data[strtolower("cmi.".$block.".".$line[0])]=$line[1];
                                }
                        }
                }
                return $data;
        }

Here is the caller graph for this function:

ilObjHACPTracking::putparam ( ref_id,
obj_id,
version,
aicc_data 
)

Definition at line 57 of file class.ilObjHACPTracking.php.

References $data, $key, $obj_id, $ref_id, $set, $user_id, _lookupObjId(), parseAICCData(), and ilObjSCORMTracking::store().

                                                                  {
                //aiccdata is a non standard ini format
                //$data=parse_ini_file($tmpFilename, TRUE);
                $data=$this->parseAICCData($aicc_data);

                //choose either insert or update to be able to inherit superclass
                global $ilDB, $ilUser;
                $this->update=array();
                $this->insert=array();
                if (is_object($ilUser)) {
                        $user_id = $ilUser->getId();
                        foreach ($data as $key=>$value) {
                                $stmt = "SELECT * FROM scorm_tracking WHERE user_id = ".$ilDB->quote($user_id).
                                        " AND sco_id = ".$ilDB->quote($obj_id)." AND lvalue = ".$ilDB->quote($key);
                                $set = $ilDB->query($stmt);
                                if ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))
                                        $this->update[] = array("left" => $key, "right" => $value);
                                else
                                        $this->insert[] = array("left" => $key, "right" => $value);
                        }
                }
                
                //store
                $hacp_id = ilObject::_lookupObjId($ref_id);
                $this->store($hacp_id, $obj_id, 0);
                
                $response=new ilHACPResponse($ref_id, $obj_id);
                $response->sendOk();
        }

Here is the call graph for this function:

ilObjHACPTracking::startau ( ref_id,
obj_id,
version,
aicc_data 
)

Definition at line 92 of file class.ilObjHACPTracking.php.

References $obj_id, and $ref_id.

                                                                 {
                $response=new ilHACPResponse($ref_id, $obj_id);
                $response->sendParam(); 
        }


The documentation for this class was generated from the following file: