0

このコードを codeigniter MVC に変換するのに助けが必要です。ビューアー用の 3 つのファイル php Openlink3.php クラス用の class.php とモデル用の databaseConnection.php があります。

このphpファイルをcodeigniterに変換する際に問題があります。私を助けてください。

これは私のPHPコード Openlink.php

<?php
include("DatabaseConnection.php");
include("class.php");

Global $AppCode;
//$AppCode='0001';
$user='0772';

$db = new dbconnection();
$conn = $db->dbOpen();

$misApp = new misApplication();

$sql="SELECT a.RAL_Code,a.RAL_App_Name,a.RAL_Remarks,b.RAL_APPIconLocation,b.RAL_ApplicationLink FROM R_Application_List as a ,R_Application_Links as b where a.RSC_Active=1 and a.RAL_Code=b.RAL_APPCODE";
        $rs=odbc_exec($conn,$sql);
        $appcount;
        echo "<table align=center cellpadding=10>";
        echo "<tr height=120>";
        $appcount=0;
        while (odbc_fetch_row($rs))
        {
            $appcode=odbc_result($rs,"RAL_Code");
            $appname=odbc_result($rs,"RAL_App_Name");
            $desc=odbc_result($rs,"RAL_Remarks");
            $icon=odbc_result($rs,"RAL_APPIconLocation");
            $applink=trim(odbc_result($rs,"RAL_ApplicationLink"));



            if($appcount==3){
            echo "<tr height=120>";
            //echo "<td>";

            $appcount=0;
            }
            //echo "<td>".$appcode."</td>";
            //echo "<td>".$appname."</td>";
            echo "<td valign=bottom><img src=".$icon."height=30 width=150 onclick='openApp(\"$appcode\",\"$user\",\"$applink\");' </img></td>";
            //echo "<td><input type=\"button\" ></td>"
            //echo "<td>".$desc."</td>";
            echo '<script>openApp();</script>';

            $appcount++;
            //echo $icon."<br/>";

        }
        echo "</table>";
?>

<img src="dtr.png" height="30" width="150" onclick=openApp("0001","<?php echo $user; ?>","<?php echo $appLink = $misApp->getAppLink($conn,"0001",$user); ?>") ></img></br>
<input type="button" id="btn.DTR"; name="btn.Dtr"; value="DTR"; onclick='openApp("0001","<?php echo $user; ?>","<?php echo $appLink = $misApp->getAppLink($conn,"0001",$user); ?>")'/>

<input type="button" id="jose"; name="btn.OpenApp"; value="Approval System(test)"; background="dtr.png";onclick='openApp("0014","<?php echo $user; ?>","<?php echo $appLink = $misApp->getAppLink($conn,"0002",$user); ?>")'/>

<script language="javascript">
function openApp(Appcode, User, link){

var OpenLink;

OpenLink = link+"?A1="+User+"&A2="+Appcode; // Concatenating strings
//alert(OpenLink);

//document.write (OpenLink); // printing the Concatenated string

//window.open(OpenLink);
//window.open(OpenLink,'_blank', 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10000, top=10000, width=10, height=10, visible=none', '');
 window.location.href = OpenLink;

}
</script>

</html>

これは私のPHPコードclass.php

<?php

class misApplication{

    public function getAppLink($actveConn,$appCode,$user){
        $linktoOpen;
        $sql="select * from R_Application_Links where RAL_APPCode='$appCode'";
        $rs=odbc_exec($actveConn,$sql);

        while (odbc_fetch_row($rs))
        {
            $a=odbc_result($rs,"RAL_APPCode");
            $b=odbc_result($rs,"RAL_InstallationLink");
            $link=odbc_result($rs,"RAL_ApplicationLink");
            $d=odbc_result($rs,"RAL_APPIconLocation");
        }
        $linktoOpen = $link.$user.$appCode;
        return trim($link);

        odbc_close($actveConn);

    }
}
?>

データベース接続.php

<?php

class dbconnection{

    public function dbOpen(){
        $conn=odbc_connect("Global02","USER-00","USER00");
        if (!$conn){
            exit("Connection Failed: " . $conn);
        }
        else{
            return $conn;
        }
    }
}

?>

変換すると、常にエラーが発生します。

4

1 に答える 1