Пример #1
0
 public static function addSociety($obj_Society)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Society->SocietyId = DAL_manageSociety::getLastSocietyId() + 1;
     $sql = "INSERT INTO tbl_society (SocietyId,Name,Description,Mission,SocietyTypeId,SocietyAddress) \n\t\tVALUES (" . common::noSqlInject($obj_Society->SocietyId) . "," . "'" . common::noSqlInject($obj_Society->Name) . "'" . "," . "'" . common::noSqlInject($obj_Society->Description) . "'" . "," . "'" . common::noSqlInject($obj_Society->Mission) . "'" . "," . common::noSqlInject($obj_Society->SocietyTypeId) . "," . "'" . common::noSqlInject($obj_Society->SocietyAddress) . "'" . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Society;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
Пример #2
0
function updateSociety($sessionkey, $appcode, $Societydata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Society = new Society();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "SOCIETYID":
                    $obj_Society->SocietyId = $child;
                    break;
                case "NAME":
                    $obj_Society->Name = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Society->Description = $child;
                    break;
                case "MISSION":
                    $obj_Society->Mission = $child;
                    break;
                case "SOCIETYTYPEID":
                    $obj_Society->SocietyTypeId = $child;
                    break;
                case "SOCIETYADDRESS":
                    $obj_Society->SocietyAddress = $child;
                    break;
            }
        }
        $obj_retResult_Society = DAL_manageSociety::updateSociety($obj_Society);
        if ($obj_retResult_Society->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getSocietyXml($obj_retResult_Society->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
Пример #3
0
 public static function isChildSociety($SocietyId, $ChildSocietyId)
 {
     $ischild = false;
     $obj_retResult = DAL_manageSociety::getSocietyListBySocietyId($ChildSocietyId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_SocietyList = $obj_retResult->data;
         $obj_Society = $arr_SocietyList[0];
         $arrParentIds = explode(",", $obj_Society->Url);
         foreach ($arrParentIds as $SocietyParentId) {
             if ($SocietyParentId == $SocietyId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }