Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev Added widgets for the admin menu, flash message and the javascrip…
…t object.
- Loading branch information
Showing
11 changed files
with
879 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
Yii::import('zii.widgets.grid.CGridColumn'); | ||
class CallbackColumn extends CGridColumn | ||
{ | ||
|
||
public $label; | ||
|
||
public $url; | ||
|
||
public function renderDataCellContent($row, $data) | ||
{ | ||
if (isset($this->label) && is_callable($this->label)) | ||
{ | ||
$text = call_user_func($this->label, $data); | ||
} | ||
else | ||
{ | ||
$text = $data[$this->label]; | ||
} | ||
// Create link. | ||
if (isset($this->url)) | ||
{ | ||
if (is_callable($this->url)) | ||
{ | ||
$url = call_user_func($this->url, $data); | ||
} | ||
else | ||
{ | ||
$url = $this->url; | ||
} | ||
echo CHtml::link($text, $url); | ||
} | ||
else | ||
{ | ||
echo $text; | ||
} | ||
|
||
|
||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
class FlashMessage extends CWidget { | ||
public function run() { | ||
if (!empty(App()->session['flashmessage']) && Yii::app()->session['flashmessage'] != '') | ||
{ | ||
$message = App()->session['flashmessage']; | ||
$key = 'session'; | ||
unset(App()->session['flashmessage']); | ||
$this->render('message', compact('key', 'message')); | ||
} | ||
foreach(Yii::app()->user->getFlashes() as $key => $message) | ||
{ | ||
$this->render('message', compact('key', 'message')); | ||
} | ||
|
||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div id="flash-<?php echo $key; ?>"class="flashmessage" style="display:none;"> | ||
|
||
<div id="themeroller" class="ui-state-highlight ui-corner-all"> | ||
<!-- close link --> | ||
<a class="ui-notify-close" href="#"> | ||
<span class="ui-icon ui-icon-close" style="float:right"> </span> | ||
</a> | ||
|
||
<!-- alert icon --> | ||
<span style="float:left; margin:2px 5px 0 0;" class="ui-icon ui-icon-info"> </span> | ||
<p><?php echo $message; ?></p><br> | ||
</div> | ||
|
||
<!-- other templates here, maybe.. --> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
Yii::import('zii.widgets.grid.CGridView'); | ||
class GridViewWidget extends CGridView | ||
{ | ||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
*/ | ||
class LimeScript extends CWidget | ||
{ | ||
public function run() | ||
{ | ||
$data = array(); | ||
$data['baseUrl'] = Yii::app()->getBaseUrl(true); | ||
$data['showScriptName'] = Yii::app()->urlManager->showScriptName; | ||
$data['urlFormat'] = Yii::app()->urlManager->urlFormat; | ||
$data['layoutPath'] = Yii::app()->getLayoutPath(); | ||
$data['adminImageUrl'] = Yii::app()->getConfig('adminimageurl'); | ||
$data['replacementFields']['path'] = App()->createUrl("admin/limereplacementfields/sa/index/"); | ||
$this->render('script', compact('data')); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Initial definition of Limesurvey javascript object. | ||
var LS = {}; | ||
|
||
LS.createUrl = function (route, params) | ||
{ | ||
if (typeof params === 'undefined') { | ||
params = {}; | ||
} | ||
var result = LS.data.baseUrl; | ||
|
||
if (LS.data.showScriptName) | ||
{ | ||
result = result + '/index.php'; | ||
} | ||
|
||
|
||
if (LS.data.urlFormat == 'get') | ||
{ | ||
// Configure route. | ||
result += '?r=' + route; | ||
|
||
// Configure params. | ||
for (var key in params) | ||
{ | ||
result = result + '&' + key+ '=' + params[key]; | ||
} | ||
} | ||
else | ||
{ | ||
// Configure route. | ||
result += route; | ||
|
||
// Configure params. | ||
for (var key in params) | ||
{ | ||
result = result + '/' + key + '/' + params[key]; | ||
} | ||
} | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
$json = json_encode($data, JSON_FORCE_OBJECT); | ||
echo "LS.data = $json"; | ||
App()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(Yii::getPathOfAlias('ext.LimeScript.assets'). '/script.js')); | ||
?> |
Oops, something went wrong.