public function applications_list($type_ = null) { $args = func_get_args(); // func_get_args(): Can't be used as a function parameter before PHP 5.3.0 $res = $this->__call('applications_list', $args); if ($res === null) { return null; } $applications = array(); foreach ($res as $item) { $application = new Application($item); if (!$application->is_valid()) { continue; } $applications[$application->getAttribute('id')] = $application; } return $applications; }
public function generateApplicationFromRow($row) { if (!isset($row['id']) || !isset($row['name']) || !isset($row['type']) || !isset($row['executable_path']) || !isset($row['published'])) { // no right attribute, we do nothing Logger::info('main', 'ApplicationDB_sql::getList app not insert'); // todo right the content return NULL; } else { if (!isset($row['package'])) { $row['package'] = NULL; } if ($row['type'] == 'weblink') { $r = new Application_weblink($row['id'], $row['name'], $row['description'], $row['executable_path']); unset($row['id']); unset($row['name']); unset($row['description']); unset($row['type']); unset($row['executable_path']); unset($row['package']); unset($row['desktopfile']); } elseif ($row['type'] == 'webapp') { $r = new Application_webapp($row['id'], $row['name'], $row['description']); unset($row['id']); unset($row['name']); unset($row['description']); unset($row['type']); unset($row['executable_path']); unset($row['package']); unset($row['desktopfile']); } else { $r = new Application($row['id'], $row['name'], $row['description'], $row['type'], $row['executable_path'], $row['package'], $row['published']); Logger::debug('main', 'ApplicationDB::load_mimetypes'); $liaisons = Abstract_Liaison::load('ApplicationMimeType', $r->getAttribute('id'), NULL); if (is_array($liaisons)) { $mimetypes = array(); foreach ($liaisons as $group => $liaison) { $mimetypes[] = $group; } $r->setMimeTypes($mimetypes); } } foreach ($row as $key => $value) { $r->setAttribute($key, $value); } return $r; } }