Skip to content

Commit

Permalink
Dev: First try with gridview in dashboard (CintLink)
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jul 27, 2016
1 parent 696180d commit 38eedf2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
20 changes: 19 additions & 1 deletion application/core/plugins/CintLink/CintLink.php
Expand Up @@ -224,8 +224,13 @@ protected function registerCssAndJs() {
App()->clientScript->registerScriptFile("$assetsUrl/cintlink.js");
App()->clientScript->registerScriptFile("http://" . $this->cintApiKey . ".cds.cintworks.net/assets/cint-link-1-0-0.js");

// Need to include this manually so Ajax loading of gridview will work
App()->clientScript->registerScriptFile('/framework/zii/widgets/assets/gridview/jquery.yiigridview.js');
App()->clientScript->registerScriptFile('/framework/web/js/source/jquery.ba-bbq.min.js');

$assetsUrl = Yii::app()->assetManager->publish(dirname(__FILE__) . '/css');
App()->clientScript->registerCssFile("$assetsUrl/cintlink.css");

}

/**
Expand Down Expand Up @@ -329,13 +334,26 @@ public function getGlobalDashboard()
$data = array();
$data['orders'] = $orders;
$data['user'] = Yii::app()->user;
$data['model'] = CintLinkOrder::model();
$data['dateformatdata'] = getDateFormatData(Yii::app()->session['dateformat']);

$content = $this->renderPartial('dashboard', $data, true);
$content = $this->renderPartial('global_dashboard', $data, true, true);

return $content;
}

/**
* gridview stuff
*/
public function renderClientScripts()
{
foreach (Yii::app()->clientScript->scripts as $index=>$script)
{
echo CHtml::script(implode("\n",$script));
}
Yii::app()->clientScript->reset();
}

/**
* Login to limesurvey.org using com_api
*
Expand Down
26 changes: 26 additions & 0 deletions application/core/plugins/CintLink/model/CintLinkOrder.php
Expand Up @@ -39,4 +39,30 @@ public function relations()
);
}

/**
* Search method provided to TbGridView widget
* @return CActiveDataProvider
*/
public function search()
{
$pageSize = Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);

$sort = new CSort();
$sort->attributes = array(
'url'=>array(
'desc'=>'url desc'
));

$dataProvider = new CActiveDataProvider('CintLinkOrder', array(
'sort' => $sort,
'pagination' => array(
'pageSize' => $pageSize,
),
));

return $dataProvider;

}

}

0 comments on commit 38eedf2

Please sign in to comment.