surveylist = $list; $this->plainsurveylist = $plain_array; } /** * This function gets the parent id of a survey * * @param int survey id * @return int survey parent id * * @author Julio Montoya , Dokeos * @version September 2008 */ public function getParentId($id) { $node = $this->plainsurveylist[$id]; if (is_array($node)&& !empty($node['parent_id'])) { return $node['parent_id']; } else { return -1; } } /** * This function creates a list of all surveys id * @param list of nodes * @return array with the structure survey_id => survey_name * @author Julio Montoya * @version September 2008 */ public function createList ($list) { $result = array(); if (is_array($list)) { foreach ($list as $key=>$node) { if (isset($node['children']) && is_array($node['children'])) { //echo $key; echo '--
'; //print_r($node); //echo '
'; $result[$key]= $node['name']; $re = self::createList($node['children']); if (!empty($re)) { if (is_array($re)) { foreach ($re as $key=>$r) { $result[$key]=''.$r; } } else { $result[]=$re; } } } else { $result[$key]=$node['name']; } } } return $result; } }