Answer the question
In order to leave comments, you need to log in
How to remove return parameters from a function?
Hello!
I want to pull the parameters from the API from the function.
Connected the module:
use Bitrix\Main\Loader;
Loader::includeModule("aelita.test");
Here is the function:
public function GetQuestioning($ProfileID,&$Test)
{
//echo "<pre>";print_r($Test);echo "</pre>";
$ProfileID=(int)$ProfileID;
$TestID=(int)$Test["ID"];
$Result=array();
$Select=array(
"ID",
"PROFILE_ID",
"TEST_ID",
"RESULT_ID",
"CLOSED",
"FINAL",
"DATE_START",
"DATE_STOP",
"DURATION",
"AVER_DURATION",
"GLASSES_ID",
"TEST_TYPE_RESULT",
"STEP_MULTIPLE",
);
if($ProfileID>0 && $TestID>0)
{
$el=new AelitaTestQuestioning();
$arFields=array(
"CLOSED"=>"N",
"TEST_ID"=>$TestID,
"PROFILE_ID"=>$ProfileID,
);
$res = $el->GetList(array("ID"=>"DESC"),$arFields,false,array("nPageSize"=>1),$Select);
if($arr=$res->GetNext())
{
$Result=$arr;
$arFields["<>ID"]=$arr["ID"];
$res = $el->GetList(array("ID"=>"DESC"),$arFields);
$arUpdate=array("CLOSED"=>"Y");
while($arr=$res->GetNext())
{
$el->Update($arr["ID"],$arUpdate);
}
}
}
return $Result;
}
$test = AelitaTestTools::GetQuestioning($ProfileID, $Test);
?>
<pre>
<?print_r($test)?>
</pre>
<?
Answer the question
In order to leave comments, you need to log in
You only have one place where something can be written to a variable, all other cases will be an empty array,
$Result=$arr;
but what should be returned?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question