/** */ public static function listTypes($status = USED, $sort = 'name', $operator = OPERATOR_EQUAL) { return parent::listTypes($status, $sort, $operator, 'data_type', 'data_type'); }
/** Returs the types on the system. status = (used/deleted/all) shows types */ public static function listTypesRestricted($status = USED, $sort = 'name', $operator = OPERATOR_EQUAL, $table, $class, $datos = false, $restrictedTypes) { global $ari; $clause = ""; if ($status != "all") { $status = $ari->db->qMagic($status); $clause = " AND status {$operator} {$status} "; } if (!is_array($restrictedTypes)) { $restrictedTypes = array($restrictedTypes); } $first = true; foreach ($restrictedTypes as $type) { $type = $ari->db->qMagic($type); if ($first) { $lista = $type; $first = false; } else { $lista .= "," . $type; } } $mas_datos = ""; if (is_array($datos)) { foreach ($datos as $item) { $mas_datos .= "," . $item['field']; } } if (in_array($sort, OOB_type::getOrders())) { $sortby = " ORDER BY {$sort}"; } else { $sortby = " ORDER BY name"; } $sql = "SELECT ID,Name,Description,Status {$mas_datos} \n\t\t\t\tFROM {$table} \n\t\t\t\tWHERE ID NOT IN ({$lista})\n\t\t\t\t{$clause} \n\t\t\t\t{$sortby}\n\t\t\t "; //echo $sql;exit; $savem = $ari->db->SetFetchMode(ADODB_FETCH_NUM); $rs = $ari->db->Execute($sql); $ari->db->SetFetchMode($savem); $i = 0; if ($rs && !$rs->EOF) { while (!$rs->EOF) { $return[$i] = new $class(ID_UNDEFINED); $return[$i]->set('id', $rs->fields[0]); $return[$i]->set('name', $rs->fields[1]); $return[$i]->set('description', $rs->fields[2]); $return[$i]->set('status', $rs->fields[3]); $j = 4; if (is_array($datos)) { foreach ($datos as $item) { $return[$i]->set($item['field'], $rs->fields[$j]); $j++; } } $i++; $rs->MoveNext(); } $rs->Close(); } else { return false; } return $return; }