public static function addPerson_olresult($obj_Person_olresult)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Person_olresult->OLResultId = DAL_managePerson_olresult::getLastPerson_olresultId() + 1;
     $sql = "INSERT INTO tbl_person_olresult (OLResultId,SubjectId,SchoolId,Grade,Language,DateTime,PersonId) \n\t\tVALUES (" . common::noSqlInject($obj_Person_olresult->OLResultId) . "," . "'" . common::noSqlInject($obj_Person_olresult->SubjectId) . "'" . "," . "'" . common::noSqlInject($obj_Person_olresult->SchoolId) . "'" . "," . "'" . common::noSqlInject($obj_Person_olresult->Grade) . "'" . "," . "'" . common::noSqlInject($obj_Person_olresult->Language) . "'" . "," . "'" . common::noSqlInject($obj_Person_olresult->DateTime) . "'" . "," . common::noSqlInject($obj_Person_olresult->PersonId) . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Person_olresult;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
function updatePerson_olresult($sessionkey, $appcode, $Person_olresultdata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Person_olresult = new Person_olresult();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "OLRESULTID":
                    $obj_Person_olresult->OLResultId = $child;
                    break;
                case "SUBJECTID":
                    $obj_Person_olresult->SubjectId = $child;
                    break;
                case "SCHOOLID":
                    $obj_Person_olresult->SchoolId = $child;
                    break;
                case "GRADE":
                    $obj_Person_olresult->Grade = $child;
                    break;
                case "LANGUAGE":
                    $obj_Person_olresult->Language = $child;
                    break;
                case "DATETIME":
                    $obj_Person_olresult->DateTime = $child;
                    break;
                case "PERSONID":
                    $obj_Person_olresult->PersonId = $child;
                    break;
            }
        }
        $obj_retResult_Person_olresult = DAL_managePerson_olresult::updatePerson_olresult($obj_Person_olresult);
        if ($obj_retResult_Person_olresult->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getPerson_olresultXml($obj_retResult_Person_olresult->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function isChildPerson_olresult($OLResultId, $ChildOLResultId)
 {
     $ischild = false;
     $obj_retResult = DAL_managePerson_olresult::getPerson_olresultListByOLResultId($ChildOLResultId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_Person_olresultList = $obj_retResult->data;
         $obj_Person_olresult = $arr_Person_olresultList[0];
         $arrParentIds = explode(",", $obj_Person_olresult->Url);
         foreach ($arrParentIds as $Person_olresultParentId) {
             if ($Person_olresultParentId == $OLResultId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }