Exemplo n.º 1
0
Arquivo: iq.php Projeto: razzman/mi
 /**
  * choosePackage method
  *
  * @return void
  * @access protected
  */
 protected function _choosePackage($action = 'to install', $installed = false)
 {
     if ($installed) {
         $plugins = MiInstall::plugins();
         foreach ($plugins as $plugin) {
             $this->out($plugin);
         }
         $choice = $this->in('Type the name of what you want ' . $action);
         if (!$choice) {
             $this->out('no choice made');
             $this->_stop();
         }
         return $choice;
     }
     $page = 0;
     $options = MiInstall::details($this->params);
     $options = array_chunk($options, 5, true);
     $choice = false;
     while (!$choice && $page < count($options)) {
         $this->out('id                  Description');
         $this->hr();
         foreach ($options[$page] as $id => $description) {
             $id = str_pad($id, 20);
             $this->out($id . $description);
         }
         $choice = $this->in("Type the name of what you want {$action}, or enter for more options");
         $page++;
     }
     if (!$choice || !MiInstall::details($choice)) {
         $this->out('no choice made');
         $this->_stop();
     }
     return $choice;
 }
Exemplo n.º 2
0
 /**
  * remove method
  *
  * @param mixed $id null
  * @param array $params array()
  * @return void
  * @access public
  */
 public function remove($id = null, $params = array())
 {
     if (!$id) {
         return false;
     }
     if (is_array($id)) {
         $details = $id;
         $id = $id['Package'];
     } else {
         $details = MiInstall::details($id);
     }
     if (!$details) {
         return false;
     }
     $method = Inflector::pluralize($details['Type']);
     $all = array_flip(MiInstall::$method());
     if (!isset($all[$id])) {
         return false;
     }
     $Folder = new Folder($all[$id]);
     $Folder->delete();
     return $Folder->messages();
 }