/**
  * Constructor.
  * @throws            Command_Exception.
  */
 public function __construct()
 {
     global $DB, $STANDARD_PLUGIN_TYPES;
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdpluginsetupname', 'vmoodleadminset_plugins');
     $cmd_desc = vmoodle_get_string('cmdpluginsetupdesc', 'vmoodleadminset_plugins');
     $pm = \plugin_manager::instance();
     $allplugins = $pm->get_plugins();
     $pluginlist = array();
     foreach ($allplugins as $type => $plugins) {
         foreach ($plugins as $p) {
             if (array_key_exists($type, $STANDARD_PLUGIN_TYPES)) {
                 $pluginlist[$type . '/' . $p->name] = $STANDARD_PLUGIN_TYPES[$type] . ' : ' . $p->displayname;
             }
         }
     }
     asort($pluginlist, SORT_STRING);
     $plugin_param = new Command_Parameter('plugin', 'enum', vmoodle_get_string('pluginparamdesc', 'vmoodleadminset_plugins'), null, $pluginlist);
     $states = array();
     $states['enable'] = vmoodle_get_string('enable', 'vmoodleadminset_plugins');
     $states['disable'] = vmoodle_get_string('disable', 'vmoodleadminset_plugins');
     $state_param = new Command_Parameter('state', 'enum', vmoodle_get_string('pluginstateparamdesc', 'vmoodleadminset_plugins'), null, $states);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, array($plugin_param, $state_param));
 }
 /**
  * Constructor.
  * @throws Command_Exception.
  */
 public function __construct()
 {
     global $DB;
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdsynccapabilityname', 'vmoodleadminset_roles');
     $cmd_desc = vmoodle_get_string('cmdsynccapabilitydesc', 'vmoodleadminset_roles');
     // Creating platform parameter.
     $platform_param = new Command_Parameter('platform', 'enum', vmoodle_get_string('platformparamsyncdesc', 'vmoodleadminset_roles'), null, get_available_platforms());
     // Getting role parameter.
     $roles = role_fix_names(get_all_roles(), \context_system::instance(), ROLENAME_ORIGINAL);
     $rolemenu = array();
     foreach ($roles as $r) {
         $rolemenu[$r->shortname] = $r->name;
     }
     $role_param = new Command_Parameter('role', 'enum', vmoodle_get_string('roleparamsyncdesc', 'vmoodleadminset_roles'), null, $rolemenu);
     // Creating capability parameter.
     $records = $DB->get_records('capabilities', null, 'name', 'name');
     $capabilities = array();
     foreach ($records as $record) {
         $capabilities[$record->name] = get_capability_string($record->name);
     }
     asort($capabilities);
     $capability_param = new Command_Parameter('capability', 'enum', vmoodle_get_string('capabilityparamsyncdesc', 'vmoodleadminset_roles'), null, $capabilities);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, array($platform_param, $role_param, $capability_param));
 }
 /**
  * Constructor.
  * @throws                Command_Exception.
  */
 public function __construct()
 {
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdupgradename', 'vmoodleadminset_upgrade');
     $cmd_desc = vmoodle_get_string('cmdupgradedesc', 'vmoodleadminset_upgrade');
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc);
 }
 /**
  * Constructor.
  * @param string $name Command's name.
  * @param string $description Command's description.
  * @param string $sql SQL command.
  * @param string $parameters Command's parameters (optional / could be null, Command_Parameter object or Command_Parameter array).
  * @param Command $rpcommand Retrieve platforms command (optional / could be null or Command object).
  * @throws Command_Exception
  */
 public function __construct($name, $description, $parameters = null, $rpcommand = null)
 {
     global $vmcommands_constants;
     // Creating Command.
     parent::__construct($name, $description, $parameters, $rpcommand);
     if (is_null($parameters) || is_array($parameters)) {
         throw new Command_Maintenance_Exception('messageparamonly');
     }
     if ($parameters->getName() != 'message') {
         throw new Command_Maintenance_Exception('messageparamonly');
     }
 }
 /**
  * Constructor.
  * @throws Command_Exception.
  */
 public function __construct()
 {
     global $DB, $STANDARD_PLUGIN_TYPES;
     /*
     @TODO : consider using get_plugin_types()
     */
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdcomparename', 'vmoodleadminset_plugins');
     $cmd_desc = vmoodle_get_string('cmdcomparedesc', 'vmoodleadminset_plugins');
     $plugin_param = new Command_Parameter('plugintype', 'enum', vmoodle_get_string('plugintypeparamcomparedesc', 'vmoodleadminset_plugins'), null, $STANDARD_PLUGIN_TYPES);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, $plugin_param);
 }
 /**
  * Constructor.
  * @param string $name Command's name.
  * @param string $description Command's description.
  * @param string $sql SQL command.
  * @param string $parameters Command's parameters (optional / could be null, Command_Parameter object or Command_Parameter array).
  * @param Command $rpcommand Retrieve platforms command (optional / could be null or Command object).
  * @throws Command_Exception
  */
 public function __construct($name, $description, $parameters = null, $rpcommand = null)
 {
     global $vmcommands_constants;
     // Creating Command.
     parent::__construct($name, $description, $parameters, $rpcommand);
     if (is_null($parameters) || !is_array($parameters)) {
         throw new Command_SetConfig_Exception('arrayexpected');
     }
     foreach ($parameters as $param) {
         if (!in_array($param->getName(), array('key', 'value'))) {
             throw new Command_SetConfig_Exception('unexpectedparam');
         }
     }
 }
 /**
  * Constructor.
  * @throws Command_Exception.
  */
 public function __construct()
 {
     global $DB;
     // Getting command description
     $cmd_name = vmoodle_get_string('cmdallowcomparename', 'vmoodleadminset_roles');
     $cmd_desc = vmoodle_get_string('cmdallowcomparedesc', 'vmoodleadminset_roles');
     // Creating table parameter
     $tables['assign'] = vmoodle_get_string('assigntable', 'vmoodleadminset_roles');
     $tables['override'] = vmoodle_get_string('overridetable', 'vmoodleadminset_roles');
     $tables['switch'] = vmoodle_get_string('switchtable', 'vmoodleadminset_roles');
     $table_param = new Command_Parameter('table', 'enum', vmoodle_get_string('tableparamdesc', 'vmoodleadminset_roles'), null, $tables);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, $table_param);
 }
 /**
  * Constructor.
  * @throws Command_Exception.
  */
 function __construct()
 {
     global $DB;
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdsyncname', 'vmoodleadminset_plugins');
     $cmd_desc = vmoodle_get_string('cmdsyncdesc', 'vmoodleadminset_plugins');
     // Creating platform parameter. This is the source platform.
     $platform_param = new Command_Parameter('platform', 'enum', vmoodle_get_string('platformparamsyncdesc', 'vmoodleadminset_plugins'), null, get_available_platforms());
     // Creating plugins type parameter. If this parameter has a value,
     // then all plugins in this type will be synchronized
     $plugintypes = get_plugin_types();
     $plugintype_param = new Command_Parameter('plugintype', 'enum', vmoodle_get_string('plugintypeparamsyncdesc', 'vmoodleadminset_plugins'), null, $plugintypes);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, array($platform_param, $plugintype_param));
 }
 /**
  * Constructor.
  * @throws Command_Exception.
  */
 public function __construct()
 {
     global $DB;
     // Getting command description
     $cmd_name = vmoodle_get_string('cmdcomparename', 'vmoodleadminset_roles');
     $cmd_desc = vmoodle_get_string('cmdcomparedesc', 'vmoodleadminset_roles');
     // Getting role parameter
     $roles = role_fix_names(get_all_roles(), \context_system::instance(), ROLENAME_ORIGINAL);
     $rolemenu = array();
     foreach ($roles as $r) {
         $rolemenu[$r->shortname] = $r->localname;
     }
     $role_param = new Command_Parameter('role', 'enum', vmoodle_get_string('roleparamcomparedesc', 'vmoodleadminset_roles'), null, $rolemenu);
     // Creating command.
     parent::__construct($cmd_name, $cmd_desc, $role_param);
 }
 /**
  * Constructor.
  * @throws Command_Exception.
  */
 function __construct()
 {
     global $DB;
     // Getting command description.
     $cmd_name = vmoodle_get_string('cmdallowsyncname', 'vmoodleadminset_roles');
     $cmd_desc = vmoodle_get_string('cmdallowsyncdesc', 'vmoodleadminset_roles');
     // Creating platform parameter
     $platform_param = new Command_Parameter('platform', 'enum', vmoodle_get_string('platformparamsyncdesc', 'vmoodleadminset_roles'), null, get_available_platforms());
     // Creating table parameter
     $tables['assign'] = vmoodle_get_string('assigntable', 'vmoodleadminset_roles');
     $tables['override'] = vmoodle_get_string('overridetable', 'vmoodleadminset_roles');
     $tables['switch'] = vmoodle_get_string('switchtable', 'vmoodleadminset_roles');
     $table_param = new Command_Parameter('table', 'enum', vmoodle_get_string('tableparamdesc', 'vmoodleadminset_roles'), null, $tables);
     // Creating role parameter
     $roles = role_fix_names(get_all_roles(), \context_system::instance(), ROLENAME_ORIGINAL);
     $rolemenu = array();
     foreach ($roles as $r) {
         $rolemenu[$r->shortname] = $r->localname;
     }
     $role_param = new Command_Parameter('role', 'enum', vmoodle_get_string('roleparamsyncdesc', 'vmoodleadminset_roles'), null, $rolemenu);
     // Creating command
     parent::__construct($cmd_name, $cmd_desc, array($platform_param, $table_param, $role_param));
 }
 /**
  * Constructor.
  * @param string $name Command's name.
  * @param string $description Command's description.
  * @param string $sql SQL command.
  * @param mixed $parameters Command's parameters (optional / could be null, Command_Parameter object or Command_Parameter array).
  * @param Command $rpcommand Retrieve platforms command (optional / could be null or Command object).
  * @throws Command_Exception
  */
 public function __construct($name, $description, $sqls, $parameters = null, $rpcommand = null)
 {
     global $vmcommands_constants;
     // Creating Command.
     parent::__construct($name, $description, $parameters, $rpcommand);
     // Checking SQL command
     if (empty($sqls)) {
         throw new Command_Sql_Exception('sqlemtpycommand', $this->name);
     } else {
         // Looking for parameters
         preg_match_all(Command::placeholder, $sqls, $sql_vars);
         // Checking parameters to show
         foreach ($sql_vars[2] as $key => $sql_var) {
             $is_param = !empty($sql_vars[1][$key]);
             if (!$is_param && !array_key_exists($sql_var, $vmcommands_constants)) {
                 throw new Command_Sql_Exception('sqlconstantnotgiven', (object) array('constant_name' => $sql_var, 'command_name' => $this->name));
             } elseif ($is_param && !array_key_exists($sql_var, $this->parameters)) {
                 throw new Command_Sql_Exception('sqlparameternotgiven', (object) array('parameter_name' => $sql_var, 'command_name' => $this->name));
             }
         }
         $this->sqls = $sqls;
     }
     $this->values = array();
 }
 /**
  * Constructor.
  * @param string $name Command's name.
  * @param string $description Command's description.
  * @param string $sql SQL command.
  * @param string $parameters Command's parameters (optional / could be null, Command_Parameter object or Command_Parameter array).
  * @param Command $rpcommand Retrieve platforms command (optional / could be null or Command object).
  * @throws Command_Exception
  */
 public function __construct($name, $description, $parameters = null, $rpcommand = null)
 {
     global $vmcommands_constants;
     // Creating Command.
     parent::__construct($name, $description, $parameters, $rpcommand);
 }