Пример #1
0
 /**
  * Constructor
  * Loads points configuration
  *
  * @return  object
  */
 public static function values()
 {
     $pc = self::all()->rows();
     $config = new Object();
     foreach ($pc as $p) {
         $config->set($p->get('alias'), $p->get('points'));
     }
     return $config;
 }
Пример #2
0
 /**
  * Gets a list of the actions that can be performed.
  *
  * @return  object  Object
  */
 public static function getActions()
 {
     $assetName = self::$extension;
     $actions = \JAccess::getActions($assetName);
     $result = new Object();
     foreach ($actions as $action) {
         $result->set($action->name, User::authorise($action->name, $assetName));
     }
     return $result;
 }
Пример #3
0
 /**
  * Gets a list of the actions that can be performed.
  *
  * @param   string   $extension  The extension.
  * @param   integer  $assetId    The asset ID.
  * @return  object   Object
  */
 public static function getActions($assetType = 'component', $assetId = 0)
 {
     $assetName = self::$extension;
     if ($assetId) {
         $assetName .= '.' . (int) $assetId;
     }
     $result = new Object();
     $actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
     foreach ($actions as $action) {
         $result->set($action, User::authorise($action, $assetName));
     }
     return $result;
 }
Пример #4
0
 /**
  * Gets a list of the actions that can be performed.
  *
  * @param   string   $extension  The extension.
  * @param   integer  $assetId    The category ID.
  * @return  object
  */
 public static function getActions($assetType = 'component', $assetId = 0)
 {
     $assetName = self::$extension;
     $assetName .= '.' . $assetType;
     if ($assetId) {
         $assetName .= '.' . (int) $assetId;
     }
     $user = \User::getInstance();
     $result = new Object();
     $actions = array('admin', 'manage', 'create', 'edit', 'edit.state', 'delete');
     foreach ($actions as $action) {
         $result->set('core.' . $action, $user->authorise('core.' . $action, $assetName));
     }
     return $result;
 }
Пример #5
0
 /**
  * Get the allowed actions for an identity.
  *
  * @param   mixed  $identity  An integer representing the identity or an array of identities
  * @return  object  Allowed actions for the identity or identities
  */
 public function getAllowed($identity)
 {
     // Sweep for the allowed actions.
     $allowed = new Object();
     foreach ($this->data as $name => &$action) {
         if ($action->allow($identity)) {
             $allowed->set($name, true);
         }
     }
     return $allowed;
 }
Пример #6
0
 /**
  * Returns an array of standard published state filter options.
  *
  * @return  object
  */
 public function parseXMLTemplateFile($templateBaseDir, $templateDir)
 {
     $data = new Object();
     // Check of the xml file exists
     $filePath = Filesystem::cleanPath($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml');
     if (is_file($filePath)) {
         $xml = \JInstaller::parseXMLInstallFile($filePath);
         if ($xml['type'] != 'template') {
             return false;
         }
         foreach ($xml as $key => $value) {
             $data->set($key, $value);
         }
     }
     return $data;
 }
Пример #7
0
 /**
  * Test setting a default value if not alreay assigned
  *
  * @covers  \Hubzero\Base\Object::def
  * @return  void
  **/
 public function testDef()
 {
     $obj = new Object();
     $obj->def('bar', 'ipsum');
     $this->assertEquals($obj->get('bar'), 'ipsum');
     $obj->set('foo', 'bar');
     $obj->def('foo', 'lorem');
     $this->assertEquals($obj->get('foo'), 'bar');
 }
Пример #8
0
 /**
  * Modifies a property of the object, creating it if it does not already exist.
  *
  * @param   string  $property  The name of the property
  * @param   mixed   $value     The value of the property to set
  * @return  mixed   Previous value of the property
  */
 public function set($property, $value = null)
 {
     if ($property == 'scope') {
         $this->_scope = $value;
         return $this;
     }
     if ($property == 'scope_id') {
         $this->_scope_id = $value;
         return $this;
     }
     return parent::set($property, $value);
 }