Example #1
0
 /**
  * Respond to get('schemes')
  * Respond to get('schemes/SCHEMENAME')
  *
  * @param $route
  * @return mixed
  * @throws Exception
  */
 public static function metaSchemes($route)
 {
     switch ($route) {
         case '':
             return parent::getSchemeNames();
         default:
             return parent::getScheme($route);
     }
     throw new Exception('One cannot get schemes/', $route);
 }
Example #2
0
 /**
  * Create routes for all schemes based on behavior
  */
 protected function _setupRoutes()
 {
     // default route for /
     $this->slim->get('/', array('One_Controller_Rest', 'defaultRouteHandler'));
     foreach (One_Repository::getSchemeNames() as $schemeName) {
         $scheme = One_Repository::getScheme($schemeName);
         if ($scheme->hasBehavior('restable')) {
             One_Behavior_Restable::slimSetup($this->slim, $scheme);
         }
     }
 }
Example #3
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  * @since  1.6
  */
 protected function getInput()
 {
     $doc = JFactory::getDocument();
     // find out which schemes are defined
     $schemeNames = One_Repository::getSchemeNames();
     sort($schemeNames);
     $options = array();
     foreach ($schemeNames as $schemeName) {
         $currScheme = One_Repository::getScheme($schemeName);
         if (!isset($currScheme->information['internal']) || isset($currScheme->information['menuonly'])) {
             $options[] = array("id" => $schemeName, "title" => $currScheme->get('info.title'));
         }
     }
     array_unshift($options, JHTML::_('select.option', '0', '- ' . JText::_('Select scheme') . ' -', 'id', 'title'));
     return JHTML::_('select.genericlist', $options, '' . $this->formControl . '[' . $this->group . '][' . $this->fieldname . ']', 'class="inputbox" ', 'id', 'title', $this->value, $this->formControl . $this->fieldname);
 }
Example #4
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     $this->schemes = array();
     $schemeNames = One_Repository::getSchemeNames();
     foreach ($schemeNames as $name) {
         $scheme = One_Repository::getScheme($name);
         if ($scheme->get('info.options.internal') != 'internal') {
             $group = $scheme->get('info.group', 'all');
             if (!isset($this->schemes[$group])) {
                 $this->schemes[$group] = array();
             }
             $this->schemes[$group][] = $scheme;
             $this->schemes['all'][] = $scheme;
         }
     }
     $this->groups = array_keys($this->schemes);
 }