Код: Выделить всё
function addDevice($device_type, $options=0) {
$this->setDictionary();
$type_details=$this->getTypeDetails($rec['TYPE']);
if (!is_array($options)) {
$options=array();
}
if (!is_array($this->device_types[$device_type])) {
return 0;
}
$rec=array();
$rec['TYPE']=$device_type;
if ($options['TITLE']) {
$rec['TITLE']=$options['TITLE'];
} else {
$rec['TITLE']='New device '.date('H:i');
}
if ($options['LOCATION_ID']) {
$rec['LOCATION_ID']=$options['LOCATION_ID'];
}
$rec['ID']=SQLInsert('devices',$rec);
if ($rec['LOCATION_ID']) {
$location_title=getRoomObjectByLocation($rec['LOCATION_ID'],1);
}
if (!$rec['LINKED_OBJECT']) {
$new_object_title=ucfirst($rec['TYPE']).$this->getNewObjectIndex($type_details['CLASS']);
$object_id=addClassObject($type_details['CLASS'],$new_object_title,'sdevice'.$rec['ID']);
$rec['LINKED_OBJECT']=$new_object_title;
if (preg_match('/New device .+/',$rec['TITLE'])) {
$rec['TITLE']=$rec['LINKED_OBJECT'];
}
SQLUpdate('devices',$rec);
}
if ($table_rec['ID']) {
$this->addDeviceToSourceTable($options['TABLE'],$table_rec['ID'],$rec['ID']);
}
if ($options['ADD_MENU']) {
$this->addDeviceToMenu($rec['ID']);
}
if ($options['ADD_SCENE']) {
$this->addDeviceToScene($rec['ID']);
}
return 1;
}
ГДЕ она возмет $rec['TYPE'] ???
Или я чего то не понимаю....???