/**
  * Initialise l'autorisation.
  * @param Webos Le webos.
  * @param User $user L'utilisateur sous lequel on executera l'action.
  * @param string $file Le fichier qui demande l'action.
  */
 public function __construct(Webos $webos, models\User $user)
 {
     parent::__construct($webos);
     if ($user->getId() !== null) {
         $this->authorizations = $this->webos->managers()->get('User')->getAuthorisations($user->getId());
     }
 }
 /**
  * Initialiser une instance de FileBase.
  * @param Webos $webos Le webos.
  * @param string $path Le chemin du fichier a ouvrir.
  */
 public function __construct(\lib\Webos $webos, $path = null)
 {
     parent::__construct($webos);
     if (!empty($path)) {
         $this->open($path);
     }
 }
 /**
  * Initialise l'interface utilisateur.
  * @param Webos $webos Le webos.
  * @param string $name Le nom de l'interface.
  */
 public function __construct(\lib\Webos $webos, $name = false)
 {
     //On appelle le constructeur parent
     parent::__construct($webos);
     //Si le nom de l'interface n'est pas specifie
     if ($name === false) {
         $name = $this->webos->managers()->get('UserInterface')->getDefault();
     }
     //On charge l'interface par defaut
     $this->name = $name;
     //Quelques tests pour verifier que l'interface est complete...
     if (!$this->webos->managers()->get('File')->exists($this->_getInterfaceRoot())) {
         //Dossier d'index
         throw new InvalidArgumentException('Interface graphique "' . $name . '" introuvable : dossier "' . $this->_getInterfaceRoot() . '" inexistant');
     }
     $root = $this->webos->managers()->get('File')->get($this->_getInterfaceRoot());
     if (!$root->isDir()) {
         throw new InvalidArgumentException('Interface graphique "' . $name . '" introuvable : "' . $this->_getInterfaceRoot() . '" n\'est pas un dossier');
     }
     if (!$this->webos->managers()->get('File')->exists($this->_getInterfaceRoot() . '/config.xml')) {
         //Fichier de configuration
         throw new InvalidArgumentException('Erreur de lors du chargement de l\'interface graphique "' . $name . '" : fichier de configuration ("config.xml") introuvable');
     }
     if (!$this->webos->managers()->get('File')->exists($this->_getInterfaceRoot() . '/index.html')) {
         //Contenu (code HTML)
         throw new InvalidArgumentException('Erreur de lors du chargement de l\'interface graphique "' . $name . '" : fichier du contenu ("index.html") introuvable');
     }
     //Configuration de l'interface.
     $xml = new \DOMDocument();
     $xml->loadXML($this->webos->managers()->get('File')->get($this->_getInterfaceRoot() . '/config.xml')->contents());
     $attributes = $xml->getElementsByTagName('attribute');
     foreach ($attributes as $attr) {
         $this->attributes[$attr->getAttribute('name')] = $attr->getAttribute('value');
     }
     $includes = $xml->getElementsByTagName('includes')->item(0)->getElementsByTagName('file');
     foreach ($includes as $include) {
         //Fichiers a inclure
         $file = $this->webos->managers()->get('File')->get($include->getAttribute('path'));
         switch ($file->extension()) {
             case 'js':
                 $this->js[$file->path()] = $file->contents();
                 //On ajoute le code JS
                 break;
             case 'css':
                 $this->css[] = $file->contents();
                 //On ajoute le fichier CSS a la liste
                 break;
         }
     }
     //Contenu de l'interface (code HTML)
     $htmlFile = $this->webos->managers()->get('File')->get($this->_getInterfaceRoot() . '/index.html');
     $this->html = $htmlFile->contents();
     //Code Javascript
     if ($this->webos->managers()->get('File')->exists($this->_getInterfaceRoot() . '/index.js')) {
         $jsFile = $this->webos->managers()->get('File')->get($this->_getInterfaceRoot() . '/index.js');
         $this->js[$jsFile->path()] = $jsFile->contents();
     }
 }
 /**
  * Initialiser le terminal.
  * @param Webos $webos Le webos.
  * @param int $id L'ID du terminal.
  */
 public function __construct(\lib\Webos $webos, $id)
 {
     parent::__construct($webos);
     $this->id = $id;
     if ($this->webos->getUser()->isConnected()) {
         $this->location = '~';
     } else {
         $this->location = '/';
     }
     $this->_remember();
 }
 /**
  * Demarre le processus.
  * @param Webos $webos Le webos.
  * @param Authorization $auth Le niveau d'autorisation du processus.
  */
 public function __construct(\lib\Webos $webos, \lib\Authorization $auth)
 {
     //On appelle le constructeur du parent.
     parent::__construct($webos);
     $this->auth = $auth;
     //On stocke l'autorisation
     $this->pid = $this->_getNextId();
     //On determinse l'ID du processus
     $uniqueId = new \lib\UniqueId();
     $this->key = $uniqueId->getId();
     //On determine la clef du processus
     $this->childs = array();
     $this->startTime = microtime();
     //Date de demarrage
     $this->_register();
     //On ajoute le processus a la liste
 }
 /**
  * Initialiser le paquet.
  * @param Webos $webos Le webos.
  * @param Repository $repository Le depot sur lequel est le paquet.
  * @param string $name Le nom du paquet.
  */
 public function __construct(\lib\Webos $webos, Repository $repository, $name)
 {
     //On appelle le constructeur du parent
     parent::__construct($webos);
     //On enregistre les infos
     $this->name = $name;
     $this->repositorySource = $repository->getSource();
     $this->source = $this->repositorySource . '/packages/' . substr($name, 0, 1) . '/' . $name;
     $this->locked = false;
     if ($this->webos->managers()->get('File')->exists('/etc/apt/locked.xml')) {
         $xml = new \DOMDocument();
         $xml->loadXML($this->webos->managers()->get('File')->get('/etc/apt/locked.xml')->contents());
         $packages = $xml->getElementsByTagName('package');
         foreach ($packages as $package) {
             if ($package->getAttribute('name') == $this->getName()) {
                 $this->locked = (bool) (int) $package->getAttribute('locked');
             }
         }
     }
     //On charge les infos sur le paquet
     $this->load();
     $this->version = new \lib\Version($this->getAttribute('version'));
 }
 public function setWebos(\lib\Webos $webos)
 {
     parent::setWebos($webos);
     foreach ($this->packages as $name => $pkg) {
         $this->packages[$name]->setWebos($webos);
     }
 }
 public function __construct($webos, array $data = array())
 {
     parent::__construct($webos);
     $this->data = $data;
 }
 /**
  * Initialiser la configuration.
  */
 public function __construct(\lib\Webos $webos)
 {
     parent::__construct($webos);
     $this->domdocument = new \DOMDocument();
 }
 /**
  * Initialiser la classe.
  * @param Webos $webos
  */
 public function __construct(\lib\Webos $webos)
 {
     parent::__construct($webos);
     $this->daos = new Daos($webos);
 }