mirror of
https://gitlab.com/CodeSolutionsProject/CodeShare.git
synced 2026-03-13 05:42:02 +01:00
@@ -11,10 +11,16 @@
|
||||
* Methods to get an array to send to twig
|
||||
*/
|
||||
|
||||
function lastToArray(&$query,$supported){
|
||||
function lastToArray(&$query,$supported,$db,$idu=0){
|
||||
$last = array();
|
||||
$list = $query->fetchAll();
|
||||
foreach($list as $var){
|
||||
$like=0;
|
||||
$save=0;
|
||||
if($idu!=0){
|
||||
$like = $db->iVote($idu,$var['IDC'],$var['Lang']);
|
||||
$save = $db->iSave($idu,$var['IDC'],$var['Lang']);
|
||||
}
|
||||
$array = array
|
||||
( "idc" => $var["IDC"],
|
||||
"lang" => $var["Lang"],
|
||||
@@ -24,13 +30,21 @@ function lastToArray(&$query,$supported){
|
||||
"lLang" => $supported[$var["Lang"]][0],
|
||||
"description" => $var["Description"],
|
||||
"code" => html_entity_decode($var["Code"]),
|
||||
"like" => $like,
|
||||
"save" => $save
|
||||
);
|
||||
array_push($last,$array);
|
||||
}
|
||||
return $last;
|
||||
}
|
||||
|
||||
function allCodeToArray(&$query,$supported){
|
||||
function allCodeToArray(&$query,$supported,$db,$idu=0){
|
||||
$like=0;
|
||||
$save=0;
|
||||
if($idu!=0){
|
||||
$like = $db->iVote($idu,$query['IDC'],$query['Lang']);
|
||||
$save = $db->iSave($idu,$query['IDC'],$query['Lang']);
|
||||
}
|
||||
$code = array(
|
||||
"idc" => $query['IDC'],
|
||||
"lang" => $query['Lang'],
|
||||
@@ -46,6 +60,8 @@ function allCodeToArray(&$query,$supported){
|
||||
"rows" => substr_count($query['Code'],"\n"),
|
||||
"extlib" => $query['UseExtLib'],
|
||||
"extlibver" => $query['UseExtLibVer'],
|
||||
"like" => $like,
|
||||
"save" => $save
|
||||
);
|
||||
return $code;
|
||||
|
||||
@@ -65,6 +81,22 @@ function otherImplementationToArray(&$query,$supported){
|
||||
return $other;
|
||||
}
|
||||
|
||||
function savedToArray($query,$supported){
|
||||
$saved = array();
|
||||
foreach($query as $var){
|
||||
$array = array
|
||||
(
|
||||
"idc" => $var['IDC'],
|
||||
"lang" => $var['Lang'],
|
||||
"version" => $var['Version'],
|
||||
"lLang" => $supported[$var["Lang"]][0],
|
||||
"name" => $var['Name']
|
||||
);
|
||||
array_push($saved,$array);
|
||||
}
|
||||
return $saved;
|
||||
}
|
||||
|
||||
function otherVersionToArray(&$query,$supported){
|
||||
return lastToArray($query,$supported);
|
||||
}
|
||||
Reference in New Issue
Block a user