public function application_info($id_)
 {
     $args = func_get_args();
     // func_get_args(): Can't be used as a function parameter before PHP 5.3.0
     $res = $this->__call('application_info', $args);
     if ($res === null) {
         return null;
     }
     $application = new Application($res);
     if (!$application->is_valid()) {
         return null;
     }
     if (array_key_exists('tasks', $res)) {
         $tasks = array();
         foreach ($res['tasks'] as $item) {
             $task = new Task($item);
             if (!$task->is_valid()) {
                 continue;
             }
             $tasks[] = $task;
         }
         $application->setAttribute('tasks', $tasks);
     }
     return $application;
 }
Example #2
0
 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;
     }
 }