Пример #1
0
	public function render($tpl, $app = false, $base = 'base')
	{
		if ($base == 'base' && $app == false)
		{
			CoOrg::loadPluginInfo('admin');
			$this->_adminTabs = Admin::tabs($this->_adminModule, $this->_adminTab);

			parent::render($tpl, false, 'base.html.tpl|'.Controller::getTemplatePath('admin.html.tpl', 'admin'));
		}
		else
		{
			parent::render($tpl, $app, $base);
		}
	}
Пример #2
0
	public static function owns($user, $object)
	{
		CoOrg::loadPluginInfo('acl');
		$class = get_class($object);
		while ($class && ! array_key_exists($class, self::$_ownerMethods)) {
			$class = get_parent_class($class);
		}
		if ($class)
		{
			return self::$_ownerMethods[$class]->owns($user, $object);
		}
		else
		{
			return false;
		}
	}
Пример #3
0
	public function __set($name, $value)
	{
		if ($name == 'entryID')
		{
			$p = explode('/', $value, 3);
			
			CoOrg::loadPluginInfo('menu');
			if (!class_exists($p[0]))
			{
				$this->entryID_error = t('Provider not found');
				return;
			}
			
			$this->provider = $p[0];
			if (count($p) > 1)
			{
				$this->action = $p[1];
				
				if (count($p) > 2)
				{
					$this->data = $p[2];
				}
				else
				{
					$this->data = null;
				}
				$this->url = call_user_func(array($p[0], 'url'), $this->action, $this->language, $this->data);
			}
			else
			{
				$this->action = 'do';
				$this->url = call_user_func(array($p[0], 'url'), $this->data, $this->language);
			}
		}
		parent::__set($name, $value);
	}
Пример #4
0
	public function testMenuIntegration()
	{
		CoOrg::loadPluginInfo('menu', 'page');
		
		$this->assertEquals(array('show', 'create'),
		                    array_keys(PageMenuEntryProvider::listActions()));

		$this->assertNull(PageMenuEntryProvider::listData('create', 'en'));
		
		$pages = PageMenuEntryProvider::listData('show', 'en');
		$this->assertEquals(3, count($pages));
		$this->assertEquals('Some Page', $pages['some-page']);
		$this->assertEquals('AA BB CC', $pages['aabbcc']);
		$this->assertEquals('Tidelodoo', $pages['tidelodoo']);
		
		$pages = PageMenuEntryProvider::listData('show', 'nl');
		$this->assertEquals(2, count($pages));
		$this->assertEquals('Tidelodoe', $pages['tidelodoe']);
		$this->assertEquals('AA BB CC', $pages['aabbcc']);
	}
Пример #5
0
	public static function searches()
	{
		CoOrg::loadPluginInfo('search');
		return self::$_searches;
	}
Пример #6
0
	public static function selectNodes($tag, $language)
	{
		CoOrg::loadPluginInfo('search');
		$results = array();
		foreach (self::$_searches as $table => $r)
		{
			$r->results = SearchHack::callStatic($table, 'tagged', array($tag, $language));
			$results[] = $r;
		}
		return $results;
	}
Пример #7
0
	public static function needsWidget($request)
	{
		CoOrg::loadPluginInfo('flattr');
		return array_key_exists($request, self::$_requests);
	}
Пример #8
0
	public function testLoadPluginInfoSpecific()
	{
		$this->assertFalse(class_exists('Alpha2Info'));
		$this->assertFalse(class_exists('Home2Info'));
		
		CoOrg::loadPluginInfo('info2', 'home');
		
		$this->assertFalse(class_exists('Alpha2Info'));
		$this->assertTrue(class_exists('Home2Info'));
		
		CoOrg::loadPluginInfo('info2', 'sub'); // Sub does not have an info2
		CoOrg::loadPluginInfo('info2', 'home');
	}
Пример #9
0
	public static function modules()
	{
		$session = UserSession::get();
		if ($session)
		{
			$user = $session->user();
			if (!Acl::isAllowed($user->username, 'admin'))
			{
				return null;
			}
		}
		else
		{
			return null;
		}	
		
		CoOrg::loadPluginInfo('admin');
		$modules = array();
		foreach (self::$_modules as $m)
		{
			if ($m->isAllowed($user))
			{
				$modules[] = $m;
			}
		}
		usort($modules, array('Admin', 'cmpModule'));
		return $modules;
	}