render() public method

Renders the HTML snippet of the Dashboard.
public render ( ) : mixed
return mixed
Esempio n. 1
0
 public function testRender_correct()
 {
     $first_db = array('title' => 'first', 'content' => 'first render');
     $second_db = array('title' => 'second', 'content' => 'second render');
     // two different module APIs for dashboard generation
     $first = $this->getMockBuilder('BaseAPI')->disableOriginalConstructor()->setMethods(array('renderDashboard'))->getMock();
     $second = $this->getMockBuilder('BaseAPI')->disableOriginalConstructor()->setMethods(array('renderDashboard'))->getMock();
     // static render values for these mock apis
     $first->expects($this->any())->method('renderDashboard')->will($this->returnValue($first_db));
     $second->expects($this->any())->method('renderDashboard')->will($this->returnValue($second_db));
     // return the appropriate module api mocks
     $this->moduleAPI->expects($this->any())->method('get')->will($this->returnValueMap(array(array('firstModule', $first), array('secondModule', $second))));
     $user = $this->getMock('OEWebUser', array('checkAccess'));
     // alternate restriction to test impact
     $user->expects($this->at(0))->method('checkAccess')->with('onlysecond')->will($this->returnValue(false));
     $user->expects($this->at(1))->method('checkAccess')->with('onlysecond')->will($this->returnValue(true));
     $test = new DashboardHelper(array(array('module' => 'firstModule'), array('restricted' => array('onlysecond'), 'module' => 'secondModule')), $user);
     $this->controller->expects($this->at(0))->method('renderPartial')->with($this->anything(), array('items' => array($first_db), 'sortable' => false), true, false)->will($this->returnValue('first render'));
     $this->controller->expects($this->at(1))->method('renderPartial')->with($this->anything(), array('items' => array($first_db, $second_db), 'sortable' => true), true, false)->will($this->returnValue('first rendersecond render'));
     $this->assertEquals('first render', $test->render());
     $test->sortable = true;
     $this->assertEquals('first rendersecond render', $test->render());
 }
Esempio n. 2
0
?>
            </div>
            <div class="large-3 column text-right">
                <img class="loader" src="<?php 
echo Yii::app()->assetManager->createUrl('img/ajax-loader.gif');
?>
"
                     alt="loading..." style="margin-right: 10px; display: none;"/>
                <button type="submit" class="primary long">
                    Search
                </button>
            </div>
        </div>

        <?php 
$this->endWidget();
?>

        <div id="dashboard">
            <?php 
$dashboardHelper = new DashboardHelper();
echo $dashboardHelper->render();
?>
        </div>
    </div>
</div>

<script type="text/javascript">
    handleButton($('#search-form button'));
</script>