我是 Codeigniter 的新手,我正在研究 API 类,以下是 API 代码
<?php
require_once("WiZiQService.php");
class ScheduleClass{
function ScheduleClass($secretAcessKey,$access_key,$webServiceUrl)
{
require_once("AuthBase.php");
$authBase = new AuthBase($secretAcessKey,$access_key);
$method = "create";
$requestParameters["signature"]=$authBase->GenerateSignature($method,$requestParameters);
#for teacher account pass parameter 'presenter_email'
//This is the unique email of the presenter that will identify the presenter in WizIQ. Make sure to add
//this presenter email to your organization’s teacher account. ’ For more information visit at: (http://developer.wiziq.com/faqs)
$requestParameters["presenter_email"]=$By_PresenterEmail;//"kerrygun@gmail.com";
#for room based account pass parameters 'presenter_id', 'presenter_name'
//$requestParameters["presenter_id"] = "40";
//$requestParameters["presenter_name"] = "vinugeorge";
$requestParameters["start_time"] = $By_StartTime;//"2011-12-25 11:55";
$requestParameters["title"]=$By_ClassTitle;//"my php-class"; //Required
$requestParameters["duration"]=$By_ClassDuration; //optional
$requestParameters["time_zone"]=$By_TimeZone; //optional
$requestParameters["attendee_limit"]=$By_AttendeeLimit; //optional
$requestParameters["control_category_id"]=$By_ControlCategory; //optional
$requestParameters["create_recording"]=$By_CreateRecording; //optional
$requestParameters["return_url"]=$By_ReturnUrl; //optional
$requestParameters["status_ping_url"]=$By_StatusPingUrl; //optional
$requestParameters["language_culture_name"]=$By_LanguageCulture;
$httpRequest=new HttpRequest();
try
{
$XMLReturn=$httpRequest->wiziq_do_post_request($webServiceUrl.'?method=create',http_build_query($requestParameters, '', '&'));
}
catch(Exception $e)
{
echo $e->getMessage();
}
if(!empty($XMLReturn))
{
try
{
$objDOM = new DOMDocument();
$objDOM->loadXML($XMLReturn);
}
catch(Exception $e)
{
echo $e->getMessage();
}
$status=$objDOM->getElementsByTagName("rsp")->item(0);
$attribNode = $status->getAttribute("status");
if($attribNode=="ok")
{
$methodTag=$objDOM->getElementsByTagName("method");
echo "method=".$method=$methodTag->item(0)->nodeValue;
$class_idTag=$objDOM->getElementsByTagName("class_id");
echo "<br>Class ID=".$class_id=$class_idTag->item(0)->nodeValue;
$recording_urlTag=$objDOM->getElementsByTagName("recording_url");
echo "<br>recording_url=".$recording_url=$recording_urlTag->item(0)->nodeValue;
$presenter_emailTag=$objDOM->getElementsByTagName("presenter_email");
echo "<br>presenter_email=".$presenter_email=$presenter_emailTag->item(0)->nodeValue;
$presenter_urlTag=$objDOM->getElementsByTagName("presenter_url");
echo "<br>presenter_url=".$presenter_url=$presenter_urlTag->item(0)->nodeValue;
}
else if($attribNode=="fail")
{
$error=$objDOM->getElementsByTagName("error")->item(0);
echo "<br>errorcode=".$errorcode = $error->getAttribute("code");
echo "<br>errormsg=".$errormsg = $error->getAttribute("msg");
}
}//end if
}//end function
}
?>
所以我的问题是,我如何将值从控制器传递到附加的外部类,并且输出应该返回到控制器,然后将其发送到视图。
我正在尝试像这样使用它:
class Form extends CI_Controller {
public function index() {
$this->load->library('Create');
$this->load->view('form_view');
}
public function wizprocess() {
$this->load->library('Create');
$this->Create->ScheduleClass();
}
}
您对上述问题的解决方案将不胜感激