Skip to content

Commit

Permalink
Dev: Add Cint logo to menu items (CintLink)
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jul 28, 2016
1 parent 89a9fb5 commit 500597b
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 1 deletion.
51 changes: 50 additions & 1 deletion application/core/plugins/CintLink/CintLink.php
Expand Up @@ -49,6 +49,7 @@ public function init()
$this->subscribe('beforeActivate');
$this->subscribe('beforeAdminMenuRender');
$this->subscribe('beforeToolsMenuRender');
$this->subscribe('afterQuickMenuLoad');
$this->subscribe('newDirectRequest');

// Login session key from com_api at limesurvey.org
Expand Down Expand Up @@ -130,7 +131,7 @@ public function beforeToolsMenuRender()

$menuItem = new MenuItem(array(
'label' => $this->gT('CintLink'),
'iconClass' => 'fa fa-table',
'iconClass' => 'cintlink-icons cinticon',
'href' => $href
));

Expand Down Expand Up @@ -164,6 +165,54 @@ public function beforeAdminMenuRender()
));
}

/**
* Add quick menu icon
*/
public function afterQuickMenuLoad()
{
// Do nothing if QuickMenu plugin is not active
$quickMenuExistsAndIsActive = $this->api->pluginExists('QuickMenu')
&& $this->api->pluginIsActive('QuickMenu');
if (!$quickMenuExistsAndIsActive)
{
return;
}

$event = $this->getEvent();
$settings = $this->getPluginSettings(true);

$data = $event->get('aData');
$activated = $data['activated'];
$surveyId = $data['surveyid'];

$href = Yii::app()->createUrl(
'admin/pluginhelper',
array(
'sa' => 'sidebody',
'plugin' => 'CintLink',
'method' => 'actionIndex',
'surveyId' => $surveyId
)
);

$button = new QuickMenuButton(array(
'name' => 'cintLink',
'href' => $href,
'tooltip' => $this->gT('CintLink'),
'iconClass' => 'cintlink-icons cinticon',
'neededPermission' => array('surveycontent', 'update')
));
$db = Yii::app()->db;
$userId = Yii::app()->user->getId();
$orderings = QuickMenu::getOrder($userId);
if (isset($orderings['cintLink']))
{
$button->setOrder($orderings['cintLink']);
}

$event->append('quickMenuItems', array($button));
}

/**
* @return string
*/
Expand Down
19 changes: 19 additions & 0 deletions application/core/plugins/CintLink/css/cintlink.css
Expand Up @@ -21,3 +21,22 @@
.cintlink-completed-check-column {
width: 20px;
}

@font-face {
font-family: 'CintFont';
src: url('icomoon.eot?gsq6lm');
src: url('icomoon.eot?gsq6lm#iefix') format('embedded-opentype'),
url('icomoon.ttf?gsq6lm') format('truetype'),
url('icomoon.woff?gsq6lm') format('woff'),
url('icomoon.svg?gsq6lm#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}

.cintlink-icons {
font: normal normal normal 14px/1 'CintFont';
}

.cinticon:before {
content: '\e900';
}
Binary file not shown.
11 changes: 11 additions & 0 deletions application/core/plugins/CintLink/css/icomoon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added application/core/plugins/CintLink/css/icomoon.ttf
Binary file not shown.
Binary file not shown.

0 comments on commit 500597b

Please sign in to comment.