1 <?php
2
3 class RAssignmentDataProvider extends CActiveDataProvider
4 {
5 /**
6 * @property RAuthorizer
7 */
8 private $_authorizer;
9
10 /**
11 * Constructor.
12 * (e.g. <code>Post::model()</code>, <code>Post::model()->published()</code>).
13 * @param array $config configuration (name=>value) to be applied as the initial property values of this class.
14 */
15 public function __construct($config=array())
16 {
17 $module = Rights::module();
18 $userClass = $module->userClass;
19 parent::__construct($userClass, $config);
20
21 $this->_authorizer = $module->getAuthorizer();
22 }
23
24 /**
25 * Fetches the data from the persistent data storage.
26 * @return array list of data items
27 */
28 protected function fetchData()
29 {
30 $data = parent::fetchData();
31
32 foreach( $data as $model )
33 $this->_authorizer->attachUserBehavior($model);
34
35 return $data;
36 }
37 }