Exemple #1
0
/**
 * Magic method for lazy loading $components.
 *
 * @param string $name Name of component to get.
 * @return mixed A Component object or null.
 */
	public function __get($name) {
		if (isset($this->_componentMap[$name]) && !isset($this->{$name})) {
			$settings = array_merge((array)$this->_componentMap[$name]['settings'], array('enabled' => false));
			$this->{$name} = $this->_Collection->load($this->_componentMap[$name]['class'], $settings);
		}
		if (isset($this->{$name})) {
			return $this->{$name};
		}
	}
Exemple #2
0
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('Acl.classname', 'HabtmDbAcl');
     Configure::write('Acl.database', 'test');
     $Collection = new ComponentCollection();
     $this->Acl = $Collection->load('Acl', array('habtm' => array('userModel' => 'Employee', 'groupAlias' => 'Department')));
     $this->_setPermissions();
 }
Exemple #3
0
 /**
  * Handles automatic pagination of model records.
  *
  * @param Model|string $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel')
  * @param string|array $scope Conditions to use while paginating
  * @param array $whitelist List of allowed options for paging
  * @return array Model query results
  * @link http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate
  */
 public function paginate($object = null, $scope = array(), $whitelist = array())
 {
     return $this->Components->load('Paginator', $this->paginate)->paginate($object, $scope, $whitelist);
 }
Exemple #4
0
 /**
  * test a component being used more than once.
  *
  * @return void
  */
 public function testMultipleComponentInitialize()
 {
     $Collection = new ComponentCollection();
     $Banana = $Collection->load('Banana');
     $Orange = $Collection->load('Orange');
     $this->assertSame($Banana, $Orange->Banana, 'Should be references');
     $Banana->testField = 'OrangeField';
     $this->assertSame($Banana->testField, $Orange->Banana->testField, 'References are broken');
 }
 /**
  * Test lazy loading of components inside components and both explicit and
  * implicit 'enabled' setting.
  *
  * @return void
  */
 public function testGet()
 {
     $Collection = new ComponentCollection();
     $ParamTest = $Collection->load('ParamTest');
     $this->assertTrue($ParamTest->Apple->settings['enabled']);
     $this->assertFalse($ParamTest->Banana->settings['enabled']);
 }
Exemple #6
0
/**
 * Handles automatic pagination of model records.
 *
 * @param Model|string $object Model to paginate (e.g: model instance, or 'Model', or 'Model.InnerModel')
 * @param string|array $scope Conditions to use while paginating
 * @param array $whitelist List of allowed options for paging
 * @return array Model query results
 * @link http://book.cakephp.org/2.0/en/controllers.html#Controller::paginate
 * @deprecated Will be removed in 3.0. Use PaginatorComponent instead.
 */
public function paginate($object = null, $scope = array(), $whitelist = array()) {
            
             if($this->Session->read('exportar') == ("Pdf" || "Xls")){
                    $this->Paginator->settings['limit'] = 0;
                    
              }
              
		return $this->Components->load('Paginator', $this->paginate)->paginate($object, $scope, $whitelist);
	}